Merge pull request #30259 from Microsoft/transformFlagCleanup

Transform flag cleanup
This commit is contained in:
Ron Buckton
2019-03-08 15:08:26 -08:00
committed by GitHub
27 changed files with 480 additions and 640 deletions
+18 -101
View File
@@ -3093,32 +3093,24 @@ namespace ts {
function computeCallExpression(node: CallExpression, subtreeFlags: TransformFlags) {
let transformFlags = subtreeFlags;
const callee = skipOuterExpressions(node.expression);
const expression = node.expression;
if (node.typeArguments) {
transformFlags |= TransformFlags.AssertTypeScript;
}
if (subtreeFlags & TransformFlags.ContainsRestOrSpread
|| (expression.transformFlags & (TransformFlags.Super | TransformFlags.ContainsSuper))) {
if (subtreeFlags & TransformFlags.ContainsRestOrSpread || isSuperOrSuperProperty(callee)) {
// If the this node contains a SpreadExpression, or is a super call, then it is an ES6
// node.
transformFlags |= TransformFlags.AssertES2015;
// super property or element accesses could be inside lambdas, etc, and need a captured `this`,
// while super keyword for super calls (indicated by TransformFlags.Super) does not (since it can only be top-level in a constructor)
if (expression.transformFlags & TransformFlags.ContainsSuper) {
if (isSuperProperty(callee)) {
transformFlags |= TransformFlags.ContainsLexicalThis;
}
}
if (expression.kind === SyntaxKind.ImportKeyword) {
transformFlags |= TransformFlags.ContainsDynamicImport;
// A dynamic 'import()' call that contains a lexical 'this' will
// require a captured 'this' when emitting down-level.
if (subtreeFlags & TransformFlags.ContainsLexicalThis) {
transformFlags |= TransformFlags.ContainsCapturedLexicalThis;
}
}
node.transformFlags = transformFlags | TransformFlags.HasComputedFlags;
@@ -3191,7 +3183,7 @@ namespace ts {
// If a parameter has an initializer, a binding pattern or a dotDotDot token, then
// it is ES6 syntax and its container must emit default value assignments or parameter destructuring downlevel.
if (subtreeFlags & TransformFlags.ContainsBindingPattern || initializer || dotDotDotToken) {
transformFlags |= TransformFlags.AssertES2015 | TransformFlags.ContainsDefaultValueAssignments;
transformFlags |= TransformFlags.AssertES2015;
}
node.transformFlags = transformFlags | TransformFlags.HasComputedFlags;
@@ -3202,7 +3194,6 @@ namespace ts {
let transformFlags = subtreeFlags;
const expression = node.expression;
const expressionKind = expression.kind;
const expressionTransformFlags = expression.transformFlags;
// If the node is synthesized, it means the emitter put the parentheses there,
// not the user. If we didn't want them, the emitter would not have put them
@@ -3212,12 +3203,6 @@ namespace ts {
transformFlags |= TransformFlags.AssertTypeScript;
}
// If the expression of a ParenthesizedExpression is a destructuring assignment,
// then the ParenthesizedExpression is a destructuring assignment.
if (expressionTransformFlags & TransformFlags.DestructuringAssignment) {
transformFlags |= TransformFlags.DestructuringAssignment;
}
node.transformFlags = transformFlags | TransformFlags.HasComputedFlags;
return transformFlags & ~TransformFlags.OuterExpressionExcludes;
}
@@ -3241,12 +3226,6 @@ namespace ts {
|| node.typeParameters) {
transformFlags |= TransformFlags.AssertTypeScript;
}
if (subtreeFlags & TransformFlags.ContainsLexicalThisInComputedPropertyName) {
// A computed property name containing `this` might need to be rewritten,
// so propagate the ContainsLexicalThis flag upward.
transformFlags |= TransformFlags.ContainsLexicalThis;
}
}
node.transformFlags = transformFlags | TransformFlags.HasComputedFlags;
@@ -3264,12 +3243,6 @@ namespace ts {
transformFlags |= TransformFlags.AssertTypeScript;
}
if (subtreeFlags & TransformFlags.ContainsLexicalThisInComputedPropertyName) {
// A computed property name containing `this` might need to be rewritten,
// so propagate the ContainsLexicalThis flag upward.
transformFlags |= TransformFlags.ContainsLexicalThis;
}
node.transformFlags = transformFlags | TransformFlags.HasComputedFlags;
return transformFlags & ~TransformFlags.ClassExcludes;
}
@@ -3374,7 +3347,7 @@ namespace ts {
}
node.transformFlags = transformFlags | TransformFlags.HasComputedFlags;
return transformFlags & ~TransformFlags.MethodOrAccessorExcludes;
return propagatePropertyNameFlags(node.name, transformFlags & ~TransformFlags.MethodOrAccessorExcludes);
}
function computeAccessor(node: AccessorDeclaration, subtreeFlags: TransformFlags) {
@@ -3396,7 +3369,7 @@ namespace ts {
}
node.transformFlags = transformFlags | TransformFlags.HasComputedFlags;
return transformFlags & ~TransformFlags.MethodOrAccessorExcludes;
return propagatePropertyNameFlags(node.name, transformFlags & ~TransformFlags.MethodOrAccessorExcludes);
}
function computePropertyDeclaration(node: PropertyDeclaration, subtreeFlags: TransformFlags) {
@@ -3410,7 +3383,7 @@ namespace ts {
}
node.transformFlags = transformFlags | TransformFlags.HasComputedFlags;
return transformFlags & ~TransformFlags.NodeExcludes;
return propagatePropertyNameFlags(node.name, transformFlags & ~TransformFlags.PropertyExcludes);
}
function computeFunctionDeclaration(node: FunctionDeclaration, subtreeFlags: TransformFlags) {
@@ -3444,13 +3417,6 @@ namespace ts {
transformFlags |= TransformFlags.AssertES2018;
}
// If a FunctionDeclaration's subtree has marked the container as needing to capture the
// lexical this, or the function contains parameters with initializers, then this node is
// ES6 syntax.
if (subtreeFlags & TransformFlags.ES2015FunctionSyntaxMask) {
transformFlags |= TransformFlags.AssertES2015;
}
// If a FunctionDeclaration is generator function and is the body of a
// transformed async function, then this node can be transformed to a
// down-level generator.
@@ -3486,14 +3452,6 @@ namespace ts {
transformFlags |= TransformFlags.AssertES2018;
}
// If a FunctionExpression's subtree has marked the container as needing to capture the
// lexical this, or the function contains parameters with initializers, then this node is
// ES6 syntax.
if (subtreeFlags & TransformFlags.ES2015FunctionSyntaxMask) {
transformFlags |= TransformFlags.AssertES2015;
}
// If a FunctionExpression is generator function and is the body of a
// transformed async function, then this node can be transformed to a
// down-level generator.
@@ -3527,11 +3485,6 @@ namespace ts {
transformFlags |= TransformFlags.AssertES2018;
}
// If an ArrowFunction contains a lexical this, its container must capture the lexical this.
if (subtreeFlags & TransformFlags.ContainsLexicalThis) {
transformFlags |= TransformFlags.ContainsCapturedLexicalThis;
}
node.transformFlags = transformFlags | TransformFlags.HasComputedFlags;
return transformFlags & ~TransformFlags.ArrowFunctionExcludes;
}
@@ -3541,11 +3494,10 @@ namespace ts {
// If a PropertyAccessExpression starts with a super keyword, then it is
// ES6 syntax, and requires a lexical `this` binding.
if (transformFlags & TransformFlags.Super) {
transformFlags ^= TransformFlags.Super;
if (node.expression.kind === SyntaxKind.SuperKeyword) {
// super inside of an async function requires hoisting the super access (ES2017).
// same for super inside of an async generator, which is ES2018.
transformFlags |= TransformFlags.ContainsSuper | TransformFlags.ContainsES2017 | TransformFlags.ContainsES2018;
transformFlags |= TransformFlags.ContainsES2017 | TransformFlags.ContainsES2018;
}
node.transformFlags = transformFlags | TransformFlags.HasComputedFlags;
@@ -3554,16 +3506,13 @@ namespace ts {
function computeElementAccess(node: ElementAccessExpression, subtreeFlags: TransformFlags) {
let transformFlags = subtreeFlags;
const expression = node.expression;
const expressionFlags = expression.transformFlags; // We do not want to aggregate flags from the argument expression for super/this capturing
// If an ElementAccessExpression starts with a super keyword, then it is
// ES6 syntax, and requires a lexical `this` binding.
if (expressionFlags & TransformFlags.Super) {
transformFlags &= ~TransformFlags.Super;
if (node.expression.kind === SyntaxKind.SuperKeyword) {
// super inside of an async function requires hoisting the super access (ES2017).
// same for super inside of an async generator, which is ES2018.
transformFlags |= TransformFlags.ContainsSuper | TransformFlags.ContainsES2017 | TransformFlags.ContainsES2018;
transformFlags |= TransformFlags.ContainsES2017 | TransformFlags.ContainsES2018;
}
node.transformFlags = transformFlags | TransformFlags.HasComputedFlags;
@@ -3572,7 +3521,7 @@ namespace ts {
function computeVariableDeclaration(node: VariableDeclaration, subtreeFlags: TransformFlags) {
let transformFlags = subtreeFlags;
transformFlags |= TransformFlags.AssertES2015 | TransformFlags.ContainsBindingPattern;
transformFlags |= TransformFlags.AssertES2015 | TransformFlags.ContainsBindingPattern; // TODO(rbuckton): Why are these set unconditionally?
// A VariableDeclaration containing ObjectRest is ES2018 syntax
if (subtreeFlags & TransformFlags.ContainsObjectRestOrSpread) {
@@ -3634,15 +3583,7 @@ namespace ts {
}
function computeExpressionStatement(node: ExpressionStatement, subtreeFlags: TransformFlags) {
let transformFlags = subtreeFlags;
// 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 (node.expression.transformFlags & TransformFlags.DestructuringAssignment) {
transformFlags |= TransformFlags.AssertES2015;
}
const transformFlags = subtreeFlags;
node.transformFlags = transformFlags | TransformFlags.HasComputedFlags;
return transformFlags & ~TransformFlags.NodeExcludes;
}
@@ -3815,17 +3756,6 @@ namespace ts {
// This is so that they can flow through PropertyName transforms unaffected.
// Instead, we mark the container as ES6, so that it can properly handle the transform.
transformFlags |= TransformFlags.ContainsComputedPropertyName;
if (subtreeFlags & TransformFlags.ContainsLexicalThis) {
// A computed method name like `[this.getName()](x: string) { ... }` needs to
// distinguish itself from the normal case of a method body containing `this`:
// `this` inside a method doesn't need to be rewritten (the method provides `this`),
// whereas `this` inside a computed name *might* need to be rewritten if the class/object
// is inside an arrow function:
// `_this = this; () => class K { [_this.getName()]() { ... } }`
// To make this distinction, use ContainsLexicalThisInComputedPropertyName
// instead of ContainsLexicalThis for computed property names
transformFlags |= TransformFlags.ContainsLexicalThisInComputedPropertyName;
}
break;
case SyntaxKind.SpreadElement:
@@ -3838,7 +3768,7 @@ namespace ts {
case SyntaxKind.SuperKeyword:
// This node is ES6 syntax.
transformFlags |= TransformFlags.AssertES2015 | TransformFlags.Super;
transformFlags |= TransformFlags.AssertES2015;
excludeFlags = TransformFlags.OuterExpressionExcludes; // must be set to persist `Super`
break;
@@ -3880,12 +3810,6 @@ namespace ts {
transformFlags |= TransformFlags.AssertES2015;
}
if (subtreeFlags & TransformFlags.ContainsLexicalThisInComputedPropertyName) {
// A computed property name containing `this` might need to be rewritten,
// so propagate the ContainsLexicalThis flag upward.
transformFlags |= TransformFlags.ContainsLexicalThis;
}
if (subtreeFlags & TransformFlags.ContainsObjectRestOrSpread) {
// If an ObjectLiteralExpression contains a spread element, then it
// is an ES2018 node.
@@ -3895,14 +3819,7 @@ namespace ts {
break;
case SyntaxKind.ArrayLiteralExpression:
case SyntaxKind.NewExpression:
excludeFlags = TransformFlags.ArrayLiteralOrCallOrNewExcludes;
if (subtreeFlags & TransformFlags.ContainsRestOrSpread) {
// If the this node contains a SpreadExpression, then it is an ES6
// node.
transformFlags |= TransformFlags.AssertES2015;
}
break;
case SyntaxKind.DoStatement:
@@ -3917,10 +3834,6 @@ namespace ts {
break;
case SyntaxKind.SourceFile:
if (subtreeFlags & TransformFlags.ContainsCapturedLexicalThis) {
transformFlags |= TransformFlags.AssertES2015;
}
break;
case SyntaxKind.ReturnStatement:
@@ -3938,6 +3851,10 @@ namespace ts {
return transformFlags & ~excludeFlags;
}
function propagatePropertyNameFlags(node: PropertyName, transformFlags: TransformFlags) {
return transformFlags | (node.transformFlags & TransformFlags.PropertyNamePropagatingFlags);
}
/**
* Gets the transform flags to exclude when unioning the transform flags of a subtree.
*
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -438,7 +438,7 @@ namespace ts {
)
);
addStatementsAfterPrologue(statements, endLexicalEnvironment());
insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
// Minor optimization, emit `_super` helper to capture `super` access in an arrow.
// This step isn't needed if we eventually transform this to ES5.
@@ -448,7 +448,7 @@ namespace ts {
enableSubstitutionForAsyncMethodsWithSuper();
const variableStatement = createSuperAccessVariableStatement(resolver, node, capturedSuperProperties);
substitutedSuperAccessors[getNodeId(variableStatement)] = true;
addStatementsAfterPrologue(statements, [variableStatement]);
insertStatementsAfterStandardPrologue(statements, [variableStatement]);
}
const block = createBlock(statements, /*multiLine*/ true);
+3 -3
View File
@@ -689,12 +689,12 @@ namespace ts {
enableSubstitutionForAsyncMethodsWithSuper();
const variableStatement = createSuperAccessVariableStatement(resolver, node, capturedSuperProperties);
substitutedSuperAccessors[getNodeId(variableStatement)] = true;
addStatementsAfterPrologue(statements, [variableStatement]);
insertStatementsAfterStandardPrologue(statements, [variableStatement]);
}
statements.push(returnStatement);
addStatementsAfterPrologue(statements, endLexicalEnvironment());
insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
const block = updateBlock(node.body!, statements);
if (emitSuperHelpers && hasSuperElementAccess) {
@@ -726,7 +726,7 @@ namespace ts {
const leadingStatements = endLexicalEnvironment();
if (statementOffset > 0 || some(statements) || some(leadingStatements)) {
const block = convertToFunctionBody(body, /*multiLine*/ true);
addStatementsAfterPrologue(statements, leadingStatements);
insertStatementsAfterStandardPrologue(statements, leadingStatements);
addRange(statements, block.statements.slice(statementOffset));
return updateBlock(block, setTextRange(createNodeArray(statements), block.statements));
}
+2 -2
View File
@@ -316,7 +316,7 @@ namespace ts {
else if (inGeneratorFunctionBody) {
return visitJavaScriptInGeneratorFunctionBody(node);
}
else if (transformFlags & TransformFlags.Generator) {
else if (isFunctionLikeDeclaration(node) && node.asteriskToken) {
return visitGenerator(node);
}
else if (transformFlags & TransformFlags.ContainsGenerator) {
@@ -587,7 +587,7 @@ namespace ts {
transformAndEmitStatements(body.statements, statementOffset);
const buildResult = build();
addStatementsAfterPrologue(statements, endLexicalEnvironment());
insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
statements.push(createReturn(buildResult));
// Restore previous generator state
+4 -4
View File
@@ -100,7 +100,7 @@ namespace ts {
append(statements, visitNode(currentModuleInfo.externalHelpersImportDeclaration, sourceElementVisitor, isStatement));
addRange(statements, visitNodes(node.statements, sourceElementVisitor, isStatement, statementOffset));
addExportEqualsIfNeeded(statements, /*emitAsReturn*/ false);
addStatementsAfterPrologue(statements, endLexicalEnvironment());
insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
const updated = updateSourceFileNode(node, setTextRange(createNodeArray(statements), node.statements));
if (currentModuleInfo.hasExportStarsToExportValues && !compilerOptions.importHelpers) {
@@ -432,7 +432,7 @@ namespace ts {
// End the lexical environment for the module body
// and merge any new lexical declarations.
addStatementsAfterPrologue(statements, endLexicalEnvironment());
insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
const body = createBlock(statements, /*multiLine*/ true);
if (currentModuleInfo.hasExportStarsToExportValues && !compilerOptions.importHelpers) {
@@ -537,8 +537,8 @@ namespace ts {
if (isImportCall(node)) {
return visitImportCallExpression(node);
}
else if (node.transformFlags & TransformFlags.DestructuringAssignment && isBinaryExpression(node)) {
return visitDestructuringAssignment(node as DestructuringAssignment);
else if (isDestructuringAssignment(node)) {
return visitDestructuringAssignment(node);
}
else {
return visitEachChild(node, moduleExpressionElementVisitor, context);
+3 -4
View File
@@ -257,7 +257,7 @@ namespace ts {
// We emit hoisted variables early to align roughly with our previous emit output.
// Two key differences in this approach are:
// - Temporary variables will appear at the top rather than at the bottom of the file
addStatementsAfterPrologue(statements, endLexicalEnvironment());
insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
const exportStarFunction = addExportStarIfNeeded(statements)!; // TODO: GH#18217
const moduleObject = createObjectLiteral([
@@ -1463,9 +1463,8 @@ namespace ts {
* @param node The node to visit.
*/
function destructuringAndImportCallVisitor(node: Node): VisitResult<Node> {
if (node.transformFlags & TransformFlags.DestructuringAssignment
&& node.kind === SyntaxKind.BinaryExpression) {
return visitDestructuringAssignment(<DestructuringAssignment>node);
if (isDestructuringAssignment(node)) {
return visitDestructuringAssignment(node);
}
else if (isImportCall(node)) {
return visitImportCallExpression(node);
+47 -140
View File
@@ -208,15 +208,9 @@ namespace ts {
* @param node The node to visit.
*/
function visitorWorker(node: Node): VisitResult<Node> {
if (node.transformFlags & TransformFlags.TypeScript) {
// This node is explicitly marked as TypeScript, so we should transform the node.
if (node.transformFlags & TransformFlags.ContainsTypeScript) {
return visitTypeScript(node);
}
else if (node.transformFlags & TransformFlags.ContainsTypeScript) {
// This node contains TypeScript, so we should visit its children.
return visitEachChild(node, visitor, context);
}
return node;
}
@@ -296,15 +290,9 @@ namespace ts {
(<ImportEqualsDeclaration>node).moduleReference.kind === SyntaxKind.ExternalModuleReference)) {
// do not emit ES6 imports and exports since they are illegal inside a namespace
return undefined;
}
else if (node.transformFlags & TransformFlags.TypeScript || hasModifier(node, ModifierFlags.Export)) {
// This node is explicitly marked as TypeScript, or is exported at the namespace
// level, so we should transform the node.
return visitTypeScript(node);
}
else if (node.transformFlags & TransformFlags.ContainsTypeScript) {
// This node contains TypeScript, so we should visit its children.
return visitEachChild(node, visitor, context);
else if (node.transformFlags & TransformFlags.ContainsTypeScript || hasModifier(node, ModifierFlags.Export)) {
return visitTypeScript(node);
}
return node;
@@ -365,7 +353,7 @@ namespace ts {
* @param node The node to visit.
*/
function visitTypeScript(node: Node): VisitResult<Node> {
if (hasModifier(node, ModifierFlags.Ambient) && isStatement(node)) {
if (isStatement(node) && hasModifier(node, ModifierFlags.Ambient)) {
// TypeScript ambient declarations are elided, but some comments may be preserved.
// See the implementation of `getLeadingComments` in comments.ts for more details.
return createNotEmittedStatement(node);
@@ -443,7 +431,7 @@ namespace ts {
return createNotEmittedStatement(node);
case SyntaxKind.ClassDeclaration:
// This is a class declaration with TypeScript syntax extensions.
// This may be a class declaration with TypeScript syntax extensions.
//
// TypeScript class syntax extensions include:
// - decorators
@@ -455,7 +443,7 @@ namespace ts {
return visitClassDeclaration(<ClassDeclaration>node);
case SyntaxKind.ClassExpression:
// This is a class expression with TypeScript syntax extensions.
// This may be a class expression with TypeScript syntax extensions.
//
// TypeScript class syntax extensions include:
// - decorators
@@ -467,7 +455,7 @@ namespace ts {
return visitClassExpression(<ClassExpression>node);
case SyntaxKind.HeritageClause:
// This is a heritage clause with TypeScript syntax extensions.
// This may be a heritage clause with TypeScript syntax extensions.
//
// TypeScript heritage clause extensions include:
// - `implements` clause
@@ -503,7 +491,7 @@ namespace ts {
return visitArrowFunction(<ArrowFunction>node);
case SyntaxKind.Parameter:
// This is a parameter declaration with TypeScript syntax extensions.
// This may be a parameter declaration with TypeScript syntax extensions.
//
// TypeScript parameter declaration syntax extensions include:
// - decorators
@@ -556,7 +544,8 @@ namespace ts {
return visitImportEqualsDeclaration(<ImportEqualsDeclaration>node);
default:
return Debug.failBadSyntaxKind(node);
// node contains some other TypeScript syntax
return visitEachChild(node, visitor, context);
}
}
@@ -607,18 +596,22 @@ namespace ts {
return facts;
}
/**
* Transforms a class declaration with TypeScript syntax into compatible ES6.
*
* This function will only be called when one of the following conditions are met:
* - The class has decorators.
* - The class has property declarations with initializers.
* - The class contains a constructor that contains parameters with accessibility modifiers.
* - The class is an export in a TypeScript namespace.
*
* @param node The node to transform.
*/
function hasTypeScriptClassSyntax(node: Node) {
return !!(node.transformFlags & TransformFlags.ContainsTypeScriptClassSyntax);
}
function isClassLikeDeclarationWithTypeScriptSyntax(node: ClassLikeDeclaration) {
return some(node.decorators)
|| some(node.typeParameters)
|| some(node.heritageClauses, hasTypeScriptClassSyntax)
|| some(node.members, hasTypeScriptClassSyntax);
}
function visitClassDeclaration(node: ClassDeclaration): VisitResult<Statement> {
if (!isClassLikeDeclarationWithTypeScriptSyntax(node) && !(currentNamespace && hasModifier(node, ModifierFlags.Export))) {
return visitEachChild(node, visitor, context);
}
const savedPendingExpressions = pendingExpressions;
pendingExpressions = undefined;
@@ -682,7 +675,7 @@ namespace ts {
setEmitFlags(statement, EmitFlags.NoComments | EmitFlags.NoTokenSourceMaps);
statements.push(statement);
addStatementsAfterPrologue(statements, context.endLexicalEnvironment());
insertStatementsAfterStandardPrologue(statements, context.endLexicalEnvironment());
const iife = createImmediatelyInvokedArrowFunction(statements);
setEmitFlags(iife, EmitFlags.TypeScriptClassWrapper);
@@ -890,16 +883,11 @@ namespace ts {
return statement;
}
/**
* Transforms a class expression with TypeScript syntax into compatible ES6.
*
* This function will only be called when one of the following conditions are met:
* - The class has property declarations with initializers.
* - The class contains a constructor that contains parameters with accessibility modifiers.
*
* @param node The node to transform.
*/
function visitClassExpression(node: ClassExpression): Expression {
if (!isClassLikeDeclarationWithTypeScriptSyntax(node)) {
return visitEachChild(node, visitor, context);
}
const savedPendingExpressions = pendingExpressions;
pendingExpressions = undefined;
@@ -2237,18 +2225,11 @@ namespace ts {
* @param node The HeritageClause to transform.
*/
function visitHeritageClause(node: HeritageClause): HeritageClause | undefined {
if (node.token === SyntaxKind.ExtendsKeyword) {
const types = visitNodes(node.types, visitor, isExpressionWithTypeArguments, 0, 1);
return setTextRange(
createHeritageClause(
SyntaxKind.ExtendsKeyword,
types
),
node
);
if (node.token === SyntaxKind.ImplementsKeyword) {
// implements clauses are elided
return undefined;
}
return undefined;
return visitEachChild(node, visitor, context);
}
/**
@@ -2299,16 +2280,6 @@ namespace ts {
);
}
/**
* Visits a method declaration of a class.
*
* This function will be called when one of the following conditions are met:
* - The node is an overload
* - The node is marked as abstract, public, private, protected, or readonly
* - The node has a computed property name
*
* @param node The method node.
*/
function visitMethodDeclaration(node: MethodDeclaration) {
if (!shouldEmitFunctionLikeDeclaration(node)) {
return undefined;
@@ -2344,15 +2315,6 @@ namespace ts {
return !(nodeIsMissing(node.body) && hasModifier(node, ModifierFlags.Abstract));
}
/**
* Visits a get accessor declaration of a class.
*
* This function will be called when one of the following conditions are met:
* - The node is marked as abstract, public, private, or protected
* - The node has a computed property name
*
* @param node The get accessor node.
*/
function visitGetAccessor(node: GetAccessorDeclaration) {
if (!shouldEmitAccessorDeclaration(node)) {
return undefined;
@@ -2375,15 +2337,6 @@ namespace ts {
return updated;
}
/**
* Visits a set accessor declaration of a class.
*
* This function will be called when one of the following conditions are met:
* - The node is marked as abstract, public, private, or protected
* - The node has a computed property name
*
* @param node The set accessor node.
*/
function visitSetAccessor(node: SetAccessorDeclaration) {
if (!shouldEmitAccessorDeclaration(node)) {
return undefined;
@@ -2405,16 +2358,6 @@ namespace ts {
return updated;
}
/**
* Visits a function declaration.
*
* This function will be called when one of the following conditions are met:
* - The node is an overload
* - The node is exported from a TypeScript namespace
* - The node has decorators
*
* @param node The function node.
*/
function visitFunctionDeclaration(node: FunctionDeclaration): VisitResult<Statement> {
if (!shouldEmitFunctionLikeDeclaration(node)) {
return createNotEmittedStatement(node);
@@ -2438,14 +2381,6 @@ namespace ts {
return updated;
}
/**
* Visits a function expression node.
*
* This function will be called when one of the following conditions are met:
* - The node has type annotations
*
* @param node The function expression node.
*/
function visitFunctionExpression(node: FunctionExpression): Expression {
if (!shouldEmitFunctionLikeDeclaration(node)) {
return createOmittedExpression();
@@ -2463,11 +2398,6 @@ namespace ts {
return updated;
}
/**
* @remarks
* This function will be called when one of the following conditions are met:
* - The node has type annotations
*/
function visitArrowFunction(node: ArrowFunction) {
const updated = updateArrowFunction(
node,
@@ -2481,22 +2411,12 @@ namespace ts {
return updated;
}
/**
* Visits a parameter declaration node.
*
* This function will be called when one of the following conditions are met:
* - The node has an accessibility modifier.
* - The node has a questionToken.
* - The node's kind is ThisKeyword.
*
* @param node The parameter declaration node.
*/
function visitParameter(node: ParameterDeclaration) {
if (parameterIsThisKeyword(node)) {
return undefined;
}
const parameter = createParameter(
const updated = updateParameter(
node,
/*decorators*/ undefined,
/*modifiers*/ undefined,
node.dotDotDotToken,
@@ -2505,24 +2425,17 @@ namespace ts {
/*type*/ undefined,
visitNode(node.initializer, visitor, isExpression)
);
// While we emit the source map for the node after skipping decorators and modifiers,
// we need to emit the comments for the original range.
setOriginalNode(parameter, node);
setTextRange(parameter, moveRangePastModifiers(node));
setCommentRange(parameter, node);
setSourceMapRange(parameter, moveRangePastModifiers(node));
setEmitFlags(parameter.name, EmitFlags.NoTrailingSourceMap);
return parameter;
if (updated !== node) {
// While we emit the source map for the node after skipping decorators and modifiers,
// we need to emit the comments for the original range.
setCommentRange(updated, node);
setTextRange(updated, moveRangePastModifiers(node));
setSourceMapRange(updated, moveRangePastModifiers(node));
setEmitFlags(updated.name, EmitFlags.NoTrailingSourceMap);
}
return updated;
}
/**
* Visits a variable statement in a namespace.
*
* This function will be called when one of the following conditions are met:
* - The node is exported from a TypeScript namespace.
*/
function visitVariableStatement(node: VariableStatement): Statement | undefined {
if (isExportOfNamespace(node)) {
const variables = getInitializedVariables(node.declarationList);
@@ -2576,12 +2489,6 @@ namespace ts {
visitNode(node.initializer, visitor, isExpression));
}
/**
* Visits a parenthesized expression that contains either a type assertion or an `as`
* expression.
*
* @param node The parenthesized expression node.
*/
function visitParenthesizedExpression(node: ParenthesizedExpression): Expression {
const innerExpression = skipOuterExpressions(node.expression, ~OuterExpressionKinds.Assertions);
if (isAssertionExpression(innerExpression)) {
@@ -2765,7 +2672,7 @@ namespace ts {
const statements: Statement[] = [];
startLexicalEnvironment();
const members = map(node.members, transformEnumMember);
addStatementsAfterPrologue(statements, endLexicalEnvironment());
insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
addRange(statements, members);
currentNamespaceContainerName = savedCurrentNamespaceLocalName;
@@ -3086,7 +2993,7 @@ namespace ts {
statementsLocation = moveRangePos(moduleBlock.statements, -1);
}
addStatementsAfterPrologue(statements, endLexicalEnvironment());
insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
currentNamespaceContainerName = savedCurrentNamespaceContainerName;
currentNamespace = savedCurrentNamespace;
currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
+38 -43
View File
@@ -5065,38 +5065,29 @@ namespace ts {
// Facts
// - Flags used to indicate that a node or subtree contains syntax that requires transformation.
TypeScript = 1 << 0,
ContainsTypeScript = 1 << 1,
ContainsJsx = 1 << 2,
ContainsESNext = 1 << 3,
ContainsES2017 = 1 << 4,
ContainsES2016 = 1 << 5,
ES2015 = 1 << 6,
ContainsTypeScript = 1 << 0,
ContainsJsx = 1 << 1,
ContainsESNext = 1 << 2,
ContainsES2019 = 1 << 3,
ContainsES2018 = 1 << 4,
ContainsES2017 = 1 << 5,
ContainsES2016 = 1 << 6,
ContainsES2015 = 1 << 7,
Generator = 1 << 8,
ContainsGenerator = 1 << 9,
DestructuringAssignment = 1 << 10,
ContainsDestructuringAssignment = 1 << 11,
ContainsGenerator = 1 << 8,
ContainsDestructuringAssignment = 1 << 9,
// Markers
// - Flags used to indicate that a subtree contains a specific transformation.
ContainsTypeScriptClassSyntax = 1 << 12, // Decorators, Property Initializers, Parameter Property Initializers
ContainsLexicalThis = 1 << 13,
ContainsCapturedLexicalThis = 1 << 14,
ContainsLexicalThisInComputedPropertyName = 1 << 15,
ContainsDefaultValueAssignments = 1 << 16,
ContainsRestOrSpread = 1 << 17,
ContainsObjectRestOrSpread = 1 << 18,
ContainsComputedPropertyName = 1 << 19,
ContainsBlockScopedBinding = 1 << 20,
ContainsBindingPattern = 1 << 21,
ContainsYield = 1 << 22,
ContainsHoistedDeclarationOrCompletion = 1 << 23,
ContainsDynamicImport = 1 << 24,
Super = 1 << 25,
ContainsSuper = 1 << 26,
ContainsES2018 = 1 << 27,
ContainsES2019 = 1 << 28,
ContainsTypeScriptClassSyntax = 1 << 10, // Decorators, Property Initializers, Parameter Property Initializers
ContainsLexicalThis = 1 << 11,
ContainsRestOrSpread = 1 << 12,
ContainsObjectRestOrSpread = 1 << 13,
ContainsComputedPropertyName = 1 << 14,
ContainsBlockScopedBinding = 1 << 15,
ContainsBindingPattern = 1 << 16,
ContainsYield = 1 << 17,
ContainsHoistedDeclarationOrCompletion = 1 << 18,
ContainsDynamicImport = 1 << 19,
// Please leave this as 1 << 29.
// It is the maximum bit we can set before we outgrow the size of a v8 small integer (SMI) on an x86 system.
@@ -5105,40 +5096,44 @@ namespace ts {
// Assertions
// - Bitmasks that are used to assert facts about the syntax of a node and its subtree.
AssertTypeScript = TypeScript | ContainsTypeScript,
AssertTypeScript = ContainsTypeScript,
AssertJsx = ContainsJsx,
AssertESNext = ContainsESNext,
AssertES2019 = ContainsES2019,
AssertES2018 = ContainsES2018,
AssertES2017 = ContainsES2017,
AssertES2016 = ContainsES2016,
AssertES2015 = ES2015 | ContainsES2015,
AssertGenerator = Generator | ContainsGenerator,
AssertDestructuringAssignment = DestructuringAssignment | ContainsDestructuringAssignment,
AssertES2015 = ContainsES2015,
AssertGenerator = ContainsGenerator,
AssertDestructuringAssignment = ContainsDestructuringAssignment,
// Scope Exclusions
// - Bitmasks that exclude flags from propagating out of a specific context
// into the subtree flags of their container.
OuterExpressionExcludes = TypeScript | ES2015 | DestructuringAssignment | Generator | HasComputedFlags,
PropertyAccessExcludes = OuterExpressionExcludes | Super,
NodeExcludes = PropertyAccessExcludes | ContainsSuper,
ArrowFunctionExcludes = NodeExcludes | ContainsTypeScriptClassSyntax | ContainsDefaultValueAssignments | ContainsLexicalThis | ContainsBlockScopedBinding | ContainsYield | ContainsHoistedDeclarationOrCompletion | ContainsBindingPattern | ContainsObjectRestOrSpread,
FunctionExcludes = NodeExcludes | ContainsTypeScriptClassSyntax | ContainsDefaultValueAssignments | ContainsCapturedLexicalThis | ContainsLexicalThis | ContainsBlockScopedBinding | ContainsYield | ContainsHoistedDeclarationOrCompletion | ContainsBindingPattern | ContainsObjectRestOrSpread,
ConstructorExcludes = NodeExcludes | ContainsDefaultValueAssignments | ContainsLexicalThis | ContainsCapturedLexicalThis | ContainsBlockScopedBinding | ContainsYield | ContainsHoistedDeclarationOrCompletion | ContainsBindingPattern | ContainsObjectRestOrSpread,
MethodOrAccessorExcludes = NodeExcludes | ContainsDefaultValueAssignments | ContainsLexicalThis | ContainsCapturedLexicalThis | ContainsBlockScopedBinding | ContainsYield | ContainsHoistedDeclarationOrCompletion | ContainsBindingPattern | ContainsObjectRestOrSpread,
ClassExcludes = NodeExcludes | ContainsTypeScriptClassSyntax | ContainsLexicalThis | ContainsCapturedLexicalThis | ContainsComputedPropertyName | ContainsLexicalThisInComputedPropertyName,
ModuleExcludes = NodeExcludes | ContainsTypeScriptClassSyntax | ContainsLexicalThis | ContainsCapturedLexicalThis | ContainsBlockScopedBinding | ContainsHoistedDeclarationOrCompletion,
OuterExpressionExcludes = HasComputedFlags,
PropertyAccessExcludes = OuterExpressionExcludes,
NodeExcludes = PropertyAccessExcludes,
ArrowFunctionExcludes = NodeExcludes | ContainsTypeScriptClassSyntax | ContainsBlockScopedBinding | ContainsYield | ContainsHoistedDeclarationOrCompletion | ContainsBindingPattern | ContainsObjectRestOrSpread,
FunctionExcludes = NodeExcludes | ContainsTypeScriptClassSyntax | ContainsLexicalThis | ContainsBlockScopedBinding | ContainsYield | ContainsHoistedDeclarationOrCompletion | ContainsBindingPattern | ContainsObjectRestOrSpread,
ConstructorExcludes = NodeExcludes | ContainsLexicalThis | ContainsBlockScopedBinding | ContainsYield | ContainsHoistedDeclarationOrCompletion | ContainsBindingPattern | ContainsObjectRestOrSpread,
MethodOrAccessorExcludes = NodeExcludes | ContainsLexicalThis | ContainsBlockScopedBinding | ContainsYield | ContainsHoistedDeclarationOrCompletion | ContainsBindingPattern | ContainsObjectRestOrSpread,
PropertyExcludes = NodeExcludes | ContainsLexicalThis,
ClassExcludes = NodeExcludes | ContainsTypeScriptClassSyntax | ContainsComputedPropertyName,
ModuleExcludes = NodeExcludes | ContainsTypeScriptClassSyntax | ContainsLexicalThis | ContainsBlockScopedBinding | ContainsHoistedDeclarationOrCompletion,
TypeExcludes = ~ContainsTypeScript,
ObjectLiteralExcludes = NodeExcludes | ContainsTypeScriptClassSyntax | ContainsComputedPropertyName | ContainsLexicalThisInComputedPropertyName | ContainsObjectRestOrSpread,
ObjectLiteralExcludes = NodeExcludes | ContainsTypeScriptClassSyntax | ContainsComputedPropertyName | ContainsObjectRestOrSpread,
ArrayLiteralOrCallOrNewExcludes = NodeExcludes | ContainsRestOrSpread,
VariableDeclarationListExcludes = NodeExcludes | ContainsBindingPattern | ContainsObjectRestOrSpread,
ParameterExcludes = NodeExcludes,
CatchClauseExcludes = NodeExcludes | ContainsObjectRestOrSpread,
BindingPatternExcludes = NodeExcludes | ContainsRestOrSpread,
// Propagating flags
// - Bitmasks for flags that should propagate from a child
PropertyNamePropagatingFlags = ContainsLexicalThis,
// Masks
// - Additional bitmasks
ES2015FunctionSyntaxMask = ContainsCapturedLexicalThis | ContainsDefaultValueAssignments,
}
export interface SourceMapRange extends TextRange {
+48 -6
View File
@@ -401,10 +401,7 @@ namespace ts {
return !nodeIsMissing(node);
}
/**
* Prepends statements to an array while taking care of prologue directives.
*/
export function addStatementsAfterPrologue<T extends Statement>(to: T[], from: ReadonlyArray<T> | undefined): T[] {
function insertStatementsAfterPrologue<T extends Statement>(to: T[], from: ReadonlyArray<T> | undefined, isPrologueDirective: (node: Node) => boolean): T[] {
if (from === undefined || from.length === 0) return to;
let statementIndex = 0;
// skip all prologue directives to insert at the correct position
@@ -417,6 +414,46 @@ namespace ts {
return to;
}
function insertStatementAfterPrologue<T extends Statement>(to: T[], statement: T | undefined, isPrologueDirective: (node: Node) => boolean): T[] {
if (statement === undefined) return to;
let statementIndex = 0;
// skip all prologue directives to insert at the correct position
for (; statementIndex < to.length; ++statementIndex) {
if (!isPrologueDirective(to[statementIndex])) {
break;
}
}
to.splice(statementIndex, 0, statement);
return to;
}
function isAnyPrologueDirective(node: Node) {
return isPrologueDirective(node) || !!(getEmitFlags(node) & EmitFlags.CustomPrologue);
}
/**
* Prepends statements to an array while taking care of prologue directives.
*/
export function insertStatementsAfterStandardPrologue<T extends Statement>(to: T[], from: ReadonlyArray<T> | undefined): T[] {
return insertStatementsAfterPrologue(to, from, isPrologueDirective);
}
export function insertStatementsAfterCustomPrologue<T extends Statement>(to: T[], from: ReadonlyArray<T> | undefined): T[] {
return insertStatementsAfterPrologue(to, from, isAnyPrologueDirective);
}
/**
* Prepends statements to an array while taking care of prologue directives.
*/
export function insertStatementAfterStandardPrologue<T extends Statement>(to: T[], statement: T | undefined): T[] {
return insertStatementAfterPrologue(to, statement, isPrologueDirective);
}
export function insertStatementAfterCustomPrologue<T extends Statement>(to: T[], statement: T | undefined): T[] {
return insertStatementAfterPrologue(to, statement, isAnyPrologueDirective);
}
/**
* Determine if the given comment is a triple-slash
*
@@ -1436,6 +1473,11 @@ namespace ts {
}
}
export function isSuperOrSuperProperty(node: Node): node is SuperExpression | SuperProperty {
return node.kind === SyntaxKind.SuperKeyword
|| isSuperProperty(node);
}
/**
* Determines whether a node is a property or element access expression for `super`.
*/
@@ -3418,8 +3460,8 @@ namespace ts {
return computeLineAndCharacterOfPosition(lineMap, pos).line;
}
export function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration | undefined {
return find(node.members, (member): member is ConstructorDeclaration => isConstructorDeclaration(member) && nodeIsPresent(member.body));
export function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration & { body: FunctionBody } | undefined {
return find(node.members, (member): member is ConstructorDeclaration & { body: FunctionBody } => isConstructorDeclaration(member) && nodeIsPresent(member.body));
}
function getSetAccessorValueParameter(accessor: SetAccessorDeclaration): ParameterDeclaration | undefined {
+2 -2
View File
@@ -1478,8 +1478,8 @@ namespace ts {
}
return isNodeArray(statements)
? setTextRange(createNodeArray(addStatementsAfterPrologue(statements.slice(), declarations)), statements)
: addStatementsAfterPrologue(statements, declarations);
? setTextRange(createNodeArray(insertStatementsAfterStandardPrologue(statements.slice(), declarations)), statements)
: insertStatementsAfterStandardPrologue(statements, declarations);
}
/**
@@ -11,4 +11,4 @@ var d = () => ((<Error>({ name: "foo", message: "bar" })));
var a = function () { return ({ name: "foo", message: "bar" }); };
var b = function () { return ({ name: "foo", message: "bar" }); };
var c = function () { return ({ name: "foo", message: "bar" }); };
var d = function () { return (({ name: "foo", message: "bar" })); };
var d = function () { return ({ name: "foo", message: "bar" }); };
@@ -11,4 +11,4 @@ var d = () => ((<Error>({ name: "foo", message: "bar" })));
var a = () => ({ name: "foo", message: "bar" });
var b = () => ({ name: "foo", message: "bar" });
var c = () => ({ name: "foo", message: "bar" });
var d = () => (({ name: "foo", message: "bar" }));
var d = () => ({ name: "foo", message: "bar" });
@@ -17,7 +17,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
};
var M;
(function (M) {
var _this = this;
var C = /** @class */ (function () {
function C() {
}
@@ -30,7 +30,6 @@ c.dynamic();
}
C.prototype.dynamic = function () {
var _a;
var _this = this;
return _a = this._path, __syncRequire ? Promise.resolve().then(function () { return require(_a); }) : new Promise(function (resolve_1, reject_1) { require([_a], resolve_1, reject_1); });
};
return C;
@@ -34,26 +34,44 @@ var C = /** @class */ (function () {
this.f = function () { return _newTarget; };
}
C.prototype[_newTarget] = function () { };
C.prototype.c = function () { var _newTarget = void 0; return _newTarget; };
C.prototype.c = function () {
var _newTarget = void 0;
return _newTarget;
};
Object.defineProperty(C.prototype, "d", {
get: function () { var _newTarget = void 0; return _newTarget; },
get: function () {
var _newTarget = void 0;
return _newTarget;
},
enumerable: true,
configurable: true
});
Object.defineProperty(C.prototype, "e", {
set: function (_) { var _newTarget = void 0; _ = _newTarget; },
set: function (_) {
var _newTarget = void 0;
_ = _newTarget;
},
enumerable: true,
configurable: true
});
C[_newTarget] = function () { };
C.g = function () { var _newTarget = void 0; return _newTarget; };
C.g = function () {
var _newTarget = void 0;
return _newTarget;
};
Object.defineProperty(C, "h", {
get: function () { var _newTarget = void 0; return _newTarget; },
get: function () {
var _newTarget = void 0;
return _newTarget;
},
enumerable: true,
configurable: true
});
Object.defineProperty(C, "i", {
set: function (_) { var _newTarget = void 0; _ = _newTarget; },
set: function (_) {
var _newTarget = void 0;
_ = _newTarget;
},
enumerable: true,
configurable: true
});
@@ -62,14 +80,23 @@ var C = /** @class */ (function () {
}());
var O = (_a = {},
_a[_newTarget] = undefined,
_a.k = function () { var _newTarget = void 0; return _newTarget; },
_a.k = function () {
var _newTarget = void 0;
return _newTarget;
},
Object.defineProperty(_a, "l", {
get: function () { var _newTarget = void 0; return _newTarget; },
get: function () {
var _newTarget = void 0;
return _newTarget;
},
enumerable: true,
configurable: true
}),
Object.defineProperty(_a, "m", {
set: function (_) { var _newTarget = void 0; _ = _newTarget; },
set: function (_) {
var _newTarget = void 0;
_ = _newTarget;
},
enumerable: true,
configurable: true
}),
+12 -3
View File
@@ -49,11 +49,17 @@ var __extends = (this && this.__extends) || (function () {
var A = /** @class */ (function () {
function A() {
var _newTarget = this.constructor;
this.d = function _a() { var _newTarget = this && this instanceof _a ? this.constructor : void 0; return _newTarget; };
this.d = function _a() {
var _newTarget = this && this instanceof _a ? this.constructor : void 0;
return _newTarget;
};
var a = _newTarget;
var b = function () { return _newTarget; };
}
A.c = function _a() { var _newTarget = this && this instanceof _a ? this.constructor : void 0; return _newTarget; };
A.c = function _a() {
var _newTarget = this && this instanceof _a ? this.constructor : void 0;
return _newTarget;
};
return A;
}());
var B = /** @class */ (function (_super) {
@@ -78,5 +84,8 @@ var f2 = function _b() {
var j = function () { return _newTarget; };
};
var O = {
k: function k() { var _newTarget = this && this instanceof k ? this.constructor : void 0; return _newTarget; }
k: function k() {
var _newTarget = this && this instanceof k ? this.constructor : void 0;
return _newTarget;
}
};
@@ -25,9 +25,9 @@ function f2(_: ReadonlyArray<number>): void {}
//// [noUnusedLocals_writeOnly.js]
"use strict";
function f(x, b) {
var _a, _b;
if (x === void 0) { x = 0; }
if (b === void 0) { b = false; }
var _a, _b;
// None of these statements read from 'x', so it will be marked unused.
x = 1;
x++;
@@ -17,9 +17,7 @@ let o = {
string; // should be => not :
// doesn't work in non-type contexts, where the return type is optional
var f = function (n) { return function (string) { return n.toString(); }; };
var o = {
m: function (n) { }
};
var o = {};
string;
{
return n.toString();
@@ -2,5 +2,4 @@
function f(p: A) => p;
//// [parserErrantEqualsGreaterThanAfterFunction2.js]
function f(p) { }
p;
@@ -123,8 +123,8 @@ var Bs = /** @class */ (function (_super) {
var Cs = /** @class */ (function (_super) {
__extends(Cs, _super);
function Cs() {
var _this = _super.call(this) || this;
"use strict";
var _this = _super.call(this) || this;
return _this;
}
Cs.s = 9;
@@ -12,16 +12,15 @@ class P {
}
//// [thisInConstructorParameter2.js]
var _this = this;
var P = /** @class */ (function () {
function P(z, zz, zzz) {
var _this = this;
if (z === void 0) { z = this; }
if (zz === void 0) { zz = this; }
if (zzz === void 0) { zzz = function (p) {
if (p === void 0) { p = _this; }
return _this;
}; }
var _this = this;
this.z = z;
this.x = this;
zzz = function (p) {
@@ -62,7 +62,6 @@ var __extends = (this && this.__extends) || (function () {
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var _this = this;
//'this' in static member initializer
var ErrClass1 = /** @class */ (function () {
function ErrClass1() {
@@ -63,7 +63,6 @@ var __extends = (this && this.__extends) || (function () {
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var _this = this;
//'this' in static member initializer
var ErrClass1 = /** @class */ (function () {
function ErrClass1() {
@@ -21,7 +21,6 @@ class Foo {
}
//// [thisInOuterClassBody.js]
var _this = this;
var Foo = /** @class */ (function () {
function Foo() {
this.x = this;
@@ -321,7 +321,6 @@ function modifiers() { return this.n; }
function restParam(...) { return this.n; }
function optional() { return this.n; }
function decorated() { return this.n; }
function initializer(, C) { }
();
number;
{
@@ -8,7 +8,6 @@ class C2<T> {
}
//// [typeOfThisInStaticMembers2.js]
var _this = this;
var C = /** @class */ (function () {
function C() {
}