Accept string or number as name of an accessor.

[not sure I'm happy about this fix]

Reference mishoo/UglifyJS#478
This commit is contained in:
Mihai Bazon
2012-12-22 01:24:04 +02:00
parent 31c4a37e37
commit 9916d0e547

View File

@@ -881,11 +881,14 @@ function parse($TEXT, options) {
}; };
var function_ = function(in_statement, ctor) { var function_ = function(in_statement, ctor) {
var name = is("name") ? as_symbol(in_statement var is_accessor = ctor === AST_Accessor;
? AST_SymbolDefun var name = (is("name") ? as_symbol(in_statement
: ctor === AST_Accessor ? AST_SymbolDefun
? AST_SymbolAccessor : is_accessor
: AST_SymbolLambda) : null; ? AST_SymbolAccessor
: AST_SymbolLambda)
: is_accessor && (is("string") || is("num")) ? as_atom_node()
: null);
if (in_statement && !name) if (in_statement && !name)
unexpected(); unexpected();
expect("("); expect("(");