[Pkg-javascript-commits] [node-acorn-jsx] 64/484: create node 'class' - improve v8 performance

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:20:05 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-acorn-jsx.

commit c8eb50fabe1bf124a1cbd93c702516245ca8e80b
Author: Alistair Braidwood <alistair_braidwood at yahoo.co.uk>
Date:   Fri Dec 21 08:23:38 2012 +0000

    create node 'class' - improve v8 performance
---
 acorn.js | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/acorn.js b/acorn.js
index bbe56c7..1ccd4d5 100644
--- a/acorn.js
+++ b/acorn.js
@@ -881,14 +881,26 @@
   // Start an AST node, attaching a start offset and optionally a
   // `commentsBefore` property to it.
 
+  var node_t = function(s) {
+    this.type=null;
+    this.start=tokStart;
+    this.end=null;
+  };
+
+  var node_loc_t = function(s) {
+    this.start=tokStartLoc;
+    this.end=null;
+  };
+  node_loc_t.prototype.source=sourceFile;
+
   function startNode() {
-    var node = {type: null, start: tokStart, end: null};
+    var node = new node_t();
     if (options.trackComments && tokCommentsBefore) {
       node.commentsBefore = tokCommentsBefore;
       tokCommentsBefore = null;
     }
     if (options.locations)
-      node.loc = {start: tokStartLoc, end: null, source: sourceFile};
+      node.loc = new node_loc_t();
     if (options.ranges)
       node.range = [tokStart, 0];
     return node;
@@ -900,13 +912,16 @@
   // already been parsed.
 
   function startNodeFrom(other) {
-    var node = {type: null, start: other.start};
+    var node = new node_t();
+    node.start = other.start;
     if (other.commentsBefore) {
       node.commentsBefore = other.commentsBefore;
       other.commentsBefore = null;
     }
-    if (options.locations)
-      node.loc = {start: other.loc.start, end: null, source: other.loc.source};
+    if (options.locations) {
+      node.loc = new node_loc_t();
+      node.loc.start = other.loc.start;//{start: other.loc.start, end: null, source: other.loc.source};
+    }
     if (options.ranges)
       node.range = [other.range[0], 0];
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git



More information about the Pkg-javascript-commits mailing list