Skip to content

Commit

Permalink
Revert discard to using "none" bytecode
Browse files Browse the repository at this point in the history
Avoids incompatibility issues
  • Loading branch information
ryn5 committed Dec 7, 2023
1 parent ae6bc6f commit 4eaba06
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private Symbols() {
}

public static final String profile = "profile";
public static final String discard = "discard";
public static final String discard = "none";
public static final String none = "none";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void setup() {
@Test
public void shouldParseTraversalMethod_discard() {
compare(g.V().discard(), eval("g.V().discard()"));
compare(g.V().union(__.identity().discard()), eval("g.V().union(__.identity().discard())"));
compare(g.V().union(__.identity().discard()), eval("g.V().union(__.identity().none())"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public bool HasNext()
/// <returns>The fully drained traversal.</returns>
public ITraversal<TStart, TEnd> Iterate()
{
Bytecode.AddStep("discard");
Bytecode.AddStep("none");
while (MoveNext())
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ public GraphTraversal<TStart, TEnd> Difference (object differenceObject)
/// </summary>
public GraphTraversal<TStart, TEnd> Discard ()
{
Bytecode.AddStep("discard");
Bytecode.AddStep("none");
return Wrap<TStart, TEnd>(this);
}

Expand Down
2 changes: 1 addition & 1 deletion gremlin-go/driver/graphTraversal.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func (g *GraphTraversal) Difference(args ...interface{}) *GraphTraversal {

// Discard adds the discard step to the GraphTraversal.
func (g *GraphTraversal) Discard(args ...interface{}) *GraphTraversal {
g.Bytecode.AddStep("discard", args...)
g.Bytecode.AddStep("none", args...)
return g
}

Expand Down
2 changes: 1 addition & 1 deletion gremlin-go/driver/traversal.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (t *Traversal) Iterate() <-chan error {
return
}

if err := t.Bytecode.AddStep("discard"); err != nil {
if err := t.Bytecode.AddStep("none"); err != nil {
r <- err
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ class GraphTraversal extends Traversal {
* @returns {GraphTraversal}
*/
discard(...args) {
this.bytecode.addStep('discard', args);
this.bytecode.addStep('none', args);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Traversal {
* @returns {Promise}
*/
iterate() {
this.bytecode.addStep('discard');
this.bytecode.addStep('none');
return this._applyStrategies().then(() => {
let it;
while ((it = this._getNext()) && !it.done) {
Expand Down
2 changes: 1 addition & 1 deletion gremlin-language/src/main/antlr4/Gremlin.g4
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,7 @@ traversalTerminalMethod_toBulkSet
;

traversalSelfMethod_discard
: 'discard' LPAREN RPAREN
: 'none' LPAREN RPAREN
;

traversalSelfMethod_none
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ def difference(self, *args):
return self

def discard(self, *args):
self.bytecode.add_step("discard", *args)
self.bytecode.add_step("none", *args)
return self

def disjunct(self, *args):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def to_set(self):
return set(iter(self))

def iterate(self):
self.bytecode.add_step("discard")
self.bytecode.add_step("none")
while True:
try: self.next_traverser()
except StopIteration: return self
Expand Down

0 comments on commit 4eaba06

Please sign in to comment.