File tree 1 file changed +13
-12
lines changed
1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -417,24 +417,25 @@ module ts {
417
417
}
418
418
break;
419
419
case SyntaxKind.Decorator:
420
- // Decorators are resolved at the class declaration as that point where they are evaluated in the emit:
420
+ // Decorators are resolved at the class declaration. Resolving at the parameter
421
+ // or member would result in looking up locals in the method.
421
422
//
422
423
// function y() {}
423
424
// class C {
424
- // method(@y x, y) {} // <-- All references to decorators should occur at the class declaration
425
+ // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter.
425
426
// }
426
427
//
427
- let parent = location.parent;
428
- if (parent && parent.kind === SyntaxKind.Parameter) {
429
- parent = parent.parent;
428
+ if (location.parent && location.parent.kind === SyntaxKind.Parameter) {
429
+ location = location.parent;
430
430
}
431
- if (parent && isClassElement(parent)) {
432
- parent = parent.parent;
433
- }
434
- if (parent) {
435
- lastLocation = location;
436
- location = parent;
437
- continue;
431
+ //
432
+ // function y() {}
433
+ // class C {
434
+ // @y method(x, y) {} // <-- decorator y should be resolved at the class declaration, not the method.
435
+ // }
436
+ //
437
+ if (location.parent && isClassElement(location.parent)) {
438
+ location = location.parent;
438
439
}
439
440
break;
440
441
}
You can’t perform that action at this time.
0 commit comments