[Pkg-javascript-commits] [node-acorn-jsx] 299/484: Make parse_dammit honour the 'ranges' option

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:20:46 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 ad69446c0a95d58804f12d63785b160ac93d2760
Author: Mike Rennie <Michael_Rennie at ca.ibm.com>
Date:   Thu Oct 9 13:12:02 2014 -0500

    Make parse_dammit honour the 'ranges' option
    
    Closes #140
---
 acorn_loose.js | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/acorn_loose.js b/acorn_loose.js
index 6344792..d94fb46 100644
--- a/acorn_loose.js
+++ b/acorn_loose.js
@@ -209,6 +209,8 @@
       node.loc = new SourceLocation();
     if (options.directSourceFile)
       node.sourceFile = options.directSourceFile;
+    if (options.ranges)
+      node.range = [token.start, 0];
     return node;
   }
 
@@ -226,6 +228,8 @@
     }
     if (options.directSourceFile)
       node.sourceFile = options.directSourceFile;
+    if (options.ranges)
+      node.range = [pos[0], 0];
     return node;
   }
 
@@ -234,24 +238,15 @@
     node.end = lastEnd;
     if (options.locations)
       node.loc.end = lastEndLoc;
+    if (options.ranges)
+      node.range[1] = lastEnd;
     return node;
   }
 
-  function getDummyLoc() {
-    if (options.locations) {
-      var loc = new SourceLocation();
-      loc.end = loc.start;
-      return loc;
-    }
-  };
-
   function dummyIdent() {
-    var dummy = new Node(token.start);
-    dummy.type = "Identifier";
-    dummy.end = token.start;
+    var dummy = startNode();
     dummy.name = "✖";
-    dummy.loc = getDummyLoc();
-    return dummy;
+    return finishNode(dummy, "Identifier");
   }
   function isDummy(node) { return node.name == "✖"; }
 

-- 
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