diff options
Diffstat (limited to 'lib/parse.js')
-rw-r--r-- | lib/parse.js | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/lib/parse.js b/lib/parse.js index 3b7d15ca..27fa0424 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -1482,7 +1482,39 @@ function parse($TEXT, options) { })); continue; } - if (!is("punc", ":") && start.type == "name") switch (key) { + if (is("punc", ":")) { + next(); + a.push(new AST_ObjectKeyVal({ + start: start, + key: key, + value: maybe_assign(), + end: prev(), + })); + continue; + } + if (is("punc", ",") || is("punc", "}")) { + a.push(new AST_ObjectKeyVal({ + start: start, + key: key, + value: _make_symbol(AST_SymbolRef, start), + end: prev(), + })); + continue; + } + if (start.type == "name") switch (key) { + case "async": + key = as_property_key(); + var func_start = S.token; + var func = function_(AST_AsyncFunction); + func.start = func_start; + func.end = prev(); + a.push(new AST_ObjectKeyVal({ + start: start, + key: key, + value: func, + end: prev(), + })); + continue; case "get": a.push(new AST_ObjectGetter({ start: start, @@ -1499,22 +1531,8 @@ function parse($TEXT, options) { end: prev(), })); continue; - default: - a.push(new AST_ObjectKeyVal({ - start: start, - key: key, - value: _make_symbol(AST_SymbolRef, start), - end: prev(), - })); - continue; } - expect(":"); - a.push(new AST_ObjectKeyVal({ - start: start, - key: key, - value: maybe_assign(), - end: prev(), - })); + unexpected(); } next(); return new AST_Object({ properties: a }); |