Fix crash when exporting class without name

This commit is contained in:
Ron Buckton
2017-08-23 17:09:47 -07:00
parent 952e9cae70
commit 80601fccb5
5 changed files with 24 additions and 2 deletions

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);
}

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);