Skip to content
Merged
309 changes: 295 additions & 14 deletions src/compiler/checker.ts

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ module ts {
shortName: "w",
type: "boolean",
description: Diagnostics.Watch_input_files,
},
{
name: "emitDecoratorMetadata",
type: "boolean",
experimental: true
}
];

Expand Down
414 changes: 272 additions & 142 deletions src/compiler/emitter.ts

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,9 @@ module ts {
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
resolvesToSomeValue(location: Node, name: string): boolean;
getBlockScopedVariableId(node: Identifier): number;
serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[];
serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
}

export const enum SymbolFlags {
Expand Down Expand Up @@ -1380,6 +1383,7 @@ module ts {
EnumValuesComputed = 0x00000080,
BlockScopedBindingInLoop = 0x00000100,
EmitDecorate = 0x00000200, // Emit __decorate
EmitParam = 0x00000400, // Emit __param helper for decorators
}

export interface NodeLinks {
Expand Down Expand Up @@ -1605,6 +1609,7 @@ module ts {
version?: boolean;
watch?: boolean;
separateCompilation?: boolean;
emitDecoratorMetadata?: boolean;
/* @internal */ stripInternal?: boolean;
[option: string]: string | number | boolean;
}
Expand Down
12 changes: 12 additions & 0 deletions src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,18 @@ module ts {
return false;
}

export function isAccessor(node: Node): boolean {
if (node) {
switch (node.kind) {
case SyntaxKind.GetAccessor:
case SyntaxKind.SetAccessor:
return true;
}
}

return false;
}

export function isFunctionLike(node: Node): boolean {
if (node) {
switch (node.kind) {
Expand Down
36 changes: 18 additions & 18 deletions src/lib/es6.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3513,27 +3513,27 @@ interface ProxyHandler<T> {

interface ProxyConstructor {
revocable<T>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
new <T>(target: T, handeler: ProxyHandler<T>): T
new <T>(target: T, handler: ProxyHandler<T>): T
}
declare var Proxy: ProxyConstructor;

declare var Reflect: {
apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
construct(target: Function, argumentsList: ArrayLike<any>): any;
defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
deleteProperty(target: any, propertyKey: PropertyKey): boolean;
enumerate(target: any): IterableIterator<any>;
get(target: any, propertyKey: PropertyKey, receiver?: any): any;
getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
getPrototypeOf(target: any): any;
has(target: any, propertyKey: string): boolean;
has(target: any, propertyKey: symbol): boolean;
isExtensible(target: any): boolean;
ownKeys(target: any): Array<PropertyKey>;
preventExtensions(target: any): boolean;
set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean;
setPrototypeOf(target: any, proto: any): boolean;
};
declare module Reflect {
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
function construct(target: Function, argumentsList: ArrayLike<any>): any;
function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
function deleteProperty(target: any, propertyKey: PropertyKey): boolean;
function enumerate(target: any): IterableIterator<any>;
function get(target: any, propertyKey: PropertyKey, receiver?: any): any;
function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
function getPrototypeOf(target: any): any;
function has(target: any, propertyKey: string): boolean;
function has(target: any, propertyKey: symbol): boolean;
function isExtensible(target: any): boolean;
function ownKeys(target: any): Array<PropertyKey>;
function preventExtensions(target: any): boolean;
function set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean;
function setPrototypeOf(target: any, proto: any): boolean;
}

/**
* Represents the completion of an asynchronous operation
Expand Down
5 changes: 5 additions & 0 deletions tests/baselines/reference/APISample_compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,9 @@ declare module "typescript" {
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
resolvesToSomeValue(location: Node, name: string): boolean;
getBlockScopedVariableId(node: Identifier): number;
serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[];
serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
}
const enum SymbolFlags {
FunctionScopedVariable = 1,
Expand Down Expand Up @@ -1084,6 +1087,7 @@ declare module "typescript" {
EnumValuesComputed = 128,
BlockScopedBindingInLoop = 256,
EmitDecorate = 512,
EmitParam = 1024,
}
interface NodeLinks {
resolvedType?: Type;
Expand Down Expand Up @@ -1256,6 +1260,7 @@ declare module "typescript" {
version?: boolean;
watch?: boolean;
separateCompilation?: boolean;
emitDecoratorMetadata?: boolean;
[option: string]: string | number | boolean;
}
const enum ModuleKind {
Expand Down
30 changes: 30 additions & 0 deletions tests/baselines/reference/APISample_compile.types
Original file line number Diff line number Diff line change
Expand Up @@ -3188,6 +3188,30 @@ declare module "typescript" {
>getBlockScopedVariableId : (node: Identifier) => number
>node : Identifier
>Identifier : Identifier

serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
>serializeTypeOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => string | string[]
>node : Node
>Node : Node
>getGeneratedNameForNode : (Node: Node) => string
>Node : Node
>Node : Node

serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[];
>serializeParameterTypesOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => (string | string[])[]
>node : Node
>Node : Node
>getGeneratedNameForNode : (Node: Node) => string
>Node : Node
>Node : Node

serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
>serializeReturnTypeOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => string | string[]
>node : Node
>Node : Node
>getGeneratedNameForNode : (Node: Node) => string
>Node : Node
>Node : Node
}
const enum SymbolFlags {
>SymbolFlags : SymbolFlags
Expand Down Expand Up @@ -3504,6 +3528,9 @@ declare module "typescript" {

EmitDecorate = 512,
>EmitDecorate : NodeCheckFlags

EmitParam = 1024,
>EmitParam : NodeCheckFlags
}
interface NodeLinks {
>NodeLinks : NodeLinks
Expand Down Expand Up @@ -4019,6 +4046,9 @@ declare module "typescript" {
separateCompilation?: boolean;
>separateCompilation : boolean

emitDecoratorMetadata?: boolean;
>emitDecoratorMetadata : boolean

[option: string]: string | number | boolean;
>option : string
}
Expand Down
5 changes: 5 additions & 0 deletions tests/baselines/reference/APISample_linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,9 @@ declare module "typescript" {
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
resolvesToSomeValue(location: Node, name: string): boolean;
getBlockScopedVariableId(node: Identifier): number;
serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[];
serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
}
const enum SymbolFlags {
FunctionScopedVariable = 1,
Expand Down Expand Up @@ -1115,6 +1118,7 @@ declare module "typescript" {
EnumValuesComputed = 128,
BlockScopedBindingInLoop = 256,
EmitDecorate = 512,
EmitParam = 1024,
}
interface NodeLinks {
resolvedType?: Type;
Expand Down Expand Up @@ -1287,6 +1291,7 @@ declare module "typescript" {
version?: boolean;
watch?: boolean;
separateCompilation?: boolean;
emitDecoratorMetadata?: boolean;
[option: string]: string | number | boolean;
}
const enum ModuleKind {
Expand Down
30 changes: 30 additions & 0 deletions tests/baselines/reference/APISample_linter.types
Original file line number Diff line number Diff line change
Expand Up @@ -3334,6 +3334,30 @@ declare module "typescript" {
>getBlockScopedVariableId : (node: Identifier) => number
>node : Identifier
>Identifier : Identifier

serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
>serializeTypeOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => string | string[]
>node : Node
>Node : Node
>getGeneratedNameForNode : (Node: Node) => string
>Node : Node
>Node : Node

serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[];
>serializeParameterTypesOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => (string | string[])[]
>node : Node
>Node : Node
>getGeneratedNameForNode : (Node: Node) => string
>Node : Node
>Node : Node

serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
>serializeReturnTypeOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => string | string[]
>node : Node
>Node : Node
>getGeneratedNameForNode : (Node: Node) => string
>Node : Node
>Node : Node
}
const enum SymbolFlags {
>SymbolFlags : SymbolFlags
Expand Down Expand Up @@ -3650,6 +3674,9 @@ declare module "typescript" {

EmitDecorate = 512,
>EmitDecorate : NodeCheckFlags

EmitParam = 1024,
>EmitParam : NodeCheckFlags
}
interface NodeLinks {
>NodeLinks : NodeLinks
Expand Down Expand Up @@ -4165,6 +4192,9 @@ declare module "typescript" {
separateCompilation?: boolean;
>separateCompilation : boolean

emitDecoratorMetadata?: boolean;
>emitDecoratorMetadata : boolean

[option: string]: string | number | boolean;
>option : string
}
Expand Down
30 changes: 30 additions & 0 deletions tests/baselines/reference/APISample_linter.types.pull
Original file line number Diff line number Diff line change
Expand Up @@ -3334,6 +3334,30 @@ declare module "typescript" {
>getBlockScopedVariableId : (node: Identifier) => number
>node : Identifier
>Identifier : Identifier

serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
>serializeTypeOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => string | string[]
>node : Node
>Node : Node
>getGeneratedNameForNode : (Node: Node) => string
>Node : Node
>Node : Node

serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[];
>serializeParameterTypesOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => (string | string[])[]
>node : Node
>Node : Node
>getGeneratedNameForNode : (Node: Node) => string
>Node : Node
>Node : Node

serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
>serializeReturnTypeOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => string | string[]
>node : Node
>Node : Node
>getGeneratedNameForNode : (Node: Node) => string
>Node : Node
>Node : Node
}
const enum SymbolFlags {
>SymbolFlags : SymbolFlags
Expand Down Expand Up @@ -3650,6 +3674,9 @@ declare module "typescript" {

EmitDecorate = 512,
>EmitDecorate : NodeCheckFlags

EmitParam = 1024,
>EmitParam : NodeCheckFlags
}
interface NodeLinks {
>NodeLinks : NodeLinks
Expand Down Expand Up @@ -4165,6 +4192,9 @@ declare module "typescript" {
separateCompilation?: boolean;
>separateCompilation : boolean

emitDecoratorMetadata?: boolean;
>emitDecoratorMetadata : boolean

[option: string]: string | number | boolean;
>option : string
}
Expand Down
5 changes: 5 additions & 0 deletions tests/baselines/reference/APISample_transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,9 @@ declare module "typescript" {
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
resolvesToSomeValue(location: Node, name: string): boolean;
getBlockScopedVariableId(node: Identifier): number;
serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[];
serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
}
const enum SymbolFlags {
FunctionScopedVariable = 1,
Expand Down Expand Up @@ -1116,6 +1119,7 @@ declare module "typescript" {
EnumValuesComputed = 128,
BlockScopedBindingInLoop = 256,
EmitDecorate = 512,
EmitParam = 1024,
}
interface NodeLinks {
resolvedType?: Type;
Expand Down Expand Up @@ -1288,6 +1292,7 @@ declare module "typescript" {
version?: boolean;
watch?: boolean;
separateCompilation?: boolean;
emitDecoratorMetadata?: boolean;
[option: string]: string | number | boolean;
}
const enum ModuleKind {
Expand Down
30 changes: 30 additions & 0 deletions tests/baselines/reference/APISample_transform.types
Original file line number Diff line number Diff line change
Expand Up @@ -3284,6 +3284,30 @@ declare module "typescript" {
>getBlockScopedVariableId : (node: Identifier) => number
>node : Identifier
>Identifier : Identifier

serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
>serializeTypeOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => string | string[]
>node : Node
>Node : Node
>getGeneratedNameForNode : (Node: Node) => string
>Node : Node
>Node : Node

serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[];
>serializeParameterTypesOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => (string | string[])[]
>node : Node
>Node : Node
>getGeneratedNameForNode : (Node: Node) => string
>Node : Node
>Node : Node

serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
>serializeReturnTypeOfNode : (node: Node, getGeneratedNameForNode: (Node: Node) => string) => string | string[]
>node : Node
>Node : Node
>getGeneratedNameForNode : (Node: Node) => string
>Node : Node
>Node : Node
}
const enum SymbolFlags {
>SymbolFlags : SymbolFlags
Expand Down Expand Up @@ -3600,6 +3624,9 @@ declare module "typescript" {

EmitDecorate = 512,
>EmitDecorate : NodeCheckFlags

EmitParam = 1024,
>EmitParam : NodeCheckFlags
}
interface NodeLinks {
>NodeLinks : NodeLinks
Expand Down Expand Up @@ -4115,6 +4142,9 @@ declare module "typescript" {
separateCompilation?: boolean;
>separateCompilation : boolean

emitDecoratorMetadata?: boolean;
>emitDecoratorMetadata : boolean

[option: string]: string | number | boolean;
>option : string
}
Expand Down
Loading