Merge branch 'transforms-fixPerformance' into transforms-visitEachChildPerf

This commit is contained in:
Ron Buckton
2016-05-25 12:24:36 -07:00
330 changed files with 1381 additions and 1614 deletions

View File

@@ -2172,8 +2172,8 @@ namespace ts {
// A GetAccessor or SetAccessor is ES5 syntax.
excludeFlags = TransformFlags.MethodOrAccessorExcludes;
// A GetAccessor or SetAccessor is TypeScript syntax if it is either abstract,
// or has a decorator.
// A GetAccessor or SetAccessor is TypeScript syntax if it has async or abstract
// modifiers, or has a decorator.
if ((<AccessorDeclaration>node).body === undefined
|| hasModifier(node, ModifierFlags.Async | ModifierFlags.Abstract)
|| subtreeFlags & TransformFlags.ContainsDecorators) {

View File

@@ -1431,9 +1431,6 @@ namespace ts {
const right = getMutableClone(node.right);
return createPropertyAccess(left, right, /*location*/ node);
}
else if (isIdentifier(node)) {
return getMutableClone(node);
}
else {
return getMutableClone(node);
}

View File

@@ -220,7 +220,7 @@ const _super = (function (geti, seti) {
// Write the source map
if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) {
writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), compilerOptions.emitBOM);
writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false);
}
// Record source map data for the test harness.

View File

@@ -712,9 +712,6 @@ namespace ts {
function visitClassDeclaration(node: ClassDeclaration): VisitResult<Statement> {
const statements: Statement[] = [];
const name = node.name || getGeneratedNameForNode(node);
// Set emitFlags on the name of the classDeclaration
// This is so that when printer will not substitute the identifier
setNodeEmitFlags(name, NodeEmitFlags.NoSubstitution);
if (hasModifier(node, ModifierFlags.Export)) {
statements.push(
setOriginalNode(

View File

@@ -228,9 +228,7 @@ namespace ts {
if (hasModifier(node, ModifierFlags.Ambient) && isStatement(node)) {
// TypeScript ambient declarations are elided, but some comments may be preserved.
// See the implementation of `getLeadingComments` in comments.ts for more details.
return isStatement(node)
? createNotEmittedStatement(node)
: undefined;
return createNotEmittedStatement(node);
}
switch (node.kind) {
@@ -430,16 +428,19 @@ namespace ts {
const constructor = getFirstConstructorWithBody(node);
if (constructor) {
for (const parameter of constructor.parameters) {
if (parameter.decorators && parameter.decorators.length > 0) {
return true;
}
}
return forEach(constructor.parameters, shouldEmitDecorateCallForParameter);
}
return false;
}
/**
* Tests whether we should emit a __decorate call for a parameter declaration.
*/
function shouldEmitDecorateCallForParameter(parameter: ParameterDeclaration) {
return parameter.decorators !== undefined && parameter.decorators.length > 0;
}
/**
* Transforms a class declaration with TypeScript syntax into compatible ES6.
*

View File

@@ -156,7 +156,7 @@ class CompilerBaselineRunner extends RunnerBase {
if (options.sourceMap || options.inlineSourceMap) {
Harness.Baseline.runBaseline("Correct sourcemap content for " + fileName, justName.replace(/\.tsx?$/, ".sourcemap.txt"), () => {
const record = result.getSourceMapRecord();
if (options.noEmitOnError && result.errors.length !== 0 && record === undefined) {
if ((options.noEmitOnError && result.errors.length !== 0) || record === undefined) {
// Because of the noEmitOnError option no files are created. We need to return null because baselining isn"t required.
return null;
}
@@ -232,7 +232,7 @@ class CompilerBaselineRunner extends RunnerBase {
}
Harness.Baseline.runBaseline("Correct Sourcemap output for " + fileName, justName.replace(/\.tsx?/, ".js.map"), () => {
if (options.noEmitOnError && result.errors.length !== 0 && result.sourceMaps.length === 0) {
if ((options.noEmitOnError && result.errors.length !== 0) || result.sourceMaps.length === 0) {
// We need to return null here or the runBaseLine will actually create a empty file.
// Baselining isn't required here because there is no output.
return null;

View File

@@ -1432,7 +1432,7 @@ namespace Harness {
}
public getSourceMapRecord() {
if (this.sourceMapData) {
if (this.sourceMapData.length > 0) {
return Harness.SourceMapRecorder.getSourceMapRecord(this.sourceMapData, this.program, this.files);
}
}