Skip to content

Commit ff4c72d

Browse files
committed
Make most current Node factory functions public
1 parent bc611d9 commit ff4c72d

File tree

17 files changed

+2131
-1873
lines changed

17 files changed

+2131
-1873
lines changed

src/compiler/factory.ts

Lines changed: 1220 additions & 1152 deletions
Large diffs are not rendered by default.

src/compiler/program.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,13 +1152,10 @@ namespace ts {
11521152
&& (options.isolatedModules || isExternalModuleFile)
11531153
&& !file.isDeclarationFile) {
11541154
// synthesize 'import "tslib"' declaration
1155-
const externalHelpersModuleReference = <StringLiteral>createSynthesizedNode(SyntaxKind.StringLiteral);
1156-
externalHelpersModuleReference.text = externalHelpersModuleNameText;
1157-
const importDecl = createSynthesizedNode(SyntaxKind.ImportDeclaration);
1158-
1159-
importDecl.parent = file;
1155+
const externalHelpersModuleReference = createLiteral(externalHelpersModuleNameText);
1156+
const importDecl = createImportDeclaration(undefined, undefined, undefined);
11601157
externalHelpersModuleReference.parent = importDecl;
1161-
1158+
importDecl.parent = file;
11621159
imports = [externalHelpersModuleReference];
11631160
}
11641161

src/compiler/transformers/destructuring.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ namespace ts {
112112
Debug.assertNode(target, createAssignmentCallback ? isIdentifier : isExpression);
113113
const expression = createAssignmentCallback
114114
? createAssignmentCallback(<Identifier>target, value, location)
115-
: createAssignment(visitNode(<Expression>target, visitor, isExpression), value, location);
115+
: setTextRange(
116+
createAssignment(visitNode(<Expression>target, visitor, isExpression), value),
117+
location
118+
);
116119
expression.original = original;
117120
emitExpression(expression);
118121
}
@@ -174,9 +177,10 @@ namespace ts {
174177
const variable = createVariableDeclaration(
175178
name,
176179
/*type*/ undefined,
177-
pendingExpressions ? inlineExpressions(append(pendingExpressions, value)) : value,
178-
location);
180+
pendingExpressions ? inlineExpressions(append(pendingExpressions, value)) : value
181+
);
179182
variable.original = original;
183+
setTextRange(variable, location);
180184
if (isIdentifier(name)) {
181185
setEmitFlags(variable, EmitFlags.NoNestedSourceMaps);
182186
}
@@ -416,7 +420,7 @@ namespace ts {
416420
const temp = createTempVariable(/*recordTempVariable*/ undefined);
417421
if (flattenContext.hoistTempVariables) {
418422
flattenContext.context.hoistVariableDeclaration(temp);
419-
flattenContext.emitExpression(createAssignment(temp, value, location));
423+
flattenContext.emitExpression(setTextRange(createAssignment(temp, value), location));
420424
}
421425
else {
422426
flattenContext.emitBindingOrAssignment(temp, value, location, /*original*/ undefined);
@@ -492,6 +496,15 @@ namespace ts {
492496
}
493497
}
494498
}
495-
return createCall(getHelperName("__rest"), undefined, [value, createArrayLiteral(propertyNames, location)]);
499+
return createCall(
500+
getHelperName("__rest"),
501+
undefined,
502+
[
503+
value,
504+
setTextRange(
505+
createArrayLiteral(propertyNames),
506+
location
507+
)
508+
]);
496509
}
497510
}

0 commit comments

Comments
 (0)