Skip to content

Commit 7acc488

Browse files
committed
Removed Object.defineProperty for function name
1 parent 14362b0 commit 7acc488

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

src/compiler/emitter.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3898,6 +3898,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
38983898
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
38993899
scopeEmitEnd();
39003900

3901+
// TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now.
3902+
39013903
// For a decorated class, we need to assign its name (if it has one). This is because we emit
39023904
// the class as a class expression to avoid the double-binding of the identifier:
39033905
//
@@ -3907,15 +3909,6 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
39073909
//
39083910
if (thisNodeIsDecorated) {
39093911
write(";");
3910-
if (node.name) {
3911-
writeLine();
3912-
write("Object.defineProperty(");
3913-
emitDeclarationName(node);
3914-
write(", \"name\", { value: \"");
3915-
emitDeclarationName(node);
3916-
write("\", configurable: true });");
3917-
writeLine();
3918-
}
39193912
}
39203913

39213914
// Emit static property assignment. Because classDeclaration is lexically evaluated,

tests/baselines/reference/decoratedClassFromExternalModule.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
2121
function decorate() { }
2222
let Decorated = class {
2323
};
24-
Object.defineProperty(Decorated, "name", { value: "Decorated", configurable: true });
2524
Decorated = __decorate([
2625
decorate
2726
], Decorated);

0 commit comments

Comments
 (0)