Bug 1501537 - Name function in variable declaration initializer in BinAST. r=Yoric

This commit is contained in:
Tooru Fujisawa 2018-10-30 09:49:40 +09:00
parent 3cec62da42
commit b5cfef2126
2 changed files with 8 additions and 8 deletions

View File

@ -5061,11 +5061,11 @@ BinASTParser<Tok>::parseInterfaceVariableDeclarator(const size_t start, const Bi
ParseNode* result;
if (binding->isKind(ParseNodeKind::Name)) {
// `var foo [= bar]``
MOZ_TRY(checkBinding(binding->template as<NameNode>().atom()->asPropertyName()));
BINJS_TRY_VAR(result, factory_.newName(binding->template as<NameNode>().atom()->asPropertyName(), tokenizer_->pos(start), cx_));
NameNode* bindingNameNode = &binding->template as<NameNode>();
MOZ_TRY(checkBinding(bindingNameNode->atom()->asPropertyName()));
result = bindingNameNode;
if (init) {
result->as<NameNode>().setInitializer(init);
BINJS_TRY(factory_.finishInitializerAssignment(bindingNameNode, init));
}
} else {
// `var pattern = bar`

View File

@ -1347,11 +1347,11 @@ VariableDeclarator:
ParseNode* result;
if (binding->isKind(ParseNodeKind::Name)) {
// `var foo [= bar]``
MOZ_TRY(checkBinding(binding->template as<NameNode>().atom()->asPropertyName()));
BINJS_TRY_VAR(result, factory_.newName(binding->template as<NameNode>().atom()->asPropertyName(), tokenizer_->pos(start), cx_));
NameNode* bindingNameNode = &binding->template as<NameNode>();
MOZ_TRY(checkBinding(bindingNameNode->atom()->asPropertyName()));
result = bindingNameNode;
if (init) {
result->as<NameNode>().setInitializer(init);
BINJS_TRY(factory_.finishInitializerAssignment(bindingNameNode, init));
}
} else {
// `var pattern = bar`