Skip to content

Commit

Permalink
fix feature test
Browse files Browse the repository at this point in the history
  • Loading branch information
Cole-Greer committed Nov 28, 2024
1 parent 6a8d0de commit 24d73b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1250,15 +1250,16 @@ public Traversal visitTraversalMethod_option_Merge_Map_Cardinality(final Gremlin
return this.graphTraversal.option(TraversalEnumParser.parseTraversalEnumFromContext(Merge.class, ctx.traversalMerge()), (Map) null);
}

if (ctx.genericLiteralMapNullableArgument().variable() != null) {
final Object literalOrVar = antlr.argumentVisitor.visitGenericLiteralMapNullableArgument(ctx.genericLiteralMapNullableArgument());
if (GValue.valueInstanceOf(literalOrVar, GType.MAP)) {
return graphTraversal.option(TraversalEnumParser.parseTraversalEnumFromContext(Merge.class, ctx.traversalMerge()),
(Map) antlr.argumentVisitor.visitVariable(ctx.genericLiteralMapNullableArgument().variable()),
(GValue<Map<Object, Object>>) literalOrVar,
TraversalEnumParser.parseTraversalEnumFromContext(Cardinality.class, ctx.traversalCardinality()));
} else {
return graphTraversal.option(TraversalEnumParser.parseTraversalEnumFromContext(Merge.class, ctx.traversalMerge()),
(Map<Object, Object>) literalOrVar,
TraversalEnumParser.parseTraversalEnumFromContext(Cardinality.class, ctx.traversalCardinality()));
}

return graphTraversal.option(TraversalEnumParser.parseTraversalEnumFromContext(Merge.class, ctx.traversalMerge()),
(Map) new GenericLiteralVisitor(antlr).visitGenericLiteralMap(ctx.genericLiteralMapNullableArgument().genericLiteralMap()),
TraversalEnumParser.parseTraversalEnumFromContext(Cardinality.class, ctx.traversalCardinality()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4554,14 +4554,6 @@ public default <M, E2> GraphTraversal<S, E> option(final M token, final GValue<M
public default <M, E2> GraphTraversal<S, E> option(final Merge merge, final GValue<Map<Object, Object>> m, final VertexProperty.Cardinality cardinality) {
this.asAdmin().getGremlinLang().addStep(GraphTraversal.Symbols.option, merge, m, cardinality);

final Map<Object, Object> map = m.get();

// do explicit cardinality for every single pair in the map
for (Object k : map.keySet()) {
final Object o = map.get(k);
if (!(o instanceof CardinalityValueTraversal))
map.put(k, new CardinalityValueTraversal(cardinality, o));
}
((TraversalOptionParent<M, E, E2>) this.asAdmin().getEndStep()).addChildOption((M) merge, (Traversal.Admin<E, E2>) new ConstantTraversal<>(m).asAdmin());
return this;
}
Expand Down

0 comments on commit 24d73b8

Please sign in to comment.