mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 21:36:50 -05:00
change enum emit
This commit is contained in:
@@ -6206,9 +6206,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
if (!shouldHoistDeclarationInSystemJsModule(node)) {
|
||||
// do not emit var if variable was already hoisted
|
||||
if (!(node.flags & NodeFlags.Export) || isES6ExportedDeclaration(node)) {
|
||||
|
||||
const isES6ExportedEnum = isES6ExportedDeclaration(node);
|
||||
if (!(node.flags & NodeFlags.Export) || (isES6ExportedEnum && isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, SyntaxKind.ModuleDeclaration))) {
|
||||
emitStart(node);
|
||||
if (isES6ExportedDeclaration(node)) {
|
||||
if (isES6ExportedEnum) {
|
||||
write("export ");
|
||||
}
|
||||
write("var ");
|
||||
@@ -6307,6 +6309,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
return languageVersion === ScriptTarget.ES6 && !!(resolver.getNodeCheckFlags(node) & NodeCheckFlags.LexicalModuleMergesWithClass);
|
||||
}
|
||||
|
||||
function isFirstDeclarationOfKind(node: Declaration, declarations: Declaration[], kind: SyntaxKind) {
|
||||
return !forEach(declarations, declaration => declaration.kind === kind && declaration.pos < node.pos);
|
||||
}
|
||||
|
||||
function emitModuleDeclaration(node: ModuleDeclaration) {
|
||||
// Emit only if this module is non-ambient.
|
||||
const shouldEmit = shouldEmitModuleDeclaration(node);
|
||||
@@ -6319,7 +6325,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
if (emitVarForModule) {
|
||||
const isES6ExportedNamespace = isES6ExportedDeclaration(node);
|
||||
if ((!isES6ExportedNamespace) || !forEach(node.symbol && node.symbol.declarations, declaration => declaration.kind === SyntaxKind.ModuleDeclaration && declaration.pos < node.pos)) {
|
||||
if ((!isES6ExportedNamespace) || isFirstDeclarationOfKind(node, node.symbol && node.symbol.declarations, SyntaxKind.ModuleDeclaration)) {
|
||||
emitStart(node);
|
||||
if (isES6ExportedNamespace) {
|
||||
write("export ");
|
||||
|
||||
Reference in New Issue
Block a user