You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2018/10/05 12:37:05 UTC

[04/10] tinkerpop git commit: Fixed issue where eval was added to wrong class in GraphTravesal

Fixed issue where eval was added to wrong class in GraphTravesal


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/3f87545f
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/3f87545f
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/3f87545f

Branch: refs/heads/TINKERPOP-1959
Commit: 3f87545f47c8ab36a2c9ed4041029c5a038c2be8
Parents: 090f139
Author: Matthew Allen <ma...@runbox.com>
Authored: Mon Aug 27 09:52:49 2018 +0100
Committer: Matthew Allen <ma...@runbox.com>
Committed: Mon Aug 27 09:52:49 2018 +0100

----------------------------------------------------------------------
 .../glv/GraphTraversalSource.template           | 23 +++++++++----------
 .../lib/process/graph-traversal.js              | 24 +++++++++-----------
 .../gremlin-javascript/lib/process/traversal.js |  3 +--
 .../test/integration/traversal-test.js          |  2 +-
 4 files changed, 24 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3f87545f/gremlin-javascript/glv/GraphTraversalSource.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/GraphTraversalSource.template b/gremlin-javascript/glv/GraphTraversalSource.template
index e48dd67..1d3dd5d 100644
--- a/gremlin-javascript/glv/GraphTraversalSource.template
+++ b/gremlin-javascript/glv/GraphTraversalSource.template
@@ -84,6 +84,17 @@ class GraphTraversalSource {
     return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
   }
   <% } %>
+
+
+  /**
+   * Send a Gremlin-Groovy script to the server. If a script is not passed in 
+   * then the bytecode instructions will be converted to a script and sent.
+   * @param {string} script The script to send to server
+   * @param {array} bindings Map of bindings
+   */
+  eval(script, bindings) {
+    return (new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), new Bytecode(this.bytecode))).eval(script, bindings);
+  }
 }
 
 /**
@@ -104,18 +115,6 @@ class GraphTraversal extends Traversal {
     return this;
   }
   <% } %>
-
-
-  /**
-   * Send a Gremlin-Groovy script to the server. If a script is not passed in 
-   * then the bytecode instructions will be converted to a script and sent.
-   * @param {string} script The script to send to server
-   * @param {array} bindings Map of bindings
-   */
-  eval(script, bindings) {
-    this.bytecode.addStep('eval', [ script, bindings ]);
-    return this._applyStrategies().then(() => this._getNext());
-  }
 }
 
 function callOnEmptyTraversal(fnName, args) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3f87545f/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
index d2a0faf..08cbb01 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
@@ -162,6 +162,17 @@ class GraphTraversalSource {
     return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
   }
   
+
+
+  /**
+   * Send a Gremlin-Groovy script to the server. If a script is not passed in 
+   * then the bytecode instructions will be converted to a script and sent.
+   * @param {string} script The script to send to server
+   * @param {array} bindings Map of bindings
+   */
+  eval(script, bindings) {
+    return (new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), new Bytecode(this.bytecode))).eval(script, bindings);
+  }
 }
 
 /**
@@ -1152,19 +1163,6 @@ class GraphTraversal extends Traversal {
     return this;
   }
   
-
-
-  /**
-   * Send a Gremlin-Groovy script to the server. If a script is not passed in 
-   * then the bytecode instructions will be converted to a script and sent.
-   * @param {string} gremlinScript The script to send to server
-   * @param {array} bindings Map of bindings
-   * @param {*} options Options to configure the script sending
-   */
-  eval(script, bindings) {
-    this.bytecode.addStep('eval', [ script, bindings ]);
-    return this._applyStrategies().then(() => this._getNext());
-  }
 }
 
 function callOnEmptyTraversal(fnName, args) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3f87545f/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
index e84d251..df74548 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
@@ -81,9 +81,8 @@ class Traversal {
   /**
    * Send a Gremlin-Groovy script to the server. If a script is not passed in 
    * then the bytecode instructions will be converted to a script and sent.
-   * @param {string} gremlinScript The script to send to server
+   * @param {string} script The script to send to server
    * @param {array} bindings Map of bindings
-   * @param {*} options Options to configure the script sending
    */
   eval(script, bindings) {
     this.bytecode.addStep('eval', [ script, bindings ]);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3f87545f/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
index 9d5af16..cfdc4f0 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/traversal-test.js
@@ -78,7 +78,7 @@ describe('Traversal', function () {
 
     it('should submit a script and bindings and return a result', function() {
       var g = new Graph().traversal().withRemote(connection);
-      return g.V().eval('g.V().has(\'name\', name)', { name: 'marko' }).then(function (item) {
+      return g.eval('g.V(v1)', { v1: 1 }).then(function (item) {
         assert.ok(item);
         assert.ok(item.value instanceof Vertex);
       });