diff --git a/tests/baselines/reference/commentOnDecoratedClassDeclaration.js b/tests/baselines/reference/commentOnDecoratedClassDeclaration.js new file mode 100644 index 00000000000..44a7047a2ac --- /dev/null +++ b/tests/baselines/reference/commentOnDecoratedClassDeclaration.js @@ -0,0 +1,47 @@ +//// [commentOnDecoratedClassDeclaration.ts] +declare function decorator(x: string): any; + +/** + * Leading trivia + */ +@decorator("hello") +class Remote { } + +/** + * Floating Comment + */ + +@decorator("hi") +class AnotherRomote { + constructor() {} +} + +//// [commentOnDecoratedClassDeclaration.js] +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; +}; +/** + * Leading trivia + */ +var Remote = (function () { + function Remote() { + } + return Remote; +}()); +Remote = __decorate([ + decorator("hello") +], Remote); +/** + * Floating Comment + */ +var AnotherRomote = (function () { + function AnotherRomote() { + } + return AnotherRomote; +}()); +AnotherRomote = __decorate([ + decorator("hi") +], AnotherRomote); diff --git a/tests/baselines/reference/commentOnDecoratedClassDeclaration.symbols b/tests/baselines/reference/commentOnDecoratedClassDeclaration.symbols new file mode 100644 index 00000000000..92a21ce23ba --- /dev/null +++ b/tests/baselines/reference/commentOnDecoratedClassDeclaration.symbols @@ -0,0 +1,26 @@ +=== tests/cases/compiler/commentOnDecoratedClassDeclaration.ts === +declare function decorator(x: string): any; +>decorator : Symbol(decorator, Decl(commentOnDecoratedClassDeclaration.ts, 0, 0)) +>x : Symbol(x, Decl(commentOnDecoratedClassDeclaration.ts, 0, 27)) + +/** + * Leading trivia + */ +@decorator("hello") +>decorator : Symbol(decorator, Decl(commentOnDecoratedClassDeclaration.ts, 0, 0)) + +class Remote { } +>Remote : Symbol(Remote, Decl(commentOnDecoratedClassDeclaration.ts, 0, 43)) + +/** + * Floating Comment + */ + +@decorator("hi") +>decorator : Symbol(decorator, Decl(commentOnDecoratedClassDeclaration.ts, 0, 0)) + +class AnotherRomote { +>AnotherRomote : Symbol(AnotherRomote, Decl(commentOnDecoratedClassDeclaration.ts, 6, 16)) + + constructor() {} +} diff --git a/tests/baselines/reference/commentOnDecoratedClassDeclaration.types b/tests/baselines/reference/commentOnDecoratedClassDeclaration.types new file mode 100644 index 00000000000..f4850a0b7b7 --- /dev/null +++ b/tests/baselines/reference/commentOnDecoratedClassDeclaration.types @@ -0,0 +1,30 @@ +=== tests/cases/compiler/commentOnDecoratedClassDeclaration.ts === +declare function decorator(x: string): any; +>decorator : (x: string) => any +>x : string + +/** + * Leading trivia + */ +@decorator("hello") +>decorator("hello") : any +>decorator : (x: string) => any +>"hello" : string + +class Remote { } +>Remote : Remote + +/** + * Floating Comment + */ + +@decorator("hi") +>decorator("hi") : any +>decorator : (x: string) => any +>"hi" : string + +class AnotherRomote { +>AnotherRomote : AnotherRomote + + constructor() {} +} diff --git a/tests/cases/compiler/commentOnDecoratedClassDeclaration.ts b/tests/cases/compiler/commentOnDecoratedClassDeclaration.ts new file mode 100644 index 00000000000..aadf63bf757 --- /dev/null +++ b/tests/cases/compiler/commentOnDecoratedClassDeclaration.ts @@ -0,0 +1,17 @@ +// @experimentalDecorators: true +declare function decorator(x: string): any; + +/** + * Leading trivia + */ +@decorator("hello") +class Remote { } + +/** + * Floating Comment + */ + +@decorator("hi") +class AnotherRomote { + constructor() {} +} \ No newline at end of file