diff options
author | Mihai Bazon <mihai@bazon.net> | 2013-04-29 15:03:52 +0300 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2013-04-29 15:03:52 +0300 |
commit | 9794ebf88ce877c83ef522642bbd75f72bb80ac7 (patch) | |
tree | 02321c859a570e7732696cf84a9f36eb401c0a98 /lib | |
parent | 68394eed93472b2a778e1731b4e43ed0cc2359d1 (diff) | |
download | tracifyjs-9794ebf88ce877c83ef522642bbd75f72bb80ac7.tar.gz tracifyjs-9794ebf88ce877c83ef522642bbd75f72bb80ac7.zip |
Workaround for missing `prefix` in UnaryExpression generated by Esprima
See #193
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mozilla-ast.js | 6 |
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 = {}; |