fix(35050): Decorator emit incorrect within try block (#41951)

* fix(35050): fix decorated block-scoped class emit

* Only use internal name when targeting ES5/3

Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
This commit is contained in:
Oleksandr T
2021-07-08 10:48:02 -07:00
committed by GitHub
co-authored by Ron Buckton
parent e881a69939
commit a15030ff6f
13 changed files with 455 additions and 2 deletions
@@ -0,0 +1,16 @@
// @target: es5
// @experimentaldecorators: true
// @emitDecoratorMetadata: true
// @filename: a.ts
function decorator() {
return (target: new (...args: any[]) => any) => {}
}
@decorator()
class Foo {
public static func(): Foo {
return new Foo();
}
}
Foo.func();
@@ -0,0 +1,19 @@
// @target: es5
// @experimentaldecorators: true
// @emitDecoratorMetadata: true
// @filename: a.ts
function decorator() {
return (target: new (...args: any[]) => any) => {}
}
try {
@decorator()
class Foo {
public static func(): Foo {
return new Foo();
}
}
Foo.func();
}
catch (e) {}
@@ -0,0 +1,27 @@
// @target: es5
// @experimentaldecorators: true
// @emitDecoratorMetadata: true
// @filename: a.ts
function decorator() {
return (target: new (...args: any[]) => any) => {}
}
@decorator()
class Foo {
public static func(): Foo {
return new Foo();
}
}
Foo.func();
try {
@decorator()
class Foo {
public static func(): Foo {
return new Foo();
}
}
Foo.func();
}
catch (e) {}