Skip to content

Commit 29fe9f5

Browse files
committed
Merge branch 'master' into APISamples
Conflicts: tests/baselines/reference/APISample_compile.js tests/baselines/reference/APISample_compile.types tests/baselines/reference/APISample_linter.js tests/baselines/reference/APISample_linter.types tests/baselines/reference/APISample_transform.js tests/baselines/reference/APISample_transform.types tests/baselines/reference/APISample_watcher.js tests/baselines/reference/APISample_watcher.types
2 parents facbe84 + e195d89 commit 29fe9f5

File tree

102 files changed

+2580
-8718
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+2580
-8718
lines changed

src/compiler/checker.ts

Lines changed: 305 additions & 15 deletions
Large diffs are not rendered by default.

src/compiler/commandLineParser.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ module ts {
156156
shortName: "w",
157157
type: "boolean",
158158
description: Diagnostics.Watch_input_files,
159+
},
160+
{
161+
name: "emitDecoratorMetadata",
162+
type: "boolean",
163+
experimental: true
159164
}
160165
];
161166

src/compiler/diagnosticInformationMap.generated.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ module ts {
167167
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." },
168168
Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." },
169169
Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." },
170-
A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1210, category: DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" },
170+
Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: DiagnosticCategory.Error, key: "Invalid use of '{0}'. Class definitions are automatically in strict mode." },
171+
A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" },
171172
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
172173
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
173174
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },

src/compiler/diagnosticMessages.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,9 +659,13 @@
659659
"category": "Error",
660660
"code": 1209
661661
},
662+
"Invalid use of '{0}'. Class definitions are automatically in strict mode.": {
663+
"category": "Error",
664+
"code": 1210
665+
},
662666
"A class declaration without the 'default' modifier must have a name": {
663667
"category": "Error",
664-
"code": 1210
668+
"code": 1211
665669
},
666670
"Duplicate identifier '{0}'.": {
667671
"category": "Error",

src/compiler/emitter.ts

Lines changed: 365 additions & 172 deletions
Large diffs are not rendered by default.

src/compiler/parser.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4756,9 +4756,7 @@ module ts {
47564756
function parseClassDeclarationOrExpression(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, kind: SyntaxKind): ClassLikeDeclaration {
47574757
// In ES6 specification, All parts of a ClassDeclaration or a ClassExpression are strict mode code
47584758
let savedStrictModeContext = inStrictModeContext();
4759-
if (languageVersion >= ScriptTarget.ES6) {
4760-
setStrictModeContext(true);
4761-
}
4759+
setStrictModeContext(true);
47624760

47634761
var node = <ClassLikeDeclaration>createNode(kind, fullStart);
47644762
node.decorators = decorators;

src/compiler/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,6 +1255,9 @@ module ts {
12551255
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
12561256
resolvesToSomeValue(location: Node, name: string): boolean;
12571257
getBlockScopedVariableId(node: Identifier): number;
1258+
serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
1259+
serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[];
1260+
serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
12581261
}
12591262

12601263
export const enum SymbolFlags {
@@ -1380,6 +1383,7 @@ module ts {
13801383
EnumValuesComputed = 0x00000080,
13811384
BlockScopedBindingInLoop = 0x00000100,
13821385
EmitDecorate = 0x00000200, // Emit __decorate
1386+
EmitParam = 0x00000400, // Emit __param helper for decorators
13831387
}
13841388

13851389
export interface NodeLinks {
@@ -1605,6 +1609,7 @@ module ts {
16051609
version?: boolean;
16061610
watch?: boolean;
16071611
separateCompilation?: boolean;
1612+
emitDecoratorMetadata?: boolean;
16081613
/* @internal */ stripInternal?: boolean;
16091614
[option: string]: string | number | boolean;
16101615
}

src/compiler/utilities.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,18 @@ module ts {
449449
return false;
450450
}
451451

452+
export function isAccessor(node: Node): boolean {
453+
if (node) {
454+
switch (node.kind) {
455+
case SyntaxKind.GetAccessor:
456+
case SyntaxKind.SetAccessor:
457+
return true;
458+
}
459+
}
460+
461+
return false;
462+
}
463+
452464
export function isFunctionLike(node: Node): boolean {
453465
if (node) {
454466
switch (node.kind) {

src/lib/core.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,4 +1168,4 @@ interface TypedPropertyDescriptor<T> {
11681168
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
11691169
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
11701170
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
1171-
declare type ParameterDecorator = (target: Function, propertyKey: string | symbol, parameterIndex: number) => void;
1171+
declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;

src/lib/es6.d.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3513,27 +3513,27 @@ interface ProxyHandler<T> {
35133513

35143514
interface ProxyConstructor {
35153515
revocable<T>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
3516-
new <T>(target: T, handeler: ProxyHandler<T>): T
3516+
new <T>(target: T, handler: ProxyHandler<T>): T
35173517
}
35183518
declare var Proxy: ProxyConstructor;
35193519

3520-
declare var Reflect: {
3521-
apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
3522-
construct(target: Function, argumentsList: ArrayLike<any>): any;
3523-
defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
3524-
deleteProperty(target: any, propertyKey: PropertyKey): boolean;
3525-
enumerate(target: any): IterableIterator<any>;
3526-
get(target: any, propertyKey: PropertyKey, receiver?: any): any;
3527-
getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
3528-
getPrototypeOf(target: any): any;
3529-
has(target: any, propertyKey: string): boolean;
3530-
has(target: any, propertyKey: symbol): boolean;
3531-
isExtensible(target: any): boolean;
3532-
ownKeys(target: any): Array<PropertyKey>;
3533-
preventExtensions(target: any): boolean;
3534-
set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean;
3535-
setPrototypeOf(target: any, proto: any): boolean;
3536-
};
3520+
declare module Reflect {
3521+
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
3522+
function construct(target: Function, argumentsList: ArrayLike<any>): any;
3523+
function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
3524+
function deleteProperty(target: any, propertyKey: PropertyKey): boolean;
3525+
function enumerate(target: any): IterableIterator<any>;
3526+
function get(target: any, propertyKey: PropertyKey, receiver?: any): any;
3527+
function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
3528+
function getPrototypeOf(target: any): any;
3529+
function has(target: any, propertyKey: string): boolean;
3530+
function has(target: any, propertyKey: symbol): boolean;
3531+
function isExtensible(target: any): boolean;
3532+
function ownKeys(target: any): Array<PropertyKey>;
3533+
function preventExtensions(target: any): boolean;
3534+
function set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean;
3535+
function setPrototypeOf(target: any, proto: any): boolean;
3536+
}
35373537

35383538
/**
35393539
* Represents the completion of an asynchronous operation

0 commit comments

Comments
 (0)