--- a/js/src/builtin/ReflectParse.cpp
+++ b/js/src/builtin/ReflectParse.cpp
@@ -461,17 +461,17 @@ class NodeBuilder
MOZ_MUST_USE bool literal(HandleValue val, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool identifier(HandleValue name, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool function(ASTType type, TokenPos* pos,
HandleValue id, NodeVector& args, NodeVector& defaults,
HandleValue body, HandleValue rest, GeneratorStyle generatorStyle,
- bool isExpression, MutableHandleValue dst);
+ bool isAsync, bool isExpression, MutableHandleValue dst);
MOZ_MUST_USE bool variableDeclarator(HandleValue id, HandleValue init, TokenPos* pos,
MutableHandleValue dst);
MOZ_MUST_USE bool switchCase(HandleValue expr, NodeVector& elts, TokenPos* pos, MutableHandleValue dst);
MOZ_MUST_USE bool catchClause(HandleValue var, HandleValue guard, HandleValue body, TokenPos* pos,
MutableHandleValue dst);
@@ -1585,27 +1585,28 @@ NodeBuilder::arrayPattern(NodeVector& el
{
return listNode(AST_ARRAY_PATT, "elements", elts, pos, dst);
}
bool
NodeBuilder::function(ASTType type, TokenPos* pos,
HandleValue id, NodeVector& args, NodeVector& defaults,
HandleValue body, HandleValue rest,
- GeneratorStyle generatorStyle, bool isExpression,
+ GeneratorStyle generatorStyle, bool isAsync, bool isExpression,
MutableHandleValue dst)
{
RootedValue array(cx), defarray(cx);
if (!newArray(args, &array))
return false;
if (!newArray(defaults, &defarray))
return false;
bool isGenerator = generatorStyle != GeneratorStyle::None;
RootedValue isGeneratorVal(cx, BooleanValue(isGenerator));
+ RootedValue isAsyncVal(cx, BooleanValue(isAsync));
RootedValue isExpressionVal(cx, BooleanValue(isExpression));
RootedValue cb(cx, callbacks[type]);
if (!cb.isNull()) {
return callback(cb, opt(id), array, body, isGeneratorVal, isExpressionVal, pos, dst);
}
if (isGenerator) {
@@ -1619,28 +1620,30 @@ NodeBuilder::function(ASTType type, Toke
styleVal.setString(styleStr);
return newNode(type, pos,
"id", id,
"params", array,
"defaults", defarray,
"body", body,
"rest", rest,
"generator", isGeneratorVal,
+ "async", isAsyncVal,
"style", styleVal,
"expression", isExpressionVal,
dst);
}
return newNode(type, pos,
"id", id,
"params", array,
"defaults", defarray,
"body", body,
"rest", rest,
"generator", isGeneratorVal,
+ "async", isAsyncVal,
"expression", isExpressionVal,
dst);
}
bool
NodeBuilder::classMethod(HandleValue name, HandleValue body, PropKind kind, bool isStatic,
TokenPos* pos, MutableHandleValue dst)
{
@@ -3391,16 +3394,17 @@ ASTSerializer::function(ParseNode* pn, A
GeneratorStyle generatorStyle =
pn->pn_funbox->isGenerator()
? (pn->pn_funbox->isLegacyGenerator()
? GeneratorStyle::Legacy
: GeneratorStyle::ES6)
: GeneratorStyle::None;
+ bool isAsync = pn->pn_funbox->isAsync();
bool isExpression =
#if JS_HAS_EXPR_CLOSURES
func->isExprBody();
#else
false;
#endif
RootedValue id(cx);
@@ -3412,18 +3416,18 @@ ASTSerializer::function(ParseNode* pn, A
NodeVector defaults(cx);
RootedValue body(cx), rest(cx);
if (func->hasRest())
rest.setUndefined();
else
rest.setNull();
return functionArgsAndBody(pn->pn_body, args, defaults, &body, &rest) &&
- builder.function(type, &pn->pn_pos, id, args, defaults, body,
- rest, generatorStyle, isExpression, dst);
+ builder.function(type, &pn->pn_pos, id, args, defaults, body,
+ rest, generatorStyle, isAsync, isExpression, dst);
}
bool
ASTSerializer::functionArgsAndBody(ParseNode* pn, NodeVector& args, NodeVector& defaults,
MutableHandleValue body, MutableHandleValue rest)
{
ParseNode* pnargs;
ParseNode* pnbody;