Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dd8ed65

Browse filesBrowse files
committed
Merge branch 'transforms-fixPerformance' into transforms-visitEachChildPerf
2 parents 6f5a23d + 4db1448 commit dd8ed65
Copy full SHA for dd8ed65

330 files changed

+1,380-1,613Lines changed: 1380 additions & 1613 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/compiler/binder.ts‎

Copy file name to clipboardExpand all lines: src/compiler/binder.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2172,8 +2172,8 @@ namespace ts {
21722172
// A GetAccessor or SetAccessor is ES5 syntax.
21732173
excludeFlags = TransformFlags.MethodOrAccessorExcludes;
21742174

2175-
// A GetAccessor or SetAccessor is TypeScript syntax if it is either abstract,
2176-
// or has a decorator.
2175+
// A GetAccessor or SetAccessor is TypeScript syntax if it has async or abstract
2176+
// modifiers, or has a decorator.
21772177
if ((<AccessorDeclaration>node).body === undefined
21782178
|| hasModifier(node, ModifierFlags.Async | ModifierFlags.Abstract)
21792179
|| subtreeFlags & TransformFlags.ContainsDecorators) {
Collapse file

‎src/compiler/factory.ts‎

Copy file name to clipboardExpand all lines: src/compiler/factory.ts
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,9 +1431,6 @@ namespace ts {
14311431
const right = getMutableClone(node.right);
14321432
return createPropertyAccess(left, right, /*location*/ node);
14331433
}
1434-
else if (isIdentifier(node)) {
1435-
return getMutableClone(node);
1436-
}
14371434
else {
14381435
return getMutableClone(node);
14391436
}
Collapse file

‎src/compiler/printer.ts‎

Copy file name to clipboardExpand all lines: src/compiler/printer.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ const _super = (function (geti, seti) {
220220

221221
// Write the source map
222222
if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) {
223-
writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), compilerOptions.emitBOM);
223+
writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false);
224224
}
225225

226226
// Record source map data for the test harness.
Collapse file

‎src/compiler/transformers/module/module.ts‎

