Merge branch 'transforms-transformer-module' into transforms-transformer-es6-generators
This commit is contained in:
commit
88b38f8b40
|
@ -241,7 +241,6 @@ 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);
|
||||
|
@ -304,9 +303,6 @@ 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(" ");
|
||||
|
@ -435,10 +431,6 @@ task("setTransforms", function() {
|
|||
useTransforms = true;
|
||||
});
|
||||
|
||||
task("setTransformCompat", function() {
|
||||
useTransformCompat = true;
|
||||
});
|
||||
|
||||
task("configure-nightly", [configureNightlyJs], function() {
|
||||
var cmd = host + " " + configureNightlyJs + " " + packageJson + " " + programTs;
|
||||
console.log(cmd);
|
||||
|
|
|
@ -1933,7 +1933,8 @@ namespace ts {
|
|||
case SyntaxKind.CallExpression:
|
||||
excludeFlags = TransformFlags.ArrayLiteralOrCallOrNewExcludes;
|
||||
if (subtreeFlags & TransformFlags.ContainsSpreadElementExpression
|
||||
|| isSuperCall(node)) {
|
||||
|| isSuperCall(node)
|
||||
|| isSuperPropertyCall(node)) {
|
||||
// If the this node contains a SpreadElementExpression, or is a super call, then it is an ES6
|
||||
// node.
|
||||
transformFlags |= TransformFlags.AssertES6;
|
||||
|
@ -1972,12 +1973,18 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
|
||||
// If the expression of a ParenthesizedExpression is a destructuring assignment,
|
||||
// then the ParenthesizedExpression is a destructuring assignment.
|
||||
if ((<ParenthesizedExpression>node).expression.transformFlags & TransformFlags.DestructuringAssignment) {
|
||||
transformFlags |= TransformFlags.DestructuringAssignment;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SyntaxKind.BinaryExpression:
|
||||
if (isDestructuringAssignment(node)) {
|
||||
// Destructuring assignments are ES6 syntax.
|
||||
transformFlags |= TransformFlags.AssertES6;
|
||||
transformFlags |= TransformFlags.AssertES6 | TransformFlags.DestructuringAssignment;
|
||||
}
|
||||
else if ((<BinaryExpression>node).operatorToken.kind === SyntaxKind.AsteriskAsteriskToken
|
||||
|| (<BinaryExpression>node).operatorToken.kind === SyntaxKind.AsteriskAsteriskEqualsToken) {
|
||||
|
@ -1987,6 +1994,16 @@ namespace ts {
|
|||
|
||||
break;
|
||||
|
||||
case SyntaxKind.ExpressionStatement:
|
||||
// If the expression of an expression statement is a destructuring assignment,
|
||||
// then we treat the statement as ES6 so that we can indicate that we do not
|
||||
// need to hold on to the right-hand side.
|
||||
if ((<ExpressionStatement>node).expression.transformFlags & TransformFlags.DestructuringAssignment) {
|
||||
transformFlags |= TransformFlags.AssertES6;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SyntaxKind.Parameter:
|
||||
// If the parameter has a question token, then it is TypeScript syntax.
|
||||
if ((<ParameterDeclaration>node).questionToken) {
|
||||
|
|
|
@ -4846,7 +4846,7 @@ namespace ts {
|
|||
const parent = container && container.parent;
|
||||
if (parent && (isClassLike(parent) || parent.kind === SyntaxKind.InterfaceDeclaration)) {
|
||||
if (!(container.flags & NodeFlags.Static) &&
|
||||
(container.kind !== SyntaxKind.Constructor || isNodeDescendentOf(node, (<ConstructorDeclaration>container).body))) {
|
||||
(container.kind !== SyntaxKind.Constructor || isNodeDescendantOf(node, (<ConstructorDeclaration>container).body))) {
|
||||
return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType;
|
||||
}
|
||||
}
|
||||
|
@ -7206,8 +7206,8 @@ namespace ts {
|
|||
let container = getContainingClass(node);
|
||||
while (container !== undefined) {
|
||||
if (container === localOrExportSymbol.valueDeclaration && container.name !== node) {
|
||||
getNodeLinks(container).flags |= NodeCheckFlags.ClassWithBodyScopedClassBinding;
|
||||
getNodeLinks(node).flags |= NodeCheckFlags.BodyScopedClassBinding;
|
||||
getNodeLinks(container).flags |= NodeCheckFlags.DecoratedClassWithSelfReference;
|
||||
getNodeLinks(node).flags |= NodeCheckFlags.SelfReferenceInDecoratedClass;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -7495,7 +7495,7 @@ namespace ts {
|
|||
// This is required for destructuring assignments, as a call expression cannot be used as the target of a destructuring assignment
|
||||
// while a property access can.
|
||||
if (container.kind === SyntaxKind.MethodDeclaration && container.flags & NodeFlags.Async) {
|
||||
if (isSuperPropertyOrElementAccess(node.parent) && isAssignmentTarget(node.parent)) {
|
||||
if (isSuperProperty(node.parent) && isAssignmentTarget(node.parent)) {
|
||||
getNodeLinks(container).flags |= NodeCheckFlags.AsyncMethodWithSuperBinding;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -327,13 +327,6 @@ namespace ts {
|
|||
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
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
@ -172,25 +172,118 @@ namespace ts {
|
|||
}
|
||||
|
||||
/**
|
||||
* Maps an array. If the mapped value is an array, it is spread into the result.
|
||||
* Flattens an array containing a mix of array or non-array elements.
|
||||
*
|
||||
* @param array The array to flatten.
|
||||
*/
|
||||
export function flatMap<T, U>(array: T[], f: (x: T, i: number) => U | U[]): U[] {
|
||||
export function flatten<T>(array: (T | T[])[]): T[] {
|
||||
let result: T[];
|
||||
if (array) {
|
||||
result = [];
|
||||
for (const v of array) {
|
||||
if (v) {
|
||||
if (isArray(v)) {
|
||||
addRange(result, v);
|
||||
}
|
||||
else {
|
||||
result.push(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps an array. If the mapped value is an array, it is spread into the result.
|
||||
*
|
||||
* @param array The array to map.
|
||||
* @param mapfn The callback used to map the result into one or more values.
|
||||
*/
|
||||
export function flatMap<T, U>(array: T[], mapfn: (x: T, i: number) => U | U[]): U[] {
|
||||
let result: U[];
|
||||
if (array) {
|
||||
result = [];
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
const v = array[i];
|
||||
const ar = f(v, i);
|
||||
if (ar) {
|
||||
// We cast to <U> here to leverage the behavior of Array#concat
|
||||
// which will append a single value here.
|
||||
result = result.concat(<U[]>ar);
|
||||
const v = mapfn(array[i], i);
|
||||
if (v) {
|
||||
if (isArray(v)) {
|
||||
addRange(result, v);
|
||||
}
|
||||
else {
|
||||
result.push(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the first matching span of elements and returns a tuple of the first span
|
||||
* and the remaining elements.
|
||||
*/
|
||||
export function span<T>(array: T[], f: (x: T, i: number) => boolean): [T[], T[]] {
|
||||
if (array) {
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
if (!f(array[i], i)) {
|
||||
return [array.slice(0, i), array.slice(i)];
|
||||
}
|
||||
}
|
||||
return [array.slice(0), []];
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps contiguous spans of values with the same key.
|
||||
*
|
||||
* @param array The array to map.
|
||||
* @param keyfn A callback used to select the key for an element.
|
||||
* @param mapfn A callback used to map a contiguous chunk of values to a single value.
|
||||
*/
|
||||
export function spanMap<T, K, U>(array: T[], keyfn: (x: T, i: number) => K, mapfn: (chunk: T[], key: K) => U): U[] {
|
||||
let result: U[];
|
||||
if (array) {
|
||||
result = [];
|
||||
const len = array.length;
|
||||
let previousKey: K;
|
||||
let key: K;
|
||||
let start = 0;
|
||||
let pos = 0;
|
||||
while (start < len) {
|
||||
while (pos < len) {
|
||||
const value = array[pos];
|
||||
key = keyfn(value, pos);
|
||||
if (pos === 0) {
|
||||
previousKey = key;
|
||||
}
|
||||
else if (key !== previousKey) {
|
||||
break;
|
||||
}
|
||||
|
||||
pos++;
|
||||
}
|
||||
|
||||
if (start < pos) {
|
||||
const v = mapfn(array.slice(start, pos), previousKey);
|
||||
if (v) {
|
||||
result.push(v);
|
||||
}
|
||||
|
||||
start = pos;
|
||||
}
|
||||
|
||||
previousKey = key;
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export function concatenate<T>(array1: T[], array2: T[]): T[] {
|
||||
if (!array2 || !array2.length) return array1;
|
||||
if (!array1 || !array1.length) return array2;
|
||||
|
|
|
@ -346,7 +346,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
};
|
||||
|
||||
function isUniqueLocalName(name: string, container: Node): boolean {
|
||||
for (let node = container; isNodeDescendentOf(node, container); node = node.nextContainer) {
|
||||
for (let node = container; isNodeDescendantOf(node, container); node = node.nextContainer) {
|
||||
if (node.locals && hasProperty(node.locals, name)) {
|
||||
// We conservatively include alias symbols to cover cases where they're emitted as locals
|
||||
if (node.locals[name].flags & (SymbolFlags.Value | SymbolFlags.ExportValue | SymbolFlags.Alias)) {
|
||||
|
@ -1529,7 +1529,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
return;
|
||||
}
|
||||
}
|
||||
else if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.BodyScopedClassBinding) {
|
||||
else if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.SelfReferenceInDecoratedClass) {
|
||||
// Due to the emit for class decorators, any reference to the class from inside of the class body
|
||||
// must instead be rewritten to point to a temporary variable to avoid issues with the double-bind
|
||||
// behavior of class names in ES6.
|
||||
|
@ -1915,9 +1915,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
|
||||
if (multiLine) {
|
||||
decreaseIndent();
|
||||
if (!compilerOptions.transformCompatibleEmit) {
|
||||
writeLine();
|
||||
}
|
||||
}
|
||||
|
||||
write(")");
|
||||
|
@ -2237,7 +2234,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
return forEach(elements, e => e.kind === SyntaxKind.SpreadElementExpression);
|
||||
}
|
||||
|
||||
function skipParentheses(node: Expression): Expression {
|
||||
function skipParenthesesAndAssertions(node: Expression): Expression {
|
||||
while (node.kind === SyntaxKind.ParenthesizedExpression || node.kind === SyntaxKind.TypeAssertionExpression || node.kind === SyntaxKind.AsExpression) {
|
||||
node = (<ParenthesizedExpression | AssertionExpression>node).expression;
|
||||
}
|
||||
|
@ -2268,7 +2265,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
|
||||
function emitCallWithSpread(node: CallExpression) {
|
||||
let target: Expression;
|
||||
const expr = skipParentheses(node.expression);
|
||||
const expr = skipParenthesesAndAssertions(node.expression);
|
||||
if (expr.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
// Target will be emitted as "this" argument
|
||||
target = emitCallTarget((<PropertyAccessExpression>expr).expression);
|
||||
|
@ -2342,7 +2339,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
superCall = true;
|
||||
}
|
||||
else {
|
||||
superCall = isSuperPropertyOrElementAccess(expression);
|
||||
superCall = isSuperProperty(expression);
|
||||
isAsyncMethodWithSuper = superCall && isInAsyncMethodWithSuperInES6(node);
|
||||
emit(expression);
|
||||
}
|
||||
|
@ -4334,9 +4331,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
writeLine();
|
||||
emitStart(restParam);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(restParam.name);
|
||||
write(restIndex > 0 || !compilerOptions.transformCompatibleEmit
|
||||
? `[${tempName} - ${restIndex}] = arguments[${tempName}];`
|
||||
: `[${tempName}] = arguments[${tempName}];`);
|
||||
write(`[${tempName} - ${restIndex}] = arguments[${tempName}];`);
|
||||
emitEnd(restParam);
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
|
@ -5208,7 +5203,7 @@ const _super = (function (geti, seti) {
|
|||
// [Example 4]
|
||||
//
|
||||
|
||||
if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.ClassWithBodyScopedClassBinding) {
|
||||
if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.DecoratedClassWithSelfReference) {
|
||||
decoratedClassAlias = unescapeIdentifier(makeUniqueName(node.name ? node.name.text : "default"));
|
||||
decoratedClassAliases[getNodeId(node)] = decoratedClassAlias;
|
||||
write(`let ${decoratedClassAlias};`);
|
||||
|
@ -5356,7 +5351,7 @@ const _super = (function (geti, seti) {
|
|||
const isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === SyntaxKind.ClassExpression;
|
||||
let tempVariable: Identifier;
|
||||
|
||||
if (isClassExpressionWithStaticProperties && compilerOptions.transformCompatibleEmit) {
|
||||
if (isClassExpressionWithStaticProperties) {
|
||||
tempVariable = createAndRecordTempVariable(TempFlags.Auto);
|
||||
write("(");
|
||||
increaseIndent();
|
||||
|
@ -5393,11 +5388,6 @@ 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 ");
|
||||
|
@ -5424,13 +5414,10 @@ const _super = (function (geti, seti) {
|
|||
write("))");
|
||||
if (node.kind === SyntaxKind.ClassDeclaration) {
|
||||
write(";");
|
||||
if (compilerOptions.transformCompatibleEmit) {
|
||||
emitPropertyDeclarations(node, staticProperties);
|
||||
writeLine();
|
||||
emitDecoratorsOfClass(node, /*decoratedClassAlias*/ undefined);
|
||||
}
|
||||
emitPropertyDeclarations(node, staticProperties);
|
||||
emitDecoratorsOfClass(node, /*decoratedClassAlias*/ undefined);
|
||||
}
|
||||
else if (isClassExpressionWithStaticProperties && compilerOptions.transformCompatibleEmit) {
|
||||
else if (isClassExpressionWithStaticProperties) {
|
||||
for (const property of staticProperties) {
|
||||
write(",");
|
||||
writeLine();
|
||||
|
|
|
@ -157,16 +157,16 @@ namespace ts {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a shallow, memberwise clone with no position information.
|
||||
* Creates a shallow, memberwise clone of a node with no source map location.
|
||||
*/
|
||||
export function getSynthesizedClone<T extends Node>(node: T): T {
|
||||
return cloneNode(node, /*location*/ undefined, node.flags, /*parent*/ undefined, /*original*/ node);
|
||||
return nodeIsSynthesized(node) ? node : cloneNode(node, /*location*/ undefined, node.flags, /*parent*/ undefined, /*original*/ node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a shallow, memberwise clone with the specified position information.
|
||||
* Creates a shallow, memberwise clone of a node at the specified source map location.
|
||||
*/
|
||||
export function getRelocatedClone<T extends Node>(node: T, location: TextRange) {
|
||||
export function getRelocatedClone<T extends Node>(node: T, location: TextRange): T {
|
||||
return cloneNode(node, location, node.flags, /*parent*/ undefined, /*original*/ node);
|
||||
}
|
||||
|
||||
|
@ -206,26 +206,32 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
export function createTempVariable(): Identifier {
|
||||
const name = <Identifier>createNode(SyntaxKind.Identifier);
|
||||
name.text = undefined;
|
||||
name.tempKind = GeneratedIdentifierKind.Auto;
|
||||
export function createTempVariable(location?: TextRange): Identifier {
|
||||
const name = <Identifier>createNode(SyntaxKind.Identifier, location);
|
||||
name.autoGenerateKind = GeneratedIdentifierKind.Auto;
|
||||
getNodeId(name);
|
||||
return name;
|
||||
}
|
||||
|
||||
export function createLoopVariable(): Identifier {
|
||||
const name = <Identifier>createNode(SyntaxKind.Identifier);
|
||||
name.text = undefined;
|
||||
name.tempKind = GeneratedIdentifierKind.Loop;
|
||||
export function createLoopVariable(location?: TextRange): Identifier {
|
||||
const name = <Identifier>createNode(SyntaxKind.Identifier, location);
|
||||
name.autoGenerateKind = GeneratedIdentifierKind.Loop;
|
||||
getNodeId(name);
|
||||
return name;
|
||||
}
|
||||
|
||||
export function createUniqueName(text: string): Identifier {
|
||||
const name = <Identifier>createNode(SyntaxKind.Identifier);
|
||||
export function createUniqueName(text: string, location?: TextRange): Identifier {
|
||||
const name = <Identifier>createNode(SyntaxKind.Identifier, location);
|
||||
name.text = text;
|
||||
name.tempKind = GeneratedIdentifierKind.Unique;
|
||||
name.autoGenerateKind = GeneratedIdentifierKind.Unique;
|
||||
getNodeId(name);
|
||||
return name;
|
||||
}
|
||||
|
||||
export function getGeneratedNameForNode(node: Node, location?: TextRange): Identifier {
|
||||
const name = <Identifier>createNode(SyntaxKind.Identifier, location);
|
||||
name.autoGenerateKind = GeneratedIdentifierKind.Node;
|
||||
name.original = node;
|
||||
getNodeId(name);
|
||||
return name;
|
||||
}
|
||||
|
@ -624,7 +630,7 @@ namespace ts {
|
|||
return createTryCatchFinally(tryBlock, /*catchClause*/ undefined, finallyBlock, location);
|
||||
}
|
||||
|
||||
export function createFunctionDeclaration(modifiers: Modifier[], asteriskToken: Node, name: string | Identifier, parameters: ParameterDeclaration[], body: Block, location?: TextRange) {
|
||||
export function createFunctionDeclaration(modifiers: Modifier[], asteriskToken: Node, name: string | Identifier, parameters: ParameterDeclaration[], body: Block, location?: TextRange, original?: Node) {
|
||||
const node = <FunctionDeclaration>createNode(SyntaxKind.FunctionDeclaration, location);
|
||||
node.decorators = undefined;
|
||||
setModifiers(node, modifiers);
|
||||
|
@ -634,6 +640,9 @@ namespace ts {
|
|||
node.parameters = createNodeArray(parameters);
|
||||
node.type = undefined;
|
||||
node.body = body;
|
||||
if (original) {
|
||||
node.original = original;
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
|
@ -1125,52 +1134,62 @@ namespace ts {
|
|||
);
|
||||
}
|
||||
|
||||
export interface CallTarget {
|
||||
export interface CallBinding {
|
||||
target: LeftHandSideExpression;
|
||||
thisArg: Expression;
|
||||
}
|
||||
|
||||
export function createCallBinding(expression: Expression): CallTarget {
|
||||
export function createCallBinding(expression: Expression, languageVersion?: ScriptTarget): CallBinding {
|
||||
const callee = skipParentheses(expression);
|
||||
let thisArg: Expression;
|
||||
let target: LeftHandSideExpression;
|
||||
switch (callee.kind) {
|
||||
case SyntaxKind.PropertyAccessExpression: {
|
||||
// for `a.b()` target is `(_a = a).b` and thisArg is `_a`
|
||||
thisArg = createTempVariable();
|
||||
target = createPropertyAccess(
|
||||
createAssignment(
|
||||
thisArg,
|
||||
(<PropertyAccessExpression>callee).expression,
|
||||
/*location*/ (<PropertyAccessExpression>callee).expression
|
||||
),
|
||||
(<PropertyAccessExpression>callee).name,
|
||||
/*location*/ callee
|
||||
);
|
||||
break;
|
||||
}
|
||||
if (isSuperProperty(callee)) {
|
||||
thisArg = createThis(/*location*/ callee.expression);
|
||||
target = callee;
|
||||
}
|
||||
else if (isSuperCall(callee)) {
|
||||
thisArg = createThis(/*location*/ callee);
|
||||
target = languageVersion < ScriptTarget.ES6 ? createIdentifier("_super", /*location*/ callee) : callee;
|
||||
}
|
||||
else {
|
||||
switch (callee.kind) {
|
||||
case SyntaxKind.PropertyAccessExpression: {
|
||||
// for `a.b()` target is `(_a = a).b` and thisArg is `_a`
|
||||
thisArg = createTempVariable();
|
||||
target = createPropertyAccess(
|
||||
createAssignment(
|
||||
thisArg,
|
||||
(<PropertyAccessExpression>callee).expression,
|
||||
/*location*/ (<PropertyAccessExpression>callee).expression
|
||||
),
|
||||
(<PropertyAccessExpression>callee).name,
|
||||
/*location*/ callee
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
case SyntaxKind.ElementAccessExpression: {
|
||||
// for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a`
|
||||
thisArg = createTempVariable();
|
||||
target = createElementAccess(
|
||||
createAssignment(
|
||||
thisArg,
|
||||
(<ElementAccessExpression>callee).expression,
|
||||
/*location*/ (<ElementAccessExpression>callee).expression
|
||||
),
|
||||
(<ElementAccessExpression>callee).argumentExpression,
|
||||
/*location*/ callee
|
||||
);
|
||||
case SyntaxKind.ElementAccessExpression: {
|
||||
// for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a`
|
||||
thisArg = createTempVariable();
|
||||
target = createElementAccess(
|
||||
createAssignment(
|
||||
thisArg,
|
||||
(<ElementAccessExpression>callee).expression,
|
||||
/*location*/ (<ElementAccessExpression>callee).expression
|
||||
),
|
||||
(<ElementAccessExpression>callee).argumentExpression,
|
||||
/*location*/ callee
|
||||
);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
// for `a()` target is `a` and thisArg is `void 0`
|
||||
thisArg = createVoidZero();
|
||||
target = parenthesizeForAccess(expression);
|
||||
break;
|
||||
default: {
|
||||
// for `a()` target is `a` and thisArg is `void 0`
|
||||
thisArg = createVoidZero();
|
||||
target = parenthesizeForAccess(expression);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1405,6 +1424,12 @@ namespace ts {
|
|||
|| binaryOperator === SyntaxKind.CaretToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps an expression in parentheses if it is needed in order to use the expression
|
||||
* as the expression of a NewExpression node.
|
||||
*
|
||||
* @param expression The Expression node.
|
||||
*/
|
||||
export function parenthesizeForNew(expression: Expression): LeftHandSideExpression {
|
||||
const lhs = parenthesizeForAccess(expression);
|
||||
switch (lhs.kind) {
|
||||
|
|
|
@ -280,7 +280,6 @@ const _super = (function (geti, seti) {
|
|||
const writer = createTextWriter(newLine);
|
||||
const {
|
||||
write,
|
||||
writeTextOfNode,
|
||||
writeLine,
|
||||
increaseIndent,
|
||||
decreaseIndent
|
||||
|
@ -307,15 +306,16 @@ const _super = (function (geti, seti) {
|
|||
let startLexicalEnvironment: () => void;
|
||||
let endLexicalEnvironment: () => Statement[];
|
||||
let getNodeEmitFlags: (node: Node) => NodeEmitFlags;
|
||||
let setNodeEmitFlags: (node: Node, flags: NodeEmitFlags) => void;
|
||||
let isExpressionSubstitutionEnabled: (node: Node) => boolean;
|
||||
let isEmitNotificationEnabled: (node: Node) => boolean;
|
||||
let expressionSubstitution: (node: Expression) => Expression;
|
||||
let identifierSubstitution: (node: Identifier) => Identifier;
|
||||
let onBeforeEmitNode: (node: Node) => void;
|
||||
let onAfterEmitNode: (node: Node) => void;
|
||||
let temporaryVariables: string[] = [];
|
||||
let tempFlags: TempFlags;
|
||||
let nodeToGeneratedName: string[];
|
||||
let generatedNameSet: Map<string>;
|
||||
let tempFlags: TempFlags;
|
||||
let currentSourceFile: SourceFile;
|
||||
let currentText: string;
|
||||
let currentFileIdentifiers: Map<string>;
|
||||
|
@ -329,8 +329,8 @@ const _super = (function (geti, seti) {
|
|||
|
||||
function doPrint(jsFilePath: string, sourceMapFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean) {
|
||||
sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit);
|
||||
nodeToGeneratedName = [];
|
||||
generatedNameSet = {};
|
||||
|
||||
isOwnFileEmit = !isBundledEmit;
|
||||
|
||||
// Emit helpers from all the files
|
||||
|
@ -369,13 +369,13 @@ const _super = (function (geti, seti) {
|
|||
startLexicalEnvironment = undefined;
|
||||
endLexicalEnvironment = undefined;
|
||||
getNodeEmitFlags = undefined;
|
||||
setNodeEmitFlags = undefined;
|
||||
isExpressionSubstitutionEnabled = undefined;
|
||||
isEmitNotificationEnabled = undefined;
|
||||
expressionSubstitution = undefined;
|
||||
identifierSubstitution = undefined;
|
||||
onBeforeEmitNode = undefined;
|
||||
onAfterEmitNode = undefined;
|
||||
temporaryVariables = undefined;
|
||||
tempFlags = TempFlags.Auto;
|
||||
currentSourceFile = undefined;
|
||||
currentText = undefined;
|
||||
|
@ -391,6 +391,7 @@ const _super = (function (geti, seti) {
|
|||
startLexicalEnvironment = context.startLexicalEnvironment;
|
||||
endLexicalEnvironment = context.endLexicalEnvironment;
|
||||
getNodeEmitFlags = context.getNodeEmitFlags;
|
||||
setNodeEmitFlags = context.setNodeEmitFlags;
|
||||
isExpressionSubstitutionEnabled = context.isExpressionSubstitutionEnabled;
|
||||
isEmitNotificationEnabled = context.isEmitNotificationEnabled;
|
||||
expressionSubstitution = context.expressionSubstitution;
|
||||
|
@ -820,46 +821,14 @@ const _super = (function (geti, seti) {
|
|||
//
|
||||
|
||||
function emitIdentifier(node: Identifier) {
|
||||
switch (node.tempKind) {
|
||||
case GeneratedIdentifierKind.Auto:
|
||||
return emitAutoIdentifier(node);
|
||||
case GeneratedIdentifierKind.Loop:
|
||||
return emitLoopIdentifier(node);
|
||||
case GeneratedIdentifierKind.Unique:
|
||||
return emitUniqueIdentifier(node);
|
||||
}
|
||||
|
||||
if (nodeIsSynthesized(node) || !node.parent) {
|
||||
if (getNodeEmitFlags(node) & NodeEmitFlags.UMDDefine) {
|
||||
writeLines(umdHelper);
|
||||
}
|
||||
else {
|
||||
write(node.text);
|
||||
}
|
||||
if (getNodeEmitFlags(node) & NodeEmitFlags.UMDDefine) {
|
||||
writeLines(umdHelper);
|
||||
}
|
||||
else {
|
||||
writeTextOfNode(currentText, node);
|
||||
write(getTextOfNode(node, /*includeTrivia*/ false));
|
||||
}
|
||||
}
|
||||
|
||||
function emitAutoIdentifier(node: Identifier) {
|
||||
const nodeId = getOriginalNodeId(node);
|
||||
const text = temporaryVariables[nodeId] || (temporaryVariables[nodeId] = makeTempVariableName(TempFlags.Auto));
|
||||
write(text);
|
||||
}
|
||||
|
||||
function emitLoopIdentifier(node: Identifier) {
|
||||
const nodeId = getOriginalNodeId(node);
|
||||
const text = temporaryVariables[nodeId] || (temporaryVariables[nodeId] = makeTempVariableName(TempFlags._i));
|
||||
write(text);
|
||||
}
|
||||
|
||||
function emitUniqueIdentifier(node: Identifier) {
|
||||
const nodeId = getOriginalNodeId(node);
|
||||
const text = temporaryVariables[nodeId] || (temporaryVariables[nodeId] = makeUniqueName(node.text));
|
||||
write(text);
|
||||
}
|
||||
|
||||
//
|
||||
// Names
|
||||
//
|
||||
|
@ -1902,7 +1871,6 @@ const _super = (function (geti, seti) {
|
|||
emitExpression(node.expression);
|
||||
write(":");
|
||||
|
||||
debugger;
|
||||
emitCaseOrDefaultClauseStatements(node, node.statements);
|
||||
}
|
||||
|
||||
|
@ -1945,14 +1913,14 @@ const _super = (function (geti, seti) {
|
|||
function emitPropertyAssignment(node: PropertyAssignment) {
|
||||
emit(node.name);
|
||||
write(": ");
|
||||
// // This is to ensure that we emit comment in the following case:
|
||||
// // For example:
|
||||
// // obj = {
|
||||
// // id: /*comment1*/ ()=>void
|
||||
// // }
|
||||
// // "comment1" is not considered to be leading comment for node.initializer
|
||||
// // but rather a trailing comment on the previous node.
|
||||
// emitTrailingCommentsOfPosition(node.initializer.pos);
|
||||
// This is to ensure that we emit comment in the following case:
|
||||
// For example:
|
||||
// obj = {
|
||||
// id: /*comment1*/ ()=>void
|
||||
// }
|
||||
// "comment1" is not considered to be leading comment for node.initializer
|
||||
// but rather a trailing comment on the previous node.
|
||||
emitLeadingComments(node.initializer, getTrailingComments(collapseTextRange(node.initializer, TextRangeCollapse.CollapseToStart)));
|
||||
emitExpression(node.initializer);
|
||||
}
|
||||
|
||||
|
@ -2133,11 +2101,8 @@ const _super = (function (geti, seti) {
|
|||
}
|
||||
|
||||
function emitModifiers(node: Node, modifiers: ModifiersArray) {
|
||||
const startingPos = writer.getTextPos();
|
||||
emitList(node, modifiers, ListFormat.SingleLine);
|
||||
|
||||
const endingPos = writer.getTextPos();
|
||||
if (startingPos !== endingPos) {
|
||||
if (modifiers && modifiers.length) {
|
||||
emitList(node, modifiers, ListFormat.SingleLine);
|
||||
write(" ");
|
||||
}
|
||||
}
|
||||
|
@ -2165,10 +2130,13 @@ const _super = (function (geti, seti) {
|
|||
}
|
||||
|
||||
function tryEmitSubstitute(node: Node, substitution: (node: Node) => Node) {
|
||||
const substitute = substitution ? substitution(node) : node;
|
||||
if (substitute && substitute !== node) {
|
||||
emitWorker(substitute);
|
||||
return true;
|
||||
if (substitution && (getNodeEmitFlags(node) & NodeEmitFlags.NoSubstitution) === 0) {
|
||||
const substitute = substitution(node);
|
||||
if (substitute !== node) {
|
||||
setNodeEmitFlags(substitute, NodeEmitFlags.NoSubstitution);
|
||||
emitWorker(substitute);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -2527,7 +2495,15 @@ const _super = (function (geti, seti) {
|
|||
}
|
||||
|
||||
function getTextOfNode(node: Node, includeTrivia?: boolean) {
|
||||
if (nodeIsSynthesized(node) && (isLiteralExpression(node) || isIdentifier(node))) {
|
||||
if (isIdentifier(node)) {
|
||||
if (node.autoGenerateKind) {
|
||||
return getGeneratedIdentifier(node);
|
||||
}
|
||||
else if (nodeIsSynthesized(node) || !node.parent) {
|
||||
return node.text;
|
||||
}
|
||||
}
|
||||
else if (isLiteralExpression(node) && (nodeIsSynthesized(node) || !node.parent)) {
|
||||
return node.text;
|
||||
}
|
||||
|
||||
|
@ -2550,18 +2526,24 @@ const _super = (function (geti, seti) {
|
|||
&& rangeEndIsOnSameLineAsRangeStart(block, block);
|
||||
}
|
||||
|
||||
function tempKindToFlags(kind: GeneratedIdentifierKind) {
|
||||
return kind === GeneratedIdentifierKind.Loop
|
||||
? TempFlags._i
|
||||
: TempFlags.Auto;
|
||||
}
|
||||
|
||||
function isUniqueName(name: string): boolean {
|
||||
return !resolver.hasGlobalName(name) &&
|
||||
!hasProperty(currentFileIdentifiers, name) &&
|
||||
!hasProperty(generatedNameSet, name);
|
||||
}
|
||||
|
||||
function isUniqueLocalName(name: string, container: Node): boolean {
|
||||
for (let node = container; isNodeDescendantOf(node, container); node = node.nextContainer) {
|
||||
if (node.locals && hasProperty(node.locals, name)) {
|
||||
// We conservatively include alias symbols to cover cases where they're emitted as locals
|
||||
if (node.locals[name].flags & (SymbolFlags.Value | SymbolFlags.ExportValue | SymbolFlags.Alias)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the next available name in the pattern _a ... _z, _0, _1, ...
|
||||
* TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name.
|
||||
|
@ -2590,28 +2572,84 @@ const _super = (function (geti, seti) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a name that is unique within the current file and doesn't conflict with any names
|
||||
* in global scope. The name is formed by adding an '_n' suffix to the specified base name,
|
||||
* where n is a positive integer. Note that names generated by makeTempVariableName and
|
||||
* makeUniqueName are guaranteed to never conflict.
|
||||
*/
|
||||
// Generate a name that is unique within the current file and doesn't conflict with any names
|
||||
// in global scope. The name is formed by adding an '_n' suffix to the specified base name,
|
||||
// where n is a positive integer. Note that names generated by makeTempVariableName and
|
||||
// makeUniqueName are guaranteed to never conflict.
|
||||
function makeUniqueName(baseName: string): string {
|
||||
// Find the first unique 'name_n', where n is a positive number
|
||||
if (baseName.charCodeAt(baseName.length - 1) !== CharacterCodes._) {
|
||||
baseName += "_";
|
||||
}
|
||||
|
||||
let i = 1;
|
||||
while (true) {
|
||||
const generatedName = baseName + i;
|
||||
if (isUniqueName(generatedName)) {
|
||||
return generatedNameSet[generatedName] = generatedName;
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
function generateNameForModuleOrEnum(node: ModuleDeclaration | EnumDeclaration) {
|
||||
const name = node.name.text;
|
||||
// Use module/enum name itself if it is unique, otherwise make a unique variation
|
||||
return isUniqueLocalName(name, node) ? name : makeUniqueName(name);
|
||||
}
|
||||
|
||||
function generateNameForImportOrExportDeclaration(node: ImportDeclaration | ExportDeclaration) {
|
||||
const expr = getExternalModuleName(node);
|
||||
const baseName = expr.kind === SyntaxKind.StringLiteral ?
|
||||
escapeIdentifier(makeIdentifierFromModuleName((<LiteralExpression>expr).text)) : "module";
|
||||
return makeUniqueName(baseName);
|
||||
}
|
||||
|
||||
function generateNameForExportDefault() {
|
||||
return makeUniqueName("default");
|
||||
}
|
||||
|
||||
function generateNameForClassExpression() {
|
||||
return makeUniqueName("class");
|
||||
}
|
||||
|
||||
function generateNameForNode(node: Node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
return makeUniqueName((<Identifier>node).text);
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
return generateNameForModuleOrEnum(<ModuleDeclaration | EnumDeclaration>node);
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
case SyntaxKind.ExportDeclaration:
|
||||
return generateNameForImportOrExportDeclaration(<ImportDeclaration | ExportDeclaration>node);
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ExportAssignment:
|
||||
return generateNameForExportDefault();
|
||||
case SyntaxKind.ClassExpression:
|
||||
return generateNameForClassExpression();
|
||||
default:
|
||||
return makeTempVariableName(TempFlags.Auto);
|
||||
}
|
||||
}
|
||||
|
||||
function generateIdentifier(node: Identifier) {
|
||||
switch (node.autoGenerateKind) {
|
||||
case GeneratedIdentifierKind.Auto:
|
||||
return makeTempVariableName(TempFlags.Auto);
|
||||
case GeneratedIdentifierKind.Loop:
|
||||
return makeTempVariableName(TempFlags._i);
|
||||
case GeneratedIdentifierKind.Unique:
|
||||
return makeUniqueName(node.text);
|
||||
case GeneratedIdentifierKind.Node:
|
||||
return generateNameForNode(getOriginalNode(node));
|
||||
}
|
||||
}
|
||||
|
||||
function getGeneratedIdentifier(node: Identifier) {
|
||||
const id = getOriginalNodeId(node);
|
||||
return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = unescapeIdentifier(generateIdentifier(node)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@ namespace ts {
|
|||
* @param transforms An array of Transformers.
|
||||
*/
|
||||
export function transformFiles(resolver: EmitResolver, host: EmitHost, sourceFiles: SourceFile[], transformers: Transformer[]) {
|
||||
const nodeToGeneratedName: Identifier[] = [];
|
||||
const nodeEmitFlags: NodeEmitFlags[] = [];
|
||||
const lexicalEnvironmentVariableDeclarationsStack: VariableDeclaration[][] = [];
|
||||
const lexicalEnvironmentFunctionDeclarationsStack: FunctionDeclaration[][] = [];
|
||||
|
@ -73,8 +72,6 @@ namespace ts {
|
|||
getEmitResolver: () => resolver,
|
||||
getNodeEmitFlags,
|
||||
setNodeEmitFlags,
|
||||
getGeneratedNameForNode,
|
||||
nodeHasGeneratedName,
|
||||
hoistVariableDeclaration,
|
||||
hoistFunctionDeclaration,
|
||||
startLexicalEnvironment,
|
||||
|
@ -150,118 +147,6 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Generate a name that is unique within the current file and doesn't conflict with any names
|
||||
// * in global scope. The name is formed by adding an '_n' suffix to the specified base name,
|
||||
// * where n is a positive integer. Note that names generated by makeTempVariableName and
|
||||
// * makeUniqueName are guaranteed to never conflict.
|
||||
// */
|
||||
// function makeUniqueName(baseName: string): Identifier {
|
||||
// // Find the first unique 'name_n', where n is a positive number
|
||||
// if (baseName.charCodeAt(baseName.length - 1) !== CharacterCodes._) {
|
||||
// baseName += "_";
|
||||
// }
|
||||
|
||||
// let i = 1;
|
||||
// while (true) {
|
||||
// const generatedName = baseName + i;
|
||||
// if (isUniqueName(generatedName)) {
|
||||
// return createIdentifier(generatedNameSet[generatedName] = generatedName);
|
||||
// }
|
||||
|
||||
// i++;
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Gets the generated name for a node.
|
||||
*/
|
||||
function getGeneratedNameForNode(node: Node) {
|
||||
const id = getNodeId(node);
|
||||
return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = generateNameForNode(node));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a value indicating whether a node has a generated name.
|
||||
*/
|
||||
function nodeHasGeneratedName(node: Node) {
|
||||
const id = getNodeId(node);
|
||||
return nodeToGeneratedName[id] !== undefined;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Tests whether the provided name is unique.
|
||||
// */
|
||||
// function isUniqueName(name: string): boolean {
|
||||
// return !resolver.hasGlobalName(name)
|
||||
// && !hasProperty(currentSourceFile.identifiers, name)
|
||||
// && !hasProperty(generatedNameSet, name);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Tests whether the provided name is unique within a container.
|
||||
*/
|
||||
function isUniqueLocalName(name: string, container: Node): boolean {
|
||||
container = getOriginalNode(container);
|
||||
for (let node = container; isNodeDescendentOf(node, container); node = node.nextContainer) {
|
||||
if (node.locals && hasProperty(node.locals, name)) {
|
||||
// We conservatively include alias symbols to cover cases where they're emitted as locals
|
||||
if (node.locals[name].flags & (SymbolFlags.Value | SymbolFlags.ExportValue | SymbolFlags.Alias)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a name for a node.
|
||||
*/
|
||||
function generateNameForNode(node: Node): Identifier {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
return createUniqueName((<Identifier>node).text);
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
return generateNameForModuleOrEnum(<ModuleDeclaration | EnumDeclaration>node);
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
case SyntaxKind.ExportDeclaration:
|
||||
return generateNameForImportOrExportDeclaration(<ImportDeclaration | ExportDeclaration>node);
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
Debug.assert((node.flags & NodeFlags.Default) !== 0, "Can only generate a name for a default export.");
|
||||
return generateNameForExportDefault();
|
||||
case SyntaxKind.ExportAssignment:
|
||||
return generateNameForExportDefault();
|
||||
case SyntaxKind.ClassExpression:
|
||||
return generateNameForClassExpression();
|
||||
default:
|
||||
return createTempVariable();
|
||||
}
|
||||
}
|
||||
|
||||
function generateNameForModuleOrEnum(node: ModuleDeclaration | EnumDeclaration) {
|
||||
const name = node.name;
|
||||
// Use module/enum name itself if it is unique, otherwise make a unique variation
|
||||
return isUniqueLocalName(name.text, node) ? name : createUniqueName(name.text);
|
||||
}
|
||||
|
||||
function generateNameForImportOrExportDeclaration(node: ImportDeclaration | ExportDeclaration) {
|
||||
const expr = getExternalModuleName(node);
|
||||
const baseName = expr.kind === SyntaxKind.StringLiteral
|
||||
? escapeIdentifier(makeIdentifierFromModuleName((<LiteralExpression>expr).text))
|
||||
: "module";
|
||||
return createUniqueName(baseName);
|
||||
}
|
||||
|
||||
function generateNameForExportDefault() {
|
||||
return createUniqueName("default");
|
||||
}
|
||||
|
||||
function generateNameForClassExpression() {
|
||||
return createUniqueName("class");
|
||||
}
|
||||
|
||||
/**
|
||||
* Records a hoisted variable declaration for the provided name within a lexical environment.
|
||||
*/
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -231,7 +231,6 @@ namespace ts {
|
|||
|
||||
export function transformGenerators(context: TransformationContext) {
|
||||
const {
|
||||
getGeneratedNameForNode,
|
||||
startLexicalEnvironment,
|
||||
endLexicalEnvironment,
|
||||
hoistFunctionDeclaration,
|
||||
|
|
|
@ -9,6 +9,11 @@ namespace ts {
|
|||
const compilerOptions = context.getCompilerOptions();
|
||||
return transformSourceFile;
|
||||
|
||||
/**
|
||||
* Transform JSX-specific syntax in a SourceFile.
|
||||
*
|
||||
* @param node A SourceFile node.
|
||||
*/
|
||||
function transformSourceFile(node: SourceFile) {
|
||||
return visitEachChild(node, visitor, context);
|
||||
}
|
||||
|
@ -64,52 +69,41 @@ namespace ts {
|
|||
}
|
||||
|
||||
function visitJsxOpeningLikeElement(node: JsxOpeningLikeElement, children: JsxChild[]) {
|
||||
// We must the node onto the node stack if it is not already at the top.
|
||||
const tagName = getTagName(node);
|
||||
let objectProperties: Expression;
|
||||
if (node.attributes.length === 0) {
|
||||
const attrs = node.attributes;
|
||||
if (attrs.length === 0) {
|
||||
// When there are no attributes, React wants "null"
|
||||
objectProperties = createNull();
|
||||
}
|
||||
else {
|
||||
// Map spans of JsxAttribute nodes into object literals and spans
|
||||
// of JsxSpreadAttribute nodes into expressions.
|
||||
const segments = flatten(
|
||||
spanMap(attrs, isJsxSpreadAttribute, (attrs, isSpread) => isSpread
|
||||
? map(attrs, transformJsxSpreadAttributeToExpression)
|
||||
: createObjectLiteral(map(attrs, transformJsxAttributeToObjectLiteralElement))
|
||||
)
|
||||
);
|
||||
|
||||
if (isJsxSpreadAttribute(attrs[0])) {
|
||||
// We must always emit at least one object literal before a spread
|
||||
// argument.
|
||||
segments.unshift(createObjectLiteral());
|
||||
}
|
||||
|
||||
// Either emit one big object literal (no spread attribs), or
|
||||
// a call to React.__spread
|
||||
const attrs = node.attributes;
|
||||
if (forEach(attrs, isJsxSpreadAttribute)) {
|
||||
const segments: Expression[] = [];
|
||||
let properties: ObjectLiteralElement[] = [];
|
||||
for (const attr of attrs) {
|
||||
if (isJsxSpreadAttribute(attr)) {
|
||||
if (properties) {
|
||||
segments.push(createObjectLiteral(properties));
|
||||
properties = undefined;
|
||||
}
|
||||
|
||||
addNode(segments, transformJsxSpreadAttributeToExpression(attr));
|
||||
}
|
||||
else {
|
||||
if (!properties) {
|
||||
properties = [];
|
||||
}
|
||||
|
||||
addNode(properties, transformJsxAttributeToObjectLiteralElement(attr));
|
||||
}
|
||||
}
|
||||
|
||||
if (properties) {
|
||||
segments.push(createObjectLiteral(properties));
|
||||
}
|
||||
|
||||
objectProperties = createJsxSpread(compilerOptions.reactNamespace, segments);
|
||||
}
|
||||
else {
|
||||
const properties = map(node.attributes, transformJsxAttributeToObjectLiteralElement);
|
||||
objectProperties = createObjectLiteral(properties);
|
||||
}
|
||||
objectProperties = singleOrUndefined(segments)
|
||||
|| createJsxSpread(compilerOptions.reactNamespace, segments);
|
||||
}
|
||||
|
||||
const childExpressions = filter(map(children, transformJsxChildToExpression), isDefined);
|
||||
return createJsxCreateElement(compilerOptions.reactNamespace, tagName, objectProperties, childExpressions);
|
||||
return createJsxCreateElement(
|
||||
compilerOptions.reactNamespace,
|
||||
tagName,
|
||||
objectProperties,
|
||||
filter(map(children, transformJsxChildToExpression), isDefined)
|
||||
);
|
||||
}
|
||||
|
||||
function transformJsxSpreadAttributeToExpression(node: JsxSpreadAttribute) {
|
||||
|
@ -125,39 +119,29 @@ namespace ts {
|
|||
}
|
||||
|
||||
function visitJsxText(node: JsxText) {
|
||||
const text = getTextToEmit(node);
|
||||
if (text !== undefined) {
|
||||
return createLiteral(text);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function getTextToEmit(node: JsxText) {
|
||||
const text = trimReactWhitespaceAndApplyEntities(node);
|
||||
if (text === undefined || text.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
else {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
function trimReactWhitespaceAndApplyEntities(node: JsxText): string {
|
||||
const text = getTextOfNode(node, /*includeTrivia*/ true);
|
||||
let result: string = undefined;
|
||||
let parts: Expression[];
|
||||
let firstNonWhitespace = 0;
|
||||
let lastNonWhitespace = -1;
|
||||
|
||||
// JSX trims whitespace at the end and beginning of lines, except that the
|
||||
// start/end of a tag is considered a start/end of a line only if that line is
|
||||
// on the same line as the closing tag. See examples in tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx
|
||||
// on the same line as the closing tag. See examples in
|
||||
// tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
const c = text.charCodeAt(i);
|
||||
if (isLineBreak(c)) {
|
||||
if (firstNonWhitespace !== -1 && (lastNonWhitespace - firstNonWhitespace + 1 > 0)) {
|
||||
const part = text.substr(firstNonWhitespace, lastNonWhitespace - firstNonWhitespace + 1);
|
||||
result = (result ? result + "\" + ' ' + \"" : "") + part;
|
||||
if (!parts) {
|
||||
parts = [];
|
||||
}
|
||||
|
||||
// We do not escape the string here as that is handled by the printer
|
||||
// when it emits the literal. We do, however, need to decode JSX entities.
|
||||
parts.push(createLiteral(decodeEntities(part)));
|
||||
}
|
||||
|
||||
firstNonWhitespace = -1;
|
||||
}
|
||||
else if (!isWhiteSpace(c)) {
|
||||
|
@ -170,22 +154,41 @@ namespace ts {
|
|||
|
||||
if (firstNonWhitespace !== -1) {
|
||||
const part = text.substr(firstNonWhitespace);
|
||||
result = (result ? result + "\" + ' ' + \"" : "") + part;
|
||||
if (!parts) {
|
||||
parts = [];
|
||||
}
|
||||
|
||||
// We do not escape the string here as that is handled by the printer
|
||||
// when it emits the literal. We do, however, need to decode JSX entities.
|
||||
parts.push(createLiteral(decodeEntities(part)));
|
||||
}
|
||||
|
||||
if (result) {
|
||||
// Replace entities like
|
||||
result = result.replace(/&(\w+);/g, function(s: any, m: string) {
|
||||
if (entities[m] !== undefined) {
|
||||
return String.fromCharCode(entities[m]);
|
||||
}
|
||||
else {
|
||||
return s;
|
||||
}
|
||||
});
|
||||
if (parts) {
|
||||
return reduceLeft(parts, aggregateJsxTextParts);
|
||||
}
|
||||
|
||||
return result;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Aggregates two expressions by interpolating them with a whitespace literal.
|
||||
*/
|
||||
function aggregateJsxTextParts(left: Expression, right: Expression) {
|
||||
return createAdd(createAdd(left, createLiteral(" ")), right);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes JSX entities.
|
||||
*/
|
||||
function decodeEntities(text: string) {
|
||||
return text.replace(/&(\w+);/g, function(s: any, m: string) {
|
||||
if (entities[m] !== undefined) {
|
||||
return String.fromCharCode(entities[m]);
|
||||
}
|
||||
else {
|
||||
return s;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getTagName(node: JsxElement | JsxOpeningLikeElement): Expression {
|
||||
|
@ -210,7 +213,7 @@ namespace ts {
|
|||
*/
|
||||
function getAttributeName(node: JsxAttribute): StringLiteral | Identifier {
|
||||
const name = node.name;
|
||||
if (/[A-Za-z_]+[\w*]/.test(name.text)) {
|
||||
if (/^[A-Za-z_]\w*$/.test(name.text)) {
|
||||
return createLiteral(name.text);
|
||||
}
|
||||
else {
|
||||
|
@ -422,62 +425,62 @@ namespace ts {
|
|||
"uarr": 0x2191,
|
||||
"rarr": 0x2192,
|
||||
"darr": 0x2193,
|
||||
"harr": 0x2194,
|
||||
"crarr": 0x21B5,
|
||||
"lArr": 0x21D0,
|
||||
"uArr": 0x21D1,
|
||||
"rArr": 0x21D2,
|
||||
"dArr": 0x21D3,
|
||||
"hArr": 0x21D4,
|
||||
"forall": 0x2200,
|
||||
"part": 0x2202,
|
||||
"exist": 0x2203,
|
||||
"empty": 0x2205,
|
||||
"nabla": 0x2207,
|
||||
"isin": 0x2208,
|
||||
"notin": 0x2209,
|
||||
"ni": 0x220B,
|
||||
"prod": 0x220F,
|
||||
"sum": 0x2211,
|
||||
"minus": 0x2212,
|
||||
"lowast": 0x2217,
|
||||
"radic": 0x221A,
|
||||
"prop": 0x221D,
|
||||
"infin": 0x221E,
|
||||
"ang": 0x2220,
|
||||
"and": 0x2227,
|
||||
"or": 0x2228,
|
||||
"cap": 0x2229,
|
||||
"cup": 0x222A,
|
||||
"int": 0x222B,
|
||||
"there4": 0x2234,
|
||||
"sim": 0x223C,
|
||||
"cong": 0x2245,
|
||||
"asymp": 0x2248,
|
||||
"ne": 0x2260,
|
||||
"equiv": 0x2261,
|
||||
"le": 0x2264,
|
||||
"ge": 0x2265,
|
||||
"sub": 0x2282,
|
||||
"sup": 0x2283,
|
||||
"nsub": 0x2284,
|
||||
"sube": 0x2286,
|
||||
"supe": 0x2287,
|
||||
"oplus": 0x2295,
|
||||
"otimes": 0x2297,
|
||||
"perp": 0x22A5,
|
||||
"sdot": 0x22C5,
|
||||
"lceil": 0x2308,
|
||||
"rceil": 0x2309,
|
||||
"lfloor": 0x230A,
|
||||
"rfloor": 0x230B,
|
||||
"lang": 0x2329,
|
||||
"rang": 0x232A,
|
||||
"loz": 0x25CA,
|
||||
"spades": 0x2660,
|
||||
"clubs": 0x2663,
|
||||
"hearts": 0x2665,
|
||||
"diams": 0x2666
|
||||
};
|
||||
"harr": 0x2194,
|
||||
"crarr": 0x21B5,
|
||||
"lArr": 0x21D0,
|
||||
"uArr": 0x21D1,
|
||||
"rArr": 0x21D2,
|
||||
"dArr": 0x21D3,
|
||||
"hArr": 0x21D4,
|
||||
"forall": 0x2200,
|
||||
"part": 0x2202,
|
||||
"exist": 0x2203,
|
||||
"empty": 0x2205,
|
||||
"nabla": 0x2207,
|
||||
"isin": 0x2208,
|
||||
"notin": 0x2209,
|
||||
"ni": 0x220B,
|
||||
"prod": 0x220F,
|
||||
"sum": 0x2211,
|
||||
"minus": 0x2212,
|
||||
"lowast": 0x2217,
|
||||
"radic": 0x221A,
|
||||
"prop": 0x221D,
|
||||
"infin": 0x221E,
|
||||
"ang": 0x2220,
|
||||
"and": 0x2227,
|
||||
"or": 0x2228,
|
||||
"cap": 0x2229,
|
||||
"cup": 0x222A,
|
||||
"int": 0x222B,
|
||||
"there4": 0x2234,
|
||||
"sim": 0x223C,
|
||||
"cong": 0x2245,
|
||||
"asymp": 0x2248,
|
||||
"ne": 0x2260,
|
||||
"equiv": 0x2261,
|
||||
"le": 0x2264,
|
||||
"ge": 0x2265,
|
||||
"sub": 0x2282,
|
||||
"sup": 0x2283,
|
||||
"nsub": 0x2284,
|
||||
"sube": 0x2286,
|
||||
"supe": 0x2287,
|
||||
"oplus": 0x2295,
|
||||
"otimes": 0x2297,
|
||||
"perp": 0x22A5,
|
||||
"sdot": 0x22C5,
|
||||
"lceil": 0x2308,
|
||||
"rceil": 0x2309,
|
||||
"lfloor": 0x230A,
|
||||
"rfloor": 0x230B,
|
||||
"lang": 0x2329,
|
||||
"rang": 0x232A,
|
||||
"loz": 0x25CA,
|
||||
"spades": 0x2660,
|
||||
"clubs": 0x2663,
|
||||
"hearts": 0x2665,
|
||||
"diams": 0x2666
|
||||
};
|
||||
}
|
||||
}
|
|
@ -12,7 +12,6 @@ namespace ts {
|
|||
};
|
||||
|
||||
const {
|
||||
getGeneratedNameForNode,
|
||||
startLexicalEnvironment,
|
||||
endLexicalEnvironment,
|
||||
hoistVariableDeclaration,
|
||||
|
|
|
@ -10,7 +10,6 @@ namespace ts {
|
|||
}
|
||||
|
||||
const {
|
||||
getGeneratedNameForNode,
|
||||
startLexicalEnvironment,
|
||||
endLexicalEnvironment,
|
||||
hoistVariableDeclaration,
|
||||
|
|
|
@ -6,9 +6,17 @@
|
|||
namespace ts {
|
||||
type SuperContainer = ClassDeclaration | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ConstructorDeclaration;
|
||||
|
||||
const enum TypeScriptSubstitutionFlags {
|
||||
/** Enables substitutions for decorated classes. */
|
||||
DecoratedClasses = 1 << 0,
|
||||
/** Enables substitutions for namespace exports. */
|
||||
NamespaceExports = 1 << 1,
|
||||
/** Enables substitutions for async methods with `super` calls. */
|
||||
AsyncMethodsWithSuper = 1 << 2,
|
||||
}
|
||||
|
||||
export function transformTypeScript(context: TransformationContext) {
|
||||
const {
|
||||
getGeneratedNameForNode,
|
||||
setNodeEmitFlags,
|
||||
startLexicalEnvironment,
|
||||
endLexicalEnvironment,
|
||||
|
@ -20,14 +28,14 @@ namespace ts {
|
|||
const languageVersion = getEmitScriptTarget(compilerOptions);
|
||||
|
||||
// Save the previous transformation hooks.
|
||||
const previousExpressionSubstitution = context.expressionSubstitution;
|
||||
const previousOnBeforeEmitNode = context.onBeforeEmitNode;
|
||||
const previousOnAfterEmitNode = context.onAfterEmitNode;
|
||||
const previousExpressionSubstitution = context.expressionSubstitution;
|
||||
|
||||
// Set new transformation hooks.
|
||||
context.expressionSubstitution = substituteExpression;
|
||||
context.onBeforeEmitNode = onBeforeEmitNode;
|
||||
context.onAfterEmitNode = onAfterEmitNode;
|
||||
context.expressionSubstitution = substituteExpression;
|
||||
|
||||
// These variables contain state that changes as we descend into the tree.
|
||||
let currentSourceFile: SourceFile;
|
||||
|
@ -36,33 +44,47 @@ namespace ts {
|
|||
let currentScope: SourceFile | Block | ModuleBlock | CaseBlock;
|
||||
let currentParent: Node;
|
||||
let currentNode: Node;
|
||||
let combinedNodeFlags: NodeFlags;
|
||||
|
||||
// These variables keep track of whether expression substitution has been enabled for
|
||||
// specific edge cases. They are persisted between each SourceFile transformation and
|
||||
// should not be reset.
|
||||
let hasEnabledExpressionSubstitutionForDecoratedClasses = false;
|
||||
let hasEnabledExpressionSubstitutionForNamespaceExports = false;
|
||||
let hasEnabledExpressionSubstitutionForAsyncMethodsWithSuper = false;
|
||||
/**
|
||||
* Keeps track of whether expression substitution has been enabled for specific edge cases.
|
||||
* They are persisted between each SourceFile transformation and should not be reset.
|
||||
*/
|
||||
let enabledSubstitutions: TypeScriptSubstitutionFlags;
|
||||
|
||||
// This map keeps track of aliases created for classes with decorators to avoid issues
|
||||
// with the double-binding behavior of classes.
|
||||
/**
|
||||
* A map that keeps track of aliases created for classes with decorators to avoid issues
|
||||
* with the double-binding behavior of classes.
|
||||
*/
|
||||
let decoratedClassAliases: Map<Identifier>;
|
||||
|
||||
// This map keeps track of currently active aliases defined in `decoratedClassAliases`
|
||||
// when just-in-time substitution occurs while printing an expression identifier.
|
||||
/**
|
||||
* A map that keeps track of currently active aliases defined in `decoratedClassAliases`
|
||||
* when just-in-time substitution occurs while printing an expression identifier.
|
||||
*/
|
||||
let currentDecoratedClassAliases: Map<Identifier>;
|
||||
|
||||
// This value keeps track of how deeply nested we are within any containing namespaces
|
||||
// when performing just-in-time substitution while printing an expression identifier.
|
||||
/**
|
||||
* Keeps track of how deeply nested we are within any containing namespaces
|
||||
* when performing just-in-time substitution while printing an expression identifier.
|
||||
* If the nest level is greater than zero, then we are performing a substitution
|
||||
* inside of a namespace and we should perform the more costly checks to determine
|
||||
* whether the identifier points to an exported declaration.
|
||||
*/
|
||||
let namespaceNestLevel: number;
|
||||
|
||||
// This array keeps track of containers where `super` is valid, for use with
|
||||
// just-in-time substitution for `super` expressions inside of async methods.
|
||||
/**
|
||||
* This array keeps track of containers where `super` is valid, for use with
|
||||
* just-in-time substitution for `super` expressions inside of async methods.
|
||||
*/
|
||||
let superContainerStack: SuperContainer[];
|
||||
|
||||
return transformSourceFile;
|
||||
|
||||
/**
|
||||
* Transform TypeScript-specific syntax in a SourceFile.
|
||||
*
|
||||
* @param node A SourceFile node.
|
||||
*/
|
||||
function transformSourceFile(node: SourceFile) {
|
||||
currentSourceFile = node;
|
||||
node = visitEachChild(node, visitor, context);
|
||||
|
@ -81,7 +103,6 @@ namespace ts {
|
|||
const savedCurrentScope = currentScope;
|
||||
const savedCurrentParent = currentParent;
|
||||
const savedCurrentNode = currentNode;
|
||||
const savedCombinedNodeFlags = combinedNodeFlags;
|
||||
|
||||
// Handle state changes before visiting a node.
|
||||
onBeforeVisitNode(node);
|
||||
|
@ -93,7 +114,6 @@ namespace ts {
|
|||
currentScope = savedCurrentScope;
|
||||
currentParent = savedCurrentParent;
|
||||
currentNode = savedCurrentNode;
|
||||
combinedNodeFlags = savedCombinedNodeFlags;
|
||||
|
||||
return node;
|
||||
}
|
||||
|
@ -140,8 +160,7 @@ namespace ts {
|
|||
* @param node The node to visit.
|
||||
*/
|
||||
function namespaceElementVisitorWorker(node: Node): Node {
|
||||
if (node.transformFlags & TransformFlags.TypeScript
|
||||
|| node.flags & NodeFlags.Export) {
|
||||
if (node.transformFlags & TransformFlags.TypeScript || isExported(node)) {
|
||||
// This node is explicitly marked as TypeScript, or is exported at the namespace
|
||||
// level, so we should transform the node.
|
||||
node = visitTypeScript(node);
|
||||
|
@ -169,12 +188,25 @@ namespace ts {
|
|||
* @param node The node to visit.
|
||||
*/
|
||||
function classElementVisitorWorker(node: Node) {
|
||||
if (node.kind === SyntaxKind.Constructor) {
|
||||
// TypeScript constructors are elided.
|
||||
return undefined;
|
||||
}
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Constructor:
|
||||
// TypeScript constructors are transformed in `transformClassDeclaration`.
|
||||
// We elide them here as `visitorWorker` checks transform flags, which could
|
||||
// erronously include an ES6 constructor without TypeScript syntax.
|
||||
return undefined;
|
||||
|
||||
return visitorWorker(node);
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.IndexSignature:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
// Fallback to the default visit behavior.
|
||||
return visitorWorker(node);
|
||||
|
||||
default:
|
||||
Debug.fail("Unexpected node.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -183,9 +215,9 @@ namespace ts {
|
|||
* @param node The node to visit.
|
||||
*/
|
||||
function visitTypeScript(node: Node): Node {
|
||||
// TypeScript ambient declarations are elided.
|
||||
if (node.flags & NodeFlags.Ambient) {
|
||||
return;
|
||||
// TypeScript ambient declarations are elided.
|
||||
return undefined;
|
||||
}
|
||||
|
||||
switch (node.kind) {
|
||||
|
@ -237,8 +269,7 @@ namespace ts {
|
|||
// TypeScript property declarations are elided.
|
||||
|
||||
case SyntaxKind.Constructor:
|
||||
// TypeScript constructors are elided. The constructor of a class will be
|
||||
// transformed as part of `transformClassDeclaration`.
|
||||
// TypeScript constructors are transformed in `transformClassDeclaration`.
|
||||
return undefined;
|
||||
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
|
@ -358,8 +389,6 @@ namespace ts {
|
|||
currentParent = currentNode;
|
||||
currentNode = node;
|
||||
|
||||
combinedNodeFlags = combineNodeFlags(currentNode, currentParent, combinedNodeFlags);
|
||||
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.SourceFile:
|
||||
case SyntaxKind.CaseBlock:
|
||||
|
@ -383,11 +412,7 @@ namespace ts {
|
|||
*/
|
||||
function visitClassDeclaration(node: ClassDeclaration): NodeArrayNode<Statement> {
|
||||
const staticProperties = getInitializedProperties(node, /*isStatic*/ true);
|
||||
const statements: Statement[] = [];
|
||||
const modifiers = visitNodes(node.modifiers, visitor, isModifier);
|
||||
const heritageClauses = visitNodes(node.heritageClauses, visitor, isHeritageClause);
|
||||
const members = transformClassMembers(node, firstOrUndefined(heritageClauses) !== undefined);
|
||||
let decoratedClassAlias: Identifier;
|
||||
const hasExtendsClause = getClassExtendsHeritageClauseElement(node) !== undefined;
|
||||
|
||||
// emit name if
|
||||
// - node has a name
|
||||
|
@ -398,166 +423,28 @@ namespace ts {
|
|||
name = getGeneratedNameForNode(node);
|
||||
}
|
||||
|
||||
if (node.decorators) {
|
||||
// When we emit an ES6 class that has a class decorator, we must tailor the
|
||||
// emit to certain specific cases.
|
||||
//
|
||||
// In the simplest case, we emit the class declaration as a let declaration, and
|
||||
// evaluate decorators after the close of the class body:
|
||||
//
|
||||
// [Example 1]
|
||||
// ---------------------------------------------------------------------
|
||||
// TypeScript | Javascript
|
||||
// ---------------------------------------------------------------------
|
||||
// @dec | let C = class C {
|
||||
// class C { | }
|
||||
// } | C = __decorate([dec], C);
|
||||
// ---------------------------------------------------------------------
|
||||
// @dec | let C = class C {
|
||||
// export class C { | }
|
||||
// } | C = __decorate([dec], C);
|
||||
// | export { C };
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// If a class declaration contains a reference to itself *inside* of the class body,
|
||||
// this introduces two bindings to the class: One outside of the class body, and one
|
||||
// inside of the class body. If we apply decorators as in [Example 1] above, there
|
||||
// is the possibility that the decorator `dec` will return a new value for the
|
||||
// constructor, which would result in the binding inside of the class no longer
|
||||
// pointing to the same reference as the binding outside of the class.
|
||||
//
|
||||
// As a result, we must instead rewrite all references to the class *inside* of the
|
||||
// class body to instead point to a local temporary alias for the class:
|
||||
//
|
||||
// [Example 2]
|
||||
// ---------------------------------------------------------------------
|
||||
// TypeScript | Javascript
|
||||
// ---------------------------------------------------------------------
|
||||
// @dec | let C_1;
|
||||
// class C { | let C = C_1 = class C {
|
||||
// static x() { return C.y; } | static x() { return C_1.y; }
|
||||
// static y = 1; | }
|
||||
// } | C.y = 1;
|
||||
// | C = C_1 = __decorate([dec], C);
|
||||
// ---------------------------------------------------------------------
|
||||
// @dec | let C_1;
|
||||
// export class C { | let C = C_1 = class C {
|
||||
// static x() { return C.y; } | static x() { return C_1.y; }
|
||||
// static y = 1; | }
|
||||
// } | C.y = 1;
|
||||
// | C = C_1 = __decorate([dec], C);
|
||||
// | export { C };
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// If a class declaration is the default export of a module, we instead emit
|
||||
// the export after the decorated declaration:
|
||||
//
|
||||
// [Example 3]
|
||||
// ---------------------------------------------------------------------
|
||||
// TypeScript | Javascript
|
||||
// ---------------------------------------------------------------------
|
||||
// @dec | let default_1 = class {
|
||||
// export default class { | }
|
||||
// } | default_1 = __decorate([dec], default_1);
|
||||
// | export default default_1;
|
||||
// ---------------------------------------------------------------------
|
||||
// @dec | let C = class C {
|
||||
// export default class C { | }
|
||||
// } | C = __decorate([dec], C);
|
||||
// | export default C;
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// If the class declaration is the default export and a reference to itself
|
||||
// inside of the class body, we must emit both an alias for the class *and*
|
||||
// move the export after the declaration:
|
||||
//
|
||||
// [Example 4]
|
||||
// ---------------------------------------------------------------------
|
||||
// TypeScript | Javascript
|
||||
// ---------------------------------------------------------------------
|
||||
// @dec | let C_1;
|
||||
// export default class C { | let C = C_1 = class C {
|
||||
// static x() { return C.y; } | static x() { return C_1.y; }
|
||||
// static y = 1; | }
|
||||
// } | C.y = 1;
|
||||
// | C = C_1 = __decorate([dec], C);
|
||||
// | export default C;
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
|
||||
// class ${name} ${heritageClauses} {
|
||||
// ${members}
|
||||
// }
|
||||
let classExpression: Expression = setOriginalNode(
|
||||
createClassExpression(
|
||||
name,
|
||||
heritageClauses,
|
||||
members,
|
||||
/*location*/ node
|
||||
),
|
||||
node
|
||||
);
|
||||
|
||||
// Record an alias to avoid class double-binding.
|
||||
if (resolver.getNodeCheckFlags(getOriginalNode(node)) & NodeCheckFlags.ClassWithBodyScopedClassBinding) {
|
||||
enableExpressionSubstitutionForDecoratedClasses();
|
||||
decoratedClassAlias = createUniqueName(node.name ? node.name.text : "default");
|
||||
decoratedClassAliases[getOriginalNodeId(node)] = decoratedClassAlias;
|
||||
|
||||
// We emit the class alias as a `let` declaration here so that it has the same
|
||||
// TDZ as the class.
|
||||
|
||||
// let ${decoratedClassAlias};
|
||||
addNode(statements,
|
||||
createVariableStatement(
|
||||
/*modifiers*/ undefined,
|
||||
createVariableDeclarationList([
|
||||
createVariableDeclaration(decoratedClassAlias)
|
||||
],
|
||||
/*location*/ undefined,
|
||||
NodeFlags.Let)
|
||||
)
|
||||
);
|
||||
|
||||
// ${decoratedClassAlias} = ${classExpression}
|
||||
classExpression = createAssignment(
|
||||
cloneNode(decoratedClassAlias),
|
||||
classExpression,
|
||||
/*location*/ node);
|
||||
}
|
||||
|
||||
// let ${name} = ${classExpression};
|
||||
addNode(statements,
|
||||
createVariableStatement(
|
||||
/*modifiers*/ undefined,
|
||||
createVariableDeclarationList([
|
||||
createVariableDeclaration(
|
||||
name,
|
||||
classExpression
|
||||
)
|
||||
],
|
||||
/*location*/ undefined,
|
||||
NodeFlags.Let)
|
||||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
let decoratedClassAlias: Identifier;
|
||||
const statements: Statement[] = [];
|
||||
if (!node.decorators) {
|
||||
// ${modifiers} class ${name} ${heritageClauses} {
|
||||
// ${members}
|
||||
// }
|
||||
addNode(statements,
|
||||
setOriginalNode(
|
||||
createClassDeclaration(
|
||||
modifiers,
|
||||
visitNodes(node.modifiers, visitor, isModifier),
|
||||
name,
|
||||
heritageClauses,
|
||||
members,
|
||||
visitNodes(node.heritageClauses, visitor, isHeritageClause),
|
||||
transformClassMembers(node, hasExtendsClause),
|
||||
/*location*/ node
|
||||
),
|
||||
node
|
||||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
decoratedClassAlias = addClassDeclarationHeadWithDecorators(statements, node, name, hasExtendsClause);
|
||||
}
|
||||
|
||||
// Emit static property assignment. Because classDeclaration is lexically evaluated,
|
||||
// it is safe to emit static property assignment after classDeclaration
|
||||
|
@ -582,13 +469,168 @@ namespace ts {
|
|||
addNode(statements, createExportDefault(name));
|
||||
}
|
||||
else if (isNamedExternalModuleExport(node)) {
|
||||
addNode(statements, createModuleExport(name));
|
||||
addNode(statements, createExternalModuleExport(name));
|
||||
}
|
||||
}
|
||||
|
||||
return createNodeArrayNode(statements);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms a decorated class declaration and appends the resulting statements. If
|
||||
* the class requires an alias to avoid issues with double-binding, the alias is returned.
|
||||
*
|
||||
* @param node A ClassDeclaration node.
|
||||
* @param name The name of the class.
|
||||
* @param hasExtendsClause A value indicating whether
|
||||
*/
|
||||
function addClassDeclarationHeadWithDecorators(statements: Statement[], node: ClassDeclaration, name: Identifier, hasExtendsClause: boolean) {
|
||||
// When we emit an ES6 class that has a class decorator, we must tailor the
|
||||
// emit to certain specific cases.
|
||||
//
|
||||
// In the simplest case, we emit the class declaration as a let declaration, and
|
||||
// evaluate decorators after the close of the class body:
|
||||
//
|
||||
// [Example 1]
|
||||
// ---------------------------------------------------------------------
|
||||
// TypeScript | Javascript
|
||||
// ---------------------------------------------------------------------
|
||||
// @dec | let C = class C {
|
||||
// class C { | }
|
||||
// } | C = __decorate([dec], C);
|
||||
// ---------------------------------------------------------------------
|
||||
// @dec | let C = class C {
|
||||
// export class C { | }
|
||||
// } | C = __decorate([dec], C);
|
||||
// | export { C };
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// If a class declaration contains a reference to itself *inside* of the class body,
|
||||
// this introduces two bindings to the class: One outside of the class body, and one
|
||||
// inside of the class body. If we apply decorators as in [Example 1] above, there
|
||||
// is the possibility that the decorator `dec` will return a new value for the
|
||||
// constructor, which would result in the binding inside of the class no longer
|
||||
// pointing to the same reference as the binding outside of the class.
|
||||
//
|
||||
// As a result, we must instead rewrite all references to the class *inside* of the
|
||||
// class body to instead point to a local temporary alias for the class:
|
||||
//
|
||||
// [Example 2]
|
||||
// ---------------------------------------------------------------------
|
||||
// TypeScript | Javascript
|
||||
// ---------------------------------------------------------------------
|
||||
// @dec | let C_1;
|
||||
// class C { | let C = C_1 = class C {
|
||||
// static x() { return C.y; } | static x() { return C_1.y; }
|
||||
// static y = 1; | }
|
||||
// } | C.y = 1;
|
||||
// | C = C_1 = __decorate([dec], C);
|
||||
// ---------------------------------------------------------------------
|
||||
// @dec | let C_1;
|
||||
// export class C { | let C = C_1 = class C {
|
||||
// static x() { return C.y; } | static x() { return C_1.y; }
|
||||
// static y = 1; | }
|
||||
// } | C.y = 1;
|
||||
// | C = C_1 = __decorate([dec], C);
|
||||
// | export { C };
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// If a class declaration is the default export of a module, we instead emit
|
||||
// the export after the decorated declaration:
|
||||
//
|
||||
// [Example 3]
|
||||
// ---------------------------------------------------------------------
|
||||
// TypeScript | Javascript
|
||||
// ---------------------------------------------------------------------
|
||||
// @dec | let default_1 = class {
|
||||
// export default class { | }
|
||||
// } | default_1 = __decorate([dec], default_1);
|
||||
// | export default default_1;
|
||||
// ---------------------------------------------------------------------
|
||||
// @dec | let C = class C {
|
||||
// export default class C { | }
|
||||
// } | C = __decorate([dec], C);
|
||||
// | export default C;
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
// If the class declaration is the default export and a reference to itself
|
||||
// inside of the class body, we must emit both an alias for the class *and*
|
||||
// move the export after the declaration:
|
||||
//
|
||||
// [Example 4]
|
||||
// ---------------------------------------------------------------------
|
||||
// TypeScript | Javascript
|
||||
// ---------------------------------------------------------------------
|
||||
// @dec | let C_1;
|
||||
// export default class C { | let C = C_1 = class C {
|
||||
// static x() { return C.y; } | static x() { return C_1.y; }
|
||||
// static y = 1; | }
|
||||
// } | C.y = 1;
|
||||
// | C = C_1 = __decorate([dec], C);
|
||||
// | export default C;
|
||||
// ---------------------------------------------------------------------
|
||||
//
|
||||
|
||||
// ... = class ${name} ${heritageClauses} {
|
||||
// ${members}
|
||||
// }
|
||||
let classExpression: Expression = setOriginalNode(
|
||||
createClassExpression(
|
||||
name,
|
||||
visitNodes(node.heritageClauses, visitor, isHeritageClause),
|
||||
transformClassMembers(node, hasExtendsClause),
|
||||
/*location*/ node
|
||||
),
|
||||
node
|
||||
);
|
||||
|
||||
// Record an alias to avoid class double-binding.
|
||||
let decoratedClassAlias: Identifier;
|
||||
if (resolver.getNodeCheckFlags(getOriginalNode(node)) & NodeCheckFlags.DecoratedClassWithSelfReference) {
|
||||
enableExpressionSubstitutionForDecoratedClasses();
|
||||
decoratedClassAlias = createUniqueName(node.name && !isGeneratedIdentifier(node.name) ? node.name.text : "default");
|
||||
decoratedClassAliases[getOriginalNodeId(node)] = decoratedClassAlias;
|
||||
|
||||
// We emit the class alias as a `let` declaration here so that it has the same
|
||||
// TDZ as the class.
|
||||
|
||||
// let ${decoratedClassAlias};
|
||||
addNode(statements,
|
||||
createVariableStatement(
|
||||
/*modifiers*/ undefined,
|
||||
createVariableDeclarationList([
|
||||
createVariableDeclaration(decoratedClassAlias)
|
||||
],
|
||||
/*location*/ undefined,
|
||||
NodeFlags.Let)
|
||||
)
|
||||
);
|
||||
|
||||
// ${decoratedClassAlias} = ${classExpression}
|
||||
classExpression = createAssignment(
|
||||
decoratedClassAlias,
|
||||
classExpression,
|
||||
/*location*/ node);
|
||||
}
|
||||
|
||||
// let ${name} = ${classExpression};
|
||||
addNode(statements,
|
||||
createVariableStatement(
|
||||
/*modifiers*/ undefined,
|
||||
createVariableDeclarationList([
|
||||
createVariableDeclaration(
|
||||
name,
|
||||
classExpression
|
||||
)
|
||||
],
|
||||
/*location*/ undefined,
|
||||
NodeFlags.Let)
|
||||
)
|
||||
);
|
||||
|
||||
return decoratedClassAlias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms a class expression with TypeScript syntax into compatible ES6.
|
||||
*
|
||||
|
@ -645,7 +687,7 @@ namespace ts {
|
|||
const members: ClassElement[] = [];
|
||||
addNode(members, transformConstructor(node, hasExtendsClause));
|
||||
addNodes(members, visitNodes(node.members, classElementVisitor, isClassElement));
|
||||
return members;
|
||||
return createNodeArray(members, /*location*/ node.members);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2116,14 +2158,15 @@ namespace ts {
|
|||
}
|
||||
|
||||
const savedCurrentNamespaceLocalName = currentNamespaceLocalName;
|
||||
const modifiers = visitNodes(node.modifiers, visitor, isModifier);
|
||||
const statements: Statement[] = [];
|
||||
|
||||
let location: TextRange = node;
|
||||
if (!isNamespaceExport(node)) {
|
||||
if (!isExported(node) || (isExternalModuleExport(node) && isFirstDeclarationOfKind(node, SyntaxKind.EnumDeclaration))) {
|
||||
// Emit a VariableStatement if the enum is not exported, or is the first enum
|
||||
// with the same name exported from an external module.
|
||||
addNode(statements,
|
||||
createVariableStatement(
|
||||
modifiers,
|
||||
visitNodes(node.modifiers, visitor, isModifier),
|
||||
createVariableDeclarationList([
|
||||
createVariableDeclaration(node.name)
|
||||
]),
|
||||
|
@ -2195,7 +2238,7 @@ namespace ts {
|
|||
*
|
||||
* @param member The enum member node.
|
||||
*/
|
||||
function transformEnumMember(member: EnumMember) {
|
||||
function transformEnumMember(member: EnumMember): Statement {
|
||||
const name = getExpressionForPropertyName(member);
|
||||
return createStatement(
|
||||
createAssignment(
|
||||
|
@ -2484,14 +2527,31 @@ namespace ts {
|
|||
&& (isExternalModule(currentSourceFile) || !resolver.isTopLevelValueImportEqualsWithEntityName(node));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a value indicating whether the node is exported.
|
||||
*
|
||||
* @param node The node to test.
|
||||
*/
|
||||
function isExported(node: Node) {
|
||||
return (node.flags & NodeFlags.Export) !== 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a value indicating whether the node is exported from a namespace.
|
||||
*
|
||||
* @param node The node to test.
|
||||
*/
|
||||
function isNamespaceExport(node: Node) {
|
||||
return currentNamespace !== undefined && isExported(node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a value indicating whether the node is exported from an external module.
|
||||
*
|
||||
* @param node The node to test.
|
||||
*/
|
||||
function isExternalModuleExport(node: Node) {
|
||||
return currentNamespace === undefined
|
||||
&& (node.flags & NodeFlags.Export) !== 0;
|
||||
return currentNamespace === undefined && isExported(node);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2515,13 +2575,14 @@ namespace ts {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets a value indicating whether the node is exported from a namespace.
|
||||
* Gets a value indicating whether a node is the first declaration of its kind.
|
||||
*
|
||||
* @param node The node to test.
|
||||
* @param node A Declaration node.
|
||||
* @param kind The SyntaxKind to find among related declarations.
|
||||
*/
|
||||
function isNamespaceExport(node: Node) {
|
||||
return currentNamespace !== undefined
|
||||
&& (node.flags & NodeFlags.Export) !== 0;
|
||||
function isFirstDeclarationOfKind(node: Declaration, kind: SyntaxKind) {
|
||||
const original = getOriginalNode(node);
|
||||
return original.symbol && getDeclarationOfKind(original.symbol, kind) === original;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2541,7 +2602,7 @@ namespace ts {
|
|||
);
|
||||
}
|
||||
|
||||
function createModuleExport(exportName: Identifier) {
|
||||
function createExternalModuleExport(exportName: Identifier) {
|
||||
return createExportDeclaration(
|
||||
createNamedExports([
|
||||
createExportSpecifier(exportName)
|
||||
|
@ -2571,12 +2632,13 @@ namespace ts {
|
|||
previousOnBeforeEmitNode(node);
|
||||
|
||||
const kind = node.kind;
|
||||
if (hasEnabledExpressionSubstitutionForDecoratedClasses
|
||||
&& kind === SyntaxKind.ClassDeclaration && node.decorators) {
|
||||
if (enabledSubstitutions & TypeScriptSubstitutionFlags.DecoratedClasses
|
||||
&& kind === SyntaxKind.ClassDeclaration
|
||||
&& node.decorators) {
|
||||
currentDecoratedClassAliases[getOriginalNodeId(node)] = decoratedClassAliases[getOriginalNodeId(node)];
|
||||
}
|
||||
|
||||
if (hasEnabledExpressionSubstitutionForAsyncMethodsWithSuper
|
||||
if (enabledSubstitutions & TypeScriptSubstitutionFlags.NamespaceExports
|
||||
&& (kind === SyntaxKind.ClassDeclaration
|
||||
|| kind === SyntaxKind.Constructor
|
||||
|| kind === SyntaxKind.MethodDeclaration
|
||||
|
@ -2590,7 +2652,7 @@ namespace ts {
|
|||
superContainerStack.push(<SuperContainer>node);
|
||||
}
|
||||
|
||||
if (hasEnabledExpressionSubstitutionForNamespaceExports
|
||||
if (enabledSubstitutions & TypeScriptSubstitutionFlags.NamespaceExports
|
||||
&& kind === SyntaxKind.ModuleDeclaration) {
|
||||
namespaceNestLevel++;
|
||||
}
|
||||
|
@ -2600,12 +2662,13 @@ namespace ts {
|
|||
previousOnAfterEmitNode(node);
|
||||
|
||||
const kind = node.kind;
|
||||
if (hasEnabledExpressionSubstitutionForDecoratedClasses
|
||||
&& kind === SyntaxKind.ClassDeclaration && node.decorators) {
|
||||
if (enabledSubstitutions & TypeScriptSubstitutionFlags.DecoratedClasses
|
||||
&& kind === SyntaxKind.ClassDeclaration
|
||||
&& node.decorators) {
|
||||
currentDecoratedClassAliases[getOriginalNodeId(node)] = undefined;
|
||||
}
|
||||
|
||||
if (hasEnabledExpressionSubstitutionForAsyncMethodsWithSuper
|
||||
if (enabledSubstitutions & TypeScriptSubstitutionFlags.NamespaceExports
|
||||
&& (kind === SyntaxKind.ClassDeclaration
|
||||
|| kind === SyntaxKind.Constructor
|
||||
|| kind === SyntaxKind.MethodDeclaration
|
||||
|
@ -2617,7 +2680,7 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
|
||||
if (hasEnabledExpressionSubstitutionForNamespaceExports
|
||||
if (enabledSubstitutions & TypeScriptSubstitutionFlags.NamespaceExports
|
||||
&& kind === SyntaxKind.ModuleDeclaration) {
|
||||
namespaceNestLevel--;
|
||||
}
|
||||
|
@ -2631,7 +2694,7 @@ namespace ts {
|
|||
return substituteExpressionIdentifier(<Identifier>node);
|
||||
}
|
||||
|
||||
if (hasEnabledExpressionSubstitutionForAsyncMethodsWithSuper) {
|
||||
if (enabledSubstitutions & TypeScriptSubstitutionFlags.NamespaceExports) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.CallExpression:
|
||||
return substituteCallExpression(<CallExpression>node);
|
||||
|
@ -2646,10 +2709,10 @@ namespace ts {
|
|||
}
|
||||
|
||||
function substituteExpressionIdentifier(node: Identifier): Expression {
|
||||
if (hasEnabledExpressionSubstitutionForDecoratedClasses) {
|
||||
if (enabledSubstitutions & TypeScriptSubstitutionFlags.DecoratedClasses) {
|
||||
const original = getOriginalNode(node);
|
||||
if (isIdentifier(original)) {
|
||||
if (resolver.getNodeCheckFlags(original) & NodeCheckFlags.BodyScopedClassBinding) {
|
||||
if (resolver.getNodeCheckFlags(original) & NodeCheckFlags.SelfReferenceInDecoratedClass) {
|
||||
// Due to the emit for class decorators, any reference to the class from inside of the class body
|
||||
// must instead be rewritten to point to a temporary variable to avoid issues with the double-bind
|
||||
// behavior of class names in ES6.
|
||||
|
@ -2664,7 +2727,7 @@ namespace ts {
|
|||
}
|
||||
}
|
||||
|
||||
if (hasEnabledExpressionSubstitutionForNamespaceExports
|
||||
if (enabledSubstitutions & TypeScriptSubstitutionFlags.NamespaceExports
|
||||
&& namespaceNestLevel > 0) {
|
||||
// If we are nested within a namespace declaration, we may need to qualifiy
|
||||
// an identifier that is exported from a merged namespace.
|
||||
|
@ -2682,7 +2745,7 @@ namespace ts {
|
|||
|
||||
function substituteCallExpression(node: CallExpression): Expression {
|
||||
const expression = node.expression;
|
||||
if (isSuperPropertyOrElementAccess(expression)) {
|
||||
if (isSuperProperty(expression)) {
|
||||
const flags = getSuperContainerAsyncMethodFlags();
|
||||
if (flags) {
|
||||
const argumentExpression = isPropertyAccessExpression(expression)
|
||||
|
@ -2731,8 +2794,8 @@ namespace ts {
|
|||
}
|
||||
|
||||
function enableExpressionSubstitutionForAsyncMethodsWithSuper() {
|
||||
if (!hasEnabledExpressionSubstitutionForAsyncMethodsWithSuper) {
|
||||
hasEnabledExpressionSubstitutionForAsyncMethodsWithSuper = true;
|
||||
if ((enabledSubstitutions & TypeScriptSubstitutionFlags.NamespaceExports) === 0) {
|
||||
enabledSubstitutions |= TypeScriptSubstitutionFlags.NamespaceExports;
|
||||
|
||||
// We need to enable substitutions for call, property access, and element access
|
||||
// if we need to rewrite super calls.
|
||||
|
@ -2750,8 +2813,8 @@ namespace ts {
|
|||
}
|
||||
|
||||
function enableExpressionSubstitutionForDecoratedClasses() {
|
||||
if (!hasEnabledExpressionSubstitutionForDecoratedClasses) {
|
||||
hasEnabledExpressionSubstitutionForDecoratedClasses = true;
|
||||
if ((enabledSubstitutions & TypeScriptSubstitutionFlags.DecoratedClasses) === 0) {
|
||||
enabledSubstitutions |= TypeScriptSubstitutionFlags.DecoratedClasses;
|
||||
|
||||
// We need to enable substitutions for identifiers. This allows us to
|
||||
// substitute class names inside of a class declaration.
|
||||
|
@ -2764,8 +2827,8 @@ namespace ts {
|
|||
}
|
||||
|
||||
function enableExpressionSubstitutionForNamespaceExports() {
|
||||
if (!hasEnabledExpressionSubstitutionForNamespaceExports) {
|
||||
hasEnabledExpressionSubstitutionForNamespaceExports = true;
|
||||
if ((enabledSubstitutions & TypeScriptSubstitutionFlags.NamespaceExports) === 0) {
|
||||
enabledSubstitutions |= TypeScriptSubstitutionFlags.NamespaceExports;
|
||||
|
||||
// We need to enable substitutions for identifiers. This allows us to
|
||||
// substitute the names of exported members of a namespace.
|
||||
|
|
|
@ -498,17 +498,18 @@ namespace ts {
|
|||
export interface Modifier extends Node { }
|
||||
|
||||
export const enum GeneratedIdentifierKind {
|
||||
None, // Not automatically generated
|
||||
Auto, // Automatically generated identifier
|
||||
Loop, // Automatically generated identifier with a preference for '_i'
|
||||
Unique, // Automatically generated identifier based on specified text
|
||||
None, // Not automatically generated.
|
||||
Auto, // Automatically generated identifier.
|
||||
Loop, // Automatically generated identifier with a preference for '_i'.
|
||||
Unique, // Unique name based on the 'text' property.
|
||||
Node, // Unique name based on the node in the 'original' property.
|
||||
}
|
||||
|
||||
// @kind(SyntaxKind.Identifier)
|
||||
export interface Identifier extends PrimaryExpression {
|
||||
text: string; // Text of identifier (with escapes converted to characters)
|
||||
originalKeywordKind?: SyntaxKind; // Original syntaxKind which get set so that we can report an error later
|
||||
tempKind?: GeneratedIdentifierKind; // Specifies whether to auto-generate the text for an identifier.
|
||||
autoGenerateKind?: GeneratedIdentifierKind; // Specifies whether to auto-generate the text for an identifier.
|
||||
}
|
||||
|
||||
// @kind(SyntaxKind.QualifiedName)
|
||||
|
@ -2095,8 +2096,8 @@ namespace ts {
|
|||
CapturedBlockScopedBinding = 0x00020000, // Block-scoped binding that is captured in some function
|
||||
BlockScopedBindingInLoop = 0x00040000, // Block-scoped binding with declaration nested inside iteration statement
|
||||
HasSeenSuperCall = 0x00080000, // Set during the binding when encounter 'super'
|
||||
ClassWithBodyScopedClassBinding = 0x00100000, // Decorated class that contains a binding to itself inside of the class body.
|
||||
BodyScopedClassBinding = 0x00200000, // Binding to a decorated class inside of the class's body.
|
||||
DecoratedClassWithSelfReference = 0x00100000, // Decorated class that contains a binding to itself inside of the class body.
|
||||
SelfReferenceInDecoratedClass = 0x00200000, // Binding to a decorated class inside of the class's body.
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
|
@ -2477,7 +2478,6 @@ 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;
|
||||
|
@ -2766,20 +2766,21 @@ namespace ts {
|
|||
ContainsES7 = 1 << 5,
|
||||
ES6 = 1 << 6,
|
||||
ContainsES6 = 1 << 7,
|
||||
ContainsGenerators = 1 << 8,
|
||||
DestructuringAssignment = 1 << 8,
|
||||
ContainsGenerators = 1 << 9,
|
||||
|
||||
// Markers
|
||||
// - Flags used to indicate that a subtree contains a specific transformation.
|
||||
ContainsDecorators = 1 << 9,
|
||||
ContainsPropertyInitializer = 1 << 10,
|
||||
ContainsLexicalThis = 1 << 11,
|
||||
ContainsCapturedLexicalThis = 1 << 12,
|
||||
ContainsDefaultValueAssignments = 1 << 13,
|
||||
ContainsParameterPropertyAssignments = 1 << 14,
|
||||
ContainsSpreadElementExpression = 1 << 15,
|
||||
ContainsComputedPropertyName = 1 << 16,
|
||||
ContainsBlockScopedBinding = 1 << 17,
|
||||
ContainsYield = 1 << 18,
|
||||
ContainsDecorators = 1 << 10,
|
||||
ContainsPropertyInitializer = 1 << 11,
|
||||
ContainsLexicalThis = 1 << 12,
|
||||
ContainsCapturedLexicalThis = 1 << 13,
|
||||
ContainsDefaultValueAssignments = 1 << 14,
|
||||
ContainsParameterPropertyAssignments = 1 << 15,
|
||||
ContainsSpreadElementExpression = 1 << 16,
|
||||
ContainsComputedPropertyName = 1 << 17,
|
||||
ContainsBlockScopedBinding = 1 << 18,
|
||||
ContainsYield = 1 << 19,
|
||||
|
||||
// Assertions
|
||||
// - Bitmasks that are used to assert facts about the syntax of a node and its subtree.
|
||||
|
@ -2791,7 +2792,7 @@ namespace ts {
|
|||
// Scope Exclusions
|
||||
// - Bitmasks that exclude flags from propagating out of a specific context
|
||||
// into the subtree flags of their container.
|
||||
NodeExcludes = TypeScript | Jsx | ES7 | ES6,
|
||||
NodeExcludes = TypeScript | Jsx | ES7 | ES6 | DestructuringAssignment,
|
||||
ArrowFunctionExcludes = ContainsDecorators | ContainsDefaultValueAssignments | ContainsLexicalThis | ContainsParameterPropertyAssignments | ContainsBlockScopedBinding | ContainsYield,
|
||||
FunctionExcludes = ContainsDecorators | ContainsDefaultValueAssignments | ContainsCapturedLexicalThis | ContainsLexicalThis | ContainsParameterPropertyAssignments | ContainsBlockScopedBinding | ContainsYield,
|
||||
ConstructorExcludes = ContainsDefaultValueAssignments | ContainsLexicalThis | ContainsCapturedLexicalThis | ContainsBlockScopedBinding | ContainsYield,
|
||||
|
@ -2814,7 +2815,8 @@ namespace ts {
|
|||
SingleLine = 1 << 6, // The contents of this node should be emit on a single line.
|
||||
AdviseOnEmitNode = 1 << 7, // The node printer should invoke the onBeforeEmitNode and onAfterEmitNode callbacks when printing this node.
|
||||
IsNotEmittedNode = 1 << 8, // Is a node that is not emitted but whose comments should be preserved if possible.
|
||||
EmitCommentsOfNotEmittedParent = 1 << 8, // Emits comments of missing parent nodes.
|
||||
EmitCommentsOfNotEmittedParent = 1 << 9, // Emits comments of missing parent nodes.
|
||||
NoSubstitution = 1 << 10, // Disables further substitution of an expression.
|
||||
}
|
||||
|
||||
/** Additional context provided to `visitEachChild` */
|
||||
|
@ -2834,8 +2836,6 @@ namespace ts {
|
|||
setNodeEmitFlags<T extends Node>(node: T, flags: NodeEmitFlags): T;
|
||||
hoistFunctionDeclaration(node: FunctionDeclaration): void;
|
||||
hoistVariableDeclaration(node: Identifier): void;
|
||||
getGeneratedNameForNode(node: Node): Identifier;
|
||||
nodeHasGeneratedName(node: Node): boolean;
|
||||
|
||||
/**
|
||||
* Hook used by transformers to substitute non-expression identifiers
|
||||
|
|
|
@ -491,19 +491,6 @@ namespace ts {
|
|||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* Combines the flags of a node with the combined flags of its parent if they can be combined.
|
||||
*/
|
||||
export function combineNodeFlags(node: Node, parentNode: Node, previousNodeFlags: NodeFlags) {
|
||||
if ((node.kind === SyntaxKind.VariableDeclarationList && parentNode.kind === SyntaxKind.VariableStatement) ||
|
||||
(node.kind === SyntaxKind.VariableDeclaration && parentNode.kind === SyntaxKind.VariableDeclarationList) ||
|
||||
(node.kind === SyntaxKind.BindingElement)) {
|
||||
return node.flags | previousNodeFlags;
|
||||
}
|
||||
|
||||
return node.flags;
|
||||
}
|
||||
|
||||
// Returns the node flags for this node and all relevant parent nodes. This is done so that
|
||||
// nodes like variable declarations and binding elements can returned a view of their flags
|
||||
// that includes the modifiers from their container. i.e. flags like export/declare aren't
|
||||
|
@ -948,19 +935,20 @@ namespace ts {
|
|||
/**
|
||||
* Determines whether a node is a property or element access expression for super.
|
||||
*/
|
||||
export function isSuperPropertyOrElementAccess(node: Node): node is (PropertyAccessExpression | ElementAccessExpression) {
|
||||
export function isSuperProperty(node: Node): node is (PropertyAccessExpression | ElementAccessExpression) {
|
||||
return (node.kind === SyntaxKind.PropertyAccessExpression
|
||||
|| node.kind === SyntaxKind.ElementAccessExpression)
|
||||
&& (<PropertyAccessExpression | ElementAccessExpression>node).expression.kind === SyntaxKind.SuperKeyword;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a node is a call to either `super`, or a super property or element access.
|
||||
*/
|
||||
export function isSuperPropertyCall(node: Node): node is CallExpression {
|
||||
return node.kind === SyntaxKind.CallExpression
|
||||
&& <boolean>isSuperProperty((<CallExpression>node).expression);
|
||||
}
|
||||
|
||||
export function isSuperCall(node: Node): node is CallExpression {
|
||||
return node.kind === SyntaxKind.CallExpression
|
||||
&& ((<CallExpression>node).expression.kind === SyntaxKind.SuperKeyword
|
||||
|| isSuperPropertyOrElementAccess((<CallExpression>node).expression));
|
||||
&& (<CallExpression>node).expression.kind === SyntaxKind.SuperKeyword;
|
||||
}
|
||||
|
||||
export function getEntityNameFromTypeNode(node: TypeNode): EntityName | Expression {
|
||||
|
@ -1392,7 +1380,7 @@ namespace ts {
|
|||
|
||||
|
||||
|
||||
export function isNodeDescendentOf(node: Node, ancestor: Node): boolean {
|
||||
export function isNodeDescendantOf(node: Node, ancestor: Node): boolean {
|
||||
while (node) {
|
||||
if (node === ancestor) return true;
|
||||
node = node.parent;
|
||||
|
@ -2358,11 +2346,11 @@ namespace ts {
|
|||
writer.write(" ");
|
||||
}
|
||||
|
||||
let emitInterveningSeperator = false;
|
||||
let emitInterveningSeparator = false;
|
||||
for (const comment of comments) {
|
||||
if (emitInterveningSeperator) {
|
||||
if (emitInterveningSeparator) {
|
||||
writer.write(" ");
|
||||
emitInterveningSeperator = false;
|
||||
emitInterveningSeparator = false;
|
||||
}
|
||||
|
||||
writeComment(text, lineMap, writer, comment, newLine);
|
||||
|
@ -2370,11 +2358,11 @@ namespace ts {
|
|||
writer.writeLine();
|
||||
}
|
||||
else {
|
||||
emitInterveningSeperator = true;
|
||||
emitInterveningSeparator = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (emitInterveningSeperator && trailingSeparator) {
|
||||
if (emitInterveningSeparator && trailingSeparator) {
|
||||
writer.write(" ");
|
||||
}
|
||||
}
|
||||
|
@ -2866,7 +2854,7 @@ namespace ts {
|
|||
}
|
||||
|
||||
return collapse === TextRangeCollapse.CollapseToStart
|
||||
? { pos: range.pos, end: range.end }
|
||||
? { pos: range.pos, end: range.pos }
|
||||
: { pos: range.end, end: range.end };
|
||||
}
|
||||
|
||||
|
@ -3010,7 +2998,8 @@ namespace ts {
|
|||
}
|
||||
|
||||
export function isGeneratedIdentifier(node: Node): node is Identifier {
|
||||
return isIdentifier(node) && node.tempKind > GeneratedIdentifierKind.None;
|
||||
// Using `>` here catches both `GeneratedIdentifierKind.None` and `undefined`.
|
||||
return isIdentifier(node) && node.autoGenerateKind > GeneratedIdentifierKind.None;
|
||||
}
|
||||
|
||||
// Keywords
|
||||
|
@ -3411,6 +3400,10 @@ namespace ts {
|
|||
return node.kind === SyntaxKind.JsxSpreadAttribute;
|
||||
}
|
||||
|
||||
export function isJsxAttribute(node: Node): node is JsxAttribute {
|
||||
return node.kind === SyntaxKind.JsxAttribute;
|
||||
}
|
||||
|
||||
// Clauses
|
||||
|
||||
export function isCaseOrDefaultClause(node: Node): node is CaseOrDefaultClause {
|
||||
|
|
|
@ -28,9 +28,9 @@ var Point = (function () {
|
|||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
Point.Origin = { x: 0, y: 0 };
|
||||
return Point;
|
||||
}());
|
||||
Point.Origin = { x: 0, y: 0 };
|
||||
var Point;
|
||||
(function (Point) {
|
||||
Point.Origin = ""; //expected duplicate identifier error
|
||||
|
@ -42,9 +42,9 @@ var A;
|
|||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
Point.Origin = { x: 0, y: 0 };
|
||||
return Point;
|
||||
}());
|
||||
Point.Origin = { x: 0, y: 0 };
|
||||
A.Point = Point;
|
||||
var Point;
|
||||
(function (Point) {
|
||||
|
|
|
@ -28,9 +28,9 @@ var Point = (function () {
|
|||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
Point.Origin = { x: 0, y: 0 };
|
||||
return Point;
|
||||
}());
|
||||
Point.Origin = { x: 0, y: 0 };
|
||||
var Point;
|
||||
(function (Point) {
|
||||
var Origin = ""; // not an error, since not exported
|
||||
|
@ -42,9 +42,9 @@ var A;
|
|||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
Point.Origin = { x: 0, y: 0 };
|
||||
return Point;
|
||||
}());
|
||||
Point.Origin = { x: 0, y: 0 };
|
||||
A.Point = Point;
|
||||
var Point;
|
||||
(function (Point) {
|
||||
|
|
|
@ -7,6 +7,6 @@ class AtomicNumbers {
|
|||
var AtomicNumbers = (function () {
|
||||
function AtomicNumbers() {
|
||||
}
|
||||
AtomicNumbers.H = 1;
|
||||
return AtomicNumbers;
|
||||
}());
|
||||
AtomicNumbers.H = 1;
|
||||
|
|
|
@ -14,7 +14,6 @@ obj[Symbol.foo];
|
|||
var Symbol;
|
||||
var obj = (_a = {},
|
||||
_a[Symbol.foo] = 0,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
obj[Symbol.foo];
|
||||
var _a;
|
||||
|
|
|
@ -38,9 +38,9 @@ define(["require", "exports"], function (require, exports) {
|
|||
function C1() {
|
||||
this.m1 = 42;
|
||||
}
|
||||
C1.s1 = true;
|
||||
return C1;
|
||||
}());
|
||||
C1.s1 = true;
|
||||
exports.C1 = C1;
|
||||
(function (E1) {
|
||||
E1[E1["A"] = 0] = "A";
|
||||
|
|
|
@ -37,9 +37,9 @@ var Point = (function () {
|
|||
Point.prototype.getDist = function () {
|
||||
return Math.sqrt(this.x * this.x + this.y * this.y);
|
||||
};
|
||||
Point.origin = new Point(0, 0);
|
||||
return Point;
|
||||
}());
|
||||
Point.origin = new Point(0, 0);
|
||||
var Point3D = (function (_super) {
|
||||
__extends(Point3D, _super);
|
||||
function Point3D(x, y, z, m) {
|
||||
|
|
|
@ -163,31 +163,35 @@ function foo8() {
|
|||
var x;
|
||||
}
|
||||
function foo9() {
|
||||
var y = (function () {
|
||||
function class_3() {
|
||||
}
|
||||
class_3.a = x;
|
||||
return class_3;
|
||||
}());
|
||||
var y = (_a = (function () {
|
||||
function class_3() {
|
||||
}
|
||||
return class_3;
|
||||
}()),
|
||||
_a.a = x,
|
||||
_a);
|
||||
var x;
|
||||
var _a;
|
||||
}
|
||||
function foo10() {
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
A.a = x;
|
||||
return A;
|
||||
}());
|
||||
A.a = x;
|
||||
var x;
|
||||
}
|
||||
function foo11() {
|
||||
function f() {
|
||||
var y = (function () {
|
||||
function class_4() {
|
||||
}
|
||||
class_4.a = x;
|
||||
return class_4;
|
||||
}());
|
||||
var y = (_a = (function () {
|
||||
function class_4() {
|
||||
}
|
||||
return class_4;
|
||||
}()),
|
||||
_a.a = x,
|
||||
_a);
|
||||
var _a;
|
||||
}
|
||||
var x;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,6 @@ class foo { constructor() { static f = 3; } }
|
|||
var foo = (function () {
|
||||
function foo() {
|
||||
}
|
||||
foo.f = 3;
|
||||
return foo;
|
||||
}());
|
||||
foo.f = 3;
|
||||
|
|
|
@ -12,10 +12,10 @@ var v = ;
|
|||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.p = 1;
|
||||
C = __decorate([
|
||||
decorate
|
||||
], C);
|
||||
return C;
|
||||
}());
|
||||
C.p = 1;
|
||||
C = __decorate([
|
||||
decorate
|
||||
], C);
|
||||
;
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
var v = class C { static a = 1; static b = 2 };
|
||||
|
||||
//// [classExpressionWithStaticProperties1.js]
|
||||
var v = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.a = 1;
|
||||
C.b = 2;
|
||||
return C;
|
||||
}());
|
||||
var v = (_a = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
}()),
|
||||
_a.a = 1,
|
||||
_a.b = 2,
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
var v = class C { static a = 1; static b };
|
||||
|
||||
//// [classExpressionWithStaticProperties2.js]
|
||||
var v = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.a = 1;
|
||||
return C;
|
||||
}());
|
||||
var v = (_a = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
}()),
|
||||
_a.a = 1,
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -27,9 +27,9 @@ var CCC = (function () {
|
|||
this.y = aaa;
|
||||
this.y = ''; // was: error, cannot assign string to number
|
||||
}
|
||||
CCC.staticY = aaa; // This shouldnt be error
|
||||
return CCC;
|
||||
}());
|
||||
CCC.staticY = aaa; // This shouldnt be error
|
||||
// above is equivalent to this:
|
||||
var aaaa = 1;
|
||||
var CCCC = (function () {
|
||||
|
|
|
@ -40,12 +40,12 @@ var Test = (function () {
|
|||
console.log(field); // Using field here shouldnt be error
|
||||
};
|
||||
}
|
||||
Test.staticMessageHandler = function () {
|
||||
var field = Test.field;
|
||||
console.log(field); // Using field here shouldnt be error
|
||||
};
|
||||
return Test;
|
||||
}());
|
||||
Test.staticMessageHandler = function () {
|
||||
var field = Test.field;
|
||||
console.log(field); // Using field here shouldnt be error
|
||||
};
|
||||
var field1;
|
||||
var Test1 = (function () {
|
||||
function Test1(field1) {
|
||||
|
@ -56,8 +56,8 @@ var Test1 = (function () {
|
|||
// it would resolve to private field1 and thats not what user intended here.
|
||||
};
|
||||
}
|
||||
Test1.staticMessageHandler = function () {
|
||||
console.log(field1); // This shouldnt be error as its a static property
|
||||
};
|
||||
return Test1;
|
||||
}());
|
||||
Test1.staticMessageHandler = function () {
|
||||
console.log(field1); // This shouldnt be error as its a static property
|
||||
};
|
||||
|
|
|
@ -32,9 +32,9 @@ var C = (function () {
|
|||
}
|
||||
C.prototype.c = function () { return ''; };
|
||||
C.f = function () { return ''; };
|
||||
C.g = function () { return ''; };
|
||||
return C;
|
||||
}());
|
||||
C.g = function () { return ''; };
|
||||
var c = new C();
|
||||
var r1 = c.x;
|
||||
var r2 = c.a;
|
||||
|
|
|
@ -42,9 +42,9 @@ var C = (function () {
|
|||
}
|
||||
C.prototype.c = function () { return ''; };
|
||||
C.f = function () { return ''; };
|
||||
C.g = function () { return ''; };
|
||||
return C;
|
||||
}());
|
||||
C.g = function () { return ''; };
|
||||
var D = (function (_super) {
|
||||
__extends(D, _super);
|
||||
function D() {
|
||||
|
|
|
@ -30,9 +30,9 @@ var C = (function () {
|
|||
}
|
||||
C.prototype.c = function () { return ''; };
|
||||
C.f = function () { return ''; };
|
||||
C.g = function () { return ''; };
|
||||
return C;
|
||||
}());
|
||||
C.g = function () { return ''; };
|
||||
// all of these are valid
|
||||
var c = new C();
|
||||
var r1 = c.x;
|
||||
|
|
|
@ -16,10 +16,10 @@ module Clod {
|
|||
var Clod = (function () {
|
||||
function Clod() {
|
||||
}
|
||||
Clod.x = 10;
|
||||
Clod.y = 10;
|
||||
return Clod;
|
||||
}());
|
||||
Clod.x = 10;
|
||||
Clod.y = 10;
|
||||
var Clod;
|
||||
(function (Clod) {
|
||||
var p = Clod.x;
|
||||
|
|
|
@ -24,13 +24,13 @@ class test {
|
|||
var test = (function () {
|
||||
function test() {
|
||||
}
|
||||
/**
|
||||
* p1 comment appears in output
|
||||
*/
|
||||
test.p1 = "";
|
||||
/**
|
||||
* p3 comment appears in output
|
||||
*/
|
||||
test.p3 = "";
|
||||
return test;
|
||||
}());
|
||||
/**
|
||||
* p1 comment appears in output
|
||||
*/
|
||||
test.p1 = "";
|
||||
/**
|
||||
* p3 comment appears in output
|
||||
*/
|
||||
test.p3 = "";
|
||||
|
|
|
@ -19,9 +19,9 @@ var C1 = (function () {
|
|||
function C1() {
|
||||
this.m1 = 42;
|
||||
}
|
||||
C1.s1 = true;
|
||||
return C1;
|
||||
}());
|
||||
C1.s1 = true;
|
||||
exports.C1 = C1;
|
||||
//// [foo_1.js]
|
||||
"use strict";
|
||||
|
|
|
@ -37,9 +37,9 @@ var C1 = (function () {
|
|||
function C1() {
|
||||
this.m1 = 42;
|
||||
}
|
||||
C1.s1 = true;
|
||||
return C1;
|
||||
}());
|
||||
C1.s1 = true;
|
||||
exports.C1 = C1;
|
||||
(function (E1) {
|
||||
E1[E1["A"] = 0] = "A";
|
||||
|
|
|
@ -32,6 +32,5 @@ var v = (_a = {},
|
|||
_a[true] = function () { },
|
||||
_a["hello bye"] = function () { },
|
||||
_a["hello " + a + " bye"] = function () { },
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -68,6 +68,5 @@ var v = (_a = {},
|
|||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -26,6 +26,6 @@ var C = (function () {
|
|||
this[s + n] = 2;
|
||||
this["hello bye"] = 0;
|
||||
}
|
||||
C["hello " + a + " bye"] = 0;
|
||||
return C;
|
||||
}());
|
||||
C["hello " + a + " bye"] = 0;
|
||||
|
|
|
@ -9,7 +9,6 @@ function foo() {
|
|||
function foo() {
|
||||
var obj = (_a = {},
|
||||
_a[this.bar] = 0,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ var M;
|
|||
(function (M) {
|
||||
var obj = (_a = {},
|
||||
_a[this.bar] = 0,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
})(M || (M = {}));
|
||||
|
|
|
@ -17,6 +17,5 @@ var v = (_a = {},
|
|||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -6,6 +6,5 @@ var obj = {
|
|||
//// [computedPropertyNames20_ES5.js]
|
||||
var obj = (_a = {},
|
||||
_a[this.bar] = 0,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -15,8 +15,7 @@ var C = (function () {
|
|||
C.prototype.bar = function () {
|
||||
var obj = (_a = {},
|
||||
_a[this.bar()] = function () { },
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
return 0;
|
||||
var _a;
|
||||
};
|
||||
|
|
|
@ -35,8 +35,7 @@ var C = (function (_super) {
|
|||
C.prototype.foo = function () {
|
||||
var obj = (_a = {},
|
||||
_a[_super.prototype.bar.call(this)] = function () { },
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
return 0;
|
||||
var _a;
|
||||
};
|
||||
|
|
|
@ -27,8 +27,7 @@ var C = (function (_super) {
|
|||
_super.call(this);
|
||||
var obj = (_a = {},
|
||||
_a[(_super.call(this), "prop")] = function () { },
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
}
|
||||
return C;
|
||||
|
|
|
@ -19,8 +19,7 @@ var C = (function () {
|
|||
(function () {
|
||||
var obj = (_a = {},
|
||||
_a[_this.bar()] = function () { },
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
});
|
||||
return 0;
|
||||
|
|
|
@ -36,8 +36,7 @@ var C = (function (_super) {
|
|||
// illegal, and not capturing this is consistent with
|
||||
//treatment of other similar violations.
|
||||
_a[(_super.call(this), "prop")] = function () { },
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -39,8 +39,7 @@ var C = (function (_super) {
|
|||
(function () {
|
||||
var obj = (_a = {},
|
||||
_a[_super.prototype.bar.call(_this)] = function () { },
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
});
|
||||
return 0;
|
||||
|
|
|
@ -17,8 +17,7 @@ var C = (function () {
|
|||
C.prototype.bar = function () {
|
||||
var obj = (_a = {},
|
||||
_a[foo()] = function () { },
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
return 0;
|
||||
var _a;
|
||||
};
|
||||
|
|
|
@ -17,8 +17,7 @@ var C = (function () {
|
|||
C.bar = function () {
|
||||
var obj = (_a = {},
|
||||
_a[foo()] = function () { },
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
return 0;
|
||||
var _a;
|
||||
};
|
||||
|
|
|
@ -6,6 +6,5 @@ var o = {
|
|||
//// [computedPropertyNames46_ES5.js]
|
||||
var o = (_a = {},
|
||||
_a["" || 0] = 0,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -16,6 +16,5 @@ var E2;
|
|||
})(E2 || (E2 = {}));
|
||||
var o = (_a = {},
|
||||
_a[E1.x || E2.x] = 0,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -25,14 +25,11 @@ var E;
|
|||
var a;
|
||||
extractIndexer((_a = {},
|
||||
_a[a] = "",
|
||||
_a
|
||||
)); // Should return string
|
||||
_a)); // Should return string
|
||||
extractIndexer((_b = {},
|
||||
_b[E.x] = "",
|
||||
_b
|
||||
)); // Should return string
|
||||
_b)); // Should return string
|
||||
extractIndexer((_c = {},
|
||||
_c["" || 0] = "",
|
||||
_c
|
||||
)); // Should return any (widened form of undefined)
|
||||
_c)); // Should return any (widened form of undefined)
|
||||
var _a, _b, _c;
|
||||
|
|
|
@ -62,6 +62,5 @@ var x = (_a = {
|
|||
}),
|
||||
,
|
||||
_a.p2 = 20,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -32,6 +32,5 @@ var v = (_a = {},
|
|||
_a[true] = 0,
|
||||
_a["hello bye"] = 0,
|
||||
_a["hello " + a + " bye"] = 0,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -58,6 +58,5 @@ var x = (_a = {
|
|||
}),
|
||||
,
|
||||
_a.p2 = 20,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -18,6 +18,5 @@ var v = (_a = {},
|
|||
_a[{}] = 0,
|
||||
_a[undefined] = undefined,
|
||||
_a[null] = null,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -16,6 +16,5 @@ var v = (_a = {},
|
|||
_a[p1] = 0,
|
||||
_a[p2] = 1,
|
||||
_a[p3] = 2,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -13,6 +13,5 @@ var E;
|
|||
})(E || (E = {}));
|
||||
var v = (_a = {},
|
||||
_a[E.member] = 0,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -15,7 +15,6 @@ function f() {
|
|||
var v = (_a = {},
|
||||
_a[t] = 0,
|
||||
_a[u] = 1,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,5 @@ var v = (_a = {},
|
|||
_a[f("")] = 0,
|
||||
_a[f(0)] = 0,
|
||||
_a[f(true)] = 0,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -12,6 +12,5 @@ var o: I = {
|
|||
var o = (_a = {},
|
||||
_a[+"foo"] = "",
|
||||
_a[+"bar"] = 0,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -13,6 +13,5 @@ var o: I = {
|
|||
var o = (_a = {},
|
||||
_a["" + 0] = function (y) { return y.length; },
|
||||
_a["" + 1] = function (y) { return y.length; },
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -13,6 +13,5 @@ var o: I = {
|
|||
var o = (_a = {},
|
||||
_a[+"foo"] = function (y) { return y.length; },
|
||||
_a[+"bar"] = function (y) { return y.length; },
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -12,6 +12,5 @@ var o: I = {
|
|||
var o = (_a = {},
|
||||
_a[+"foo"] = function (y) { return y.length; },
|
||||
_a[+"bar"] = function (y) { return y.length; },
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -13,6 +13,5 @@ var o: I = {
|
|||
var o = (_a = {},
|
||||
_a["" + "foo"] = "",
|
||||
_a["" + "bar"] = 0,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -13,6 +13,5 @@ var o: I = {
|
|||
var o = (_a = {},
|
||||
_a[+"foo"] = "",
|
||||
_a[+"bar"] = 0,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -21,6 +21,5 @@ foo((_a = {
|
|||
_a["hi" + "bye"] = true,
|
||||
_a[0 + 1] = 0,
|
||||
_a[+"hi"] = [0],
|
||||
_a
|
||||
));
|
||||
_a));
|
||||
var _a;
|
||||
|
|
|
@ -21,6 +21,5 @@ foo((_a = {
|
|||
_a["hi" + "bye"] = true,
|
||||
_a[0 + 1] = 0,
|
||||
_a[+"hi"] = [0],
|
||||
_a
|
||||
));
|
||||
_a));
|
||||
var _a;
|
||||
|
|
|
@ -13,6 +13,5 @@ var o: I = {
|
|||
var o = (_a = {},
|
||||
_a["" + "foo"] = "",
|
||||
_a["" + "bar"] = 0,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -13,6 +13,5 @@ var o: I = {
|
|||
var o = (_a = {},
|
||||
_a[+"foo"] = "",
|
||||
_a[+"bar"] = 0,
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
|
|
@ -20,8 +20,7 @@ var v = (_a = {},
|
|||
enumerable: true,
|
||||
configurable: true
|
||||
}),
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ var v = (_a = {},
|
|||
_a["hello"] = function () {
|
||||
debugger;
|
||||
},
|
||||
_a
|
||||
);
|
||||
_a);
|
||||
var _a;
|
||||
//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map
|
|
@ -1,2 +1,2 @@
|
|||
//// [computedPropertyNamesSourceMap2_ES5.js.map]
|
||||
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,GAAC,OAAO,CAAC,GAAT;QACI,QAAQ,CAAC;IACb,CAAC;;CACJ,CAAA"}
|
||||
{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,GAAC,OAAO,CAAC,GAAT;QACI,QAAQ,CAAC;IACb,CAAC;OACJ,CAAA"}
|
|
@ -56,23 +56,21 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts
|
|||
>>> },
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^^->
|
||||
3 > ^^^^->
|
||||
1 >
|
||||
>
|
||||
2 > }
|
||||
1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0)
|
||||
2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0)
|
||||
---
|
||||
>>> _a
|
||||
>>>);
|
||||
1->^
|
||||
2 > ^
|
||||
3 > ^^^^^^->
|
||||
>>> _a);
|
||||
1->^^^^^^^
|
||||
2 > ^
|
||||
1->
|
||||
>}
|
||||
2 >
|
||||
1->Emitted(6, 2) Source(5, 2) + SourceIndex(0)
|
||||
2 >Emitted(6, 3) Source(5, 2) + SourceIndex(0)
|
||||
2 >
|
||||
1->Emitted(5, 8) Source(5, 2) + SourceIndex(0)
|
||||
2 >Emitted(5, 9) Source(5, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>var _a;
|
||||
>>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map
|
|
@ -61,28 +61,32 @@ function getFoo1() {
|
|||
}());
|
||||
}
|
||||
function getFoo2() {
|
||||
return (function () {
|
||||
function class_2() {
|
||||
}
|
||||
class_2.method1 = function (arg) {
|
||||
return (_a = (function () {
|
||||
function class_2() {
|
||||
}
|
||||
return class_2;
|
||||
}()),
|
||||
_a.method1 = function (arg) {
|
||||
arg.numProp = 10;
|
||||
};
|
||||
class_2.method2 = function (arg) {
|
||||
},
|
||||
_a.method2 = function (arg) {
|
||||
arg.strProp = "hello";
|
||||
};
|
||||
return class_2;
|
||||
}());
|
||||
},
|
||||
_a);
|
||||
var _a;
|
||||
}
|
||||
function getFoo3() {
|
||||
return (function () {
|
||||
function class_3() {
|
||||
}
|
||||
class_3.method1 = function (arg) {
|
||||
return (_a = (function () {
|
||||
function class_3() {
|
||||
}
|
||||
return class_3;
|
||||
}()),
|
||||
_a.method1 = function (arg) {
|
||||
arg.numProp = 10;
|
||||
};
|
||||
class_3.method2 = function (arg) {
|
||||
},
|
||||
_a.method2 = function (arg) {
|
||||
arg.strProp = "hello";
|
||||
};
|
||||
return class_3;
|
||||
}());
|
||||
},
|
||||
_a);
|
||||
var _a;
|
||||
}
|
||||
|
|
|
@ -40,10 +40,10 @@ var C = (function () {
|
|||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
C.x = 1;
|
||||
C.y = 1;
|
||||
return C;
|
||||
}());
|
||||
C.x = 1;
|
||||
C.y = 1;
|
||||
|
||||
|
||||
//// [declFilePrivateStatic.d.ts]
|
||||
|
|
|
@ -24,8 +24,8 @@ var C = (function () {
|
|||
function C() {
|
||||
}
|
||||
C.m = function () { };
|
||||
C = __decorate([
|
||||
dec
|
||||
], C);
|
||||
return C;
|
||||
}());
|
||||
C = __decorate([
|
||||
dec
|
||||
], C);
|
||||
|
|
|
@ -30,12 +30,12 @@ var A = (function () {
|
|||
}
|
||||
A.prototype.m = function () {
|
||||
};
|
||||
__decorate([
|
||||
(function (x, p) {
|
||||
var a = 3;
|
||||
func(a);
|
||||
return x;
|
||||
})
|
||||
], A.prototype, "m", null);
|
||||
return A;
|
||||
}());
|
||||
__decorate([
|
||||
(function (x, p) {
|
||||
var a = 3;
|
||||
func(a);
|
||||
return x;
|
||||
})
|
||||
], A.prototype, "m", null);
|
||||
|
|
|
@ -45,8 +45,8 @@ var Wat = (function () {
|
|||
Wat.whatever = function () {
|
||||
// ...
|
||||
};
|
||||
__decorate([
|
||||
filter(function () { return a_1.test == 'abc'; })
|
||||
], Wat, "whatever", null);
|
||||
return Wat;
|
||||
}());
|
||||
__decorate([
|
||||
filter(function () { return a_1.test == 'abc'; })
|
||||
], Wat, "whatever", null);
|
||||
|
|
|
@ -45,15 +45,15 @@ var MyComponent = (function () {
|
|||
}
|
||||
MyComponent.prototype.method = function (x) {
|
||||
};
|
||||
__decorate([
|
||||
decorator,
|
||||
__metadata('design:type', Function),
|
||||
__metadata('design:paramtypes', [Object]),
|
||||
__metadata('design:returntype', void 0)
|
||||
], MyComponent.prototype, "method", null);
|
||||
MyComponent = __decorate([
|
||||
decorator,
|
||||
__metadata('design:paramtypes', [service_1.default])
|
||||
], MyComponent);
|
||||
return MyComponent;
|
||||
}());
|
||||
__decorate([
|
||||
decorator,
|
||||
__metadata('design:type', Function),
|
||||
__metadata('design:paramtypes', [Object]),
|
||||
__metadata('design:returntype', void 0)
|
||||
], MyComponent.prototype, "method", null);
|
||||
MyComponent = __decorate([
|
||||
decorator,
|
||||
__metadata('design:paramtypes', [service_1.default])
|
||||
], MyComponent);
|
||||
|
|
|
@ -20,11 +20,11 @@ var MyClass = (function () {
|
|||
}
|
||||
MyClass.prototype.doSomething = function () {
|
||||
};
|
||||
__decorate([
|
||||
decorator,
|
||||
__metadata('design:type', Function),
|
||||
__metadata('design:paramtypes', []),
|
||||
__metadata('design:returntype', void 0)
|
||||
], MyClass.prototype, "doSomething", null);
|
||||
return MyClass;
|
||||
}());
|
||||
__decorate([
|
||||
decorator,
|
||||
__metadata('design:type', Function),
|
||||
__metadata('design:paramtypes', []),
|
||||
__metadata('design:returntype', void 0)
|
||||
], MyClass.prototype, "doSomething", null);
|
||||
|
|
|
@ -31,10 +31,10 @@ var B = (function () {
|
|||
function B() {
|
||||
this.x = new A();
|
||||
}
|
||||
__decorate([
|
||||
decorator,
|
||||
__metadata('design:type', Object)
|
||||
], B.prototype, "x", void 0);
|
||||
return B;
|
||||
}());
|
||||
__decorate([
|
||||
decorator,
|
||||
__metadata('design:type', Object)
|
||||
], B.prototype, "x", void 0);
|
||||
exports.B = B;
|
||||
|
|
|
@ -31,10 +31,10 @@ var B = (function () {
|
|||
function B() {
|
||||
this.x = new A();
|
||||
}
|
||||
__decorate([
|
||||
decorator,
|
||||
__metadata('design:type', A)
|
||||
], B.prototype, "x", void 0);
|
||||
return B;
|
||||
}());
|
||||
__decorate([
|
||||
decorator,
|
||||
__metadata('design:type', A)
|
||||
], B.prototype, "x", void 0);
|
||||
exports.B = B;
|
||||
|
|
|
@ -44,10 +44,10 @@ var MyClass = (function () {
|
|||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [db_1.db])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
}());
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [db_1.db])
|
||||
], MyClass);
|
||||
exports.MyClass = MyClass;
|
||||
|
|
|
@ -44,10 +44,10 @@ var MyClass = (function () {
|
|||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [db_1.db])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
}());
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [db_1.db])
|
||||
], MyClass);
|
||||
exports.MyClass = MyClass;
|
||||
|
|
|
@ -44,10 +44,10 @@ var MyClass = (function () {
|
|||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [db.db])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
}());
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [db.db])
|
||||
], MyClass);
|
||||
exports.MyClass = MyClass;
|
||||
|
|
|
@ -44,10 +44,10 @@ var MyClass = (function () {
|
|||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [Object])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
}());
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [Object])
|
||||
], MyClass);
|
||||
exports.MyClass = MyClass;
|
||||
|
|
|
@ -45,10 +45,10 @@ var MyClass = (function () {
|
|||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [db_1.default])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
}());
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [db_1.default])
|
||||
], MyClass);
|
||||
exports.MyClass = MyClass;
|
||||
|
|
|
@ -45,10 +45,10 @@ var MyClass = (function () {
|
|||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [db_1.default])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
}());
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [db_1.default])
|
||||
], MyClass);
|
||||
exports.MyClass = MyClass;
|
||||
|
|
|
@ -45,10 +45,10 @@ var MyClass = (function () {
|
|||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [Object])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
}());
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [Object])
|
||||
], MyClass);
|
||||
exports.MyClass = MyClass;
|
||||
|
|
|
@ -44,10 +44,10 @@ var MyClass = (function () {
|
|||
this.db = db;
|
||||
this.db.doSomething();
|
||||
}
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [database.db])
|
||||
], MyClass);
|
||||
return MyClass;
|
||||
}());
|
||||
MyClass = __decorate([
|
||||
someDecorator,
|
||||
__metadata('design:paramtypes', [database.db])
|
||||
], MyClass);
|
||||
exports.MyClass = MyClass;
|
||||
|
|
|
@ -15,8 +15,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C = __decorate([
|
||||
dec
|
||||
], C);
|
||||
return C;
|
||||
}());
|
||||
C = __decorate([
|
||||
dec
|
||||
], C);
|
||||
|
|
|
@ -16,9 +16,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C = __decorate([
|
||||
dec
|
||||
], C);
|
||||
return C;
|
||||
}());
|
||||
C = __decorate([
|
||||
dec
|
||||
], C);
|
||||
exports.C = C;
|
||||
|
|
|
@ -16,8 +16,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C = __decorate([
|
||||
dec
|
||||
], C);
|
||||
return C;
|
||||
}());
|
||||
C = __decorate([
|
||||
dec
|
||||
], C);
|
||||
|
|
|
@ -15,8 +15,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C = __decorate([
|
||||
dec()
|
||||
], C);
|
||||
return C;
|
||||
}());
|
||||
C = __decorate([
|
||||
dec()
|
||||
], C);
|
||||
|
|
|
@ -15,8 +15,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C = __decorate([
|
||||
dec()
|
||||
], C);
|
||||
return C;
|
||||
}());
|
||||
C = __decorate([
|
||||
dec()
|
||||
], C);
|
||||
|
|
|
@ -15,8 +15,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C = __decorate([
|
||||
dec()
|
||||
], C);
|
||||
return C;
|
||||
}());
|
||||
C = __decorate([
|
||||
dec()
|
||||
], C);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue