Fix for #2619
This commit is contained in:
parent
189f07ae7f
commit
627c7f4211
|
@ -1136,8 +1136,8 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
|||
if (!computedPropertyNamesToGeneratedNames) {
|
||||
computedPropertyNamesToGeneratedNames = [];
|
||||
}
|
||||
|
||||
let generatedName = computedPropertyNamesToGeneratedNames[node.id];
|
||||
|
||||
let generatedName = computedPropertyNamesToGeneratedNames[getNodeId(node)];
|
||||
if (generatedName) {
|
||||
// we have already generated a variable for this node, write that value instead.
|
||||
write(generatedName);
|
||||
|
@ -1145,7 +1145,7 @@ var __param = this.__param || function(index, decorator) { return function (targ
|
|||
}
|
||||
|
||||
generatedName = createAndRecordTempVariable(TempFlags.Auto).text;
|
||||
computedPropertyNamesToGeneratedNames[node.id] = generatedName;
|
||||
computedPropertyNamesToGeneratedNames[getNodeId(node)] = generatedName;
|
||||
write(generatedName);
|
||||
write(" = ");
|
||||
}
|
||||
|
|
29
tests/baselines/reference/decoratorOnClassMethod11.js
Normal file
29
tests/baselines/reference/decoratorOnClassMethod11.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
//// [decoratorOnClassMethod11.ts]
|
||||
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec ["1"]() { }
|
||||
@dec ["b"]() { }
|
||||
}
|
||||
|
||||
//// [decoratorOnClassMethod11.js]
|
||||
var __decorate = this.__decorate || (typeof Reflect === "object" && Reflect.decorate) || function (decorators, target, key, desc) {
|
||||
switch (arguments.length) {
|
||||
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||||
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
|
||||
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
||||
}
|
||||
};
|
||||
class C {
|
||||
[_a = "1"]() { }
|
||||
[_b = "b"]() { }
|
||||
}
|
||||
Object.defineProperty(C.prototype, _a,
|
||||
__decorate([
|
||||
dec
|
||||
], C.prototype, _a, Object.getOwnPropertyDescriptor(C.prototype, _a)));
|
||||
Object.defineProperty(C.prototype, _b,
|
||||
__decorate([
|
||||
dec
|
||||
], C.prototype, _b, Object.getOwnPropertyDescriptor(C.prototype, _b)));
|
||||
var _a, _b;
|
21
tests/baselines/reference/decoratorOnClassMethod11.types
Normal file
21
tests/baselines/reference/decoratorOnClassMethod11.types
Normal file
|
@ -0,0 +1,21 @@
|
|||
=== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod11.ts ===
|
||||
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
||||
>dec : () => <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>target : any
|
||||
>propertyKey : string
|
||||
>descriptor : TypedPropertyDescriptor<T>
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
>TypedPropertyDescriptor : TypedPropertyDescriptor<T>
|
||||
>T : T
|
||||
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
@dec ["1"]() { }
|
||||
>dec : unknown
|
||||
|
||||
@dec ["b"]() { }
|
||||
>dec : unknown
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
// @target: ES6
|
||||
declare function dec(): <T>(target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
||||
|
||||
class C {
|
||||
@dec ["1"]() { }
|
||||
@dec ["b"]() { }
|
||||
}
|
Loading…
Reference in a new issue