diff --git a/lib/Parser/Parse.cpp b/lib/Parser/Parse.cpp index 6581d96e1d0..4df6b8b2f37 100644 --- a/lib/Parser/Parse.cpp +++ b/lib/Parser/Parse.cpp @@ -2505,7 +2505,7 @@ ModuleImportOrExportEntry* Parser::AddModuleImportOrExportEntry(ModuleImportOrEx void Parser::AddModuleLocalExportEntry(ParseNodePtr varDeclNode) { - Assert(varDeclNode->nop == knopVarDecl || varDeclNode->nop == knopLetDecl || varDeclNode->nop == knopConstDecl); + AssertOrFailFast(varDeclNode->nop == knopVarDecl || varDeclNode->nop == knopLetDecl || varDeclNode->nop == knopConstDecl); IdentPtr localName = varDeclNode->sxVar.pid; varDeclNode->sxVar.sym->SetIsModuleExportStorage(true); @@ -3014,15 +3014,19 @@ ParseNodePtr Parser::ParseExportDeclaration(bool *needTerminator) if (buildAST) { - ParseNodePtr temp = pnode; - while (temp->nop == knopList) - { - ParseNodePtr varDeclNode = temp->sxBin.pnode1; - temp = temp->sxBin.pnode2; - - AddModuleLocalExportEntry(varDeclNode); - } - AddModuleLocalExportEntry(temp); + ForEachItemInList(pnode, [&](ParseNodePtr item) { + if (item->nop == knopAsg) + { + Parser::MapBindIdentifier(item, [&](ParseNodePtr subItem) + { + AddModuleLocalExportEntry(subItem); + }); + } + else + { + AddModuleLocalExportEntry(item); + } + }); } } break; @@ -12966,6 +12970,7 @@ ParseNodePtr Parser::ParseDestructuredInitializer(ParseNodePtr lhsNode, pnodeDestructAsg = CreateNodeWithScanner(); pnodeDestructAsg->sxBin.pnode1 = lhsNode; pnodeDestructAsg->sxBin.pnode2 = pnodeDefault; + pnodeDestructAsg->sxBin.pnodeNext = nullptr; pnodeDestructAsg->ichMin = lhsNode->ichMin; pnodeDestructAsg->ichLim = pnodeDefault->ichLim; }