From 5b19196bac1c91305fbdd7a284c7a061f8f1dc36 Mon Sep 17 00:00:00 2001 From: krator Date: Mon, 24 Dec 2012 21:14:53 +0800 Subject: [PATCH] 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 64abf4bc40..c985d9e954 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 b844133476..55b77fd519 100644 --- a/index.html +++ b/index.html @@ -1094,6 +1094,7 @@ or {}.

case _null: case _true: case _false: var node = startNode(); node.value = tokType.atomValue; + node.raw = tokType.keyword next(); return finishNode(node, "Literal");