Copy file name to clipboardExpand all lines: src/compiler/transformers/module/module.ts
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -712,9 +712,6 @@ namespace ts {
712712
function visitClassDeclaration(node: ClassDeclaration): VisitResult<Statement> {
713713
const statements: Statement[] = [];
714714
const name = node.name || getGeneratedNameForNode(node);
715-
// Set emitFlags on the name of the classDeclaration
716-
// This is so that when printer will not substitute the identifier
717-
setNodeEmitFlags(name, NodeEmitFlags.NoSubstitution);
718715
if (hasModifier(node, ModifierFlags.Export)) {
719716
statements.push(
720717
setOriginalNode(
Collapse file

‎src/compiler/transformers/ts.ts‎

Copy file name to clipboardExpand all lines: src/compiler/transformers/ts.ts
+9-8Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,7 @@ namespace ts {
228228
if (hasModifier(node, ModifierFlags.Ambient) && isStatement(node)) {
229229
// TypeScript ambient declarations are elided, but some comments may be preserved.
230230
// See the implementation of `getLeadingComments` in comments.ts for more details.
231-
return isStatement(node)
232-
? createNotEmittedStatement(node)
233-
: undefined;
231+
return createNotEmittedStatement(node);
234232
}
235233

236234
switch (node.kind) {
@@ -430,16 +428,19 @@ namespace ts {
430428

431429
const constructor = getFirstConstructorWithBody(node);
432430
if (constructor) {
433-
for (const parameter of constructor.parameters) {
434-
if (parameter.decorators && parameter.decorators.length > 0) {
435-
return true;
436-
}
437-
}
431+
return forEach(constructor.parameters, shouldEmitDecorateCallForParameter);
438432
}
439433

440434
return false;
441435
}
442436

437+
/**
438+
* Tests whether we should emit a __decorate call for a parameter declaration.
439+
*/
440+
function shouldEmitDecorateCallForParameter(parameter: ParameterDeclaration) {
441+
return parameter.decorators !== undefined && parameter.decorators.length > 0;
442+
}
443+
443444
/**
444445
* Transforms a class declaration with TypeScript syntax into compatible ES6.
445446
*
Collapse file

‎src/harness/compilerRunner.ts‎

Copy file name to clipboardExpand all lines: src/harness/compilerRunner.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class CompilerBaselineRunner extends RunnerBase {
156156
if (options.sourceMap || options.inlineSourceMap) {
157157
Harness.Baseline.runBaseline("Correct sourcemap content for " + fileName, justName.replace(/\.tsx?$/, ".sourcemap.txt"), () => {
158158
const record = result.getSourceMapRecord();
159-
if (options.noEmitOnError && result.errors.length !== 0 && record === undefined) {
159+
if ((options.noEmitOnError && result.errors.length !== 0) || record === undefined) {
160160
// Because of the noEmitOnError option no files are created. We need to return null because baselining isn"t required.
161161
return null;
162162
}
@@ -232,7 +232,7 @@ class CompilerBaselineRunner extends RunnerBase {
232232
}
233233

234234
Harness.Baseline.runBaseline("Correct Sourcemap output for " + fileName, justName.replace(/\.tsx?/, ".js.map"), () => {
235-
if (options.noEmitOnError && result.errors.length !== 0 && result.sourceMaps.length === 0) {
235+
if ((options.noEmitOnError && result.errors.length !== 0) || result.sourceMaps.length === 0) {
236236
// We need to return null here or the runBaseLine will actually create a empty file.
237237
// Baselining isn't required here because there is no output.
238238
return null;
Collapse file

‎src/harness/harness.ts‎

Copy file name to clipboardExpand all lines: src/harness/harness.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1432,7 +1432,7 @@ namespace Harness {
14321432
}
14331433

14341434
public getSourceMapRecord() {
1435-
if (this.sourceMapData) {
1435+
if (this.sourceMapData.length > 0) {
14361436
return Harness.SourceMapRecorder.getSourceMapRecord(this.sourceMapData, this.program, this.files);
14371437
}
14381438
}
Collapse file

‎tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map‎

Copy file name to clipboardExpand all lines: tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map
+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt‎

Copy file name to clipboardExpand all lines: tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt
+5-11Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,28 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
1212
1 >
1313
2 >^^^^
1414
3 > ^
15-
4 > ^^^
16-
5 > ^^^^^^^^^^^^^^^^^^^^^^^^->
15+
4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1716
1 >
1817
2 >var
1918
3 > v
20-
4 > =
2119
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
2220
2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
2321
3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0)
24-
4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0)
2522
---
2623
>>> _a["hello"] = function () {
2724
1->^^^^
2825
2 > ^^^
2926
3 > ^^^^^^^
30-
4 > ^
31-
5 > ^^^
32-
1->{
27+
4 > ^^^^
28+
1-> = {
3329
>
3430
2 > [
3531
3 > "hello"
36-
4 > ]
37-
5 >
32+
4 >
3833
1->Emitted(2, 5) Source(2, 5) + SourceIndex(0)
3934
2 >Emitted(2, 8) Source(2, 6) + SourceIndex(0)
4035
3 >Emitted(2, 15) Source(2, 13) + SourceIndex(0)
41-
4 >Emitted(2, 16) Source(2, 14) + SourceIndex(0)
42-
5 >Emitted(2, 19) Source(2, 5) + SourceIndex(0)
36+
4 >Emitted(2, 19) Source(2, 5) + SourceIndex(0)
4337
---
4438
>>> debugger;
4539
1 >^^^^^^^^
Collapse file

‎tests/baselines/reference/contextualTyping.js.map‎

Copy file name to clipboardExpand all lines: tests/baselines/reference/contextualTyping.js.map
+1-1Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.