aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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("(");