Skip to content

Commit f1e65c6

Browse files
emitJavaScriptWorker -> emitBareNode; emitNodeWithoutSourceMap -> emitWithoutSourceMap
1 parent 689f383 commit f1e65c6

File tree

1 file changed

+35
-32
lines changed

1 file changed

+35
-32
lines changed

src/compiler/emitter.ts

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2188,36 +2188,36 @@ var __param = this.__param || function(index, decorator) { return function (targ
21882188
write("var ");
21892189

21902190
// _i = 0
2191-
emitNodeWithoutSourceMap(counter);
2191+
emitWithoutSourceMap(counter);
21922192
write(" = 0");
21932193
emitEnd(node.expression);
21942194

21952195
if (!rhsIsIdentifier) {
21962196
// , _a = expr
21972197
write(", ");
21982198
emitStart(node.expression);
2199-
emitNodeWithoutSourceMap(rhsReference);
2199+
emitWithoutSourceMap(rhsReference);
22002200
write(" = ");
2201-
emitNodeWithoutSourceMap(node.expression);
2201+
emitWithoutSourceMap(node.expression);
22022202
emitEnd(node.expression);
22032203
}
22042204

22052205
write("; ");
22062206

22072207
// _i < _a.length;
22082208
emitStart(node.initializer);
2209-
emitNodeWithoutSourceMap(counter);
2209+
emitWithoutSourceMap(counter);
22102210
write(" < ");
22112211

2212-
emitNodeWithoutSourceMap(rhsReference);
2212+
emitWithoutSourceMap(rhsReference);
22132213
write(".length");
22142214

22152215
emitEnd(node.initializer);
22162216
write("; ");
22172217

22182218
// _i++)
22192219
emitStart(node.initializer);
2220-
emitNodeWithoutSourceMap(counter);
2220+
emitWithoutSourceMap(counter);
22212221
write("++");
22222222
emitEnd(node.initializer);
22232223
emitToken(SyntaxKind.CloseParenToken, node.expression.end);
@@ -2244,17 +2244,17 @@ var __param = this.__param || function(index, decorator) { return function (targ
22442244
else {
22452245
// The following call does not include the initializer, so we have
22462246
// to emit it separately.
2247-
emitNodeWithoutSourceMap(declaration);
2247+
emitWithoutSourceMap(declaration);
22482248
write(" = ");
2249-
emitNodeWithoutSourceMap(rhsIterationValue);
2249+
emitWithoutSourceMap(rhsIterationValue);
22502250
}
22512251
}
22522252
else {
22532253
// It's an empty declaration list. This can only happen in an error case, if the user wrote
22542254
// for (let of []) {}
2255-
emitNodeWithoutSourceMap(createTempVariable(TempFlags.Auto));
2255+
emitWithoutSourceMap(createTempVariable(TempFlags.Auto));
22562256
write(" = ");
2257-
emitNodeWithoutSourceMap(rhsIterationValue);
2257+
emitWithoutSourceMap(rhsIterationValue);
22582258
}
22592259
}
22602260
else {
@@ -2267,7 +2267,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
22672267
emitDestructuring(assignmentExpression, /*isAssignmentExpressionStatement*/ true, /*value*/ undefined);
22682268
}
22692269
else {
2270-
emitNodeWithoutSourceMap(assignmentExpression);
2270+
emitWithoutSourceMap(assignmentExpression);
22712271
}
22722272
}
22732273
emitEnd(node.initializer);
@@ -2423,7 +2423,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
24232423
write("exports.");
24242424
}
24252425
}
2426-
emitNodeWithoutSourceMap(node.name);
2426+
emitWithoutSourceMap(node.name);
24272427
emitEnd(node.name);
24282428
}
24292429

@@ -2463,7 +2463,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
24632463
emitStart(specifier.name);
24642464
emitContainingModuleName(specifier);
24652465
write(".");
2466-
emitNodeWithoutSourceMap(specifier.name);
2466+
emitWithoutSourceMap(specifier.name);
24672467
emitEnd(specifier.name);
24682468
write(" = ");
24692469
emitExpressionIdentifier(name);
@@ -2846,14 +2846,14 @@ var __param = this.__param || function(index, decorator) { return function (targ
28462846
writeLine();
28472847
emitStart(p);
28482848
write("if (");
2849-
emitNodeWithoutSourceMap(p.name);
2849+
emitWithoutSourceMap(p.name);
28502850
write(" === void 0)");
28512851
emitEnd(p);
28522852
write(" { ");
28532853
emitStart(p);
2854-
emitNodeWithoutSourceMap(p.name);
2854+
emitWithoutSourceMap(p.name);
28552855
write(" = ");
2856-
emitNodeWithoutSourceMap(p.initializer);
2856+
emitWithoutSourceMap(p.initializer);
28572857
emitEnd(p);
28582858
write("; }");
28592859
}
@@ -2876,7 +2876,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
28762876
emitLeadingComments(restParam);
28772877
emitStart(restParam);
28782878
write("var ");
2879-
emitNodeWithoutSourceMap(restParam.name);
2879+
emitWithoutSourceMap(restParam.name);
28802880
write(" = [];");
28812881
emitEnd(restParam);
28822882
emitTrailingComments(restParam);
@@ -2897,7 +2897,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
28972897
increaseIndent();
28982898
writeLine();
28992899
emitStart(restParam);
2900-
emitNodeWithoutSourceMap(restParam.name);
2900+
emitWithoutSourceMap(restParam.name);
29012901
write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];");
29022902
emitEnd(restParam);
29032903
decreaseIndent();
@@ -2918,7 +2918,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
29182918

