aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2012-12-22 01:24:04 +0200
committerMihai Bazon <mihai@bazon.net>2012-12-22 01:24:04 +0200
commit9916d0e54797679453cafc0ec260fd4116b725a0 (patch)
tree3f70243824685ec5458dc53dd5cf9e6af8e54888
parent31c4a37e37acc1e3ddd44c6c23f61a330e7b1484 (diff)
downloadtracifyjs-9916d0e54797679453cafc0ec260fd4116b725a0.tar.gz
tracifyjs-9916d0e54797679453cafc0ec260fd4116b725a0.zip
Accept string or number as name of an accessor.
[not sure I'm happy about this fix] Reference mishoo/UglifyJS#478
-rw-r--r--lib/parse.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/parse.js b/lib/parse.js
index ffdd7a53..5b6820ff 100644
--- a/lib/parse.js
+++ b/lib/parse.js
@@ -881,11 +881,14 @@ function parse($TEXT, options) {
};
var function_ = function(in_statement, ctor) {
- var name = is("name") ? as_symbol(in_statement
- ? AST_SymbolDefun
- : ctor === AST_Accessor
- ? AST_SymbolAccessor
- : AST_SymbolLambda) : null;
+ var is_accessor = ctor === AST_Accessor;
+ var name = (is("name") ? as_symbol(in_statement
+ ? AST_SymbolDefun
+ : is_accessor
+ ? AST_SymbolAccessor
+ : AST_SymbolLambda)
+ : is_accessor && (is("string") || is("num")) ? as_atom_node()
+ : null);
if (in_statement && !name)
unexpected();
expect("(");