support shorthand property named "async" (#2108)

This commit is contained in:
kzc
2017-06-16 00:18:18 -04:00
committed by Alex Lam S.L
parent 370f2cc906
commit 3fa862ce19
2 changed files with 48 additions and 3 deletions

View File

@@ -2012,7 +2012,7 @@ function parse($TEXT, options) {
case "[":
return subscripts(array_(), allow_calls);
case "{":
return subscripts(object_or_object_destructuring_(), allow_calls);
return subscripts(object_or_destructuring_(), allow_calls);
}
unexpected();
}
@@ -2109,7 +2109,7 @@ function parse($TEXT, options) {
return function_(AST_Accessor, is_generator, is_async);
});
var object_or_object_destructuring_ = embed_tokens(function() {
var object_or_destructuring_ = embed_tokens(function object_or_destructuring_() {
var start = S.token, first = true, a = [];
expect("{");
while (!is("punc", "}")) {
@@ -2231,7 +2231,7 @@ function parse($TEXT, options) {
property_token = S.token;
name = as_property_name();
}
if (name === "async" && !is("punc", "(")) {
if (name === "async" && !is("punc", "(") && !is("punc", ",") && !is("punc", "}")) {
is_async = true;
property_token = S.token;
name = as_property_name();