mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 21:36:50 -05:00
Merge pull request #22886 from Microsoft/Fix22866
Fix #22866: Condition checking for name collision of generated variable names on emit happening
This commit is contained in:
@@ -21952,7 +21952,7 @@ namespace ts {
|
||||
|
||||
function checkCollisionWithArgumentsInGeneratedCode(node: SignatureDeclaration) {
|
||||
// no rest parameters \ declaration context \ overload - no codegen impact
|
||||
if (!hasRestParameter(node) || node.flags & NodeFlags.Ambient || nodeIsMissing((<FunctionLikeDeclaration>node).body)) {
|
||||
if (languageVersion >= ScriptTarget.ES2015 || compilerOptions.noEmit || !hasRestParameter(node) || node.flags & NodeFlags.Ambient || nodeIsMissing((<FunctionLikeDeclaration>node).body)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -21993,13 +21993,13 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkCollisionWithCapturedThisVariable(node: Node, name: Identifier): void {
|
||||
if (needCollisionCheckForIdentifier(node, name, "_this")) {
|
||||
if (languageVersion <= ScriptTarget.ES5 && !compilerOptions.noEmit && needCollisionCheckForIdentifier(node, name, "_this")) {
|
||||
potentialThisCollisions.push(node);
|
||||
}
|
||||
}
|
||||
|
||||
function checkCollisionWithCapturedNewTargetVariable(node: Node, name: Identifier): void {
|
||||
if (needCollisionCheckForIdentifier(node, name, "_newTarget")) {
|
||||
if (languageVersion <= ScriptTarget.ES5 && !compilerOptions.noEmit && needCollisionCheckForIdentifier(node, name, "_newTarget")) {
|
||||
potentialNewTargetCollisions.push(node);
|
||||
}
|
||||
}
|
||||
@@ -22036,6 +22036,10 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkCollisionWithCapturedSuperVariable(node: Node, name: Identifier) {
|
||||
if (languageVersion >= ScriptTarget.ES2015 || compilerOptions.noEmit) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!needCollisionCheckForIdentifier(node, name, "_super")) {
|
||||
return;
|
||||
}
|
||||
@@ -22060,7 +22064,7 @@ namespace ts {
|
||||
|
||||
function checkCollisionWithRequireExportsInGeneratedCode(node: Node, name: Identifier) {
|
||||
// No need to check for require or exports for ES6 modules and later
|
||||
if (modulekind >= ModuleKind.ES2015) {
|
||||
if (modulekind >= ModuleKind.ES2015 || compilerOptions.noEmit) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -22083,7 +22087,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkCollisionWithGlobalPromiseInGeneratedCode(node: Node, name: Identifier): void {
|
||||
if (languageVersion >= ScriptTarget.ES2017 || !needCollisionCheckForIdentifier(node, name, "Promise")) {
|
||||
if (languageVersion >= ScriptTarget.ES2017 || compilerOptions.noEmit || !needCollisionCheckForIdentifier(node, name, "Promise")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user