From 9916d0e54797679453cafc0ec260fd4116b725a0 Mon Sep 17 00:00:00 2001 From: Mihai Bazon Date: Sat, 22 Dec 2012 01:24:04 +0200 Subject: Accept string or number as name of an accessor. [not sure I'm happy about this fix] Reference mishoo/UglifyJS#478 --- lib/parse.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lib/parse.js') 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("("); -- cgit v1.2.3