Add missing emitter for NamespaceExportDeclaration (#16025)

This commit is contained in:
Ika
2017-05-23 11:07:34 -07:00
committed by Mohamed Hegazy
parent e4d6752a93
commit f9a1fca388
5 changed files with 16 additions and 0 deletions
+1
View File
@@ -3398,6 +3398,7 @@ namespace ts {
case SyntaxKind.IndexedAccessType:
case SyntaxKind.MappedType:
case SyntaxKind.LiteralType:
case SyntaxKind.NamespaceExportDeclaration:
// Types and signatures are TypeScript syntax, and exclude all other facts.
transformFlags = TransformFlags.AssertTypeScript;
excludeFlags = TransformFlags.TypeExcludes;
+8
View File
@@ -571,6 +571,8 @@ namespace ts {
return emitModuleBlock(<ModuleBlock>node);
case SyntaxKind.CaseBlock:
return emitCaseBlock(<CaseBlock>node);
case SyntaxKind.NamespaceExportDeclaration:
return emitNamespaceExportDeclaration(<NamespaceExportDeclaration>node);
case SyntaxKind.ImportEqualsDeclaration:
return emitImportEqualsDeclaration(<ImportEqualsDeclaration>node);
case SyntaxKind.ImportDeclaration:
@@ -1886,6 +1888,12 @@ namespace ts {
write(";");
}
function emitNamespaceExportDeclaration(node: NamespaceExportDeclaration) {
write("export as namespace ");
emit(node.name);
write(";");
}
function emitNamedExports(node: NamedExports) {
emitNamedImportsOrExports(node);
}
+3
View File
@@ -345,6 +345,9 @@ namespace ts {
case SyntaxKind.PropertyDeclaration:
// TypeScript property declarations are elided.
case SyntaxKind.NamespaceExportDeclaration:
// TypeScript namespace export declarations are elided.
return undefined;
case SyntaxKind.Constructor:
+3
View File
@@ -131,6 +131,9 @@ namespace ts {
// tslint:enable boolean-trivia
printsCorrectly("class", {}, printer => printer.printNode(EmitHint.Unspecified, syntheticNode, sourceFile));
printsCorrectly("namespaceExportDeclaration", {}, printer => printer.printNode(EmitHint.Unspecified, createNamespaceExportDeclaration("B"), sourceFile));
printsCorrectly("classWithOptionalMethodAndProperty", {}, printer => printer.printNode(EmitHint.Unspecified, classWithOptionalMethodAndProperty, sourceFile));
});
});
@@ -0,0 +1 @@
export as namespace B;