29192919
function emitNameOfDeclaration(node: Declaration) {
29202920
if (node.name) {
2921-
emitNodeWithoutSourceMap(node.name);
2921+
emitWithoutSourceMap(node.name);
29222922
}
29232923
else {
29242924
write(getGeneratedNameForNode(node));
@@ -3170,7 +3170,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
31703170
emitStart(param);
31713171
emitStart(param.name);
31723172
write("this.");
3173-
emitNodeWithoutSourceMap(param.name);
3173+
emitWithoutSourceMap(param.name);
31743174
emitEnd(param.name);
31753175
write(" = ");
31763176
emit(param.name);
@@ -3184,15 +3184,15 @@ var __param = this.__param || function(index, decorator) { return function (targ
31843184
// TODO: (jfreeman,drosen): comment on why this is emitNodeWithoutSourceMap instead of emit here.
31853185
if (memberName.kind === SyntaxKind.StringLiteral || memberName.kind === SyntaxKind.NumericLiteral) {
31863186
write("[");
3187-
emitNodeWithoutSourceMap(memberName);
3187+
emitWithoutSourceMap(memberName);
31883188
write("]");
31893189
}
31903190
else if (memberName.kind === SyntaxKind.ComputedPropertyName) {
31913191
emitComputedPropertyName(<ComputedPropertyName>memberName);
31923192
}
31933193
else {
31943194
write(".");
3195-
emitNodeWithoutSourceMap(memberName);
3195+
emitWithoutSourceMap(memberName);
31963196
}
31973197
}
31983198

@@ -4440,11 +4440,11 @@ var __param = this.__param || function(index, decorator) { return function (targ
44404440
emitStart(specifier);
44414441
emitContainingModuleName(specifier);
44424442
write(".");
4443-
emitNodeWithoutSourceMap(specifier.name);
4443+
emitWithoutSourceMap(specifier.name);
44444444
write(" = ");
44454445
write(generatedName);
44464446
write(".");
4447-
emitNodeWithoutSourceMap(specifier.propertyName || specifier.name);
4447+
emitWithoutSourceMap(specifier.propertyName || specifier.name);
44484448
write(";");
44494449
emitEnd(specifier);
44504450
}
@@ -4480,7 +4480,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
44804480
}
44814481
if (node.moduleSpecifier) {
44824482
write(" from ");
4483-
emitNodeWithoutSourceMap(node.moduleSpecifier);
4483+
emitWithoutSourceMap(node.moduleSpecifier);
44844484
}
44854485
write(";");
44864486
emitEnd(node);
@@ -4499,10 +4499,10 @@ var __param = this.__param || function(index, decorator) { return function (targ
44994499
}
45004500
emitStart(specifier);
45014501
if (specifier.propertyName) {
4502-
emitNodeWithoutSourceMap(specifier.propertyName);
4502+
emitWithoutSourceMap(specifier.propertyName);
45034503
write(" as ");
45044504
}
4505-
emitNodeWithoutSourceMap(specifier.name);
4505+
emitWithoutSourceMap(specifier.name);
45064506
emitEnd(specifier);
45074507
needsComma = true;
45084508
}
@@ -4826,7 +4826,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
48264826
* the sourcemap for 'a + b' itself, but if 'emit' is called instead for nodes 'a' and 'b',
48274827
* then both 'a' and 'b' will have sourcemaps recorded if appropriate.
48284828
*/
4829-
function emitNodeWithoutSourceMap(node: Node, allowGeneratedIdentifiers?: boolean): void {
4829+
function emitWithoutSourceMap(node: Node, allowGeneratedIdentifiers?: boolean): void {
48304830
emitNodeWorker(node, /*shouldEmitSourceMap*/ false, allowGeneratedIdentifiers);
48314831
}
48324832

@@ -4853,7 +4853,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
48534853
if (shouldEmitSourceMap) {
48544854
emitSourceFileStart(<SourceFile>node);
48554855
}
4856-
emitJavaScriptWorker(node, allowGeneratedIdentifiers);
4856+
emitBareNode(node, allowGeneratedIdentifiers);
48574857
return;
48584858
}
48594859

@@ -4866,11 +4866,11 @@ var __param = this.__param || function(index, decorator) { return function (targ
48664866
// Synthesized nodes do not correspond to text in the original source.
48674867
if (shouldEmitSourceMap && !nodeIsSynthesized(node)) {
48684868
emitStart(node);
4869-
emitJavaScriptWorker(node, allowGeneratedIdentifiers);
4869+
emitBareNode(node, allowGeneratedIdentifiers);
48704870
emitEnd(node);
48714871
}
48724872
else {
4873-
emitJavaScriptWorker(node, allowGeneratedIdentifiers);
4873+
emitBareNode(node, allowGeneratedIdentifiers);
48744874
}
48754875

48764876
if (emitComments) {
@@ -4920,7 +4920,10 @@ var __param = this.__param || function(index, decorator) { return function (targ
49204920
return true;
49214921
}
49224922

4923-
function emitJavaScriptWorker(node: Node, allowGeneratedIdentifiers: boolean = true) {
4923+
/**
4924+
* Emits a node without emitting comments or tracking sourcemap information.
4925+
*/
4926+
function emitBareNode(node: Node, allowGeneratedIdentifiers: boolean = true) {
49244927
// Check if the node can be emitted regardless of the ScriptTarget
49254928
switch (node.kind) {
49264929
case SyntaxKind.Identifier:

0 commit comments

Comments
 (0)