From commits-return-32911-archive-asf-public=cust-asf.ponee.io@tinkerpop.apache.org Mon Oct 8 21:02:07 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id BCF4C18076D for ; Mon, 8 Oct 2018 21:02:06 +0200 (CEST) Received: (qmail 40879 invoked by uid 500); 8 Oct 2018 19:02:05 -0000 Mailing-List: contact commits-help@tinkerpop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tinkerpop.apache.org Delivered-To: mailing list commits@tinkerpop.apache.org Received: (qmail 40848 invoked by uid 99); 8 Oct 2018 19:02:05 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Oct 2018 19:02:05 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 1631382C90; Mon, 8 Oct 2018 19:02:05 +0000 (UTC) Date: Mon, 08 Oct 2018 19:02:08 +0000 To: "commits@tinkerpop.apache.org" Subject: [tinkerpop] 04/12: Fixed issue where eval was added to wrong class in GraphTravesal MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: spmallette@apache.org In-Reply-To: <153902532482.18441.5724402075294112878@gitbox.apache.org> References: <153902532482.18441.5724402075294112878@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: tinkerpop X-Git-Refname: refs/heads/TINKERPOP-1959-tp33 X-Git-Reftype: branch X-Git-Rev: 9f4cfc7bdbcf74fafb73a3a7de31f4fd01a591e6 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20181008190205.1631382C90@gitbox.apache.org> This is an automated email from the ASF dual-hosted git repository. spmallette pushed a commit to branch TINKERPOP-1959-tp33 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 9f4cfc7bdbcf74fafb73a3a7de31f4fd01a591e6 Author: Matthew Allen AuthorDate: Mon Aug 27 09:52:49 2018 +0100 Fixed issue where eval was added to wrong class in GraphTravesal --- .../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(-) 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) { 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 aa0259b..c73405e 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 @@ -172,6 +172,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); + } } /** @@ -1132,19 +1143,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) { 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 d8a0761..9b88232 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 ]); 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); });