Skip to content

Commit 5769398

Browse files
committed
Changed specialized emit for IdentifierName
1 parent 0a0cacf commit 5769398

File tree

1 file changed

+12
-31
lines changed

1 file changed

+12
-31
lines changed

src/compiler/emitter.ts

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -314,25 +314,6 @@ const _super = (function (geti, seti) {
314314
emitNodeWithNotification(node, emitWithComments);
315315
}
316316

317-
/**
318-
* Emits a node with specialized emit flags.
319-
*/
320-
// TODO(rbuckton): This should be removed once source maps are aligned with the old
321-
// emitter and new baselines are taken. This exists solely to
322-
// align with the old emitter.
323-
function emitSpecialized(node: Node, flags: NodeEmitFlags) {
324-
if (node) {
325-
const flagsToAdd = flags & ~node.emitFlags;
326-
if (flagsToAdd) {
327-
node.emitFlags |= flagsToAdd;
328-
emit(node);
329-
node.emitFlags &= ~flagsToAdd;
330-
return;
331-
}
332-
333-
emit(node);
334-
}
335-
}
336317

337318
/**
338319
* Emits a node with comments.
@@ -354,6 +335,16 @@ const _super = (function (geti, seti) {
354335
emitNodeWithSourceMap(node, emitWorker);
355336
}
356337

338+
function emitIdentifierName(node: Identifier) {
339+
if (node) {
340+
emitNodeWithNotification(node, emitIdentifierNameWithComments);
341+
}
342+
}
343+
344+
function emitIdentifierNameWithComments(node: Identifier) {
345+
emitNodeWithComments(node, emitWorker);
346+
}
347+
357348
/**
358349
* Emits an expression node.
359350
*/
@@ -1573,7 +1564,7 @@ const _super = (function (geti, seti) {
15731564
emitDecorators(node, node.decorators);
15741565
emitModifiers(node, node.modifiers);
15751566
write(node.asteriskToken ? "function* " : "function ");
1576-
emitSpecialized(node.name, NodeEmitFlags.NoSourceMap);
1567+
emitIdentifierName(node.name);
15771568
emitSignatureAndBody(node, emitSignatureHead);
15781569
}
15791570

@@ -1709,7 +1700,7 @@ const _super = (function (geti, seti) {
17091700
emitDecorators(node, node.decorators);
17101701
emitModifiers(node, node.modifiers);
17111702
write("class");
1712-
emitSpecializedWithPrefix(" ", node.name, NodeEmitFlags.NoSourceMap);
1703+
emitNodeWithPrefix(" ", node.name, emitIdentifierName);
17131704

17141705
const indentedFlag = node.emitFlags & NodeEmitFlags.Indented;
17151706
if (indentedFlag) {
@@ -2237,16 +2228,6 @@ const _super = (function (geti, seti) {
22372228
emitNodeWithPrefix(prefix, node, emit);
22382229
}
22392230

2240-
// TODO(rbuckton): This should be removed once source maps are aligned with the old
2241-
// emitter and new baselines are taken. This exists solely to
2242-
// align with the old emitter.
2243-
function emitSpecializedWithPrefix(prefix: string, node: Node, flags: NodeEmitFlags) {
2244-
if (node) {
2245-
write(prefix);
2246-
emitSpecialized(node, flags);
2247-
}
2248-
}
2249-
22502231
function emitExpressionWithPrefix(prefix: string, node: Node) {
22512232
emitNodeWithPrefix(prefix, node, emitExpression);
22522233
}

0 commit comments

Comments
 (0)