Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,372 changes: 1,220 additions & 1,152 deletions src/compiler/factory.ts

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1152,13 +1152,10 @@ namespace ts {
&& (options.isolatedModules || isExternalModuleFile)
&& !file.isDeclarationFile) {
// synthesize 'import "tslib"' declaration
const externalHelpersModuleReference = <StringLiteral>createSynthesizedNode(SyntaxKind.StringLiteral);
externalHelpersModuleReference.text = externalHelpersModuleNameText;
const importDecl = createSynthesizedNode(SyntaxKind.ImportDeclaration);

importDecl.parent = file;
const externalHelpersModuleReference = createLiteral(externalHelpersModuleNameText);
const importDecl = createImportDeclaration(undefined, undefined, undefined);
externalHelpersModuleReference.parent = importDecl;

importDecl.parent = file;
imports = [externalHelpersModuleReference];
}

Expand Down
23 changes: 18 additions & 5 deletions src/compiler/transformers/destructuring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ namespace ts {
Debug.assertNode(target, createAssignmentCallback ? isIdentifier : isExpression);
const expression = createAssignmentCallback
? createAssignmentCallback(<Identifier>target, value, location)
: createAssignment(visitNode(<Expression>target, visitor, isExpression), value, location);
: setTextRange(
createAssignment(visitNode(<Expression>target, visitor, isExpression), value),
location
);
expression.original = original;
emitExpression(expression);
}
Expand Down Expand Up @@ -174,9 +177,10 @@ namespace ts {
const variable = createVariableDeclaration(
name,
/*type*/ undefined,
pendingExpressions ? inlineExpressions(append(pendingExpressions, value)) : value,
location);
pendingExpressions ? inlineExpressions(append(pendingExpressions, value)) : value
);
variable.original = original;
setTextRange(variable, location);
if (isIdentifier(name)) {
setEmitFlags(variable, EmitFlags.NoNestedSourceMaps);
}
Expand Down Expand Up @@ -416,7 +420,7 @@ namespace ts {
const temp = createTempVariable(/*recordTempVariable*/ undefined);
if (flattenContext.hoistTempVariables) {
flattenContext.context.hoistVariableDeclaration(temp);
flattenContext.emitExpression(createAssignment(temp, value, location));
flattenContext.emitExpression(setTextRange(createAssignment(temp, value), location));
}
else {
flattenContext.emitBindingOrAssignment(temp, value, location, /*original*/ undefined);
Expand Down Expand Up @@ -492,6 +496,15 @@ namespace ts {
}
}
}
return createCall(getHelperName("__rest"), undefined, [value, createArrayLiteral(propertyNames, location)]);
return createCall(
getHelperName("__rest"),
undefined,
[
value,
setTextRange(
createArrayLiteral(propertyNames),
location
)
]);
}
}
Loading