Merge pull request #17996 from Microsoft/fix16681

Fix crash when exporting class without name
This commit is contained in:
Ron Buckton
2017-08-24 11:07:12 -07:00
committed by GitHub
5 changed files with 24 additions and 2 deletions
+1 -1
View File
@@ -1204,7 +1204,7 @@ namespace ts {
}
if (hasModifier(decl, ModifierFlags.Export)) {
const exportName = hasModifier(decl, ModifierFlags.Default) ? createIdentifier("default") : decl.name;
const exportName = hasModifier(decl, ModifierFlags.Default) ? createIdentifier("default") : getDeclarationName(decl);
statements = appendExportStatement(statements, exportName, getLocalName(decl), /*location*/ decl);
}
+1 -1
View File
@@ -124,7 +124,7 @@ namespace ts {
else {
// export class x { }
const name = (<ClassDeclaration>node).name;
if (!uniqueExports.get(unescapeLeadingUnderscores(name.escapedText))) {
if (name && !uniqueExports.get(unescapeLeadingUnderscores(name.escapedText))) {
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
uniqueExports.set(unescapeLeadingUnderscores(name.escapedText), true);
exportedNames = append(exportedNames, name);