[Pkg-javascript-commits] [node-acorn-jsx] 62/484: Give true/false/null literals a `raw` property

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 5b19196bac1c91305fbdd7a284c7a061f8f1dc36
Author: krator <kratorado at gmail.com>
Date:   Mon Dec 24 21:14:53 2012 +0800

    Give true/false/null literals a `raw` property
    
    In the generated ast, "null"/"true"/"false" are "Literal" nodes.
    As every "Literal" node has a 'raw' property,
    When i am doing something with the ast using python,
    the 3 "Literal"s caused some problem.
    make the 3 "Literal"s have 'raw' property.
---
 acorn.js   | 1 +
 index.html | 1 +
 2 files changed, 2 insertions(+)

diff --git a/acorn.js b/acorn.js
index 64abf4b..c985d9e 100644
--- a/acorn.js
+++ b/acorn.js
@@ -1481,6 +1481,7 @@
     case _null: case _true: case _false:
       var node = startNode();
       node.value = tokType.atomValue;
+      node.raw = tokType.keyword
       next();
       return finishNode(node, "Literal");
 
diff --git a/index.html b/index.html
index b844133..55b77fd 100644
--- a/index.html
+++ b/index.html
@@ -1094,6 +1094,7 @@ or <code>{}</code>.</p>             </td>             <td class="code">
     <span class="k">case</span> <span class="nx">_null</span><span class="o">:</span> <span class="k">case</span> <span class="nx">_true</span><span class="o">:</span> <span class="k">case</span> <span class="nx">_false</span><span class="o">:</span>
       <span class="kd">var</span> <span class="nx">node</span> <span class="o">=</span> <span class="nx">startNode</span><span class="p">();</span>
       <span class="nx">node</span><span class="p">.</span><span class="nx">value</span> <span class="o">=</span> <span class="nx">tokType</span><span class="p">.</span><span class="nx">atomValue</span><span class="p">;</span>
+      <span class="nx">node</span><span class="p">.</span><span class="nx">raw</span> <span class="o">=</span> <span class="nx">tokType</span><span class="p">.</span><span class="nx">keyword</span>
       <span class="nx">next</span><span class="p">();</span>
       <span class="k">return</span> <span class="nx">finishNode</span><span class="p">(</span><span class="nx">node</span><span class="p">,</span> <span class="s2">"Literal"</span><span class="p">);</span>
 

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