Skip to content

Commit b2f2610

Browse files
authored
Use getInternalName not getLocalName (microsoft#20168)
1 parent 16a882e commit b2f2610

5 files changed

Lines changed: 83 additions & 1 deletion

File tree

src/compiler/transformers/es2015.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ namespace ts {
859859
statements.push(
860860
setTextRange(
861861
createStatement(
862-
createExtendsHelper(context, getLocalName(node))
862+
createExtendsHelper(context, getInternalName(node))
863863
),
864864
/*location*/ extendsClauseElement
865865
)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//// [classExtensionNameOutput.ts]
2+
class A {}
3+
if (true) {
4+
class B extends A {}
5+
6+
const foo = function () {
7+
new B();
8+
}
9+
}
10+
11+
//// [classExtensionNameOutput.js]
12+
var __extends = (this && this.__extends) || (function () {
13+
var extendStatics = Object.setPrototypeOf ||
14+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
15+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
16+
return function (d, b) {
17+
extendStatics(d, b);
18+
function __() { this.constructor = d; }
19+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
20+
};
21+
})();
22+
var A = /** @class */ (function () {
23+
function A() {
24+
}
25+
return A;
26+
}());
27+
if (true) {
28+
var B_1 = /** @class */ (function (_super) {
29+
__extends(B, _super);
30+
function B() {
31+
return _super !== null && _super.apply(this, arguments) || this;
32+
}
33+
return B;
34+
}(A));
35+
var foo = function () {
36+
new B_1();
37+
};
38+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
=== tests/cases/compiler/classExtensionNameOutput.ts ===
2+
class A {}
3+
>A : Symbol(A, Decl(classExtensionNameOutput.ts, 0, 0))
4+
5+
if (true) {
6+
class B extends A {}
7+
>B : Symbol(B, Decl(classExtensionNameOutput.ts, 1, 11))
8+
>A : Symbol(A, Decl(classExtensionNameOutput.ts, 0, 0))
9+
10+
const foo = function () {
11+
>foo : Symbol(foo, Decl(classExtensionNameOutput.ts, 4, 7))
12+
13+
new B();
14+
>B : Symbol(B, Decl(classExtensionNameOutput.ts, 1, 11))
15+
}
16+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
=== tests/cases/compiler/classExtensionNameOutput.ts ===
2+
class A {}
3+
>A : A
4+
5+
if (true) {
6+
>true : true
7+
8+
class B extends A {}
9+
>B : B
10+
>A : A
11+
12+
const foo = function () {
13+
>foo : () => void
14+
>function () { new B(); } : () => void
15+
16+
new B();
17+
>new B() : B
18+
>B : typeof B
19+
}
20+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class A {}
2+
if (true) {
3+
class B extends A {}
4+
5+
const foo = function () {
6+
new B();
7+
}
8+
}

0 commit comments

Comments
 (0)