aboutsummaryrefslogtreecommitdiff
path: root/lib/mozilla-ast.js
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2013-04-29 15:03:52 +0300
committerMihai Bazon <mihai@bazon.net>2013-04-29 15:03:52 +0300
commit9794ebf88ce877c83ef522642bbd75f72bb80ac7 (patch)
tree02321c859a570e7732696cf84a9f36eb401c0a98 /lib/mozilla-ast.js
parent68394eed93472b2a778e1731b4e43ed0cc2359d1 (diff)
downloadtracifyjs-9794ebf88ce877c83ef522642bbd75f72bb80ac7.tar.gz
tracifyjs-9794ebf88ce877c83ef522642bbd75f72bb80ac7.zip
Workaround for missing `prefix` in UnaryExpression generated by Esprima
See #193
Diffstat (limited to 'lib/mozilla-ast.js')
-rw-r--r--lib/mozilla-ast.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/mozilla-ast.js b/lib/mozilla-ast.js
index 982d621a..d7950942 100644
--- a/lib/mozilla-ast.js
+++ b/lib/mozilla-ast.js
@@ -148,12 +148,14 @@
};
function From_Moz_Unary(M) {
- return new (M.prefix ? AST_UnaryPrefix : AST_UnaryPostfix)({
+ var prefix = "prefix" in M ? M.prefix
+ : M.type == "UnaryExpression" ? true : false;
+ return new (prefix ? AST_UnaryPrefix : AST_UnaryPostfix)({
start : my_start_token(M),
end : my_end_token(M),
operator : M.operator,
expression : from_moz(M.argument)
- })
+ });
};
var ME_TO_MOZ = {};