From 5769398abfd4e9498f75052311f9ac5eb7faa936 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 20 Jul 2016 18:43:41 -0700 Subject: [PATCH] Changed specialized emit for IdentifierName --- src/compiler/emitter.ts | 43 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 879bfd16278..bb97dbb42f0 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -314,25 +314,6 @@ const _super = (function (geti, seti) { emitNodeWithNotification(node, emitWithComments); } - /** - * Emits a node with specialized emit flags. - */ - // TODO(rbuckton): This should be removed once source maps are aligned with the old - // emitter and new baselines are taken. This exists solely to - // align with the old emitter. - function emitSpecialized(node: Node, flags: NodeEmitFlags) { - if (node) { - const flagsToAdd = flags & ~node.emitFlags; - if (flagsToAdd) { - node.emitFlags |= flagsToAdd; - emit(node); - node.emitFlags &= ~flagsToAdd; - return; - } - - emit(node); - } - } /** * Emits a node with comments. @@ -354,6 +335,16 @@ const _super = (function (geti, seti) { emitNodeWithSourceMap(node, emitWorker); } + function emitIdentifierName(node: Identifier) { + if (node) { + emitNodeWithNotification(node, emitIdentifierNameWithComments); + } + } + + function emitIdentifierNameWithComments(node: Identifier) { + emitNodeWithComments(node, emitWorker); + } + /** * Emits an expression node. */ @@ -1573,7 +1564,7 @@ const _super = (function (geti, seti) { emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); write(node.asteriskToken ? "function* " : "function "); - emitSpecialized(node.name, NodeEmitFlags.NoSourceMap); + emitIdentifierName(node.name); emitSignatureAndBody(node, emitSignatureHead); } @@ -1709,7 +1700,7 @@ const _super = (function (geti, seti) { emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); write("class"); - emitSpecializedWithPrefix(" ", node.name, NodeEmitFlags.NoSourceMap); + emitNodeWithPrefix(" ", node.name, emitIdentifierName); const indentedFlag = node.emitFlags & NodeEmitFlags.Indented; if (indentedFlag) { @@ -2237,16 +2228,6 @@ const _super = (function (geti, seti) { emitNodeWithPrefix(prefix, node, emit); } - // TODO(rbuckton): This should be removed once source maps are aligned with the old - // emitter and new baselines are taken. This exists solely to - // align with the old emitter. - function emitSpecializedWithPrefix(prefix: string, node: Node, flags: NodeEmitFlags) { - if (node) { - write(prefix); - emitSpecialized(node, flags); - } - } - function emitExpressionWithPrefix(prefix: string, node: Node) { emitNodeWithPrefix(prefix, node, emitExpression); }