-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13540 from Microsoft/metadataReferences
Mark as referenced aliases in Union that will get emitted as part of decorator metadata
- Loading branch information
Showing
12 changed files
with
326 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
//// [tests/cases/compiler/metadataOfClassFromAlias.ts] //// | ||
|
||
//// [auxiliry.ts] | ||
export class SomeClass { | ||
field: string; | ||
} | ||
|
||
//// [test.ts] | ||
import { SomeClass } from './auxiliry'; | ||
function annotation(): PropertyDecorator { | ||
return (target: any): void => { }; | ||
} | ||
export class ClassA { | ||
@annotation() array: SomeClass | null; | ||
} | ||
|
||
//// [auxiliry.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var SomeClass = (function () { | ||
function SomeClass() { | ||
} | ||
return SomeClass; | ||
}()); | ||
exports.SomeClass = SomeClass; | ||
//// [test.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); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function annotation() { | ||
return function (target) { }; | ||
} | ||
var ClassA = (function () { | ||
function ClassA() { | ||
} | ||
return ClassA; | ||
}()); | ||
__decorate([ | ||
annotation(), | ||
__metadata("design:type", Object) | ||
], ClassA.prototype, "array", void 0); | ||
exports.ClassA = ClassA; |
27 changes: 27 additions & 0 deletions
27
tests/baselines/reference/metadataOfClassFromAlias.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
=== tests/cases/compiler/auxiliry.ts === | ||
export class SomeClass { | ||
>SomeClass : Symbol(SomeClass, Decl(auxiliry.ts, 0, 0)) | ||
|
||
field: string; | ||
>field : Symbol(SomeClass.field, Decl(auxiliry.ts, 0, 24)) | ||
} | ||
|
||
=== tests/cases/compiler/test.ts === | ||
import { SomeClass } from './auxiliry'; | ||
>SomeClass : Symbol(SomeClass, Decl(test.ts, 0, 8)) | ||
|
||
function annotation(): PropertyDecorator { | ||
>annotation : Symbol(annotation, Decl(test.ts, 0, 39)) | ||
>PropertyDecorator : Symbol(PropertyDecorator, Decl(lib.d.ts, --, --)) | ||
|
||
return (target: any): void => { }; | ||
>target : Symbol(target, Decl(test.ts, 2, 12)) | ||
} | ||
export class ClassA { | ||
>ClassA : Symbol(ClassA, Decl(test.ts, 3, 1)) | ||
|
||
@annotation() array: SomeClass | null; | ||
>annotation : Symbol(annotation, Decl(test.ts, 0, 39)) | ||
>array : Symbol(ClassA.array, Decl(test.ts, 4, 21)) | ||
>SomeClass : Symbol(SomeClass, Decl(test.ts, 0, 8)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
=== tests/cases/compiler/auxiliry.ts === | ||
export class SomeClass { | ||
>SomeClass : SomeClass | ||
|
||
field: string; | ||
>field : string | ||
} | ||
|
||
=== tests/cases/compiler/test.ts === | ||
import { SomeClass } from './auxiliry'; | ||
>SomeClass : typeof SomeClass | ||
|
||
function annotation(): PropertyDecorator { | ||
>annotation : () => PropertyDecorator | ||
>PropertyDecorator : PropertyDecorator | ||
|
||
return (target: any): void => { }; | ||
>(target: any): void => { } : (target: any) => void | ||
>target : any | ||
} | ||
export class ClassA { | ||
>ClassA : ClassA | ||
|
||
@annotation() array: SomeClass | null; | ||
>annotation() : PropertyDecorator | ||
>annotation : () => PropertyDecorator | ||
>array : SomeClass | ||
>SomeClass : SomeClass | ||
>null : null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
//// [tests/cases/compiler/metadataOfClassFromAlias2.ts] //// | ||
|
||
//// [auxiliry.ts] | ||
export class SomeClass { | ||
field: string; | ||
} | ||
|
||
//// [test.ts] | ||
import { SomeClass } from './auxiliry'; | ||
function annotation(): PropertyDecorator { | ||
return (target: any): void => { }; | ||
} | ||
export class ClassA { | ||
@annotation() array: SomeClass | null | string; | ||
} | ||
|
||
//// [auxiliry.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var SomeClass = (function () { | ||
function SomeClass() { | ||
} | ||
return SomeClass; | ||
}()); | ||
exports.SomeClass = SomeClass; | ||
//// [test.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); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function annotation() { | ||
return function (target) { }; | ||
} | ||
var ClassA = (function () { | ||
function ClassA() { | ||
} | ||
return ClassA; | ||
}()); | ||
__decorate([ | ||
annotation(), | ||
__metadata("design:type", Object) | ||
], ClassA.prototype, "array", void 0); | ||
exports.ClassA = ClassA; |
27 changes: 27 additions & 0 deletions
27
tests/baselines/reference/metadataOfClassFromAlias2.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
=== tests/cases/compiler/auxiliry.ts === | ||
export class SomeClass { | ||
>SomeClass : Symbol(SomeClass, Decl(auxiliry.ts, 0, 0)) | ||
|
||
field: string; | ||
>field : Symbol(SomeClass.field, Decl(auxiliry.ts, 0, 24)) | ||
} | ||
|
||
=== tests/cases/compiler/test.ts === | ||
import { SomeClass } from './auxiliry'; | ||
>SomeClass : Symbol(SomeClass, Decl(test.ts, 0, 8)) | ||
|
||
function annotation(): PropertyDecorator { | ||
>annotation : Symbol(annotation, Decl(test.ts, 0, 39)) | ||
>PropertyDecorator : Symbol(PropertyDecorator, Decl(lib.d.ts, --, --)) | ||
|
||
return (target: any): void => { }; | ||
>target : Symbol(target, Decl(test.ts, 2, 12)) | ||
} | ||
export class ClassA { | ||
>ClassA : Symbol(ClassA, Decl(test.ts, 3, 1)) | ||
|
||
@annotation() array: SomeClass | null | string; | ||
>annotation : Symbol(annotation, Decl(test.ts, 0, 39)) | ||
>array : Symbol(ClassA.array, Decl(test.ts, 4, 21)) | ||
>SomeClass : Symbol(SomeClass, Decl(test.ts, 0, 8)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
=== tests/cases/compiler/auxiliry.ts === | ||
export class SomeClass { | ||
>SomeClass : SomeClass | ||
|
||
field: string; | ||
>field : string | ||
} | ||
|
||
=== tests/cases/compiler/test.ts === | ||
import { SomeClass } from './auxiliry'; | ||
>SomeClass : typeof SomeClass | ||
|
||
function annotation(): PropertyDecorator { | ||
>annotation : () => PropertyDecorator | ||
>PropertyDecorator : PropertyDecorator | ||
|
||
return (target: any): void => { }; | ||
>(target: any): void => { } : (target: any) => void | ||
>target : any | ||
} | ||
export class ClassA { | ||
>ClassA : ClassA | ||
|
||
@annotation() array: SomeClass | null | string; | ||
>annotation() : PropertyDecorator | ||
>annotation : () => PropertyDecorator | ||
>array : string | SomeClass | ||
>SomeClass : SomeClass | ||
>null : null | ||
} |
Oops, something went wrong.