mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
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:
co-authored by
Ron Buckton
parent
e881a69939
commit
a15030ff6f
@@ -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) {}
|
||||
Reference in New Issue
Block a user