| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| decoratorMetadataObjectLiteralMethodNoCrash.ts(4,7): error TS1206: Decorators are not valid here. | ||
| decoratorMetadataObjectLiteralMethodNoCrash.ts(13,15): error TS1206: Decorators are not valid here. | ||
| decoratorMetadataObjectLiteralMethodNoCrash.ts(14,19): error TS1206: Decorators are not valid here. | ||
|
|
||
|
|
||
| ==== decoratorMetadataObjectLiteralMethodNoCrash.ts (3 errors) ==== | ||
| declare function dec(...args: any[]): any; | ||
|
|
||
| const o = { | ||
| m(@dec x: string) {} | ||
| ~ | ||
| !!! error TS1206: Decorators are not valid here. | ||
| }; | ||
|
|
||
| class C { | ||
| @dec | ||
| prop!: number; | ||
|
|
||
| method() { | ||
| return { | ||
| m(@dec x: string) {}, | ||
| ~ | ||
| !!! error TS1206: Decorators are not valid here. | ||
| set s(@dec v: number) {} | ||
| ~ | ||
| !!! error TS1206: Decorators are not valid here. | ||
| }; | ||
| } | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| //// [tests/cases/compiler/decoratorMetadataObjectLiteralMethodNoCrash.ts] //// | ||
|
|
||
| //// [decoratorMetadataObjectLiteralMethodNoCrash.ts] | ||
| declare function dec(...args: any[]): any; | ||
|
|
||
| const o = { | ||
| m(@dec x: string) {} | ||
| }; | ||
|
|
||
| class C { | ||
| @dec | ||
| prop!: number; | ||
|
|
||
| method() { | ||
| return { | ||
| m(@dec x: string) {}, | ||
| set s(@dec v: number) {} | ||
| }; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| //// [decoratorMetadataObjectLiteralMethodNoCrash.js] | ||
| "use strict"; | ||
| var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
| var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
| if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
| else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
| return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
| }; | ||
| var __metadata = (this && this.__metadata) || function (k, v) { | ||
| if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
| }; | ||
| const o = { | ||
| m(x) { } | ||
| }; | ||
| class C { | ||
| prop; | ||
| method() { | ||
| return { | ||
| m(x) { }, | ||
| set s(v) { } | ||
| }; | ||
| } | ||
| } | ||
| __decorate([ | ||
| dec, | ||
| __metadata("design:type", Number) | ||
| ], C.prototype, "prop", void 0); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| //// [tests/cases/compiler/decoratorMetadataObjectLiteralMethodNoCrash.ts] //// | ||
|
|
||
| === decoratorMetadataObjectLiteralMethodNoCrash.ts === | ||
| declare function dec(...args: any[]): any; | ||
| >dec : Symbol(dec, Decl(decoratorMetadataObjectLiteralMethodNoCrash.ts, 0, 0)) | ||
| >args : Symbol(args, Decl(decoratorMetadataObjectLiteralMethodNoCrash.ts, 0, 21)) | ||
|
|
||
| const o = { | ||
| >o : Symbol(o, Decl(decoratorMetadataObjectLiteralMethodNoCrash.ts, 2, 5)) | ||
|
|
||
| m(@dec x: string) {} | ||
| >m : Symbol(m, Decl(decoratorMetadataObjectLiteralMethodNoCrash.ts, 2, 11)) | ||
| >dec : Symbol(dec, Decl(decoratorMetadataObjectLiteralMethodNoCrash.ts, 0, 0)) | ||
| >x : Symbol(x, Decl(decoratorMetadataObjectLiteralMethodNoCrash.ts, 3, 6)) | ||
|
|
||
| }; | ||
|
|
||
| class C { | ||
| >C : Symbol(C, Decl(decoratorMetadataObjectLiteralMethodNoCrash.ts, 4, 2)) | ||
|
|
||
| @dec | ||
| >dec : Symbol(dec, Decl(decoratorMetadataObjectLiteralMethodNoCrash.ts, 0, 0)) | ||
|
|
||
| prop!: number; | ||
| >prop : Symbol(C.prop, Decl(decoratorMetadataObjectLiteralMethodNoCrash.ts, 6, 9)) | ||
|
|
||
| method() { | ||
| >method : Symbol(C.method, Decl(decoratorMetadataObjectLiteralMethodNoCrash.ts, 8, 18)) | ||
|
|
||
| return { | ||
| m(@dec x: string) {}, | ||
| >m : Symbol(m, Decl(decoratorMetadataObjectLiteralMethodNoCrash.ts, 11, 16)) | ||
| >dec : Symbol(dec, Decl(decoratorMetadataObjectLiteralMethodNoCrash.ts, 0, 0)) | ||
| >x : Symbol(x, Decl(decoratorMetadataObjectLiteralMethodNoCrash.ts, 12, 14)) | ||
|
|
||
| set s(@dec v: number) {} | ||
| >s : Symbol(s, Decl(decoratorMetadataObjectLiteralMethodNoCrash.ts, 12, 33)) | ||
| >dec : Symbol(dec, Decl(decoratorMetadataObjectLiteralMethodNoCrash.ts, 0, 0)) | ||
| >v : Symbol(v, Decl(decoratorMetadataObjectLiteralMethodNoCrash.ts, 13, 18)) | ||
|
|
||
| }; | ||
| } | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| //// [tests/cases/compiler/decoratorMetadataObjectLiteralMethodNoCrash.ts] //// | ||
|
|
||
| === decoratorMetadataObjectLiteralMethodNoCrash.ts === | ||
| declare function dec(...args: any[]): any; | ||
| >dec : (...args: any[]) => any | ||
| >args : any[] | ||
|
|
||
| const o = { | ||
| >o : { m(x: string): void; } | ||
| >{ m(@dec x: string) {}} : { m(x: string): void; } | ||
|
|
||
| m(@dec x: string) {} | ||
| >m : (x: string) => void | ||
| >dec : (...args: any[]) => any | ||
| >x : string | ||
|
|
||
| }; | ||
|
|
||
| class C { | ||
| >C : C | ||
|
|
||
| @dec | ||
| >dec : (...args: any[]) => any | ||
|
|
||
| prop!: number; | ||
| >prop : number | ||
|
|
||
| method() { | ||
| >method : () => { m(x: string): void; s: number; } | ||
|
|
||
| return { | ||
| >{ m(@dec x: string) {}, set s(@dec v: number) {} } : { m(x: string): void; s: number; } | ||
|
|
||
| m(@dec x: string) {}, | ||
| >m : (x: string) => void | ||
| >dec : (...args: any[]) => any | ||
| >x : string | ||
|
|
||
| set s(@dec v: number) {} | ||
| >s : number | ||
| >dec : (...args: any[]) => any | ||
| >v : number | ||
|
|
||
| }; | ||
| } | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // @experimentalDecorators: true | ||
| // @emitDecoratorMetadata: true | ||
|
Comment thread
Andarist marked this conversation as resolved.
|
||
|
|
||
| declare function dec(...args: any[]): any; | ||
|
|
||
| const o = { | ||
| m(@dec x: string) {} | ||
| }; | ||
|
|
||
| class C { | ||
| @dec | ||
| prop!: number; | ||
|
|
||
| method() { | ||
| return { | ||
| m(@dec x: string) {}, | ||
| set s(@dec v: number) {} | ||
| }; | ||
| } | ||
| } | ||
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThe fix here matches Strada conceptually. Strada passed down parent (also in the case of object literal expressions). This patch just reuses the neighboring pattern (the same thing as in visitClassExpression) for doing the equivalent here in Corsa
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.