Added temporary compat flag to control emit output to fix tests
This commit is contained in:
parent
2e47e2eb78
commit
e5cd8fef21
|
@ -223,6 +223,7 @@ function concatenateFiles(destinationFile, sourceFiles) {
|
|||
|
||||
var useDebugMode = true;
|
||||
var useTransforms = process.env.USE_TRANSFORMS || false;
|
||||
var useTransformCompat = false;
|
||||
var host = (process.env.host || process.env.TYPESCRIPT_HOST || "node");
|
||||
var compilerFilename = "tsc.js";
|
||||
var LKGCompiler = path.join(LKGDirectory, compilerFilename);
|
||||
|
@ -285,6 +286,9 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
|
|||
if (useBuiltCompiler && useTransforms) {
|
||||
options += " --experimentalTransforms"
|
||||
}
|
||||
else if (useBuiltCompiler && useTransformCompat) {
|
||||
options += " --transformCompatibleEmit"
|
||||
}
|
||||
|
||||
var cmd = host + " " + compilerPath + " " + options + " ";
|
||||
cmd = cmd + sources.join(" ");
|
||||
|
@ -413,6 +417,10 @@ task("setTransforms", function() {
|
|||
useTransforms = true;
|
||||
});
|
||||
|
||||
task("setTransformCompat", function() {
|
||||
useTransformCompat = true;
|
||||
});
|
||||
|
||||
task("configure-nightly", [configureNightlyJs], function() {
|
||||
var cmd = host + " " + configureNightlyJs + " " + packageJson + " " + programTs;
|
||||
console.log(cmd);
|
||||
|
|
|
@ -322,9 +322,18 @@ namespace ts {
|
|||
description: Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking
|
||||
},
|
||||
{
|
||||
// this option will be removed when this is merged with master and exists solely
|
||||
// to enable the tree transforming emitter side-by-side with the existing emitter.
|
||||
name: "experimentalTransforms",
|
||||
type: "boolean",
|
||||
experimental: true
|
||||
},
|
||||
{
|
||||
// this option will be removed when this is merged with master and exists solely
|
||||
// to enable the tree transforming emitter side-by-side with the existing emitter.
|
||||
name: "transformCompatibleEmit",
|
||||
type: "boolean",
|
||||
experimental: true
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
@ -1915,6 +1915,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
|
||||
if (multiLine) {
|
||||
decreaseIndent();
|
||||
if (!compilerOptions.transformCompatibleEmit) {
|
||||
writeLine();
|
||||
}
|
||||
}
|
||||
|
||||
write(")");
|
||||
|
@ -4331,7 +4334,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
writeLine();
|
||||
emitStart(restParam);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(restParam.name);
|
||||
write(restIndex > 0
|
||||
write(restIndex > 0 || !compilerOptions.transformCompatibleEmit
|
||||
? `[${tempName} - ${restIndex}] = arguments[${tempName}];`
|
||||
: `[${tempName}] = arguments[${tempName}];`);
|
||||
emitEnd(restParam);
|
||||
|
@ -5353,7 +5356,7 @@ const _super = (function (geti, seti) {
|
|||
const isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === SyntaxKind.ClassExpression;
|
||||
let tempVariable: Identifier;
|
||||
|
||||
if (isClassExpressionWithStaticProperties) {
|
||||
if (isClassExpressionWithStaticProperties && compilerOptions.transformCompatibleEmit) {
|
||||
tempVariable = createAndRecordTempVariable(TempFlags.Auto);
|
||||
write("(");
|
||||
increaseIndent();
|
||||
|
@ -5390,6 +5393,11 @@ const _super = (function (geti, seti) {
|
|||
writeLine();
|
||||
emitConstructor(node, baseTypeNode);
|
||||
emitMemberFunctionsForES5AndLower(node);
|
||||
if (!compilerOptions.transformCompatibleEmit) {
|
||||
emitPropertyDeclarations(node, staticProperties);
|
||||
writeLine();
|
||||
emitDecoratorsOfClass(node, /*decoratedClassAlias*/ undefined);
|
||||
}
|
||||
writeLine();
|
||||
emitToken(SyntaxKind.CloseBraceToken, node.members.end, () => {
|
||||
write("return ");
|
||||
|
@ -5416,11 +5424,13 @@ const _super = (function (geti, seti) {
|
|||
write("))");
|
||||
if (node.kind === SyntaxKind.ClassDeclaration) {
|
||||
write(";");
|
||||
emitPropertyDeclarations(node, staticProperties);
|
||||
writeLine();
|
||||
emitDecoratorsOfClass(node, /*decoratedClassAlias*/ undefined);
|
||||
if (compilerOptions.transformCompatibleEmit) {
|
||||
emitPropertyDeclarations(node, staticProperties);
|
||||
writeLine();
|
||||
emitDecoratorsOfClass(node, /*decoratedClassAlias*/ undefined);
|
||||
}
|
||||
}
|
||||
else if (isClassExpressionWithStaticProperties) {
|
||||
else if (isClassExpressionWithStaticProperties && compilerOptions.transformCompatibleEmit) {
|
||||
for (const property of staticProperties) {
|
||||
write(",");
|
||||
writeLine();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/// <reference path="sys.ts" />
|
||||
/// <reference path="emitter.ts" />
|
||||
/// <reference path="core.ts" />
|
||||
/// <reference path="printer.ts" />
|
||||
|
||||
namespace ts {
|
||||
/* @internal */ export let programTime = 0;
|
||||
|
|
|
@ -2470,6 +2470,7 @@ namespace ts {
|
|||
allowJs?: boolean;
|
||||
/* @internal */ stripInternal?: boolean;
|
||||
/* @internal */ experimentalTransforms?: boolean;
|
||||
/* @internal */ transformCompatibleEmit?: boolean;
|
||||
|
||||
// Skip checking lib.d.ts to help speed up tests.
|
||||
/* @internal */ skipDefaultLibCheck?: boolean;
|
||||
|
|
Loading…
Reference in a new issue