10000 Merge branch 'transforms-printer' into transforms-transformer-ts · icssjs/TypeScript@8e5e5f8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8e5e5f8

Browse files
committed
Merge branch 'transforms-printer' into transforms-transformer-ts
2 parents 25f4102 + b1d8828 commit 8e5e5f8

File tree

175 files changed

+1122
-1213
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+1122
-1213
lines changed

Jakefile.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ function concatenateFiles(destinationFile, sourceFiles) {
239239

240240
var useDebugMode = true;
241241
var useTransforms = process.env.USE_TRANSFORMS || false;
242-
var useTransformCompat = false;
243242
var host = (process.env.host || process.env.TYPESCRIPT_HOST || "node");
244243
var compilerFilename = "tsc.js";
245244
var LKGCompiler = path.join(LKGDirectory, compilerFilename);
@@ -302,9 +301,6 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
302301
if (useBuiltCompiler && useTransforms) {
303302
options += " --experimentalTransforms"
304303
}
305-
else if (useBuiltCompiler && useTransformCompat) {
306-
options += " --transformCompatibleEmit"
307-
}
308304

309305
var cmd = host + " " + compilerPath + " " + options + " ";
310306
cmd = cmd + sources.join(" ");
@@ -433,10 +429,6 @@ task("setTransforms", function() {
433429
useTransforms = true;
434430
});
435431

436-
task("setTransformCompat", function() {
437-
useTransformCompat = true;
438-
});
439-
440432
task("configure-nightly", [configureNightlyJs], function() {
441433
var cmd = host + " " + configureNightlyJs + " " + packageJson + " " + programTs;
442434
console.log(cmd);

src/compiler/commandLineParser.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,6 @@ namespace ts {
327327
name: "experimentalTransforms",
328328
type: "boolean",
329329
experimental: true
330-
},
331-
{
332-
// this option will be removed when this is merged with master and exists solely
333-
// to enable the tree transforming emitter side-by-side with the existing emitter.
334-
name: "transformCompatibleEmit",
335-
type: "boolean",
336-
experimental: true
337330
}
338331
];
339332

src/compiler/emitter.ts

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1915,9 +1915,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
19151915

19161916
if (multiLine) {
19171917
decreaseIndent();
1918-
if (!compilerOptions.transformCompatibleEmit) {
1919-
writeLine();
1920-
}
19211918
}
19221919

19231920
write(")");
@@ -2237,7 +2234,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22372234
return forEach(elements, e => e.kind === SyntaxKind.SpreadElementExpression);
22382235
}
22392236

2240-
function skipParentheses(node: Expression): Expression {
2237+
function skipParenthesesAndAssertions(node: Expression): Expression {
22412238
while (node.kind === SyntaxKind.ParenthesizedExpression || node.kind === SyntaxKind.TypeAssertionExpression || node.kind === SyntaxKind.AsExpression) {
22422239
node = (<ParenthesizedExpression | AssertionExpression>node).expression;
22432240
}
@@ -2268,7 +2265,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22682265

22692266
function emitCallWithSpread(node: CallExpression) {
22702267
let target: Expression;
2271-
const expr = skipParentheses(node.expression);
2268+
const expr = skipParenthesesAndAssertions(node.expression);
22722269
if (expr.kind === SyntaxKind.PropertyAccessExpression) {
22732270
// Target will be emitted as "this" argument
22742271
target = emitCallTarget((<PropertyAccessExpression>expr).expression);
@@ -4334,9 +4331,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
43344331
writeLine();
43354332
emitStart(restParam);
43364333
emitNodeWithCommentsAndWithoutSourcemap(restParam.name);
4337-
write(restIndex > 0 || !compilerOptions.transformCompatibleEmit
4338-
? `[${tempName} - ${restIndex}] = arguments[${tempName}];`
4339-
: `[${tempName}] = arguments[${tempName}];`);
4334+
write(`[${tempName} - ${restIndex}] = arguments[${tempName}];`);
43404335
emitEnd(restParam);
43414336
decreaseIndent();
43424337
writeLine();
@@ -5356,7 +5351,7 @@ const _super = (function (geti, seti) {
53565351
const isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === SyntaxKind.ClassExpression;
53575352
let tempVariable: Identifier;
53585353

5359-
if (isClassExpressionWithStaticProperties && compilerOptions.transformCompatibleEmit) {
5354+
if (isClassExpressionWithStaticProperties) {
53605355
tempVariable = createAndRecordTempVariable(TempFlags.Auto);
53615356
write("(");
53625357
increaseIndent();
@@ -5393,11 +5388,6 @@ const _super = (function (geti, seti) {
53935388
writeLine();
53945389
emitConstructor(node, baseTypeNode);
53955390
emitMemberFunctionsForES5AndLower(node);
5396-
if (!compilerOptions.transformCompatibleEmit) {
5397-
emitPropertyDeclarations(node, staticProperties);
5398-
writeLine();
5399-
emitDecoratorsOfClass(node, /*decoratedClassAlias*/ undefined);
5400-
}
54015391
writeLine();
54025392
emitToken(SyntaxKind.CloseBraceToken, node.members.end, () => {
54035393
write("return ");
@@ -5424,13 +5414,10 @@ const _super = (function (geti, seti) {
54245414
write("))");
54255415
if (node.kind === SyntaxKind.ClassDeclaration) {
54265416
write(";");
5427-
if (compilerOptions.transformCompatibleEmit) {
5428-
emitPropertyDeclarations(node, staticProperties);
5429-
writeLine();
5430-
emitDecoratorsOfClass(node, /*decoratedClassAlias*/ undefined);
5431-
}
5417+
emitPropertyDeclarations(node, staticProperties);
5418+
emitDecoratorsOfClass(node, /*decoratedClassAlias*/ undefined);
54325419
}
5433-
else if (isClassExpressionWithStaticProperties && compilerOptions.transformCompatibleEmit) {
5420+
else if (isClassExpressionWithStaticProperties) {
54345421
for (const property of staticProperties) {
54355422
write(",");
54365423
writeLine();

src/compiler/factory.ts

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,24 +185,38 @@ namespace ts {
185185

186186
// Identifiers
187187

188-
export function createIdentifier(text: string): Identifier {
189-
const node = <Identifier>createNode(SyntaxKind.Identifier);
188+
export function createIdentifier(text: string, location?: TextRange): Identifier {
189+
const node = <Identifier>createNode(SyntaxKind.Identifier, location);
190190
node.text = text;
191191
return node;
192192
}
193193

194-
export function createTempVariable(): Identifier {
195-
const name = <Identifier>createNode(SyntaxKind.Identifier);
196-
name.text = undefined;
197-
name.tempKind = TempVariableKind.Auto;
194+
export function createTempVariable(location?: TextRange): Identifier {
195+
const na F4FE me = <Identifier>createNode(SyntaxKind.Identifier, location);
196+
name.autoGenerateKind = GeneratedIdentifierKind.Auto;
198197
getNodeId(name);
199198
return name;
200199
}
201200

202-
export function createLoopVariable(): Identifier {
203-
const name = <Identifier>createNode(SyntaxKind.Identifier);
204-
name.text = undefined;
205-
name.tempKind = TempVariableKind.Loop;
201+
export function createLoopVariable(location?: TextRange): Identifier {
202+
const name = <Identifier>createNode(SyntaxKind.Identifier, location);
203+
name.autoGenerateKind = GeneratedIdentifierKind.Loop;
204+
getNodeId(name);
205+
return name;
206+
}
207+
208+
export function createUniqueName(text: string, location?: TextRange): Identifier {
209+
const name = <Identifier>createNode(SyntaxKind.Identifier, location);
210+
name.text = text;
211+
name.autoGenerateKind = GeneratedIdentifierKind.Unique;
212+
getNodeId(name);
213+
return name;
214+
}
215+
216+
export function createGeneratedNameForNode(node: Node, location?: TextRange): Identifier {
217+
const name = <Identifier>createNode(SyntaxKind.Identifier, location);
218+
name.autoGenerateKind = GeneratedIdentifierKind.Node;
219+
name.original = node;
206220
getNodeId(name);
207221
return name;
208222
}

0 commit comments

Comments
 (0)
0