diff --git a/Jakefile b/Jakefile index 7b17a83a579..ca1ee20a3ce 100644 --- a/Jakefile +++ b/Jakefile @@ -65,8 +65,10 @@ var servicesSources = [ return path.join(compilerDirectory, f); }).concat([ "breakpoints.ts", + "navigateTo.ts", "navigationBar.ts", "outliningElementsCollector.ts", + "patternMatcher.ts", "services.ts", "shims.ts", "signatureHelp.ts", @@ -138,7 +140,8 @@ var harnessSources = [ "incrementalParser.ts", "services/colorization.ts", "services/documentRegistry.ts", - "services/preProcessFile.ts" + "services/preProcessFile.ts", + "services/patternMatcher.ts" ].map(function (f) { return path.join(unittestsDirectory, f); })).concat([ diff --git a/bin/lib.core.es6.d.ts b/bin/lib.core.es6.d.ts index d5898b35a71..13326cb1380 100644 --- a/bin/lib.core.es6.d.ts +++ b/bin/lib.core.es6.d.ts @@ -1164,7 +1164,7 @@ interface ArrayConstructor { } declare var Array: ArrayConstructor; -declare type PropertyKey = string | number | Symbol; +declare type PropertyKey = string | number | symbol; interface Symbol { /** Returns a string representation of an object. */ @@ -1173,7 +1173,7 @@ interface Symbol { /** Returns the primitive value of the specified object. */ valueOf(): Object; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface SymbolConstructor { @@ -1186,21 +1186,21 @@ interface SymbolConstructor { * Returns a new unique Symbol value. * @param description Description of the new Symbol object. */ - (description?: string|number): Symbol; + (description?: string|number): symbol; /** * Returns a Symbol object from the global symbol registry matching the given key if found. * Otherwise, returns a new symbol with this key. * @param key key to search for. */ - for(key: string): Symbol; + for(key: string): symbol; /** * Returns a key from the global symbol registry matching the given Symbol if found. * Otherwise, returns a undefined. * @param sym Symbol to find the key for. */ - keyFor(sym: Symbol): string; + keyFor(sym: symbol): string; // Well-known Symbols @@ -1208,42 +1208,42 @@ interface SymbolConstructor { * A method that determines if a constructor object recognizes an object as one of the * constructor’s instances. Called by the semantics of the instanceof operator. */ - hasInstance: Symbol; + hasInstance: symbol; /** * A Boolean value that if true indicates that an object should flatten to its array elements * by Array.prototype.concat. */ - isConcatSpreadable: Symbol; + isConcatSpreadable: symbol; /** * A Boolean value that if true indicates that an object may be used as a regular expression. */ - isRegExp: Symbol; + isRegExp: symbol; /** * A method that returns the default iterator for an object.Called by the semantics of the * for-of statement. */ - iterator: Symbol; + iterator: symbol; /** * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive * abstract operation. */ - toPrimitive: Symbol; + toPrimitive: symbol; /** * A String value that is used in the creation of the default string description of an object. * Called by the built- in method Object.prototype.toString. */ - toStringTag: Symbol; + toStringTag: symbol; /** * An Object whose own property names are property names that are excluded from the with * environment bindings of the associated objects. */ - unscopables: Symbol; + unscopables: symbol; } declare var Symbol: SymbolConstructor; @@ -1274,7 +1274,7 @@ interface ObjectConstructor { * Returns an array of all symbol properties found directly on object o. * @param o Object to retrieve the symbols from. */ - getOwnPropertySymbols(o: any): Symbol[]; + getOwnPropertySymbols(o: any): symbol[]; /** * Returns true if the values are the same value, false otherwise. @@ -1396,7 +1396,7 @@ interface ArrayLike { interface Array { /** Iterator */ - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; /** * Returns an array of key, value pairs for every entry in the array @@ -1495,7 +1495,7 @@ interface ArrayConstructor { interface String { /** Iterator */ - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; /** * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point @@ -1613,12 +1613,12 @@ interface IteratorResult { } interface Iterator { - //[Symbol.iterator](): Iterator; + [Symbol.iterator](): Iterator; next(): IteratorResult; } interface Iterable { - //[Symbol.iterator](): Iterator; + [Symbol.iterator](): Iterator; } interface GeneratorFunction extends Function { @@ -1640,7 +1640,7 @@ interface Generator extends Iterator { next(value?: any): IteratorResult; throw (exception: any): IteratorResult; return (value: T): IteratorResult; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface Math { @@ -1754,11 +1754,11 @@ interface Math { */ cbrt(x: number): number; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface RegExp { - // [Symbol.isRegExp]: boolean; + [Symbol.isRegExp]: boolean; /** * Matches a string with a regular expression, and returns an array containing the results of @@ -1815,8 +1815,8 @@ interface Map { set(key: K, value?: V): Map; size: number; values(): Iterator; - // [Symbol.iterator]():Iterator<[K,V]>; - // [Symbol.toStringTag]: string; + [Symbol.iterator]():Iterator<[K,V]>; + [Symbol.toStringTag]: string; } interface MapConstructor { @@ -1832,7 +1832,7 @@ interface WeakMap { get(key: K): V; has(key: K): boolean; set(key: K, value?: V): WeakMap; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface WeakMapConstructor { @@ -1852,8 +1852,8 @@ interface Set { keys(): Iterator; size: number; values(): Iterator; - // [Symbol.iterator]():Iterator; - // [Symbol.toStringTag]: string; + [Symbol.iterator]():Iterator; + [Symbol.toStringTag]: string; } interface SetConstructor { @@ -1868,7 +1868,7 @@ interface WeakSet { clear(): void; delete(value: T): boolean; has(value: T): boolean; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface WeakSetConstructor { @@ -1879,7 +1879,7 @@ interface WeakSetConstructor { declare var WeakSet: WeakSetConstructor; interface JSON { - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } /** @@ -1899,7 +1899,7 @@ interface ArrayBuffer { */ slice(begin: number, end?: number): ArrayBuffer; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface ArrayBufferConstructor { @@ -2036,7 +2036,7 @@ interface DataView { */ setUint32(byteOffset: number, value: number, littleEndian: boolean): void; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface DataViewConstructor { @@ -2303,7 +2303,7 @@ interface Int8Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int8ArrayConstructor { @@ -2593,7 +2593,7 @@ interface Uint8Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint8ArrayConstructor { @@ -2883,7 +2883,7 @@ interface Uint8ClampedArray { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint8ClampedArrayConstructor { @@ -3173,7 +3173,7 @@ interface Int16Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int16ArrayConstructor { @@ -3463,7 +3463,7 @@ interface Uint16Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint16ArrayConstructor { @@ -3753,7 +3753,7 @@ interface Int32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int32ArrayConstructor { @@ -4043,7 +4043,7 @@ interface Uint32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint32ArrayConstructor { @@ -4333,7 +4333,7 @@ interface Float32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Float32ArrayConstructor { @@ -4623,7 +4623,7 @@ interface Float64Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Float64ArrayConstructor { @@ -4687,7 +4687,7 @@ declare var Reflect: { getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; getPrototypeOf(target: any): any; has(target: any, propertyKey: string): boolean; - has(target: any, propertyKey: Symbol): boolean; + has(target: any, propertyKey: symbol): boolean; isExtensible(target: any): boolean; ownKeys(target: any): Array; preventExtensions(target: any): boolean; diff --git a/bin/lib.es6.d.ts b/bin/lib.es6.d.ts index a66c28662fd..dfb025a0c36 100644 --- a/bin/lib.es6.d.ts +++ b/bin/lib.es6.d.ts @@ -1164,7 +1164,7 @@ interface ArrayConstructor { } declare var Array: ArrayConstructor; -declare type PropertyKey = string | number | Symbol; +declare type PropertyKey = string | number | symbol; interface Symbol { /** Returns a string representation of an object. */ @@ -1173,7 +1173,7 @@ interface Symbol { /** Returns the primitive value of the specified object. */ valueOf(): Object; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface SymbolConstructor { @@ -1186,21 +1186,21 @@ interface SymbolConstructor { * Returns a new unique Symbol value. * @param description Description of the new Symbol object. */ - (description?: string|number): Symbol; + (description?: string|number): symbol; /** * Returns a Symbol object from the global symbol registry matching the given key if found. * Otherwise, returns a new symbol with this key. * @param key key to search for. */ - for(key: string): Symbol; + for(key: string): symbol; /** * Returns a key from the global symbol registry matching the given Symbol if found. * Otherwise, returns a undefined. * @param sym Symbol to find the key for. */ - keyFor(sym: Symbol): string; + keyFor(sym: symbol): string; // Well-known Symbols @@ -1208,42 +1208,42 @@ interface SymbolConstructor { * A method that determines if a constructor object recognizes an object as one of the * constructor’s instances. Called by the semantics of the instanceof operator. */ - hasInstance: Symbol; + hasInstance: symbol; /** * A Boolean value that if true indicates that an object should flatten to its array elements * by Array.prototype.concat. */ - isConcatSpreadable: Symbol; + isConcatSpreadable: symbol; /** * A Boolean value that if true indicates that an object may be used as a regular expression. */ - isRegExp: Symbol; + isRegExp: symbol; /** * A method that returns the default iterator for an object.Called by the semantics of the * for-of statement. */ - iterator: Symbol; + iterator: symbol; /** * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive * abstract operation. */ - toPrimitive: Symbol; + toPrimitive: symbol; /** * A String value that is used in the creation of the default string description of an object. * Called by the built- in method Object.prototype.toString. */ - toStringTag: Symbol; + toStringTag: symbol; /** * An Object whose own property names are property names that are excluded from the with * environment bindings of the associated objects. */ - unscopables: Symbol; + unscopables: symbol; } declare var Symbol: SymbolConstructor; @@ -1274,7 +1274,7 @@ interface ObjectConstructor { * Returns an array of all symbol properties found directly on object o. * @param o Object to retrieve the symbols from. */ - getOwnPropertySymbols(o: any): Symbol[]; + getOwnPropertySymbols(o: any): symbol[]; /** * Returns true if the values are the same value, false otherwise. @@ -1396,7 +1396,7 @@ interface ArrayLike { interface Array { /** Iterator */ - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; /** * Returns an array of key, value pairs for every entry in the array @@ -1495,7 +1495,7 @@ interface ArrayConstructor { interface String { /** Iterator */ - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; /** * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point @@ -1613,12 +1613,12 @@ interface IteratorResult { } interface Iterator { - //[Symbol.iterator](): Iterator; + [Symbol.iterator](): Iterator; next(): IteratorResult; } interface Iterable { - //[Symbol.iterator](): Iterator; + [Symbol.iterator](): Iterator; } interface GeneratorFunction extends Function { @@ -1640,7 +1640,7 @@ interface Generator extends Iterator { next(value?: any): IteratorResult; throw (exception: any): IteratorResult; return (value: T): IteratorResult; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface Math { @@ -1754,11 +1754,11 @@ interface Math { */ cbrt(x: number): number; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface RegExp { - // [Symbol.isRegExp]: boolean; + [Symbol.isRegExp]: boolean; /** * Matches a string with a regular expression, and returns an array containing the results of @@ -1815,8 +1815,8 @@ interface Map { set(key: K, value?: V): Map; size: number; values(): Iterator; - // [Symbol.iterator]():Iterator<[K,V]>; - // [Symbol.toStringTag]: string; + [Symbol.iterator]():Iterator<[K,V]>; + [Symbol.toStringTag]: string; } interface MapConstructor { @@ -1832,7 +1832,7 @@ interface WeakMap { get(key: K): V; has(key: K): boolean; set(key: K, value?: V): WeakMap; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface WeakMapConstructor { @@ -1852,8 +1852,8 @@ interface Set { keys(): Iterator; size: number; values(): Iterator; - // [Symbol.iterator]():Iterator; - // [Symbol.toStringTag]: string; + [Symbol.iterator]():Iterator; + [Symbol.toStringTag]: string; } interface SetConstructor { @@ -1868,7 +1868,7 @@ interface WeakSet { clear(): void; delete(value: T): boolean; has(value: T): boolean; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface WeakSetConstructor { @@ -1879,7 +1879,7 @@ interface WeakSetConstructor { declare var WeakSet: WeakSetConstructor; interface JSON { - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } /** @@ -1899,7 +1899,7 @@ interface ArrayBuffer { */ slice(begin: number, end?: number): ArrayBuffer; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface ArrayBufferConstructor { @@ -2036,7 +2036,7 @@ interface DataView { */ setUint32(byteOffset: number, value: number, littleEndian: boolean): void; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface DataViewConstructor { @@ -2303,7 +2303,7 @@ interface Int8Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int8ArrayConstructor { @@ -2593,7 +2593,7 @@ interface Uint8Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint8ArrayConstructor { @@ -2883,7 +2883,7 @@ interface Uint8ClampedArray { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint8ClampedArrayConstructor { @@ -3173,7 +3173,7 @@ interface Int16Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int16ArrayConstructor { @@ -3463,7 +3463,7 @@ interface Uint16Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint16ArrayConstructor { @@ -3753,7 +3753,7 @@ interface Int32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int32ArrayConstructor { @@ -4043,7 +4043,7 @@ interface Uint32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint32ArrayConstructor { @@ -4333,7 +4333,7 @@ interface Float32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Float32ArrayConstructor { @@ -4623,7 +4623,7 @@ interface Float64Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Float64ArrayConstructor { @@ -4687,7 +4687,7 @@ declare var Reflect: { getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; getPrototypeOf(target: any): any; has(target: any, propertyKey: string): boolean; - has(target: any, propertyKey: Symbol): boolean; + has(target: any, propertyKey: symbol): boolean; isExtensible(target: any): boolean; ownKeys(target: any): Array; preventExtensions(target: any): boolean; diff --git a/bin/tsc.js b/bin/tsc.js index 7a5c75155f4..945a2115041 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -316,7 +316,12 @@ var ts; return diagnostic.file ? diagnostic.file.fileName : undefined; } function compareDiagnostics(d1, d2) { - return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0; + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || + compareValues(d1.start, d2.start) || + compareValues(d1.length, d2.length) || + compareValues(d1.code, d2.code) || + compareMessageText(d1.messageText, d2.messageText) || + 0; } ts.compareDiagnostics = compareDiagnostics; function compareMessageText(text1, text2) { @@ -812,9 +817,7 @@ var ts; watchFile: function (fileName, callback) { _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); return { - close: function () { - _fs.unwatchFile(fileName, fileChanged); - } + close: function () { _fs.unwatchFile(fileName, fileChanged); } }; function fileChanged(curr, prev) { if (+curr.mtime <= +prev.mtime) { @@ -991,12 +994,12 @@ var ts; An_object_member_cannot_be_declared_optional: { code: 1162, category: 1, key: "An object member cannot be declared optional." }, yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1, key: "'yield' expression must be contained_within a generator declaration." }, Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1, key: "Computed property names are not allowed in enums." }, - Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: 1, key: "Computed property names are not allowed in an ambient context." }, - Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: 1, key: "Computed property names are not allowed in class property declarations." }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: 1, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: 1, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: 1, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, - Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: 1, key: "Computed property names are not allowed in method overloads." }, - Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: 1, key: "Computed property names are not allowed in interfaces." }, - Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: 1, key: "Computed property names are not allowed in type literals." }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: 1, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: 1, key: "A computed property name in an interface must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: 1, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: 1, key: "A comma expression is not allowed in a computed property name." }, extends_clause_already_seen: { code: 1172, category: 1, key: "'extends' clause already seen." }, extends_clause_must_precede_implements_clause: { code: 1173, category: 1, key: "'extends' clause must precede 'implements' clause." }, @@ -1015,6 +1018,9 @@ var ts; Merge_conflict_marker_encountered: { code: 1185, category: 1, key: "Merge conflict marker encountered." }, A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1, key: "A rest element cannot have an initializer." }, A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1, key: "A parameter property may not be a binding pattern." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: 1, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: 1, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: 1, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, Duplicate_identifier_0: { code: 2300, category: 1, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1, key: "Static members cannot reference class type parameters." }, @@ -1034,7 +1040,7 @@ var ts; Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1, key: "Global type '{0}' must be a class or interface type." }, Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1, key: "Global type '{0}' must have {1} type parameter(s)." }, Cannot_find_global_type_0: { code: 2318, category: 1, key: "Cannot find global type '{0}'." }, - Named_properties_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." }, + Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1, key: "Type '{0}' is not assignable to type '{1}'." }, @@ -1056,7 +1062,7 @@ var ts; Property_0_does_not_exist_on_type_1: { code: 2339, category: 1, key: "Property '{0}' does not exist on type '{1}'." }, Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', or 'any'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1, key: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1, key: "Supplied parameters do not match any signature of call target." }, @@ -1072,7 +1078,7 @@ var ts; The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, - The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'." }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, @@ -1167,11 +1173,26 @@ var ts; Type_0_is_not_an_array_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type." }, A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1, key: "A rest element must be last in an array destructuring pattern" }, A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1, key: "A binding pattern parameter cannot be optional in an implementation signature." }, - A_computed_property_name_must_be_of_type_string_number_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', or 'any'." }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1, key: "'this' cannot be referenced in a computed property name." }, super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1, key: "'super' cannot be referenced in a computed property name." }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2468, category: 1, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, + Cannot_find_global_value_0: { code: 2468, category: 1, key: "Cannot find global value '{0}'." }, + The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: 1, key: "The '{0}' operator cannot be applied to type 'symbol'." }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: 1, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: 1, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: 1, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: 1, key: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: 1, key: "A const enum member can only be accessed using a string literal." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: 1, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, + for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: 1, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: 1, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1241,14 +1262,6 @@ var ts; Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1, key: "Exported type alias '{0}' has or is using private name '{1}'." }, - Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: 1, key: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 4084, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 4085, category: 1, key: "A const enum member can only be accessed using a string literal." }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 4087, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - Property_0_does_not_exist_on_const_enum_1: { code: 4088, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 4089, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: 1, key: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1, key: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: 1, key: "Cannot read file '{0}': {1}" }, @@ -1324,7 +1337,8 @@ var ts; You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: 1, key: "You cannot rename elements that are defined in the standard TypeScript library." }, yield_expressions_are_not_currently_supported: { code: 9000, category: 1, key: "'yield' expressions are not currently supported." }, Generators_are_not_currently_supported: { code: 9001, category: 1, key: "Generators are not currently supported." }, - The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." } + The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, + for_of_statements_are_not_currently_supported: { code: 9003, category: 1, key: "'for...of' statements are not currently supported." } }; })(ts || (ts = {})); var ts; @@ -1375,17 +1389,19 @@ var ts; "string": 119, "super": 90, "switch": 91, + "symbol": 120, "this": 92, "throw": 93, "true": 94, "try": 95, - "type": 120, + "type": 121, "typeof": 96, "var": 97, "void": 98, "while": 99, "with": 100, "yield": 109, + "of": 122, "{": 14, "}": 15, "(": 16, @@ -1466,6 +1482,7 @@ var ts; function isUnicodeIdentifierStart(code, languageVersion) { return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); } + ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; function isUnicodeIdentifierPart(code, languageVersion) { return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); } @@ -1510,15 +1527,15 @@ var ts; return result; } ts.computeLineStarts = computeLineStarts; - function getPositionFromLineAndCharacter(sourceFile, line, character) { - return computePositionFromLineAndCharacter(getLineStarts(sourceFile), line, character); + function getPositionOfLineAndCharacter(sourceFile, line, character) { + return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character); } - ts.getPositionFromLineAndCharacter = getPositionFromLineAndCharacter; - function computePositionFromLineAndCharacter(lineStarts, line, character) { - ts.Debug.assert(line > 0 && line <= lineStarts.length); - return lineStarts[line - 1] + character - 1; + ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter; + function computePositionOfLineAndCharacter(lineStarts, line, character) { + ts.Debug.assert(line >= 0 && line < lineStarts.length); + return lineStarts[line] + character; } - ts.computePositionFromLineAndCharacter = computePositionFromLineAndCharacter; + ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter; function getLineStarts(sourceFile) { return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text)); } @@ -1526,11 +1543,11 @@ var ts; function computeLineAndCharacterOfPosition(lineStarts, position) { var lineNumber = ts.binarySearch(lineStarts, position); if (lineNumber < 0) { - lineNumber = (~lineNumber) - 1; + lineNumber = ~lineNumber - 1; } return { - line: lineNumber + 1, - character: position - lineStarts[lineNumber] + 1 + line: lineNumber, + character: position - lineStarts[lineNumber] }; } ts.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition; @@ -1540,7 +1557,9 @@ var ts; ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { - return ch === 32 || ch === 9 || ch === 11 || ch === 12 || ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; + return ch === 32 || ch === 9 || ch === 11 || ch === 12 || + ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || + ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; } ts.isWhiteSpace = isWhiteSpace; function isLineBreak(ch) { @@ -1627,7 +1646,8 @@ var ts; return false; } } - return ch === 61 || text.charCodeAt(pos + mergeConflictMarkerLength) === 32; + return ch === 61 || + text.charCodeAt(pos + mergeConflictMarkerLength) === 32; } } return false; @@ -1734,11 +1754,15 @@ var ts; } ts.getTrailingCommentRanges = getTrailingCommentRanges; function isIdentifierStart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } ts.isIdentifierStart = isIdentifierStart; function isIdentifierPart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; function createScanner(languageVersion, skipTrivia, text, onError) { @@ -1756,10 +1780,14 @@ var ts; } } function isIdentifierStart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } function isIdentifierPart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } function scanNumber() { var start = pos; @@ -2480,13 +2508,10 @@ var ts; writeParameter: writeText, writeSymbol: writeText, writeLine: function () { return str += " "; }, - increaseIndent: function () { - }, - decreaseIndent: function () { - }, + increaseIndent: function () { }, + decreaseIndent: function () { }, clear: function () { return str = ""; }, - trackSymbol: function () { - } + trackSymbol: function () { } }; } return stringWriters.pop(); @@ -2508,7 +2533,8 @@ var ts; ts.containsParseError = containsParseError; function aggregateChildData(node) { if (!(node.parserContextFlags & 64)) { - var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || ts.forEachChild(node, containsParseError); + var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || + ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { node.parserContextFlags |= 32; } @@ -2516,16 +2542,21 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 207) { + while (node && node.kind !== 210) { node = node.parent; } return node; } ts.getSourceFileOfNode = getSourceFileOfNode; + function getStartPositionOfLine(line, sourceFile) { + ts.Debug.assert(line >= 0); + return ts.getLineStarts(sourceFile)[line]; + } + ts.getStartPositionOfLine = getStartPositionOfLine; function nodePosToString(node) { var file = getSourceFileOfNode(node); var loc = ts.getLineAndCharacterOfPosition(file, node.pos); - return file.fileName + "(" + loc.line + "," + loc.character + ")"; + return file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + ")"; } ts.nodePosToString = nodePosToString; function getStartPosOfNode(node) { @@ -2607,13 +2638,13 @@ var ts; function getErrorSpanForNode(node) { var errorSpan; switch (node.kind) { - case 188: - case 146: case 191: - case 192: - case 195: + case 148: case 194: - case 206: + case 195: + case 198: + case 197: + case 209: errorSpan = node.name; break; } @@ -2629,11 +2660,11 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 194 && isConst(node); + return node.kind === 197 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 146 || isBindingPattern(node))) { + while (node && (node.kind === 148 || isBindingPattern(node))) { node = node.parent; } return node; @@ -2641,14 +2672,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 188) { + if (node.kind === 191) { node = node.parent; } - if (node && node.kind === 189) { + if (node && node.kind === 192) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 171) { + if (node && node.kind === 173) { flags |= node.flags; } return flags; @@ -2663,12 +2694,12 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 173 && node.expression.kind === 8; + return node.kind === 175 && node.expression.kind === 8; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { sourceFileOfNode = sourceFileOfNode || getSourceFileOfNode(node); - if (node.kind === 124 || node.kind === 123) { + if (node.kind === 126 || node.kind === 125) { return ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)); } else { @@ -2679,7 +2710,9 @@ var ts; function getJsDocComments(node, sourceFileOfNode) { return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); function isJsDocComment(comment) { - return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; + return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && + sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && + sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; } } ts.getJsDocComments = getJsDocComments; @@ -2688,21 +2721,22 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 181: + case 184: return visitor(node); - case 170: - case 174: - case 175: + case 172: case 176: case 177: case 178: - case 182: - case 183: - case 200: - case 201: - case 184: + case 179: + case 180: + case 181: + case 185: case 186: case 203: + case 204: + case 187: + case 189: + case 206: return ts.forEachChild(node, traverse); } } @@ -2711,22 +2745,22 @@ var ts; function isAnyFunction(node) { if (node) { switch (node.kind) { - case 129: - case 156: - case 190: - case 157: - case 128: - case 127: - case 130: case 131: + case 158: + case 193: + case 159: + case 130: + case 129: case 132: case 133: case 134: + case 135: case 136: - case 137: - case 156: - case 157: - case 190: + case 138: + case 139: + case 158: + case 159: + case 193: return true; } } @@ -2734,11 +2768,11 @@ var ts; } ts.isAnyFunction = isAnyFunction; function isFunctionBlock(node) { - return node && node.kind === 170 && isAnyFunction(node.parent); + return node && node.kind === 172 && isAnyFunction(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 128 && node.parent.kind === 148; + return node && node.kind === 130 && node.parent.kind === 150; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function getContainingFunction(node) { @@ -2757,28 +2791,28 @@ var ts; return undefined; } switch (node.kind) { - case 122: - if (node.parent.parent.kind === 191) { + case 124: + if (node.parent.parent.kind === 194) { return node; } node = node.parent; break; - case 157: + case 159: if (!includeArrowFunctions) { continue; } - case 190: - case 156: - case 195: - case 126: - case 125: + case 193: + case 158: + case 198: case 128: case 127: - case 129: case 130: + case 129: case 131: - case 194: - case 207: + case 132: + case 133: + case 197: + case 210: return node; } } @@ -2790,32 +2824,32 @@ var ts; if (!node) return node; switch (node.kind) { - case 122: - if (node.parent.parent.kind === 191) { + case 124: + if (node.parent.parent.kind === 194) { return node; } node = node.parent; break; - case 190: - case 156: - case 157: + case 193: + case 158: + case 159: if (!includeFunctions) { continue; } - case 126: - case 125: case 128: case 127: - case 129: case 130: + case 129: case 131: + case 132: + case 133: return node; } } } ts.getSuperContainer = getSuperContainer; function getInvokedExpression(node) { - if (node.kind === 153) { + if (node.kind === 155) { return node.tag; } return node.expression; @@ -2829,8 +2863,6 @@ var ts; case 94: case 79: case 9: - case 147: - case 148: case 149: case 150: case 151: @@ -2840,61 +2872,67 @@ var ts; case 155: case 156: case 157: - case 160: case 158: case 159: - case 161: case 162: + case 160: + case 161: case 163: case 164: - case 167: case 165: + case 166: + case 169: + case 167: case 10: - case 168: + case 170: return true; - case 121: - while (node.parent.kind === 121) { + case 123: + while (node.parent.kind === 123) { node = node.parent; } - return node.parent.kind === 138; + return node.parent.kind === 140; case 64: - if (node.parent.kind === 138) { + if (node.parent.kind === 140) { return true; } case 7: case 8: var parent = node.parent; switch (parent.kind) { - case 188: - case 124: + case 191: case 126: - case 125: - case 206: - case 204: - case 146: + case 128: + case 127: + case 209: + case 207: + case 148: return parent.initializer === node; - case 173: - case 174: case 175: case 176: - case 181: - case 182: - case 183: - case 200: - case 185: - case 183: - return parent.expression === node; case 177: - var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 189) || forStatement.condition === node || forStatement.iterator === node; case 178: + case 184: + case 185: + case 186: + case 203: + case 188: + case 186: + return parent.expression === node; + case 179: + var forStatement = parent; + return (forStatement.initializer === node && forStatement.initializer.kind !== 192) || + forStatement.condition === node || + forStatement.iterator === node; + case 180: + case 181: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 189) || forInStatement.expression === node; - case 154: + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 192) || + forInStatement.expression === node; + case 156: return node === parent.expression; - case 169: + case 171: return node === parent.expression; - case 122: + case 124: return node === parent.expression; default: if (isExpression(parent)) { @@ -2907,11 +2945,12 @@ var ts; ts.isExpression = isExpression; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); - return moduleState === 1 || (preserveConstEnums && moduleState === 2); + return moduleState === 1 || + (preserveConstEnums && moduleState === 2); } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportDeclaration(node) { - return node.kind === 197 && node.moduleReference.kind === 199; + return node.kind === 200 && node.moduleReference.kind === 202; } ts.isExternalModuleImportDeclaration = isExternalModuleImportDeclaration; function getExternalModuleImportDeclarationExpression(node) { @@ -2920,26 +2959,26 @@ var ts; } ts.getExternalModuleImportDeclarationExpression = getExternalModuleImportDeclarationExpression; function isInternalModuleImportDeclaration(node) { - return node.kind === 197 && node.moduleReference.kind !== 199; + return node.kind === 200 && node.moduleReference.kind !== 202; } ts.isInternalModuleImportDeclaration = isInternalModuleImportDeclaration; function hasDotDotDotToken(node) { - return node && node.kind === 124 && node.dotDotDotToken !== undefined; + return node && node.kind === 126 && node.dotDotDotToken !== undefined; } ts.hasDotDotDotToken = hasDotDotDotToken; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 124: + case 126: return node.questionToken !== undefined; + case 130: + case 129: + return node.questionToken !== undefined; + case 208: + case 207: case 128: case 127: return node.questionToken !== undefined; - case 205: - case 204: - case 126: - case 125: - return node.questionToken !== undefined; } } return false; @@ -2962,7 +3001,7 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return node.kind === 145 || node.kind === 144; + return node.kind === 147 || node.kind === 146; } ts.isBindingPattern = isBindingPattern; function isInAmbientContext(node) { @@ -2977,27 +3016,27 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 123: - case 124: - case 188: - case 146: - case 126: case 125: - case 204: - case 205: - case 206: + case 126: + case 191: + case 148: case 128: case 127: - case 190: + case 207: + case 208: + case 209: case 130: - case 131: case 129: - case 191: - case 192: case 193: + case 132: + case 133: + case 131: case 194: case 195: + case 196: case 197: + case 198: + case 200: return true; } return false; @@ -3005,24 +3044,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 180: - case 179: - case 187: - case 175: - case 173: - case 172: - case 178: - case 177: - case 174: - case 184: - case 181: case 183: - case 93: - case 186: - case 171: - case 176: case 182: - case 198: + case 190: + case 177: + case 175: + case 174: + case 180: + case 181: + case 179: + case 176: + case 187: + case 184: + case 186: + case 93: + case 189: + case 173: + case 178: + case 185: + case 201: return true; default: return false; @@ -3034,10 +3074,10 @@ var ts; return false; } var parent = name.parent; - if (isDeclaration(parent) || parent.kind === 156) { + if (isDeclaration(parent) || parent.kind === 158) { return parent.name === name; } - if (parent.kind === 203) { + if (parent.kind === 206) { return parent.name === name; } return false; @@ -3079,16 +3119,16 @@ var ts; ts.tryResolveScriptReference = tryResolveScriptReference; function getAncestor(node, kind) { switch (kind) { - case 191: + case 194: while (node) { switch (node.kind) { - case 191: - return node; case 194: - case 192: - case 193: - case 195: + return node; case 197: + case 195: + case 196: + case 198: + case 200: return undefined; default: node = node.parent; @@ -3143,13 +3183,45 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 65 <= token && token <= 120; + return 65 <= token && token <= 122; } ts.isKeyword = isKeyword; function isTrivia(token) { return 2 <= token && token <= 6; } ts.isTrivia = isTrivia; + function hasDynamicName(declaration) { + return declaration.name && + declaration.name.kind === 124 && + !isWellKnownSymbolSyntactically(declaration.name.expression); + } + ts.hasDynamicName = hasDynamicName; + function isWellKnownSymbolSyntactically(node) { + return node.kind === 151 && isESSymbolIdentifier(node.expression); + } + ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; + function getPropertyNameForPropertyNameNode(name) { + if (name.kind === 64 || name.kind === 8 || name.kind === 7) { + return name.text; + } + if (name.kind === 124) { + var nameExpression = name.expression; + if (isWellKnownSymbolSyntactically(nameExpression)) { + var rightHandSideName = nameExpression.name.text; + return getPropertyNameForKnownSymbolName(rightHandSideName); + } + } + return undefined; + } + ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode; + function getPropertyNameForKnownSymbolName(symbolName) { + return "__@" + symbolName; + } + ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName; + function isESSymbolIdentifier(node) { + return node.kind === 64 && node.text === "Symbol"; + } + ts.isESSymbolIdentifier = isESSymbolIdentifier; function isModifier(token) { switch (token) { case 107: @@ -3341,7 +3413,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var nodeConstructors = new Array(209); + var nodeConstructors = new Array(212); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -3378,152 +3450,224 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 121: - return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); case 123: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 124: - case 126: + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); case 125: - case 204: - case 205: - case 188: - case 146: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 136: - case 137: - case 132: - case 133: - case 134: - return visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.expression); + case 126: case 128: case 127: - case 129: - case 130: - case 131: - case 156: - case 190: - case 157: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.body); - case 135: - return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); + case 207: + case 208: + case 191: + case 148: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); case 138: - return visitNode(cbNode, node.exprName); case 139: - return visitNodes(cbNodes, node.members); + case 134: + case 135: + case 136: + return visitNodes(cbNodes, node.modifiers) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type); + case 130: + case 129: + case 131: + case 132: + case 133: + case 158: + case 193: + case 159: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + case 137: + return visitNode(cbNode, node.typeName) || + visitNodes(cbNodes, node.typeArguments); case 140: - return visitNode(cbNode, node.elementType); + return visitNode(cbNode, node.exprName); case 141: - return visitNodes(cbNodes, node.elementTypes); + return visitNodes(cbNodes, node.members); case 142: - return visitNodes(cbNodes, node.types); + return visitNode(cbNode, node.elementType); case 143: - return visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.elementTypes); case 144: + return visitNodes(cbNodes, node.types); case 145: - return visitNodes(cbNodes, node.elements); + return visitNode(cbNode, node.type); + case 146: case 147: return visitNodes(cbNodes, node.elements); - case 148: - return visitNodes(cbNodes, node.properties); case 149: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); + return visitNodes(cbNodes, node.elements); case 150: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); + return visitNodes(cbNodes, node.properties); case 151: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.name); case 152: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.argumentExpression); case 153: - return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); case 154: - return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.typeArguments) || + visitNodes(cbNodes, node.arguments); case 155: - return visitNode(cbNode, node.expression); - case 158: - return visitNode(cbNode, node.expression); - case 159: + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.template); + case 156: + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + case 157: return visitNode(cbNode, node.expression); case 160: return visitNode(cbNode, node.expression); case 161: - return visitNode(cbNode, node.operand); - case 166: - return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.expression); case 162: - return visitNode(cbNode, node.operand); + return visitNode(cbNode, node.expression); case 163: - return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); + return visitNode(cbNode, node.operand); + case 168: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); case 164: - return visitNode(cbNode, node.condition) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.whenFalse); - case 167: - return visitNode(cbNode, node.expression); - case 170: - case 196: - return visitNodes(cbNodes, node.statements); - case 207: - return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 171: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 189: - return visitNodes(cbNodes, node.declarations); - case 173: - return visitNode(cbNode, node.expression); - case 174: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 175: - return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 176: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 177: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); - case 178: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 179: - case 180: - return visitNode(cbNode, node.label); - case 181: - return visitNode(cbNode, node.expression); - case 182: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 183: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.clauses); - case 200: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 201: - return visitNodes(cbNodes, node.statements); - case 184: - return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 185: - return visitNode(cbNode, node.expression); - case 186: - return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 203: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.type) || visitNode(cbNode, node.block); - case 191: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 192: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 193: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 194: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 206: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 195: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 197: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 198: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportName); + return visitNode(cbNode, node.operand); case 165: - return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + case 166: + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.whenFalse); case 169: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 122: return visitNode(cbNode, node.expression); - case 202: - return visitNodes(cbNodes, node.types); + case 172: case 199: + return visitNodes(cbNodes, node.statements); + case 210: + return visitNodes(cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + case 173: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + case 192: + return visitNodes(cbNodes, node.declarations); + case 175: + return visitNode(cbNode, node.expression); + case 176: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + case 177: + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + case 178: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 179: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.iterator) || + visitNode(cbNode, node.statement); + case 180: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 181: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 182: + case 183: + return visitNode(cbNode, node.label); + case 184: + return visitNode(cbNode, node.expression); + case 185: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 186: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.clauses); + case 203: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.statements); + case 204: + return visitNodes(cbNodes, node.statements); + case 187: + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + case 188: + return visitNode(cbNode, node.expression); + case 189: + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + case 206: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.block); + case 194: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 195: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 196: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); + case 197: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 209: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 198: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + case 200: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + case 201: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.exportName); + case 167: + return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); + case 171: + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); + case 124: + return visitNode(cbNode, node.expression); + case 205: + return visitNodes(cbNodes, node.types); + case 202: return visitNode(cbNode, node.expression); } } @@ -3792,7 +3936,8 @@ var ts; } ts.updateSourceFile = updateSourceFile; function isEvalOrArgumentsIdentifier(node) { - return node.kind === 64 && (node.text === "eval" || node.text === "arguments"); + return node.kind === 64 && + (node.text === "eval" || node.text === "arguments"); } ts.isEvalOrArgumentsIdentifier = isEvalOrArgumentsIdentifier; function isUseStrictPrologueDirective(sourceFile, node) { @@ -3874,7 +4019,7 @@ var ts; var identifierCount = 0; var nodeCount = 0; var token; - var sourceFile = createNode(207, 0); + var sourceFile = createNode(210, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -4062,6 +4207,11 @@ var ts; } return undefined; } + function parseTokenNode() { + var node = createNode(token); + nextToken(); + return finishNode(node); + } function canParseSemicolon() { if (token === 22) { return true; @@ -4132,7 +4282,9 @@ var ts; return createIdentifier(isIdentifierOrKeyword()); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || token === 8 || token === 7; + return isIdentifierOrKeyword() || + token === 8 || + token === 7; } function parsePropertyName() { if (token === 8 || token === 7) { @@ -4144,7 +4296,7 @@ var ts; return parseIdentifierName(); } function parseComputedPropertyName() { - var node = createNode(122); + var node = createNode(124); parseExpected(18); var yieldContext = inYieldContext(); if (inGeneratorParameterContext()) { @@ -4227,7 +4379,8 @@ var ts; return isIdentifier(); } function isNotHeritageClauseTypeName() { - if (token === 101 || token === 78) { + if (token === 101 || + token === 78) { return lookAhead(nextTokenIsIdentifier); } return false; @@ -4272,7 +4425,7 @@ var ts; if (canParseSemicolon()) { return true; } - if (token === 85) { + if (isInOrOfKeyword(token)) { return true; } if (token === 32) { @@ -4392,12 +4545,12 @@ var ts; function isReusableModuleElement(node) { if (node) { switch (node.kind) { - case 197: - case 198: - case 191: - case 192: - case 195: + case 200: + case 201: case 194: + case 195: + case 198: + case 197: return true; } return isReusableStatement(node); @@ -4407,12 +4560,12 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 129: - case 134: - case 128: - case 130: case 131: - case 126: + case 136: + case 130: + case 132: + case 133: + case 128: return true; } } @@ -4421,8 +4574,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 200: - case 201: + case 203: + case 204: return true; } } @@ -4431,55 +4584,56 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 190: - case 171: - case 170: - case 174: + case 193: case 173: - case 185: - case 181: + case 172: + case 176: + case 175: + case 188: + case 184: + case 186: case 183: + case 182: case 180: + case 181: case 179: case 178: - case 177: - case 176: - case 182: - case 172: - case 186: - case 184: - case 175: + case 185: + case 174: + case 189: case 187: + case 177: + case 190: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 206; + return node.kind === 209; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 133: + case 135: + case 129: + case 136: case 127: case 134: - case 125: - case 132: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 188) { + if (node.kind !== 191) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 124) { + if (node.kind !== 126) { return false; } var parameter = node; @@ -4548,7 +4702,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(20)) { - var node = createNode(121, entity.pos); + var node = createNode(123, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -4564,13 +4718,8 @@ var ts; } return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } - function parseTokenNode() { - var node = createNode(token); - nextToken(); - return finishNode(node); - } function parseTemplateExpression() { - var template = createNode(165); + var template = createNode(167); template.head = parseLiteralNode(); ts.Debug.assert(template.head.kind === 11, "Template head has wrong token kind"); var templateSpans = []; @@ -4583,7 +4732,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(169); + var span = createNode(171); span.expression = allowInAnd(parseExpression); var literal; if (token === 15) { @@ -4612,7 +4761,7 @@ var ts; return node; } function parseTypeReference() { - var node = createNode(135); + var node = createNode(137); node.typeName = parseEntityName(false, ts.Diagnostics.Type_expected); if (!scanner.hasPrecedingLineBreak() && token === 24) { node.typeArguments = parseBracketedList(17, parseType, 24, 25); @@ -4620,13 +4769,13 @@ var ts; return finishNode(node); } function parseTypeQuery() { - var node = createNode(138); + var node = createNode(140); parseExpected(96); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(123); + var node = createNode(125); node.name = parseIdentifier(); if (parseOptional(78)) { if (isStartOfType() || !isStartOfExpression()) { @@ -4659,7 +4808,7 @@ var ts; } } function parseParameter() { - var node = createNode(124); + var node = createNode(126); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(21); node.name = inGeneratorParameterContext() ? doInYieldContext(parseIdentifierOrPattern) : parseIdentifierOrPattern(); @@ -4710,7 +4859,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 133) { + if (kind === 135) { parseExpected(87); } fillSignature(51, false, false, node); @@ -4751,7 +4900,7 @@ var ts; } function parseIndexSignatureDeclaration(modifiers) { var fullStart = modifiers ? modifiers.pos : scanner.getStartPos(); - var node = createNode(134, fullStart); + var node = createNode(136, fullStart); setModifiers(node, modifiers); node.parameters = parseBracketedList(15, parseParameter, 18, 19); node.type = parseTypeAnnotation(); @@ -4763,7 +4912,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(50); if (token === 16 || token === 24) { - var method = createNode(127, fullStart); + var method = createNode(129, fullStart); method.name = name; method.questionToken = questionToken; fillSignature(51, false, false, method); @@ -4771,7 +4920,7 @@ var ts; return finishNode(method); } else { - var property = createNode(125, fullStart); + var property = createNode(127, fullStart); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -4803,18 +4952,22 @@ var ts; } function isTypeMemberWithLiteralPropertyName() { nextToken(); - return token === 16 || token === 24 || token === 50 || token === 51 || canParseSemicolon(); + return token === 16 || + token === 24 || + token === 50 || + token === 51 || + canParseSemicolon(); } function parseTypeMember() { switch (token) { case 16: case 24: - return parseSignatureMember(132); + return parseSignatureMember(134); case 18: return isIndexSignature() ? parseIndexSignatureDeclaration(undefined) : parsePropertyOrMethodSignature(); case 87: if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(133); + return parseSignatureMember(135); } case 8: case 7: @@ -4840,7 +4993,7 @@ var ts; return token === 16 || token === 24; } function parseTypeLiteral() { - var node = createNode(139); + var node = createNode(141); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -4856,12 +5009,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(141); + var node = createNode(143); node.elementTypes = parseBracketedList(18, parseType, 18, 19); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(143); + var node = createNode(145); parseExpected(16); node.type = parseType(); parseExpected(17); @@ -4869,7 +5022,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 137) { + if (kind === 139) { parseExpected(87); } fillSignature(32, false, false, node); @@ -4885,6 +5038,7 @@ var ts; case 119: case 117: case 111: + case 120: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); case 98: @@ -4907,6 +5061,7 @@ var ts; case 119: case 117: case 111: + case 120: case 98: case 96: case 14: @@ -4928,7 +5083,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(18)) { parseExpected(19); - var node = createNode(140, type.pos); + var node = createNode(142, type.pos); node.elementType = type; type = finishNode(node); } @@ -4943,7 +5098,7 @@ var ts; types.push(parseArrayTypeOrHigher()); } types.end = getNodeEnd(); - var node = createNode(142, type.pos); + var node = createNode(144, type.pos); node.types = types; type = finishNode(node); } @@ -4962,7 +5117,9 @@ var ts; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 51 || token === 23 || token === 50 || token === 52 || isIdentifier() || ts.isModifier(token)) { + if (token === 51 || token === 23 || + token === 50 || token === 52 || + isIdentifier() || ts.isModifier(token)) { return true; } if (token === 17) { @@ -4986,10 +5143,10 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(136); + return parseFunctionOrConstructorType(138); } if (token === 87) { - return parseFunctionOrConstructorType(137); + return parseFunctionOrConstructorType(139); } return parseUnionTypeOrHigher(); } @@ -5039,8 +5196,9 @@ var ts; } function parseExpression() { var expr = parseAssignmentExpressionOrHigher(); - while (parseOptional(23)) { - expr = makeBinaryExpression(expr, 23, parseAssignmentExpressionOrHigher()); + var operatorToken; + while ((operatorToken = parseOptionalToken(23))) { + expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); } return expr; } @@ -5066,9 +5224,7 @@ var ts; return parseSimpleArrowFunctionExpression(expr); } if (isLeftHandSideExpression(expr) && isAssignmentOperator(reScanGreaterToken())) { - var operator = token; - nextToken(); - return makeBinaryExpression(expr, operator, parseAssignmentExpressionOrHigher()); + return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher()); } return parseConditionalExpressionRest(expr); } @@ -5089,9 +5245,10 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(166); + var node = createNode(168); nextToken(); - if (!scanner.hasPrecedingLineBreak() && (token === 35 || isStartOfExpression())) { + if (!scanner.hasPrecedingLineBreak() && + (token === 35 || isStartOfExpression())) { node.asteriskToken = parseOptionalToken(35); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); @@ -5102,8 +5259,8 @@ var ts; } function parseSimpleArrowFunctionExpression(identifier) { ts.Debug.assert(token === 32, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(157, identifier.pos); - var parameter = createNode(124, identifier.pos); + var node = createNode(159, identifier.pos); + var parameter = createNode(126, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; @@ -5177,7 +5334,7 @@ var ts; return parseParenthesizedArrowFunctionExpressionHead(false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(157); + var node = createNode(159); fillSignature(51, false, !allowAmbiguity, node); if (!node.parameters) { return undefined; @@ -5200,7 +5357,7 @@ var ts; if (!parseOptional(50)) { return leftOperand; } - var node = createNode(164, leftOperand.pos); + var node = createNode(166, leftOperand.pos); node.condition = leftOperand; node.whenTrue = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(51); @@ -5211,6 +5368,9 @@ var ts; var leftOperand = parseUnaryExpressionOrHigher(); return parseBinaryExpressionRest(precedence, leftOperand); } + function isInOrOfKeyword(t) { + return t === 85 || t === 122; + } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { reScanGreaterToken(); @@ -5221,9 +5381,7 @@ var ts; if (token === 85 && inDisallowInContext()) { break; } - var operator = token; - nextToken(); - leftOperand = makeBinaryExpression(leftOperand, operator, parseBinaryExpressionOrHigher(newPrecedence)); + leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence)); } return leftOperand; } @@ -5271,34 +5429,34 @@ var ts; } return -1; } - function makeBinaryExpression(left, operator, right) { - var node = createNode(163, left.pos); + function makeBinaryExpression(left, operatorToken, right) { + var node = createNode(165, left.pos); node.left = left; - node.operator = operator; + node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(161); + var node = createNode(163); node.operator = token; nextToken(); node.operand = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(158); + var node = createNode(160); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(159); + var node = createNode(161); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(160); + var node = createNode(162); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); @@ -5328,7 +5486,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(isLeftHandSideExpression(expression)); if ((token === 38 || token === 39) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(162, expression.pos); + var node = createNode(164, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -5349,14 +5507,14 @@ var ts; if (token === 16 || token === 20) { return expression; } - var node = createNode(149, expression.pos); + var node = createNode(151, expression.pos); node.expression = expression; parseExpected(20, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); return finishNode(node); } function parseTypeAssertion() { - var node = createNode(154); + var node = createNode(156); parseExpected(24); node.type = parseType(); parseExpected(25); @@ -5367,14 +5525,14 @@ var ts; while (true) { var dotOrBracketStart = scanner.getTokenPos(); if (parseOptional(20)) { - var propertyAccess = createNode(149, expression.pos); + var propertyAccess = createNode(151, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); continue; } if (parseOptional(18)) { - var indexedAccess = createNode(150, expression.pos); + var indexedAccess = createNode(152, expression.pos); indexedAccess.expression = expression; if (token !== 19) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -5388,7 +5546,7 @@ var ts; continue; } if (token === 10 || token === 11) { - var tagExpression = createNode(153, expression.pos); + var tagExpression = createNode(155, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 10 ? parseLiteralNode() : parseTemplateExpression(); expression = finishNode(tagExpression); @@ -5405,7 +5563,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(151, expression.pos); + var callExpr = createNode(153, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -5413,7 +5571,7 @@ var ts; continue; } else if (token === 16) { - var callExpr = createNode(151, expression.pos); + var callExpr = createNode(153, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -5498,26 +5656,26 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(155); + var node = createNode(157); parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); return finishNode(node); } function parseSpreadElement() { - var node = createNode(167); + var node = createNode(169); parseExpected(21); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { - return token === 21 ? parseSpreadElement() : token === 23 ? createNode(168) : parseAssignmentExpressionOrHigher(); + return token === 21 ? parseSpreadElement() : token === 23 ? createNode(170) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return allowInAnd(parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(147); + var node = createNode(149); parseExpected(18); if (scanner.hasPrecedingLineBreak()) node.flags |= 256; @@ -5527,10 +5685,10 @@ var ts; } function tryParseAccessorDeclaration(fullStart, modifiers) { if (parseContextualModifier(114)) { - return parseAccessorDeclaration(130, fullStart, modifiers); + return parseAccessorDeclaration(132, fullStart, modifiers); } else if (parseContextualModifier(118)) { - return parseAccessorDeclaration(131, fullStart, modifiers); + return parseAccessorDeclaration(133, fullStart, modifiers); } return undefined; } @@ -5550,13 +5708,13 @@ var ts; return parseMethodDeclaration(fullStart, modifiers, asteriskToken, propertyName, questionToken); } if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(205, fullStart); + var shorthandDeclaration = createNode(208, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(204, fullStart); + var propertyAssignment = createNode(207, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51); @@ -5565,7 +5723,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(148); + var node = createNode(150); parseExpected(14); if (scanner.hasPrecedingLineBreak()) { node.flags |= 256; @@ -5575,7 +5733,7 @@ var ts; return finishNode(node); } function parseFunctionExpression() { - var node = createNode(156); + var node = createNode(158); parseExpected(82); node.asteriskToken = parseOptionalToken(35); node.name = node.asteriskToken ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier(); @@ -5587,7 +5745,7 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(152); + var node = createNode(154); parseExpected(87); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); @@ -5597,7 +5755,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode, diagnosticMessage) { - var node = createNode(170); + var node = createNode(172); if (parseExpected(14, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(2, checkForStrictMode, parseStatement); parseExpected(15); @@ -5615,12 +5773,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(172); + var node = createNode(174); parseExpected(22); return finishNode(node); } function parseIfStatement() { - var node = createNode(174); + var node = createNode(176); parseExpected(83); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -5630,7 +5788,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(175); + var node = createNode(177); parseExpected(74); node.statement = parseStatement(); parseExpected(99); @@ -5641,7 +5799,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(176); + var node = createNode(178); parseExpected(99); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -5649,7 +5807,7 @@ var ts; node.statement = parseStatement(); return finishNode(node); } - function parseForOrForInStatement() { + function parseForOrForInOrForOfStatement() { var pos = getNodePos(); parseExpected(81); parseExpected(16); @@ -5662,16 +5820,23 @@ var ts; initializer = disallowInAnd(parseExpression); } } - var forOrForInStatement; + var forOrForInOrForOfStatement; if (parseOptional(85)) { - var forInStatement = createNode(178, pos); + var forInStatement = createNode(180, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(17); - forOrForInStatement = forInStatement; + forOrForInOrForOfStatement = forInStatement; + } + else if (parseOptional(122)) { + var forOfStatement = createNode(181, pos); + forOfStatement.initializer = initializer; + forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); + parseExpected(17); + forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(177, pos); + var forStatement = createNode(179, pos); forStatement.initializer = initializer; parseExpected(22); if (token !== 22 && token !== 17) { @@ -5682,14 +5847,14 @@ var ts; forStatement.iterator = allowInAnd(parseExpression); } parseExpected(17); - forOrForInStatement = forStatement; + forOrForInOrForOfStatement = forStatement; } - forOrForInStatement.statement = parseStatement(); - return finishNode(forOrForInStatement); + forOrForInOrForOfStatement.statement = parseStatement(); + return finishNode(forOrForInOrForOfStatement); } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 180 ? 65 : 70); + parseExpected(kind === 183 ? 65 : 70); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -5697,7 +5862,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(181); + var node = createNode(184); parseExpected(89); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -5706,7 +5871,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(182); + var node = createNode(185); parseExpected(100); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -5715,7 +5880,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(200); + var node = createNode(203); parseExpected(66); node.expression = allowInAnd(parseExpression); parseExpected(51); @@ -5723,7 +5888,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(201); + var node = createNode(204); parseExpected(72); parseExpected(51); node.statements = parseList(4, false, parseStatement); @@ -5733,7 +5898,7 @@ var ts; return token === 66 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(183); + var node = createNode(186); parseExpected(91); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -5744,14 +5909,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(185); + var node = createNode(188); parseExpected(93); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(186); + var node = createNode(189); parseExpected(95); node.tryBlock = parseBlock(false, false); node.catchClause = token === 67 ? parseCatchClause() : undefined; @@ -5762,7 +5927,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(203); + var result = createNode(206); parseExpected(67); parseExpected(16); result.name = parseIdentifier(); @@ -5772,7 +5937,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(187); + var node = createNode(190); parseExpected(71); parseSemicolon(); return finishNode(node); @@ -5781,13 +5946,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 64 && parseOptional(51)) { - var labeledStatement = createNode(184, fullStart); + var labeledStatement = createNode(187, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(173, fullStart); + var expressionStatement = createNode(175, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -5829,7 +5994,7 @@ var ts; case 68: case 115: case 76: - case 120: + case 121: if (isDeclarationStart()) { return false; } @@ -5870,11 +6035,11 @@ var ts; case 99: return parseWhileStatement(); case 81: - return parseForOrForInStatement(); + return parseForOrForInOrForOfStatement(); case 70: - return parseBreakOrContinueStatement(179); + return parseBreakOrContinueStatement(182); case 65: - return parseBreakOrContinueStatement(180); + return parseBreakOrContinueStatement(183); case 89: return parseReturnStatement(); case 100: @@ -5934,16 +6099,16 @@ var ts; } function parseArrayBindingElement() { if (token === 23) { - return createNode(168); + return createNode(170); } - var node = createNode(146); + var node = createNode(148); node.dotDotDotToken = parseOptionalToken(21); node.name = parseIdentifierOrPattern(); node.initializer = parseInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(146); + var node = createNode(148); var id = parsePropertyName(); if (id.kind === 64 && token !== 51) { node.name = id; @@ -5957,14 +6122,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(144); + var node = createNode(146); parseExpected(14); node.elements = parseDelimitedList(10, parseObjectBindingElement); parseExpected(15); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(145); + var node = createNode(147); parseExpected(18); node.elements = parseDelimitedList(11, parseArrayBindingElement); parseExpected(19); @@ -5983,14 +6148,16 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(188); + var node = createNode(191); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); - node.initializer = parseInitializer(false); + if (!isInOrOfKeyword(token)) { + node.initializer = parseInitializer(false); + } return finishNode(node); } - function parseVariableDeclarationList(disallowIn) { - var node = createNode(189); + function parseVariableDeclarationList(inForStatementInitializer) { + var node = createNode(192); switch (token) { case 97: break; @@ -6004,21 +6171,29 @@ var ts; ts.Debug.fail(); } nextToken(); - var savedDisallowIn = inDisallowInContext(); - setDisallowInContext(disallowIn); - node.declarations = parseDelimitedList(9, parseVariableDeclaration); - setDisallowInContext(savedDisallowIn); + if (token === 122 && lookAhead(canFollowContextualOfKeyword)) { + node.declarations = createMissingList(); + } + else { + var savedDisallowIn = inDisallowInContext(); + setDisallowInContext(inForStatementInitializer); + node.declarations = parseDelimitedList(9, parseVariableDeclaration); + setDisallowInContext(savedDisallowIn); + } return finishNode(node); } + function canFollowContextualOfKeyword() { + return nextTokenIsIdentifier() && nextToken() === 17; + } function parseVariableStatement(fullStart, modifiers) { - var node = createNode(171, fullStart); + var node = createNode(173, fullStart); setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); parseSemicolon(); return finishNode(node); } function parseFunctionDeclaration(fullStart, modifiers) { - var node = createNode(190, fullStart); + var node = createNode(193, fullStart); setModifiers(node, modifiers); parseExpected(82); node.asteriskToken = parseOptionalToken(35); @@ -6028,7 +6203,7 @@ var ts; return finishNode(node); } function parseConstructorDeclaration(pos, modifiers) { - var node = createNode(129, pos); + var node = createNode(131, pos); setModifiers(node, modifiers); parseExpected(112); fillSignature(51, false, false, node); @@ -6036,7 +6211,7 @@ var ts; return finishNode(node); } function parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(128, fullStart); + var method = createNode(130, fullStart); setModifiers(method, modifiers); method.asteriskToken = asteriskToken; method.name = name; @@ -6053,7 +6228,7 @@ var ts; return parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); } else { - var property = createNode(126, fullStart); + var property = createNode(128, fullStart); setModifiers(property, modifiers); property.name = name; property.questionToken = questionToken; @@ -6142,13 +6317,17 @@ var ts; if (isIndexSignature()) { return parseIndexSignatureDeclaration(modifiers); } - if (isIdentifierOrKeyword() || token === 8 || token === 7 || token === 35 || token === 18) { + if (isIdentifierOrKeyword() || + token === 8 || + token === 7 || + token === 35 || + token === 18) { return parsePropertyOrMethodDeclaration(fullStart, modifiers); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassDeclaration(fullStart, modifiers) { - var node = createNode(191, fullStart); + var node = createNode(194, fullStart); setModifiers(node, modifiers); parseExpected(68); node.name = parseIdentifier(); @@ -6174,7 +6353,7 @@ var ts; } function parseHeritageClause() { if (token === 78 || token === 101) { - var node = createNode(202); + var node = createNode(205); node.token = token; nextToken(); node.types = parseDelimitedList(8, parseTypeReference); @@ -6189,7 +6368,7 @@ var ts; return parseList(6, false, parseClassElement); } function parseInterfaceDeclaration(fullStart, modifiers) { - var node = createNode(192, fullStart); + var node = createNode(195, fullStart); setModifiers(node, modifiers); parseExpected(102); node.name = parseIdentifier(); @@ -6199,9 +6378,9 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, modifiers) { - var node = createNode(193, fullStart); + var node = createNode(196, fullStart); setModifiers(node, modifiers); - parseExpected(120); + parseExpected(121); node.name = parseIdentifier(); parseExpected(52); node.type = parseType(); @@ -6209,13 +6388,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(206, scanner.getStartPos()); + var node = createNode(209, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, modifiers) { - var node = createNode(194, fullStart); + var node = createNode(197, fullStart); setModifiers(node, modifiers); parseExpected(76); node.name = parseIdentifier(); @@ -6229,7 +6408,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(196, scanner.getStartPos()); + var node = createNode(199, scanner.getStartPos()); if (parseExpected(14)) { node.statements = parseList(1, false, parseModuleElement); parseExpected(15); @@ -6240,7 +6419,7 @@ var ts; return finishNode(node); } function parseInternalModuleTail(fullStart, modifiers, flags) { - var node = createNode(195, fullStart); + var node = createNode(198, fullStart); setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); @@ -6248,7 +6427,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, modifiers) { - var node = createNode(195, fullStart); + var node = createNode(198, fullStart); setModifiers(node, modifiers); node.name = parseLiteralNode(true); node.body = parseModuleBlock(); @@ -6259,13 +6438,14 @@ var ts; return token === 8 ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); } function isExternalModuleReference() { - return token === 116 && lookAhead(nextTokenIsOpenParen); + return token === 116 && + lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { return nextToken() === 16; } function parseImportDeclaration(fullStart, modifiers) { - var node = createNode(197, fullStart); + var node = createNode(200, fullStart); setModifiers(node, modifiers); parseExpected(84); node.name = parseIdentifier(); @@ -6278,7 +6458,7 @@ var ts; return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(199); + var node = createNode(202); parseExpected(116); parseExpected(16); node.expression = parseExpression(); @@ -6289,7 +6469,7 @@ var ts; return finishNode(node); } function parseExportAssignmentTail(fullStart, modifiers) { - var node = createNode(198, fullStart); + var node = createNode(201, fullStart); setModifiers(node, modifiers); node.exportName = parseIdentifier(); parseSemicolon(); @@ -6310,7 +6490,7 @@ var ts; case 102: case 76: case 84: - case 120: + case 121: return lookAhead(nextTokenIsIdentifierOrKeyword); case 115: return lookAhead(nextTokenIsIdentifierOrKeywordOrStringLiteral); @@ -6363,7 +6543,7 @@ var ts; return parseClassDeclaration(fullStart, modifiers); case 102: return parseInterfaceDeclaration(fullStart, modifiers); - case 120: + case 121: return parseTypeAliasDeclaration(fullStart, modifiers); case 76: return parseEnumDeclaration(fullStart, modifiers); @@ -6442,27 +6622,29 @@ var ts; sourceFile.amdModuleName = amdModuleName; } function setExternalModuleIndicator(sourceFile) { - sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 || node.kind === 197 && node.moduleReference.kind === 199 || node.kind === 198 ? node : undefined; }); + sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { + return node.flags & 1 || node.kind === 200 && node.moduleReference.kind === 202 || node.kind === 201 ? node : undefined; + }); } } function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 149: - case 150: - case 152: case 151: + case 152: + case 154: case 153: - case 147: case 155: - case 148: - case 156: + case 149: + case 157: + case 150: + case 158: case 64: case 9: case 7: case 8: case 10: - case 165: + case 167: case 79: case 88: case 92: @@ -6483,16 +6665,16 @@ var ts; (function (ts) { ts.bindTime = 0; function getModuleInstanceState(node) { - if (node.kind === 192 || node.kind === 193) { + if (node.kind === 195 || node.kind === 196) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if (node.kind === 197 && !(node.flags & 1)) { + else if (node.kind === 200 && !(node.flags & 1)) { return 0; } - else if (node.kind === 196) { + else if (node.kind === 199) { var state = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -6508,7 +6690,7 @@ var ts; }); return state; } - else if (node.kind === 195) { + else if (node.kind === 198) { return getModuleInstanceState(node.body); } else { @@ -6516,10 +6698,6 @@ var ts; } } ts.getModuleInstanceState = getModuleInstanceState; - function hasDynamicName(declaration) { - return declaration.name && declaration.name.kind === 122; - } - ts.hasDynamicName = hasDynamicName; function bindSourceFile(file) { var start = new Date().getTime(); bindSourceFileWorker(file); @@ -6558,22 +6736,26 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 195 && node.name.kind === 8) { + if (node.kind === 198 && node.name.kind === 8) { return '"' + node.name.text + '"'; } - ts.Debug.assert(!hasDynamicName(node)); + if (node.name.kind === 124) { + var nameExpression = node.name.expression; + ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); + return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); + } return node.name.text; } switch (node.kind) { - case 137: - case 129: + case 139: + case 131: return "__constructor"; - case 136: - case 132: - return "__call"; - case 133: - return "__new"; + case 138: case 134: + return "__call"; + case 135: + return "__new"; + case 136: return "__index"; } } @@ -6581,7 +6763,7 @@ var ts; return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); } function declareSymbol(symbols, parent, node, includes, excludes) { - ts.Debug.assert(!hasDynamicName(node)); + ts.Debug.assert(!ts.hasDynamicName(node)); var name = getDeclarationName(node); if (name !== undefined) { var symbol = ts.hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name)); @@ -6602,7 +6784,7 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if (node.kind === 191 && symbol.exports) { + if (node.kind === 194 && symbol.exports) { var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { @@ -6634,7 +6816,7 @@ var ts; if (symbolKind & 1536) { exportKind |= 4194304; } - if (ts.getCombinedNodeFlags(node) & 1 || (node.kind !== 197 && isAmbientContext(container))) { + if (ts.getCombinedNodeFlags(node) & 1 || (node.kind !== 200 && isAmbientContext(container))) { if (exportKind) { var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); @@ -6673,40 +6855,40 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 195: + case 198: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 207: + case 210: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; } + case 138: + case 139: + case 134: + case 135: case 136: - case 137: + case 130: + case 129: + case 131: case 132: case 133: - case 134: - case 128: - case 127: - case 129: - case 130: - case 131: - case 190: - case 156: - case 157: + case 193: + case 158: + case 159: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 191: + case 194: if (node.flags & 128) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } - case 139: - case 148: - case 192: + case 141: + case 150: + case 195: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 194: + case 197: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } @@ -6739,7 +6921,7 @@ var ts; var typeLiteralSymbol = createSymbol(2048, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, 2048); typeLiteralSymbol.members = {}; - typeLiteralSymbol.members[node.kind === 136 ? "__call" : "__new"] = symbol; + typeLiteralSymbol.members[node.kind === 138 ? "__call" : "__new"] = symbol; } function bindAnonymousDeclaration(node, symbolKind, name, isBlockScopeContainer) { var symbol = createSymbol(symbolKind, name); @@ -6758,10 +6940,10 @@ var ts; } function bindBlockScopedVariableDeclaration(node) { switch (blockScopeContainer.kind) { - case 195: + case 198: declareModuleMember(node, 2, 107455); break; - case 207: + case 210: if (ts.isExternalModule(container)) { declareModuleMember(node, 2, 107455); break; @@ -6780,14 +6962,14 @@ var ts; function bind(node) { node.parent = parent; switch (node.kind) { - case 123: + case 125: bindDeclaration(node, 262144, 530912, false); break; - case 124: + case 126: bindParameter(node); break; - case 188: - case 146: + case 191: + case 148: if (ts.isBindingPattern(node.name)) { bindChildren(node, 0, false); } @@ -6798,65 +6980,65 @@ var ts; bindDeclaration(node, 1, 107454, false); } break; - case 126: - case 125: - bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); - break; - case 204: - case 205: - bindPropertyOrMethodOrAccessor(node, 4, 107455, false); - break; - case 206: - bindPropertyOrMethodOrAccessor(node, 8, 107455, false); - break; - case 132: - case 133: - case 134: - bindDeclaration(node, 131072, 0, false); - break; case 128: case 127: - bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263, true); + bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); break; - case 190: - bindDeclaration(node, 16, 106927, true); + case 207: + case 208: + bindPropertyOrMethodOrAccessor(node, 4, 107455, false); break; - case 129: - bindDeclaration(node, 16384, 0, true); + case 209: + bindPropertyOrMethodOrAccessor(node, 8, 107455, false); + break; + case 134: + case 135: + case 136: + bindDeclaration(node, 131072, 0, false); break; case 130: - bindPropertyOrMethodOrAccessor(node, 32768, 41919, true); - break; - case 131: - bindPropertyOrMethodOrAccessor(node, 65536, 74687, true); - break; - case 136: - case 137: - bindFunctionOrConstructorType(node); - break; - case 139: - bindAnonymousDeclaration(node, 2048, "__type", false); - break; - case 148: - bindAnonymousDeclaration(node, 4096, "__object", false); - break; - case 156: - case 157: - bindAnonymousDeclaration(node, 16, "__function", true); - break; - case 203: - bindCatchVariableDeclaration(node); - break; - case 191: - bindDeclaration(node, 32, 899583, false); - break; - case 192: - bindDeclaration(node, 64, 792992, false); + case 129: + bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263, true); break; case 193: - bindDeclaration(node, 524288, 793056, false); + bindDeclaration(node, 16, 106927, true); + break; + case 131: + bindDeclaration(node, 16384, 0, true); + break; + case 132: + bindPropertyOrMethodOrAccessor(node, 32768, 41919, true); + break; + case 133: + bindPropertyOrMethodOrAccessor(node, 65536, 74687, true); + break; + case 138: + case 139: + bindFunctionOrConstructorType(node); + break; + case 141: + bindAnonymousDeclaration(node, 2048, "__type", false); + break; + case 150: + bindAnonymousDeclaration(node, 4096, "__object", false); + break; + case 158: + case 159: + bindAnonymousDeclaration(node, 16, "__function", true); + break; + case 206: + bindCatchVariableDeclaration(node); break; case 194: + bindDeclaration(node, 32, 899583, false); + break; + case 195: + bindDeclaration(node, 64, 792992, false); + break; + case 196: + bindDeclaration(node, 524288, 793056, false); + break; + case 197: if (ts.isConst(node)) { bindDeclaration(node, 128, 899967, false); } @@ -6864,22 +7046,25 @@ var ts; bindDeclaration(node, 256, 899327, false); } break; - case 195: + case 198: bindModuleDeclaration(node); break; - case 197: + case 200: bindDeclaration(node, 8388608, 8388608, false); break; - case 207: + case 210: if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; } - case 170: - case 203: - case 177: - case 178: - case 183: + case 172: + bindChildren(node, 0, !ts.isAnyFunction(node.parent)); + break; + case 206: + case 179: + case 180: + case 181: + case 186: bindChildren(node, 0, true); break; default: @@ -6896,13 +7081,15 @@ var ts; else { bindDeclaration(node, 1, 107455, false); } - if (node.flags & 112 && node.parent.kind === 129 && node.parent.parent.kind === 191) { + if (node.flags & 112 && + node.parent.kind === 131 && + node.parent.parent.kind === 194) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } } function bindPropertyOrMethodOrAccessor(node, symbolKind, symbolExcludes, isBlockScopeContainer) { - if (hasDynamicName(node)) { + if (ts.hasDynamicName(node)) { bindAnonymousDeclaration(node, symbolKind, "__computed", isBlockScopeContainer); } else { @@ -6970,6 +7157,7 @@ var ts; var stringType = createIntrinsicType(2, "string"); var numberType = createIntrinsicType(4, "number"); var booleanType = createIntrinsicType(8, "boolean"); + var esSymbolType = createIntrinsicType(1048576, "symbol"); var voidType = createIntrinsicType(16, "void"); var undefinedType = createIntrinsicType(32 | 262144, "undefined"); var nullType = createIntrinsicType(64 | 262144, "null"); @@ -6983,6 +7171,7 @@ var ts; var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, 0, false, false); var globals = {}; var globalArraySymbol; + var globalESSymbolConstructorSymbol; var globalObjectType; var globalFunctionType; var globalArrayType; @@ -6991,6 +7180,7 @@ var ts; var globalBooleanType; var globalRegExpType; var globalTemplateStringsArrayType; + var globalESSymbolType; var anyArrayType; var tupleTypes = {}; var unionTypes = {}; @@ -7013,6 +7203,10 @@ var ts; "boolean": { type: booleanType, flags: 8 + }, + "symbol": { + type: esSymbolType, + flags: 1048576 } }; function getEmitResolver(sourceFile) { @@ -7153,10 +7347,10 @@ var ts; return nodeLinks[node.id] || (nodeLinks[node.id] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 207); + return ts.getAncestor(node, 210); } function isGlobalSourceFile(node) { - return node.kind === 207 && !ts.isExternalModule(node); + return node.kind === 210 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -7197,22 +7391,22 @@ var ts; } } switch (location.kind) { - case 207: + case 210: if (!ts.isExternalModule(location)) break; - case 195: + case 198: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { break loop; } break; - case 194: + case 197: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; - case 126: - case 125: - if (location.parent.kind === 191 && !(location.flags & 128)) { + case 128: + case 127: + if (location.parent.kind === 194 && !(location.flags & 128)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455)) { @@ -7221,8 +7415,8 @@ var ts; } } break; - case 191: - case 192: + case 194: + case 195: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { if (lastLocation && lastLocation.flags & 128) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -7231,28 +7425,28 @@ var ts; break loop; } break; - case 122: + case 124: var grandparent = location.parent.parent; - if (grandparent.kind === 191 || grandparent.kind === 192) { + if (grandparent.kind === 194 || grandparent.kind === 195) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; } } break; - case 128: - case 127: - case 129: case 130: + case 129: case 131: - case 190: - case 157: + case 132: + case 133: + case 193: + case 159: if (name === "arguments") { result = argumentsSymbol; break loop; } break; - case 156: + case 158: if (name === "arguments") { result = argumentsSymbol; break loop; @@ -7263,7 +7457,7 @@ var ts; break loop; } break; - case 203: + case 206: var id = location.name; if (name === id.text) { result = location.symbol; @@ -7304,13 +7498,13 @@ var ts; var links = getSymbolLinks(symbol); if (!links.target) { links.target = resolvingSymbol; - var node = ts.getDeclarationOfKind(symbol, 197); - if (node.moduleReference.kind === 199) { + var node = ts.getDeclarationOfKind(symbol, 200); + if (node.moduleReference.kind === 202) { if (node.moduleReference.expression.kind !== 8) { grammarErrorOnNode(node.moduleReference.expression, ts.Diagnostics.String_literal_expected); } } - var target = node.moduleReference.kind === 199 ? resolveExternalModuleName(node, ts.getExternalModuleImportDeclarationExpression(node)) : getSymbolOfPartOfRightHandSideOfImport(node.moduleReference, node); + var target = node.moduleReference.kind === 202 ? resolveExternalModuleName(node, ts.getExternalModuleImportDeclarationExpression(node)) : getSymbolOfPartOfRightHandSideOfImport(node.moduleReference, node); if (links.target === resolvingSymbol) { links.target = target || unknownSymbol; } @@ -7325,17 +7519,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImport(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 197); + importDeclaration = ts.getAncestor(entityName, 200); ts.Debug.assert(importDeclaration !== undefined); } if (entityName.kind === 64 && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 64 || entityName.parent.kind === 121) { + if (entityName.kind === 64 || entityName.parent.kind === 123) { return resolveEntityName(importDeclaration, entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 197); + ts.Debug.assert(entityName.parent.kind === 200); return resolveEntityName(importDeclaration, entityName, 107455 | 793056 | 1536); } } @@ -7352,7 +7546,7 @@ var ts; return; } } - else if (name.kind === 121) { + else if (name.kind === 123) { var namespace = resolveEntityName(location, name.left, 1536); if (!namespace || namespace === unknownSymbol || ts.getFullWidth(name.right) === 0) return; @@ -7444,9 +7638,9 @@ var ts; var seenExportedMember = false; var result = []; ts.forEach(symbol.declarations, function (declaration) { - var block = (declaration.kind === 207 ? declaration : declaration.body); + var block = (declaration.kind === 210 ? declaration : declaration.body); ts.forEach(block.statements, function (node) { - if (node.kind === 198) { + if (node.kind === 201) { result.push(node); } else { @@ -7488,7 +7682,7 @@ var ts; var members = node.members; for (var i = 0; i < members.length; i++) { var member = members[i]; - if (member.kind === 129 && ts.nodeIsPresent(member.body)) { + if (member.kind === 131 && ts.nodeIsPresent(member.body)) { return member; } } @@ -7509,7 +7703,10 @@ var ts; return type; } function isReservedMemberName(name) { - return name.charCodeAt(0) === 95 && name.charCodeAt(1) === 95 && name.charCodeAt(2) !== 95; + return name.charCodeAt(0) === 95 && + name.charCodeAt(1) === 95 && + name.charCodeAt(2) !== 95 && + name.charCodeAt(2) !== 64; } function getNamedMembers(members) { var result; @@ -7550,17 +7747,17 @@ var ts; } } switch (location.kind) { - case 207: + case 210: if (!ts.isExternalModule(location)) { break; } - case 195: + case 198: if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; - case 191: - case 192: + case 194: + case 195: if (result = callback(getSymbolOfNode(location).members)) { return result; } @@ -7583,7 +7780,8 @@ var ts; } function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { - return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && canQualifySymbol(symbolFromSymbolTable, meaning); + return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && + canQualifySymbol(symbolFromSymbolTable, meaning); } } if (isAccessible(ts.lookUp(symbols, symbol.name))) { @@ -7591,7 +7789,8 @@ var ts; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608) { - if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportDeclaration)) { + if (!useOnlyExternalAliasing || + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportDeclaration)) { var resolvedImportedSymbol = resolveImport(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveImport(symbolFromSymbolTable))) { return [symbolFromSymbolTable]; @@ -7673,7 +7872,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 195 && declaration.name.kind === 8) || (declaration.kind === 207 && ts.isExternalModule(declaration)); + return (declaration.kind === 198 && declaration.name.kind === 8) || + (declaration.kind === 210 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -7683,7 +7883,9 @@ var ts; return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { - if (declaration.kind === 197 && !(declaration.flags & 1) && isDeclarationVisible(declaration.parent)) { + if (declaration.kind === 200 && + !(declaration.flags & 1) && + isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, declaration)) { @@ -7702,10 +7904,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 138) { + if (entityName.parent.kind === 140) { meaning = 107455 | 1048576; } - else if (entityName.kind === 121 || entityName.parent.kind === 197) { + else if (entityName.kind === 123 || + entityName.parent.kind === 200) { meaning = 1536; } else { @@ -7749,10 +7952,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { var node = type.symbol.declarations[0].parent; - while (node.kind === 143) { + while (node.kind === 145) { node = node.parent; } - if (node.kind === 193) { + if (node.kind === 196) { return getSymbolOfNode(node); } } @@ -7791,7 +7994,8 @@ var ts; function walkSymbol(symbol, meaning) { if (symbol) { var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); - if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + if (!accessibleSymbolChain || + needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { @@ -7822,8 +8026,9 @@ var ts; var globalFlagsToPass = globalFlags & 16; return writeType(type, globalFlags); function writeType(type, flags) { - if (type.flags & 127) { - writer.writeKeyword(!(globalFlags & 16) && (type.flags & 1) ? "any" : type.intrinsicName); + if (type.flags & 1048703) { + writer.writeKeyword(!(globalFlags & 16) && + (type.flags & 1) ? "any" : type.intrinsicName); } else if (type.flags & 4096) { writeTypeReference(type, flags); @@ -7916,10 +8121,16 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { - var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128; })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { return declaration.parent.kind === 207 || declaration.parent.kind === 196; })); + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && + ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128; })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && + (type.symbol.parent || + ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.parent.kind === 210 || declaration.parent.kind === 199; + })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { - return !!(flags & 2) || (typeStack && ts.contains(typeStack, type)); + return !!(flags & 2) || + (typeStack && ts.contains(typeStack, type)); } } } @@ -8144,12 +8355,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 195) { + if (node.kind === 198) { if (node.name.kind === 8) { return node; } } - else if (node.kind === 207) { + else if (node.kind === 210) { return ts.isExternalModule(node) ? node : undefined; } } @@ -8191,46 +8402,47 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 188: - case 146: - case 195: case 191: - case 192: - case 193: - case 190: + case 148: + case 198: case 194: + case 195: + case 196: + case 193: case 197: + case 200: var parent = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 1) && !(node.kind !== 197 && parent.kind !== 207 && ts.isInAmbientContext(parent))) { + if (!(ts.getCombinedNodeFlags(node) & 1) && + !(node.kind !== 200 && parent.kind !== 210 && ts.isInAmbientContext(parent))) { return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); } return isDeclarationVisible(parent); - case 126: - case 125: - case 130: - case 131: case 128: case 127: + case 132: + case 133: + case 130: + case 129: if (node.flags & (32 | 64)) { return false; } - case 129: - case 133: - case 132: - case 134: - case 124: - case 196: - case 136: - case 137: - case 139: + case 131: case 135: - case 140: + case 134: + case 136: + case 126: + case 199: + case 138: + case 139: case 141: + case 137: case 142: case 143: + case 144: + case 145: return isDeclarationVisible(node.parent); - case 123: - case 207: + case 125: + case 210: return true; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -8245,14 +8457,14 @@ var ts; } } function getRootDeclaration(node) { - while (node.kind === 146) { + while (node.kind === 148) { node = node.parent.parent; } return node; } function getDeclarationContainer(node) { node = getRootDeclaration(node); - return node.kind === 188 ? node.parent.parent.parent : node.parent; + return node.kind === 191 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); @@ -8274,16 +8486,18 @@ var ts; } return parentType; } - if (pattern.kind === 144) { + if (pattern.kind === 146) { var name = declaration.propertyName || declaration.name; - var type = getTypeOfPropertyOfType(parentType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); + var type = getTypeOfPropertyOfType(parentType, name.text) || + isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1) || + getIndexTypeOfType(parentType, 0); if (!type) { error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); return unknownType; } } else { - if (!isTypeAssignableTo(parentType, anyArrayType)) { + if (!isArrayLikeType(parentType)) { error(pattern, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(parentType)); return unknownType; } @@ -8302,7 +8516,7 @@ var ts; return type; } function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 178) { + if (declaration.parent.parent.kind === 180) { return anyType; } if (ts.isBindingPattern(declaration.parent)) { @@ -8311,10 +8525,10 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 124) { + if (declaration.kind === 126) { var func = declaration.parent; - if (func.kind === 131 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 130); + if (func.kind === 133 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 132); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -8327,7 +8541,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 205) { + if (declaration.kind === 208) { return checkIdentifier(declaration.name); } return undefined; @@ -8356,7 +8570,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 168 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 170 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -8364,7 +8578,7 @@ var ts; return !elementTypes.length ? anyArrayType : hasSpreadElement ? createArrayType(getUnionType(elementTypes)) : createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern) { - return pattern.kind === 144 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); + return pattern.kind === 146 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { var type = getTypeForVariableLikeDeclaration(declaration); @@ -8372,7 +8586,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 204 ? getWidenedType(type) : type; + return declaration.kind !== 207 ? getWidenedType(type) : type; } if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name); @@ -8380,7 +8594,7 @@ var ts; type = declaration.dotDotDotToken ? anyArrayType : anyType; if (reportErrors && compilerOptions.noImplicitAny) { var root = getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 124 && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 126 && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -8393,7 +8607,7 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.kind === 203) { + if (declaration.kind === 206) { return links.type = anyType; } links.type = resolvingType; @@ -8416,7 +8630,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 130) { + if (accessor.kind === 132) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -8435,8 +8649,8 @@ var ts; links = links || getSymbolLinks(symbol); if (!links.type) { links.type = resolvingType; - var getter = ts.getDeclarationOfKind(symbol, 130); - var setter = ts.getDeclarationOfKind(symbol, 131); + var getter = ts.getDeclarationOfKind(symbol, 132); + var setter = ts.getDeclarationOfKind(symbol, 133); var type; var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { @@ -8466,7 +8680,7 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 130); + var getter = ts.getDeclarationOfKind(symbol, 132); error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -8533,7 +8747,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 192 || node.kind === 191) { + if (node.kind === 195 || node.kind === 194) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -8564,7 +8778,7 @@ var ts; type.typeArguments = type.typeParameters; } type.baseTypes = []; - var declaration = ts.getDeclarationOfKind(symbol, 191); + var declaration = ts.getDeclarationOfKind(symbol, 194); var baseTypeNode = ts.getClassBaseTypeNode(declaration); if (baseTypeNode) { var baseType = getTypeFromTypeReferenceNode(baseTypeNode); @@ -8605,7 +8819,7 @@ var ts; } type.baseTypes = []; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 192 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 195 && ts.getInterfaceBaseTypeNodes(declaration)) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), function (node) { var baseType = getTypeFromTypeReferenceNode(node); if (baseType !== unknownType) { @@ -8636,7 +8850,7 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = ts.getDeclarationOfKind(symbol, 193); + var declaration = ts.getDeclarationOfKind(symbol, 196); var type = getTypeFromTypeNode(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; @@ -8644,7 +8858,7 @@ var ts; } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 193); + var declaration = ts.getDeclarationOfKind(symbol, 196); error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; @@ -8663,7 +8877,7 @@ var ts; if (!links.declaredType) { var type = createType(512); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 123).constraint) { + if (!ts.getDeclarationOfKind(symbol, 125).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -8964,6 +9178,9 @@ var ts; else if (type.flags & 8) { type = globalBooleanType; } + else if (type.flags & 1048576) { + type = globalESSymbolType; + } return type; } function createUnionProperty(unionType, name) { @@ -9066,7 +9283,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 129 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 131 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; @@ -9094,8 +9311,8 @@ var ts; returnType = getTypeFromTypeNode(declaration.type); } else { - if (declaration.kind === 130 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 131); + if (declaration.kind === 132 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 133); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { @@ -9113,19 +9330,19 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 136: - case 137: - case 190: - case 128: - case 127: + case 138: + case 139: + case 193: + case 130: case 129: + case 131: + case 134: + case 135: + case 136: case 132: case 133: - case 134: - case 130: - case 131: - case 156: - case 157: + case 158: + case 159: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -9194,7 +9411,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 129 || signature.declaration.kind === 133; + var isConstructor = signature.declaration.kind === 131 || signature.declaration.kind === 135; var type = createObjectType(32768 | 65536); type.members = emptySymbols; type.properties = emptyArray; @@ -9235,7 +9452,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 123).constraint); + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 125).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -9283,13 +9500,13 @@ var ts; while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 123; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 125; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 135 && n.typeName.kind === 64) { + if (n.kind === 137 && n.typeName.kind === 64) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); @@ -9354,9 +9571,9 @@ var ts; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; switch (declaration.kind) { - case 191: - case 192: case 194: + case 195: + case 197: return declaration; } } @@ -9375,11 +9592,20 @@ var ts; } return type; } - function getGlobalSymbol(name) { - return resolveName(undefined, name, 793056, ts.Diagnostics.Cannot_find_global_type_0, name); + function getGlobalValueSymbol(name) { + return getGlobalSymbol(name, 107455, ts.Diagnostics.Cannot_find_global_value_0); + } + function getGlobalTypeSymbol(name) { + return getGlobalSymbol(name, 793056, ts.Diagnostics.Cannot_find_global_type_0); + } + function getGlobalSymbol(name, meaning, diagnostic) { + return resolveName(undefined, name, meaning, diagnostic, name); } function getGlobalType(name) { - return getTypeOfGlobalSymbol(getGlobalSymbol(name), 0); + return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), 0); + } + function getGlobalESSymbolConstructorSymbol() { + return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); } function createArrayType(elementType) { var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); @@ -9528,28 +9754,30 @@ var ts; return numberType; case 111: return booleanType; + case 120: + return esSymbolType; case 98: return voidType; case 8: return getTypeFromStringLiteral(node); - case 135: - return getTypeFromTypeReferenceNode(node); - case 138: - return getTypeFromTypeQueryNode(node); - case 140: - return getTypeFromArrayTypeNode(node); - case 141: - return getTypeFromTupleTypeNode(node); - case 142: - return getTypeFromUnionTypeNode(node); - case 143: - return getTypeFromTypeNode(node.type); - case 136: case 137: + return getTypeFromTypeReferenceNode(node); + case 140: + return getTypeFromTypeQueryNode(node); + case 142: + return getTypeFromArrayTypeNode(node); + case 143: + return getTypeFromTupleTypeNode(node); + case 144: + return getTypeFromUnionTypeNode(node); + case 145: + return getTypeFromTypeNode(node.type); + case 138: case 139: + case 141: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 64: - case 121: + case 123: var symbol = getSymbolInfo(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: @@ -9693,25 +9921,27 @@ var ts; return type; } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 128 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 156: - case 157: + case 158: + case 159: return isContextSensitiveFunctionLikeDeclaration(node); - case 148: + case 150: return ts.forEach(node.properties, isContextSensitive); - case 147: + case 149: return ts.forEach(node.elements, isContextSensitive); - case 164: - return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 163: - return node.operator === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 204: + case 166: + return isContextSensitive(node.whenTrue) || + isContextSensitive(node.whenFalse); + case 165: + return node.operatorToken.kind === 49 && + (isContextSensitive(node.left) || isContextSensitive(node.right)); + case 207: return isContextSensitive(node.initializer); - case 128: - case 127: + case 130: + case 129: return isContextSensitiveFunctionLikeDeclaration(node); - case 155: + case 157: return isContextSensitive(node.expression); } return false; @@ -9856,7 +10086,8 @@ var ts; } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && + (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; return result; } @@ -10313,7 +10544,9 @@ var ts; if (source === target) { return -1; } - if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { + if (source.parameters.length !== target.parameters.length || + source.minArgumentCount !== target.minArgumentCount || + source.hasRestParameter !== target.hasRestParameter) { return 0; } var result = -1; @@ -10387,6 +10620,9 @@ var ts; function isArrayType(type) { return type.flags & 4096 && type.target === globalArrayType; } + function isArrayLikeType(type) { + return !(type.flags & (32 | 64)) && isTypeAssignableTo(type, anyArrayType); + } function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); } @@ -10464,20 +10700,20 @@ var ts; function reportImplicitAnyError(declaration, type) { var typeAsString = typeToString(getWidenedType(type)); switch (declaration.kind) { - case 126: - case 125: - var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; - break; - case 124: - var diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; - break; - case 190: case 128: case 127: + var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; + break; + case 126: + var diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + break; + case 193: case 130: - case 131: - case 156: - case 157: + case 129: + case 132: + case 133: + case 158: + case 159: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -10610,7 +10846,8 @@ var ts; inferFromTypes(sourceTypes[i], target); } } - else if (source.flags & 48128 && (target.flags & (4096 | 8192) || (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { + else if (source.flags & 48128 && (target.flags & (4096 | 8192) || + (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -10705,10 +10942,10 @@ var ts; function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 138: + case 140: return true; case 64: - case 121: + case 123: node = node.parent; continue; default: @@ -10745,9 +10982,9 @@ var ts; } return links.assignmentChecks[symbol.id] = isAssignedIn(node); function isAssignedInBinaryExpression(node) { - if (node.operator >= 52 && node.operator <= 63) { + if (node.operatorToken.kind >= 52 && node.operatorToken.kind <= 63) { var n = node.left; - while (n.kind === 155) { + while (n.kind === 157) { n = n.expression; } if (n.kind === 64 && getResolvedSymbol(n) === symbol) { @@ -10764,45 +11001,46 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 163: + case 165: return isAssignedInBinaryExpression(node); - case 188: - case 146: - return isAssignedInVariableDeclaration(node); - case 144: - case 145: - case 147: + case 191: case 148: + return isAssignedInVariableDeclaration(node); + case 146: + case 147: case 149: case 150: case 151: case 152: + case 153: case 154: - case 155: - case 161: - case 158: - case 159: + case 156: + case 157: + case 163: case 160: + case 161: case 162: case 164: - case 167: - case 170: - case 171: + case 166: + case 169: + case 172: case 173: - case 174: case 175: case 176: case 177: case 178: + case 179: + case 180: case 181: - case 182: - case 183: - case 200: - case 201: case 184: case 185: case 186: case 203: + case 204: + case 187: + case 188: + case 189: + case 206: return ts.forEachChild(node, isAssignedIn); } return false; @@ -10811,13 +11049,12 @@ var ts; function resolveLocation(node) { var containerNodes = []; for (var parent = node.parent; parent; parent = parent.parent) { - if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(parent)) { + if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && + isContextSensitive(parent)) { containerNodes.unshift(parent); } } - ts.forEach(containerNodes, function (node) { - getTypeOfNode(node); - }); + ts.forEach(containerNodes, function (node) { getTypeOfNode(node); }); } function getSymbolAtLocation(node) { resolveLocation(node); @@ -10839,34 +11076,34 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 174: + case 176: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } break; - case 164: + case 166: if (child !== node.condition) { narrowedType = narrowType(type, node.condition, child === node.whenTrue); } break; - case 163: + case 165: if (child === node.right) { - if (node.operator === 48) { + if (node.operatorToken.kind === 48) { narrowedType = narrowType(type, node.left, true); } - else if (node.operator === 49) { + else if (node.operatorToken.kind === 49) { narrowedType = narrowType(type, node.left, false); } } break; - case 207: - case 195: - case 190: - case 128: - case 127: + case 210: + case 198: + case 193: case 130: - case 131: case 129: + case 132: + case 133: + case 131: break loop; } if (narrowedType !== type) { @@ -10879,7 +11116,7 @@ var ts; } return type; function narrowTypeByEquality(type, expr, assumeTrue) { - if (expr.left.kind !== 159 || expr.right.kind !== 8) { + if (expr.left.kind !== 161 || expr.right.kind !== 8) { return type; } var left = expr.left; @@ -10888,12 +11125,12 @@ var ts; return type; } var typeInfo = primitiveTypeInfo[right.text]; - if (expr.operator === 31) { + if (expr.operatorToken.kind === 31) { assumeTrue = !assumeTrue; } if (assumeTrue) { if (!typeInfo) { - return removeTypesFromUnionType(type, 258 | 132 | 8, true); + return removeTypesFromUnionType(type, 258 | 132 | 8 | 1048576, true); } if (isTypeSubtypeOf(typeInfo.type, type)) { return typeInfo.type; @@ -10952,10 +11189,10 @@ var ts; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 155: + case 157: return narrowType(type, expr.expression, assumeTrue); - case 163: - var operator = expr.operator; + case 165: + var operator = expr.operatorToken.kind; if (operator === 30 || operator === 31) { return narrowTypeByEquality(type, expr, assumeTrue); } @@ -10969,7 +11206,7 @@ var ts; return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 161: + case 163: if (expr.operator === 46) { return narrowType(type, expr.operand, !assumeTrue); } @@ -10985,19 +11222,21 @@ var ts; nodeLinks.importOnRightSide = undefined; getSymbolLinks(rightSide).referenced = true; ts.Debug.assert((rightSide.flags & 8388608) !== 0); - nodeLinks = getNodeLinks(ts.getDeclarationOfKind(rightSide, 197)); + nodeLinks = getNodeLinks(ts.getDeclarationOfKind(rightSide, 200)); } } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); - if (symbol === argumentsSymbol && ts.getContainingFunction(node).kind === 157) { + if (symbol === argumentsSymbol && ts.getContainingFunction(node).kind === 159) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression); } if (symbol.flags & 8388608) { var symbolLinks = getSymbolLinks(symbol); if (!symbolLinks.referenced) { var importOrExportAssignment = getLeftSideOfImportOrExportAssignment(node); - if (!importOrExportAssignment || (importOrExportAssignment.flags & 1) || (importOrExportAssignment.kind === 198)) { + if (!importOrExportAssignment || + (importOrExportAssignment.flags & 1) || + (importOrExportAssignment.kind === 201)) { symbolLinks.referenced = !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol)); } else { @@ -11007,7 +11246,7 @@ var ts; } } if (symbolLinks.referenced) { - markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 197)); + markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 200)); } } checkCollisionWithCapturedSuperVariable(node, node); @@ -11015,9 +11254,9 @@ var ts; return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 191 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 194 ? container.parent : undefined; getNodeLinks(node).flags |= 2; - if (container.kind === 126 || container.kind === 129) { + if (container.kind === 128 || container.kind === 131) { getNodeLinks(classNode).flags |= 4; } else { @@ -11027,36 +11266,36 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 157) { + if (container.kind === 159) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 195: + case 198: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); break; - case 194: + case 197: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 129: + case 131: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 126: - case 125: + case 128: + case 127: if (container.flags & 128) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 122: + case 124: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === 191 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 194 ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -11065,15 +11304,15 @@ var ts; } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 124) { + if (n.kind === 126) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 151 && node.parent.expression === node; - var enclosingClass = ts.getAncestor(node, 191); + var isCallExpression = node.parent.kind === 153 && node.parent.expression === node; + var enclosingClass = ts.getAncestor(node, 194); var baseClass; if (enclosingClass && ts.getClassBaseTypeNode(enclosingClass)) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); @@ -11087,20 +11326,31 @@ var ts; if (container) { var canUseSuperExpression = false; if (isCallExpression) { - canUseSuperExpression = container.kind === 129; + canUseSuperExpression = container.kind === 131; } else { var needToCaptureLexicalThis = false; - while (container && container.kind === 157) { + while (container && container.kind === 159) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = true; } - if (container && container.parent && container.parent.kind === 191) { + if (container && container.parent && container.parent.kind === 194) { if (container.flags & 128) { - canUseSuperExpression = container.kind === 128 || container.kind === 127 || container.kind === 130 || container.kind === 131; + canUseSuperExpression = + container.kind === 130 || + container.kind === 129 || + container.kind === 132 || + container.kind === 133; } else { - canUseSuperExpression = container.kind === 128 || container.kind === 127 || container.kind === 130 || container.kind === 131 || container.kind === 126 || container.kind === 125 || container.kind === 129; + canUseSuperExpression = + container.kind === 130 || + container.kind === 129 || + container.kind === 132 || + container.kind === 133 || + container.kind === 128 || + container.kind === 127 || + container.kind === 131; } } } @@ -11114,7 +11364,7 @@ var ts; getNodeLinks(node).flags |= 16; returnType = baseClass; } - if (container.kind === 129 && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 131 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); returnType = unknownType; } @@ -11124,7 +11374,7 @@ var ts; return returnType; } } - if (container.kind === 122) { + if (container.kind === 124) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { @@ -11147,7 +11397,8 @@ var ts; if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } - if (indexOfParameter === (func.parameters.length - 1) && funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + if (indexOfParameter === (func.parameters.length - 1) && + funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); } } @@ -11161,7 +11412,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 124) { + if (declaration.kind === 126) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -11176,7 +11427,7 @@ var ts; function getContextualTypeForReturnExpression(node) { var func = ts.getContainingFunction(node); if (func) { - if (func.type || func.kind === 129 || func.kind === 130 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 131))) { + if (func.type || func.kind === 131 || func.kind === 132 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 133))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(func)); } var signature = getContextualSignatureForFunctionLikeDeclaration(func); @@ -11196,14 +11447,14 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 153) { + if (template.parent.kind === 155) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; } function getContextualTypeForBinaryOperand(node) { var binaryExpression = node.parent; - var operator = binaryExpression.operator; + var operator = binaryExpression.operatorToken.kind; if (operator >= 52 && operator <= 63) { if (node === binaryExpression.right) { return checkExpression(binaryExpression.left); @@ -11274,7 +11525,8 @@ var ts; return propertyType; } } - return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || getIndexTypeOfContextualType(type, 0); + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || + getIndexTypeOfContextualType(type, 0); } return undefined; } @@ -11300,32 +11552,32 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 188: - case 124: + case 191: case 126: - case 125: - case 146: + case 128: + case 127: + case 148: return getContextualTypeForInitializerExpression(node); - case 157: - case 181: + case 159: + case 184: return getContextualTypeForReturnExpression(node); - case 151: - case 152: - return getContextualTypeForArgument(parent, node); + case 153: case 154: + return getContextualTypeForArgument(parent, node); + case 156: return getTypeFromTypeNode(parent.type); - case 163: + case 165: return getContextualTypeForBinaryOperand(node); - case 204: + case 207: return getContextualTypeForObjectLiteralElement(parent); - case 147: + case 149: return getContextualTypeForElementExpression(node); - case 164: + case 166: return getContextualTypeForConditionalOperand(node); - case 169: - ts.Debug.assert(parent.parent.kind === 165); + case 171: + ts.Debug.assert(parent.parent.kind === 167); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 155: + case 157: return getContextualType(parent); } return undefined; @@ -11340,13 +11592,13 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 156 || node.kind === 157; + return node.kind === 158 || node.kind === 159; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) ? getContextualSignature(node) : undefined; } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 128 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); if (!type) { return undefined; @@ -11357,7 +11609,8 @@ var ts; var signatureList; var types = type.types; for (var i = 0; i < types.length; i++) { - if (signatureList && getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { + if (signatureList && + getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { return undefined; } var signature = getNonGenericSignature(types[i]); @@ -11386,20 +11639,20 @@ var ts; } function isAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 163 && parent.operator === 52 && parent.left === node) { + if (parent.kind === 165 && parent.operatorToken.kind === 52 && parent.left === node) { return true; } - if (parent.kind === 204) { + if (parent.kind === 207) { return isAssignmentTarget(parent.parent); } - if (parent.kind === 147) { + if (parent.kind === 149) { return isAssignmentTarget(parent); } return false; } function checkSpreadElementExpression(node, contextualMapper) { var type = checkExpressionCached(node.expression, contextualMapper); - if (!isTypeAssignableTo(type, anyArrayType)) { + if (!isArrayLikeType(type)) { error(node.expression, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(type)); return unknownType; } @@ -11414,7 +11667,7 @@ var ts; var elementTypes = []; ts.forEach(elements, function (e) { var type = checkExpression(e, contextualMapper); - if (e.kind === 167) { + if (e.kind === 169) { elementTypes.push(getIndexTypeOfType(type, 1) || anyType); hasSpreadElement = true; } @@ -11431,10 +11684,10 @@ var ts; return createArrayType(getUnionType(elementTypes)); } function isNumericName(name) { - return name.kind === 122 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 124 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { - return isTypeOfKind(checkComputedPropertyName(name), 1 | 132); + return allConstituentTypesHaveKind(checkComputedPropertyName(name), 1 | 132); } function isNumericLiteralName(name) { return (+name).toString() === name; @@ -11443,8 +11696,11 @@ var ts; var links = getNodeLinks(node.expression); if (!links.resolvedType) { links.resolvedType = checkExpression(node.expression); - if (!isTypeOfKind(links.resolvedType, 1 | 132 | 258)) { - error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_or_any); + if (!allConstituentTypesHaveKind(links.resolvedType, 1 | 132 | 258 | 1048576)) { + error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); + } + else { + checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, true); } } return links.resolvedType; @@ -11458,16 +11714,18 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 204 || memberDecl.kind === 205 || ts.isObjectLiteralMethod(memberDecl)) { - if (memberDecl.kind === 204) { + if (memberDecl.kind === 207 || + memberDecl.kind === 208 || + ts.isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === 207) { var type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 128) { + else if (memberDecl.kind === 130) { var type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 205); - var type = memberDecl.name.kind === 122 ? unknownType : checkExpression(memberDecl.name, contextualMapper); + ts.Debug.assert(memberDecl.kind === 208); + var type = memberDecl.name.kind === 124 ? unknownType : checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); @@ -11481,7 +11739,7 @@ var ts; member = prop; } else { - ts.Debug.assert(memberDecl.kind === 130 || memberDecl.kind === 131); + ts.Debug.assert(memberDecl.kind === 132 || memberDecl.kind === 133); checkAccessorDeclaration(memberDecl); } if (!ts.hasDynamicName(memberDecl)) { @@ -11514,7 +11772,7 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 126; + return s.valueDeclaration ? s.valueDeclaration.kind : 128; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 16 | 128 : 0; @@ -11524,7 +11782,7 @@ var ts; if (!(flags & (32 | 64))) { return; } - var enclosingClassDeclaration = ts.getAncestor(node, 191); + var enclosingClassDeclaration = ts.getAncestor(node, 194); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); if (flags & 32) { @@ -11571,7 +11829,7 @@ var ts; } getNodeLinks(node).resolvedSymbol = prop; if (prop.parent && prop.parent.flags & 32) { - if (left.kind === 90 && getDeclarationKindFromSymbol(prop) !== 128) { + if (left.kind === 90 && getDeclarationKindFromSymbol(prop) !== 130) { error(right, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); } else { @@ -11583,12 +11841,12 @@ var ts; return anyType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 149 ? node.expression : node.left; + var left = node.kind === 151 ? node.expression : node.left; var type = checkExpressionOrQualifiedName(left); if (type !== unknownType && type !== anyType) { var prop = getPropertyOfType(getWidenedType(type), propertyName); if (prop && prop.parent && prop.parent.flags & 32) { - if (left.kind === 90 && getDeclarationKindFromSymbol(prop) !== 128) { + if (left.kind === 90 && getDeclarationKindFromSymbol(prop) !== 130) { return false; } else { @@ -11603,7 +11861,7 @@ var ts; function checkIndexedAccess(node) { if (!node.argumentExpression) { var sourceFile = getSourceFile(node); - if (node.parent.kind === 152 && node.parent.expression === node) { + if (node.parent.kind === 154 && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -11620,13 +11878,14 @@ var ts; return unknownType; } var isConstEnum = isConstEnumObjectType(objectType); - if (isConstEnum && (!node.argumentExpression || node.argumentExpression.kind !== 8)) { + if (isConstEnum && + (!node.argumentExpression || node.argumentExpression.kind !== 8)) { error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } if (node.argumentExpression) { - if (node.argumentExpression.kind === 8 || node.argumentExpression.kind === 7) { - var name = node.argumentExpression.text; + var name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name !== undefined) { var prop = getPropertyOfType(objectType, name); if (prop) { getNodeLinks(node).resolvedSymbol = prop; @@ -11638,8 +11897,8 @@ var ts; } } } - if (isTypeOfKind(indexType, 1 | 258 | 132)) { - if (isTypeOfKind(indexType, 1 | 132)) { + if (allConstituentTypesHaveKind(indexType, 1 | 258 | 132 | 1048576)) { + if (allConstituentTypesHaveKind(indexType, 1 | 132)) { var numberIndexType = getIndexTypeOfType(objectType, 1); if (numberIndexType) { return numberIndexType; @@ -11654,11 +11913,51 @@ var ts; } return anyType; } - error(node, ts.Diagnostics.An_index_expression_argument_must_be_of_type_string_number_or_any); + error(node, ts.Diagnostics.An_index_expression_argument_must_be_of_type_string_number_symbol_or_any); return unknownType; } + function getPropertyNameForIndexedAccess(indexArgumentExpression, indexArgumentType) { + if (indexArgumentExpression.kind === 8 || indexArgumentExpression.kind === 7) { + return indexArgumentExpression.text; + } + if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, false)) { + var rightHandSideName = indexArgumentExpression.name.text; + return ts.getPropertyNameForKnownSymbolName(rightHandSideName); + } + return undefined; + } + function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { + if (expressionType === unknownType) { + return false; + } + if (!ts.isWellKnownSymbolSyntactically(expression)) { + return false; + } + if ((expressionType.flags & 1048576) === 0) { + if (reportError) { + error(expression, ts.Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, ts.getTextOfNode(expression)); + } + return false; + } + var leftHandSide = expression.expression; + var leftHandSideSymbol = getResolvedSymbol(leftHandSide); + if (!leftHandSideSymbol) { + return false; + } + var globalESSymbol = getGlobalESSymbolConstructorSymbol(); + if (!globalESSymbol) { + return false; + } + if (leftHandSideSymbol !== globalESSymbol) { + if (reportError) { + error(leftHandSide, ts.Diagnostics.Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object); + } + return false; + } + return true; + } function resolveUntypedCall(node) { - if (node.kind === 153) { + if (node.kind === 155) { checkExpression(node.template); } else { @@ -11711,7 +12010,7 @@ var ts; } function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { - if (args[i].kind === 167) { + if (args[i].kind === 169) { return i; } } @@ -11721,11 +12020,11 @@ var ts; var adjustedArgCount; var typeArguments; var callIsIncomplete; - if (node.kind === 153) { + if (node.kind === 155) { var tagExpression = node; adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 165) { + if (tagExpression.template.kind === 167) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -11740,14 +12039,15 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 152); + ts.Debug.assert(callExpression.kind === 154); return signature.minArgumentCount === 0; } adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; callIsIncomplete = callExpression.arguments.end === callExpression.end; typeArguments = callExpression.typeArguments; } - var hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + var hasRightNumberOfTypeArgs = !typeArguments || + (signature.typeParameters && typeArguments.length === signature.typeParameters.length); if (!hasRightNumberOfTypeArgs) { return false; } @@ -11764,7 +12064,8 @@ var ts; function getSingleCallSignature(type) { if (type.flags & 48128) { var resolved = resolveObjectOrUnionTypeMembers(type); - if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && + resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { return resolved.callSignatures[0]; } } @@ -11783,9 +12084,9 @@ var ts; var inferenceMapper = createInferenceMapper(context); for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 168) { - var paramType = getTypeAtPosition(signature, arg.kind === 167 ? -1 : i); - if (i === 0 && args[i].parent.kind === 153) { + if (arg.kind !== 170) { + var paramType = getTypeAtPosition(signature, arg.kind === 169 ? -1 : i); + if (i === 0 && args[i].parent.kind === 155) { var argType = globalTemplateStringsArrayType; } else { @@ -11799,7 +12100,7 @@ var ts; for (var i = 0; i < args.length; i++) { if (excludeArgument[i] === false) { var arg = args[i]; - var paramType = getTypeAtPosition(signature, arg.kind === 167 ? -1 : i); + var paramType = getTypeAtPosition(signature, arg.kind === 169 ? -1 : i); inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } @@ -11832,9 +12133,9 @@ var ts; function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 168) { - var paramType = getTypeAtPosition(signature, arg.kind === 167 ? -1 : i); - var argType = i === 0 && node.kind === 153 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + if (arg.kind !== 170) { + var paramType = getTypeAtPosition(signature, arg.kind === 169 ? -1 : i); + var argType = i === 0 && node.kind === 155 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); if (!checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1)) { return false; } @@ -11844,10 +12145,10 @@ var ts; } function getEffectiveCallArguments(node) { var args; - if (node.kind === 153) { + if (node.kind === 155) { var template = node.template; args = [template]; - if (template.kind === 165) { + if (template.kind === 167) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); @@ -11860,7 +12161,7 @@ var ts; } function getEffectiveTypeArguments(callExpression) { if (callExpression.expression.kind === 90) { - var containingClass = ts.getAncestor(callExpression, 191); + var containingClass = ts.getAncestor(callExpression, 194); var baseClassTypeNode = containingClass && ts.getClassBaseTypeNode(containingClass); return baseClassTypeNode && baseClassTypeNode.typeArguments; } @@ -11869,7 +12170,7 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray) { - var isTaggedTemplate = node.kind === 153; + var isTaggedTemplate = node.kind === 155; var typeArguments; if (!isTaggedTemplate) { typeArguments = getEffectiveTypeArguments(node); @@ -12075,13 +12376,13 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 151) { + if (node.kind === 153) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 152) { + else if (node.kind === 154) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 153) { + else if (node.kind === 155) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } else { @@ -12096,9 +12397,12 @@ var ts; if (node.expression.kind === 90) { return voidType; } - if (node.kind === 152) { + if (node.kind === 154) { var declaration = signature.declaration; - if (declaration && declaration.kind !== 129 && declaration.kind !== 133 && declaration.kind !== 137) { + if (declaration && + declaration.kind !== 131 && + declaration.kind !== 135 && + declaration.kind !== 139) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -12148,7 +12452,7 @@ var ts; if (!func.body) { return unknownType; } - if (func.body.kind !== 170) { + if (func.body.kind !== 172) { var type = checkExpressionCached(func.body, contextualMapper); } else { @@ -12186,7 +12490,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 185); + return (body.statements.length === 1) && (body.statements[0].kind === 188); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -12195,7 +12499,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 170) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 172) { return; } var bodyBlock = func.body; @@ -12208,9 +12512,9 @@ var ts; error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement); } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 128 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 156) { + if (!hasGrammarError && node.kind === 158) { checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { @@ -12238,19 +12542,19 @@ var ts; checkSignatureDeclaration(node); } } - if (produceDiagnostics && node.kind !== 128 && node.kind !== 127) { + if (produceDiagnostics && node.kind !== 130 && node.kind !== 129) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 128 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); if (node.type) { checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); } if (node.body) { - if (node.body.kind === 170) { + if (node.body.kind === 172) { checkSourceElement(node.body); } else { @@ -12263,7 +12567,7 @@ var ts; } } function checkArithmeticOperandType(operand, type, diagnostic) { - if (!isTypeOfKind(type, 1 | 132)) { + if (!allConstituentTypesHaveKind(type, 1 | 132)) { error(operand, diagnostic); return false; } @@ -12279,12 +12583,12 @@ var ts; case 64: var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; - case 149: + case 151: var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; - case 150: + case 152: return true; - case 155: + case 157: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -12293,10 +12597,10 @@ var ts; function isConstVariableReference(n) { switch (n.kind) { case 64: - case 149: + case 151: var symbol = findSymbol(n); return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 4096) !== 0; - case 150: + case 152: var index = n.argumentExpression; var symbol = findSymbol(n.expression); if (symbol && index && index.kind === 8) { @@ -12305,7 +12609,7 @@ var ts; return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 4096) !== 0; } return false; - case 155: + case 157: return isConstVariableReference(n.expression); default: return false; @@ -12345,6 +12649,9 @@ var ts; case 33: case 34: case 47: + if (someConstituentTypeHasKind(operandType, 1048576)) { + error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); + } return numberType; case 46: return booleanType; @@ -12367,7 +12674,22 @@ var ts; } return numberType; } - function isTypeOfKind(type, kind) { + function someConstituentTypeHasKind(type, kind) { + if (type.flags & kind) { + return true; + } + if (type.flags & 16384) { + var types = type.types; + for (var i = 0; i < types.length; i++) { + if (types[i].flags & kind) { + return true; + } + } + return false; + } + return false; + } + function allConstituentTypesHaveKind(type, kind) { if (type.flags & kind) { return true; } @@ -12389,7 +12711,7 @@ var ts; return (symbol.flags & 128) !== 0; } function checkInstanceOfExpression(node, leftType, rightType) { - if (isTypeOfKind(leftType, 510)) { + if (allConstituentTypesHaveKind(leftType, 1049086)) { error(node.left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } if (!(rightType.flags & 1 || isTypeSubtypeOf(rightType, globalFunctionType))) { @@ -12398,10 +12720,10 @@ var ts; return booleanType; } function checkInExpression(node, leftType, rightType) { - if (!isTypeOfKind(leftType, 1 | 258 | 132)) { - error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number); + if (!allConstituentTypesHaveKind(leftType, 1 | 258 | 132 | 1048576)) { + error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeOfKind(rightType, 1 | 48128 | 512)) { + if (!allConstituentTypesHaveKind(rightType, 1 | 48128 | 512)) { error(node.right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; @@ -12410,9 +12732,11 @@ var ts; var properties = node.properties; for (var i = 0; i < properties.length; i++) { var p = properties[i]; - if (p.kind === 204 || p.kind === 205) { + if (p.kind === 207 || p.kind === 208) { var name = p.name; - var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); + var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || + isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || + getIndexTypeOfType(sourceType, 0); if (type) { checkDestructuringAssignment(p.initializer || name, type); } @@ -12427,15 +12751,15 @@ var ts; return sourceType; } function checkArrayLiteralAssignment(node, sourceType, contextualMapper) { - if (!isTypeAssignableTo(sourceType, anyArrayType)) { + if (!isArrayLikeType(sourceType)) { error(node, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(sourceType)); return sourceType; } var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 168) { - if (e.kind !== 167) { + if (e.kind !== 170) { + if (e.kind !== 169) { var propName = "" + i; var type = sourceType.flags & 1 ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : getIndexTypeOfType(sourceType, 1); if (type) { @@ -12458,14 +12782,14 @@ var ts; return sourceType; } function checkDestructuringAssignment(target, sourceType, contextualMapper) { - if (target.kind === 163 && target.operator === 52) { + if (target.kind === 165 && target.operatorToken.kind === 52) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 148) { + if (target.kind === 150) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 147) { + if (target.kind === 149) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -12478,11 +12802,11 @@ var ts; return sourceType; } function checkBinaryExpression(node, contextualMapper) { - if (ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operator)) { + if (ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operatorToken.kind)) { checkGrammarEvalOrArgumentsInStrictMode(node, node.left); } - var operator = node.operator; - if (operator === 52 && (node.left.kind === 148 || node.left.kind === 147)) { + var operator = node.operatorToken.kind; + if (operator === 52 && (node.left.kind === 150 || node.left.kind === 149)) { return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); } var leftType = checkExpression(node.left, contextualMapper); @@ -12513,8 +12837,10 @@ var ts; if (rightType.flags & (32 | 64)) rightType = leftType; var suggestedOperator; - if ((leftType.flags & 8) && (rightType.flags & 8) && (suggestedOperator = getSuggestedBooleanOperator(node.operator)) !== undefined) { - error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operator), ts.tokenToString(suggestedOperator)); + if ((leftType.flags & 8) && + (rightType.flags & 8) && + (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { + error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operatorToken.kind), ts.tokenToString(suggestedOperator)); } else { var leftOk = checkArithmeticOperandType(node.left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); @@ -12531,14 +12857,19 @@ var ts; if (rightType.flags & (32 | 64)) rightType = leftType; var resultType; - if (isTypeOfKind(leftType, 132) && isTypeOfKind(rightType, 132)) { + if (allConstituentTypesHaveKind(leftType, 132) && allConstituentTypesHaveKind(rightType, 132)) { resultType = numberType; } - else if (isTypeOfKind(leftType, 258) || isTypeOfKind(rightType, 258)) { - resultType = stringType; - } - else if (leftType.flags & 1 || rightType.flags & 1) { - resultType = anyType; + else { + if (allConstituentTypesHaveKind(leftType, 258) || allConstituentTypesHaveKind(rightType, 258)) { + resultType = stringType; + } + else if (leftType.flags & 1 || rightType.flags & 1) { + resultType = anyType; + } + if (resultType && !checkForDisallowedESSymbolOperand(operator)) { + return resultType; + } } if (!resultType) { reportOperatorError(); @@ -12548,14 +12879,17 @@ var ts; checkAssignmentOperator(resultType); } return resultType; - case 28: - case 29: - case 30: - case 31: case 24: case 25: case 26: case 27: + if (!checkForDisallowedESSymbolOperand(operator)) { + return booleanType; + } + case 28: + case 29: + case 30: + case 31: if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } @@ -12574,6 +12908,14 @@ var ts; case 23: return rightType; } + function checkForDisallowedESSymbolOperand(operator) { + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : someConstituentTypeHasKind(rightType, 1048576) ? node.right : undefined; + if (offendingSymbolOperand) { + error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); + return false; + } + return true; + } function getSuggestedBooleanOperator(operator) { switch (operator) { case 44: @@ -12598,7 +12940,7 @@ var ts; } } function reportOperatorError() { - error(node, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(node.operator), typeToString(leftType), typeToString(rightType)); + error(node, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(node.operatorToken.kind), typeToString(leftType), typeToString(rightType)); } } function checkYieldExpression(node) { @@ -12636,14 +12978,14 @@ var ts; return links.resolvedType; } function checkPropertyAssignment(node, contextualMapper) { - if (ts.hasDynamicName(node)) { + if (node.name.kind === 124) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); - if (ts.hasDynamicName(node)) { + if (node.name.kind === 124) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -12669,7 +13011,7 @@ var ts; } function checkExpressionOrQualifiedName(node, contextualMapper) { var type; - if (node.kind == 121) { + if (node.kind == 123) { type = checkQualifiedName(node); } else { @@ -12677,7 +13019,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 149 && node.parent.expression === node) || (node.parent.kind === 150 && node.parent.expression === node) || ((node.kind === 64 || node.kind === 121) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 151 && node.parent.expression === node) || + (node.parent.kind === 152 && node.parent.expression === node) || + ((node.kind === 64 || node.kind === 123) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -12703,52 +13047,52 @@ var ts; return booleanType; case 7: return checkNumericLiteral(node); - case 165: + case 167: return checkTemplateExpression(node); case 8: case 10: return stringType; case 9: return globalRegExpType; - case 147: - return checkArrayLiteral(node, contextualMapper); - case 148: - return checkObjectLiteral(node, contextualMapper); case 149: - return checkPropertyAccessExpression(node); + return checkArrayLiteral(node, contextualMapper); case 150: - return checkIndexedAccess(node); + return checkObjectLiteral(node, contextualMapper); case 151: + return checkPropertyAccessExpression(node); case 152: - return checkCallExpression(node); + return checkIndexedAccess(node); case 153: - return checkTaggedTemplateExpression(node); case 154: - return checkTypeAssertion(node); + return checkCallExpression(node); case 155: - return checkExpression(node.expression, contextualMapper); + return checkTaggedTemplateExpression(node); case 156: + return checkTypeAssertion(node); case 157: - return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 159: - return checkTypeOfExpression(node); + return checkExpression(node.expression, contextualMapper); case 158: - return checkDeleteExpression(node); - case 160: - return checkVoidExpression(node); + case 159: + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); case 161: - return checkPrefixUnaryExpression(node); + return checkTypeOfExpression(node); + case 160: + return checkDeleteExpression(node); case 162: - return checkPostfixUnaryExpression(node); + return checkVoidExpression(node); case 163: - return checkBinaryExpression(node, contextualMapper); + return checkPrefixUnaryExpression(node); case 164: - return checkConditionalExpression(node, contextualMapper); - case 167: - return checkSpreadElementExpression(node, contextualMapper); - case 168: - return undefinedType; + return checkPostfixUnaryExpression(node); + case 165: + return checkBinaryExpression(node, contextualMapper); case 166: + return checkConditionalExpression(node, contextualMapper); + case 169: + return checkSpreadElementExpression(node, contextualMapper); + case 170: + return undefinedType; + case 168: checkYieldExpression(node); return unknownType; } @@ -12770,7 +13114,7 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 112) { func = ts.getContainingFunction(node); - if (!(func.kind === 129 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 131 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -12784,10 +13128,12 @@ var ts; } } function checkSignatureDeclaration(node) { - if (node.kind === 134) { + if (node.kind === 136) { checkGrammarIndexSignature(node); } - else if (node.kind === 136 || node.kind === 190 || node.kind === 137 || node.kind === 132 || node.kind === 129 || node.kind === 133) { + else if (node.kind === 138 || node.kind === 193 || node.kind === 139 || + node.kind === 134 || node.kind === 131 || + node.kind === 135) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -12799,10 +13145,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 133: + case 135: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 132: + case 134: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -12811,7 +13157,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 192) { + if (node.kind === 195) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -12847,7 +13193,7 @@ var ts; } } function checkPropertyDeclaration(node) { - checkGrammarModifiers(node) || checkGrammarProperty(node); + checkGrammarModifiers(node) || checkGrammarProperty(node) || checkGrammarComputedPropertyName(node.name); checkVariableLikeDeclaration(node); } function checkMethodDeclaration(node) { @@ -12870,17 +13216,17 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 151 && n.expression.kind === 90; + return n.kind === 153 && n.expression.kind === 90; } function containsSuperCall(n) { if (isSuperCallExpression(n)) { return true; } switch (n.kind) { - case 156: - case 190: - case 157: - case 148: return false; + case 158: + case 193: + case 159: + case 150: return false; default: return ts.forEachChild(n, containsSuperCall); } } @@ -12888,19 +13234,22 @@ var ts; if (n.kind === 92) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 156 && n.kind !== 190) { + else if (n.kind !== 158 && n.kind !== 193) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 126 && !(n.flags & 128) && !!n.initializer; + return n.kind === 128 && + !(n.flags & 128) && + !!n.initializer; } if (ts.getClassBaseTypeNode(node.parent)) { if (containsSuperCall(node.body)) { - var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || + ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 173 || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 175 || !isSuperCallExpression(statements[0].expression)) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } else { @@ -12916,13 +13265,13 @@ var ts; function checkAccessorDeclaration(node) { if (produceDiagnostics) { checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 130) { + if (node.kind === 132) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && !(bodyContainsAReturnStatement(node.body) || bodyContainsSingleThrowStatement(node.body))) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); } } if (!ts.hasDynamicName(node)) { - var otherKind = node.kind === 130 ? 131 : 130; + var otherKind = node.kind === 132 ? 133 : 132; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 112) !== (otherAccessor.flags & 112))) { @@ -12996,9 +13345,9 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 192) { - ts.Debug.assert(signatureDeclarationNode.kind === 132 || signatureDeclarationNode.kind === 133); - var signatureKind = signatureDeclarationNode.kind === 132 ? 0 : 1; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 195) { + ts.Debug.assert(signatureDeclarationNode.kind === 134 || signatureDeclarationNode.kind === 135); + var signatureKind = signatureDeclarationNode.kind === 134 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -13016,7 +13365,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 192 && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 195 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; } @@ -13089,7 +13438,7 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 128 || node.kind === 127); + ts.Debug.assert(node.kind === 130 || node.kind === 129); ts.Debug.assert((node.flags & 128) !== (subsequentNode.flags & 128)); var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode, diagnostic); @@ -13115,11 +13464,11 @@ var ts; for (var i = 0; i < declarations.length; i++) { var node = declarations[i]; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 192 || node.parent.kind === 139 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 195 || node.parent.kind === 141 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 190 || node.kind === 128 || node.kind === 127 || node.kind === 129) { + if (node.kind === 193 || node.kind === 130 || node.kind === 129 || node.kind === 131) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -13216,19 +13565,17 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 192: - return 2097152; case 195: + return 2097152; + case 198: return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 191: case 194: - return 2097152 | 1048576; case 197: + return 2097152 | 1048576; + case 200: var result = 0; var target = resolveImport(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { - result |= getDeclarationSpaces(d); - }); + ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); return result; default: return 1048576; @@ -13237,7 +13584,10 @@ var ts; } function checkFunctionDeclaration(node) { if (produceDiagnostics) { - checkFunctionLikeDeclaration(node) || checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); + checkFunctionLikeDeclaration(node) || + checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionName(node.name) || + checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -13245,10 +13595,10 @@ var ts; } function checkFunctionLikeDeclaration(node) { checkSignatureDeclaration(node); - if (ts.hasDynamicName(node)) { + if (node.name.kind === 124) { checkComputedPropertyName(node.name); } - else { + if (!ts.hasDynamicName(node)) { var symbol = getSymbolOfNode(node); var localSymbol = node.localSymbol || symbol; var firstDeclaration = ts.getDeclarationOfKind(localSymbol, node.kind); @@ -13270,11 +13620,11 @@ var ts; } } function checkBlock(node) { - if (node.kind === 170) { - checkGrammarForStatementInAmbientContext(node); + if (node.kind === 172) { + checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 196) { + if (ts.isFunctionBlock(node) || node.kind === 199) { checkFunctionExpressionBodies(node); } } @@ -13292,14 +13642,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 126 || node.kind === 125 || node.kind === 128 || node.kind === 127 || node.kind === 130 || node.kind === 131) { + if (node.kind === 128 || + node.kind === 127 || + node.kind === 130 || + node.kind === 129 || + node.kind === 132 || + node.kind === 133) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = getRootDeclaration(node); - if (root.kind === 124 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 126 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -13329,7 +13684,7 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = ts.getAncestor(node, 191); + var enclosingClass = ts.getAncestor(node, 194); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } @@ -13347,35 +13702,47 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 195 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 198 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 207 && ts.isExternalModule(parent)) { + if (parent.kind === 210 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } - function checkCollisionWithConstDeclarations(node) { + function checkVarDeclaredNamesNotShadowed(node) { if (node.initializer && (ts.getCombinedNodeFlags(node) & 6144) === 0) { var symbol = getSymbolOfNode(node); if (symbol.flags & 1) { var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined); - if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { - if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 4096) { - error(node, ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0, symbolToString(localDeclarationSymbol)); + if (localDeclarationSymbol && + localDeclarationSymbol !== symbol && + localDeclarationSymbol.flags & 2) { + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 6144) { + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 192); + var container = varDeclList.parent.kind === 173 && + varDeclList.parent.parent; + var namesShareScope = container && + (container.kind === 172 && ts.isAnyFunction(container.parent) || + (container.kind === 199 && container.kind === 198) || + container.kind === 210); + if (!namesShareScope) { + var name = symbolToString(localDeclarationSymbol); + error(ts.getErrorSpanForNode(node), ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); + } } } } } } function isParameterDeclaration(node) { - while (node.kind === 146) { + while (node.kind === 148) { node = node.parent.parent; } - return node.kind === 124; + return node.kind === 126; } function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind === 124) { + if (getRootDeclaration(node).kind === 126) { var func = ts.getContainingFunction(node); visit(node.initializer); } @@ -13383,7 +13750,7 @@ var ts; if (n.kind === 64) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 124) { + if (referencedSymbol.valueDeclaration.kind === 126) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -13402,17 +13769,16 @@ var ts; } function checkVariableLikeDeclaration(node) { checkSourceElement(node.type); - if (ts.hasDynamicName(node)) { + if (node.name.kind === 124) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } - return; } if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && getRootDeclaration(node).kind === 124 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && getRootDeclaration(node).kind === 126 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -13440,9 +13806,11 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); } } - if (node.kind !== 126 && node.kind !== 125) { + if (node.kind !== 128 && node.kind !== 127) { checkExportsOnMergedDeclarations(node); - checkCollisionWithConstDeclarations(node); + if (node.kind === 191 || node.kind === 148) { + checkVarDeclaredNamesNotShadowed(node); + } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -13469,40 +13837,40 @@ var ts; } function inBlockOrObjectLiteralExpression(node) { while (node) { - if (node.kind === 170 || node.kind === 148) { + if (node.kind === 172 || node.kind === 150) { return true; } node = node.parent; } } function checkExpressionStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); } function checkIfStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); checkSourceElement(node.elseStatement); } function checkDoStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkSourceElement(node.statement); checkExpression(node.expression); } function checkWhileStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.statement); } function checkForStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind == 189) { + if (!checkGrammarStatementInAmbientContext(node)) { + if (node.initializer && node.initializer.kind == 192) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 189) { + if (node.initializer.kind === 192) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -13515,31 +13883,22 @@ var ts; checkExpression(node.iterator); checkSourceElement(node.statement); } + function checkForOfStatement(node) { + checkGrammarForOfStatement(node); + } function checkForInStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { - if (node.initializer.kind === 189) { - var variableList = node.initializer; - if (!checkGrammarVariableDeclarationList(variableList)) { - if (variableList.declarations.length > 1) { - grammarErrorOnFirstToken(variableList.declarations[1], ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); - } - } - } - } - if (node.initializer.kind === 189) { + checkGrammarForInOrForOfStatement(node); + if (node.initializer.kind === 192) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; checkVariableDeclaration(decl); - if (decl.type) { - error(decl, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation); - } } } else { var varExpr = node.initializer; var exprType = checkExpression(varExpr); - if (exprType !== anyType && exprType !== stringType) { + if (!allConstituentTypesHaveKind(exprType, 1 | 258)) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { @@ -13547,19 +13906,19 @@ var ts; } } var exprType = checkExpression(node.expression); - if (!isTypeOfKind(exprType, 1 | 48128 | 512)) { + if (!allConstituentTypesHaveKind(exprType, 1 | 48128 | 512)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } checkSourceElement(node.statement); } function checkBreakOrContinueStatement(node) { - checkGrammarForStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); + checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 130 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 131))); + return !!(node.kind === 132 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 133))); } function checkReturnStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { var functionBlock = ts.getContainingFunction(node); if (!functionBlock) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); @@ -13570,11 +13929,11 @@ var ts; if (func) { var returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); var exprType = checkExpressionCached(node.expression); - if (func.kind === 131) { + if (func.kind === 133) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } else { - if (func.kind === 129) { + if (func.kind === 131) { if (!isTypeAssignableTo(exprType, returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -13587,7 +13946,7 @@ var ts; } } function checkWithStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { if (node.parserContextFlags & 1) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); } @@ -13596,12 +13955,12 @@ var ts; error(node.expression, ts.Diagnostics.All_symbols_within_a_with_block_will_be_resolved_to_any); } function checkSwitchStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.clauses, function (clause) { - if (clause.kind === 201 && !hasDuplicateDefaultClause) { + if (clause.kind === 204 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -13613,7 +13972,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 200) { + if (produceDiagnostics && clause.kind === 203) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -13624,13 +13983,13 @@ var ts; }); } function checkLabeledStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { var current = node.parent; while (current) { if (ts.isAnyFunction(current)) { break; } - if (current.kind === 184 && current.label.text === node.label.text) { + if (current.kind === 187 && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -13641,7 +14000,7 @@ var ts; checkSourceElement(node.statement); } function checkThrowStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { if (node.expression === undefined) { grammarErrorAfterFirstToken(node, ts.Diagnostics.Line_break_not_permitted_here); } @@ -13651,7 +14010,7 @@ var ts; } } function checkTryStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkBlock(node.tryBlock); var catchClause = node.catchClause; if (catchClause) { @@ -13677,7 +14036,7 @@ var ts; checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0); checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1); }); - if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 191) { + if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 194) { var classDeclaration = type.symbol.valueDeclaration; for (var i = 0; i < classDeclaration.members.length; i++) { var member = classDeclaration.members[i]; @@ -13708,7 +14067,7 @@ var ts; return; } var errorNode; - if (prop.valueDeclaration.name.kind === 122 || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 124 || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -13730,6 +14089,7 @@ var ts; case "number": case "boolean": case "string": + case "symbol": case "void": error(name, message, name.text); } @@ -13848,7 +14208,7 @@ var ts; } } function isAccessor(kind) { - return kind === 130 || kind === 131; + return kind === 132 || kind === 133; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -13880,9 +14240,7 @@ var ts; return true; } var seen = {}; - ts.forEach(type.declaredProperties, function (p) { - seen[p.name] = { prop: p, containingType: type }; - }); + ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; for (var i = 0, len = type.baseTypes.length; i < len; ++i) { var base = type.baseTypes[i]; @@ -13899,7 +14257,7 @@ var ts; ok = false; var typeName1 = typeToString(existing.containingType); var typeName2 = typeToString(base); - var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_properties_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2); + var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo)); } @@ -13915,7 +14273,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 192); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 195); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -13951,7 +14309,7 @@ var ts; var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); ts.forEach(node.members, function (member) { - if (member.name.kind !== 122 && isNumericLiteralName(member.name.text)) { + if (member.name.kind !== 124 && isNumericLiteralName(member.name.text)) { error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); } var initializer = member.initializer; @@ -13987,7 +14345,7 @@ var ts; return evalConstant(initializer); function evalConstant(e) { switch (e.kind) { - case 161: + case 163: var value = evalConstant(e.operand); if (value === undefined) { return undefined; @@ -13998,7 +14356,7 @@ var ts; case 47: return enumIsConst ? ~value : undefined; } return undefined; - case 163: + case 165: if (!enumIsConst) { return undefined; } @@ -14010,7 +14368,7 @@ var ts; if (right === undefined) { return undefined; } - switch (e.operator) { + switch (e.operatorToken.kind) { case 44: return left | right; case 43: return left & right; case 41: return left >> right; @@ -14026,11 +14384,11 @@ var ts; return undefined; case 7: return +e.text; - case 155: + case 157: return enumIsConst ? evalConstant(e.expression) : undefined; case 64: - case 150: - case 149: + case 152: + case 151: if (!enumIsConst) { return undefined; } @@ -14043,8 +14401,9 @@ var ts; propertyName = e.text; } else { - if (e.kind === 150) { - if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8) { + if (e.kind === 152) { + if (e.argumentExpression === undefined || + e.argumentExpression.kind !== 8) { return undefined; } var enumType = getTypeOfNode(e.expression); @@ -14100,7 +14459,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 194) { + if (declaration.kind !== 197) { return false; } var enumDeclaration = declaration; @@ -14123,7 +14482,7 @@ var ts; var declarations = symbol.declarations; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; - if ((declaration.kind === 191 || (declaration.kind === 190 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { + if ((declaration.kind === 194 || (declaration.kind === 193 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } } @@ -14135,11 +14494,11 @@ var ts; if (!ts.isInAmbientContext(node) && node.name.kind === 8) { grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names); } - else if (node.name.kind === 64 && node.body.kind === 196) { + else if (node.name.kind === 64 && node.body.kind === 199) { var statements = node.body.statements; for (var i = 0, n = statements.length; i < n; i++) { var statement = statements[i]; - if (statement.kind === 198) { + if (statement.kind === 201) { grammarErrorOnNode(statement, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); } else if (ts.isExternalModuleImportDeclaration(statement)) { @@ -14175,7 +14534,7 @@ var ts; checkSourceElement(node.body); } function getFirstIdentifier(node) { - while (node.kind === 121) { + while (node.kind === 123) { node = node.left; } return node; @@ -14204,10 +14563,10 @@ var ts; } } else { - if (node.parent.kind === 207) { + if (node.parent.kind === 210) { target = resolveImport(symbol); } - else if (node.parent.kind === 196 && node.parent.parent.name.kind === 8) { + else if (node.parent.kind === 199 && node.parent.parent.name.kind === 8) { if (ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { if (isExternalModuleNameRelative(ts.getExternalModuleImportDeclarationExpression(node).text)) { error(node, ts.Diagnostics.Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); @@ -14226,7 +14585,9 @@ var ts; } } if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); + var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | + (symbol.flags & 793056 ? 793056 : 0) | + (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { error(node, ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0, symbolToString(symbol)); } @@ -14237,7 +14598,7 @@ var ts; grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } var container = node.parent; - if (container.kind !== 207) { + if (container.kind !== 210) { container = container.parent; } checkTypeOfExportAssignmentSymbol(getSymbolOfNode(container)); @@ -14246,156 +14607,156 @@ var ts; if (!node) return; switch (node.kind) { - case 123: - return checkTypeParameter(node); - case 124: - return checkParameter(node); - case 126: case 125: - return checkPropertyDeclaration(node); - case 136: - case 137: - case 132: - case 133: - return checkSignatureDeclaration(node); - case 134: - return checkSignatureDeclaration(node); + return checkTypeParameter(node); + case 126: + return checkParameter(node); case 128: case 127: - return checkMethodDeclaration(node); - case 129: - return checkConstructorDeclaration(node); - case 130: - case 131: - return checkAccessorDeclaration(node); - case 135: - return checkTypeReference(node); + return checkPropertyDeclaration(node); case 138: - return checkTypeQuery(node); case 139: - return checkTypeLiteral(node); + case 134: + case 135: + return checkSignatureDeclaration(node); + case 136: + return checkSignatureDeclaration(node); + case 130: + case 129: + return checkMethodDeclaration(node); + case 131: + return checkConstructorDeclaration(node); + case 132: + case 133: + return checkAccessorDeclaration(node); + case 137: + return checkTypeReference(node); case 140: - return checkArrayType(node); + return checkTypeQuery(node); case 141: - return checkTupleType(node); + return checkTypeLiteral(node); case 142: - return checkUnionType(node); + return checkArrayType(node); case 143: + return checkTupleType(node); + case 144: + return checkUnionType(node); + case 145: return checkSourceElement(node.type); - case 190: - return checkFunctionDeclaration(node); - case 170: - case 196: - return checkBlock(node); - case 171: - return checkVariableStatement(node); - case 173: - return checkExpressionStatement(node); - case 174: - return checkIfStatement(node); - case 175: - return checkDoStatement(node); - case 176: - return checkWhileStatement(node); - case 177: - return checkForStatement(node); - case 178: - return checkForInStatement(node); - case 179: - case 180: - return checkBreakOrContinueStatement(node); - case 181: - return checkReturnStatement(node); - case 182: - return checkWithStatement(node); - case 183: - return checkSwitchStatement(node); - case 184: - return checkLabeledStatement(node); - case 185: - return checkThrowStatement(node); - case 186: - return checkTryStatement(node); - case 188: - return checkVariableDeclaration(node); - case 146: - return checkBindingElement(node); - case 191: - return checkClassDeclaration(node); - case 192: - return checkInterfaceDeclaration(node); case 193: - return checkTypeAliasDeclaration(node); - case 194: - return checkEnumDeclaration(node); - case 195: - return checkModuleDeclaration(node); - case 197: - return checkImportDeclaration(node); - case 198: - return checkExportAssignment(node); + return checkFunctionDeclaration(node); case 172: - checkGrammarForStatementInAmbientContext(node); - return; + case 199: + return checkBlock(node); + case 173: + return checkVariableStatement(node); + case 175: + return checkExpressionStatement(node); + case 176: + return checkIfStatement(node); + case 177: + return checkDoStatement(node); + case 178: + return checkWhileStatement(node); + case 179: + return checkForStatement(node); + case 180: + return checkForInStatement(node); + case 181: + return checkForOfStatement(node); + case 182: + case 183: + return checkBreakOrContinueStatement(node); + case 184: + return checkReturnStatement(node); + case 185: + return checkWithStatement(node); + case 186: + return checkSwitchStatement(node); case 187: - checkGrammarForStatementInAmbientContext(node); + return checkLabeledStatement(node); + case 188: + return checkThrowStatement(node); + case 189: + return checkTryStatement(node); + case 191: + return checkVariableDeclaration(node); + case 148: + return checkBindingElement(node); + case 194: + return checkClassDeclaration(node); + case 195: + return checkInterfaceDeclaration(node); + case 196: + return checkTypeAliasDeclaration(node); + case 197: + return checkEnumDeclaration(node); + case 198: + return checkModuleDeclaration(node); + case 200: + return checkImportDeclaration(node); + case 201: + return checkExportAssignment(node); + case 174: + checkGrammarStatementInAmbientContext(node); + return; + case 190: + checkGrammarStatementInAmbientContext(node); return; } } function checkFunctionExpressionBodies(node) { switch (node.kind) { - case 156: - case 157: + case 158: + case 159: ts.forEach(node.parameters, checkFunctionExpressionBodies); checkFunctionExpressionOrObjectLiteralMethodBody(node); break; - case 128: - case 127: + case 130: + case 129: ts.forEach(node.parameters, checkFunctionExpressionBodies); if (ts.isObjectLiteralMethod(node)) { checkFunctionExpressionOrObjectLiteralMethodBody(node); } break; - case 129: - case 130: case 131: - case 190: + case 132: + case 133: + case 193: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 182: + case 185: checkFunctionExpressionBodies(node.expression); break; - case 124: case 126: - case 125: - case 144: - case 145: + case 128: + case 127: case 146: case 147: case 148: - case 204: case 149: case 150: + case 207: case 151: case 152: case 153: - case 165: - case 169: case 154: case 155: - case 159: - case 160: - case 158: + case 167: + case 171: + case 156: + case 157: case 161: case 162: + case 160: case 163: case 164: - case 167: - case 170: - case 196: - case 171: + case 165: + case 166: + case 169: + case 172: + case 199: case 173: - case 174: case 175: case 176: case 177: @@ -14403,19 +14764,22 @@ var ts; case 179: case 180: case 181: + case 182: case 183: - case 200: - case 201: case 184: - case 185: case 186: case 203: + case 204: + case 187: case 188: case 189: - case 191: - case 194: case 206: - case 207: + case 191: + case 192: + case 194: + case 197: + case 209: + case 210: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -14437,7 +14801,7 @@ var ts; var symbol = getExportAssignmentSymbol(node.symbol); if (symbol && symbol.flags & 8388608) { getSymbolLinks(symbol).referenced = true; - markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 197)); + markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 200)); } } if (potentialThisCollisions.length) { @@ -14471,7 +14835,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 182 && node.parent.statement === node) { + if (node.parent.kind === 185 && node.parent.statement === node) { return true; } node = node.parent; @@ -14507,27 +14871,27 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 207: + case 210: if (!ts.isExternalModule(location)) break; - case 195: + case 198: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 194: + case 197: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 191: - case 192: + case 194: + case 195: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; - case 156: + case 158: if (location.name) { copySymbol(location.symbol, meaning); } break; - case 203: + case 206: if (location.name.text) { copySymbol(location.symbol, meaning); } @@ -14540,26 +14904,28 @@ var ts; return ts.mapToArray(symbols); } function isTypeDeclarationName(name) { - return name.kind == 64 && isTypeDeclaration(name.parent) && name.parent.name === name; + return name.kind == 64 && + isTypeDeclaration(name.parent) && + name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 123: - case 191: - case 192: - case 193: + case 125: case 194: + case 195: + case 196: + case 197: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 121) + while (node.parent && node.parent.kind === 123) node = node.parent; - return node.parent && node.parent.kind === 135; + return node.parent && node.parent.kind === 137; } function isTypeNode(node) { - if (135 <= node.kind && node.kind <= 143) { + if (137 <= node.kind && node.kind <= 145) { return true; } switch (node.kind) { @@ -14567,64 +14933,65 @@ var ts; case 117: case 119: case 111: + case 120: return true; case 98: - return node.parent.kind !== 160; + return node.parent.kind !== 162; case 8: - return node.parent.kind === 124; + return node.parent.kind === 126; case 64: - if (node.parent.kind === 121 && node.parent.right === node) { + if (node.parent.kind === 123 && node.parent.right === node) { node = node.parent; } - case 121: - ts.Debug.assert(node.kind === 64 || node.kind === 121, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + case 123: + ts.Debug.assert(node.kind === 64 || node.kind === 123, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); var parent = node.parent; - if (parent.kind === 138) { + if (parent.kind === 140) { return false; } - if (135 <= parent.kind && parent.kind <= 143) { + if (137 <= parent.kind && parent.kind <= 145) { return true; } switch (parent.kind) { - case 123: - return node === parent.constraint; - case 126: case 125: - case 124: - case 188: - return node === parent.type; - case 190: - case 156: - case 157: - case 129: + return node === parent.constraint; case 128: case 127: - case 130: - case 131: + case 126: + case 191: return node === parent.type; + case 193: + case 158: + case 159: + case 131: + case 130: + case 129: case 132: case 133: + return node === parent.type; case 134: + case 135: + case 136: return node === parent.type; - case 154: + case 156: return node === parent.type; - case 151: - case 152: - return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; case 153: + case 154: + return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + case 155: return false; } } return false; } function getLeftSideOfImportOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 121) { + while (nodeOnRightSide.parent.kind === 123) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 197) { + if (nodeOnRightSide.parent.kind === 200) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 198) { + if (nodeOnRightSide.parent.kind === 201) { return nodeOnRightSide.parent.exportName === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -14633,16 +15000,17 @@ var ts; return getLeftSideOfImportOrExportAssignment(node) !== undefined; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 121 && node.parent.right === node) || (node.parent.kind === 149 && node.parent.name === node); + return (node.parent.kind === 123 && node.parent.right === node) || + (node.parent.kind === 151 && node.parent.name === node); } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 198) { + if (entityName.parent.kind === 201) { return resolveEntityName(entityName.parent.parent, entityName, 107455 | 793056 | 1536 | 8388608); } - if (entityName.kind !== 149) { + if (entityName.kind !== 151) { if (isInRightSideOfImportOrExportAssignment(entityName)) { return getSymbolOfPartOfRightHandSideOfImport(entityName); } @@ -14658,14 +15026,14 @@ var ts; var meaning = 107455 | 8388608; return resolveEntityName(entityName, entityName, meaning); } - else if (entityName.kind === 149) { + else if (entityName.kind === 151) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 121) { + else if (entityName.kind === 123) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -14674,7 +15042,7 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 135 ? 793056 : 1536; + var meaning = entityName.parent.kind === 137 ? 793056 : 1536; meaning |= 8388608; return resolveEntityName(entityName, entityName, meaning); } @@ -14688,12 +15056,12 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 64 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 198 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImport(node); + return node.parent.kind === 201 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImport(node); } switch (node.kind) { case 64: - case 149: - case 121: + case 151: + case 123: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 92: case 90: @@ -14701,18 +15069,19 @@ var ts; return type.symbol; case 112: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 129) { + if (constructorDeclaration && constructorDeclaration.kind === 131) { return constructorDeclaration.parent.symbol; } return undefined; case 8: - if (ts.isExternalModuleImportDeclaration(node.parent.parent) && ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node) { + if (ts.isExternalModuleImportDeclaration(node.parent.parent) && + ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node) { var importSymbol = getSymbolOfNode(node.parent.parent); var moduleType = getTypeOfSymbol(importSymbol); return moduleType ? moduleType.symbol : undefined; } case 7: - if (node.parent.kind == 150 && node.parent.argumentExpression === node) { + if (node.parent.kind == 152 && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -14726,7 +15095,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 205) { + if (location && location.kind === 208) { return resolveEntityName(location, location.name, 107455); } return undefined; @@ -14800,7 +15169,7 @@ var ts; return [symbol]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 207; + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 210; } function isNodeDescendentOf(node, ancestor) { while (node) { @@ -14818,7 +15187,7 @@ var ts; return false; } if (symbolWithRelevantName.flags & 8388608) { - var importDeclarationWithRelevantName = ts.getDeclarationOfKind(symbolWithRelevantName, 197); + var importDeclarationWithRelevantName = ts.getDeclarationOfKind(symbolWithRelevantName, 200); if (isReferencedImportDeclaration(importDeclarationWithRelevantName)) { return false; } @@ -14842,7 +15211,7 @@ var ts; function getLocalNameForSymbol(symbol, location) { var node = location; while (node) { - if ((node.kind === 195 || node.kind === 194) && getSymbolOfNode(node) === symbol) { + if ((node.kind === 198 || node.kind === 197) && getSymbolOfNode(node) === symbol) { return getLocalNameOfContainer(node); } node = node.parent; @@ -14866,7 +15235,7 @@ var ts; return symbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol) ? symbolToString(symbol) : undefined; } function isTopLevelValueImportWithEntityName(node) { - if (node.parent.kind !== 207 || !ts.isInternalModuleImportDeclaration(node)) { + if (node.parent.kind !== 210 || !ts.isInternalModuleImportDeclaration(node)) { return false; } return isImportResolvedToValue(getSymbolOfNode(node)); @@ -14892,7 +15261,8 @@ var ts; if (ts.nodeIsPresent(node.body)) { var symbol = getSymbolOfNode(node); var signaturesOfSymbol = getSignaturesOfSymbol(symbol); - return signaturesOfSymbol.length > 1 || (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + return signaturesOfSymbol.length > 1 || + (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); } return false; } @@ -14904,14 +15274,14 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 206) { + if (node.kind === 209) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; if (symbol && (symbol.flags & 8)) { var declaration = symbol.valueDeclaration; var constantValue; - if (declaration.kind === 206) { + if (declaration.kind === 209) { return getEnumMemberValue(declaration); } } @@ -14960,7 +15330,7 @@ var ts; getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); getSymbolLinks(unknownSymbol).type = unknownType; globals[undefinedSymbol.name] = undefinedSymbol; - globalArraySymbol = getGlobalSymbol("Array"); + globalArraySymbol = getGlobalTypeSymbol("Array"); globalArrayType = getTypeOfGlobalSymbol(globalArraySymbol, 1); globalObjectType = getGlobalType("Object"); globalFunctionType = getGlobalType("Function"); @@ -14968,29 +15338,38 @@ var ts; globalNumberType = getGlobalType("Number"); globalBooleanType = getGlobalType("Boolean"); globalRegExpType = getGlobalType("RegExp"); - globalTemplateStringsArrayType = languageVersion >= 2 ? getGlobalType("TemplateStringsArray") : unknownType; + if (languageVersion >= 2) { + globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); + globalESSymbolType = getGlobalType("Symbol"); + globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); + } + else { + globalTemplateStringsArrayType = unknownType; + globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + globalESSymbolConstructorSymbol = undefined; + } anyArrayType = createArrayType(anyType); } function checkGrammarModifiers(node) { switch (node.kind) { - case 130: + case 132: + case 133: case 131: - case 129: - case 126: - case 125: case 128: case 127: - case 134: - case 191: - case 192: - case 195: + case 130: + case 129: + case 136: case 194: + case 195: case 198: - case 171: - case 190: - case 193: case 197: - case 124: + case 201: + case 173: + case 193: + case 196: + case 200: + case 126: break; default: return false; @@ -15024,7 +15403,7 @@ var ts; else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (node.parent.kind === 196 || node.parent.kind === 207) { + else if (node.parent.kind === 199 || node.parent.kind === 210) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -15033,10 +15412,10 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 196 || node.parent.kind === 207) { + else if (node.parent.kind === 199 || node.parent.kind === 210) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } - else if (node.kind === 124) { + else if (node.kind === 126) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } flags |= 128; @@ -15049,10 +15428,10 @@ var ts; else if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (node.parent.kind === 191) { + else if (node.parent.kind === 194) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 124) { + else if (node.kind === 126) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; @@ -15061,13 +15440,13 @@ var ts; if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (node.parent.kind === 191) { + else if (node.parent.kind === 194) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 124) { + else if (node.kind === 126) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 196) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 199) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -15075,7 +15454,7 @@ var ts; break; } } - if (node.kind === 129) { + if (node.kind === 131) { if (flags & 128) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -15086,13 +15465,13 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if (node.kind === 197 && flags & 2) { + else if (node.kind === 200 && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 192 && flags & 2) { + else if (node.kind === 195 && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } - else if (node.kind === 124 && (flags & 112) && ts.isBindingPattern(node.name)) { + else if (node.kind === 126 && (flags & 112) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } } @@ -15160,25 +15539,25 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter); } } - else if (parameter.dotDotDotToken) { + if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - else if (parameter.flags & 243) { + if (parameter.flags & 243) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } - else if (parameter.questionToken) { + if (parameter.questionToken) { return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark); } - else if (parameter.initializer) { + if (parameter.initializer) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_initializer); } - else if (!parameter.type) { + if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - else if (parameter.type.kind !== 119 && parameter.type.kind !== 117) { + if (parameter.type.kind !== 119 && parameter.type.kind !== 117) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } - else if (!node.type) { + if (!node.type) { return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_a_type_annotation); } } @@ -15199,21 +15578,23 @@ var ts; } } function checkGrammarTypeArguments(node, typeArguments) { - return checkGrammarForDisallowedTrailingComma(typeArguments) || checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + return checkGrammarForDisallowedTrailingComma(typeArguments) || + checkGrammarForAtLeastOneTypeArgument(node, typeArguments); } function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); for (var i = 0, n = arguments.length; i < n; i++) { var arg = arguments[i]; - if (arg.kind === 168) { + if (arg.kind === 170) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } } } function checkGrammarArguments(node, arguments) { - return checkGrammarForDisallowedTrailingComma(arguments) || checkGrammarForOmittedArgument(node, arguments); + return checkGrammarForDisallowedTrailingComma(arguments) || + checkGrammarForOmittedArgument(node, arguments); } function checkGrammarHeritageClause(node) { var types = node.types; @@ -15278,14 +15659,11 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 122) { + if (node.kind !== 124) { return false; } var computedPropertyName = node; - if (languageVersion < 2) { - return grammarErrorOnNode(node, ts.Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); - } - else if (computedPropertyName.expression.kind === 163 && computedPropertyName.expression.operator === 23) { + if (computedPropertyName.expression.kind === 165 && computedPropertyName.expression.operatorToken.kind === 23) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } @@ -15312,25 +15690,26 @@ var ts; for (var i = 0, n = node.properties.length; i < n; i++) { var prop = node.properties[i]; var name = prop.name; - if (prop.kind === 168 || name.kind === 122) { + if (prop.kind === 170 || + name.kind === 124) { checkGrammarComputedPropertyName(name); continue; } var currentKind; - if (prop.kind === 204 || prop.kind === 205) { + if (prop.kind === 207 || prop.kind === 208) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 7) { checkGrammarNumbericLiteral(name); } currentKind = Property; } - else if (prop.kind === 128) { + else if (prop.kind === 130) { currentKind = Property; } - else if (prop.kind === 130) { + else if (prop.kind === 132) { currentKind = GetAccessor; } - else if (prop.kind === 131) { + else if (prop.kind === 133) { currentKind = SetAccesor; } else { @@ -15360,6 +15739,37 @@ var ts; } } } + function checkGrammarForInOrForOfStatement(forInOrOfStatement) { + if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { + return true; + } + if (forInOrOfStatement.initializer.kind === 192) { + var variableList = forInOrOfStatement.initializer; + if (!checkGrammarVariableDeclarationList(variableList)) { + if (variableList.declarations.length > 1) { + var diagnostic = forInOrOfStatement.kind === 180 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); + } + var firstDeclaration = variableList.declarations[0]; + if (firstDeclaration.initializer) { + var diagnostic = forInOrOfStatement.kind === 180 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + return grammarErrorOnNode(firstDeclaration.name, diagnostic); + } + if (firstDeclaration.type) { + var diagnostic = forInOrOfStatement.kind === 180 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + return grammarErrorOnNode(firstDeclaration, diagnostic); + } + } + } + return false; + } + function checkGrammarForOfStatement(forOfStatement) { + return grammarErrorOnFirstToken(forOfStatement, ts.Diagnostics.for_of_statements_are_not_currently_supported); + if (languageVersion < 2) { + return grammarErrorOnFirstToken(forOfStatement, ts.Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); + } + return checkGrammarForInOrForOfStatement(forOfStatement); + } function checkGrammarAccessor(accessor) { var kind = accessor.kind; if (languageVersion < 1) { @@ -15374,10 +15784,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 130 && accessor.parameters.length) { + else if (kind === 132 && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 131) { + else if (kind === 133) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -15401,16 +15811,18 @@ var ts; } } } - function checkGrammarForDisallowedComputedProperty(node, message) { - if (node.kind === 122) { + function checkGrammarForNonSymbolComputedProperty(node, message) { + if (node.kind === 124 && !ts.isWellKnownSymbolSyntactically(node.expression)) { return grammarErrorOnNode(node, message); } } function checkGrammarMethod(node) { - if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionLikeDeclaration(node) || checkGrammarForGenerator(node)) { + if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionLikeDeclaration(node) || + checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 148) { + if (node.parent.kind === 150) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -15418,32 +15830,33 @@ var ts; return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } - if (node.parent.kind === 191) { + if (node.parent.kind === 194) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } if (ts.isInAmbientContext(node)) { - return checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_an_ambient_context); + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol); } else if (!node.body) { - return checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_method_overloads); + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 192) { - return checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_interfaces); + else if (node.parent.kind === 195) { + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 139) { - return checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_type_literals); + else if (node.parent.kind === 141) { + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { + case 179: + case 180: + case 181: case 177: case 178: - case 175: - case 176: return true; - case 184: + case 187: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -15455,17 +15868,17 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 184: + case 187: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 179 && !isIterationStatement(current.statement, true); + var isMisplacedContinueLabel = node.kind === 182 && !isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } return false; } break; - case 183: - if (node.kind === 180 && !node.label) { + case 186: + if (node.kind === 183 && !node.label) { return false; } break; @@ -15478,11 +15891,11 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 180 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + var message = node.kind === 183 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 180 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + var message = node.kind === 183 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } } @@ -15518,7 +15931,8 @@ var ts; } } var checkLetConstNames = languageVersion >= 2 && (ts.isLet(node) || ts.isConst(node)); - return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || + checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 64) { @@ -15552,14 +15966,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 174: - case 175: case 176: - case 182: case 177: case 178: + case 185: + case 179: + case 180: + case 181: return false; - case 184: + case 187: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -15575,7 +15990,7 @@ var ts; } } function isIntegerLiteral(expression) { - if (expression.kind === 161) { + if (expression.kind === 163) { var unaryExpression = expression; if (unaryExpression.operator === 33 || unaryExpression.operator === 34) { expression = unaryExpression.operand; @@ -15594,7 +16009,7 @@ var ts; var inAmbientContext = ts.isInAmbientContext(enumDecl); for (var i = 0, n = enumDecl.members.length; i < n; i++) { var node = enumDecl.members[i]; - if (node.name.kind === 122) { + if (node.name.kind === 124) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } else if (inAmbientContext) { @@ -15662,18 +16077,19 @@ var ts; } } function checkGrammarProperty(node) { - if (node.parent.kind === 191) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_class_property_declarations)) { + if (node.parent.kind === 194) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || + checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 192) { - if (checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_interfaces)) { + else if (node.parent.kind === 195) { + if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 139) { - if (checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_type_literals)) { + else if (node.parent.kind === 141) { + if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } } @@ -15682,7 +16098,10 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 192 || node.kind === 197 || node.kind === 198 || (node.flags & 2)) { + if (node.kind === 195 || + node.kind === 200 || + node.kind === 201 || + (node.flags & 2)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -15690,7 +16109,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var i = 0, n = file.statements.length; i < n; i++) { var decl = file.statements[i]; - if (ts.isDeclaration(decl) || decl.kind === 171) { + if (ts.isDeclaration(decl) || decl.kind === 173) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -15700,7 +16119,7 @@ var ts; function checkGrammarSourceFile(node) { return ts.isInAmbientContext(node) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node); } - function checkGrammarForStatementInAmbientContext(node) { + function checkGrammarStatementInAmbientContext(node) { if (ts.isInAmbientContext(node)) { if (isAccessor(node.parent.kind)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = true; @@ -15709,7 +16128,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isAnyFunction(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 170 || node.parent.kind === 196 || node.parent.kind === 207) { + if (node.parent.kind === 172 || node.parent.kind === 199 || node.parent.kind === 210) { var links = getNodeLinks(node.parent); if (!links.hasReportedStatementInAmbientContext) { return links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -15833,7 +16252,8 @@ var ts; return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; } function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { - if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && + getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { writer.writeLine(); } } @@ -15859,13 +16279,13 @@ var ts; function writeCommentRange(currentSourceFile, writer, comment, newLine) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { var firstCommentLineAndCharacter = ts.getLineAndCharacterOfPosition(currentSourceFile, comment.pos); - var lastLine = ts.getLineStarts(currentSourceFile).length; + var lineCount = ts.getLineStarts(currentSourceFile).length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = currentLine === lastLine ? (comment.end + 1) : ts.getPositionFromLineAndCharacter(currentSourceFile, currentLine + 1, 1); + var nextLineStart = (currentLine + 1) === lineCount ? currentSourceFile.text.length + 1 : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); if (pos !== comment.pos) { if (firstCommentLineIndent === undefined) { - firstCommentLineIndent = calculateIndent(ts.getPositionFromLineAndCharacter(currentSourceFile, firstCommentLineAndCharacter.line, 1), comment.pos); + firstCommentLineIndent = calculateIndent(ts.getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); } var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(pos, nextLineStart); @@ -15917,21 +16337,21 @@ var ts; } function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 129 && ts.nodeIsPresent(member.body)) { + if (member.kind === 131 && ts.nodeIsPresent(member.body)) { return member; } }); } - function getAllAccessorDeclarations(node, accessor) { + function getAllAccessorDeclarations(declarations, accessor) { var firstAccessor; var getAccessor; var setAccessor; - if (accessor.name.kind === 122) { + if (ts.hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 130) { + if (accessor.kind === 132) { getAccessor = accessor; } - else if (accessor.kind === 131) { + else if (accessor.kind === 133) { setAccessor = accessor; } else { @@ -15939,16 +16359,20 @@ var ts; } } else { - ts.forEach(node.members, function (member) { - if ((member.kind === 130 || member.kind === 131) && member.name.text === accessor.name.text && (member.flags & 128) === (accessor.flags & 128)) { - if (!firstAccessor) { - firstAccessor = member; - } - if (member.kind === 130 && !getAccessor) { - getAccessor = member; - } - if (member.kind === 131 && !setAccessor) { - setAccessor = member; + ts.forEach(declarations, function (member) { + if ((member.kind === 132 || member.kind === 133) && (member.flags & 128) === (accessor.flags & 128)) { + var memberName = ts.getPropertyNameForPropertyNameNode(member.name); + var accessorName = ts.getPropertyNameForPropertyNameNode(accessor.name); + if (memberName === accessorName) { + if (!firstAccessor) { + firstAccessor = member; + } + if (member.kind === 132 && !getAccessor) { + getAccessor = member; + } + if (member.kind === 133 && !setAccessor) { + setAccessor = member; + } } } }); @@ -15992,8 +16416,7 @@ var ts; var enclosingDeclaration; var currentSourceFile; var reportedDeclarationError = false; - var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { - } : writeJsDocComments; + var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; var emit = compilerOptions.stripInternal ? stripInternal : emitNode; var aliasDeclarationEmitInfo = []; var referencePathsOutput = ""; @@ -16002,7 +16425,9 @@ var ts; var addedGlobalFileReference = false; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - if (referencedFile && ((referencedFile.flags & 1024) || shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { + if (referencedFile && ((referencedFile.flags & 1024) || + shouldEmitToOwnFile(referencedFile, compilerOptions) || + !addedGlobalFileReference)) { writeReferencePath(referencedFile); if (!isExternalModuleOrDeclarationFile(referencedFile)) { addedGlobalFileReference = true; @@ -16019,7 +16444,8 @@ var ts; if (!compilerOptions.noResolve) { ts.forEach(sourceFile.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { + if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && + !ts.contains(emittedReferencedFiles, referencedFile))) { writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); } @@ -16162,35 +16588,36 @@ var ts; case 119: case 117: case 111: + case 120: case 98: case 8: return writeTextOfNode(currentSourceFile, type); - case 135: - return emitTypeReference(type); - case 138: - return emitTypeQuery(type); - case 140: - return emitArrayType(type); - case 141: - return emitTupleType(type); - case 142: - return emitUnionType(type); - case 143: - return emitParenType(type); - case 136: case 137: - return emitSignatureDeclarationWithJsDocComments(type); + return emitTypeReference(type); + case 140: + return emitTypeQuery(type); + case 142: + return emitArrayType(type); + case 143: + return emitTupleType(type); + case 144: + return emitUnionType(type); + case 145: + return emitParenType(type); + case 138: case 139: + return emitSignatureDeclarationWithJsDocComments(type); + case 141: return emitTypeLiteral(type); case 64: return emitEntityName(type); - case 121: + case 123: return emitEntityName(type); default: ts.Debug.fail("Unknown type annotation: " + type.kind); } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 197 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 200 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -16261,7 +16688,7 @@ var ts; if (node.flags & 1) { write("export "); } - if (node.kind !== 192) { + if (node.kind !== 195) { write("declare "); } } @@ -16321,7 +16748,7 @@ var ts; emitModuleElementDeclarationFlags(node); write("module "); writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 196) { + while (node.body.kind !== 199) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -16387,7 +16814,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 128 && (node.parent.flags & 32); + return node.parent.kind === 130 && (node.parent.flags & 32); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -16397,8 +16824,15 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 136 || node.parent.kind === 137 || (node.parent.parent && node.parent.parent.kind === 139)) { - ts.Debug.assert(node.parent.kind === 128 || node.parent.kind === 127 || node.parent.kind === 136 || node.parent.kind === 137 || node.parent.kind === 132 || node.parent.kind === 133); + if (node.parent.kind === 138 || + node.parent.kind === 139 || + (node.parent.parent && node.parent.parent.kind === 141)) { + ts.Debug.assert(node.parent.kind === 130 || + node.parent.kind === 129 || + node.parent.kind === 138 || + node.parent.kind === 139 || + node.parent.kind === 134 || + node.parent.kind === 135); emitType(node.constraint); } else { @@ -16408,31 +16842,31 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 191: + case 194: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 192: + case 195: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 133: + case 135: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 132: + case 134: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 128: - case 127: + case 130: + case 129: if (node.parent.flags & 128) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 191) { + else if (node.parent.parent.kind === 194) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 190: + case 193: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -16460,7 +16894,7 @@ var ts; emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 191) { + if (node.parent.parent.kind === 194) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { @@ -16539,12 +16973,12 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 188 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 191 || resolver.isDeclarationVisible(node)) { writeTextOfNode(currentSourceFile, node.name); - if ((node.kind === 126 || node.kind === 125) && ts.hasQuestionToken(node)) { + if ((node.kind === 128 || node.kind === 127) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 126 || node.kind === 125) && node.parent.kind === 139) { + if ((node.kind === 128 || node.kind === 127) && node.parent.kind === 141) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 32)) { @@ -16553,14 +16987,14 @@ var ts; } function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.kind === 188) { + if (node.kind === 191) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 126 || node.kind === 125) { + else if (node.kind === 128 || node.kind === 127) { if (node.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 191) { + else if (node.parent.kind === 194) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { @@ -16603,7 +17037,7 @@ var ts; if (ts.hasDynamicName(node)) { return; } - var accessors = getAllAccessorDeclarations(node.parent, node); + var accessors = getAllAccessorDeclarations(node.parent.members, node); if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); @@ -16613,7 +17047,7 @@ var ts; var accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 130 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 132 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -16626,12 +17060,12 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 130 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; + return accessor.kind === 132 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; } } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 131) { + if (accessorWithTypeAnnotation.kind === 133) { if (accessorWithTypeAnnotation.parent.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } @@ -16663,19 +17097,20 @@ var ts; if (ts.hasDynamicName(node)) { return; } - if ((node.kind !== 190 || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { + if ((node.kind !== 193 || resolver.isDeclarationVisible(node)) && + !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 190) { + if (node.kind === 193) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 128) { + else if (node.kind === 130) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 190) { + if (node.kind === 193) { write("function "); writeTextOfNode(currentSourceFile, node.name); } - else if (node.kind === 129) { + else if (node.kind === 131) { write("constructor"); } else { @@ -16692,11 +17127,11 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - if (node.kind === 133 || node.kind === 137) { + if (node.kind === 135 || node.kind === 139) { write("new "); } emitTypeParameters(node.typeParameters); - if (node.kind === 134) { + if (node.kind === 136) { write("["); } else { @@ -16705,20 +17140,20 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 134) { + if (node.kind === 136) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 136 || node.kind === 137; - if (isFunctionTypeOrConstructorType || node.parent.kind === 139) { + var isFunctionTypeOrConstructorType = node.kind === 138 || node.kind === 139; + if (isFunctionTypeOrConstructorType || node.parent.kind === 141) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 129 && !(node.flags & 32)) { + else if (node.kind !== 131 && !(node.flags & 32)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -16729,28 +17164,28 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 133: + case 135: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 132: + case 134: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 134: + case 136: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 128: - case 127: + case 130: + case 129: if (node.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 191) { + else if (node.parent.kind === 194) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 190: + case 193: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: @@ -16778,7 +17213,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 136 || node.parent.kind === 137 || node.parent.parent.kind === 139) { + if (node.parent.kind === 138 || + node.parent.kind === 139 || + node.parent.parent.kind === 141) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { @@ -16787,28 +17224,28 @@ var ts; function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 129: + case 131: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; break; - case 133: + case 135: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 132: + case 134: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 128: - case 127: + case 130: + case 129: if (node.parent.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 191) { + else if (node.parent.parent.kind === 194) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 190: + case 193: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -16823,40 +17260,40 @@ var ts; } function emitNode(node) { switch (node.kind) { + case 131: + case 193: + case 130: case 129: - case 190: + return emitFunctionDeclaration(node); + case 135: + case 134: + case 136: + return emitSignatureDeclarationWithJsDocComments(node); + case 132: + case 133: + return emitAccessorDeclaration(node); + case 173: + return emitVariableStatement(node); case 128: case 127: - return emitFunctionDeclaration(node); - case 133: - case 132: - case 134: - return emitSignatureDeclarationWithJsDocComments(node); - case 130: - case 131: - return emitAccessorDeclaration(node); - case 171: - return emitVariableStatement(node); - case 126: - case 125: return emitPropertyDeclaration(node); - case 192: - return emitInterfaceDeclaration(node); - case 191: - return emitClassDeclaration(node); - case 193: - return emitTypeAliasDeclaration(node); - case 206: - return emitEnumMemberDeclaration(node); - case 194: - return emitEnumDeclaration(node); case 195: - return emitModuleDeclaration(node); + return emitInterfaceDeclaration(node); + case 194: + return emitClassDeclaration(node); + case 196: + return emitTypeAliasDeclaration(node); + case 209: + return emitEnumMemberDeclaration(node); case 197: - return emitImportDeclaration(node); + return emitEnumDeclaration(node); case 198: + return emitModuleDeclaration(node); + case 200: + return emitImportDeclaration(node); + case 201: return emitExportAssignment(node); - case 207: + case 210: return emitSourceFile(node); } } @@ -16918,28 +17355,19 @@ var ts; var tempVariables; var tempParameters; var writeEmittedFiles = writeJavaScriptFile; - var emitLeadingComments = compilerOptions.removeComments ? function (node) { - } : emitLeadingDeclarationComments; - var emitTrailingComments = compilerOptions.removeComments ? function (node) { - } : emitTrailingDeclarationComments; - var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { - } : emitLeadingCommentsOfLocalPosition; + var emitLeadingComments = compilerOptions.removeComments ? function (node) { } : emitLeadingDeclarationComments; + var emitTrailingComments = compilerOptions.removeComments ? function (node) { } : emitTrailingDeclarationComments; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfLocalPosition; var detachedCommentsInfo; - var emitDetachedComments = compilerOptions.removeComments ? function (node) { - } : emitDetachedCommentsAtPosition; - var emitPinnedOrTripleSlashComments = compilerOptions.removeComments ? function (node) { - } : emitPinnedOrTripleSlashCommentsOfNode; + var emitDetachedComments = compilerOptions.removeComments ? function (node) { } : emitDetachedCommentsAtPosition; + var emitPinnedOrTripleSlashComments = compilerOptions.removeComments ? function (node) { } : emitPinnedOrTripleSlashCommentsOfNode; var writeComment = writeCommentRange; var emit = emitNode; - var emitStart = function (node) { - }; - var emitEnd = function (node) { - }; + var emitStart = function (node) { }; + var emitEnd = function (node) { }; var emitToken = emitTokenText; - var scopeEmitStart = function (scopeDeclaration, scopeName) { - }; - var scopeEmitEnd = function () { - }; + var scopeEmitStart = function (scopeDeclaration, scopeName) { }; + var scopeEmitEnd = function () { }; var sourceMapData; if (compilerOptions.sourceMap) { initializeEmitterWithSourceMaps(); @@ -17027,9 +17455,16 @@ var ts; } function recordSourceMapSpan(pos) { var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); + sourceLinePos.line++; + sourceLinePos.character++; var emittedLine = writer.getLine(); var emittedColumn = writer.getColumn(); - if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan.emittedLine != emittedLine || lastRecordedSourceMapSpan.emittedColumn != emittedColumn || (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + if (!lastRecordedSourceMapSpan || + lastRecordedSourceMapSpan.emittedLine != emittedLine || + lastRecordedSourceMapSpan.emittedColumn != emittedColumn || + (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { encodeLastRecordedSourceMapSpan(); lastRecordedSourceMapSpan = { emittedLine: emittedLine, @@ -17075,7 +17510,7 @@ var ts; var parentIndex = getSourceMapNameIndex(); if (parentIndex !== -1) { var name = node.name; - if (!name || name.kind !== 122) { + if (!name || name.kind !== 124) { scopeName = "." + scopeName; } scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; @@ -17092,10 +17527,18 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 190 || node.kind === 156 || node.kind === 128 || node.kind === 127 || node.kind === 130 || node.kind === 131 || node.kind === 195 || node.kind === 191 || node.kind === 194) { + else if (node.kind === 193 || + node.kind === 158 || + node.kind === 130 || + node.kind === 129 || + node.kind === 132 || + node.kind === 133 || + node.kind === 198 || + node.kind === 194 || + node.kind === 197) { if (node.name) { var name = node.name; - scopeName = name.kind === 122 ? ts.getTextOfNode(name) : node.name.text; + scopeName = name.kind === 124 ? ts.getTextOfNode(name) : node.name.text; } recordScopeNameStart(scopeName); } @@ -17175,7 +17618,7 @@ var ts; } function emitNodeWithMap(node) { if (node) { - if (node.kind != 207) { + if (node.kind != 210) { recordEmitNodeStartSpan(node); emitNode(node); recordEmitNodeEndSpan(node); @@ -17217,6 +17660,11 @@ var ts; } tempVariables.push(name); } + function createAndRecordTempVariable(location) { + var temp = createTempVariable(location, false); + recordTempDeclaration(temp); + return temp; + } function emitTempDeclarations(newLine) { if (tempVariables) { if (newLine) { @@ -17260,10 +17708,44 @@ var ts; write(","); } } - function emitList(nodes, start, count, multiLine, trailingComma) { - if (multiLine) { - increaseIndent(); + function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { + ts.Debug.assert(nodes.length > 0); + increaseIndent(); + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (spacesBetweenBraces) { + write(" "); + } } + else { + writeLine(); + } + for (var i = 0, n = nodes.length; i < n; i++) { + if (i) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + write(", "); + } + else { + write(","); + writeLine(); + } + } + emit(nodes[i]); + } + var closeTokenIsOnSameLineAsLastElement = nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes)); + if (nodes.hasTrailingComma && allowTrailingComma) { + write(","); + } + decreaseIndent(); + if (closeTokenIsOnSameLineAsLastElement) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + } + function emitList(nodes, start, count, multiLine, trailingComma) { for (var i = 0; i < count; i++) { if (multiLine) { if (i) { @@ -17282,7 +17764,6 @@ var ts; write(","); } if (multiLine) { - decreaseIndent(); writeLine(); } } @@ -17291,11 +17772,6 @@ var ts; emitList(nodes, 0, nodes.length, false, false); } } - function emitMultiLineList(nodes) { - if (nodes) { - emitList(nodes, 0, nodes.length, true, false); - } - } function emitLines(nodes) { emitLinesStartingAt(nodes, 0); } @@ -17309,7 +17785,8 @@ var ts; if (text.length <= 0) { return false; } - if (text.charCodeAt(1) === 66 || text.charCodeAt(1) === 98 || text.charCodeAt(1) === 79 || text.charCodeAt(1) === 111) { + if (text.charCodeAt(1) === 66 || text.charCodeAt(1) === 98 || + text.charCodeAt(1) === 79 || text.charCodeAt(1) === 111) { return true; } return false; @@ -17345,7 +17822,7 @@ var ts; } for (var i = 0; i < node.templateSpans.length; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 155 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + var needsParens = templateSpan.expression.kind !== 157 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); } @@ -17364,11 +17841,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 151: - case 152: - return parent.expression === template; case 153: + case 154: + return parent.expression === template; case 155: + case 157: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1; @@ -17376,8 +17853,8 @@ var ts; } function comparePrecedenceToBinaryPlus(expression) { switch (expression.kind) { - case 163: - switch (expression.operator) { + case 165: + switch (expression.operatorToken.kind) { case 35: case 36: case 37: @@ -17388,7 +17865,7 @@ var ts; default: return -1; } - case 164: + case 166: return -1; default: return 1; @@ -17400,10 +17877,11 @@ var ts; emit(span.literal); } function emitExpressionForPropertyName(node) { + ts.Debug.assert(node.kind !== 148); if (node.kind === 8) { emitLiteral(node); } - else if (node.kind === 122) { + else if (node.kind === 124) { emit(node.expression); } else { @@ -17420,33 +17898,33 @@ var ts; function isNotExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 124: - case 188: - case 146: case 126: - case 125: - case 204: - case 205: - case 206: + case 191: + case 148: case 128: case 127: - case 190: + case 207: + case 208: + case 209: case 130: - case 131: - case 156: - case 191: - case 192: + case 129: + case 193: + case 132: + case 133: + case 158: case 194: case 195: case 197: - return parent.name === node; - case 180: - case 179: case 198: + case 200: + return parent.name === node; + case 183: + case 182: + case 201: return false; - case 184: + case 187: return node.parent.label === node; - case 203: + case 206: return node.parent.name === node; } } @@ -17524,11 +18002,11 @@ var ts; function needsParenthesisForPropertyAccess(node) { switch (node.kind) { case 64: - case 147: case 149: - case 150: case 151: - case 155: + case 152: + case 153: + case 157: return false; } return true; @@ -17545,18 +18023,24 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 167) { + if (e.kind === 169) { e = e.expression; emitParenthesized(e, group === 0 && needsParenthesisForPropertyAccess(e)); pos++; } else { var i = pos; - while (i < length && elements[i].kind !== 167) { + while (i < length && elements[i].kind !== 169) { i++; } write("["); + if (multiLine) { + increaseIndent(); + } emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + if (multiLine) { + decreaseIndent(); + } write("]"); pos = i; } @@ -17566,32 +18050,187 @@ var ts; write(")"); } } + function isSpreadElementExpression(node) { + return node.kind === 169; + } function emitArrayLiteral(node) { var elements = node.elements; if (elements.length === 0) { write("[]"); } - else if (languageVersion >= 2) { + else if (languageVersion >= 2 || !ts.forEach(elements, isSpreadElementExpression)) { write("["); - emitList(elements, 0, elements.length, (node.flags & 256) !== 0, elements.hasTrailingComma); + emitLinePreservingList(node, node.elements, elements.hasTrailingComma, false); write("]"); } else { emitListWithSpread(elements, (node.flags & 256) !== 0, elements.hasTrailingComma); } } + function createSynthesizedNode(kind) { + var node = ts.createNode(kind); + node.pos = -1; + node.end = -1; + return node; + } + function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { + var parenthesizedObjectLiteral = createDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex); + return emit(parenthesizedObjectLiteral); + } + function createDownlevelObjectLiteralWithComputedProperties(originalObjectLiteral, firstComputedPropertyIndex) { + var tempVar = createAndRecordTempVariable(originalObjectLiteral); + var initialObjectLiteral = createSynthesizedNode(150); + initialObjectLiteral.properties = originalObjectLiteral.properties.slice(0, firstComputedPropertyIndex); + initialObjectLiteral.flags |= 256; + var propertyPatches = createBinaryExpression(tempVar, 52, initialObjectLiteral); + ts.forEach(originalObjectLiteral.properties, function (property) { + var patchedProperty = tryCreatePatchingPropertyAssignment(originalObjectLiteral, tempVar, property); + if (patchedProperty) { + propertyPatches = createBinaryExpression(propertyPatches, 23, patchedProperty); + } + }); + propertyPatches = createBinaryExpression(propertyPatches, 23, tempVar); + var result = createParenthesizedExpression(propertyPatches); + return result; + } + function addCommentsToSynthesizedNode(node, leadingCommentRanges, trailingCommentRanges) { + node.leadingCommentRanges = leadingCommentRanges; + node.trailingCommentRanges = trailingCommentRanges; + } + function tryCreatePatchingPropertyAssignment(objectLiteral, tempVar, property) { + var leftHandSide = createMemberAccessForPropertyName(tempVar, property.name); + var maybeRightHandSide = tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property); + return maybeRightHandSide && createBinaryExpression(leftHandSide, 52, maybeRightHandSide); + } + function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property) { + switch (property.kind) { + case 207: + return property.initializer; + case 208: + var prefix = createIdentifier(resolver.getExpressionNamePrefix(property.name)); + return createPropertyAccessExpression(prefix, property.name); + case 130: + return createFunctionExpression(property.parameters, property.body); + case 132: + case 133: + var _a = getAllAccessorDeclarations(objectLiteral.properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + if (firstAccessor !== property) { + return undefined; + } + var propertyDescriptor = createSynthesizedNode(150); + var descriptorProperties = []; + if (getAccessor) { + var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); + descriptorProperties.push(getProperty); + } + if (setAccessor) { + var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpression(setAccessor.parameters, setAccessor.body)); + descriptorProperties.push(setProperty); + } + var trueExpr = createSynthesizedNode(94); + var enumerableTrue = createPropertyAssignment(createIdentifier("enumerable"), trueExpr); + descriptorProperties.push(enumerableTrue); + var configurableTrue = createPropertyAssignment(createIdentifier("configurable"), trueExpr); + descriptorProperties.push(configurableTrue); + propertyDescriptor.properties = descriptorProperties; + var objectDotDefineProperty = createPropertyAccessExpression(createIdentifier("Object"), createIdentifier("defineProperty")); + return createCallExpression(objectDotDefineProperty, createNodeArray(propertyDescriptor)); + default: + ts.Debug.fail("ObjectLiteralElement kind " + property.kind + " not accounted for."); + } + } + function createParenthesizedExpression(expression) { + var result = createSynthesizedNode(157); + result.expression = expression; + return result; + } + function createNodeArray() { + var elements = []; + for (var _i = 0; _i < arguments.length; _i++) { + elements[_i - 0] = arguments[_i]; + } + var result = elements; + result.pos = -1; + result.end = -1; + return result; + } + function createBinaryExpression(left, operator, right) { + var result = createSynthesizedNode(165); + result.operatorToken = createSynthesizedNode(operator); + result.left = left; + result.right = right; + return result; + } + function createMemberAccessForPropertyName(expression, memberName) { + if (memberName.kind === 64) { + return createPropertyAccessExpression(expression, memberName); + } + else if (memberName.kind === 8 || memberName.kind === 7) { + return createElementAccessExpression(expression, memberName); + } + else if (memberName.kind === 124) { + return createElementAccessExpression(expression, memberName.expression); + } + else { + ts.Debug.fail("Kind '" + memberName.kind + "' not accounted for."); + } + } + function createPropertyAssignment(name, initializer) { + var result = createSynthesizedNode(207); + result.name = name; + result.initializer = initializer; + return result; + } + function createFunctionExpression(parameters, body) { + var result = createSynthesizedNode(158); + result.parameters = parameters; + result.body = body; + return result; + } + function createPropertyAccessExpression(expression, name) { + var result = createSynthesizedNode(151); + result.expression = expression; + result.name = name; + return result; + } + function createElementAccessExpression(expression, argumentExpression) { + var result = createSynthesizedNode(152); + result.expression = expression; + result.argumentExpression = argumentExpression; + return result; + } + function createIdentifier(name) { + var result = createSynthesizedNode(64); + result.text = name; + return result; + } + function createCallExpression(invokedExpression, arguments) { + var result = createSynthesizedNode(153); + result.expression = invokedExpression; + result.arguments = arguments; + return result; + } function emitObjectLiteral(node) { + var properties = node.properties; + if (languageVersion < 2) { + var numProperties = properties.length; + var numInitialNonComputedProperties = numProperties; + for (var i = 0, n = properties.length; i < n; i++) { + if (properties[i].name.kind === 124) { + numInitialNonComputedProperties = i; + break; + } + } + var hasComputedProperty = numInitialNonComputedProperties !== properties.length; + if (hasComputedProperty) { + emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); + return; + } + } write("{"); var properties = node.properties; if (properties.length) { - var multiLine = (node.flags & 256) !== 0; - if (!multiLine) { - write(" "); - } - emitList(properties, 0, properties.length, multiLine, properties.hasTrailingComma && languageVersion >= 1); - if (!multiLine) { - write(" "); - } + emitLinePreservingList(node, properties, languageVersion >= 1, true); } write("}"); } @@ -17614,7 +18253,7 @@ var ts; } function emitShorthandPropertyAssignment(node) { emit(node.name); - if (languageVersion < 2 || resolver.getExpressionNamePrefix(node.name)) { + if (languageVersion <= 1 || resolver.getExpressionNamePrefix(node.name)) { write(": "); emitExpressionIdentifier(node.name); } @@ -17624,7 +18263,7 @@ var ts; if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 149 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 151 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; @@ -17654,10 +18293,10 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 167; }); + return ts.forEach(elements, function (e) { return e.kind === 169; }); } function skipParentheses(node) { - while (node.kind === 155 || node.kind === 154) { + while (node.kind === 157 || node.kind === 156) { node = node.expression; } return node; @@ -17667,8 +18306,7 @@ var ts; emit(node); return node; } - var temp = createTempVariable(node); - recordTempDeclaration(temp); + var temp = createAndRecordTempVariable(node); write("("); emit(temp); write(" = "); @@ -17679,12 +18317,12 @@ var ts; function emitCallWithSpread(node) { var target; var expr = skipParentheses(node.expression); - if (expr.kind === 149) { + if (expr.kind === 151) { target = emitCallTarget(expr.expression); write("."); emit(expr.name); } - else if (expr.kind === 150) { + else if (expr.kind === 152) { target = emitCallTarget(expr.expression); write("["); emit(expr.argumentExpression); @@ -17725,7 +18363,7 @@ var ts; } else { emit(node.expression); - superCall = node.expression.kind === 149 && node.expression.expression.kind === 90; + superCall = node.expression.kind === 151 && node.expression.expression.kind === 90; } if (superCall) { write(".call("); @@ -17757,12 +18395,19 @@ var ts; emit(node.template); } function emitParenExpression(node) { - if (node.expression.kind === 154) { + if (node.expression.kind === 156) { var operand = node.expression.expression; - while (operand.kind == 154) { + while (operand.kind == 156) { operand = operand.expression; } - if (operand.kind !== 161 && operand.kind !== 160 && operand.kind !== 159 && operand.kind !== 158 && operand.kind !== 162 && operand.kind !== 152 && !(operand.kind === 151 && node.parent.kind === 152) && !(operand.kind === 156 && node.parent.kind === 151)) { + if (operand.kind !== 163 && + operand.kind !== 162 && + operand.kind !== 161 && + operand.kind !== 160 && + operand.kind !== 164 && + operand.kind !== 154 && + !(operand.kind === 153 && node.parent.kind === 154) && + !(operand.kind === 158 && node.parent.kind === 153)) { emit(operand); return; } @@ -17788,7 +18433,7 @@ var ts; } function emitPrefixUnaryExpression(node) { write(ts.tokenToString(node.operator)); - if (node.operand.kind === 161) { + if (node.operand.kind === 163) { var operand = node.operand; if (node.operator === 33 && (operand.operator === 33 || operand.operator === 38)) { write(" "); @@ -17804,18 +18449,48 @@ var ts; write(ts.tokenToString(node.operator)); } function emitBinaryExpression(node) { - if (languageVersion < 2 && node.operator === 52 && (node.left.kind === 148 || node.left.kind === 147)) { + if (languageVersion < 2 && node.operatorToken.kind === 52 && + (node.left.kind === 150 || node.left.kind === 149)) { emitDestructuring(node); } else { emit(node.left); - if (node.operator !== 23) + if (node.operatorToken.kind !== 23) { write(" "); - write(ts.tokenToString(node.operator)); - write(" "); + } + write(ts.tokenToString(node.operatorToken.kind)); + var operatorEnd = ts.getLineAndCharacterOfPosition(currentSourceFile, node.operatorToken.end); + var rightStart = ts.getLineAndCharacterOfPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.right.pos)); + var onDifferentLine = operatorEnd.line !== rightStart.line; + if (onDifferentLine) { + var exprStart = ts.getLineAndCharacterOfPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + var firstCharOfExpr = getFirstNonWhitespaceCharacterIndexOnLine(exprStart.line); + var shouldIndent = rightStart.character > firstCharOfExpr; + if (shouldIndent) { + increaseIndent(); + } + writeLine(); + } + else { + write(" "); + } emit(node.right); + if (shouldIndent) { + decreaseIndent(); + } } } + function getFirstNonWhitespaceCharacterIndexOnLine(line) { + var lineStart = ts.getLineStarts(currentSourceFile)[line]; + var text = currentSourceFile.text; + for (var i = lineStart; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (!ts.isWhiteSpace(text.charCodeAt(i)) || ts.isLineBreak(ch)) { + break; + } + } + return i - lineStart; + } function emitConditionalExpression(node) { emit(node.condition); write(" ? "); @@ -17823,14 +18498,14 @@ var ts; write(" : "); emit(node.whenFalse); } - function isSingleLineBlock(node) { - if (node && node.kind === 170) { + function isSingleLineEmptyBlock(node) { + if (node && node.kind === 172) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } } function emitBlock(node) { - if (isSingleLineBlock(node)) { + if (isSingleLineEmptyBlock(node)) { emitToken(14, node.pos); write(" "); emitToken(15, node.statements.end); @@ -17839,12 +18514,12 @@ var ts; emitToken(14, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 196) { - ts.Debug.assert(node.parent.kind === 195); + if (node.kind === 199) { + ts.Debug.assert(node.parent.kind === 198); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 196) { + if (node.kind === 199) { emitTempDeclarations(true); } decreaseIndent(); @@ -17853,7 +18528,7 @@ var ts; scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 170) { + if (node.kind === 172) { write(" "); emit(node); } @@ -17865,7 +18540,7 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesized(node.expression, node.expression.kind === 157); + emitParenthesized(node.expression, node.expression.kind === 159); write(";"); } function emitIfStatement(node) { @@ -17878,7 +18553,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(75, node.thenStatement.end); - if (node.elseStatement.kind === 174) { + if (node.elseStatement.kind === 176) { write(" "); emit(node.elseStatement); } @@ -17890,7 +18565,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 170) { + if (node.statement.kind === 172) { write(" "); } else { @@ -17910,7 +18585,7 @@ var ts; var endPos = emitToken(81, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer && node.initializer.kind === 189) { + if (node.initializer && node.initializer.kind === 192) { var variableDeclarationList = node.initializer; var declarations = variableDeclarationList.declarations; if (declarations[0] && ts.isLet(declarations[0])) { @@ -17935,11 +18610,11 @@ var ts; write(")"); emitEmbeddedStatement(node.statement); } - function emitForInStatement(node) { + function emitForInOrForOfStatement(node) { var endPos = emitToken(81, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer.kind === 189) { + if (node.initializer.kind === 192) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; @@ -17956,13 +18631,18 @@ var ts; else { emit(node.initializer); } - write(" in "); + if (node.kind === 180) { + write(" in "); + } + else { + write(" of "); + } emit(node.expression); emitToken(17, node.expression.end); emitEmbeddedStatement(node.statement); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 180 ? 65 : 70, node.pos); + emitToken(node.kind === 183 ? 65 : 70, node.pos); emitOptional(" ", node.label); write(";"); } @@ -17991,14 +18671,20 @@ var ts; writeLine(); emitToken(15, node.clauses.end); } - function isOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + function nodeStartPositionsAreOnSameLine(node1, node2) { + return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function nodeEndPositionsAreOnSameLine(node1, node2) { + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 200) { + if (node.kind === 203) { write("case "); emit(node.expression); write(":"); @@ -18006,7 +18692,7 @@ var ts; else { write("default:"); } - if (node.statements.length === 1 && isOnSameLine(node, node.statements[0])) { + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -18053,7 +18739,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 195); + } while (node && node.kind !== 198); return node; } function emitModuleMemberName(node) { @@ -18068,8 +18754,8 @@ var ts; } function emitDestructuring(root, value) { var emitCount = 0; - var isDeclaration = (root.kind === 188 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 124; - if (root.kind === 163) { + var isDeclaration = (root.kind === 191 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 126; + if (root.kind === 165) { emitAssignmentExpression(root); } else { @@ -18079,7 +18765,7 @@ var ts; if (emitCount++) { write(", "); } - if (name.parent && (name.parent.kind === 188 || name.parent.kind === 146)) { + if (name.parent && (name.parent.kind === 191 || name.parent.kind === 148)) { emitModuleMemberName(name.parent); } else { @@ -18102,17 +18788,17 @@ var ts; function createVoidZero() { var zero = ts.createNode(7); zero.text = "0"; - var result = ts.createNode(160); + var result = ts.createNode(162); result.expression = zero; return result; } function createDefaultValueCheck(value, defaultValue) { value = ensureIdentifier(value); - var equals = ts.createNode(163); + var equals = ts.createNode(165); equals.left = value; - equals.operator = 30; + equals.operatorToken = ts.createNode(30); equals.right = createVoidZero(); - var cond = ts.createNode(164); + var cond = ts.createNode(166); cond.condition = equals; cond.whenTrue = defaultValue; cond.whenFalse = value; @@ -18124,10 +18810,10 @@ var ts; return node; } function parenthesizeForAccess(expr) { - if (expr.kind === 64 || expr.kind === 149 || expr.kind === 150) { + if (expr.kind === 64 || expr.kind === 151 || expr.kind === 152) { return expr; } - var node = ts.createNode(155); + var node = ts.createNode(157); node.expression = expr; return node; } @@ -18135,13 +18821,13 @@ var ts; if (propName.kind !== 64) { return createElementAccess(object, propName); } - var node = ts.createNode(149); + var node = ts.createNode(151); node.expression = parenthesizeForAccess(object); node.name = propName; return node; } function createElementAccess(object, index) { - var node = ts.createNode(150); + var node = ts.createNode(152); node.expression = parenthesizeForAccess(object); node.argumentExpression = index; return node; @@ -18153,7 +18839,7 @@ var ts; } for (var i = 0; i < properties.length; i++) { var p = properties[i]; - if (p.kind === 204 || p.kind === 205) { + if (p.kind === 207 || p.kind === 208) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); } @@ -18166,8 +18852,8 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 168) { - if (e.kind !== 167) { + if (e.kind !== 170) { + if (e.kind !== 169) { emitDestructuringAssignment(e, createElementAccess(value, createNumericLiteral(i))); } else { @@ -18181,14 +18867,14 @@ var ts; } } function emitDestructuringAssignment(target, value) { - if (target.kind === 163 && target.operator === 52) { + if (target.kind === 165 && target.operatorToken.kind === 52) { value = createDefaultValueCheck(value, target.right); target = target.left; } - if (target.kind === 148) { + if (target.kind === 150) { emitObjectLiteralAssignment(target, value); } - else if (target.kind === 147) { + else if (target.kind === 149) { emitArrayLiteralAssignment(target, value); } else { @@ -18198,18 +18884,18 @@ var ts; function emitAssignmentExpression(root) { var target = root.left; var value = root.right; - if (root.parent.kind === 173) { + if (root.parent.kind === 175) { emitDestructuringAssignment(target, value); } else { - if (root.parent.kind !== 155) { + if (root.parent.kind !== 157) { write("("); } value = ensureIdentifier(value); emitDestructuringAssignment(target, value); write(", "); emit(value); - if (root.parent.kind !== 155) { + if (root.parent.kind !== 157) { write(")"); } } @@ -18229,11 +18915,11 @@ var ts; } for (var i = 0; i < elements.length; i++) { var element = elements[i]; - if (pattern.kind === 144) { + if (pattern.kind === 146) { var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccess(value, propName)); } - else if (element.kind !== 168) { + else if (element.kind !== 170) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccess(value, createNumericLiteral(i))); } @@ -18372,28 +19058,28 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 130 ? "get " : "set "); + write(node.kind === 132 ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 157 && languageVersion >= 2; + return node.kind === 159 && languageVersion >= 2; } function emitFunctionDeclaration(node) { if (ts.nodeIsMissing(node.body)) { return emitPinnedOrTripleSlashComments(node); } - if (node.kind !== 128 && node.kind !== 127) { + if (node.kind !== 130 && node.kind !== 129) { emitLeadingComments(node); } if (!shouldEmitAsArrowFunction(node)) { write("function "); } - if (node.kind === 190 || (node.kind === 156 && node.name)) { + if (node.kind === 193 || (node.kind === 158 && node.name)) { emit(node.name); } emitSignatureAndBody(node); - if (node.kind !== 128 && node.kind !== 127) { + if (node.kind !== 130 && node.kind !== 129) { emitTrailingComments(node); } } @@ -18437,69 +19123,14 @@ var ts; else { emitSignatureParameters(node); } - if (isSingleLineBlock(node.body)) { + if (isSingleLineEmptyBlock(node.body) || !node.body) { write(" { }"); } + else if (node.body.kind === 172) { + emitBlockFunctionBody(node, node.body); + } else { - write(" {"); - scopeEmitStart(node); - if (!node.body) { - writeLine(); - write("}"); - } - else { - increaseIndent(); - emitDetachedComments(node.body.kind === 170 ? node.body.statements : node.body); - var startIndex = 0; - if (node.body.kind === 170) { - startIndex = emitDirectivePrologues(node.body.statements, true); - } - var outPos = writer.getTextPos(); - emitCaptureThisForNodeIfNecessary(node); - emitDefaultValueAssignments(node); - emitRestParameter(node); - if (node.body.kind !== 170 && outPos === writer.getTextPos()) { - decreaseIndent(); - write(" "); - emitStart(node.body); - write("return "); - emitNode(node.body, true); - emitEnd(node.body); - write(";"); - emitTempDeclarations(false); - write(" "); - emitStart(node.body); - write("}"); - emitEnd(node.body); - } - else { - if (node.body.kind === 170) { - emitLinesStartingAt(node.body.statements, startIndex); - } - else { - writeLine(); - emitLeadingComments(node.body); - write("return "); - emit(node.body, true); - write(";"); - emitTrailingComments(node.body); - } - emitTempDeclarations(true); - writeLine(); - if (node.body.kind === 170) { - emitLeadingCommentsOfPosition(node.body.statements.end); - decreaseIndent(); - emitToken(15, node.body.statements.end); - } - else { - decreaseIndent(); - emitStart(node.body); - write("}"); - emitEnd(node.body); - } - } - } - scopeEmitEnd(); + emitExpressionFunctionBody(node, node.body); } if (node.flags & 1) { writeLine(); @@ -18514,12 +19145,83 @@ var ts; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } + function emitFunctionBodyPreamble(node) { + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + } + function emitExpressionFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + increaseIndent(); + var outPos = writer.getTextPos(); + emitDetachedComments(node.body); + emitFunctionBodyPreamble(node); + var preambleEmitted = writer.getTextPos() !== outPos; + decreaseIndent(); + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + write(" "); + emitStart(body); + write("return "); + emitNode(body, true); + emitEnd(body); + write(";"); + emitTempDeclarations(false); + write(" "); + } + else { + increaseIndent(); + writeLine(); + emitLeadingComments(node.body); + write("return "); + emit(node.body, true); + write(";"); + emitTrailingComments(node.body); + emitTempDeclarations(true); + decreaseIndent(); + writeLine(); + } + emitStart(node.body); + write("}"); + emitEnd(node.body); + scopeEmitEnd(); + } + function emitBlockFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + var outPos = writer.getTextPos(); + increaseIndent(); + emitDetachedComments(body.statements); + var startIndex = emitDirectivePrologues(body.statements, true); + emitFunctionBodyPreamble(node); + decreaseIndent(); + var preambleEmitted = writer.getTextPos() !== outPos; + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var i = 0, n = body.statements.length; i < n; i++) { + write(" "); + emit(body.statements[i]); + } + emitTempDeclarations(false); + write(" "); + emitLeadingCommentsOfPosition(body.statements.end); + } + else { + increaseIndent(); + emitLinesStartingAt(body.statements, startIndex); + emitTempDeclarations(true); + writeLine(); + emitLeadingCommentsOfPosition(body.statements.end); + decreaseIndent(); + } + emitToken(15, body.statements.end); + scopeEmitEnd(); + } function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 173) { + if (statement && statement.kind === 175) { var expr = statement.expression; - if (expr && expr.kind === 151) { + if (expr && expr.kind === 153) { var func = expr.expression; if (func && func.kind === 90) { return statement; @@ -18550,7 +19252,7 @@ var ts; emitNode(memberName); write("]"); } - else if (memberName.kind === 122) { + else if (memberName.kind === 124) { emitComputedPropertyName(memberName); } else { @@ -18560,7 +19262,7 @@ var ts; } function emitMemberAssignments(node, staticFlag) { ts.forEach(node.members, function (member) { - if (member.kind === 126 && (member.flags & 128) === staticFlag && member.initializer) { + if (member.kind === 128 && (member.flags & 128) === staticFlag && member.initializer) { writeLine(); emitLeadingComments(member); emitStart(member); @@ -18583,7 +19285,7 @@ var ts; } function emitMemberFunctions(node) { ts.forEach(node.members, function (member) { - if (member.kind === 128 || node.kind === 127) { + if (member.kind === 130 || node.kind === 129) { if (!member.body) { return emitPinnedOrTripleSlashComments(member); } @@ -18605,8 +19307,8 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 130 || member.kind === 131) { - var accessors = getAllAccessorDeclarations(node, member); + else if (member.kind === 132 || member.kind === 133) { + var accessors = getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); emitStart(member); @@ -18713,7 +19415,7 @@ var ts; tempVariables = undefined; tempParameters = undefined; ts.forEach(node.members, function (member) { - if (member.kind === 129 && !member.body) { + if (member.kind === 131 && !member.body) { emitPinnedOrTripleSlashComments(member); } }); @@ -18856,7 +19558,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 195) { + if (moduleDeclaration.body.kind === 198) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -18881,7 +19583,7 @@ var ts; write(resolver.getLocalNameOfContainer(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 196) { + if (node.body.kind === 199) { var saveTempCount = tempCount; var saveTempVariables = tempVariables; tempCount = 0; @@ -18920,7 +19622,7 @@ var ts; emitImportDeclaration = !ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportWithEntityName(node); } if (emitImportDeclaration) { - if (ts.isExternalModuleImportDeclaration(node) && node.parent.kind === 207 && compilerOptions.module === 2) { + if (ts.isExternalModuleImportDeclaration(node) && node.parent.kind === 210 && compilerOptions.module === 2) { if (node.flags & 1) { writeLine(); emitLeadingComments(node); @@ -18969,7 +19671,7 @@ var ts; } function getFirstExportAssignment(sourceFile) { return ts.forEach(sourceFile.statements, function (node) { - if (node.kind === 198) { + if (node.kind === 201) { return node; } }); @@ -19123,15 +19825,15 @@ var ts; } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 192: - case 190: - case 197: - case 193: - case 198: - return false; case 195: + case 193: + case 200: + case 196: + case 201: + return false; + case 198: return shouldEmitModuleDeclaration(node); - case 194: + case 197: return shouldEmitEnumDeclaration(node); } return true; @@ -19140,13 +19842,13 @@ var ts; switch (node.kind) { case 64: return emitIdentifier(node); - case 124: + case 126: return emitParameter(node); - case 128: - case 127: - return emitMethod(node); case 130: - case 131: + case 129: + return emitMethod(node); + case 132: + case 133: return emitAccessor(node); case 92: return emitThis(node); @@ -19166,120 +19868,121 @@ var ts; case 12: case 13: return emitLiteral(node); - case 165: - return emitTemplateExpression(node); - case 169: - return emitTemplateSpan(node); - case 121: - return emitQualifiedName(node); - case 144: - return emitObjectBindingPattern(node); - case 145: - return emitArrayBindingPattern(node); - case 146: - return emitBindingElement(node); - case 147: - return emitArrayLiteral(node); - case 148: - return emitObjectLiteral(node); - case 204: - return emitPropertyAssignment(node); - case 205: - return emitShorthandPropertyAssignment(node); - case 122: - return emitComputedPropertyName(node); - case 149: - return emitPropertyAccess(node); - case 150: - return emitIndexedAccess(node); - case 151: - return emitCallExpression(node); - case 152: - return emitNewExpression(node); - case 153: - return emitTaggedTemplateExpression(node); - case 154: - return emit(node.expression); - case 155: - return emitParenExpression(node); - case 190: - case 156: - case 157: - return emitFunctionDeclaration(node); - case 158: - return emitDeleteExpression(node); - case 159: - return emitTypeOfExpression(node); - case 160: - return emitVoidExpression(node); - case 161: - return emitPrefixUnaryExpression(node); - case 162: - return emitPostfixUnaryExpression(node); - case 163: - return emitBinaryExpression(node); - case 164: - return emitConditionalExpression(node); case 167: - return emitSpreadElementExpression(node); - case 168: - return; - case 170: - case 196: - return emitBlock(node); + return emitTemplateExpression(node); case 171: - return emitVariableStatement(node); - case 172: - return write(";"); - case 173: - return emitExpressionStatement(node); - case 174: - return emitIfStatement(node); - case 175: - return emitDoStatement(node); - case 176: - return emitWhileStatement(node); - case 177: - return emitForStatement(node); - case 178: - return emitForInStatement(node); - case 179: - case 180: - return emitBreakOrContinueStatement(node); - case 181: - return emitReturnStatement(node); - case 182: - return emitWithStatement(node); - case 183: - return emitSwitchStatement(node); - case 200: - case 201: - return emitCaseOrDefaultClause(node); - case 184: - return emitLabelledStatement(node); - case 185: - return emitThrowStatement(node); - case 186: - return emitTryStatement(node); - case 203: - return emitCatchClause(node); - case 187: - return emitDebuggerStatement(node); - case 188: - return emitVariableDeclaration(node); - case 191: - return emitClassDeclaration(node); - case 192: - return emitInterfaceDeclaration(node); - case 194: - return emitEnumDeclaration(node); - case 206: - return emitEnumMember(node); - case 195: - return emitModuleDeclaration(node); - case 197: - return emitImportDeclaration(node); + return emitTemplateSpan(node); + case 123: + return emitQualifiedName(node); + case 146: + return emitObjectBindingPattern(node); + case 147: + return emitArrayBindingPattern(node); + case 148: + return emitBindingElement(node); + case 149: + return emitArrayLiteral(node); + case 150: + return emitObjectLiteral(node); case 207: + return emitPropertyAssignment(node); + case 208: + return emitShorthandPropertyAssignment(node); + case 124: + return emitComputedPropertyName(node); + case 151: + return emitPropertyAccess(node); + case 152: + return emitIndexedAccess(node); + case 153: + return emitCallExpression(node); + case 154: + return emitNewExpression(node); + case 155: + return emitTaggedTemplateExpression(node); + case 156: + return emit(node.expression); + case 157: + return emitParenExpression(node); + case 193: + case 158: + case 159: + return emitFunctionDeclaration(node); + case 160: + return emitDeleteExpression(node); + case 161: + return emitTypeOfExpression(node); + case 162: + return emitVoidExpression(node); + case 163: + return emitPrefixUnaryExpression(node); + case 164: + return emitPostfixUnaryExpression(node); + case 165: + return emitBinaryExpression(node); + case 166: + return emitConditionalExpression(node); + case 169: + return emitSpreadElementExpression(node); + case 170: + return; + case 172: + case 199: + return emitBlock(node); + case 173: + return emitVariableStatement(node); + case 174: + return write(";"); + case 175: + return emitExpressionStatement(node); + case 176: + return emitIfStatement(node); + case 177: + return emitDoStatement(node); + case 178: + return emitWhileStatement(node); + case 179: + return emitForStatement(node); + case 181: + case 180: + return emitForInOrForOfStatement(node); + case 182: + case 183: + return emitBreakOrContinueStatement(node); + case 184: + return emitReturnStatement(node); + case 185: + return emitWithStatement(node); + case 186: + return emitSwitchStatement(node); + case 203: + case 204: + return emitCaseOrDefaultClause(node); + case 187: + return emitLabelledStatement(node); + case 188: + return emitThrowStatement(node); + case 189: + return emitTryStatement(node); + case 206: + return emitCatchClause(node); + case 190: + return emitDebuggerStatement(node); + case 191: + return emitVariableDeclaration(node); + case 194: + return emitClassDeclaration(node); + case 195: + return emitInterfaceDeclaration(node); + case 197: + return emitEnumDeclaration(node); + case 209: + return emitEnumMember(node); + case 198: + return emitModuleDeclaration(node); + case 200: + return emitImportDeclaration(node); + case 210: return emitSourceFile(node); } } @@ -19298,7 +20001,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 207 || node.pos !== node.parent.pos) { + if (node.parent.kind === 210 || node.pos !== node.parent.pos) { var leadingComments; if (hasDetachedComments(node.pos)) { leadingComments = getLeadingCommentsWithoutDetachedComments(); @@ -19317,7 +20020,7 @@ var ts; } function emitTrailingDeclarationComments(node) { if (node.parent) { - if (node.parent.kind === 207 || node.end !== node.parent.end) { + if (node.parent.kind === 210 || node.end !== node.parent.end) { var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); } @@ -19352,8 +20055,8 @@ var ts; }); if (detachedComments.length) { var lastCommentLine = getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); - var astLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); - if (astLine >= lastCommentLine + 2) { + var nodeLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; @@ -19373,7 +20076,10 @@ var ts; if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && comment.pos + 2 < comment.end && currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { + else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && + currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { return true; } } @@ -19694,7 +20400,8 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (ts.isExternalModuleImportDeclaration(node) && ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { + if (ts.isExternalModuleImportDeclaration(node) && + ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { var nameLiteral = ts.getExternalModuleImportDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { @@ -19712,9 +20419,10 @@ var ts; } } } - else if (node.kind === 195 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { + else if (node.kind === 198 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportDeclaration(node) && ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { + if (ts.isExternalModuleImportDeclaration(node) && + ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { var nameLiteral = ts.getExternalModuleImportDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { @@ -19749,7 +20457,10 @@ var ts; var errorLength = externalModuleErrorSpan.end - errorStart; diagnostics.add(ts.createFileDiagnostic(firstExternalModule, errorStart, errorLength, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } - if (options.outDir || options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModule !== undefined))) { + if (options.outDir || + options.sourceRoot || + (options.mapRoot && + (!options.out || firstExternalModule !== undefined))) { var commonPathComponents; ts.forEach(files, function (sourceFile) { if (!(sourceFile.flags & 1024) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { @@ -20141,7 +20852,8 @@ var ts; } var language = matchResult[1]; var territory = matchResult[3]; - if (!trySetLanguageAndTerritory(language, territory, errors) && !trySetLanguageAndTerritory(language, undefined, errors)) { + if (!trySetLanguageAndTerritory(language, territory, errors) && + !trySetLanguageAndTerritory(language, undefined, errors)) { errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_locale_0, locale)); return false; } @@ -20177,7 +20889,7 @@ var ts; function countLines(program) { var count = 0; ts.forEach(program.getSourceFiles(), function (file) { - count += ts.getLineAndCharacterOfPosition(file, file.end).line; + count += ts.getLineStarts(file).length; }); return count; } @@ -20193,7 +20905,7 @@ var ts; var output = ""; if (diagnostic.file) { var loc = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); - output += diagnostic.file.fileName + "(" + loc.line + "," + loc.character + "): "; + output += diagnostic.file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + "): "; } var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase(); output += category + " TS" + diagnostic.code + ": " + ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine) + ts.sys.newLine; @@ -20390,7 +21102,7 @@ var ts; var start = new Date().getTime(); var program = ts.createProgram(fileNames, compilerOptions, compilerHost); var exitStatus = compileProgram(); - var end = start - new Date().getTime(); + var end = new Date().getTime() - start; if (compilerOptions.listFiles) { ts.forEach(program.getSourceFiles(), function (file) { ts.sys.write(file.fileName + ts.sys.newLine); @@ -20411,7 +21123,7 @@ var ts; reportTimeStatistic("Bind time", ts.bindTime); reportTimeStatistic("Check time", ts.checkTime); reportTimeStatistic("Emit time", ts.emitTime); - reportTimeStatistic("Total time", start - end); + reportTimeStatistic("Total time", end); } return { program: program, exitStatus: exitStatus }; function compileProgram() { diff --git a/bin/typescript.d.ts b/bin/typescript.d.ts index 7c97542d8af..b0cc19c87d3 100644 --- a/bin/typescript.d.ts +++ b/bin/typescript.d.ts @@ -142,110 +142,113 @@ declare module "typescript" { NumberKeyword = 117, SetKeyword = 118, StringKeyword = 119, - TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + SymbolKeyword = 120, + TypeKeyword = 121, + OfKeyword = 122, + QualifiedName = 123, + ComputedPropertyName = 124, + TypeParameter = 125, + Parameter = 126, + PropertySignature = 127, + PropertyDeclaration = 128, + MethodSignature = 129, + MethodDeclaration = 130, + Constructor = 131, + GetAccessor = 132, + SetAccessor = 133, + CallSignature = 134, + ConstructSignature = 135, + IndexSignature = 136, + TypeReference = 137, + FunctionType = 138, + ConstructorType = 139, + TypeQuery = 140, + TypeLiteral = 141, + ArrayType = 142, + TupleType = 143, + UnionType = 144, + ParenthesizedType = 145, + ObjectBindingPattern = 146, + ArrayBindingPattern = 147, + BindingElement = 148, + ArrayLiteralExpression = 149, + ObjectLiteralExpression = 150, + PropertyAccessExpression = 151, + ElementAccessExpression = 152, + CallExpression = 153, + NewExpression = 154, + TaggedTemplateExpression = 155, + TypeAssertionExpression = 156, + ParenthesizedExpression = 157, + FunctionExpression = 158, + ArrowFunction = 159, + DeleteExpression = 160, + TypeOfExpression = 161, + VoidExpression = 162, + PrefixUnaryExpression = 163, + PostfixUnaryExpression = 164, + BinaryExpression = 165, + ConditionalExpression = 166, + TemplateExpression = 167, + YieldExpression = 168, + SpreadElementExpression = 169, + OmittedExpression = 170, + TemplateSpan = 171, + Block = 172, + VariableStatement = 173, + EmptyStatement = 174, + ExpressionStatement = 175, + IfStatement = 176, + DoStatement = 177, + WhileStatement = 178, + ForStatement = 179, + ForInStatement = 180, + ForOfStatement = 181, + ContinueStatement = 182, + BreakStatement = 183, + ReturnStatement = 184, + WithStatement = 185, + SwitchStatement = 186, + LabeledStatement = 187, + ThrowStatement = 188, + TryStatement = 189, + DebuggerStatement = 190, + VariableDeclaration = 191, + VariableDeclarationList = 192, + FunctionDeclaration = 193, + ClassDeclaration = 194, + InterfaceDeclaration = 195, + TypeAliasDeclaration = 196, + EnumDeclaration = 197, + ModuleDeclaration = 198, + ModuleBlock = 199, + ImportDeclaration = 200, + ExportAssignment = 201, + ExternalModuleReference = 202, + CaseClause = 203, + DefaultClause = 204, + HeritageClause = 205, + CatchClause = 206, + PropertyAssignment = 207, + ShorthandPropertyAssignment = 208, + EnumMember = 209, + SourceFile = 210, + SyntaxList = 211, + Count = 212, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 122, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 137, + LastTypeNode = 145, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 120, + LastToken = 122, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -254,7 +257,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 123, } const enum NodeFlags { Export = 1, @@ -487,7 +490,7 @@ declare module "typescript" { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { @@ -585,6 +588,10 @@ declare module "typescript" { initializer: VariableDeclarationList | Expression; expression: Expression; } + interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } interface BreakOrContinueStatement extends Statement { label?: Identifier; } @@ -994,8 +1001,9 @@ declare module "typescript" { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, @@ -1281,6 +1289,7 @@ declare module "typescript" { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, @@ -1347,8 +1356,8 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; @@ -1432,9 +1441,9 @@ declare module "typescript" { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -1496,7 +1505,7 @@ declare module "typescript" { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; @@ -1571,6 +1580,7 @@ declare module "typescript" { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number | string; } interface DefinitionInfo { fileName: string; @@ -1704,6 +1714,9 @@ declare module "typescript" { InMultiLineCommentTrivia = 1, InSingleQuoteStringLiteral = 2, InDoubleQuoteStringLiteral = 3, + InTemplateHeadOrNoSubstitutionTemplate = 4, + InTemplateMiddleOrTail = 5, + InTemplateSubstitutionPosition = 6, } enum TokenClass { Punctuation = 0, @@ -1725,7 +1738,26 @@ declare module "typescript" { classification: TokenClass; } interface Classifier { - getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; + /** + * Gives lexical classifications of tokens on a line without any syntactic context. + * For instance, a token consisting of the text 'string' can be either an identifier + * named 'string' or the keyword 'string', however, because this classifier is not aware, + * it relies on certain heuristics to give acceptable results. For classifications where + * speed trumps accuracy, this function is preferable; however, for true accuracy, the + * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the + * lexical, syntactic, and semantic classifiers may issue the best user experience. + * + * @param text The text of a line to classify. + * @param lexState The state of the lexical classifier at the end of the previous line. + * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier. + * If there is no syntactic classifier (syntacticClassifierAbsent=true), + * certain heuristics may be used in its place; however, if there is a + * syntactic classifier (syntacticClassifierAbsent=false), certain + * classifications which may be incorrectly categorized will be given + * back as Identifiers in order to allow the syntactic classifier to + * subsume the classification. + */ + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; } /** * The document registry represents a store of SourceFile objects that can be shared between diff --git a/bin/typescript.js b/bin/typescript.js new file mode 100644 index 00000000000..1d2c9f37ac8 --- /dev/null +++ b/bin/typescript.js @@ -0,0 +1,30159 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +var ts; +(function (ts) { + (function (SyntaxKind) { + SyntaxKind[SyntaxKind["Unknown"] = 0] = "Unknown"; + SyntaxKind[SyntaxKind["EndOfFileToken"] = 1] = "EndOfFileToken"; + SyntaxKind[SyntaxKind["SingleLineCommentTrivia"] = 2] = "SingleLineCommentTrivia"; + SyntaxKind[SyntaxKind["MultiLineCommentTrivia"] = 3] = "MultiLineCommentTrivia"; + SyntaxKind[SyntaxKind["NewLineTrivia"] = 4] = "NewLineTrivia"; + SyntaxKind[SyntaxKind["WhitespaceTrivia"] = 5] = "WhitespaceTrivia"; + SyntaxKind[SyntaxKind["ConflictMarkerTrivia"] = 6] = "ConflictMarkerTrivia"; + SyntaxKind[SyntaxKind["NumericLiteral"] = 7] = "NumericLiteral"; + SyntaxKind[SyntaxKind["StringLiteral"] = 8] = "StringLiteral"; + SyntaxKind[SyntaxKind["RegularExpressionLiteral"] = 9] = "RegularExpressionLiteral"; + SyntaxKind[SyntaxKind["NoSubstitutionTemplateLiteral"] = 10] = "NoSubstitutionTemplateLiteral"; + SyntaxKind[SyntaxKind["TemplateHead"] = 11] = "TemplateHead"; + SyntaxKind[SyntaxKind["TemplateMiddle"] = 12] = "TemplateMiddle"; + SyntaxKind[SyntaxKind["TemplateTail"] = 13] = "TemplateTail"; + SyntaxKind[SyntaxKind["OpenBraceToken"] = 14] = "OpenBraceToken"; + SyntaxKind[SyntaxKind["CloseBraceToken"] = 15] = "CloseBraceToken"; + SyntaxKind[SyntaxKind["OpenParenToken"] = 16] = "OpenParenToken"; + SyntaxKind[SyntaxKind["CloseParenToken"] = 17] = "CloseParenToken"; + SyntaxKind[SyntaxKind["OpenBracketToken"] = 18] = "OpenBracketToken"; + SyntaxKind[SyntaxKind["CloseBracketToken"] = 19] = "CloseBracketToken"; + SyntaxKind[SyntaxKind["DotToken"] = 20] = "DotToken"; + SyntaxKind[SyntaxKind["DotDotDotToken"] = 21] = "DotDotDotToken"; + SyntaxKind[SyntaxKind["SemicolonToken"] = 22] = "SemicolonToken"; + SyntaxKind[SyntaxKind["CommaToken"] = 23] = "CommaToken"; + SyntaxKind[SyntaxKind["LessThanToken"] = 24] = "LessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanToken"] = 25] = "GreaterThanToken"; + SyntaxKind[SyntaxKind["LessThanEqualsToken"] = 26] = "LessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanEqualsToken"] = 27] = "GreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsToken"] = 28] = "EqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsToken"] = 29] = "ExclamationEqualsToken"; + SyntaxKind[SyntaxKind["EqualsEqualsEqualsToken"] = 30] = "EqualsEqualsEqualsToken"; + SyntaxKind[SyntaxKind["ExclamationEqualsEqualsToken"] = 31] = "ExclamationEqualsEqualsToken"; + SyntaxKind[SyntaxKind["EqualsGreaterThanToken"] = 32] = "EqualsGreaterThanToken"; + SyntaxKind[SyntaxKind["PlusToken"] = 33] = "PlusToken"; + SyntaxKind[SyntaxKind["MinusToken"] = 34] = "MinusToken"; + SyntaxKind[SyntaxKind["AsteriskToken"] = 35] = "AsteriskToken"; + SyntaxKind[SyntaxKind["SlashToken"] = 36] = "SlashToken"; + SyntaxKind[SyntaxKind["PercentToken"] = 37] = "PercentToken"; + SyntaxKind[SyntaxKind["PlusPlusToken"] = 38] = "PlusPlusToken"; + SyntaxKind[SyntaxKind["MinusMinusToken"] = 39] = "MinusMinusToken"; + SyntaxKind[SyntaxKind["LessThanLessThanToken"] = 40] = "LessThanLessThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanToken"] = 41] = "GreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanToken"] = 42] = "GreaterThanGreaterThanGreaterThanToken"; + SyntaxKind[SyntaxKind["AmpersandToken"] = 43] = "AmpersandToken"; + SyntaxKind[SyntaxKind["BarToken"] = 44] = "BarToken"; + SyntaxKind[SyntaxKind["CaretToken"] = 45] = "CaretToken"; + SyntaxKind[SyntaxKind["ExclamationToken"] = 46] = "ExclamationToken"; + SyntaxKind[SyntaxKind["TildeToken"] = 47] = "TildeToken"; + SyntaxKind[SyntaxKind["AmpersandAmpersandToken"] = 48] = "AmpersandAmpersandToken"; + SyntaxKind[SyntaxKind["BarBarToken"] = 49] = "BarBarToken"; + SyntaxKind[SyntaxKind["QuestionToken"] = 50] = "QuestionToken"; + SyntaxKind[SyntaxKind["ColonToken"] = 51] = "ColonToken"; + SyntaxKind[SyntaxKind["EqualsToken"] = 52] = "EqualsToken"; + SyntaxKind[SyntaxKind["PlusEqualsToken"] = 53] = "PlusEqualsToken"; + SyntaxKind[SyntaxKind["MinusEqualsToken"] = 54] = "MinusEqualsToken"; + SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 55] = "AsteriskEqualsToken"; + SyntaxKind[SyntaxKind["SlashEqualsToken"] = 56] = "SlashEqualsToken"; + SyntaxKind[SyntaxKind["PercentEqualsToken"] = 57] = "PercentEqualsToken"; + SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 58] = "LessThanLessThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 59] = "GreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 60] = "GreaterThanGreaterThanGreaterThanEqualsToken"; + SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 61] = "AmpersandEqualsToken"; + SyntaxKind[SyntaxKind["BarEqualsToken"] = 62] = "BarEqualsToken"; + SyntaxKind[SyntaxKind["CaretEqualsToken"] = 63] = "CaretEqualsToken"; + SyntaxKind[SyntaxKind["Identifier"] = 64] = "Identifier"; + SyntaxKind[SyntaxKind["BreakKeyword"] = 65] = "BreakKeyword"; + SyntaxKind[SyntaxKind["CaseKeyword"] = 66] = "CaseKeyword"; + SyntaxKind[SyntaxKind["CatchKeyword"] = 67] = "CatchKeyword"; + SyntaxKind[SyntaxKind["ClassKeyword"] = 68] = "ClassKeyword"; + SyntaxKind[SyntaxKind["ConstKeyword"] = 69] = "ConstKeyword"; + SyntaxKind[SyntaxKind["ContinueKeyword"] = 70] = "ContinueKeyword"; + SyntaxKind[SyntaxKind["DebuggerKeyword"] = 71] = "DebuggerKeyword"; + SyntaxKind[SyntaxKind["DefaultKeyword"] = 72] = "DefaultKeyword"; + SyntaxKind[SyntaxKind["DeleteKeyword"] = 73] = "DeleteKeyword"; + SyntaxKind[SyntaxKind["DoKeyword"] = 74] = "DoKeyword"; + SyntaxKind[SyntaxKind["ElseKeyword"] = 75] = "ElseKeyword"; + SyntaxKind[SyntaxKind["EnumKeyword"] = 76] = "EnumKeyword"; + SyntaxKind[SyntaxKind["ExportKeyword"] = 77] = "ExportKeyword"; + SyntaxKind[SyntaxKind["ExtendsKeyword"] = 78] = "ExtendsKeyword"; + SyntaxKind[SyntaxKind["FalseKeyword"] = 79] = "FalseKeyword"; + SyntaxKind[SyntaxKind["FinallyKeyword"] = 80] = "FinallyKeyword"; + SyntaxKind[SyntaxKind["ForKeyword"] = 81] = "ForKeyword"; + SyntaxKind[SyntaxKind["FunctionKeyword"] = 82] = "FunctionKeyword"; + SyntaxKind[SyntaxKind["IfKeyword"] = 83] = "IfKeyword"; + SyntaxKind[SyntaxKind["ImportKeyword"] = 84] = "ImportKeyword"; + SyntaxKind[SyntaxKind["InKeyword"] = 85] = "InKeyword"; + SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 86] = "InstanceOfKeyword"; + SyntaxKind[SyntaxKind["NewKeyword"] = 87] = "NewKeyword"; + SyntaxKind[SyntaxKind["NullKeyword"] = 88] = "NullKeyword"; + SyntaxKind[SyntaxKind["ReturnKeyword"] = 89] = "ReturnKeyword"; + SyntaxKind[SyntaxKind["SuperKeyword"] = 90] = "SuperKeyword"; + SyntaxKind[SyntaxKind["SwitchKeyword"] = 91] = "SwitchKeyword"; + SyntaxKind[SyntaxKind["ThisKeyword"] = 92] = "ThisKeyword"; + SyntaxKind[SyntaxKind["ThrowKeyword"] = 93] = "ThrowKeyword"; + SyntaxKind[SyntaxKind["TrueKeyword"] = 94] = "TrueKeyword"; + SyntaxKind[SyntaxKind["TryKeyword"] = 95] = "TryKeyword"; + SyntaxKind[SyntaxKind["TypeOfKeyword"] = 96] = "TypeOfKeyword"; + SyntaxKind[SyntaxKind["VarKeyword"] = 97] = "VarKeyword"; + SyntaxKind[SyntaxKind["VoidKeyword"] = 98] = "VoidKeyword"; + SyntaxKind[SyntaxKind["WhileKeyword"] = 99] = "WhileKeyword"; + SyntaxKind[SyntaxKind["WithKeyword"] = 100] = "WithKeyword"; + SyntaxKind[SyntaxKind["ImplementsKeyword"] = 101] = "ImplementsKeyword"; + SyntaxKind[SyntaxKind["InterfaceKeyword"] = 102] = "InterfaceKeyword"; + SyntaxKind[SyntaxKind["LetKeyword"] = 103] = "LetKeyword"; + SyntaxKind[SyntaxKind["PackageKeyword"] = 104] = "PackageKeyword"; + SyntaxKind[SyntaxKind["PrivateKeyword"] = 105] = "PrivateKeyword"; + SyntaxKind[SyntaxKind["ProtectedKeyword"] = 106] = "ProtectedKeyword"; + SyntaxKind[SyntaxKind["PublicKeyword"] = 107] = "PublicKeyword"; + SyntaxKind[SyntaxKind["StaticKeyword"] = 108] = "StaticKeyword"; + SyntaxKind[SyntaxKind["YieldKeyword"] = 109] = "YieldKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 110] = "AnyKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 111] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 112] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 113] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 114] = "GetKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 115] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 116] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 117] = "NumberKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 118] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 119] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 120] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 121] = "TypeKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 122] = "OfKeyword"; + SyntaxKind[SyntaxKind["QualifiedName"] = 123] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 124] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["TypeParameter"] = 125] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 126] = "Parameter"; + SyntaxKind[SyntaxKind["PropertySignature"] = 127] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 128] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 129] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 130] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 131] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 132] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 133] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 134] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 135] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 136] = "IndexSignature"; + SyntaxKind[SyntaxKind["TypeReference"] = 137] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 138] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 139] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 140] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 141] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 142] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 143] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 144] = "UnionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 145] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 146] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 147] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 148] = "BindingElement"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 149] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 150] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 151] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 152] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 153] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 154] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 155] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 156] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 157] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 158] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 159] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 160] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 161] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 162] = "VoidExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 163] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 164] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 165] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 166] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 167] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 168] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElementExpression"] = 169] = "SpreadElementExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 170] = "OmittedExpression"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 171] = "TemplateSpan"; + SyntaxKind[SyntaxKind["Block"] = 172] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 173] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 174] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 175] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 176] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 177] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 178] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 179] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 180] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 181] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 182] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 183] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 184] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 185] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 186] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 187] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 188] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 189] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 190] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 191] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 192] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 193] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 194] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 195] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 196] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 197] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 198] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 199] = "ModuleBlock"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 200] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 201] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 202] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["CaseClause"] = 203] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 204] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 205] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 206] = "CatchClause"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 207] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 208] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 209] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 210] = "SourceFile"; + SyntaxKind[SyntaxKind["SyntaxList"] = 211] = "SyntaxList"; + SyntaxKind[SyntaxKind["Count"] = 212] = "Count"; + SyntaxKind[SyntaxKind["FirstAssignment"] = 52] = "FirstAssignment"; + SyntaxKind[SyntaxKind["LastAssignment"] = 63] = "LastAssignment"; + SyntaxKind[SyntaxKind["FirstReservedWord"] = 65] = "FirstReservedWord"; + SyntaxKind[SyntaxKind["LastReservedWord"] = 100] = "LastReservedWord"; + SyntaxKind[SyntaxKind["FirstKeyword"] = 65] = "FirstKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 122] = "LastKeyword"; + SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 101] = "FirstFutureReservedWord"; + SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 109] = "LastFutureReservedWord"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 137] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 145] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstPunctuation"] = 14] = "FirstPunctuation"; + SyntaxKind[SyntaxKind["LastPunctuation"] = 63] = "LastPunctuation"; + SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; + SyntaxKind[SyntaxKind["LastToken"] = 122] = "LastToken"; + SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; + SyntaxKind[SyntaxKind["LastTriviaToken"] = 6] = "LastTriviaToken"; + SyntaxKind[SyntaxKind["FirstLiteralToken"] = 7] = "FirstLiteralToken"; + SyntaxKind[SyntaxKind["LastLiteralToken"] = 10] = "LastLiteralToken"; + SyntaxKind[SyntaxKind["FirstTemplateToken"] = 10] = "FirstTemplateToken"; + SyntaxKind[SyntaxKind["LastTemplateToken"] = 13] = "LastTemplateToken"; + SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 24] = "FirstBinaryOperator"; + SyntaxKind[SyntaxKind["LastBinaryOperator"] = 63] = "LastBinaryOperator"; + SyntaxKind[SyntaxKind["FirstNode"] = 123] = "FirstNode"; + })(ts.SyntaxKind || (ts.SyntaxKind = {})); + var SyntaxKind = ts.SyntaxKind; + (function (NodeFlags) { + NodeFlags[NodeFlags["Export"] = 1] = "Export"; + NodeFlags[NodeFlags["Ambient"] = 2] = "Ambient"; + NodeFlags[NodeFlags["Public"] = 16] = "Public"; + NodeFlags[NodeFlags["Private"] = 32] = "Private"; + NodeFlags[NodeFlags["Protected"] = 64] = "Protected"; + NodeFlags[NodeFlags["Static"] = 128] = "Static"; + NodeFlags[NodeFlags["MultiLine"] = 256] = "MultiLine"; + NodeFlags[NodeFlags["Synthetic"] = 512] = "Synthetic"; + NodeFlags[NodeFlags["DeclarationFile"] = 1024] = "DeclarationFile"; + NodeFlags[NodeFlags["Let"] = 2048] = "Let"; + NodeFlags[NodeFlags["Const"] = 4096] = "Const"; + NodeFlags[NodeFlags["OctalLiteral"] = 8192] = "OctalLiteral"; + NodeFlags[NodeFlags["Modifier"] = 243] = "Modifier"; + NodeFlags[NodeFlags["AccessibilityModifier"] = 112] = "AccessibilityModifier"; + NodeFlags[NodeFlags["BlockScoped"] = 6144] = "BlockScoped"; + })(ts.NodeFlags || (ts.NodeFlags = {})); + var NodeFlags = ts.NodeFlags; + (function (ParserContextFlags) { + ParserContextFlags[ParserContextFlags["StrictMode"] = 1] = "StrictMode"; + ParserContextFlags[ParserContextFlags["DisallowIn"] = 2] = "DisallowIn"; + ParserContextFlags[ParserContextFlags["Yield"] = 4] = "Yield"; + ParserContextFlags[ParserContextFlags["GeneratorParameter"] = 8] = "GeneratorParameter"; + ParserContextFlags[ParserContextFlags["ThisNodeHasError"] = 16] = "ThisNodeHasError"; + ParserContextFlags[ParserContextFlags["ParserGeneratedFlags"] = 31] = "ParserGeneratedFlags"; + ParserContextFlags[ParserContextFlags["ThisNodeOrAnySubNodesHasError"] = 32] = "ThisNodeOrAnySubNodesHasError"; + ParserContextFlags[ParserContextFlags["HasAggregatedChildData"] = 64] = "HasAggregatedChildData"; + })(ts.ParserContextFlags || (ts.ParserContextFlags = {})); + var ParserContextFlags = ts.ParserContextFlags; + (function (RelationComparisonResult) { + RelationComparisonResult[RelationComparisonResult["Succeeded"] = 1] = "Succeeded"; + RelationComparisonResult[RelationComparisonResult["Failed"] = 2] = "Failed"; + RelationComparisonResult[RelationComparisonResult["FailedAndReported"] = 3] = "FailedAndReported"; + })(ts.RelationComparisonResult || (ts.RelationComparisonResult = {})); + var RelationComparisonResult = ts.RelationComparisonResult; + (function (ExitStatus) { + ExitStatus[ExitStatus["Success"] = 0] = "Success"; + ExitStatus[ExitStatus["DiagnosticsPresent_OutputsSkipped"] = 1] = "DiagnosticsPresent_OutputsSkipped"; + ExitStatus[ExitStatus["DiagnosticsPresent_OutputsGenerated"] = 2] = "DiagnosticsPresent_OutputsGenerated"; + })(ts.ExitStatus || (ts.ExitStatus = {})); + var ExitStatus = ts.ExitStatus; + (function (TypeFormatFlags) { + TypeFormatFlags[TypeFormatFlags["None"] = 0] = "None"; + TypeFormatFlags[TypeFormatFlags["WriteArrayAsGenericType"] = 1] = "WriteArrayAsGenericType"; + TypeFormatFlags[TypeFormatFlags["UseTypeOfFunction"] = 2] = "UseTypeOfFunction"; + TypeFormatFlags[TypeFormatFlags["NoTruncation"] = 4] = "NoTruncation"; + TypeFormatFlags[TypeFormatFlags["WriteArrowStyleSignature"] = 8] = "WriteArrowStyleSignature"; + TypeFormatFlags[TypeFormatFlags["WriteOwnNameForAnyLike"] = 16] = "WriteOwnNameForAnyLike"; + TypeFormatFlags[TypeFormatFlags["WriteTypeArgumentsOfSignature"] = 32] = "WriteTypeArgumentsOfSignature"; + TypeFormatFlags[TypeFormatFlags["InElementType"] = 64] = "InElementType"; + TypeFormatFlags[TypeFormatFlags["UseFullyQualifiedType"] = 128] = "UseFullyQualifiedType"; + })(ts.TypeFormatFlags || (ts.TypeFormatFlags = {})); + var TypeFormatFlags = ts.TypeFormatFlags; + (function (SymbolFormatFlags) { + SymbolFormatFlags[SymbolFormatFlags["None"] = 0] = "None"; + SymbolFormatFlags[SymbolFormatFlags["WriteTypeParametersOrArguments"] = 1] = "WriteTypeParametersOrArguments"; + SymbolFormatFlags[SymbolFormatFlags["UseOnlyExternalAliasing"] = 2] = "UseOnlyExternalAliasing"; + })(ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); + var SymbolFormatFlags = ts.SymbolFormatFlags; + (function (SymbolAccessibility) { + SymbolAccessibility[SymbolAccessibility["Accessible"] = 0] = "Accessible"; + SymbolAccessibility[SymbolAccessibility["NotAccessible"] = 1] = "NotAccessible"; + SymbolAccessibility[SymbolAccessibility["CannotBeNamed"] = 2] = "CannotBeNamed"; + })(ts.SymbolAccessibility || (ts.SymbolAccessibility = {})); + var SymbolAccessibility = ts.SymbolAccessibility; + (function (SymbolFlags) { + SymbolFlags[SymbolFlags["FunctionScopedVariable"] = 1] = "FunctionScopedVariable"; + SymbolFlags[SymbolFlags["BlockScopedVariable"] = 2] = "BlockScopedVariable"; + SymbolFlags[SymbolFlags["Property"] = 4] = "Property"; + SymbolFlags[SymbolFlags["EnumMember"] = 8] = "EnumMember"; + SymbolFlags[SymbolFlags["Function"] = 16] = "Function"; + SymbolFlags[SymbolFlags["Class"] = 32] = "Class"; + SymbolFlags[SymbolFlags["Interface"] = 64] = "Interface"; + SymbolFlags[SymbolFlags["ConstEnum"] = 128] = "ConstEnum"; + SymbolFlags[SymbolFlags["RegularEnum"] = 256] = "RegularEnum"; + SymbolFlags[SymbolFlags["ValueModule"] = 512] = "ValueModule"; + SymbolFlags[SymbolFlags["NamespaceModule"] = 1024] = "NamespaceModule"; + SymbolFlags[SymbolFlags["TypeLiteral"] = 2048] = "TypeLiteral"; + SymbolFlags[SymbolFlags["ObjectLiteral"] = 4096] = "ObjectLiteral"; + SymbolFlags[SymbolFlags["Method"] = 8192] = "Method"; + SymbolFlags[SymbolFlags["Constructor"] = 16384] = "Constructor"; + SymbolFlags[SymbolFlags["GetAccessor"] = 32768] = "GetAccessor"; + SymbolFlags[SymbolFlags["SetAccessor"] = 65536] = "SetAccessor"; + SymbolFlags[SymbolFlags["Signature"] = 131072] = "Signature"; + SymbolFlags[SymbolFlags["TypeParameter"] = 262144] = "TypeParameter"; + SymbolFlags[SymbolFlags["TypeAlias"] = 524288] = "TypeAlias"; + SymbolFlags[SymbolFlags["ExportValue"] = 1048576] = "ExportValue"; + SymbolFlags[SymbolFlags["ExportType"] = 2097152] = "ExportType"; + SymbolFlags[SymbolFlags["ExportNamespace"] = 4194304] = "ExportNamespace"; + SymbolFlags[SymbolFlags["Import"] = 8388608] = "Import"; + SymbolFlags[SymbolFlags["Instantiated"] = 16777216] = "Instantiated"; + SymbolFlags[SymbolFlags["Merged"] = 33554432] = "Merged"; + SymbolFlags[SymbolFlags["Transient"] = 67108864] = "Transient"; + SymbolFlags[SymbolFlags["Prototype"] = 134217728] = "Prototype"; + SymbolFlags[SymbolFlags["UnionProperty"] = 268435456] = "UnionProperty"; + SymbolFlags[SymbolFlags["Optional"] = 536870912] = "Optional"; + SymbolFlags[SymbolFlags["Enum"] = 384] = "Enum"; + SymbolFlags[SymbolFlags["Variable"] = 3] = "Variable"; + SymbolFlags[SymbolFlags["Value"] = 107455] = "Value"; + SymbolFlags[SymbolFlags["Type"] = 793056] = "Type"; + SymbolFlags[SymbolFlags["Namespace"] = 1536] = "Namespace"; + SymbolFlags[SymbolFlags["Module"] = 1536] = "Module"; + SymbolFlags[SymbolFlags["Accessor"] = 98304] = "Accessor"; + SymbolFlags[SymbolFlags["FunctionScopedVariableExcludes"] = 107454] = "FunctionScopedVariableExcludes"; + SymbolFlags[SymbolFlags["BlockScopedVariableExcludes"] = 107455] = "BlockScopedVariableExcludes"; + SymbolFlags[SymbolFlags["ParameterExcludes"] = 107455] = "ParameterExcludes"; + SymbolFlags[SymbolFlags["PropertyExcludes"] = 107455] = "PropertyExcludes"; + SymbolFlags[SymbolFlags["EnumMemberExcludes"] = 107455] = "EnumMemberExcludes"; + SymbolFlags[SymbolFlags["FunctionExcludes"] = 106927] = "FunctionExcludes"; + SymbolFlags[SymbolFlags["ClassExcludes"] = 899583] = "ClassExcludes"; + SymbolFlags[SymbolFlags["InterfaceExcludes"] = 792992] = "InterfaceExcludes"; + SymbolFlags[SymbolFlags["RegularEnumExcludes"] = 899327] = "RegularEnumExcludes"; + SymbolFlags[SymbolFlags["ConstEnumExcludes"] = 899967] = "ConstEnumExcludes"; + SymbolFlags[SymbolFlags["ValueModuleExcludes"] = 106639] = "ValueModuleExcludes"; + SymbolFlags[SymbolFlags["NamespaceModuleExcludes"] = 0] = "NamespaceModuleExcludes"; + SymbolFlags[SymbolFlags["MethodExcludes"] = 99263] = "MethodExcludes"; + SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 41919] = "GetAccessorExcludes"; + SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 74687] = "SetAccessorExcludes"; + SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 530912] = "TypeParameterExcludes"; + SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 793056] = "TypeAliasExcludes"; + SymbolFlags[SymbolFlags["ImportExcludes"] = 8388608] = "ImportExcludes"; + SymbolFlags[SymbolFlags["ModuleMember"] = 8914931] = "ModuleMember"; + SymbolFlags[SymbolFlags["ExportHasLocal"] = 944] = "ExportHasLocal"; + SymbolFlags[SymbolFlags["HasLocals"] = 255504] = "HasLocals"; + SymbolFlags[SymbolFlags["HasExports"] = 1952] = "HasExports"; + SymbolFlags[SymbolFlags["HasMembers"] = 6240] = "HasMembers"; + SymbolFlags[SymbolFlags["IsContainer"] = 262128] = "IsContainer"; + SymbolFlags[SymbolFlags["PropertyOrAccessor"] = 98308] = "PropertyOrAccessor"; + SymbolFlags[SymbolFlags["Export"] = 7340032] = "Export"; + })(ts.SymbolFlags || (ts.SymbolFlags = {})); + var SymbolFlags = ts.SymbolFlags; + (function (NodeCheckFlags) { + NodeCheckFlags[NodeCheckFlags["TypeChecked"] = 1] = "TypeChecked"; + NodeCheckFlags[NodeCheckFlags["LexicalThis"] = 2] = "LexicalThis"; + NodeCheckFlags[NodeCheckFlags["CaptureThis"] = 4] = "CaptureThis"; + NodeCheckFlags[NodeCheckFlags["EmitExtends"] = 8] = "EmitExtends"; + NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 16] = "SuperInstance"; + NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 32] = "SuperStatic"; + NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 64] = "ContextChecked"; + NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 128] = "EnumValuesComputed"; + })(ts.NodeCheckFlags || (ts.NodeCheckFlags = {})); + var NodeCheckFlags = ts.NodeCheckFlags; + (function (TypeFlags) { + TypeFlags[TypeFlags["Any"] = 1] = "Any"; + TypeFlags[TypeFlags["String"] = 2] = "String"; + TypeFlags[TypeFlags["Number"] = 4] = "Number"; + TypeFlags[TypeFlags["Boolean"] = 8] = "Boolean"; + TypeFlags[TypeFlags["Void"] = 16] = "Void"; + TypeFlags[TypeFlags["Undefined"] = 32] = "Undefined"; + TypeFlags[TypeFlags["Null"] = 64] = "Null"; + TypeFlags[TypeFlags["Enum"] = 128] = "Enum"; + TypeFlags[TypeFlags["StringLiteral"] = 256] = "StringLiteral"; + TypeFlags[TypeFlags["TypeParameter"] = 512] = "TypeParameter"; + TypeFlags[TypeFlags["Class"] = 1024] = "Class"; + TypeFlags[TypeFlags["Interface"] = 2048] = "Interface"; + TypeFlags[TypeFlags["Reference"] = 4096] = "Reference"; + TypeFlags[TypeFlags["Tuple"] = 8192] = "Tuple"; + TypeFlags[TypeFlags["Union"] = 16384] = "Union"; + TypeFlags[TypeFlags["Anonymous"] = 32768] = "Anonymous"; + TypeFlags[TypeFlags["FromSignature"] = 65536] = "FromSignature"; + TypeFlags[TypeFlags["ObjectLiteral"] = 131072] = "ObjectLiteral"; + TypeFlags[TypeFlags["ContainsUndefinedOrNull"] = 262144] = "ContainsUndefinedOrNull"; + TypeFlags[TypeFlags["ContainsObjectLiteral"] = 524288] = "ContainsObjectLiteral"; + TypeFlags[TypeFlags["ESSymbol"] = 1048576] = "ESSymbol"; + TypeFlags[TypeFlags["Intrinsic"] = 1048703] = "Intrinsic"; + TypeFlags[TypeFlags["Primitive"] = 1049086] = "Primitive"; + TypeFlags[TypeFlags["StringLike"] = 258] = "StringLike"; + TypeFlags[TypeFlags["NumberLike"] = 132] = "NumberLike"; + TypeFlags[TypeFlags["ObjectType"] = 48128] = "ObjectType"; + TypeFlags[TypeFlags["RequiresWidening"] = 786432] = "RequiresWidening"; + })(ts.TypeFlags || (ts.TypeFlags = {})); + var TypeFlags = ts.TypeFlags; + (function (SignatureKind) { + SignatureKind[SignatureKind["Call"] = 0] = "Call"; + SignatureKind[SignatureKind["Construct"] = 1] = "Construct"; + })(ts.SignatureKind || (ts.SignatureKind = {})); + var SignatureKind = ts.SignatureKind; + (function (IndexKind) { + IndexKind[IndexKind["String"] = 0] = "String"; + IndexKind[IndexKind["Number"] = 1] = "Number"; + })(ts.IndexKind || (ts.IndexKind = {})); + var IndexKind = ts.IndexKind; + (function (DiagnosticCategory) { + DiagnosticCategory[DiagnosticCategory["Warning"] = 0] = "Warning"; + DiagnosticCategory[DiagnosticCategory["Error"] = 1] = "Error"; + DiagnosticCategory[DiagnosticCategory["Message"] = 2] = "Message"; + })(ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); + var DiagnosticCategory = ts.DiagnosticCategory; + (function (ModuleKind) { + ModuleKind[ModuleKind["None"] = 0] = "None"; + ModuleKind[ModuleKind["CommonJS"] = 1] = "CommonJS"; + ModuleKind[ModuleKind["AMD"] = 2] = "AMD"; + })(ts.ModuleKind || (ts.ModuleKind = {})); + var ModuleKind = ts.ModuleKind; + (function (ScriptTarget) { + ScriptTarget[ScriptTarget["ES3"] = 0] = "ES3"; + ScriptTarget[ScriptTarget["ES5"] = 1] = "ES5"; + ScriptTarget[ScriptTarget["ES6"] = 2] = "ES6"; + ScriptTarget[ScriptTarget["Latest"] = 2] = "Latest"; + })(ts.ScriptTarget || (ts.ScriptTarget = {})); + var ScriptTarget = ts.ScriptTarget; + (function (CharacterCodes) { + CharacterCodes[CharacterCodes["nullCharacter"] = 0] = "nullCharacter"; + CharacterCodes[CharacterCodes["maxAsciiCharacter"] = 127] = "maxAsciiCharacter"; + CharacterCodes[CharacterCodes["lineFeed"] = 10] = "lineFeed"; + CharacterCodes[CharacterCodes["carriageReturn"] = 13] = "carriageReturn"; + CharacterCodes[CharacterCodes["lineSeparator"] = 8232] = "lineSeparator"; + CharacterCodes[CharacterCodes["paragraphSeparator"] = 8233] = "paragraphSeparator"; + CharacterCodes[CharacterCodes["nextLine"] = 133] = "nextLine"; + CharacterCodes[CharacterCodes["space"] = 32] = "space"; + CharacterCodes[CharacterCodes["nonBreakingSpace"] = 160] = "nonBreakingSpace"; + CharacterCodes[CharacterCodes["enQuad"] = 8192] = "enQuad"; + CharacterCodes[CharacterCodes["emQuad"] = 8193] = "emQuad"; + CharacterCodes[CharacterCodes["enSpace"] = 8194] = "enSpace"; + CharacterCodes[CharacterCodes["emSpace"] = 8195] = "emSpace"; + CharacterCodes[CharacterCodes["threePerEmSpace"] = 8196] = "threePerEmSpace"; + CharacterCodes[CharacterCodes["fourPerEmSpace"] = 8197] = "fourPerEmSpace"; + CharacterCodes[CharacterCodes["sixPerEmSpace"] = 8198] = "sixPerEmSpace"; + CharacterCodes[CharacterCodes["figureSpace"] = 8199] = "figureSpace"; + CharacterCodes[CharacterCodes["punctuationSpace"] = 8200] = "punctuationSpace"; + CharacterCodes[CharacterCodes["thinSpace"] = 8201] = "thinSpace"; + CharacterCodes[CharacterCodes["hairSpace"] = 8202] = "hairSpace"; + CharacterCodes[CharacterCodes["zeroWidthSpace"] = 8203] = "zeroWidthSpace"; + CharacterCodes[CharacterCodes["narrowNoBreakSpace"] = 8239] = "narrowNoBreakSpace"; + CharacterCodes[CharacterCodes["ideographicSpace"] = 12288] = "ideographicSpace"; + CharacterCodes[CharacterCodes["mathematicalSpace"] = 8287] = "mathematicalSpace"; + CharacterCodes[CharacterCodes["ogham"] = 5760] = "ogham"; + CharacterCodes[CharacterCodes["_"] = 95] = "_"; + CharacterCodes[CharacterCodes["$"] = 36] = "$"; + CharacterCodes[CharacterCodes["_0"] = 48] = "_0"; + CharacterCodes[CharacterCodes["_1"] = 49] = "_1"; + CharacterCodes[CharacterCodes["_2"] = 50] = "_2"; + CharacterCodes[CharacterCodes["_3"] = 51] = "_3"; + CharacterCodes[CharacterCodes["_4"] = 52] = "_4"; + CharacterCodes[CharacterCodes["_5"] = 53] = "_5"; + CharacterCodes[CharacterCodes["_6"] = 54] = "_6"; + CharacterCodes[CharacterCodes["_7"] = 55] = "_7"; + CharacterCodes[CharacterCodes["_8"] = 56] = "_8"; + CharacterCodes[CharacterCodes["_9"] = 57] = "_9"; + CharacterCodes[CharacterCodes["a"] = 97] = "a"; + CharacterCodes[CharacterCodes["b"] = 98] = "b"; + CharacterCodes[CharacterCodes["c"] = 99] = "c"; + CharacterCodes[CharacterCodes["d"] = 100] = "d"; + CharacterCodes[CharacterCodes["e"] = 101] = "e"; + CharacterCodes[CharacterCodes["f"] = 102] = "f"; + CharacterCodes[CharacterCodes["g"] = 103] = "g"; + CharacterCodes[CharacterCodes["h"] = 104] = "h"; + CharacterCodes[CharacterCodes["i"] = 105] = "i"; + CharacterCodes[CharacterCodes["j"] = 106] = "j"; + CharacterCodes[CharacterCodes["k"] = 107] = "k"; + CharacterCodes[CharacterCodes["l"] = 108] = "l"; + CharacterCodes[CharacterCodes["m"] = 109] = "m"; + CharacterCodes[CharacterCodes["n"] = 110] = "n"; + CharacterCodes[CharacterCodes["o"] = 111] = "o"; + CharacterCodes[CharacterCodes["p"] = 112] = "p"; + CharacterCodes[CharacterCodes["q"] = 113] = "q"; + CharacterCodes[CharacterCodes["r"] = 114] = "r"; + CharacterCodes[CharacterCodes["s"] = 115] = "s"; + CharacterCodes[CharacterCodes["t"] = 116] = "t"; + CharacterCodes[CharacterCodes["u"] = 117] = "u"; + CharacterCodes[CharacterCodes["v"] = 118] = "v"; + CharacterCodes[CharacterCodes["w"] = 119] = "w"; + CharacterCodes[CharacterCodes["x"] = 120] = "x"; + CharacterCodes[CharacterCodes["y"] = 121] = "y"; + CharacterCodes[CharacterCodes["z"] = 122] = "z"; + CharacterCodes[CharacterCodes["A"] = 65] = "A"; + CharacterCodes[CharacterCodes["B"] = 66] = "B"; + CharacterCodes[CharacterCodes["C"] = 67] = "C"; + CharacterCodes[CharacterCodes["D"] = 68] = "D"; + CharacterCodes[CharacterCodes["E"] = 69] = "E"; + CharacterCodes[CharacterCodes["F"] = 70] = "F"; + CharacterCodes[CharacterCodes["G"] = 71] = "G"; + CharacterCodes[CharacterCodes["H"] = 72] = "H"; + CharacterCodes[CharacterCodes["I"] = 73] = "I"; + CharacterCodes[CharacterCodes["J"] = 74] = "J"; + CharacterCodes[CharacterCodes["K"] = 75] = "K"; + CharacterCodes[CharacterCodes["L"] = 76] = "L"; + CharacterCodes[CharacterCodes["M"] = 77] = "M"; + CharacterCodes[CharacterCodes["N"] = 78] = "N"; + CharacterCodes[CharacterCodes["O"] = 79] = "O"; + CharacterCodes[CharacterCodes["P"] = 80] = "P"; + CharacterCodes[CharacterCodes["Q"] = 81] = "Q"; + CharacterCodes[CharacterCodes["R"] = 82] = "R"; + CharacterCodes[CharacterCodes["S"] = 83] = "S"; + CharacterCodes[CharacterCodes["T"] = 84] = "T"; + CharacterCodes[CharacterCodes["U"] = 85] = "U"; + CharacterCodes[CharacterCodes["V"] = 86] = "V"; + CharacterCodes[CharacterCodes["W"] = 87] = "W"; + CharacterCodes[CharacterCodes["X"] = 88] = "X"; + CharacterCodes[CharacterCodes["Y"] = 89] = "Y"; + CharacterCodes[CharacterCodes["Z"] = 90] = "Z"; + CharacterCodes[CharacterCodes["ampersand"] = 38] = "ampersand"; + CharacterCodes[CharacterCodes["asterisk"] = 42] = "asterisk"; + CharacterCodes[CharacterCodes["at"] = 64] = "at"; + CharacterCodes[CharacterCodes["backslash"] = 92] = "backslash"; + CharacterCodes[CharacterCodes["backtick"] = 96] = "backtick"; + CharacterCodes[CharacterCodes["bar"] = 124] = "bar"; + CharacterCodes[CharacterCodes["caret"] = 94] = "caret"; + CharacterCodes[CharacterCodes["closeBrace"] = 125] = "closeBrace"; + CharacterCodes[CharacterCodes["closeBracket"] = 93] = "closeBracket"; + CharacterCodes[CharacterCodes["closeParen"] = 41] = "closeParen"; + CharacterCodes[CharacterCodes["colon"] = 58] = "colon"; + CharacterCodes[CharacterCodes["comma"] = 44] = "comma"; + CharacterCodes[CharacterCodes["dot"] = 46] = "dot"; + CharacterCodes[CharacterCodes["doubleQuote"] = 34] = "doubleQuote"; + CharacterCodes[CharacterCodes["equals"] = 61] = "equals"; + CharacterCodes[CharacterCodes["exclamation"] = 33] = "exclamation"; + CharacterCodes[CharacterCodes["greaterThan"] = 62] = "greaterThan"; + CharacterCodes[CharacterCodes["hash"] = 35] = "hash"; + CharacterCodes[CharacterCodes["lessThan"] = 60] = "lessThan"; + CharacterCodes[CharacterCodes["minus"] = 45] = "minus"; + CharacterCodes[CharacterCodes["openBrace"] = 123] = "openBrace"; + CharacterCodes[CharacterCodes["openBracket"] = 91] = "openBracket"; + CharacterCodes[CharacterCodes["openParen"] = 40] = "openParen"; + CharacterCodes[CharacterCodes["percent"] = 37] = "percent"; + CharacterCodes[CharacterCodes["plus"] = 43] = "plus"; + CharacterCodes[CharacterCodes["question"] = 63] = "question"; + CharacterCodes[CharacterCodes["semicolon"] = 59] = "semicolon"; + CharacterCodes[CharacterCodes["singleQuote"] = 39] = "singleQuote"; + CharacterCodes[CharacterCodes["slash"] = 47] = "slash"; + CharacterCodes[CharacterCodes["tilde"] = 126] = "tilde"; + CharacterCodes[CharacterCodes["backspace"] = 8] = "backspace"; + CharacterCodes[CharacterCodes["formFeed"] = 12] = "formFeed"; + CharacterCodes[CharacterCodes["byteOrderMark"] = 65279] = "byteOrderMark"; + CharacterCodes[CharacterCodes["tab"] = 9] = "tab"; + CharacterCodes[CharacterCodes["verticalTab"] = 11] = "verticalTab"; + })(ts.CharacterCodes || (ts.CharacterCodes = {})); + var CharacterCodes = ts.CharacterCodes; +})(ts || (ts = {})); +var ts; +(function (ts) { + (function (Ternary) { + Ternary[Ternary["False"] = 0] = "False"; + Ternary[Ternary["Maybe"] = 1] = "Maybe"; + Ternary[Ternary["True"] = -1] = "True"; + })(ts.Ternary || (ts.Ternary = {})); + var Ternary = ts.Ternary; + (function (Comparison) { + Comparison[Comparison["LessThan"] = -1] = "LessThan"; + Comparison[Comparison["EqualTo"] = 0] = "EqualTo"; + Comparison[Comparison["GreaterThan"] = 1] = "GreaterThan"; + })(ts.Comparison || (ts.Comparison = {})); + var Comparison = ts.Comparison; + function forEach(array, callback) { + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + var result = callback(array[i], i); + if (result) { + return result; + } + } + } + return undefined; + } + ts.forEach = forEach; + function contains(array, value) { + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + if (array[i] === value) { + return true; + } + } + } + return false; + } + ts.contains = contains; + function indexOf(array, value) { + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + if (array[i] === value) { + return i; + } + } + } + return -1; + } + ts.indexOf = indexOf; + function countWhere(array, predicate) { + var count = 0; + if (array) { + for (var i = 0, len = array.length; i < len; i++) { + if (predicate(array[i])) { + count++; + } + } + } + return count; + } + ts.countWhere = countWhere; + function filter(array, f) { + if (array) { + var result = []; + for (var i = 0, len = array.length; i < len; i++) { + var item = array[i]; + if (f(item)) { + result.push(item); + } + } + } + return result; + } + ts.filter = filter; + function map(array, f) { + if (array) { + var result = []; + for (var i = 0, len = array.length; i < len; i++) { + result.push(f(array[i])); + } + } + return result; + } + ts.map = map; + function concatenate(array1, array2) { + if (!array2 || !array2.length) + return array1; + if (!array1 || !array1.length) + return array2; + return array1.concat(array2); + } + ts.concatenate = concatenate; + function deduplicate(array) { + if (array) { + var result = []; + for (var i = 0, len = array.length; i < len; i++) { + var item = array[i]; + if (!contains(result, item)) + result.push(item); + } + } + return result; + } + ts.deduplicate = deduplicate; + function sum(array, prop) { + var result = 0; + for (var i = 0; i < array.length; i++) { + result += array[i][prop]; + } + return result; + } + ts.sum = sum; + function addRange(to, from) { + for (var i = 0, n = from.length; i < n; i++) { + to.push(from[i]); + } + } + ts.addRange = addRange; + function lastOrUndefined(array) { + if (array.length === 0) { + return undefined; + } + return array[array.length - 1]; + } + ts.lastOrUndefined = lastOrUndefined; + function binarySearch(array, value) { + var low = 0; + var high = array.length - 1; + while (low <= high) { + var middle = low + ((high - low) >> 1); + var midValue = array[middle]; + if (midValue === value) { + return middle; + } + else if (midValue > value) { + high = middle - 1; + } + else { + low = middle + 1; + } + } + return ~low; + } + ts.binarySearch = binarySearch; + var hasOwnProperty = Object.prototype.hasOwnProperty; + function hasProperty(map, key) { + return hasOwnProperty.call(map, key); + } + ts.hasProperty = hasProperty; + function getProperty(map, key) { + return hasOwnProperty.call(map, key) ? map[key] : undefined; + } + ts.getProperty = getProperty; + function isEmpty(map) { + for (var id in map) { + if (hasProperty(map, id)) { + return false; + } + } + return true; + } + ts.isEmpty = isEmpty; + function clone(object) { + var result = {}; + for (var id in object) { + result[id] = object[id]; + } + return result; + } + ts.clone = clone; + function extend(first, second) { + var result = {}; + for (var id in first) { + result[id] = first[id]; + } + for (var id in second) { + if (!hasProperty(result, id)) { + result[id] = second[id]; + } + } + return result; + } + ts.extend = extend; + function forEachValue(map, callback) { + var result; + for (var id in map) { + if (result = callback(map[id])) + break; + } + return result; + } + ts.forEachValue = forEachValue; + function forEachKey(map, callback) { + var result; + for (var id in map) { + if (result = callback(id)) + break; + } + return result; + } + ts.forEachKey = forEachKey; + function lookUp(map, key) { + return hasProperty(map, key) ? map[key] : undefined; + } + ts.lookUp = lookUp; + function mapToArray(map) { + var result = []; + for (var id in map) { + result.push(map[id]); + } + return result; + } + ts.mapToArray = mapToArray; + function copyMap(source, target) { + for (var p in source) { + target[p] = source[p]; + } + } + ts.copyMap = copyMap; + function arrayToMap(array, makeKey) { + var result = {}; + forEach(array, function (value) { + result[makeKey(value)] = value; + }); + return result; + } + ts.arrayToMap = arrayToMap; + function formatStringFromArgs(text, args, baseIndex) { + baseIndex = baseIndex || 0; + return text.replace(/{(\d+)}/g, function (match, index) { return args[+index + baseIndex]; }); + } + ts.localizedDiagnosticMessages = undefined; + function getLocaleSpecificMessage(message) { + return ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message] ? ts.localizedDiagnosticMessages[message] : message; + } + ts.getLocaleSpecificMessage = getLocaleSpecificMessage; + function createFileDiagnostic(file, start, length, message) { + Debug.assert(start >= 0, "start must be non-negative, is " + start); + Debug.assert(length >= 0, "length must be non-negative, is " + length); + var text = getLocaleSpecificMessage(message.key); + if (arguments.length > 4) { + text = formatStringFromArgs(text, arguments, 4); + } + return { + file: file, + start: start, + length: length, + messageText: text, + category: message.category, + code: message.code + }; + } + ts.createFileDiagnostic = createFileDiagnostic; + function createCompilerDiagnostic(message) { + var text = getLocaleSpecificMessage(message.key); + if (arguments.length > 1) { + text = formatStringFromArgs(text, arguments, 1); + } + return { + file: undefined, + start: undefined, + length: undefined, + messageText: text, + category: message.category, + code: message.code + }; + } + ts.createCompilerDiagnostic = createCompilerDiagnostic; + function chainDiagnosticMessages(details, message) { + var text = getLocaleSpecificMessage(message.key); + if (arguments.length > 2) { + text = formatStringFromArgs(text, arguments, 2); + } + return { + messageText: text, + category: message.category, + code: message.code, + next: details + }; + } + ts.chainDiagnosticMessages = chainDiagnosticMessages; + function concatenateDiagnosticMessageChains(headChain, tailChain) { + Debug.assert(!headChain.next); + headChain.next = tailChain; + return headChain; + } + ts.concatenateDiagnosticMessageChains = concatenateDiagnosticMessageChains; + function compareValues(a, b) { + if (a === b) + return 0; + if (a === undefined) + return -1; + if (b === undefined) + return 1; + return a < b ? -1 : 1; + } + ts.compareValues = compareValues; + function getDiagnosticFileName(diagnostic) { + return diagnostic.file ? diagnostic.file.fileName : undefined; + } + function compareDiagnostics(d1, d2) { + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || + compareValues(d1.start, d2.start) || + compareValues(d1.length, d2.length) || + compareValues(d1.code, d2.code) || + compareMessageText(d1.messageText, d2.messageText) || + 0; + } + ts.compareDiagnostics = compareDiagnostics; + function compareMessageText(text1, text2) { + while (text1 && text2) { + var string1 = typeof text1 === "string" ? text1 : text1.messageText; + var string2 = typeof text2 === "string" ? text2 : text2.messageText; + var res = compareValues(string1, string2); + if (res) { + return res; + } + text1 = typeof text1 === "string" ? undefined : text1.next; + text2 = typeof text2 === "string" ? undefined : text2.next; + } + if (!text1 && !text2) { + return 0; + } + return text1 ? 1 : -1; + } + function sortAndDeduplicateDiagnostics(diagnostics) { + return deduplicateSortedDiagnostics(diagnostics.sort(compareDiagnostics)); + } + ts.sortAndDeduplicateDiagnostics = sortAndDeduplicateDiagnostics; + function deduplicateSortedDiagnostics(diagnostics) { + if (diagnostics.length < 2) { + return diagnostics; + } + var newDiagnostics = [diagnostics[0]]; + var previousDiagnostic = diagnostics[0]; + for (var i = 1; i < diagnostics.length; i++) { + var currentDiagnostic = diagnostics[i]; + var isDupe = compareDiagnostics(currentDiagnostic, previousDiagnostic) === 0; + if (!isDupe) { + newDiagnostics.push(currentDiagnostic); + previousDiagnostic = currentDiagnostic; + } + } + return newDiagnostics; + } + ts.deduplicateSortedDiagnostics = deduplicateSortedDiagnostics; + function normalizeSlashes(path) { + return path.replace(/\\/g, "/"); + } + ts.normalizeSlashes = normalizeSlashes; + function getRootLength(path) { + if (path.charCodeAt(0) === 47) { + if (path.charCodeAt(1) !== 47) + return 1; + var p1 = path.indexOf("/", 2); + if (p1 < 0) + return 2; + var p2 = path.indexOf("/", p1 + 1); + if (p2 < 0) + return p1 + 1; + return p2 + 1; + } + if (path.charCodeAt(1) === 58) { + if (path.charCodeAt(2) === 47) + return 3; + return 2; + } + return 0; + } + ts.getRootLength = getRootLength; + ts.directorySeparator = "/"; + function getNormalizedParts(normalizedSlashedPath, rootLength) { + var parts = normalizedSlashedPath.substr(rootLength).split(ts.directorySeparator); + var normalized = []; + for (var i = 0; i < parts.length; i++) { + var part = parts[i]; + if (part !== ".") { + if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { + normalized.pop(); + } + else { + normalized.push(part); + } + } + } + return normalized; + } + function normalizePath(path) { + var path = normalizeSlashes(path); + var rootLength = getRootLength(path); + var normalized = getNormalizedParts(path, rootLength); + return path.substr(0, rootLength) + normalized.join(ts.directorySeparator); + } + ts.normalizePath = normalizePath; + function getDirectoryPath(path) { + return path.substr(0, Math.max(getRootLength(path), path.lastIndexOf(ts.directorySeparator))); + } + ts.getDirectoryPath = getDirectoryPath; + function isUrl(path) { + return path && !isRootedDiskPath(path) && path.indexOf("://") !== -1; + } + ts.isUrl = isUrl; + function isRootedDiskPath(path) { + return getRootLength(path) !== 0; + } + ts.isRootedDiskPath = isRootedDiskPath; + function normalizedPathComponents(path, rootLength) { + var normalizedParts = getNormalizedParts(path, rootLength); + return [path.substr(0, rootLength)].concat(normalizedParts); + } + function getNormalizedPathComponents(path, currentDirectory) { + var path = normalizeSlashes(path); + var rootLength = getRootLength(path); + if (rootLength == 0) { + path = combinePaths(normalizeSlashes(currentDirectory), path); + rootLength = getRootLength(path); + } + return normalizedPathComponents(path, rootLength); + } + ts.getNormalizedPathComponents = getNormalizedPathComponents; + function getNormalizedAbsolutePath(fileName, currentDirectory) { + return getNormalizedPathFromPathComponents(getNormalizedPathComponents(fileName, currentDirectory)); + } + ts.getNormalizedAbsolutePath = getNormalizedAbsolutePath; + function getNormalizedPathFromPathComponents(pathComponents) { + if (pathComponents && pathComponents.length) { + return pathComponents[0] + pathComponents.slice(1).join(ts.directorySeparator); + } + } + ts.getNormalizedPathFromPathComponents = getNormalizedPathFromPathComponents; + function getNormalizedPathComponentsOfUrl(url) { + var urlLength = url.length; + var rootLength = url.indexOf("://") + "://".length; + while (rootLength < urlLength) { + if (url.charCodeAt(rootLength) === 47) { + rootLength++; + } + else { + break; + } + } + if (rootLength === urlLength) { + return [url]; + } + var indexOfNextSlash = url.indexOf(ts.directorySeparator, rootLength); + if (indexOfNextSlash !== -1) { + rootLength = indexOfNextSlash + 1; + return normalizedPathComponents(url, rootLength); + } + else { + return [url + ts.directorySeparator]; + } + } + function getNormalizedPathOrUrlComponents(pathOrUrl, currentDirectory) { + if (isUrl(pathOrUrl)) { + return getNormalizedPathComponentsOfUrl(pathOrUrl); + } + else { + return getNormalizedPathComponents(pathOrUrl, currentDirectory); + } + } + function getRelativePathToDirectoryOrUrl(directoryPathOrUrl, relativeOrAbsolutePath, currentDirectory, getCanonicalFileName, isAbsolutePathAnUrl) { + var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory); + var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory); + if (directoryComponents.length > 1 && directoryComponents[directoryComponents.length - 1] === "") { + directoryComponents.length--; + } + for (var joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) { + if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) { + break; + } + } + if (joinStartIndex) { + var relativePath = ""; + var relativePathComponents = pathComponents.slice(joinStartIndex, pathComponents.length); + for (; joinStartIndex < directoryComponents.length; joinStartIndex++) { + if (directoryComponents[joinStartIndex] !== "") { + relativePath = relativePath + ".." + ts.directorySeparator; + } + } + return relativePath + relativePathComponents.join(ts.directorySeparator); + } + var absolutePath = getNormalizedPathFromPathComponents(pathComponents); + if (isAbsolutePathAnUrl && isRootedDiskPath(absolutePath)) { + absolutePath = "file:///" + absolutePath; + } + return absolutePath; + } + ts.getRelativePathToDirectoryOrUrl = getRelativePathToDirectoryOrUrl; + function getBaseFileName(path) { + var i = path.lastIndexOf(ts.directorySeparator); + return i < 0 ? path : path.substring(i + 1); + } + ts.getBaseFileName = getBaseFileName; + function combinePaths(path1, path2) { + if (!(path1 && path1.length)) + return path2; + if (!(path2 && path2.length)) + return path1; + if (getRootLength(path2) !== 0) + return path2; + if (path1.charAt(path1.length - 1) === ts.directorySeparator) + return path1 + path2; + return path1 + ts.directorySeparator + path2; + } + ts.combinePaths = combinePaths; + function fileExtensionIs(path, extension) { + var pathLen = path.length; + var extLen = extension.length; + return pathLen > extLen && path.substr(pathLen - extLen, extLen) === extension; + } + ts.fileExtensionIs = fileExtensionIs; + var supportedExtensions = [".d.ts", ".ts", ".js"]; + function removeFileExtension(path) { + for (var i = 0; i < supportedExtensions.length; i++) { + var ext = supportedExtensions[i]; + if (fileExtensionIs(path, ext)) { + return path.substr(0, path.length - ext.length); + } + } + return path; + } + ts.removeFileExtension = removeFileExtension; + var backslashOrDoubleQuote = /[\"\\]/g; + var escapedCharsRegExp = /[\0-\19\t\v\f\b\0\r\n\u2028\u2029\u0085]/g; + var escapedCharsMap = { + "\0": "\\0", + "\t": "\\t", + "\v": "\\v", + "\f": "\\f", + "\b": "\\b", + "\r": "\\r", + "\n": "\\n", + "\\": "\\\\", + "\"": "\\\"", + "\u2028": "\\u2028", + "\u2029": "\\u2029", + "\u0085": "\\u0085" + }; + function escapeString(s) { + s = backslashOrDoubleQuote.test(s) ? s.replace(backslashOrDoubleQuote, getReplacement) : s; + s = escapedCharsRegExp.test(s) ? s.replace(escapedCharsRegExp, getReplacement) : s; + return s; + function getReplacement(c) { + return escapedCharsMap[c] || unicodeEscape(c); + } + function unicodeEscape(c) { + var hexCharCode = c.charCodeAt(0).toString(16); + var paddedHexCode = ("0000" + hexCharCode).slice(-4); + return "\\u" + paddedHexCode; + } + } + ts.escapeString = escapeString; + function getDefaultLibFileName(options) { + return options.target === 2 ? "lib.es6.d.ts" : "lib.d.ts"; + } + ts.getDefaultLibFileName = getDefaultLibFileName; + function Symbol(flags, name) { + this.flags = flags; + this.name = name; + this.declarations = undefined; + } + function Type(checker, flags) { + this.flags = flags; + } + function Signature(checker) { + } + ts.objectAllocator = { + getNodeConstructor: function (kind) { + function Node() { + } + Node.prototype = { + kind: kind, + pos: 0, + end: 0, + flags: 0, + parent: undefined + }; + return Node; + }, + getSymbolConstructor: function () { return Symbol; }, + getTypeConstructor: function () { return Type; }, + getSignatureConstructor: function () { return Signature; } + }; + (function (AssertionLevel) { + AssertionLevel[AssertionLevel["None"] = 0] = "None"; + AssertionLevel[AssertionLevel["Normal"] = 1] = "Normal"; + AssertionLevel[AssertionLevel["Aggressive"] = 2] = "Aggressive"; + AssertionLevel[AssertionLevel["VeryAggressive"] = 3] = "VeryAggressive"; + })(ts.AssertionLevel || (ts.AssertionLevel = {})); + var AssertionLevel = ts.AssertionLevel; + var Debug; + (function (Debug) { + var currentAssertionLevel = 0; + function shouldAssert(level) { + return currentAssertionLevel >= level; + } + Debug.shouldAssert = shouldAssert; + function assert(expression, message, verboseDebugInfo) { + if (!expression) { + var verboseDebugString = ""; + if (verboseDebugInfo) { + verboseDebugString = "\r\nVerbose Debug Information: " + verboseDebugInfo(); + } + throw new Error("Debug Failure. False expression: " + (message || "") + verboseDebugString); + } + } + Debug.assert = assert; + function fail(message) { + Debug.assert(false, message); + } + Debug.fail = fail; + })(Debug = ts.Debug || (ts.Debug = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.sys = (function () { + function getWScriptSystem() { + var fso = new ActiveXObject("Scripting.FileSystemObject"); + var fileStream = new ActiveXObject("ADODB.Stream"); + fileStream.Type = 2; + var binaryStream = new ActiveXObject("ADODB.Stream"); + binaryStream.Type = 1; + var args = []; + for (var i = 0; i < WScript.Arguments.length; i++) { + args[i] = WScript.Arguments.Item(i); + } + function readFile(fileName, encoding) { + if (!fso.FileExists(fileName)) { + return undefined; + } + fileStream.Open(); + try { + if (encoding) { + fileStream.Charset = encoding; + fileStream.LoadFromFile(fileName); + } + else { + fileStream.Charset = "x-ansi"; + fileStream.LoadFromFile(fileName); + var bom = fileStream.ReadText(2) || ""; + fileStream.Position = 0; + fileStream.Charset = bom.length >= 2 && (bom.charCodeAt(0) === 0xFF && bom.charCodeAt(1) === 0xFE || bom.charCodeAt(0) === 0xFE && bom.charCodeAt(1) === 0xFF) ? "unicode" : "utf-8"; + } + return fileStream.ReadText(); + } + catch (e) { + throw e; + } + finally { + fileStream.Close(); + } + } + function writeFile(fileName, data, writeByteOrderMark) { + fileStream.Open(); + binaryStream.Open(); + try { + fileStream.Charset = "utf-8"; + fileStream.WriteText(data); + if (writeByteOrderMark) { + fileStream.Position = 0; + } + else { + fileStream.Position = 3; + } + fileStream.CopyTo(binaryStream); + binaryStream.SaveToFile(fileName, 2); + } + finally { + binaryStream.Close(); + fileStream.Close(); + } + } + function getNames(collection) { + var result = []; + for (var e = new Enumerator(collection); !e.atEnd(); e.moveNext()) { + result.push(e.item().Name); + } + return result.sort(); + } + function readDirectory(path, extension) { + var result = []; + visitDirectory(path); + return result; + function visitDirectory(path) { + var folder = fso.GetFolder(path || "."); + var files = getNames(folder.files); + for (var i = 0; i < files.length; i++) { + var name = files[i]; + if (!extension || ts.fileExtensionIs(name, extension)) { + result.push(ts.combinePaths(path, name)); + } + } + var subfolders = getNames(folder.subfolders); + for (var i = 0; i < subfolders.length; i++) { + visitDirectory(ts.combinePaths(path, subfolders[i])); + } + } + } + return { + args: args, + newLine: "\r\n", + useCaseSensitiveFileNames: false, + write: function (s) { + WScript.StdOut.Write(s); + }, + readFile: readFile, + writeFile: writeFile, + resolvePath: function (path) { + return fso.GetAbsolutePathName(path); + }, + fileExists: function (path) { + return fso.FileExists(path); + }, + directoryExists: function (path) { + return fso.FolderExists(path); + }, + createDirectory: function (directoryName) { + if (!this.directoryExists(directoryName)) { + fso.CreateFolder(directoryName); + } + }, + getExecutingFilePath: function () { + return WScript.ScriptFullName; + }, + getCurrentDirectory: function () { + return new ActiveXObject("WScript.Shell").CurrentDirectory; + }, + readDirectory: readDirectory, + exit: function (exitCode) { + try { + WScript.Quit(exitCode); + } + catch (e) { + } + } + }; + } + function getNodeSystem() { + var _fs = require("fs"); + var _path = require("path"); + var _os = require('os'); + var platform = _os.platform(); + var useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin"; + function readFile(fileName, encoding) { + if (!_fs.existsSync(fileName)) { + return undefined; + } + var buffer = _fs.readFileSync(fileName); + var len = buffer.length; + if (len >= 2 && buffer[0] === 0xFE && buffer[1] === 0xFF) { + len &= ~1; + for (var i = 0; i < len; i += 2) { + var temp = buffer[i]; + buffer[i] = buffer[i + 1]; + buffer[i + 1] = temp; + } + return buffer.toString("utf16le", 2); + } + if (len >= 2 && buffer[0] === 0xFF && buffer[1] === 0xFE) { + return buffer.toString("utf16le", 2); + } + if (len >= 3 && buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) { + return buffer.toString("utf8", 3); + } + return buffer.toString("utf8"); + } + function writeFile(fileName, data, writeByteOrderMark) { + if (writeByteOrderMark) { + data = '\uFEFF' + data; + } + _fs.writeFileSync(fileName, data, "utf8"); + } + function readDirectory(path, extension) { + var result = []; + visitDirectory(path); + return result; + function visitDirectory(path) { + var files = _fs.readdirSync(path || ".").sort(); + var directories = []; + for (var i = 0; i < files.length; i++) { + var name = ts.combinePaths(path, files[i]); + var stat = _fs.lstatSync(name); + if (stat.isFile()) { + if (!extension || ts.fileExtensionIs(name, extension)) { + result.push(name); + } + } + else if (stat.isDirectory()) { + directories.push(name); + } + } + for (var i = 0; i < directories.length; i++) { + visitDirectory(directories[i]); + } + } + } + return { + args: process.argv.slice(2), + newLine: _os.EOL, + useCaseSensitiveFileNames: useCaseSensitiveFileNames, + write: function (s) { + _fs.writeSync(1, s); + }, + readFile: readFile, + writeFile: writeFile, + watchFile: function (fileName, callback) { + _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); + return { + close: function () { _fs.unwatchFile(fileName, fileChanged); } + }; + function fileChanged(curr, prev) { + if (+curr.mtime <= +prev.mtime) { + return; + } + callback(fileName); + } + ; + }, + resolvePath: function (path) { + return _path.resolve(path); + }, + fileExists: function (path) { + return _fs.existsSync(path); + }, + directoryExists: function (path) { + return _fs.existsSync(path) && _fs.statSync(path).isDirectory(); + }, + createDirectory: function (directoryName) { + if (!this.directoryExists(directoryName)) { + _fs.mkdirSync(directoryName); + } + }, + getExecutingFilePath: function () { + return __filename; + }, + getCurrentDirectory: function () { + return process.cwd(); + }, + readDirectory: readDirectory, + getMemoryUsage: function () { + if (global.gc) { + global.gc(); + } + return process.memoryUsage().heapUsed; + }, + exit: function (exitCode) { + process.exit(exitCode); + } + }; + } + if (typeof WScript !== "undefined" && typeof ActiveXObject === "function") { + return getWScriptSystem(); + } + else if (typeof module !== "undefined" && module.exports) { + return getNodeSystem(); + } + else { + return undefined; + } + })(); +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.Diagnostics = { + Unterminated_string_literal: { code: 1002, category: 1, key: "Unterminated string literal." }, + Identifier_expected: { code: 1003, category: 1, key: "Identifier expected." }, + _0_expected: { code: 1005, category: 1, key: "'{0}' expected." }, + A_file_cannot_have_a_reference_to_itself: { code: 1006, category: 1, key: "A file cannot have a reference to itself." }, + Trailing_comma_not_allowed: { code: 1009, category: 1, key: "Trailing comma not allowed." }, + Asterisk_Slash_expected: { code: 1010, category: 1, key: "'*/' expected." }, + Unexpected_token: { code: 1012, category: 1, key: "Unexpected token." }, + Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: 1, key: "Catch clause parameter cannot have a type annotation." }, + A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: 1, key: "A rest parameter must be last in a parameter list." }, + Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: 1, key: "Parameter cannot have question mark and initializer." }, + A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: 1, key: "A required parameter cannot follow an optional parameter." }, + An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: 1, key: "An index signature cannot have a rest parameter." }, + An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: 1, key: "An index signature parameter cannot have an accessibility modifier." }, + An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: 1, key: "An index signature parameter cannot have a question mark." }, + An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: 1, key: "An index signature parameter cannot have an initializer." }, + An_index_signature_must_have_a_type_annotation: { code: 1021, category: 1, key: "An index signature must have a type annotation." }, + An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: 1, key: "An index signature parameter must have a type annotation." }, + An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: 1, key: "An index signature parameter type must be 'string' or 'number'." }, + A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: 1, key: "A class or interface declaration can only have one 'extends' clause." }, + An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: 1, key: "An 'extends' clause must precede an 'implements' clause." }, + A_class_can_only_extend_a_single_class: { code: 1026, category: 1, key: "A class can only extend a single class." }, + A_class_declaration_can_only_have_one_implements_clause: { code: 1027, category: 1, key: "A class declaration can only have one 'implements' clause." }, + Accessibility_modifier_already_seen: { code: 1028, category: 1, key: "Accessibility modifier already seen." }, + _0_modifier_must_precede_1_modifier: { code: 1029, category: 1, key: "'{0}' modifier must precede '{1}' modifier." }, + _0_modifier_already_seen: { code: 1030, category: 1, key: "'{0}' modifier already seen." }, + _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: 1, key: "'{0}' modifier cannot appear on a class element." }, + An_interface_declaration_cannot_have_an_implements_clause: { code: 1032, category: 1, key: "An interface declaration cannot have an 'implements' clause." }, + super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: 1, key: "'super' must be followed by an argument list or member access." }, + Only_ambient_modules_can_use_quoted_names: { code: 1035, category: 1, key: "Only ambient modules can use quoted names." }, + Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: 1, key: "Statements are not allowed in ambient contexts." }, + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: 1, key: "A 'declare' modifier cannot be used in an already ambient context." }, + Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: 1, key: "Initializers are not allowed in ambient contexts." }, + _0_modifier_cannot_appear_on_a_module_element: { code: 1044, category: 1, key: "'{0}' modifier cannot appear on a module element." }, + A_declare_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: 1, key: "A 'declare' modifier cannot be used with an interface declaration." }, + A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: 1, key: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, + A_rest_parameter_cannot_be_optional: { code: 1047, category: 1, key: "A rest parameter cannot be optional." }, + A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: 1, key: "A rest parameter cannot have an initializer." }, + A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: 1, key: "A 'set' accessor must have exactly one parameter." }, + A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: 1, key: "A 'set' accessor cannot have an optional parameter." }, + A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: 1, key: "A 'set' accessor parameter cannot have an initializer." }, + A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: 1, key: "A 'set' accessor cannot have rest parameter." }, + A_get_accessor_cannot_have_parameters: { code: 1054, category: 1, key: "A 'get' accessor cannot have parameters." }, + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: 1, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, + Enum_member_must_have_initializer: { code: 1061, category: 1, key: "Enum member must have initializer." }, + An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: 1, key: "An export assignment cannot be used in an internal module." }, + Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: 1, key: "Ambient enum elements can only have integer literal initializers." }, + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: 1, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, + A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: 1, key: "A 'declare' modifier cannot be used with an import declaration." }, + Invalid_reference_directive_syntax: { code: 1084, category: 1, key: "Invalid 'reference' directive syntax." }, + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher: { code: 1085, category: 1, key: "Octal literals are not available when targeting ECMAScript 5 and higher." }, + An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: 1, key: "An accessor cannot be declared in an ambient context." }, + _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: 1, key: "'{0}' modifier cannot appear on a constructor declaration." }, + _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: 1, key: "'{0}' modifier cannot appear on a parameter." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: 1, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, + Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: 1, key: "Type parameters cannot appear on a constructor declaration." }, + Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: 1, key: "Type annotation cannot appear on a constructor declaration." }, + An_accessor_cannot_have_type_parameters: { code: 1094, category: 1, key: "An accessor cannot have type parameters." }, + A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: 1, key: "A 'set' accessor cannot have a return type annotation." }, + An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: 1, key: "An index signature must have exactly one parameter." }, + _0_list_cannot_be_empty: { code: 1097, category: 1, key: "'{0}' list cannot be empty." }, + Type_parameter_list_cannot_be_empty: { code: 1098, category: 1, key: "Type parameter list cannot be empty." }, + Type_argument_list_cannot_be_empty: { code: 1099, category: 1, key: "Type argument list cannot be empty." }, + Invalid_use_of_0_in_strict_mode: { code: 1100, category: 1, key: "Invalid use of '{0}' in strict mode." }, + with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: 1, key: "'with' statements are not allowed in strict mode." }, + delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: 1, key: "'delete' cannot be called on an identifier in strict mode." }, + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: 1, key: "A 'continue' statement can only be used within an enclosing iteration statement." }, + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: 1, key: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, + Jump_target_cannot_cross_function_boundary: { code: 1107, category: 1, key: "Jump target cannot cross function boundary." }, + A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: 1, key: "A 'return' statement can only be used within a function body." }, + Expression_expected: { code: 1109, category: 1, key: "Expression expected." }, + Type_expected: { code: 1110, category: 1, key: "Type expected." }, + A_class_member_cannot_be_declared_optional: { code: 1112, category: 1, key: "A class member cannot be declared optional." }, + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: 1, key: "A 'default' clause cannot appear more than once in a 'switch' statement." }, + Duplicate_label_0: { code: 1114, category: 1, key: "Duplicate label '{0}'" }, + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: 1, key: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: 1, key: "A 'break' statement can only jump to a label of an enclosing statement." }, + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: 1, key: "An object literal cannot have multiple properties with the same name in strict mode." }, + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: 1, key: "An object literal cannot have multiple get/set accessors with the same name." }, + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: 1, key: "An object literal cannot have property and accessor with the same name." }, + An_export_assignment_cannot_have_modifiers: { code: 1120, category: 1, key: "An export assignment cannot have modifiers." }, + Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: 1, key: "Octal literals are not allowed in strict mode." }, + A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: 1, key: "A tuple type element list cannot be empty." }, + Variable_declaration_list_cannot_be_empty: { code: 1123, category: 1, key: "Variable declaration list cannot be empty." }, + Digit_expected: { code: 1124, category: 1, key: "Digit expected." }, + Hexadecimal_digit_expected: { code: 1125, category: 1, key: "Hexadecimal digit expected." }, + Unexpected_end_of_text: { code: 1126, category: 1, key: "Unexpected end of text." }, + Invalid_character: { code: 1127, category: 1, key: "Invalid character." }, + Declaration_or_statement_expected: { code: 1128, category: 1, key: "Declaration or statement expected." }, + Statement_expected: { code: 1129, category: 1, key: "Statement expected." }, + case_or_default_expected: { code: 1130, category: 1, key: "'case' or 'default' expected." }, + Property_or_signature_expected: { code: 1131, category: 1, key: "Property or signature expected." }, + Enum_member_expected: { code: 1132, category: 1, key: "Enum member expected." }, + Type_reference_expected: { code: 1133, category: 1, key: "Type reference expected." }, + Variable_declaration_expected: { code: 1134, category: 1, key: "Variable declaration expected." }, + Argument_expression_expected: { code: 1135, category: 1, key: "Argument expression expected." }, + Property_assignment_expected: { code: 1136, category: 1, key: "Property assignment expected." }, + Expression_or_comma_expected: { code: 1137, category: 1, key: "Expression or comma expected." }, + Parameter_declaration_expected: { code: 1138, category: 1, key: "Parameter declaration expected." }, + Type_parameter_declaration_expected: { code: 1139, category: 1, key: "Type parameter declaration expected." }, + Type_argument_expected: { code: 1140, category: 1, key: "Type argument expected." }, + String_literal_expected: { code: 1141, category: 1, key: "String literal expected." }, + Line_break_not_permitted_here: { code: 1142, category: 1, key: "Line break not permitted here." }, + or_expected: { code: 1144, category: 1, key: "'{' or ';' expected." }, + Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: 1, key: "Modifiers not permitted on index signature members." }, + Declaration_expected: { code: 1146, category: 1, key: "Declaration expected." }, + Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: 1, key: "Import declarations in an internal module cannot reference an external module." }, + Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: 1, key: "Cannot compile external modules unless the '--module' flag is provided." }, + File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: 1, key: "File name '{0}' differs from already included file name '{1}' only in casing" }, + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: 1, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, + var_let_or_const_expected: { code: 1152, category: 1, key: "'var', 'let' or 'const' expected." }, + let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1153, category: 1, key: "'let' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1154, category: 1, key: "'const' declarations are only available when targeting ECMAScript 6 and higher." }, + const_declarations_must_be_initialized: { code: 1155, category: 1, key: "'const' declarations must be initialized" }, + const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: 1, key: "'const' declarations can only be declared inside a block." }, + let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: 1, key: "'let' declarations can only be declared inside a block." }, + Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1159, category: 1, key: "Tagged templates are only available when targeting ECMAScript 6 and higher." }, + Unterminated_template_literal: { code: 1160, category: 1, key: "Unterminated template literal." }, + Unterminated_regular_expression_literal: { code: 1161, category: 1, key: "Unterminated regular expression literal." }, + An_object_member_cannot_be_declared_optional: { code: 1162, category: 1, key: "An object member cannot be declared optional." }, + yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1, key: "'yield' expression must be contained_within a generator declaration." }, + Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1, key: "Computed property names are not allowed in enums." }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: 1, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: 1, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, + Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: 1, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: 1, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: 1, key: "A computed property name in an interface must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: 1, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, + A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: 1, key: "A comma expression is not allowed in a computed property name." }, + extends_clause_already_seen: { code: 1172, category: 1, key: "'extends' clause already seen." }, + extends_clause_must_precede_implements_clause: { code: 1173, category: 1, key: "'extends' clause must precede 'implements' clause." }, + Classes_can_only_extend_a_single_class: { code: 1174, category: 1, key: "Classes can only extend a single class." }, + implements_clause_already_seen: { code: 1175, category: 1, key: "'implements' clause already seen." }, + Interface_declaration_cannot_have_implements_clause: { code: 1176, category: 1, key: "Interface declaration cannot have 'implements' clause." }, + Binary_digit_expected: { code: 1177, category: 1, key: "Binary digit expected." }, + Octal_digit_expected: { code: 1178, category: 1, key: "Octal digit expected." }, + Unexpected_token_expected: { code: 1179, category: 1, key: "Unexpected token. '{' expected." }, + Property_destructuring_pattern_expected: { code: 1180, category: 1, key: "Property destructuring pattern expected." }, + Array_element_destructuring_pattern_expected: { code: 1181, category: 1, key: "Array element destructuring pattern expected." }, + A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: 1, key: "A destructuring declaration must have an initializer." }, + Destructuring_declarations_are_not_allowed_in_ambient_contexts: { code: 1183, category: 1, key: "Destructuring declarations are not allowed in ambient contexts." }, + An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1184, category: 1, key: "An implementation cannot be declared in ambient contexts." }, + Modifiers_cannot_appear_here: { code: 1184, category: 1, key: "Modifiers cannot appear here." }, + Merge_conflict_marker_encountered: { code: 1185, category: 1, key: "Merge conflict marker encountered." }, + A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1, key: "A rest element cannot have an initializer." }, + A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1, key: "A parameter property may not be a binding pattern." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: 1, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: 1, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: 1, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, + Duplicate_identifier_0: { code: 2300, category: 1, key: "Duplicate identifier '{0}'." }, + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, + Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1, key: "Static members cannot reference class type parameters." }, + Circular_definition_of_import_alias_0: { code: 2303, category: 1, key: "Circular definition of import alias '{0}'." }, + Cannot_find_name_0: { code: 2304, category: 1, key: "Cannot find name '{0}'." }, + Module_0_has_no_exported_member_1: { code: 2305, category: 1, key: "Module '{0}' has no exported member '{1}'." }, + File_0_is_not_an_external_module: { code: 2306, category: 1, key: "File '{0}' is not an external module." }, + Cannot_find_external_module_0: { code: 2307, category: 1, key: "Cannot find external module '{0}'." }, + A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: 1, key: "A module cannot have more than one export assignment." }, + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: 1, key: "An export assignment cannot be used in a module with other exported elements." }, + Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: 1, key: "Type '{0}' recursively references itself as a base type." }, + A_class_may_only_extend_another_class: { code: 2311, category: 1, key: "A class may only extend another class." }, + An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: 1, key: "An interface may only extend a class or another interface." }, + Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list: { code: 2313, category: 1, key: "Constraint of a type parameter cannot reference any type parameter from the same type parameter list." }, + Generic_type_0_requires_1_type_argument_s: { code: 2314, category: 1, key: "Generic type '{0}' requires {1} type argument(s)." }, + Type_0_is_not_generic: { code: 2315, category: 1, key: "Type '{0}' is not generic." }, + Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1, key: "Global type '{0}' must be a class or interface type." }, + Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1, key: "Global type '{0}' must have {1} type parameter(s)." }, + Cannot_find_global_type_0: { code: 2318, category: 1, key: "Cannot find global type '{0}'." }, + Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, + Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, + Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, + Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1, key: "Type '{0}' is not assignable to type '{1}'." }, + Property_0_is_missing_in_type_1: { code: 2324, category: 1, key: "Property '{0}' is missing in type '{1}'." }, + Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: 1, key: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, + Types_of_property_0_are_incompatible: { code: 2326, category: 1, key: "Types of property '{0}' are incompatible." }, + Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: 1, key: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, + Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: 1, key: "Types of parameters '{0}' and '{1}' are incompatible." }, + Index_signature_is_missing_in_type_0: { code: 2329, category: 1, key: "Index signature is missing in type '{0}'." }, + Index_signatures_are_incompatible: { code: 2330, category: 1, key: "Index signatures are incompatible." }, + this_cannot_be_referenced_in_a_module_body: { code: 2331, category: 1, key: "'this' cannot be referenced in a module body." }, + this_cannot_be_referenced_in_current_location: { code: 2332, category: 1, key: "'this' cannot be referenced in current location." }, + this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: 1, key: "'this' cannot be referenced in constructor arguments." }, + this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: 1, key: "'this' cannot be referenced in a static property initializer." }, + super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: 1, key: "'super' can only be referenced in a derived class." }, + super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: 1, key: "'super' cannot be referenced in constructor arguments." }, + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: 1, key: "Super calls are not permitted outside constructors or in nested functions inside constructors" }, + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: 1, key: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class" }, + Property_0_does_not_exist_on_type_1: { code: 2339, category: 1, key: "Property '{0}' does not exist on type '{1}'." }, + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, + Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1, key: "Property '{0}' is private and only accessible within class '{1}'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, + Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1, key: "Type '{0}' does not satisfy the constraint '{1}'." }, + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, + Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1, key: "Supplied parameters do not match any signature of call target." }, + Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: 1, key: "Untyped function calls may not accept type arguments." }, + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: 1, key: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature: { code: 2349, category: 1, key: "Cannot invoke an expression whose type lacks a call signature." }, + Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: 1, key: "Only a void function can be called with the 'new' keyword." }, + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: 1, key: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, + Neither_type_0_nor_type_1_is_assignable_to_the_other: { code: 2352, category: 1, key: "Neither type '{0}' nor type '{1}' is assignable to the other." }, + No_best_common_type_exists_among_return_expressions: { code: 2354, category: 1, key: "No best common type exists among return expressions." }, + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2355, category: 1, key: "A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement." }, + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: 1, key: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, + Invalid_left_hand_side_of_assignment_expression: { code: 2364, category: 1, key: "Invalid left-hand side of assignment expression." }, + Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: 1, key: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, + Type_parameter_name_cannot_be_0: { code: 2368, category: 1, key: "Type parameter name cannot be '{0}'" }, + A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: 1, key: "A parameter property is only allowed in a constructor implementation." }, + A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: 1, key: "A rest parameter must be of an array type." }, + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: 1, key: "A parameter initializer is only allowed in a function or constructor implementation." }, + Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: 1, key: "Parameter '{0}' cannot be referenced in its initializer." }, + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: 1, key: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, + Duplicate_string_index_signature: { code: 2374, category: 1, key: "Duplicate string index signature." }, + Duplicate_number_index_signature: { code: 2375, category: 1, key: "Duplicate number index signature." }, + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: 1, key: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, + Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: 1, key: "Constructors for derived classes must contain a 'super' call." }, + A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement: { code: 2378, category: 1, key: "A 'get' accessor must return a value or consist of a single 'throw' statement." }, + Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: 1, key: "Getter and setter accessors do not agree in visibility." }, + get_and_set_accessor_must_have_the_same_type: { code: 2380, category: 1, key: "'get' and 'set' accessor must have the same type." }, + A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: 1, key: "A signature with an implementation cannot use a string literal type." }, + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: 1, key: "Specialized overload signature is not assignable to any non-specialized signature." }, + Overload_signatures_must_all_be_exported_or_not_exported: { code: 2383, category: 1, key: "Overload signatures must all be exported or not exported." }, + Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: 1, key: "Overload signatures must all be ambient or non-ambient." }, + Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: 1, key: "Overload signatures must all be public, private or protected." }, + Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: 1, key: "Overload signatures must all be optional or required." }, + Function_overload_must_be_static: { code: 2387, category: 1, key: "Function overload must be static." }, + Function_overload_must_not_be_static: { code: 2388, category: 1, key: "Function overload must not be static." }, + Function_implementation_name_must_be_0: { code: 2389, category: 1, key: "Function implementation name must be '{0}'." }, + Constructor_implementation_is_missing: { code: 2390, category: 1, key: "Constructor implementation is missing." }, + Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: 1, key: "Function implementation is missing or not immediately following the declaration." }, + Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: 1, key: "Multiple constructor implementations are not allowed." }, + Duplicate_function_implementation: { code: 2393, category: 1, key: "Duplicate function implementation." }, + Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: 1, key: "Overload signature is not compatible with function implementation." }, + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: 1, key: "Individual declarations in merged declaration {0} must be all exported or all local." }, + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: 1, key: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: 1, key: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: 1, key: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: 1, key: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: 1, key: "Expression resolves to '_super' that compiler uses to capture base class reference." }, + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: 1, key: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: 1, key: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: 1, key: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, + Invalid_left_hand_side_in_for_in_statement: { code: 2406, category: 1, key: "Invalid left-hand side in 'for...in' statement." }, + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: 1, key: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, + Setters_cannot_return_a_value: { code: 2408, category: 1, key: "Setters cannot return a value." }, + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: 1, key: "Return type of constructor signature must be assignable to the instance type of the class" }, + All_symbols_within_a_with_block_will_be_resolved_to_any: { code: 2410, category: 1, key: "All symbols within a 'with' block will be resolved to 'any'." }, + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: 1, key: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: 1, key: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: 1, key: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, + Class_name_cannot_be_0: { code: 2414, category: 1, key: "Class name cannot be '{0}'" }, + Class_0_incorrectly_extends_base_class_1: { code: 2415, category: 1, key: "Class '{0}' incorrectly extends base class '{1}'." }, + Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: 1, key: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, + Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0: { code: 2419, category: 1, key: "Type name '{0}' in extends clause does not reference constructor function for '{0}'." }, + Class_0_incorrectly_implements_interface_1: { code: 2420, category: 1, key: "Class '{0}' incorrectly implements interface '{1}'." }, + A_class_may_only_implement_another_class_or_interface: { code: 2422, category: 1, key: "A class may only implement another class or interface." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: 1, key: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: 1, key: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: 1, key: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, + Interface_name_cannot_be_0: { code: 2427, category: 1, key: "Interface name cannot be '{0}'" }, + All_declarations_of_an_interface_must_have_identical_type_parameters: { code: 2428, category: 1, key: "All declarations of an interface must have identical type parameters." }, + Interface_0_incorrectly_extends_interface_1: { code: 2430, category: 1, key: "Interface '{0}' incorrectly extends interface '{1}'." }, + Enum_name_cannot_be_0: { code: 2431, category: 1, key: "Enum name cannot be '{0}'" }, + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: 1, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, + A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: 1, key: "A module declaration cannot be in a different file from a class or function with which it is merged" }, + A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: 1, key: "A module declaration cannot be located prior to a class or function with which it is merged" }, + Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: 1, key: "Ambient external modules cannot be nested in other modules." }, + Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: 1, key: "Ambient external module declaration cannot specify relative module name." }, + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: 1, key: "Module '{0}' is hidden by a local declaration with the same name" }, + Import_name_cannot_be_0: { code: 2438, category: 1, key: "Import name cannot be '{0}'" }, + Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: 1, key: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name." }, + Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: 1, key: "Import declaration conflicts with local declaration of '{0}'" }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: 1, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: 1, key: "Types have separate declarations of a private property '{0}'." }, + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: 1, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, + Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: 1, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: 1, key: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: 1, key: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: 1, key: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, + Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: 1, key: "Block-scoped variable '{0}' used before its declaration." }, + The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant: { code: 2449, category: 1, key: "The operand of an increment or decrement operator cannot be a constant." }, + Left_hand_side_of_assignment_expression_cannot_be_a_constant: { code: 2450, category: 1, key: "Left-hand side of assignment expression cannot be a constant." }, + Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: 1, key: "Cannot redeclare block-scoped variable '{0}'." }, + An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: 1, key: "An enum member cannot have a numeric name." }, + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: 1, key: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: 1, key: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, + Type_alias_0_circularly_references_itself: { code: 2456, category: 1, key: "Type alias '{0}' circularly references itself." }, + Type_alias_name_cannot_be_0: { code: 2457, category: 1, key: "Type alias name cannot be '{0}'" }, + An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: 1, key: "An AMD module cannot have multiple name assignments." }, + Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: 1, key: "Type '{0}' has no property '{1}' and no string index signature." }, + Type_0_has_no_property_1: { code: 2460, category: 1, key: "Type '{0}' has no property '{1}'." }, + Type_0_is_not_an_array_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type." }, + A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1, key: "A rest element must be last in an array destructuring pattern" }, + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1, key: "A binding pattern parameter cannot be optional in an implementation signature." }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, + this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1, key: "'this' cannot be referenced in a computed property name." }, + super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1, key: "'super' cannot be referenced in a computed property name." }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, + Cannot_find_global_value_0: { code: 2468, category: 1, key: "Cannot find global value '{0}'." }, + The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: 1, key: "The '{0}' operator cannot be applied to type 'symbol'." }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: 1, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: 1, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: 1, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: 1, key: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: 1, key: "A const enum member can only be accessed using a string literal." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: 1, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, + for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: 1, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: 1, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, + Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1, key: "Import declaration '{0}' is using private name '{1}'." }, + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: 1, key: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: 1, key: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: 1, key: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: 1, key: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: 1, key: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: 1, key: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: 1, key: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: 1, key: "Extends clause of exported class '{0}' has or is using private name '{1}'." }, + Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: 1, key: "Extends clause of exported interface '{0}' has or is using private name '{1}'." }, + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: 1, key: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, + Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: 1, key: "Exported variable '{0}' has or is using private name '{1}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: 1, key: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: 1, key: "Public static property '{0}' of exported class has or is using private name '{1}'." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: 1, key: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, + Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: 1, key: "Public property '{0}' of exported class has or is using private name '{1}'." }, + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: 1, key: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, + Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: 1, key: "Property '{0}' of exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: 1, key: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: 1, key: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: 1, key: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: 1, key: "Return type of public static property getter from exported class has or is using private name '{0}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: 1, key: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: 1, key: "Return type of public property getter from exported class has or is using private name '{0}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: 1, key: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: 1, key: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: 1, key: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: 1, key: "Return type of call signature from exported interface has or is using private name '{0}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: 1, key: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: 1, key: "Return type of index signature from exported interface has or is using private name '{0}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: 1, key: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: 1, key: "Return type of public static method from exported class has or is using private name '{0}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: 1, key: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: 1, key: "Return type of public method from exported class has or is using private name '{0}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: 1, key: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: 1, key: "Return type of method from exported interface has or is using private name '{0}'." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: 1, key: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: 1, key: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, + Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: 1, key: "Return type of exported function has or is using private name '{0}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: 1, key: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: 1, key: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: 1, key: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: 1, key: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: 1, key: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: 1, key: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: 1, key: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: 1, key: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, + Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, + Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1, key: "Exported type alias '{0}' has or is using private name '{1}'." }, + The_current_host_does_not_support_the_0_option: { code: 5001, category: 1, key: "The current host does not support the '{0}' option." }, + Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1, key: "Cannot find the common subdirectory path for the input files." }, + Cannot_read_file_0_Colon_1: { code: 5012, category: 1, key: "Cannot read file '{0}': {1}" }, + Unsupported_file_encoding: { code: 5013, category: 1, key: "Unsupported file encoding." }, + Unknown_compiler_option_0: { code: 5023, category: 1, key: "Unknown compiler option '{0}'." }, + Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: 1, key: "Compiler option '{0}' requires a value of type {1}." }, + Could_not_write_file_0_Colon_1: { code: 5033, category: 1, key: "Could not write file '{0}': {1}" }, + Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: 1, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: 1, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: 1, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, + Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: 1, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, + Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: 1, key: "Option 'project' cannot be mixed with source files on a command line." }, + Concatenate_and_emit_output_to_single_file: { code: 6001, category: 2, key: "Concatenate and emit output to single file." }, + Generates_corresponding_d_ts_file: { code: 6002, category: 2, key: "Generates corresponding '.d.ts' file." }, + Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: 2, key: "Specifies the location where debugger should locate map files instead of generated locations." }, + Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: 2, key: "Specifies the location where debugger should locate TypeScript files instead of source locations." }, + Watch_input_files: { code: 6005, category: 2, key: "Watch input files." }, + Redirect_output_structure_to_the_directory: { code: 6006, category: 2, key: "Redirect output structure to the directory." }, + Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: 2, key: "Do not erase const enum declarations in generated code." }, + Do_not_emit_outputs_if_any_type_checking_errors_were_reported: { code: 6008, category: 2, key: "Do not emit outputs if any type checking errors were reported." }, + Do_not_emit_comments_to_output: { code: 6009, category: 2, key: "Do not emit comments to output." }, + Do_not_emit_outputs: { code: 6010, category: 2, key: "Do not emit outputs." }, + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: 2, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, + Specify_module_code_generation_Colon_commonjs_or_amd: { code: 6016, category: 2, key: "Specify module code generation: 'commonjs' or 'amd'" }, + Print_this_message: { code: 6017, category: 2, key: "Print this message." }, + Print_the_compiler_s_version: { code: 6019, category: 2, key: "Print the compiler's version." }, + Compile_the_project_in_the_given_directory: { code: 6020, category: 2, key: "Compile the project in the given directory." }, + Syntax_Colon_0: { code: 6023, category: 2, key: "Syntax: {0}" }, + options: { code: 6024, category: 2, key: "options" }, + file: { code: 6025, category: 2, key: "file" }, + Examples_Colon_0: { code: 6026, category: 2, key: "Examples: {0}" }, + Options_Colon: { code: 6027, category: 2, key: "Options:" }, + Version_0: { code: 6029, category: 2, key: "Version {0}" }, + Insert_command_line_options_and_files_from_a_file: { code: 6030, category: 2, key: "Insert command line options and files from a file." }, + File_change_detected_Starting_incremental_compilation: { code: 6032, category: 2, key: "File change detected. Starting incremental compilation..." }, + KIND: { code: 6034, category: 2, key: "KIND" }, + FILE: { code: 6035, category: 2, key: "FILE" }, + VERSION: { code: 6036, category: 2, key: "VERSION" }, + LOCATION: { code: 6037, category: 2, key: "LOCATION" }, + DIRECTORY: { code: 6038, category: 2, key: "DIRECTORY" }, + Compilation_complete_Watching_for_file_changes: { code: 6042, category: 2, key: "Compilation complete. Watching for file changes." }, + Generates_corresponding_map_file: { code: 6043, category: 2, key: "Generates corresponding '.map' file." }, + Compiler_option_0_expects_an_argument: { code: 6044, category: 1, key: "Compiler option '{0}' expects an argument." }, + Unterminated_quoted_string_in_response_file_0: { code: 6045, category: 1, key: "Unterminated quoted string in response file '{0}'." }, + Argument_for_module_option_must_be_commonjs_or_amd: { code: 6046, category: 1, key: "Argument for '--module' option must be 'commonjs' or 'amd'." }, + Argument_for_target_option_must_be_es3_es5_or_es6: { code: 6047, category: 1, key: "Argument for '--target' option must be 'es3', 'es5', or 'es6'." }, + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: 1, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, + Unsupported_locale_0: { code: 6049, category: 1, key: "Unsupported locale '{0}'." }, + Unable_to_open_file_0: { code: 6050, category: 1, key: "Unable to open file '{0}'." }, + Corrupted_locale_file_0: { code: 6051, category: 1, key: "Corrupted locale file {0}." }, + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: 2, key: "Raise error on expressions and declarations with an implied 'any' type." }, + File_0_not_found: { code: 6053, category: 1, key: "File '{0}' not found." }, + File_0_must_have_extension_ts_or_d_ts: { code: 6054, category: 1, key: "File '{0}' must have extension '.ts' or '.d.ts'." }, + Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: 2, key: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, + Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: 2, key: "Do not emit declarations for code that has an '@internal' annotation." }, + Variable_0_implicitly_has_an_1_type: { code: 7005, category: 1, key: "Variable '{0}' implicitly has an '{1}' type." }, + Parameter_0_implicitly_has_an_1_type: { code: 7006, category: 1, key: "Parameter '{0}' implicitly has an '{1}' type." }, + Member_0_implicitly_has_an_1_type: { code: 7008, category: 1, key: "Member '{0}' implicitly has an '{1}' type." }, + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: 1, key: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: 1, key: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: 1, key: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: 1, key: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation: { code: 7016, category: 1, key: "Property '{0}' implicitly has type 'any', because its 'set' accessor lacks a type annotation." }, + Index_signature_of_object_type_implicitly_has_an_any_type: { code: 7017, category: 1, key: "Index signature of object type implicitly has an 'any' type." }, + Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: 1, key: "Object literal's property '{0}' implicitly has an '{1}' type." }, + Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: 1, key: "Rest parameter '{0}' implicitly has an 'any[]' type." }, + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: 1, key: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, + _0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 7021, category: 1, key: "'{0}' implicitly has type 'any' because it is referenced directly or indirectly in its own type annotation." }, + _0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: 1, key: "'{0}' implicitly has type 'any' because it is does not have a type annotation and is referenced directly or indirectly in its own initializer." }, + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: 1, key: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, + Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: 1, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, + You_cannot_rename_this_element: { code: 8000, category: 1, key: "You cannot rename this element." }, + You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: 1, key: "You cannot rename elements that are defined in the standard TypeScript library." }, + yield_expressions_are_not_currently_supported: { code: 9000, category: 1, key: "'yield' expressions are not currently supported." }, + Generators_are_not_currently_supported: { code: 9001, category: 1, key: "Generators are not currently supported." }, + The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, + for_of_statements_are_not_currently_supported: { code: 9003, category: 1, key: "'for...of' statements are not currently supported." } + }; +})(ts || (ts = {})); +var ts; +(function (ts) { + var textToToken = { + "any": 110, + "boolean": 111, + "break": 65, + "case": 66, + "catch": 67, + "class": 68, + "continue": 70, + "const": 69, + "constructor": 112, + "debugger": 71, + "declare": 113, + "default": 72, + "delete": 73, + "do": 74, + "else": 75, + "enum": 76, + "export": 77, + "extends": 78, + "false": 79, + "finally": 80, + "for": 81, + "function": 82, + "get": 114, + "if": 83, + "implements": 101, + "import": 84, + "in": 85, + "instanceof": 86, + "interface": 102, + "let": 103, + "module": 115, + "new": 87, + "null": 88, + "number": 117, + "package": 104, + "private": 105, + "protected": 106, + "public": 107, + "require": 116, + "return": 89, + "set": 118, + "static": 108, + "string": 119, + "super": 90, + "switch": 91, + "symbol": 120, + "this": 92, + "throw": 93, + "true": 94, + "try": 95, + "type": 121, + "typeof": 96, + "var": 97, + "void": 98, + "while": 99, + "with": 100, + "yield": 109, + "of": 122, + "{": 14, + "}": 15, + "(": 16, + ")": 17, + "[": 18, + "]": 19, + ".": 20, + "...": 21, + ";": 22, + ",": 23, + "<": 24, + ">": 25, + "<=": 26, + ">=": 27, + "==": 28, + "!=": 29, + "===": 30, + "!==": 31, + "=>": 32, + "+": 33, + "-": 34, + "*": 35, + "/": 36, + "%": 37, + "++": 38, + "--": 39, + "<<": 40, + ">>": 41, + ">>>": 42, + "&": 43, + "|": 44, + "^": 45, + "!": 46, + "~": 47, + "&&": 48, + "||": 49, + "?": 50, + ":": 51, + "=": 52, + "+=": 53, + "-=": 54, + "*=": 55, + "/=": 56, + "%=": 57, + "<<=": 58, + ">>=": 59, + ">>>=": 60, + "&=": 61, + "|=": 62, + "^=": 63 + }; + var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + function lookupInUnicodeMap(code, map) { + if (code < map[0]) { + return false; + } + var lo = 0; + var hi = map.length; + var mid; + while (lo + 1 < hi) { + mid = lo + (hi - lo) / 2; + mid -= mid % 2; + if (map[mid] <= code && code <= map[mid + 1]) { + return true; + } + if (code < map[mid]) { + hi = mid; + } + else { + lo = mid + 2; + } + } + return false; + } + function isUnicodeIdentifierStart(code, languageVersion) { + return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); + } + ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; + function isUnicodeIdentifierPart(code, languageVersion) { + return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); + } + function makeReverseMap(source) { + var result = []; + for (var name in source) { + if (source.hasOwnProperty(name)) { + result[source[name]] = name; + } + } + return result; + } + var tokenStrings = makeReverseMap(textToToken); + function tokenToString(t) { + return tokenStrings[t]; + } + ts.tokenToString = tokenToString; + function computeLineStarts(text) { + var result = new Array(); + var pos = 0; + var lineStart = 0; + while (pos < text.length) { + var ch = text.charCodeAt(pos++); + switch (ch) { + case 13: + if (text.charCodeAt(pos) === 10) { + pos++; + } + case 10: + result.push(lineStart); + lineStart = pos; + break; + default: + if (ch > 127 && isLineBreak(ch)) { + result.push(lineStart); + lineStart = pos; + } + break; + } + } + result.push(lineStart); + return result; + } + ts.computeLineStarts = computeLineStarts; + function getPositionOfLineAndCharacter(sourceFile, line, character) { + return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character); + } + ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter; + function computePositionOfLineAndCharacter(lineStarts, line, character) { + ts.Debug.assert(line >= 0 && line < lineStarts.length); + return lineStarts[line] + character; + } + ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter; + function getLineStarts(sourceFile) { + return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text)); + } + ts.getLineStarts = getLineStarts; + function computeLineAndCharacterOfPosition(lineStarts, position) { + var lineNumber = ts.binarySearch(lineStarts, position); + if (lineNumber < 0) { + lineNumber = ~lineNumber - 1; + } + return { + line: lineNumber, + character: position - lineStarts[lineNumber] + }; + } + ts.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition; + function getLineAndCharacterOfPosition(sourceFile, position) { + return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); + } + ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; + var hasOwnProperty = Object.prototype.hasOwnProperty; + function isWhiteSpace(ch) { + return ch === 32 || ch === 9 || ch === 11 || ch === 12 || + ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || + ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; + } + ts.isWhiteSpace = isWhiteSpace; + function isLineBreak(ch) { + return ch === 10 || ch === 13 || ch === 8232 || ch === 8233 || ch === 133; + } + ts.isLineBreak = isLineBreak; + function isDigit(ch) { + return ch >= 48 && ch <= 57; + } + function isOctalDigit(ch) { + return ch >= 48 && ch <= 55; + } + ts.isOctalDigit = isOctalDigit; + function skipTrivia(text, pos, stopAfterLineBreak) { + while (true) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13: + if (text.charCodeAt(pos + 1) === 10) { + pos++; + } + case 10: + pos++; + if (stopAfterLineBreak) { + return pos; + } + continue; + case 9: + case 11: + case 12: + case 32: + pos++; + continue; + case 47: + if (text.charCodeAt(pos + 1) === 47) { + pos += 2; + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + continue; + } + if (text.charCodeAt(pos + 1) === 42) { + pos += 2; + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) { + pos += 2; + break; + } + pos++; + } + continue; + } + break; + case 60: + case 61: + case 62: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos); + continue; + } + break; + default: + if (ch > 127 && (isWhiteSpace(ch) || isLineBreak(ch))) { + pos++; + continue; + } + break; + } + return pos; + } + } + ts.skipTrivia = skipTrivia; + var mergeConflictMarkerLength = "<<<<<<<".length; + function isConflictMarkerTrivia(text, pos) { + ts.Debug.assert(pos >= 0); + if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { + var ch = text.charCodeAt(pos); + if ((pos + mergeConflictMarkerLength) < text.length) { + for (var i = 0, n = mergeConflictMarkerLength; i < n; i++) { + if (text.charCodeAt(pos + i) !== ch) { + return false; + } + } + return ch === 61 || + text.charCodeAt(pos + mergeConflictMarkerLength) === 32; + } + } + return false; + } + function scanConflictMarkerTrivia(text, pos, error) { + if (error) { + error(ts.Diagnostics.Merge_conflict_marker_encountered, mergeConflictMarkerLength); + } + var ch = text.charCodeAt(pos); + var len = text.length; + if (ch === 60 || ch === 62) { + while (pos < len && !isLineBreak(text.charCodeAt(pos))) { + pos++; + } + } + else { + ts.Debug.assert(ch === 61); + while (pos < len) { + var ch = text.charCodeAt(pos); + if (ch === 62 && isConflictMarkerTrivia(text, pos)) { + break; + } + pos++; + } + } + return pos; + } + function getCommentRanges(text, pos, trailing) { + var result; + var collecting = trailing || pos === 0; + while (true) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13: + if (text.charCodeAt(pos + 1) === 10) + pos++; + case 10: + pos++; + if (trailing) { + return result; + } + collecting = true; + if (result && result.length) { + result[result.length - 1].hasTrailingNewLine = true; + } + continue; + case 9: + case 11: + case 12: + case 32: + pos++; + continue; + case 47: + var nextChar = text.charCodeAt(pos + 1); + var hasTrailingNewLine = false; + if (nextChar === 47 || nextChar === 42) { + var startPos = pos; + pos += 2; + if (nextChar === 47) { + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + hasTrailingNewLine = true; + break; + } + pos++; + } + } + else { + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) { + pos += 2; + break; + } + pos++; + } + } + if (collecting) { + if (!result) + result = []; + result.push({ pos: startPos, end: pos, hasTrailingNewLine: hasTrailingNewLine }); + } + continue; + } + break; + default: + if (ch > 127 && (isWhiteSpace(ch) || isLineBreak(ch))) { + if (result && result.length && isLineBreak(ch)) { + result[result.length - 1].hasTrailingNewLine = true; + } + pos++; + continue; + } + break; + } + return result; + } + } + function getLeadingCommentRanges(text, pos) { + return getCommentRanges(text, pos, false); + } + ts.getLeadingCommentRanges = getLeadingCommentRanges; + function getTrailingCommentRanges(text, pos) { + return getCommentRanges(text, pos, true); + } + ts.getTrailingCommentRanges = getTrailingCommentRanges; + function isIdentifierStart(ch, languageVersion) { + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + } + ts.isIdentifierStart = isIdentifierStart; + function isIdentifierPart(ch, languageVersion) { + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + } + ts.isIdentifierPart = isIdentifierPart; + function createScanner(languageVersion, skipTrivia, text, onError) { + var pos; + var len; + var startPos; + var tokenPos; + var token; + var tokenValue; + var precedingLineBreak; + var tokenIsUnterminated; + function error(message, length) { + if (onError) { + onError(message, length || 0); + } + } + function isIdentifierStart(ch) { + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + } + function isIdentifierPart(ch) { + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + } + function scanNumber() { + var start = pos; + while (isDigit(text.charCodeAt(pos))) + pos++; + if (text.charCodeAt(pos) === 46) { + pos++; + while (isDigit(text.charCodeAt(pos))) + pos++; + } + var end = pos; + if (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101) { + pos++; + if (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) + pos++; + if (isDigit(text.charCodeAt(pos))) { + pos++; + while (isDigit(text.charCodeAt(pos))) + pos++; + end = pos; + } + else { + error(ts.Diagnostics.Digit_expected); + } + } + return +(text.substring(start, end)); + } + function scanOctalDigits() { + var start = pos; + while (isOctalDigit(text.charCodeAt(pos))) { + pos++; + } + return +(text.substring(start, pos)); + } + function scanHexDigits(count, mustMatchCount) { + var digits = 0; + var value = 0; + while (digits < count || !mustMatchCount) { + var ch = text.charCodeAt(pos); + if (ch >= 48 && ch <= 57) { + value = value * 16 + ch - 48; + } + else if (ch >= 65 && ch <= 70) { + value = value * 16 + ch - 65 + 10; + } + else if (ch >= 97 && ch <= 102) { + value = value * 16 + ch - 97 + 10; + } + else { + break; + } + pos++; + digits++; + } + if (digits < count) { + value = -1; + } + return value; + } + function scanString() { + var quote = text.charCodeAt(pos++); + var result = ""; + var start = pos; + while (true) { + if (pos >= len) { + result += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_string_literal); + break; + } + var ch = text.charCodeAt(pos); + if (ch === quote) { + result += text.substring(start, pos); + pos++; + break; + } + if (ch === 92) { + result += text.substring(start, pos); + result += scanEscapeSequence(); + start = pos; + continue; + } + if (isLineBreak(ch)) { + result += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_string_literal); + break; + } + pos++; + } + return result; + } + function scanTemplateAndSetTokenValue() { + var startedWithBacktick = text.charCodeAt(pos) === 96; + pos++; + var start = pos; + var contents = ""; + var resultingToken; + while (true) { + if (pos >= len) { + contents += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_template_literal); + resultingToken = startedWithBacktick ? 10 : 13; + break; + } + var currChar = text.charCodeAt(pos); + if (currChar === 96) { + contents += text.substring(start, pos); + pos++; + resultingToken = startedWithBacktick ? 10 : 13; + break; + } + if (currChar === 36 && pos + 1 < len && text.charCodeAt(pos + 1) === 123) { + contents += text.substring(start, pos); + pos += 2; + resultingToken = startedWithBacktick ? 11 : 12; + break; + } + if (currChar === 92) { + contents += text.substring(start, pos); + contents += scanEscapeSequence(); + start = pos; + continue; + } + if (currChar === 13) { + contents += text.substring(start, pos); + pos++; + if (pos < len && text.charCodeAt(pos) === 10) { + pos++; + } + contents += "\n"; + start = pos; + continue; + } + pos++; + } + ts.Debug.assert(resultingToken !== undefined); + tokenValue = contents; + return resultingToken; + } + function scanEscapeSequence() { + pos++; + if (pos >= len) { + error(ts.Diagnostics.Unexpected_end_of_text); + return ""; + } + var ch = text.charCodeAt(pos++); + switch (ch) { + case 48: + return "\0"; + case 98: + return "\b"; + case 116: + return "\t"; + case 110: + return "\n"; + case 118: + return "\v"; + case 102: + return "\f"; + case 114: + return "\r"; + case 39: + return "\'"; + case 34: + return "\""; + case 120: + case 117: + var ch = scanHexDigits(ch === 120 ? 2 : 4, true); + if (ch >= 0) { + return String.fromCharCode(ch); + } + else { + error(ts.Diagnostics.Hexadecimal_digit_expected); + return ""; + } + case 13: + if (pos < len && text.charCodeAt(pos) === 10) { + pos++; + } + case 10: + case 8232: + case 8233: + return ""; + default: + return String.fromCharCode(ch); + } + } + function peekUnicodeEscape() { + if (pos + 5 < len && text.charCodeAt(pos + 1) === 117) { + var start = pos; + pos += 2; + var value = scanHexDigits(4, true); + pos = start; + return value; + } + return -1; + } + function scanIdentifierParts() { + var result = ""; + var start = pos; + while (pos < len) { + var ch = text.charCodeAt(pos); + if (isIdentifierPart(ch)) { + pos++; + } + else if (ch === 92) { + ch = peekUnicodeEscape(); + if (!(ch >= 0 && isIdentifierPart(ch))) { + break; + } + result += text.substring(start, pos); + result += String.fromCharCode(ch); + pos += 6; + start = pos; + } + else { + break; + } + } + result += text.substring(start, pos); + return result; + } + function getIdentifierToken() { + var len = tokenValue.length; + if (len >= 2 && len <= 11) { + var ch = tokenValue.charCodeAt(0); + if (ch >= 97 && ch <= 122 && hasOwnProperty.call(textToToken, tokenValue)) { + return token = textToToken[tokenValue]; + } + } + return token = 64; + } + function scanBinaryOrOctalDigits(base) { + ts.Debug.assert(base !== 2 || base !== 8, "Expected either base 2 or base 8"); + var value = 0; + var numberOfDigits = 0; + while (true) { + var ch = text.charCodeAt(pos); + var valueOfCh = ch - 48; + if (!isDigit(ch) || valueOfCh >= base) { + break; + } + value = value * base + valueOfCh; + pos++; + numberOfDigits++; + } + if (numberOfDigits === 0) { + return -1; + } + return value; + } + function scan() { + startPos = pos; + precedingLineBreak = false; + tokenIsUnterminated = false; + while (true) { + tokenPos = pos; + if (pos >= len) { + return token = 1; + } + var ch = text.charCodeAt(pos); + switch (ch) { + case 10: + case 13: + precedingLineBreak = true; + if (skipTrivia) { + pos++; + continue; + } + else { + if (ch === 13 && pos + 1 < len && text.charCodeAt(pos + 1) === 10) { + pos += 2; + } + else { + pos++; + } + return token = 4; + } + case 9: + case 11: + case 12: + case 32: + if (skipTrivia) { + pos++; + continue; + } + else { + while (pos < len && isWhiteSpace(text.charCodeAt(pos))) { + pos++; + } + return token = 5; + } + case 33: + if (text.charCodeAt(pos + 1) === 61) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 31; + } + return pos += 2, token = 29; + } + return pos++, token = 46; + case 34: + case 39: + tokenValue = scanString(); + return token = 8; + case 96: + return token = scanTemplateAndSetTokenValue(); + case 37: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 57; + } + return pos++, token = 37; + case 38: + if (text.charCodeAt(pos + 1) === 38) { + return pos += 2, token = 48; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 61; + } + return pos++, token = 43; + case 40: + return pos++, token = 16; + case 41: + return pos++, token = 17; + case 42: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 55; + } + return pos++, token = 35; + case 43: + if (text.charCodeAt(pos + 1) === 43) { + return pos += 2, token = 38; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 53; + } + return pos++, token = 33; + case 44: + return pos++, token = 23; + case 45: + if (text.charCodeAt(pos + 1) === 45) { + return pos += 2, token = 39; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 54; + } + return pos++, token = 34; + case 46: + if (isDigit(text.charCodeAt(pos + 1))) { + tokenValue = "" + scanNumber(); + return token = 7; + } + if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) { + return pos += 3, token = 21; + } + return pos++, token = 20; + case 47: + if (text.charCodeAt(pos + 1) === 47) { + pos += 2; + while (pos < len) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + if (skipTrivia) { + continue; + } + else { + return token = 2; + } + } + if (text.charCodeAt(pos + 1) === 42) { + pos += 2; + var commentClosed = false; + while (pos < len) { + var ch = text.charCodeAt(pos); + if (ch === 42 && text.charCodeAt(pos + 1) === 47) { + pos += 2; + commentClosed = true; + break; + } + if (isLineBreak(ch)) { + precedingLineBreak = true; + } + pos++; + } + if (!commentClosed) { + error(ts.Diagnostics.Asterisk_Slash_expected); + } + if (skipTrivia) { + continue; + } + else { + tokenIsUnterminated = !commentClosed; + return token = 3; + } + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 56; + } + return pos++, token = 36; + case 48: + if (pos + 2 < len && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) { + pos += 2; + var value = scanHexDigits(1, false); + if (value < 0) { + error(ts.Diagnostics.Hexadecimal_digit_expected); + value = 0; + } + tokenValue = "" + value; + return token = 7; + } + else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { + pos += 2; + var value = scanBinaryOrOctalDigits(2); + if (value < 0) { + error(ts.Diagnostics.Binary_digit_expected); + value = 0; + } + tokenValue = "" + value; + return token = 7; + } + else if (pos + 2 < len && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { + pos += 2; + var value = scanBinaryOrOctalDigits(8); + if (value < 0) { + error(ts.Diagnostics.Octal_digit_expected); + value = 0; + } + tokenValue = "" + value; + return token = 7; + } + if (pos + 1 < len && isOctalDigit(text.charCodeAt(pos + 1))) { + tokenValue = "" + scanOctalDigits(); + return token = 7; + } + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + tokenValue = "" + scanNumber(); + return token = 7; + case 58: + return pos++, token = 51; + case 59: + return pos++, token = 22; + case 60: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia) { + continue; + } + else { + return token = 6; + } + } + if (text.charCodeAt(pos + 1) === 60) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 58; + } + return pos += 2, token = 40; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 26; + } + return pos++, token = 24; + case 61: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia) { + continue; + } + else { + return token = 6; + } + } + if (text.charCodeAt(pos + 1) === 61) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 30; + } + return pos += 2, token = 28; + } + if (text.charCodeAt(pos + 1) === 62) { + return pos += 2, token = 32; + } + return pos++, token = 52; + case 62: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia) { + continue; + } + else { + return token = 6; + } + } + return pos++, token = 25; + case 63: + return pos++, token = 50; + case 91: + return pos++, token = 18; + case 93: + return pos++, token = 19; + case 94: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 63; + } + return pos++, token = 45; + case 123: + return pos++, token = 14; + case 124: + if (text.charCodeAt(pos + 1) === 124) { + return pos += 2, token = 49; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 62; + } + return pos++, token = 44; + case 125: + return pos++, token = 15; + case 126: + return pos++, token = 47; + case 92: + var ch = peekUnicodeEscape(); + if (ch >= 0 && isIdentifierStart(ch)) { + pos += 6; + tokenValue = String.fromCharCode(ch) + scanIdentifierParts(); + return token = getIdentifierToken(); + } + error(ts.Diagnostics.Invalid_character); + return pos++, token = 0; + default: + if (isIdentifierStart(ch)) { + pos++; + while (pos < len && isIdentifierPart(ch = text.charCodeAt(pos))) + pos++; + tokenValue = text.substring(tokenPos, pos); + if (ch === 92) { + tokenValue += scanIdentifierParts(); + } + return token = getIdentifierToken(); + } + else if (isWhiteSpace(ch)) { + pos++; + continue; + } + else if (isLineBreak(ch)) { + precedingLineBreak = true; + pos++; + continue; + } + error(ts.Diagnostics.Invalid_character); + return pos++, token = 0; + } + } + } + function reScanGreaterToken() { + if (token === 25) { + if (text.charCodeAt(pos) === 62) { + if (text.charCodeAt(pos + 1) === 62) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 60; + } + return pos += 2, token = 42; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 59; + } + return pos++, token = 41; + } + if (text.charCodeAt(pos) === 61) { + return pos++, token = 27; + } + } + return token; + } + function reScanSlashToken() { + if (token === 36 || token === 56) { + var p = tokenPos + 1; + var inEscape = false; + var inCharacterClass = false; + while (true) { + if (p >= len) { + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_regular_expression_literal); + break; + } + var ch = text.charCodeAt(p); + if (isLineBreak(ch)) { + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_regular_expression_literal); + break; + } + if (inEscape) { + inEscape = false; + } + else if (ch === 47 && !inCharacterClass) { + p++; + break; + } + else if (ch === 91) { + inCharacterClass = true; + } + else if (ch === 92) { + inEscape = true; + } + else if (ch === 93) { + inCharacterClass = false; + } + p++; + } + while (p < len && isIdentifierPart(text.charCodeAt(p))) { + p++; + } + pos = p; + tokenValue = text.substring(tokenPos, pos); + token = 9; + } + return token; + } + function reScanTemplateToken() { + ts.Debug.assert(token === 15, "'reScanTemplateToken' should only be called on a '}'"); + pos = tokenPos; + return token = scanTemplateAndSetTokenValue(); + } + function speculationHelper(callback, isLookahead) { + var savePos = pos; + var saveStartPos = startPos; + var saveTokenPos = tokenPos; + var saveToken = token; + var saveTokenValue = tokenValue; + var savePrecedingLineBreak = precedingLineBreak; + var result = callback(); + if (!result || isLookahead) { + pos = savePos; + startPos = saveStartPos; + tokenPos = saveTokenPos; + token = saveToken; + tokenValue = saveTokenValue; + precedingLineBreak = savePrecedingLineBreak; + } + return result; + } + function lookAhead(callback) { + return speculationHelper(callback, true); + } + function tryScan(callback) { + return speculationHelper(callback, false); + } + function setText(newText) { + text = newText || ""; + len = text.length; + setTextPos(0); + } + function setTextPos(textPos) { + pos = textPos; + startPos = textPos; + tokenPos = textPos; + token = 0; + precedingLineBreak = false; + } + setText(text); + return { + getStartPos: function () { return startPos; }, + getTextPos: function () { return pos; }, + getToken: function () { return token; }, + getTokenPos: function () { return tokenPos; }, + getTokenText: function () { return text.substring(tokenPos, pos); }, + getTokenValue: function () { return tokenValue; }, + hasPrecedingLineBreak: function () { return precedingLineBreak; }, + isIdentifier: function () { return token === 64 || token > 100; }, + isReservedWord: function () { return token >= 65 && token <= 100; }, + isUnterminated: function () { return tokenIsUnterminated; }, + reScanGreaterToken: reScanGreaterToken, + reScanSlashToken: reScanSlashToken, + reScanTemplateToken: reScanTemplateToken, + scan: scan, + setText: setText, + setTextPos: setTextPos, + tryScan: tryScan, + lookAhead: lookAhead + }; + } + ts.createScanner = createScanner; +})(ts || (ts = {})); +var ts; +(function (ts) { + function getDeclarationOfKind(symbol, kind) { + var declarations = symbol.declarations; + for (var i = 0; i < declarations.length; i++) { + var declaration = declarations[i]; + if (declaration.kind === kind) { + return declaration; + } + } + return undefined; + } + ts.getDeclarationOfKind = getDeclarationOfKind; + var stringWriters = []; + function getSingleLineStringWriter() { + if (stringWriters.length == 0) { + var str = ""; + var writeText = function (text) { return str += text; }; + return { + string: function () { return str; }, + writeKeyword: writeText, + writeOperator: writeText, + writePunctuation: writeText, + writeSpace: writeText, + writeStringLiteral: writeText, + writeParameter: writeText, + writeSymbol: writeText, + writeLine: function () { return str += " "; }, + increaseIndent: function () { }, + decreaseIndent: function () { }, + clear: function () { return str = ""; }, + trackSymbol: function () { } + }; + } + return stringWriters.pop(); + } + ts.getSingleLineStringWriter = getSingleLineStringWriter; + function releaseStringWriter(writer) { + writer.clear(); + stringWriters.push(writer); + } + ts.releaseStringWriter = releaseStringWriter; + function getFullWidth(node) { + return node.end - node.pos; + } + ts.getFullWidth = getFullWidth; + function containsParseError(node) { + aggregateChildData(node); + return (node.parserContextFlags & 32) !== 0; + } + ts.containsParseError = containsParseError; + function aggregateChildData(node) { + if (!(node.parserContextFlags & 64)) { + var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || + ts.forEachChild(node, containsParseError); + if (thisNodeOrAnySubNodesHasError) { + node.parserContextFlags |= 32; + } + node.parserContextFlags |= 64; + } + } + function getSourceFileOfNode(node) { + while (node && node.kind !== 210) { + node = node.parent; + } + return node; + } + ts.getSourceFileOfNode = getSourceFileOfNode; + function getStartPositionOfLine(line, sourceFile) { + ts.Debug.assert(line >= 0); + return ts.getLineStarts(sourceFile)[line]; + } + ts.getStartPositionOfLine = getStartPositionOfLine; + function nodePosToString(node) { + var file = getSourceFileOfNode(node); + var loc = ts.getLineAndCharacterOfPosition(file, node.pos); + return file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + ")"; + } + ts.nodePosToString = nodePosToString; + function getStartPosOfNode(node) { + return node.pos; + } + ts.getStartPosOfNode = getStartPosOfNode; + function nodeIsMissing(node) { + if (!node) { + return true; + } + return node.pos === node.end && node.kind !== 1; + } + ts.nodeIsMissing = nodeIsMissing; + function nodeIsPresent(node) { + return !nodeIsMissing(node); + } + ts.nodeIsPresent = nodeIsPresent; + function getTokenPosOfNode(node, sourceFile) { + if (nodeIsMissing(node)) { + return node.pos; + } + return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); + } + ts.getTokenPosOfNode = getTokenPosOfNode; + function getSourceTextOfNodeFromSourceFile(sourceFile, node) { + if (nodeIsMissing(node)) { + return ""; + } + var text = sourceFile.text; + return text.substring(ts.skipTrivia(text, node.pos), node.end); + } + ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile; + function getTextOfNodeFromSourceText(sourceText, node) { + if (nodeIsMissing(node)) { + return ""; + } + return sourceText.substring(ts.skipTrivia(sourceText, node.pos), node.end); + } + ts.getTextOfNodeFromSourceText = getTextOfNodeFromSourceText; + function getTextOfNode(node) { + return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node); + } + ts.getTextOfNode = getTextOfNode; + function escapeIdentifier(identifier) { + return identifier.length >= 2 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 ? "_" + identifier : identifier; + } + ts.escapeIdentifier = escapeIdentifier; + function unescapeIdentifier(identifier) { + return identifier.length >= 3 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 && identifier.charCodeAt(2) === 95 ? identifier.substr(1) : identifier; + } + ts.unescapeIdentifier = unescapeIdentifier; + function declarationNameToString(name) { + return getFullWidth(name) === 0 ? "(Missing)" : getTextOfNode(name); + } + ts.declarationNameToString = declarationNameToString; + function createDiagnosticForNode(node, message, arg0, arg1, arg2) { + node = getErrorSpanForNode(node); + var file = getSourceFileOfNode(node); + var start = getTokenPosOfNode(node, file); + var length = node.end - start; + return ts.createFileDiagnostic(file, start, length, message, arg0, arg1, arg2); + } + ts.createDiagnosticForNode = createDiagnosticForNode; + function createDiagnosticForNodeFromMessageChain(node, messageChain) { + node = getErrorSpanForNode(node); + var file = getSourceFileOfNode(node); + var start = ts.skipTrivia(file.text, node.pos); + var length = node.end - start; + return { + file: file, + start: start, + length: length, + code: messageChain.code, + category: messageChain.category, + messageText: messageChain.next ? messageChain : messageChain.messageText + }; + } + ts.createDiagnosticForNodeFromMessageChain = createDiagnosticForNodeFromMessageChain; + function getErrorSpanForNode(node) { + var errorSpan; + switch (node.kind) { + case 191: + case 148: + case 194: + case 195: + case 198: + case 197: + case 209: + errorSpan = node.name; + break; + } + return errorSpan && errorSpan.pos < errorSpan.end ? errorSpan : node; + } + ts.getErrorSpanForNode = getErrorSpanForNode; + function isExternalModule(file) { + return file.externalModuleIndicator !== undefined; + } + ts.isExternalModule = isExternalModule; + function isDeclarationFile(file) { + return (file.flags & 1024) !== 0; + } + ts.isDeclarationFile = isDeclarationFile; + function isConstEnumDeclaration(node) { + return node.kind === 197 && isConst(node); + } + ts.isConstEnumDeclaration = isConstEnumDeclaration; + function walkUpBindingElementsAndPatterns(node) { + while (node && (node.kind === 148 || isBindingPattern(node))) { + node = node.parent; + } + return node; + } + function getCombinedNodeFlags(node) { + node = walkUpBindingElementsAndPatterns(node); + var flags = node.flags; + if (node.kind === 191) { + node = node.parent; + } + if (node && node.kind === 192) { + flags |= node.flags; + node = node.parent; + } + if (node && node.kind === 173) { + flags |= node.flags; + } + return flags; + } + ts.getCombinedNodeFlags = getCombinedNodeFlags; + function isConst(node) { + return !!(getCombinedNodeFlags(node) & 4096); + } + ts.isConst = isConst; + function isLet(node) { + return !!(getCombinedNodeFlags(node) & 2048); + } + ts.isLet = isLet; + function isPrologueDirective(node) { + return node.kind === 175 && node.expression.kind === 8; + } + ts.isPrologueDirective = isPrologueDirective; + function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { + sourceFileOfNode = sourceFileOfNode || getSourceFileOfNode(node); + if (node.kind === 126 || node.kind === 125) { + return ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)); + } + else { + return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); + } + } + ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; + function getJsDocComments(node, sourceFileOfNode) { + return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); + function isJsDocComment(comment) { + return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && + sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && + sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; + } + } + ts.getJsDocComments = getJsDocComments; + ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; + function forEachReturnStatement(body, visitor) { + return traverse(body); + function traverse(node) { + switch (node.kind) { + case 184: + return visitor(node); + case 172: + case 176: + case 177: + case 178: + case 179: + case 180: + case 181: + case 185: + case 186: + case 203: + case 204: + case 187: + case 189: + case 206: + return ts.forEachChild(node, traverse); + } + } + } + ts.forEachReturnStatement = forEachReturnStatement; + function isAnyFunction(node) { + if (node) { + switch (node.kind) { + case 131: + case 158: + case 193: + case 159: + case 130: + case 129: + case 132: + case 133: + case 134: + case 135: + case 136: + case 138: + case 139: + case 158: + case 159: + case 193: + return true; + } + } + return false; + } + ts.isAnyFunction = isAnyFunction; + function isFunctionBlock(node) { + return node && node.kind === 172 && isAnyFunction(node.parent); + } + ts.isFunctionBlock = isFunctionBlock; + function isObjectLiteralMethod(node) { + return node && node.kind === 130 && node.parent.kind === 150; + } + ts.isObjectLiteralMethod = isObjectLiteralMethod; + function getContainingFunction(node) { + while (true) { + node = node.parent; + if (!node || isAnyFunction(node)) { + return node; + } + } + } + ts.getContainingFunction = getContainingFunction; + function getThisContainer(node, includeArrowFunctions) { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case 124: + if (node.parent.parent.kind === 194) { + return node; + } + node = node.parent; + break; + case 159: + if (!includeArrowFunctions) { + continue; + } + case 193: + case 158: + case 198: + case 128: + case 127: + case 130: + case 129: + case 131: + case 132: + case 133: + case 197: + case 210: + return node; + } + } + } + ts.getThisContainer = getThisContainer; + function getSuperContainer(node, includeFunctions) { + while (true) { + node = node.parent; + if (!node) + return node; + switch (node.kind) { + case 124: + if (node.parent.parent.kind === 194) { + return node; + } + node = node.parent; + break; + case 193: + case 158: + case 159: + if (!includeFunctions) { + continue; + } + case 128: + case 127: + case 130: + case 129: + case 131: + case 132: + case 133: + return node; + } + } + } + ts.getSuperContainer = getSuperContainer; + function getInvokedExpression(node) { + if (node.kind === 155) { + return node.tag; + } + return node.expression; + } + ts.getInvokedExpression = getInvokedExpression; + function isExpression(node) { + switch (node.kind) { + case 92: + case 90: + case 88: + case 94: + case 79: + case 9: + case 149: + case 150: + case 151: + case 152: + case 153: + case 154: + case 155: + case 156: + case 157: + case 158: + case 159: + case 162: + case 160: + case 161: + case 163: + case 164: + case 165: + case 166: + case 169: + case 167: + case 10: + case 170: + return true; + case 123: + while (node.parent.kind === 123) { + node = node.parent; + } + return node.parent.kind === 140; + case 64: + if (node.parent.kind === 140) { + return true; + } + case 7: + case 8: + var parent = node.parent; + switch (parent.kind) { + case 191: + case 126: + case 128: + case 127: + case 209: + case 207: + case 148: + return parent.initializer === node; + case 175: + case 176: + case 177: + case 178: + case 184: + case 185: + case 186: + case 203: + case 188: + case 186: + return parent.expression === node; + case 179: + var forStatement = parent; + return (forStatement.initializer === node && forStatement.initializer.kind !== 192) || + forStatement.condition === node || + forStatement.iterator === node; + case 180: + case 181: + var forInStatement = parent; + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 192) || + forInStatement.expression === node; + case 156: + return node === parent.expression; + case 171: + return node === parent.expression; + case 124: + return node === parent.expression; + default: + if (isExpression(parent)) { + return true; + } + } + } + return false; + } + ts.isExpression = isExpression; + function isInstantiatedModule(node, preserveConstEnums) { + var moduleState = ts.getModuleInstanceState(node); + return moduleState === 1 || + (preserveConstEnums && moduleState === 2); + } + ts.isInstantiatedModule = isInstantiatedModule; + function isExternalModuleImportDeclaration(node) { + return node.kind === 200 && node.moduleReference.kind === 202; + } + ts.isExternalModuleImportDeclaration = isExternalModuleImportDeclaration; + function getExternalModuleImportDeclarationExpression(node) { + ts.Debug.assert(isExternalModuleImportDeclaration(node)); + return node.moduleReference.expression; + } + ts.getExternalModuleImportDeclarationExpression = getExternalModuleImportDeclarationExpression; + function isInternalModuleImportDeclaration(node) { + return node.kind === 200 && node.moduleReference.kind !== 202; + } + ts.isInternalModuleImportDeclaration = isInternalModuleImportDeclaration; + function hasDotDotDotToken(node) { + return node && node.kind === 126 && node.dotDotDotToken !== undefined; + } + ts.hasDotDotDotToken = hasDotDotDotToken; + function hasQuestionToken(node) { + if (node) { + switch (node.kind) { + case 126: + return node.questionToken !== undefined; + case 130: + case 129: + return node.questionToken !== undefined; + case 208: + case 207: + case 128: + case 127: + return node.questionToken !== undefined; + } + } + return false; + } + ts.hasQuestionToken = hasQuestionToken; + function hasRestParameters(s) { + return s.parameters.length > 0 && s.parameters[s.parameters.length - 1].dotDotDotToken !== undefined; + } + ts.hasRestParameters = hasRestParameters; + function isLiteralKind(kind) { + return 7 <= kind && kind <= 10; + } + ts.isLiteralKind = isLiteralKind; + function isTextualLiteralKind(kind) { + return kind === 8 || kind === 10; + } + ts.isTextualLiteralKind = isTextualLiteralKind; + function isTemplateLiteralKind(kind) { + return 10 <= kind && kind <= 13; + } + ts.isTemplateLiteralKind = isTemplateLiteralKind; + function isBindingPattern(node) { + return node.kind === 147 || node.kind === 146; + } + ts.isBindingPattern = isBindingPattern; + function isInAmbientContext(node) { + while (node) { + if (node.flags & (2 | 1024)) { + return true; + } + node = node.parent; + } + return false; + } + ts.isInAmbientContext = isInAmbientContext; + function isDeclaration(node) { + switch (node.kind) { + case 125: + case 126: + case 191: + case 148: + case 128: + case 127: + case 207: + case 208: + case 209: + case 130: + case 129: + case 193: + case 132: + case 133: + case 131: + case 194: + case 195: + case 196: + case 197: + case 198: + case 200: + return true; + } + return false; + } + ts.isDeclaration = isDeclaration; + function isStatement(n) { + switch (n.kind) { + case 183: + case 182: + case 190: + case 177: + case 175: + case 174: + case 180: + case 181: + case 179: + case 176: + case 187: + case 184: + case 186: + case 93: + case 189: + case 173: + case 178: + case 185: + case 201: + return true; + default: + return false; + } + } + ts.isStatement = isStatement; + function isDeclarationOrFunctionExpressionOrCatchVariableName(name) { + if (name.kind !== 64 && name.kind !== 8 && name.kind !== 7) { + return false; + } + var parent = name.parent; + if (isDeclaration(parent) || parent.kind === 158) { + return parent.name === name; + } + if (parent.kind === 206) { + return parent.name === name; + } + return false; + } + ts.isDeclarationOrFunctionExpressionOrCatchVariableName = isDeclarationOrFunctionExpressionOrCatchVariableName; + function getClassBaseTypeNode(node) { + var heritageClause = getHeritageClause(node.heritageClauses, 78); + return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined; + } + ts.getClassBaseTypeNode = getClassBaseTypeNode; + function getClassImplementedTypeNodes(node) { + var heritageClause = getHeritageClause(node.heritageClauses, 101); + return heritageClause ? heritageClause.types : undefined; + } + ts.getClassImplementedTypeNodes = getClassImplementedTypeNodes; + function getInterfaceBaseTypeNodes(node) { + var heritageClause = getHeritageClause(node.heritageClauses, 78); + return heritageClause ? heritageClause.types : undefined; + } + ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes; + function getHeritageClause(clauses, kind) { + if (clauses) { + for (var i = 0, n = clauses.length; i < n; i++) { + if (clauses[i].token === kind) { + return clauses[i]; + } + } + } + return undefined; + } + ts.getHeritageClause = getHeritageClause; + function tryResolveScriptReference(host, sourceFile, reference) { + if (!host.getCompilerOptions().noResolve) { + var referenceFileName = ts.isRootedDiskPath(reference.fileName) ? reference.fileName : ts.combinePaths(ts.getDirectoryPath(sourceFile.fileName), reference.fileName); + referenceFileName = ts.getNormalizedAbsolutePath(referenceFileName, host.getCurrentDirectory()); + return host.getSourceFile(referenceFileName); + } + } + ts.tryResolveScriptReference = tryResolveScriptReference; + function getAncestor(node, kind) { + switch (kind) { + case 194: + while (node) { + switch (node.kind) { + case 194: + return node; + case 197: + case 195: + case 196: + case 198: + case 200: + return undefined; + default: + node = node.parent; + continue; + } + } + break; + default: + while (node) { + if (node.kind === kind) { + return node; + } + node = node.parent; + } + break; + } + return undefined; + } + ts.getAncestor = getAncestor; + function getFileReferenceFromReferencePath(comment, commentRange) { + var simpleReferenceRegEx = /^\/\/\/\s*/gim; + if (simpleReferenceRegEx.exec(comment)) { + if (isNoDefaultLibRegEx.exec(comment)) { + return { + isNoDefaultLib: true + }; + } + else { + var matchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); + if (matchResult) { + var start = commentRange.pos; + var end = commentRange.end; + return { + fileReference: { + pos: start, + end: end, + fileName: matchResult[3] + }, + isNoDefaultLib: false + }; + } + else { + return { + diagnosticMessage: ts.Diagnostics.Invalid_reference_directive_syntax, + isNoDefaultLib: false + }; + } + } + } + return undefined; + } + ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; + function isKeyword(token) { + return 65 <= token && token <= 122; + } + ts.isKeyword = isKeyword; + function isTrivia(token) { + return 2 <= token && token <= 6; + } + ts.isTrivia = isTrivia; + function hasDynamicName(declaration) { + return declaration.name && + declaration.name.kind === 124 && + !isWellKnownSymbolSyntactically(declaration.name.expression); + } + ts.hasDynamicName = hasDynamicName; + function isWellKnownSymbolSyntactically(node) { + return node.kind === 151 && isESSymbolIdentifier(node.expression); + } + ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; + function getPropertyNameForPropertyNameNode(name) { + if (name.kind === 64 || name.kind === 8 || name.kind === 7) { + return name.text; + } + if (name.kind === 124) { + var nameExpression = name.expression; + if (isWellKnownSymbolSyntactically(nameExpression)) { + var rightHandSideName = nameExpression.name.text; + return getPropertyNameForKnownSymbolName(rightHandSideName); + } + } + return undefined; + } + ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode; + function getPropertyNameForKnownSymbolName(symbolName) { + return "__@" + symbolName; + } + ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName; + function isESSymbolIdentifier(node) { + return node.kind === 64 && node.text === "Symbol"; + } + ts.isESSymbolIdentifier = isESSymbolIdentifier; + function isModifier(token) { + switch (token) { + case 107: + case 105: + case 106: + case 108: + case 77: + case 113: + case 69: + return true; + } + return false; + } + ts.isModifier = isModifier; + function textSpanEnd(span) { + return span.start + span.length; + } + ts.textSpanEnd = textSpanEnd; + function textSpanIsEmpty(span) { + return span.length === 0; + } + ts.textSpanIsEmpty = textSpanIsEmpty; + function textSpanContainsPosition(span, position) { + return position >= span.start && position < textSpanEnd(span); + } + ts.textSpanContainsPosition = textSpanContainsPosition; + function textSpanContainsTextSpan(span, other) { + return other.start >= span.start && textSpanEnd(other) <= textSpanEnd(span); + } + ts.textSpanContainsTextSpan = textSpanContainsTextSpan; + function textSpanOverlapsWith(span, other) { + var overlapStart = Math.max(span.start, other.start); + var overlapEnd = Math.min(textSpanEnd(span), textSpanEnd(other)); + return overlapStart < overlapEnd; + } + ts.textSpanOverlapsWith = textSpanOverlapsWith; + function textSpanOverlap(span1, span2) { + var overlapStart = Math.max(span1.start, span2.start); + var overlapEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2)); + if (overlapStart < overlapEnd) { + return createTextSpanFromBounds(overlapStart, overlapEnd); + } + return undefined; + } + ts.textSpanOverlap = textSpanOverlap; + function textSpanIntersectsWithTextSpan(span, other) { + return other.start <= textSpanEnd(span) && textSpanEnd(other) >= span.start; + } + ts.textSpanIntersectsWithTextSpan = textSpanIntersectsWithTextSpan; + function textSpanIntersectsWith(span, start, length) { + var end = start + length; + return start <= textSpanEnd(span) && end >= span.start; + } + ts.textSpanIntersectsWith = textSpanIntersectsWith; + function textSpanIntersectsWithPosition(span, position) { + return position <= textSpanEnd(span) && position >= span.start; + } + ts.textSpanIntersectsWithPosition = textSpanIntersectsWithPosition; + function textSpanIntersection(span1, span2) { + var intersectStart = Math.max(span1.start, span2.start); + var intersectEnd = Math.min(textSpanEnd(span1), textSpanEnd(span2)); + if (intersectStart <= intersectEnd) { + return createTextSpanFromBounds(intersectStart, intersectEnd); + } + return undefined; + } + ts.textSpanIntersection = textSpanIntersection; + function createTextSpan(start, length) { + if (start < 0) { + throw new Error("start < 0"); + } + if (length < 0) { + throw new Error("length < 0"); + } + return { start: start, length: length }; + } + ts.createTextSpan = createTextSpan; + function createTextSpanFromBounds(start, end) { + return createTextSpan(start, end - start); + } + ts.createTextSpanFromBounds = createTextSpanFromBounds; + function textChangeRangeNewSpan(range) { + return createTextSpan(range.span.start, range.newLength); + } + ts.textChangeRangeNewSpan = textChangeRangeNewSpan; + function textChangeRangeIsUnchanged(range) { + return textSpanIsEmpty(range.span) && range.newLength === 0; + } + ts.textChangeRangeIsUnchanged = textChangeRangeIsUnchanged; + function createTextChangeRange(span, newLength) { + if (newLength < 0) { + throw new Error("newLength < 0"); + } + return { span: span, newLength: newLength }; + } + ts.createTextChangeRange = createTextChangeRange; + ts.unchangedTextChangeRange = createTextChangeRange(createTextSpan(0, 0), 0); + function collapseTextChangeRangesAcrossMultipleVersions(changes) { + if (changes.length === 0) { + return ts.unchangedTextChangeRange; + } + if (changes.length === 1) { + return changes[0]; + } + var change0 = changes[0]; + var oldStartN = change0.span.start; + var oldEndN = textSpanEnd(change0.span); + var newEndN = oldStartN + change0.newLength; + for (var i = 1; i < changes.length; i++) { + var nextChange = changes[i]; + var oldStart1 = oldStartN; + var oldEnd1 = oldEndN; + var newEnd1 = newEndN; + var oldStart2 = nextChange.span.start; + var oldEnd2 = textSpanEnd(nextChange.span); + var newEnd2 = oldStart2 + nextChange.newLength; + oldStartN = Math.min(oldStart1, oldStart2); + oldEndN = Math.max(oldEnd1, oldEnd1 + (oldEnd2 - newEnd1)); + newEndN = Math.max(newEnd2, newEnd2 + (newEnd1 - oldEnd2)); + } + return createTextChangeRange(createTextSpanFromBounds(oldStartN, oldEndN), newEndN - oldStartN); + } + ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; + function createDiagnosticCollection() { + var nonFileDiagnostics = []; + var fileDiagnostics = {}; + var diagnosticsModified = false; + var modificationCount = 0; + return { + add: add, + getGlobalDiagnostics: getGlobalDiagnostics, + getDiagnostics: getDiagnostics, + getModificationCount: getModificationCount + }; + function getModificationCount() { + return modificationCount; + } + function add(diagnostic) { + var diagnostics; + if (diagnostic.file) { + diagnostics = fileDiagnostics[diagnostic.file.fileName]; + if (!diagnostics) { + diagnostics = []; + fileDiagnostics[diagnostic.file.fileName] = diagnostics; + } + } + else { + diagnostics = nonFileDiagnostics; + } + diagnostics.push(diagnostic); + diagnosticsModified = true; + modificationCount++; + } + function getGlobalDiagnostics() { + sortAndDeduplicate(); + return nonFileDiagnostics; + } + function getDiagnostics(fileName) { + sortAndDeduplicate(); + if (fileName) { + return fileDiagnostics[fileName] || []; + } + var allDiagnostics = []; + function pushDiagnostic(d) { + allDiagnostics.push(d); + } + ts.forEach(nonFileDiagnostics, pushDiagnostic); + for (var key in fileDiagnostics) { + if (ts.hasProperty(fileDiagnostics, key)) { + ts.forEach(fileDiagnostics[key], pushDiagnostic); + } + } + return ts.sortAndDeduplicateDiagnostics(allDiagnostics); + } + function sortAndDeduplicate() { + if (!diagnosticsModified) { + return; + } + diagnosticsModified = false; + nonFileDiagnostics = ts.sortAndDeduplicateDiagnostics(nonFileDiagnostics); + for (var key in fileDiagnostics) { + if (ts.hasProperty(fileDiagnostics, key)) { + fileDiagnostics[key] = ts.sortAndDeduplicateDiagnostics(fileDiagnostics[key]); + } + } + } + } + ts.createDiagnosticCollection = createDiagnosticCollection; +})(ts || (ts = {})); +var ts; +(function (ts) { + var nodeConstructors = new Array(212); + ts.parseTime = 0; + function getNodeConstructor(kind) { + return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); + } + ts.getNodeConstructor = getNodeConstructor; + function createNode(kind) { + return new (getNodeConstructor(kind))(); + } + ts.createNode = createNode; + function visitNode(cbNode, node) { + if (node) { + return cbNode(node); + } + } + function visitNodeArray(cbNodes, nodes) { + if (nodes) { + return cbNodes(nodes); + } + } + function visitEachNode(cbNode, nodes) { + if (nodes) { + for (var i = 0, len = nodes.length; i < len; i++) { + var result = cbNode(nodes[i]); + if (result) { + return result; + } + } + } + } + function forEachChild(node, cbNode, cbNodeArray) { + if (!node) { + return; + } + var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; + var cbNodes = cbNodeArray || cbNode; + switch (node.kind) { + case 123: + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + case 125: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.expression); + case 126: + case 128: + case 127: + case 207: + case 208: + case 191: + case 148: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + case 138: + case 139: + case 134: + case 135: + case 136: + return visitNodes(cbNodes, node.modifiers) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type); + case 130: + case 129: + case 131: + case 132: + case 133: + case 158: + case 193: + case 159: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + case 137: + return visitNode(cbNode, node.typeName) || + visitNodes(cbNodes, node.typeArguments); + case 140: + return visitNode(cbNode, node.exprName); + case 141: + return visitNodes(cbNodes, node.members); + case 142: + return visitNode(cbNode, node.elementType); + case 143: + return visitNodes(cbNodes, node.elementTypes); + case 144: + return visitNodes(cbNodes, node.types); + case 145: + return visitNode(cbNode, node.type); + case 146: + case 147: + return visitNodes(cbNodes, node.elements); + case 149: + return visitNodes(cbNodes, node.elements); + case 150: + return visitNodes(cbNodes, node.properties); + case 151: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.name); + case 152: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.argumentExpression); + case 153: + case 154: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.typeArguments) || + visitNodes(cbNodes, node.arguments); + case 155: + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.template); + case 156: + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + case 157: + return visitNode(cbNode, node.expression); + case 160: + return visitNode(cbNode, node.expression); + case 161: + return visitNode(cbNode, node.expression); + case 162: + return visitNode(cbNode, node.expression); + case 163: + return visitNode(cbNode, node.operand); + case 168: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + case 164: + return visitNode(cbNode, node.operand); + case 165: + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + case 166: + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.whenFalse); + case 169: + return visitNode(cbNode, node.expression); + case 172: + case 199: + return visitNodes(cbNodes, node.statements); + case 210: + return visitNodes(cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + case 173: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + case 192: + return visitNodes(cbNodes, node.declarations); + case 175: + return visitNode(cbNode, node.expression); + case 176: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + case 177: + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + case 178: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 179: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.iterator) || + visitNode(cbNode, node.statement); + case 180: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 181: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 182: + case 183: + return visitNode(cbNode, node.label); + case 184: + return visitNode(cbNode, node.expression); + case 185: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 186: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.clauses); + case 203: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.statements); + case 204: + return visitNodes(cbNodes, node.statements); + case 187: + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + case 188: + return visitNode(cbNode, node.expression); + case 189: + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + case 206: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.block); + case 194: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 195: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 196: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); + case 197: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 209: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 198: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + case 200: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + case 201: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.exportName); + case 167: + return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); + case 171: + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); + case 124: + return visitNode(cbNode, node.expression); + case 205: + return visitNodes(cbNodes, node.types); + case 202: + return visitNode(cbNode, node.expression); + } + } + ts.forEachChild = forEachChild; + var ParsingContext; + (function (ParsingContext) { + ParsingContext[ParsingContext["SourceElements"] = 0] = "SourceElements"; + ParsingContext[ParsingContext["ModuleElements"] = 1] = "ModuleElements"; + ParsingContext[ParsingContext["BlockStatements"] = 2] = "BlockStatements"; + ParsingContext[ParsingContext["SwitchClauses"] = 3] = "SwitchClauses"; + ParsingContext[ParsingContext["SwitchClauseStatements"] = 4] = "SwitchClauseStatements"; + ParsingContext[ParsingContext["TypeMembers"] = 5] = "TypeMembers"; + ParsingContext[ParsingContext["ClassMembers"] = 6] = "ClassMembers"; + ParsingContext[ParsingContext["EnumMembers"] = 7] = "EnumMembers"; + ParsingContext[ParsingContext["TypeReferences"] = 8] = "TypeReferences"; + ParsingContext[ParsingContext["VariableDeclarations"] = 9] = "VariableDeclarations"; + ParsingContext[ParsingContext["ObjectBindingElements"] = 10] = "ObjectBindingElements"; + ParsingContext[ParsingContext["ArrayBindingElements"] = 11] = "ArrayBindingElements"; + ParsingContext[ParsingContext["ArgumentExpressions"] = 12] = "ArgumentExpressions"; + ParsingContext[ParsingContext["ObjectLiteralMembers"] = 13] = "ObjectLiteralMembers"; + ParsingContext[ParsingContext["ArrayLiteralMembers"] = 14] = "ArrayLiteralMembers"; + ParsingContext[ParsingContext["Parameters"] = 15] = "Parameters"; + ParsingContext[ParsingContext["TypeParameters"] = 16] = "TypeParameters"; + ParsingContext[ParsingContext["TypeArguments"] = 17] = "TypeArguments"; + ParsingContext[ParsingContext["TupleElementTypes"] = 18] = "TupleElementTypes"; + ParsingContext[ParsingContext["HeritageClauses"] = 19] = "HeritageClauses"; + ParsingContext[ParsingContext["Count"] = 20] = "Count"; + })(ParsingContext || (ParsingContext = {})); + var Tristate; + (function (Tristate) { + Tristate[Tristate["False"] = 0] = "False"; + Tristate[Tristate["True"] = 1] = "True"; + Tristate[Tristate["Unknown"] = 2] = "Unknown"; + })(Tristate || (Tristate = {})); + function parsingContextErrors(context) { + switch (context) { + case 0: return ts.Diagnostics.Declaration_or_statement_expected; + case 1: return ts.Diagnostics.Declaration_or_statement_expected; + case 2: return ts.Diagnostics.Statement_expected; + case 3: return ts.Diagnostics.case_or_default_expected; + case 4: return ts.Diagnostics.Statement_expected; + case 5: return ts.Diagnostics.Property_or_signature_expected; + case 6: return ts.Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; + case 7: return ts.Diagnostics.Enum_member_expected; + case 8: return ts.Diagnostics.Type_reference_expected; + case 9: return ts.Diagnostics.Variable_declaration_expected; + case 10: return ts.Diagnostics.Property_destructuring_pattern_expected; + case 11: return ts.Diagnostics.Array_element_destructuring_pattern_expected; + case 12: return ts.Diagnostics.Argument_expression_expected; + case 13: return ts.Diagnostics.Property_assignment_expected; + case 14: return ts.Diagnostics.Expression_or_comma_expected; + case 15: return ts.Diagnostics.Parameter_declaration_expected; + case 16: return ts.Diagnostics.Type_parameter_declaration_expected; + case 17: return ts.Diagnostics.Type_argument_expected; + case 18: return ts.Diagnostics.Type_expected; + case 19: return ts.Diagnostics.Unexpected_token_expected; + } + } + ; + function modifierToFlag(token) { + switch (token) { + case 108: return 128; + case 107: return 16; + case 106: return 64; + case 105: return 32; + case 77: return 1; + case 113: return 2; + case 69: return 4096; + } + return 0; + } + ts.modifierToFlag = modifierToFlag; + function fixupParentReferences(sourceFile) { + var parent = sourceFile; + forEachChild(sourceFile, visitNode); + return; + function visitNode(n) { + if (n.parent !== parent) { + n.parent = parent; + var saveParent = parent; + parent = n; + forEachChild(n, visitNode); + parent = saveParent; + } + } + } + function shouldCheckNode(node) { + switch (node.kind) { + case 8: + case 7: + case 64: + return true; + } + return false; + } + function moveElementEntirelyPastChangeRange(element, isArray, delta, oldText, newText, aggressiveChecks) { + if (isArray) { + visitArray(element); + } + else { + visitNode(element); + } + return; + function visitNode(node) { + if (aggressiveChecks && shouldCheckNode(node)) { + var text = oldText.substring(node.pos, node.end); + } + node._children = undefined; + node.pos += delta; + node.end += delta; + if (aggressiveChecks && shouldCheckNode(node)) { + ts.Debug.assert(text === newText.substring(node.pos, node.end)); + } + forEachChild(node, visitNode, visitArray); + checkNodePositions(node, aggressiveChecks); + } + function visitArray(array) { + array._children = undefined; + array.pos += delta; + array.end += delta; + for (var i = 0, n = array.length; i < n; i++) { + visitNode(array[i]); + } + } + } + function adjustIntersectingElement(element, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta) { + ts.Debug.assert(element.end >= changeStart, "Adjusting an element that was entirely before the change range"); + ts.Debug.assert(element.pos <= changeRangeOldEnd, "Adjusting an element that was entirely after the change range"); + ts.Debug.assert(element.pos <= element.end); + element.pos = Math.min(element.pos, changeRangeNewEnd); + if (element.end >= changeRangeOldEnd) { + element.end += delta; + } + else { + element.end = Math.min(element.end, changeRangeNewEnd); + } + ts.Debug.assert(element.pos <= element.end); + if (element.parent) { + ts.Debug.assert(element.pos >= element.parent.pos); + ts.Debug.assert(element.end <= element.parent.end); + } + } + function checkNodePositions(node, aggressiveChecks) { + if (aggressiveChecks) { + var pos = node.pos; + forEachChild(node, function (child) { + ts.Debug.assert(child.pos >= pos); + pos = child.end; + }); + ts.Debug.assert(pos <= node.end); + } + } + function updateTokenPositionsAndMarkElements(sourceFile, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta, oldText, newText, aggressiveChecks) { + visitNode(sourceFile); + return; + function visitNode(child) { + ts.Debug.assert(child.pos <= child.end); + if (child.pos > changeRangeOldEnd) { + moveElementEntirelyPastChangeRange(child, false, delta, oldText, newText, aggressiveChecks); + return; + } + var fullEnd = child.end; + if (fullEnd >= changeStart) { + child.intersectsChange = true; + child._children = undefined; + adjustIntersectingElement(child, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); + forEachChild(child, visitNode, visitArray); + checkNodePositions(child, aggressiveChecks); + return; + } + ts.Debug.assert(fullEnd < changeStart); + } + function visitArray(array) { + ts.Debug.assert(array.pos <= array.end); + if (array.pos > changeRangeOldEnd) { + moveElementEntirelyPastChangeRange(array, true, delta, oldText, newText, aggressiveChecks); + return; + } + var fullEnd = array.end; + if (fullEnd >= changeStart) { + array.intersectsChange = true; + array._children = undefined; + adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); + for (var i = 0, n = array.length; i < n; i++) { + visitNode(array[i]); + } + return; + } + ts.Debug.assert(fullEnd < changeStart); + } + } + function extendToAffectedRange(sourceFile, changeRange) { + var maxLookahead = 1; + var start = changeRange.span.start; + for (var i = 0; start > 0 && i <= maxLookahead; i++) { + var nearestNode = findNearestNodeStartingBeforeOrAtPosition(sourceFile, start); + ts.Debug.assert(nearestNode.pos <= start); + var position = nearestNode.pos; + start = Math.max(0, position - 1); + } + var finalSpan = ts.createTextSpanFromBounds(start, ts.textSpanEnd(changeRange.span)); + var finalLength = changeRange.newLength + (changeRange.span.start - start); + return ts.createTextChangeRange(finalSpan, finalLength); + } + function findNearestNodeStartingBeforeOrAtPosition(sourceFile, position) { + var bestResult = sourceFile; + var lastNodeEntirelyBeforePosition; + forEachChild(sourceFile, visit); + if (lastNodeEntirelyBeforePosition) { + var lastChildOfLastEntireNodeBeforePosition = getLastChild(lastNodeEntirelyBeforePosition); + if (lastChildOfLastEntireNodeBeforePosition.pos > bestResult.pos) { + bestResult = lastChildOfLastEntireNodeBeforePosition; + } + } + return bestResult; + function getLastChild(node) { + while (true) { + var lastChild = getLastChildWorker(node); + if (lastChild) { + node = lastChild; + } + else { + return node; + } + } + } + function getLastChildWorker(node) { + var last = undefined; + forEachChild(node, function (child) { + if (ts.nodeIsPresent(child)) { + last = child; + } + }); + return last; + } + function visit(child) { + if (ts.nodeIsMissing(child)) { + return; + } + if (child.pos <= position) { + if (child.pos >= bestResult.pos) { + bestResult = child; + } + if (position < child.end) { + forEachChild(child, visit); + return true; + } + else { + ts.Debug.assert(child.end <= position); + lastNodeEntirelyBeforePosition = child; + } + } + else { + ts.Debug.assert(child.pos > position); + return true; + } + } + } + function checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks) { + var oldText = sourceFile.text; + if (textChangeRange) { + ts.Debug.assert((oldText.length - textChangeRange.span.length + textChangeRange.newLength) === newText.length); + if (aggressiveChecks || ts.Debug.shouldAssert(3)) { + var oldTextPrefix = oldText.substr(0, textChangeRange.span.start); + var newTextPrefix = newText.substr(0, textChangeRange.span.start); + ts.Debug.assert(oldTextPrefix === newTextPrefix); + var oldTextSuffix = oldText.substring(ts.textSpanEnd(textChangeRange.span), oldText.length); + var newTextSuffix = newText.substring(ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange)), newText.length); + ts.Debug.assert(oldTextSuffix === newTextSuffix); + } + } + } + function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { + aggressiveChecks = aggressiveChecks || ts.Debug.shouldAssert(2); + checkChangeRange(sourceFile, newText, textChangeRange, aggressiveChecks); + if (ts.textChangeRangeIsUnchanged(textChangeRange)) { + return sourceFile; + } + if (sourceFile.statements.length === 0) { + return parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, undefined, true); + } + var incrementalSourceFile = sourceFile; + ts.Debug.assert(!incrementalSourceFile.hasBeenIncrementallyParsed); + incrementalSourceFile.hasBeenIncrementallyParsed = true; + var oldText = sourceFile.text; + var syntaxCursor = createSyntaxCursor(sourceFile); + var changeRange = extendToAffectedRange(sourceFile, textChangeRange); + checkChangeRange(sourceFile, newText, changeRange, aggressiveChecks); + ts.Debug.assert(changeRange.span.start <= textChangeRange.span.start); + ts.Debug.assert(ts.textSpanEnd(changeRange.span) === ts.textSpanEnd(textChangeRange.span)); + ts.Debug.assert(ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)) === ts.textSpanEnd(ts.textChangeRangeNewSpan(textChangeRange))); + var delta = ts.textChangeRangeNewSpan(changeRange).length - changeRange.span.length; + updateTokenPositionsAndMarkElements(incrementalSourceFile, changeRange.span.start, ts.textSpanEnd(changeRange.span), ts.textSpanEnd(ts.textChangeRangeNewSpan(changeRange)), delta, oldText, newText, aggressiveChecks); + var result = parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, true); + return result; + } + ts.updateSourceFile = updateSourceFile; + function isEvalOrArgumentsIdentifier(node) { + return node.kind === 64 && + (node.text === "eval" || node.text === "arguments"); + } + ts.isEvalOrArgumentsIdentifier = isEvalOrArgumentsIdentifier; + function isUseStrictPrologueDirective(sourceFile, node) { + ts.Debug.assert(ts.isPrologueDirective(node)); + var nodeText = ts.getSourceTextOfNodeFromSourceFile(sourceFile, node.expression); + return nodeText === '"use strict"' || nodeText === "'use strict'"; + } + var InvalidPosition; + (function (InvalidPosition) { + InvalidPosition[InvalidPosition["Value"] = -1] = "Value"; + })(InvalidPosition || (InvalidPosition = {})); + function createSyntaxCursor(sourceFile) { + var currentArray = sourceFile.statements; + var currentArrayIndex = 0; + ts.Debug.assert(currentArrayIndex < currentArray.length); + var current = currentArray[currentArrayIndex]; + var lastQueriedPosition = -1; + return { + currentNode: function (position) { + if (position !== lastQueriedPosition) { + if (current && current.end === position && currentArrayIndex < (currentArray.length - 1)) { + currentArrayIndex++; + current = currentArray[currentArrayIndex]; + } + if (!current || current.pos !== position) { + findHighestListElementThatStartsAtPosition(position); + } + } + lastQueriedPosition = position; + ts.Debug.assert(!current || current.pos === position); + return current; + } + }; + function findHighestListElementThatStartsAtPosition(position) { + currentArray = undefined; + currentArrayIndex = -1; + current = undefined; + forEachChild(sourceFile, visitNode, visitArray); + return; + function visitNode(node) { + if (position >= node.pos && position < node.end) { + forEachChild(node, visitNode, visitArray); + return true; + } + return false; + } + function visitArray(array) { + if (position >= array.pos && position < array.end) { + for (var i = 0, n = array.length; i < n; i++) { + var child = array[i]; + if (child) { + if (child.pos === position) { + currentArray = array; + currentArrayIndex = i; + current = child; + return true; + } + else { + if (child.pos < position && position < child.end) { + forEachChild(child, visitNode, visitArray); + return true; + } + } + } + } + } + return false; + } + } + } + function createSourceFile(fileName, sourceText, languageVersion, setParentNodes) { + if (setParentNodes === void 0) { setParentNodes = false; } + var start = new Date().getTime(); + var result = parseSourceFile(fileName, sourceText, languageVersion, undefined, setParentNodes); + ts.parseTime += new Date().getTime() - start; + return result; + } + ts.createSourceFile = createSourceFile; + function parseSourceFile(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes) { + if (setParentNodes === void 0) { setParentNodes = false; } + var parsingContext = 0; + var identifiers = {}; + var identifierCount = 0; + var nodeCount = 0; + var token; + var sourceFile = createNode(210, 0); + sourceFile.pos = 0; + sourceFile.end = sourceText.length; + sourceFile.text = sourceText; + sourceFile.parseDiagnostics = []; + sourceFile.bindDiagnostics = []; + sourceFile.languageVersion = languageVersion; + sourceFile.fileName = ts.normalizePath(fileName); + sourceFile.flags = ts.fileExtensionIs(sourceFile.fileName, ".d.ts") ? 1024 : 0; + var contextFlags = 0; + var parseErrorBeforeNextFinishedNode = false; + var scanner = ts.createScanner(languageVersion, true, sourceText, scanError); + token = nextToken(); + processReferenceComments(sourceFile); + sourceFile.statements = parseList(0, true, parseSourceElement); + ts.Debug.assert(token === 1); + sourceFile.endOfFileToken = parseTokenNode(); + setExternalModuleIndicator(sourceFile); + sourceFile.nodeCount = nodeCount; + sourceFile.identifierCount = identifierCount; + sourceFile.identifiers = identifiers; + if (setParentNodes) { + fixupParentReferences(sourceFile); + } + syntaxCursor = undefined; + return sourceFile; + function setContextFlag(val, flag) { + if (val) { + contextFlags |= flag; + } + else { + contextFlags &= ~flag; + } + } + function setStrictModeContext(val) { + setContextFlag(val, 1); + } + function setDisallowInContext(val) { + setContextFlag(val, 2); + } + function setYieldContext(val) { + setContextFlag(val, 4); + } + function setGeneratorParameterContext(val) { + setContextFlag(val, 8); + } + function allowInAnd(func) { + if (contextFlags & 2) { + setDisallowInContext(false); + var result = func(); + setDisallowInContext(true); + return result; + } + return func(); + } + function disallowInAnd(func) { + if (contextFlags & 2) { + return func(); + } + setDisallowInContext(true); + var result = func(); + setDisallowInContext(false); + return result; + } + function doInYieldContext(func) { + if (contextFlags & 4) { + return func(); + } + setYieldContext(true); + var result = func(); + setYieldContext(false); + return result; + } + function doOutsideOfYieldContext(func) { + if (contextFlags & 4) { + setYieldContext(false); + var result = func(); + setYieldContext(true); + return result; + } + return func(); + } + function inYieldContext() { + return (contextFlags & 4) !== 0; + } + function inStrictModeContext() { + return (contextFlags & 1) !== 0; + } + function inGeneratorParameterContext() { + return (contextFlags & 8) !== 0; + } + function inDisallowInContext() { + return (contextFlags & 2) !== 0; + } + function parseErrorAtCurrentToken(message, arg0) { + var start = scanner.getTokenPos(); + var length = scanner.getTextPos() - start; + parseErrorAtPosition(start, length, message, arg0); + } + function parseErrorAtPosition(start, length, message, arg0) { + var lastError = ts.lastOrUndefined(sourceFile.parseDiagnostics); + if (!lastError || start !== lastError.start) { + sourceFile.parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, start, length, message, arg0)); + } + parseErrorBeforeNextFinishedNode = true; + } + function scanError(message, length) { + var pos = scanner.getTextPos(); + parseErrorAtPosition(pos, length || 0, message); + } + function getNodePos() { + return scanner.getStartPos(); + } + function getNodeEnd() { + return scanner.getStartPos(); + } + function nextToken() { + return token = scanner.scan(); + } + function getTokenPos(pos) { + return ts.skipTrivia(sourceText, pos); + } + function reScanGreaterToken() { + return token = scanner.reScanGreaterToken(); + } + function reScanSlashToken() { + return token = scanner.reScanSlashToken(); + } + function reScanTemplateToken() { + return token = scanner.reScanTemplateToken(); + } + function speculationHelper(callback, isLookAhead) { + var saveToken = token; + var saveParseDiagnosticsLength = sourceFile.parseDiagnostics.length; + var saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode; + var saveContextFlags = contextFlags; + var result = isLookAhead ? scanner.lookAhead(callback) : scanner.tryScan(callback); + ts.Debug.assert(saveContextFlags === contextFlags); + if (!result || isLookAhead) { + token = saveToken; + sourceFile.parseDiagnostics.length = saveParseDiagnosticsLength; + parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode; + } + return result; + } + function lookAhead(callback) { + return speculationHelper(callback, true); + } + function tryParse(callback) { + return speculationHelper(callback, false); + } + function isIdentifier() { + if (token === 64) { + return true; + } + if (token === 109 && inYieldContext()) { + return false; + } + return inStrictModeContext() ? token > 109 : token > 100; + } + function parseExpected(kind, diagnosticMessage) { + if (token === kind) { + nextToken(); + return true; + } + if (diagnosticMessage) { + parseErrorAtCurrentToken(diagnosticMessage); + } + else { + parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind)); + } + return false; + } + function parseOptional(t) { + if (token === t) { + nextToken(); + return true; + } + return false; + } + function parseOptionalToken(t) { + if (token === t) { + var node = createNode(t); + nextToken(); + return finishNode(node); + } + return undefined; + } + function parseTokenNode() { + var node = createNode(token); + nextToken(); + return finishNode(node); + } + function canParseSemicolon() { + if (token === 22) { + return true; + } + return token === 15 || token === 1 || scanner.hasPrecedingLineBreak(); + } + function parseSemicolon() { + if (canParseSemicolon()) { + if (token === 22) { + nextToken(); + } + return true; + } + else { + return parseExpected(22); + } + } + function createNode(kind, pos) { + nodeCount++; + var node = new (nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)))(); + if (!(pos >= 0)) { + pos = scanner.getStartPos(); + } + node.pos = pos; + node.end = pos; + return node; + } + function finishNode(node) { + node.end = scanner.getStartPos(); + if (contextFlags) { + node.parserContextFlags = contextFlags; + } + if (parseErrorBeforeNextFinishedNode) { + parseErrorBeforeNextFinishedNode = false; + node.parserContextFlags |= 16; + } + return node; + } + function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, arg0) { + if (reportAtCurrentPosition) { + parseErrorAtPosition(scanner.getStartPos(), 0, diagnosticMessage, arg0); + } + else { + parseErrorAtCurrentToken(diagnosticMessage, arg0); + } + var result = createNode(kind, scanner.getStartPos()); + result.text = ""; + return finishNode(result); + } + function internIdentifier(text) { + text = ts.escapeIdentifier(text); + return ts.hasProperty(identifiers, text) ? identifiers[text] : (identifiers[text] = text); + } + function createIdentifier(isIdentifier, diagnosticMessage) { + identifierCount++; + if (isIdentifier) { + var node = createNode(64); + node.text = internIdentifier(scanner.getTokenValue()); + nextToken(); + return finishNode(node); + } + return createMissingNode(64, false, diagnosticMessage || ts.Diagnostics.Identifier_expected); + } + function parseIdentifier(diagnosticMessage) { + return createIdentifier(isIdentifier(), diagnosticMessage); + } + function parseIdentifierName() { + return createIdentifier(isIdentifierOrKeyword()); + } + function isLiteralPropertyName() { + return isIdentifierOrKeyword() || + token === 8 || + token === 7; + } + function parsePropertyName() { + if (token === 8 || token === 7) { + return parseLiteralNode(true); + } + if (token === 18) { + return parseComputedPropertyName(); + } + return parseIdentifierName(); + } + function parseComputedPropertyName() { + var node = createNode(124); + parseExpected(18); + var yieldContext = inYieldContext(); + if (inGeneratorParameterContext()) { + setYieldContext(false); + } + node.expression = allowInAnd(parseExpression); + if (inGeneratorParameterContext()) { + setYieldContext(yieldContext); + } + parseExpected(19); + return finishNode(node); + } + function parseContextualModifier(t) { + return token === t && tryParse(nextTokenCanFollowModifier); + } + function nextTokenCanFollowModifier() { + nextToken(); + return canFollowModifier(); + } + function parseAnyContextualModifier() { + return ts.isModifier(token) && tryParse(nextTokenCanFollowContextualModifier); + } + function nextTokenCanFollowContextualModifier() { + if (token === 69) { + return nextToken() === 76; + } + nextToken(); + return canFollowModifier(); + } + function canFollowModifier() { + return token === 18 || token === 14 || token === 35 || isLiteralPropertyName(); + } + function isListElement(parsingContext, inErrorRecovery) { + var node = currentNode(parsingContext); + if (node) { + return true; + } + switch (parsingContext) { + case 0: + case 1: + return isSourceElement(inErrorRecovery); + case 2: + case 4: + return isStartOfStatement(inErrorRecovery); + case 3: + return token === 66 || token === 72; + case 5: + return isStartOfTypeMember(); + case 6: + return lookAhead(isClassMemberStart); + case 7: + return token === 18 || isLiteralPropertyName(); + case 13: + return token === 18 || token === 35 || isLiteralPropertyName(); + case 10: + return isLiteralPropertyName(); + case 8: + return isIdentifier() && !isNotHeritageClauseTypeName(); + case 9: + return isIdentifierOrPattern(); + case 11: + return token === 23 || token === 21 || isIdentifierOrPattern(); + case 16: + return isIdentifier(); + case 12: + case 14: + return token === 23 || token === 21 || isStartOfExpression(); + case 15: + return isStartOfParameter(); + case 17: + case 18: + return token === 23 || isStartOfType(); + case 19: + return isHeritageClause(); + } + ts.Debug.fail("Non-exhaustive case in 'isListElement'."); + } + function nextTokenIsIdentifier() { + nextToken(); + return isIdentifier(); + } + function isNotHeritageClauseTypeName() { + if (token === 101 || + token === 78) { + return lookAhead(nextTokenIsIdentifier); + } + return false; + } + function isListTerminator(kind) { + if (token === 1) { + return true; + } + switch (kind) { + case 1: + case 2: + case 3: + case 5: + case 6: + case 7: + case 13: + case 10: + return token === 15; + case 4: + return token === 15 || token === 66 || token === 72; + case 8: + return token === 14 || token === 78 || token === 101; + case 9: + return isVariableDeclaratorListTerminator(); + case 16: + return token === 25 || token === 16 || token === 14 || token === 78 || token === 101; + case 12: + return token === 17 || token === 22; + case 14: + case 18: + case 11: + return token === 19; + case 15: + return token === 17 || token === 19; + case 17: + return token === 25 || token === 16; + case 19: + return token === 14 || token === 15; + } + } + function isVariableDeclaratorListTerminator() { + if (canParseSemicolon()) { + return true; + } + if (isInOrOfKeyword(token)) { + return true; + } + if (token === 32) { + return true; + } + return false; + } + function isInSomeParsingContext() { + for (var kind = 0; kind < 20; kind++) { + if (parsingContext & (1 << kind)) { + if (isListElement(kind, true) || isListTerminator(kind)) { + return true; + } + } + } + return false; + } + function parseList(kind, checkForStrictMode, parseElement) { + var saveParsingContext = parsingContext; + parsingContext |= 1 << kind; + var result = []; + result.pos = getNodePos(); + var savedStrictModeContext = inStrictModeContext(); + while (!isListTerminator(kind)) { + if (isListElement(kind, false)) { + var element = parseListElement(kind, parseElement); + result.push(element); + if (checkForStrictMode && !inStrictModeContext()) { + if (ts.isPrologueDirective(element)) { + if (isUseStrictPrologueDirective(sourceFile, element)) { + setStrictModeContext(true); + checkForStrictMode = false; + } + } + else { + checkForStrictMode = false; + } + } + continue; + } + if (abortParsingListOrMoveToNextToken(kind)) { + break; + } + } + setStrictModeContext(savedStrictModeContext); + result.end = getNodeEnd(); + parsingContext = saveParsingContext; + return result; + } + function parseListElement(parsingContext, parseElement) { + var node = currentNode(parsingContext); + if (node) { + return consumeNode(node); + } + return parseElement(); + } + function currentNode(parsingContext) { + if (parseErrorBeforeNextFinishedNode) { + return undefined; + } + if (!syntaxCursor) { + return undefined; + } + var node = syntaxCursor.currentNode(scanner.getStartPos()); + if (ts.nodeIsMissing(node)) { + return undefined; + } + if (node.intersectsChange) { + return undefined; + } + if (ts.containsParseError(node)) { + return undefined; + } + var nodeContextFlags = node.parserContextFlags & 31; + if (nodeContextFlags !== contextFlags) { + return undefined; + } + if (!canReuseNode(node, parsingContext)) { + return undefined; + } + return node; + } + function consumeNode(node) { + scanner.setTextPos(node.end); + nextToken(); + return node; + } + function canReuseNode(node, parsingContext) { + switch (parsingContext) { + case 1: + return isReusableModuleElement(node); + case 6: + return isReusableClassMember(node); + case 3: + return isReusableSwitchClause(node); + case 2: + case 4: + return isReusableStatement(node); + case 7: + return isReusableEnumMember(node); + case 5: + return isReusableTypeMember(node); + case 9: + return isReusableVariableDeclaration(node); + case 15: + return isReusableParameter(node); + case 19: + case 8: + case 16: + case 18: + case 17: + case 12: + case 13: + } + return false; + } + function isReusableModuleElement(node) { + if (node) { + switch (node.kind) { + case 200: + case 201: + case 194: + case 195: + case 198: + case 197: + return true; + } + return isReusableStatement(node); + } + return false; + } + function isReusableClassMember(node) { + if (node) { + switch (node.kind) { + case 131: + case 136: + case 130: + case 132: + case 133: + case 128: + return true; + } + } + return false; + } + function isReusableSwitchClause(node) { + if (node) { + switch (node.kind) { + case 203: + case 204: + return true; + } + } + return false; + } + function isReusableStatement(node) { + if (node) { + switch (node.kind) { + case 193: + case 173: + case 172: + case 176: + case 175: + case 188: + case 184: + case 186: + case 183: + case 182: + case 180: + case 181: + case 179: + case 178: + case 185: + case 174: + case 189: + case 187: + case 177: + case 190: + return true; + } + } + return false; + } + function isReusableEnumMember(node) { + return node.kind === 209; + } + function isReusableTypeMember(node) { + if (node) { + switch (node.kind) { + case 135: + case 129: + case 136: + case 127: + case 134: + return true; + } + } + return false; + } + function isReusableVariableDeclaration(node) { + if (node.kind !== 191) { + return false; + } + var variableDeclarator = node; + return variableDeclarator.initializer === undefined; + } + function isReusableParameter(node) { + if (node.kind !== 126) { + return false; + } + var parameter = node; + return parameter.initializer === undefined; + } + function abortParsingListOrMoveToNextToken(kind) { + parseErrorAtCurrentToken(parsingContextErrors(kind)); + if (isInSomeParsingContext()) { + return true; + } + nextToken(); + return false; + } + function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimeter) { + var saveParsingContext = parsingContext; + parsingContext |= 1 << kind; + var result = []; + result.pos = getNodePos(); + var commaStart = -1; + while (true) { + if (isListElement(kind, false)) { + result.push(parseListElement(kind, parseElement)); + commaStart = scanner.getTokenPos(); + if (parseOptional(23)) { + continue; + } + commaStart = -1; + if (isListTerminator(kind)) { + break; + } + parseExpected(23); + if (considerSemicolonAsDelimeter && token === 22 && !scanner.hasPrecedingLineBreak()) { + nextToken(); + } + continue; + } + if (isListTerminator(kind)) { + break; + } + if (abortParsingListOrMoveToNextToken(kind)) { + break; + } + } + if (commaStart >= 0) { + result.hasTrailingComma = true; + } + result.end = getNodeEnd(); + parsingContext = saveParsingContext; + return result; + } + function createMissingList() { + var pos = getNodePos(); + var result = []; + result.pos = pos; + result.end = pos; + return result; + } + function parseBracketedList(kind, parseElement, open, close) { + if (parseExpected(open)) { + var result = parseDelimitedList(kind, parseElement); + parseExpected(close); + return result; + } + return createMissingList(); + } + function parseEntityName(allowReservedWords, diagnosticMessage) { + var entity = parseIdentifier(diagnosticMessage); + while (parseOptional(20)) { + var node = createNode(123, entity.pos); + node.left = entity; + node.right = parseRightSideOfDot(allowReservedWords); + entity = finishNode(node); + } + return entity; + } + function parseRightSideOfDot(allowIdentifierNames) { + if (scanner.hasPrecedingLineBreak() && scanner.isReservedWord()) { + var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); + if (matchesPattern) { + return createMissingNode(64, true, ts.Diagnostics.Identifier_expected); + } + } + return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); + } + function parseTemplateExpression() { + var template = createNode(167); + template.head = parseLiteralNode(); + ts.Debug.assert(template.head.kind === 11, "Template head has wrong token kind"); + var templateSpans = []; + templateSpans.pos = getNodePos(); + do { + templateSpans.push(parseTemplateSpan()); + } while (templateSpans[templateSpans.length - 1].literal.kind === 12); + templateSpans.end = getNodeEnd(); + template.templateSpans = templateSpans; + return finishNode(template); + } + function parseTemplateSpan() { + var span = createNode(171); + span.expression = allowInAnd(parseExpression); + var literal; + if (token === 15) { + reScanTemplateToken(); + literal = parseLiteralNode(); + } + else { + literal = createMissingNode(13, false, ts.Diagnostics._0_expected, ts.tokenToString(15)); + } + span.literal = literal; + return finishNode(span); + } + function parseLiteralNode(internName) { + var node = createNode(token); + var text = scanner.getTokenValue(); + node.text = internName ? internIdentifier(text) : text; + if (scanner.isUnterminated()) { + node.isUnterminated = true; + } + var tokenPos = scanner.getTokenPos(); + nextToken(); + finishNode(node); + if (node.kind === 7 && sourceText.charCodeAt(tokenPos) === 48 && ts.isOctalDigit(sourceText.charCodeAt(tokenPos + 1))) { + node.flags |= 8192; + } + return node; + } + function parseTypeReference() { + var node = createNode(137); + node.typeName = parseEntityName(false, ts.Diagnostics.Type_expected); + if (!scanner.hasPrecedingLineBreak() && token === 24) { + node.typeArguments = parseBracketedList(17, parseType, 24, 25); + } + return finishNode(node); + } + function parseTypeQuery() { + var node = createNode(140); + parseExpected(96); + node.exprName = parseEntityName(true); + return finishNode(node); + } + function parseTypeParameter() { + var node = createNode(125); + node.name = parseIdentifier(); + if (parseOptional(78)) { + if (isStartOfType() || !isStartOfExpression()) { + node.constraint = parseType(); + } + else { + node.expression = parseUnaryExpressionOrHigher(); + } + } + return finishNode(node); + } + function parseTypeParameters() { + if (token === 24) { + return parseBracketedList(16, parseTypeParameter, 24, 25); + } + } + function parseParameterType() { + if (parseOptional(51)) { + return token === 8 ? parseLiteralNode(true) : parseType(); + } + return undefined; + } + function isStartOfParameter() { + return token === 21 || isIdentifierOrPattern() || ts.isModifier(token); + } + function setModifiers(node, modifiers) { + if (modifiers) { + node.flags |= modifiers.flags; + node.modifiers = modifiers; + } + } + function parseParameter() { + var node = createNode(126); + setModifiers(node, parseModifiers()); + node.dotDotDotToken = parseOptionalToken(21); + node.name = inGeneratorParameterContext() ? doInYieldContext(parseIdentifierOrPattern) : parseIdentifierOrPattern(); + if (ts.getFullWidth(node.name) === 0 && node.flags === 0 && ts.isModifier(token)) { + nextToken(); + } + node.questionToken = parseOptionalToken(50); + node.type = parseParameterType(); + node.initializer = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseParameterInitializer) : parseParameterInitializer(); + return finishNode(node); + } + function parseParameterInitializer() { + return parseInitializer(true); + } + function fillSignature(returnToken, yieldAndGeneratorParameterContext, requireCompleteParameterList, signature) { + var returnTokenRequired = returnToken === 32; + signature.typeParameters = parseTypeParameters(); + signature.parameters = parseParameterList(yieldAndGeneratorParameterContext, requireCompleteParameterList); + if (returnTokenRequired) { + parseExpected(returnToken); + signature.type = parseType(); + } + else if (parseOptional(returnToken)) { + signature.type = parseType(); + } + } + function parseParameterList(yieldAndGeneratorParameterContext, requireCompleteParameterList) { + if (parseExpected(16)) { + var savedYieldContext = inYieldContext(); + var savedGeneratorParameterContext = inGeneratorParameterContext(); + setYieldContext(yieldAndGeneratorParameterContext); + setGeneratorParameterContext(yieldAndGeneratorParameterContext); + var result = parseDelimitedList(15, parseParameter); + setYieldContext(savedYieldContext); + setGeneratorParameterContext(savedGeneratorParameterContext); + if (!parseExpected(17) && requireCompleteParameterList) { + return undefined; + } + return result; + } + return requireCompleteParameterList ? undefined : createMissingList(); + } + function parseTypeMemberSemicolon() { + if (parseSemicolon()) { + return; + } + parseOptional(23); + } + function parseSignatureMember(kind) { + var node = createNode(kind); + if (kind === 135) { + parseExpected(87); + } + fillSignature(51, false, false, node); + parseTypeMemberSemicolon(); + return finishNode(node); + } + function isIndexSignature() { + if (token !== 18) { + return false; + } + return lookAhead(isUnambiguouslyIndexSignature); + } + function isUnambiguouslyIndexSignature() { + nextToken(); + if (token === 21 || token === 19) { + return true; + } + if (ts.isModifier(token)) { + nextToken(); + if (isIdentifier()) { + return true; + } + } + else if (!isIdentifier()) { + return false; + } + else { + nextToken(); + } + if (token === 51 || token === 23) { + return true; + } + if (token !== 50) { + return false; + } + nextToken(); + return token === 51 || token === 23 || token === 19; + } + function parseIndexSignatureDeclaration(modifiers) { + var fullStart = modifiers ? modifiers.pos : scanner.getStartPos(); + var node = createNode(136, fullStart); + setModifiers(node, modifiers); + node.parameters = parseBracketedList(15, parseParameter, 18, 19); + node.type = parseTypeAnnotation(); + parseTypeMemberSemicolon(); + return finishNode(node); + } + function parsePropertyOrMethodSignature() { + var fullStart = scanner.getStartPos(); + var name = parsePropertyName(); + var questionToken = parseOptionalToken(50); + if (token === 16 || token === 24) { + var method = createNode(129, fullStart); + method.name = name; + method.questionToken = questionToken; + fillSignature(51, false, false, method); + parseTypeMemberSemicolon(); + return finishNode(method); + } + else { + var property = createNode(127, fullStart); + property.name = name; + property.questionToken = questionToken; + property.type = parseTypeAnnotation(); + parseTypeMemberSemicolon(); + return finishNode(property); + } + } + function isStartOfTypeMember() { + switch (token) { + case 16: + case 24: + case 18: + return true; + default: + if (ts.isModifier(token)) { + var result = lookAhead(isStartOfIndexSignatureDeclaration); + if (result) { + return result; + } + } + return isLiteralPropertyName() && lookAhead(isTypeMemberWithLiteralPropertyName); + } + } + function isStartOfIndexSignatureDeclaration() { + while (ts.isModifier(token)) { + nextToken(); + } + return isIndexSignature(); + } + function isTypeMemberWithLiteralPropertyName() { + nextToken(); + return token === 16 || + token === 24 || + token === 50 || + token === 51 || + canParseSemicolon(); + } + function parseTypeMember() { + switch (token) { + case 16: + case 24: + return parseSignatureMember(134); + case 18: + return isIndexSignature() ? parseIndexSignatureDeclaration(undefined) : parsePropertyOrMethodSignature(); + case 87: + if (lookAhead(isStartOfConstructSignature)) { + return parseSignatureMember(135); + } + case 8: + case 7: + return parsePropertyOrMethodSignature(); + default: + if (ts.isModifier(token)) { + var result = tryParse(parseIndexSignatureWithModifiers); + if (result) { + return result; + } + } + if (isIdentifierOrKeyword()) { + return parsePropertyOrMethodSignature(); + } + } + } + function parseIndexSignatureWithModifiers() { + var modifiers = parseModifiers(); + return isIndexSignature() ? parseIndexSignatureDeclaration(modifiers) : undefined; + } + function isStartOfConstructSignature() { + nextToken(); + return token === 16 || token === 24; + } + function parseTypeLiteral() { + var node = createNode(141); + node.members = parseObjectTypeMembers(); + return finishNode(node); + } + function parseObjectTypeMembers() { + var members; + if (parseExpected(14)) { + members = parseList(5, false, parseTypeMember); + parseExpected(15); + } + else { + members = createMissingList(); + } + return members; + } + function parseTupleType() { + var node = createNode(143); + node.elementTypes = parseBracketedList(18, parseType, 18, 19); + return finishNode(node); + } + function parseParenthesizedType() { + var node = createNode(145); + parseExpected(16); + node.type = parseType(); + parseExpected(17); + return finishNode(node); + } + function parseFunctionOrConstructorType(kind) { + var node = createNode(kind); + if (kind === 139) { + parseExpected(87); + } + fillSignature(32, false, false, node); + return finishNode(node); + } + function parseKeywordAndNoDot() { + var node = parseTokenNode(); + return token === 20 ? undefined : node; + } + function parseNonArrayType() { + switch (token) { + case 110: + case 119: + case 117: + case 111: + case 120: + var node = tryParse(parseKeywordAndNoDot); + return node || parseTypeReference(); + case 98: + return parseTokenNode(); + case 96: + return parseTypeQuery(); + case 14: + return parseTypeLiteral(); + case 18: + return parseTupleType(); + case 16: + return parseParenthesizedType(); + default: + return parseTypeReference(); + } + } + function isStartOfType() { + switch (token) { + case 110: + case 119: + case 117: + case 111: + case 120: + case 98: + case 96: + case 14: + case 18: + case 24: + case 87: + return true; + case 16: + return lookAhead(isStartOfParenthesizedOrFunctionType); + default: + return isIdentifier(); + } + } + function isStartOfParenthesizedOrFunctionType() { + nextToken(); + return token === 17 || isStartOfParameter() || isStartOfType(); + } + function parseArrayTypeOrHigher() { + var type = parseNonArrayType(); + while (!scanner.hasPrecedingLineBreak() && parseOptional(18)) { + parseExpected(19); + var node = createNode(142, type.pos); + node.elementType = type; + type = finishNode(node); + } + return type; + } + function parseUnionTypeOrHigher() { + var type = parseArrayTypeOrHigher(); + if (token === 44) { + var types = [type]; + types.pos = type.pos; + while (parseOptional(44)) { + types.push(parseArrayTypeOrHigher()); + } + types.end = getNodeEnd(); + var node = createNode(144, type.pos); + node.types = types; + type = finishNode(node); + } + return type; + } + function isStartOfFunctionType() { + if (token === 24) { + return true; + } + return token === 16 && lookAhead(isUnambiguouslyStartOfFunctionType); + } + function isUnambiguouslyStartOfFunctionType() { + nextToken(); + if (token === 17 || token === 21) { + return true; + } + if (isIdentifier() || ts.isModifier(token)) { + nextToken(); + if (token === 51 || token === 23 || + token === 50 || token === 52 || + isIdentifier() || ts.isModifier(token)) { + return true; + } + if (token === 17) { + nextToken(); + if (token === 32) { + return true; + } + } + } + return false; + } + function parseType() { + var savedYieldContext = inYieldContext(); + var savedGeneratorParameterContext = inGeneratorParameterContext(); + setYieldContext(false); + setGeneratorParameterContext(false); + var result = parseTypeWorker(); + setYieldContext(savedYieldContext); + setGeneratorParameterContext(savedGeneratorParameterContext); + return result; + } + function parseTypeWorker() { + if (isStartOfFunctionType()) { + return parseFunctionOrConstructorType(138); + } + if (token === 87) { + return parseFunctionOrConstructorType(139); + } + return parseUnionTypeOrHigher(); + } + function parseTypeAnnotation() { + return parseOptional(51) ? parseType() : undefined; + } + function isStartOfExpression() { + switch (token) { + case 92: + case 90: + case 88: + case 94: + case 79: + case 7: + case 8: + case 10: + case 11: + case 16: + case 18: + case 14: + case 82: + case 87: + case 36: + case 56: + case 33: + case 34: + case 47: + case 46: + case 73: + case 96: + case 98: + case 38: + case 39: + case 24: + case 64: + case 109: + return true; + default: + if (isBinaryOperator()) { + return true; + } + return isIdentifier(); + } + } + function isStartOfExpressionStatement() { + return token !== 14 && token !== 82 && isStartOfExpression(); + } + function parseExpression() { + var expr = parseAssignmentExpressionOrHigher(); + var operatorToken; + while ((operatorToken = parseOptionalToken(23))) { + expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); + } + return expr; + } + function parseInitializer(inParameter) { + if (token !== 52) { + if (scanner.hasPrecedingLineBreak() || (inParameter && token === 14) || !isStartOfExpression()) { + return undefined; + } + } + parseExpected(52); + return parseAssignmentExpressionOrHigher(); + } + function parseAssignmentExpressionOrHigher() { + if (isYieldExpression()) { + return parseYieldExpression(); + } + var arrowExpression = tryParseParenthesizedArrowFunctionExpression(); + if (arrowExpression) { + return arrowExpression; + } + var expr = parseBinaryExpressionOrHigher(0); + if (expr.kind === 64 && token === 32) { + return parseSimpleArrowFunctionExpression(expr); + } + if (isLeftHandSideExpression(expr) && isAssignmentOperator(reScanGreaterToken())) { + return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher()); + } + return parseConditionalExpressionRest(expr); + } + function isYieldExpression() { + if (token === 109) { + if (inYieldContext()) { + return true; + } + if (inStrictModeContext()) { + return true; + } + return lookAhead(nextTokenIsIdentifierOnSameLine); + } + return false; + } + function nextTokenIsIdentifierOnSameLine() { + nextToken(); + return !scanner.hasPrecedingLineBreak() && isIdentifier(); + } + function parseYieldExpression() { + var node = createNode(168); + nextToken(); + if (!scanner.hasPrecedingLineBreak() && + (token === 35 || isStartOfExpression())) { + node.asteriskToken = parseOptionalToken(35); + node.expression = parseAssignmentExpressionOrHigher(); + return finishNode(node); + } + else { + return finishNode(node); + } + } + function parseSimpleArrowFunctionExpression(identifier) { + ts.Debug.assert(token === 32, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); + var node = createNode(159, identifier.pos); + var parameter = createNode(126, identifier.pos); + parameter.name = identifier; + finishNode(parameter); + node.parameters = [parameter]; + node.parameters.pos = parameter.pos; + node.parameters.end = parameter.end; + parseExpected(32); + node.body = parseArrowFunctionExpressionBody(); + return finishNode(node); + } + function tryParseParenthesizedArrowFunctionExpression() { + var triState = isParenthesizedArrowFunctionExpression(); + if (triState === 0) { + return undefined; + } + var arrowFunction = triState === 1 ? parseParenthesizedArrowFunctionExpressionHead(true) : tryParse(parsePossibleParenthesizedArrowFunctionExpressionHead); + if (!arrowFunction) { + return undefined; + } + if (parseExpected(32) || token === 14) { + arrowFunction.body = parseArrowFunctionExpressionBody(); + } + else { + arrowFunction.body = parseIdentifier(); + } + return finishNode(arrowFunction); + } + function isParenthesizedArrowFunctionExpression() { + if (token === 16 || token === 24) { + return lookAhead(isParenthesizedArrowFunctionExpressionWorker); + } + if (token === 32) { + return 1; + } + return 0; + } + function isParenthesizedArrowFunctionExpressionWorker() { + var first = token; + var second = nextToken(); + if (first === 16) { + if (second === 17) { + var third = nextToken(); + switch (third) { + case 32: + case 51: + case 14: + return 1; + default: + return 0; + } + } + if (second === 21) { + return 1; + } + if (!isIdentifier()) { + return 0; + } + if (nextToken() === 51) { + return 1; + } + return 2; + } + else { + ts.Debug.assert(first === 24); + if (!isIdentifier()) { + return 0; + } + return 2; + } + } + function parsePossibleParenthesizedArrowFunctionExpressionHead() { + return parseParenthesizedArrowFunctionExpressionHead(false); + } + function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { + var node = createNode(159); + fillSignature(51, false, !allowAmbiguity, node); + if (!node.parameters) { + return undefined; + } + if (!allowAmbiguity && token !== 32 && token !== 14) { + return undefined; + } + return node; + } + function parseArrowFunctionExpressionBody() { + if (token === 14) { + return parseFunctionBlock(false, false); + } + if (isStartOfStatement(true) && !isStartOfExpressionStatement() && token !== 82) { + return parseFunctionBlock(false, true); + } + return parseAssignmentExpressionOrHigher(); + } + function parseConditionalExpressionRest(leftOperand) { + if (!parseOptional(50)) { + return leftOperand; + } + var node = createNode(166, leftOperand.pos); + node.condition = leftOperand; + node.whenTrue = allowInAnd(parseAssignmentExpressionOrHigher); + parseExpected(51); + node.whenFalse = parseAssignmentExpressionOrHigher(); + return finishNode(node); + } + function parseBinaryExpressionOrHigher(precedence) { + var leftOperand = parseUnaryExpressionOrHigher(); + return parseBinaryExpressionRest(precedence, leftOperand); + } + function isInOrOfKeyword(t) { + return t === 85 || t === 122; + } + function parseBinaryExpressionRest(precedence, leftOperand) { + while (true) { + reScanGreaterToken(); + var newPrecedence = getBinaryOperatorPrecedence(); + if (newPrecedence <= precedence) { + break; + } + if (token === 85 && inDisallowInContext()) { + break; + } + leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence)); + } + return leftOperand; + } + function isBinaryOperator() { + if (inDisallowInContext() && token === 85) { + return false; + } + return getBinaryOperatorPrecedence() > 0; + } + function getBinaryOperatorPrecedence() { + switch (token) { + case 49: + return 1; + case 48: + return 2; + case 44: + return 3; + case 45: + return 4; + case 43: + return 5; + case 28: + case 29: + case 30: + case 31: + return 6; + case 24: + case 25: + case 26: + case 27: + case 86: + case 85: + return 7; + case 40: + case 41: + case 42: + return 8; + case 33: + case 34: + return 9; + case 35: + case 36: + case 37: + return 10; + } + return -1; + } + function makeBinaryExpression(left, operatorToken, right) { + var node = createNode(165, left.pos); + node.left = left; + node.operatorToken = operatorToken; + node.right = right; + return finishNode(node); + } + function parsePrefixUnaryExpression() { + var node = createNode(163); + node.operator = token; + nextToken(); + node.operand = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseDeleteExpression() { + var node = createNode(160); + nextToken(); + node.expression = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseTypeOfExpression() { + var node = createNode(161); + nextToken(); + node.expression = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseVoidExpression() { + var node = createNode(162); + nextToken(); + node.expression = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseUnaryExpressionOrHigher() { + switch (token) { + case 33: + case 34: + case 47: + case 46: + case 38: + case 39: + return parsePrefixUnaryExpression(); + case 73: + return parseDeleteExpression(); + case 96: + return parseTypeOfExpression(); + case 98: + return parseVoidExpression(); + case 24: + return parseTypeAssertion(); + default: + return parsePostfixExpressionOrHigher(); + } + } + function parsePostfixExpressionOrHigher() { + var expression = parseLeftHandSideExpressionOrHigher(); + ts.Debug.assert(isLeftHandSideExpression(expression)); + if ((token === 38 || token === 39) && !scanner.hasPrecedingLineBreak()) { + var node = createNode(164, expression.pos); + node.operand = expression; + node.operator = token; + nextToken(); + return finishNode(node); + } + return expression; + } + function parseLeftHandSideExpressionOrHigher() { + var expression = token === 90 ? parseSuperExpression() : parseMemberExpressionOrHigher(); + return parseCallExpressionRest(expression); + } + function parseMemberExpressionOrHigher() { + var expression = parsePrimaryExpression(); + return parseMemberExpressionRest(expression); + } + function parseSuperExpression() { + var expression = parseTokenNode(); + if (token === 16 || token === 20) { + return expression; + } + var node = createNode(151, expression.pos); + node.expression = expression; + parseExpected(20, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); + node.name = parseRightSideOfDot(true); + return finishNode(node); + } + function parseTypeAssertion() { + var node = createNode(156); + parseExpected(24); + node.type = parseType(); + parseExpected(25); + node.expression = parseUnaryExpressionOrHigher(); + return finishNode(node); + } + function parseMemberExpressionRest(expression) { + while (true) { + var dotOrBracketStart = scanner.getTokenPos(); + if (parseOptional(20)) { + var propertyAccess = createNode(151, expression.pos); + propertyAccess.expression = expression; + propertyAccess.name = parseRightSideOfDot(true); + expression = finishNode(propertyAccess); + continue; + } + if (parseOptional(18)) { + var indexedAccess = createNode(152, expression.pos); + indexedAccess.expression = expression; + if (token !== 19) { + indexedAccess.argumentExpression = allowInAnd(parseExpression); + if (indexedAccess.argumentExpression.kind === 8 || indexedAccess.argumentExpression.kind === 7) { + var literal = indexedAccess.argumentExpression; + literal.text = internIdentifier(literal.text); + } + } + parseExpected(19); + expression = finishNode(indexedAccess); + continue; + } + if (token === 10 || token === 11) { + var tagExpression = createNode(155, expression.pos); + tagExpression.tag = expression; + tagExpression.template = token === 10 ? parseLiteralNode() : parseTemplateExpression(); + expression = finishNode(tagExpression); + continue; + } + return expression; + } + } + function parseCallExpressionRest(expression) { + while (true) { + expression = parseMemberExpressionRest(expression); + if (token === 24) { + var typeArguments = tryParse(parseTypeArgumentsInExpression); + if (!typeArguments) { + return expression; + } + var callExpr = createNode(153, expression.pos); + callExpr.expression = expression; + callExpr.typeArguments = typeArguments; + callExpr.arguments = parseArgumentList(); + expression = finishNode(callExpr); + continue; + } + else if (token === 16) { + var callExpr = createNode(153, expression.pos); + callExpr.expression = expression; + callExpr.arguments = parseArgumentList(); + expression = finishNode(callExpr); + continue; + } + return expression; + } + } + function parseArgumentList() { + parseExpected(16); + var result = parseDelimitedList(12, parseArgumentExpression); + parseExpected(17); + return result; + } + function parseTypeArgumentsInExpression() { + if (!parseOptional(24)) { + return undefined; + } + var typeArguments = parseDelimitedList(17, parseType); + if (!parseExpected(25)) { + return undefined; + } + return typeArguments && canFollowTypeArgumentsInExpression() ? typeArguments : undefined; + } + function canFollowTypeArgumentsInExpression() { + switch (token) { + case 16: + case 20: + case 17: + case 19: + case 51: + case 22: + case 23: + case 50: + case 28: + case 30: + case 29: + case 31: + case 48: + case 49: + case 45: + case 43: + case 44: + case 15: + case 1: + return true; + default: + return false; + } + } + function parsePrimaryExpression() { + switch (token) { + case 7: + case 8: + case 10: + return parseLiteralNode(); + case 92: + case 90: + case 88: + case 94: + case 79: + return parseTokenNode(); + case 16: + return parseParenthesizedExpression(); + case 18: + return parseArrayLiteralExpression(); + case 14: + return parseObjectLiteralExpression(); + case 82: + return parseFunctionExpression(); + case 87: + return parseNewExpression(); + case 36: + case 56: + if (reScanSlashToken() === 9) { + return parseLiteralNode(); + } + break; + case 11: + return parseTemplateExpression(); + } + return parseIdentifier(ts.Diagnostics.Expression_expected); + } + function parseParenthesizedExpression() { + var node = createNode(157); + parseExpected(16); + node.expression = allowInAnd(parseExpression); + parseExpected(17); + return finishNode(node); + } + function parseSpreadElement() { + var node = createNode(169); + parseExpected(21); + node.expression = parseAssignmentExpressionOrHigher(); + return finishNode(node); + } + function parseArgumentOrArrayLiteralElement() { + return token === 21 ? parseSpreadElement() : token === 23 ? createNode(170) : parseAssignmentExpressionOrHigher(); + } + function parseArgumentExpression() { + return allowInAnd(parseArgumentOrArrayLiteralElement); + } + function parseArrayLiteralExpression() { + var node = createNode(149); + parseExpected(18); + if (scanner.hasPrecedingLineBreak()) + node.flags |= 256; + node.elements = parseDelimitedList(14, parseArgumentOrArrayLiteralElement); + parseExpected(19); + return finishNode(node); + } + function tryParseAccessorDeclaration(fullStart, modifiers) { + if (parseContextualModifier(114)) { + return parseAccessorDeclaration(132, fullStart, modifiers); + } + else if (parseContextualModifier(118)) { + return parseAccessorDeclaration(133, fullStart, modifiers); + } + return undefined; + } + function parseObjectLiteralElement() { + var fullStart = scanner.getStartPos(); + var modifiers = parseModifiers(); + var accessor = tryParseAccessorDeclaration(fullStart, modifiers); + if (accessor) { + return accessor; + } + var asteriskToken = parseOptionalToken(35); + var tokenIsIdentifier = isIdentifier(); + var nameToken = token; + var propertyName = parsePropertyName(); + var questionToken = parseOptionalToken(50); + if (asteriskToken || token === 16 || token === 24) { + return parseMethodDeclaration(fullStart, modifiers, asteriskToken, propertyName, questionToken); + } + if ((token === 23 || token === 15) && tokenIsIdentifier) { + var shorthandDeclaration = createNode(208, fullStart); + shorthandDeclaration.name = propertyName; + shorthandDeclaration.questionToken = questionToken; + return finishNode(shorthandDeclaration); + } + else { + var propertyAssignment = createNode(207, fullStart); + propertyAssignment.name = propertyName; + propertyAssignment.questionToken = questionToken; + parseExpected(51); + propertyAssignment.initializer = allowInAnd(parseAssignmentExpressionOrHigher); + return finishNode(propertyAssignment); + } + } + function parseObjectLiteralExpression() { + var node = createNode(150); + parseExpected(14); + if (scanner.hasPrecedingLineBreak()) { + node.flags |= 256; + } + node.properties = parseDelimitedList(13, parseObjectLiteralElement, true); + parseExpected(15); + return finishNode(node); + } + function parseFunctionExpression() { + var node = createNode(158); + parseExpected(82); + node.asteriskToken = parseOptionalToken(35); + node.name = node.asteriskToken ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier(); + fillSignature(51, !!node.asteriskToken, false, node); + node.body = parseFunctionBlock(!!node.asteriskToken, false); + return finishNode(node); + } + function parseOptionalIdentifier() { + return isIdentifier() ? parseIdentifier() : undefined; + } + function parseNewExpression() { + var node = createNode(154); + parseExpected(87); + node.expression = parseMemberExpressionOrHigher(); + node.typeArguments = tryParse(parseTypeArgumentsInExpression); + if (node.typeArguments || token === 16) { + node.arguments = parseArgumentList(); + } + return finishNode(node); + } + function parseBlock(ignoreMissingOpenBrace, checkForStrictMode, diagnosticMessage) { + var node = createNode(172); + if (parseExpected(14, diagnosticMessage) || ignoreMissingOpenBrace) { + node.statements = parseList(2, checkForStrictMode, parseStatement); + parseExpected(15); + } + else { + node.statements = createMissingList(); + } + return finishNode(node); + } + function parseFunctionBlock(allowYield, ignoreMissingOpenBrace, diagnosticMessage) { + var savedYieldContext = inYieldContext(); + setYieldContext(allowYield); + var block = parseBlock(ignoreMissingOpenBrace, true, diagnosticMessage); + setYieldContext(savedYieldContext); + return block; + } + function parseEmptyStatement() { + var node = createNode(174); + parseExpected(22); + return finishNode(node); + } + function parseIfStatement() { + var node = createNode(176); + parseExpected(83); + parseExpected(16); + node.expression = allowInAnd(parseExpression); + parseExpected(17); + node.thenStatement = parseStatement(); + node.elseStatement = parseOptional(75) ? parseStatement() : undefined; + return finishNode(node); + } + function parseDoStatement() { + var node = createNode(177); + parseExpected(74); + node.statement = parseStatement(); + parseExpected(99); + parseExpected(16); + node.expression = allowInAnd(parseExpression); + parseExpected(17); + parseOptional(22); + return finishNode(node); + } + function parseWhileStatement() { + var node = createNode(178); + parseExpected(99); + parseExpected(16); + node.expression = allowInAnd(parseExpression); + parseExpected(17); + node.statement = parseStatement(); + return finishNode(node); + } + function parseForOrForInOrForOfStatement() { + var pos = getNodePos(); + parseExpected(81); + parseExpected(16); + var initializer = undefined; + if (token !== 22) { + if (token === 97 || token === 103 || token === 69) { + initializer = parseVariableDeclarationList(true); + } + else { + initializer = disallowInAnd(parseExpression); + } + } + var forOrForInOrForOfStatement; + if (parseOptional(85)) { + var forInStatement = createNode(180, pos); + forInStatement.initializer = initializer; + forInStatement.expression = allowInAnd(parseExpression); + parseExpected(17); + forOrForInOrForOfStatement = forInStatement; + } + else if (parseOptional(122)) { + var forOfStatement = createNode(181, pos); + forOfStatement.initializer = initializer; + forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); + parseExpected(17); + forOrForInOrForOfStatement = forOfStatement; + } + else { + var forStatement = createNode(179, pos); + forStatement.initializer = initializer; + parseExpected(22); + if (token !== 22 && token !== 17) { + forStatement.condition = allowInAnd(parseExpression); + } + parseExpected(22); + if (token !== 17) { + forStatement.iterator = allowInAnd(parseExpression); + } + parseExpected(17); + forOrForInOrForOfStatement = forStatement; + } + forOrForInOrForOfStatement.statement = parseStatement(); + return finishNode(forOrForInOrForOfStatement); + } + function parseBreakOrContinueStatement(kind) { + var node = createNode(kind); + parseExpected(kind === 183 ? 65 : 70); + if (!canParseSemicolon()) { + node.label = parseIdentifier(); + } + parseSemicolon(); + return finishNode(node); + } + function parseReturnStatement() { + var node = createNode(184); + parseExpected(89); + if (!canParseSemicolon()) { + node.expression = allowInAnd(parseExpression); + } + parseSemicolon(); + return finishNode(node); + } + function parseWithStatement() { + var node = createNode(185); + parseExpected(100); + parseExpected(16); + node.expression = allowInAnd(parseExpression); + parseExpected(17); + node.statement = parseStatement(); + return finishNode(node); + } + function parseCaseClause() { + var node = createNode(203); + parseExpected(66); + node.expression = allowInAnd(parseExpression); + parseExpected(51); + node.statements = parseList(4, false, parseStatement); + return finishNode(node); + } + function parseDefaultClause() { + var node = createNode(204); + parseExpected(72); + parseExpected(51); + node.statements = parseList(4, false, parseStatement); + return finishNode(node); + } + function parseCaseOrDefaultClause() { + return token === 66 ? parseCaseClause() : parseDefaultClause(); + } + function parseSwitchStatement() { + var node = createNode(186); + parseExpected(91); + parseExpected(16); + node.expression = allowInAnd(parseExpression); + parseExpected(17); + parseExpected(14); + node.clauses = parseList(3, false, parseCaseOrDefaultClause); + parseExpected(15); + return finishNode(node); + } + function parseThrowStatement() { + var node = createNode(188); + parseExpected(93); + node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); + parseSemicolon(); + return finishNode(node); + } + function parseTryStatement() { + var node = createNode(189); + parseExpected(95); + node.tryBlock = parseBlock(false, false); + node.catchClause = token === 67 ? parseCatchClause() : undefined; + if (!node.catchClause || token === 80) { + parseExpected(80); + node.finallyBlock = parseBlock(false, false); + } + return finishNode(node); + } + function parseCatchClause() { + var result = createNode(206); + parseExpected(67); + parseExpected(16); + result.name = parseIdentifier(); + result.type = parseTypeAnnotation(); + parseExpected(17); + result.block = parseBlock(false, false); + return finishNode(result); + } + function parseDebuggerStatement() { + var node = createNode(190); + parseExpected(71); + parseSemicolon(); + return finishNode(node); + } + function parseExpressionOrLabeledStatement() { + var fullStart = scanner.getStartPos(); + var expression = allowInAnd(parseExpression); + if (expression.kind === 64 && parseOptional(51)) { + var labeledStatement = createNode(187, fullStart); + labeledStatement.label = expression; + labeledStatement.statement = parseStatement(); + return finishNode(labeledStatement); + } + else { + var expressionStatement = createNode(175, fullStart); + expressionStatement.expression = expression; + parseSemicolon(); + return finishNode(expressionStatement); + } + } + function isStartOfStatement(inErrorRecovery) { + if (ts.isModifier(token)) { + var result = lookAhead(parseVariableStatementOrFunctionDeclarationWithModifiers); + if (result) { + return true; + } + } + switch (token) { + case 22: + return !inErrorRecovery; + case 14: + case 97: + case 103: + case 82: + case 83: + case 74: + case 99: + case 81: + case 70: + case 65: + case 89: + case 100: + case 91: + case 93: + case 95: + case 71: + case 67: + case 80: + return true; + case 69: + var isConstEnum = lookAhead(nextTokenIsEnumKeyword); + return !isConstEnum; + case 102: + case 68: + case 115: + case 76: + case 121: + if (isDeclarationStart()) { + return false; + } + case 107: + case 105: + case 106: + case 108: + if (lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine)) { + return false; + } + default: + return isStartOfExpression(); + } + } + function nextTokenIsEnumKeyword() { + nextToken(); + return token === 76; + } + function nextTokenIsIdentifierOrKeywordOnSameLine() { + nextToken(); + return isIdentifierOrKeyword() && !scanner.hasPrecedingLineBreak(); + } + function parseStatement() { + switch (token) { + case 14: + return parseBlock(false, false); + case 97: + case 69: + return parseVariableStatement(scanner.getStartPos(), undefined); + case 82: + return parseFunctionDeclaration(scanner.getStartPos(), undefined); + case 22: + return parseEmptyStatement(); + case 83: + return parseIfStatement(); + case 74: + return parseDoStatement(); + case 99: + return parseWhileStatement(); + case 81: + return parseForOrForInOrForOfStatement(); + case 70: + return parseBreakOrContinueStatement(182); + case 65: + return parseBreakOrContinueStatement(183); + case 89: + return parseReturnStatement(); + case 100: + return parseWithStatement(); + case 91: + return parseSwitchStatement(); + case 93: + return parseThrowStatement(); + case 95: + case 67: + case 80: + return parseTryStatement(); + case 71: + return parseDebuggerStatement(); + case 103: + if (isLetDeclaration()) { + return parseVariableStatement(scanner.getStartPos(), undefined); + } + default: + if (ts.isModifier(token)) { + var result = tryParse(parseVariableStatementOrFunctionDeclarationWithModifiers); + if (result) { + return result; + } + } + return parseExpressionOrLabeledStatement(); + } + } + function parseVariableStatementOrFunctionDeclarationWithModifiers() { + var start = scanner.getStartPos(); + var modifiers = parseModifiers(); + switch (token) { + case 69: + var nextTokenIsEnum = lookAhead(nextTokenIsEnumKeyword); + if (nextTokenIsEnum) { + return undefined; + } + return parseVariableStatement(start, modifiers); + case 103: + if (!isLetDeclaration()) { + return undefined; + } + return parseVariableStatement(start, modifiers); + case 97: + return parseVariableStatement(start, modifiers); + case 82: + return parseFunctionDeclaration(start, modifiers); + } + return undefined; + } + function parseFunctionBlockOrSemicolon(isGenerator, diagnosticMessage) { + if (token !== 14 && canParseSemicolon()) { + parseSemicolon(); + return; + } + return parseFunctionBlock(isGenerator, false, diagnosticMessage); + } + function parseArrayBindingElement() { + if (token === 23) { + return createNode(170); + } + var node = createNode(148); + node.dotDotDotToken = parseOptionalToken(21); + node.name = parseIdentifierOrPattern(); + node.initializer = parseInitializer(false); + return finishNode(node); + } + function parseObjectBindingElement() { + var node = createNode(148); + var id = parsePropertyName(); + if (id.kind === 64 && token !== 51) { + node.name = id; + } + else { + parseExpected(51); + node.propertyName = id; + node.name = parseIdentifierOrPattern(); + } + node.initializer = parseInitializer(false); + return finishNode(node); + } + function parseObjectBindingPattern() { + var node = createNode(146); + parseExpected(14); + node.elements = parseDelimitedList(10, parseObjectBindingElement); + parseExpected(15); + return finishNode(node); + } + function parseArrayBindingPattern() { + var node = createNode(147); + parseExpected(18); + node.elements = parseDelimitedList(11, parseArrayBindingElement); + parseExpected(19); + return finishNode(node); + } + function isIdentifierOrPattern() { + return token === 14 || token === 18 || isIdentifier(); + } + function parseIdentifierOrPattern() { + if (token === 18) { + return parseArrayBindingPattern(); + } + if (token === 14) { + return parseObjectBindingPattern(); + } + return parseIdentifier(); + } + function parseVariableDeclaration() { + var node = createNode(191); + node.name = parseIdentifierOrPattern(); + node.type = parseTypeAnnotation(); + if (!isInOrOfKeyword(token)) { + node.initializer = parseInitializer(false); + } + return finishNode(node); + } + function parseVariableDeclarationList(inForStatementInitializer) { + var node = createNode(192); + switch (token) { + case 97: + break; + case 103: + node.flags |= 2048; + break; + case 69: + node.flags |= 4096; + break; + default: + ts.Debug.fail(); + } + nextToken(); + if (token === 122 && lookAhead(canFollowContextualOfKeyword)) { + node.declarations = createMissingList(); + } + else { + var savedDisallowIn = inDisallowInContext(); + setDisallowInContext(inForStatementInitializer); + node.declarations = parseDelimitedList(9, parseVariableDeclaration); + setDisallowInContext(savedDisallowIn); + } + return finishNode(node); + } + function canFollowContextualOfKeyword() { + return nextTokenIsIdentifier() && nextToken() === 17; + } + function parseVariableStatement(fullStart, modifiers) { + var node = createNode(173, fullStart); + setModifiers(node, modifiers); + node.declarationList = parseVariableDeclarationList(false); + parseSemicolon(); + return finishNode(node); + } + function parseFunctionDeclaration(fullStart, modifiers) { + var node = createNode(193, fullStart); + setModifiers(node, modifiers); + parseExpected(82); + node.asteriskToken = parseOptionalToken(35); + node.name = parseIdentifier(); + fillSignature(51, !!node.asteriskToken, false, node); + node.body = parseFunctionBlockOrSemicolon(!!node.asteriskToken, ts.Diagnostics.or_expected); + return finishNode(node); + } + function parseConstructorDeclaration(pos, modifiers) { + var node = createNode(131, pos); + setModifiers(node, modifiers); + parseExpected(112); + fillSignature(51, false, false, node); + node.body = parseFunctionBlockOrSemicolon(false, ts.Diagnostics.or_expected); + return finishNode(node); + } + function parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { + var method = createNode(130, fullStart); + setModifiers(method, modifiers); + method.asteriskToken = asteriskToken; + method.name = name; + method.questionToken = questionToken; + fillSignature(51, !!asteriskToken, false, method); + method.body = parseFunctionBlockOrSemicolon(!!asteriskToken, diagnosticMessage); + return finishNode(method); + } + function parsePropertyOrMethodDeclaration(fullStart, modifiers) { + var asteriskToken = parseOptionalToken(35); + var name = parsePropertyName(); + var questionToken = parseOptionalToken(50); + if (asteriskToken || token === 16 || token === 24) { + return parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); + } + else { + var property = createNode(128, fullStart); + setModifiers(property, modifiers); + property.name = name; + property.questionToken = questionToken; + property.type = parseTypeAnnotation(); + property.initializer = allowInAnd(parseNonParameterInitializer); + parseSemicolon(); + return finishNode(property); + } + } + function parseNonParameterInitializer() { + return parseInitializer(false); + } + function parseAccessorDeclaration(kind, fullStart, modifiers) { + var node = createNode(kind, fullStart); + setModifiers(node, modifiers); + node.name = parsePropertyName(); + fillSignature(51, false, false, node); + node.body = parseFunctionBlockOrSemicolon(false); + return finishNode(node); + } + function isClassMemberStart() { + var idToken; + while (ts.isModifier(token)) { + idToken = token; + nextToken(); + } + if (token === 35) { + return true; + } + if (isLiteralPropertyName()) { + idToken = token; + nextToken(); + } + if (token === 18) { + return true; + } + if (idToken !== undefined) { + if (!ts.isKeyword(idToken) || idToken === 118 || idToken === 114) { + return true; + } + switch (token) { + case 16: + case 24: + case 51: + case 52: + case 50: + return true; + default: + return canParseSemicolon(); + } + } + return false; + } + function parseModifiers() { + var flags = 0; + var modifiers; + while (true) { + var modifierStart = scanner.getStartPos(); + var modifierKind = token; + if (!parseAnyContextualModifier()) { + break; + } + if (!modifiers) { + modifiers = []; + modifiers.pos = modifierStart; + } + flags |= modifierToFlag(modifierKind); + modifiers.push(finishNode(createNode(modifierKind, modifierStart))); + } + if (modifiers) { + modifiers.flags = flags; + modifiers.end = scanner.getStartPos(); + } + return modifiers; + } + function parseClassElement() { + var fullStart = getNodePos(); + var modifiers = parseModifiers(); + var accessor = tryParseAccessorDeclaration(fullStart, modifiers); + if (accessor) { + return accessor; + } + if (token === 112) { + return parseConstructorDeclaration(fullStart, modifiers); + } + if (isIndexSignature()) { + return parseIndexSignatureDeclaration(modifiers); + } + if (isIdentifierOrKeyword() || + token === 8 || + token === 7 || + token === 35 || + token === 18) { + return parsePropertyOrMethodDeclaration(fullStart, modifiers); + } + ts.Debug.fail("Should not have attempted to parse class member declaration."); + } + function parseClassDeclaration(fullStart, modifiers) { + var node = createNode(194, fullStart); + setModifiers(node, modifiers); + parseExpected(68); + node.name = parseIdentifier(); + node.typeParameters = parseTypeParameters(); + node.heritageClauses = parseHeritageClauses(true); + if (parseExpected(14)) { + node.members = inGeneratorParameterContext() ? doOutsideOfYieldContext(parseClassMembers) : parseClassMembers(); + parseExpected(15); + } + else { + node.members = createMissingList(); + } + return finishNode(node); + } + function parseHeritageClauses(isClassHeritageClause) { + if (isHeritageClause()) { + return isClassHeritageClause && inGeneratorParameterContext() ? doOutsideOfYieldContext(parseHeritageClausesWorker) : parseHeritageClausesWorker(); + } + return undefined; + } + function parseHeritageClausesWorker() { + return parseList(19, false, parseHeritageClause); + } + function parseHeritageClause() { + if (token === 78 || token === 101) { + var node = createNode(205); + node.token = token; + nextToken(); + node.types = parseDelimitedList(8, parseTypeReference); + return finishNode(node); + } + return undefined; + } + function isHeritageClause() { + return token === 78 || token === 101; + } + function parseClassMembers() { + return parseList(6, false, parseClassElement); + } + function parseInterfaceDeclaration(fullStart, modifiers) { + var node = createNode(195, fullStart); + setModifiers(node, modifiers); + parseExpected(102); + node.name = parseIdentifier(); + node.typeParameters = parseTypeParameters(); + node.heritageClauses = parseHeritageClauses(false); + node.members = parseObjectTypeMembers(); + return finishNode(node); + } + function parseTypeAliasDeclaration(fullStart, modifiers) { + var node = createNode(196, fullStart); + setModifiers(node, modifiers); + parseExpected(121); + node.name = parseIdentifier(); + parseExpected(52); + node.type = parseType(); + parseSemicolon(); + return finishNode(node); + } + function parseEnumMember() { + var node = createNode(209, scanner.getStartPos()); + node.name = parsePropertyName(); + node.initializer = allowInAnd(parseNonParameterInitializer); + return finishNode(node); + } + function parseEnumDeclaration(fullStart, modifiers) { + var node = createNode(197, fullStart); + setModifiers(node, modifiers); + parseExpected(76); + node.name = parseIdentifier(); + if (parseExpected(14)) { + node.members = parseDelimitedList(7, parseEnumMember); + parseExpected(15); + } + else { + node.members = createMissingList(); + } + return finishNode(node); + } + function parseModuleBlock() { + var node = createNode(199, scanner.getStartPos()); + if (parseExpected(14)) { + node.statements = parseList(1, false, parseModuleElement); + parseExpected(15); + } + else { + node.statements = createMissingList(); + } + return finishNode(node); + } + function parseInternalModuleTail(fullStart, modifiers, flags) { + var node = createNode(198, fullStart); + setModifiers(node, modifiers); + node.flags |= flags; + node.name = parseIdentifier(); + node.body = parseOptional(20) ? parseInternalModuleTail(getNodePos(), undefined, 1) : parseModuleBlock(); + return finishNode(node); + } + function parseAmbientExternalModuleDeclaration(fullStart, modifiers) { + var node = createNode(198, fullStart); + setModifiers(node, modifiers); + node.name = parseLiteralNode(true); + node.body = parseModuleBlock(); + return finishNode(node); + } + function parseModuleDeclaration(fullStart, modifiers) { + parseExpected(115); + return token === 8 ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); + } + function isExternalModuleReference() { + return token === 116 && + lookAhead(nextTokenIsOpenParen); + } + function nextTokenIsOpenParen() { + return nextToken() === 16; + } + function parseImportDeclaration(fullStart, modifiers) { + var node = createNode(200, fullStart); + setModifiers(node, modifiers); + parseExpected(84); + node.name = parseIdentifier(); + parseExpected(52); + node.moduleReference = parseModuleReference(); + parseSemicolon(); + return finishNode(node); + } + function parseModuleReference() { + return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(false); + } + function parseExternalModuleReference() { + var node = createNode(202); + parseExpected(116); + parseExpected(16); + node.expression = parseExpression(); + if (node.expression.kind === 8) { + internIdentifier(node.expression.text); + } + parseExpected(17); + return finishNode(node); + } + function parseExportAssignmentTail(fullStart, modifiers) { + var node = createNode(201, fullStart); + setModifiers(node, modifiers); + node.exportName = parseIdentifier(); + parseSemicolon(); + return finishNode(node); + } + function isLetDeclaration() { + return inStrictModeContext() || lookAhead(nextTokenIsIdentifierOnSameLine); + } + function isDeclarationStart() { + switch (token) { + case 97: + case 69: + case 82: + return true; + case 103: + return isLetDeclaration(); + case 68: + case 102: + case 76: + case 84: + case 121: + return lookAhead(nextTokenIsIdentifierOrKeyword); + case 115: + return lookAhead(nextTokenIsIdentifierOrKeywordOrStringLiteral); + case 77: + return lookAhead(nextTokenIsEqualsTokenOrDeclarationStart); + case 113: + case 107: + case 105: + case 106: + case 108: + return lookAhead(nextTokenIsDeclarationStart); + } + } + function isIdentifierOrKeyword() { + return token >= 64; + } + function nextTokenIsIdentifierOrKeyword() { + nextToken(); + return isIdentifierOrKeyword(); + } + function nextTokenIsIdentifierOrKeywordOrStringLiteral() { + nextToken(); + return isIdentifierOrKeyword() || token === 8; + } + function nextTokenIsEqualsTokenOrDeclarationStart() { + nextToken(); + return token === 52 || isDeclarationStart(); + } + function nextTokenIsDeclarationStart() { + nextToken(); + return isDeclarationStart(); + } + function parseDeclaration() { + var fullStart = getNodePos(); + var modifiers = parseModifiers(); + if (token === 77) { + nextToken(); + if (parseOptional(52)) { + return parseExportAssignmentTail(fullStart, modifiers); + } + } + switch (token) { + case 97: + case 103: + case 69: + return parseVariableStatement(fullStart, modifiers); + case 82: + return parseFunctionDeclaration(fullStart, modifiers); + case 68: + return parseClassDeclaration(fullStart, modifiers); + case 102: + return parseInterfaceDeclaration(fullStart, modifiers); + case 121: + return parseTypeAliasDeclaration(fullStart, modifiers); + case 76: + return parseEnumDeclaration(fullStart, modifiers); + case 115: + return parseModuleDeclaration(fullStart, modifiers); + case 84: + return parseImportDeclaration(fullStart, modifiers); + default: + ts.Debug.fail("Mismatch between isDeclarationStart and parseDeclaration"); + } + } + function isSourceElement(inErrorRecovery) { + return isDeclarationStart() || isStartOfStatement(inErrorRecovery); + } + function parseSourceElement() { + return parseSourceElementOrModuleElement(); + } + function parseModuleElement() { + return parseSourceElementOrModuleElement(); + } + function parseSourceElementOrModuleElement() { + return isDeclarationStart() ? parseDeclaration() : parseStatement(); + } + function processReferenceComments(sourceFile) { + var triviaScanner = ts.createScanner(sourceFile.languageVersion, false, sourceText); + var referencedFiles = []; + var amdDependencies = []; + var amdModuleName; + while (true) { + var kind = triviaScanner.scan(); + if (kind === 5 || kind === 4 || kind === 3) { + continue; + } + if (kind !== 2) { + break; + } + var range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos() }; + var comment = sourceText.substring(range.pos, range.end); + var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, range); + if (referencePathMatchResult) { + var fileReference = referencePathMatchResult.fileReference; + sourceFile.hasNoDefaultLib = referencePathMatchResult.isNoDefaultLib; + var diagnosticMessage = referencePathMatchResult.diagnosticMessage; + if (fileReference) { + referencedFiles.push(fileReference); + } + if (diagnosticMessage) { + sourceFile.parseDiagnostics.push(ts.createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, diagnosticMessage)); + } + } + else { + var amdModuleNameRegEx = /^\/\/\/\s*= 52 && token <= 63; + } + ts.isAssignmentOperator = isAssignmentOperator; +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.bindTime = 0; + (function (ModuleInstanceState) { + ModuleInstanceState[ModuleInstanceState["NonInstantiated"] = 0] = "NonInstantiated"; + ModuleInstanceState[ModuleInstanceState["Instantiated"] = 1] = "Instantiated"; + ModuleInstanceState[ModuleInstanceState["ConstEnumOnly"] = 2] = "ConstEnumOnly"; + })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); + var ModuleInstanceState = ts.ModuleInstanceState; + function getModuleInstanceState(node) { + if (node.kind === 195 || node.kind === 196) { + return 0; + } + else if (ts.isConstEnumDeclaration(node)) { + return 2; + } + else if (node.kind === 200 && !(node.flags & 1)) { + return 0; + } + else if (node.kind === 199) { + var state = 0; + ts.forEachChild(node, function (n) { + switch (getModuleInstanceState(n)) { + case 0: + return false; + case 2: + state = 2; + return false; + case 1: + state = 1; + return true; + } + }); + return state; + } + else if (node.kind === 198) { + return getModuleInstanceState(node.body); + } + else { + return 1; + } + } + ts.getModuleInstanceState = getModuleInstanceState; + function bindSourceFile(file) { + var start = new Date().getTime(); + bindSourceFileWorker(file); + ts.bindTime += new Date().getTime() - start; + } + ts.bindSourceFile = bindSourceFile; + function bindSourceFileWorker(file) { + var parent; + var container; + var blockScopeContainer; + var lastContainer; + var symbolCount = 0; + var Symbol = ts.objectAllocator.getSymbolConstructor(); + if (!file.locals) { + file.locals = {}; + container = blockScopeContainer = file; + bind(file); + file.symbolCount = symbolCount; + } + function createSymbol(flags, name) { + symbolCount++; + return new Symbol(flags, name); + } + function addDeclarationToSymbol(symbol, node, symbolKind) { + symbol.flags |= symbolKind; + if (!symbol.declarations) + symbol.declarations = []; + symbol.declarations.push(node); + if (symbolKind & 1952 && !symbol.exports) + symbol.exports = {}; + if (symbolKind & 6240 && !symbol.members) + symbol.members = {}; + node.symbol = symbol; + if (symbolKind & 107455 && !symbol.valueDeclaration) + symbol.valueDeclaration = node; + } + function getDeclarationName(node) { + if (node.name) { + if (node.kind === 198 && node.name.kind === 8) { + return '"' + node.name.text + '"'; + } + if (node.name.kind === 124) { + var nameExpression = node.name.expression; + ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); + return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); + } + return node.name.text; + } + switch (node.kind) { + case 139: + case 131: + return "__constructor"; + case 138: + case 134: + return "__call"; + case 135: + return "__new"; + case 136: + return "__index"; + } + } + function getDisplayName(node) { + return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); + } + function declareSymbol(symbols, parent, node, includes, excludes) { + ts.Debug.assert(!ts.hasDynamicName(node)); + var name = getDeclarationName(node); + if (name !== undefined) { + var symbol = ts.hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name)); + if (symbol.flags & excludes) { + if (node.name) { + node.name.parent = node; + } + var message = symbol.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + ts.forEach(symbol.declarations, function (declaration) { + file.bindDiagnostics.push(ts.createDiagnosticForNode(declaration.name, message, getDisplayName(declaration))); + }); + file.bindDiagnostics.push(ts.createDiagnosticForNode(node.name, message, getDisplayName(node))); + symbol = createSymbol(0, name); + } + } + else { + symbol = createSymbol(0, "__missing"); + } + addDeclarationToSymbol(symbol, node, includes); + symbol.parent = parent; + if (node.kind === 194 && symbol.exports) { + var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); + if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { + if (node.name) { + node.name.parent = node; + } + file.bindDiagnostics.push(ts.createDiagnosticForNode(symbol.exports[prototypeSymbol.name].declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + } + symbol.exports[prototypeSymbol.name] = prototypeSymbol; + prototypeSymbol.parent = symbol; + } + return symbol; + } + function isAmbientContext(node) { + while (node) { + if (node.flags & 2) + return true; + node = node.parent; + } + return false; + } + function declareModuleMember(node, symbolKind, symbolExcludes) { + var exportKind = 0; + if (symbolKind & 107455) { + exportKind |= 1048576; + } + if (symbolKind & 793056) { + exportKind |= 2097152; + } + if (symbolKind & 1536) { + exportKind |= 4194304; + } + if (ts.getCombinedNodeFlags(node) & 1 || (node.kind !== 200 && isAmbientContext(container))) { + if (exportKind) { + var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); + local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); + node.localSymbol = local; + } + else { + declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); + } + } + else { + declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); + } + } + function bindChildren(node, symbolKind, isBlockScopeContainer) { + if (symbolKind & 255504) { + node.locals = {}; + } + var saveParent = parent; + var saveContainer = container; + var savedBlockScopeContainer = blockScopeContainer; + parent = node; + if (symbolKind & 262128) { + container = node; + if (lastContainer) { + lastContainer.nextContainer = container; + } + lastContainer = container; + } + if (isBlockScopeContainer) { + blockScopeContainer = node; + } + ts.forEachChild(node, bind); + container = saveContainer; + parent = saveParent; + blockScopeContainer = savedBlockScopeContainer; + } + function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { + switch (container.kind) { + case 198: + declareModuleMember(node, symbolKind, symbolExcludes); + break; + case 210: + if (ts.isExternalModule(container)) { + declareModuleMember(node, symbolKind, symbolExcludes); + break; + } + case 138: + case 139: + case 134: + case 135: + case 136: + case 130: + case 129: + case 131: + case 132: + case 133: + case 193: + case 158: + case 159: + declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); + break; + case 194: + if (node.flags & 128) { + declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); + break; + } + case 141: + case 150: + case 195: + declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); + break; + case 197: + declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); + break; + } + bindChildren(node, symbolKind, isBlockScopeContainer); + } + function bindModuleDeclaration(node) { + if (node.name.kind === 8) { + bindDeclaration(node, 512, 106639, true); + } + else { + var state = getModuleInstanceState(node); + if (state === 0) { + bindDeclaration(node, 1024, 0, true); + } + else { + bindDeclaration(node, 512, 106639, true); + if (state === 2) { + node.symbol.constEnumOnlyModule = true; + } + else if (node.symbol.constEnumOnlyModule) { + node.symbol.constEnumOnlyModule = false; + } + } + } + } + function bindFunctionOrConstructorType(node) { + var symbol = createSymbol(131072, getDeclarationName(node)); + addDeclarationToSymbol(symbol, node, 131072); + bindChildren(node, 131072, false); + var typeLiteralSymbol = createSymbol(2048, "__type"); + addDeclarationToSymbol(typeLiteralSymbol, node, 2048); + typeLiteralSymbol.members = {}; + typeLiteralSymbol.members[node.kind === 138 ? "__call" : "__new"] = symbol; + } + function bindAnonymousDeclaration(node, symbolKind, name, isBlockScopeContainer) { + var symbol = createSymbol(symbolKind, name); + addDeclarationToSymbol(symbol, node, symbolKind); + bindChildren(node, symbolKind, isBlockScopeContainer); + } + function bindCatchVariableDeclaration(node) { + var symbol = createSymbol(1, node.name.text || "__missing"); + addDeclarationToSymbol(symbol, node, 1); + var saveParent = parent; + var savedBlockScopeContainer = blockScopeContainer; + parent = blockScopeContainer = node; + ts.forEachChild(node, bind); + parent = saveParent; + blockScopeContainer = savedBlockScopeContainer; + } + function bindBlockScopedVariableDeclaration(node) { + switch (blockScopeContainer.kind) { + case 198: + declareModuleMember(node, 2, 107455); + break; + case 210: + if (ts.isExternalModule(container)) { + declareModuleMember(node, 2, 107455); + break; + } + default: + if (!blockScopeContainer.locals) { + blockScopeContainer.locals = {}; + } + declareSymbol(blockScopeContainer.locals, undefined, node, 2, 107455); + } + bindChildren(node, 2, false); + } + function getDestructuringParameterName(node) { + return "__" + ts.indexOf(node.parent.parameters, node); + } + function bind(node) { + node.parent = parent; + switch (node.kind) { + case 125: + bindDeclaration(node, 262144, 530912, false); + break; + case 126: + bindParameter(node); + break; + case 191: + case 148: + if (ts.isBindingPattern(node.name)) { + bindChildren(node, 0, false); + } + else if (ts.getCombinedNodeFlags(node) & 6144) { + bindBlockScopedVariableDeclaration(node); + } + else { + bindDeclaration(node, 1, 107454, false); + } + break; + case 128: + case 127: + bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); + break; + case 207: + case 208: + bindPropertyOrMethodOrAccessor(node, 4, 107455, false); + break; + case 209: + bindPropertyOrMethodOrAccessor(node, 8, 107455, false); + break; + case 134: + case 135: + case 136: + bindDeclaration(node, 131072, 0, false); + break; + case 130: + case 129: + bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263, true); + break; + case 193: + bindDeclaration(node, 16, 106927, true); + break; + case 131: + bindDeclaration(node, 16384, 0, true); + break; + case 132: + bindPropertyOrMethodOrAccessor(node, 32768, 41919, true); + break; + case 133: + bindPropertyOrMethodOrAccessor(node, 65536, 74687, true); + break; + case 138: + case 139: + bindFunctionOrConstructorType(node); + break; + case 141: + bindAnonymousDeclaration(node, 2048, "__type", false); + break; + case 150: + bindAnonymousDeclaration(node, 4096, "__object", false); + break; + case 158: + case 159: + bindAnonymousDeclaration(node, 16, "__function", true); + break; + case 206: + bindCatchVariableDeclaration(node); + break; + case 194: + bindDeclaration(node, 32, 899583, false); + break; + case 195: + bindDeclaration(node, 64, 792992, false); + break; + case 196: + bindDeclaration(node, 524288, 793056, false); + break; + case 197: + if (ts.isConst(node)) { + bindDeclaration(node, 128, 899967, false); + } + else { + bindDeclaration(node, 256, 899327, false); + } + break; + case 198: + bindModuleDeclaration(node); + break; + case 200: + bindDeclaration(node, 8388608, 8388608, false); + break; + case 210: + if (ts.isExternalModule(node)) { + bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); + break; + } + case 172: + bindChildren(node, 0, !ts.isAnyFunction(node.parent)); + break; + case 206: + case 179: + case 180: + case 181: + case 186: + bindChildren(node, 0, true); + break; + default: + var saveParent = parent; + parent = node; + ts.forEachChild(node, bind); + parent = saveParent; + } + } + function bindParameter(node) { + if (ts.isBindingPattern(node.name)) { + bindAnonymousDeclaration(node, 1, getDestructuringParameterName(node), false); + } + else { + bindDeclaration(node, 1, 107455, false); + } + if (node.flags & 112 && + node.parent.kind === 131 && + node.parent.parent.kind === 194) { + var classDeclaration = node.parent.parent; + declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); + } + } + function bindPropertyOrMethodOrAccessor(node, symbolKind, symbolExcludes, isBlockScopeContainer) { + if (ts.hasDynamicName(node)) { + bindAnonymousDeclaration(node, symbolKind, "__computed", isBlockScopeContainer); + } + else { + bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer); + } + } + } +})(ts || (ts = {})); +var ts; +(function (ts) { + var nextSymbolId = 1; + var nextNodeId = 1; + var nextMergeId = 1; + ts.checkTime = 0; + function createTypeChecker(host, produceDiagnostics) { + var Symbol = ts.objectAllocator.getSymbolConstructor(); + var Type = ts.objectAllocator.getTypeConstructor(); + var Signature = ts.objectAllocator.getSignatureConstructor(); + var typeCount = 0; + var emptyArray = []; + var emptySymbols = {}; + var compilerOptions = host.getCompilerOptions(); + var languageVersion = compilerOptions.target || 0; + var emitResolver = createResolver(); + var checker = { + getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, + getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, + getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount"); }, + getTypeCount: function () { return typeCount; }, + isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, + isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, + getDiagnostics: getDiagnostics, + getGlobalDiagnostics: getGlobalDiagnostics, + getTypeOfSymbolAtLocation: getTypeOfSymbolAtLocation, + getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, + getPropertiesOfType: getPropertiesOfType, + getPropertyOfType: getPropertyOfType, + getSignaturesOfType: getSignaturesOfType, + getIndexTypeOfType: getIndexTypeOfType, + getReturnTypeOfSignature: getReturnTypeOfSignature, + getSymbolsInScope: getSymbolsInScope, + getSymbolAtLocation: getSymbolAtLocation, + getShorthandAssignmentValueSymbol: getShorthandAssignmentValueSymbol, + getTypeAtLocation: getTypeAtLocation, + typeToString: typeToString, + getSymbolDisplayBuilder: getSymbolDisplayBuilder, + symbolToString: symbolToString, + getAugmentedPropertiesOfType: getAugmentedPropertiesOfType, + getRootSymbols: getRootSymbols, + getContextualType: getContextualType, + getFullyQualifiedName: getFullyQualifiedName, + getResolvedSignature: getResolvedSignature, + getConstantValue: getConstantValue, + isValidPropertyAccess: isValidPropertyAccess, + getSignatureFromDeclaration: getSignatureFromDeclaration, + isImplementationOfOverload: isImplementationOfOverload, + getAliasedSymbol: resolveImport, + getEmitResolver: getEmitResolver + }; + var undefinedSymbol = createSymbol(4 | 67108864, "undefined"); + var argumentsSymbol = createSymbol(4 | 67108864, "arguments"); + var unknownSymbol = createSymbol(4 | 67108864, "unknown"); + var resolvingSymbol = createSymbol(67108864, "__resolving__"); + var anyType = createIntrinsicType(1, "any"); + var stringType = createIntrinsicType(2, "string"); + var numberType = createIntrinsicType(4, "number"); + var booleanType = createIntrinsicType(8, "boolean"); + var esSymbolType = createIntrinsicType(1048576, "symbol"); + var voidType = createIntrinsicType(16, "void"); + var undefinedType = createIntrinsicType(32 | 262144, "undefined"); + var nullType = createIntrinsicType(64 | 262144, "null"); + var unknownType = createIntrinsicType(1, "unknown"); + var resolvingType = createIntrinsicType(1, "__resolving__"); + var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var inferenceFailureType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var anySignature = createSignature(undefined, undefined, emptyArray, anyType, 0, false, false); + var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, 0, false, false); + var globals = {}; + var globalArraySymbol; + var globalESSymbolConstructorSymbol; + var globalObjectType; + var globalFunctionType; + var globalArrayType; + var globalStringType; + var globalNumberType; + var globalBooleanType; + var globalRegExpType; + var globalTemplateStringsArrayType; + var globalESSymbolType; + var anyArrayType; + var tupleTypes = {}; + var unionTypes = {}; + var stringLiteralTypes = {}; + var emitExtends = false; + var mergedSymbols = []; + var symbolLinks = []; + var nodeLinks = []; + var potentialThisCollisions = []; + var diagnostics = ts.createDiagnosticCollection(); + var primitiveTypeInfo = { + "string": { + type: stringType, + flags: 258 + }, + "number": { + type: numberType, + flags: 132 + }, + "boolean": { + type: booleanType, + flags: 8 + }, + "symbol": { + type: esSymbolType, + flags: 1048576 + } + }; + function getEmitResolver(sourceFile) { + getDiagnostics(sourceFile); + return emitResolver; + } + function error(location, message, arg0, arg1, arg2) { + var diagnostic = location ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2) : ts.createCompilerDiagnostic(message, arg0, arg1, arg2); + diagnostics.add(diagnostic); + } + function createSymbol(flags, name) { + return new Symbol(flags, name); + } + function getExcludedSymbolFlags(flags) { + var result = 0; + if (flags & 2) + result |= 107455; + if (flags & 1) + result |= 107454; + if (flags & 4) + result |= 107455; + if (flags & 8) + result |= 107455; + if (flags & 16) + result |= 106927; + if (flags & 32) + result |= 899583; + if (flags & 64) + result |= 792992; + if (flags & 256) + result |= 899327; + if (flags & 128) + result |= 899967; + if (flags & 512) + result |= 106639; + if (flags & 8192) + result |= 99263; + if (flags & 32768) + result |= 41919; + if (flags & 65536) + result |= 74687; + if (flags & 262144) + result |= 530912; + if (flags & 524288) + result |= 793056; + if (flags & 8388608) + result |= 8388608; + return result; + } + function recordMergedSymbol(target, source) { + if (!source.mergeId) + source.mergeId = nextMergeId++; + mergedSymbols[source.mergeId] = target; + } + function cloneSymbol(symbol) { + var result = createSymbol(symbol.flags | 33554432, symbol.name); + result.declarations = symbol.declarations.slice(0); + result.parent = symbol.parent; + if (symbol.valueDeclaration) + result.valueDeclaration = symbol.valueDeclaration; + if (symbol.constEnumOnlyModule) + result.constEnumOnlyModule = true; + if (symbol.members) + result.members = cloneSymbolTable(symbol.members); + if (symbol.exports) + result.exports = cloneSymbolTable(symbol.exports); + recordMergedSymbol(result, symbol); + return result; + } + function extendSymbol(target, source) { + if (!(target.flags & getExcludedSymbolFlags(source.flags))) { + if (source.flags & 512 && target.flags & 512 && target.constEnumOnlyModule && !source.constEnumOnlyModule) { + target.constEnumOnlyModule = false; + } + target.flags |= source.flags; + if (!target.valueDeclaration && source.valueDeclaration) + target.valueDeclaration = source.valueDeclaration; + ts.forEach(source.declarations, function (node) { + target.declarations.push(node); + }); + if (source.members) { + if (!target.members) + target.members = {}; + extendSymbolTable(target.members, source.members); + } + if (source.exports) { + if (!target.exports) + target.exports = {}; + extendSymbolTable(target.exports, source.exports); + } + recordMergedSymbol(target, source); + } + else { + var message = target.flags & 2 || source.flags & 2 ? ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0 : ts.Diagnostics.Duplicate_identifier_0; + ts.forEach(source.declarations, function (node) { + error(node.name ? node.name : node, message, symbolToString(source)); + }); + ts.forEach(target.declarations, function (node) { + error(node.name ? node.name : node, message, symbolToString(source)); + }); + } + } + function cloneSymbolTable(symbolTable) { + var result = {}; + for (var id in symbolTable) { + if (ts.hasProperty(symbolTable, id)) { + result[id] = symbolTable[id]; + } + } + return result; + } + function extendSymbolTable(target, source) { + for (var id in source) { + if (ts.hasProperty(source, id)) { + if (!ts.hasProperty(target, id)) { + target[id] = source[id]; + } + else { + var symbol = target[id]; + if (!(symbol.flags & 33554432)) { + target[id] = symbol = cloneSymbol(symbol); + } + extendSymbol(symbol, source[id]); + } + } + } + } + function getSymbolLinks(symbol) { + if (symbol.flags & 67108864) + return symbol; + if (!symbol.id) + symbol.id = nextSymbolId++; + return symbolLinks[symbol.id] || (symbolLinks[symbol.id] = {}); + } + function getNodeLinks(node) { + if (!node.id) + node.id = nextNodeId++; + return nodeLinks[node.id] || (nodeLinks[node.id] = {}); + } + function getSourceFile(node) { + return ts.getAncestor(node, 210); + } + function isGlobalSourceFile(node) { + return node.kind === 210 && !ts.isExternalModule(node); + } + function getSymbol(symbols, name, meaning) { + if (meaning && ts.hasProperty(symbols, name)) { + var symbol = symbols[name]; + ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); + if (symbol.flags & meaning) { + return symbol; + } + if (symbol.flags & 8388608) { + var target = resolveImport(symbol); + if (target === unknownSymbol || target.flags & meaning) { + return symbol; + } + } + } + } + function isDefinedBefore(node1, node2) { + var file1 = ts.getSourceFileOfNode(node1); + var file2 = ts.getSourceFileOfNode(node2); + if (file1 === file2) { + return node1.pos <= node2.pos; + } + if (!compilerOptions.out) { + return true; + } + var sourceFiles = host.getSourceFiles(); + return sourceFiles.indexOf(file1) <= sourceFiles.indexOf(file2); + } + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg) { + var result; + var lastLocation; + var propertyWithInvalidInitializer; + var errorLocation = location; + loop: while (location) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = getSymbol(location.locals, name, meaning)) { + break loop; + } + } + switch (location.kind) { + case 210: + if (!ts.isExternalModule(location)) + break; + case 198: + if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { + break loop; + } + break; + case 197: + if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { + break loop; + } + break; + case 128: + case 127: + if (location.parent.kind === 194 && !(location.flags & 128)) { + var ctor = findConstructorDeclaration(location.parent); + if (ctor && ctor.locals) { + if (getSymbol(ctor.locals, name, meaning & 107455)) { + propertyWithInvalidInitializer = location; + } + } + } + break; + case 194: + case 195: + if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { + if (lastLocation && lastLocation.flags & 128) { + error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + return undefined; + } + break loop; + } + break; + case 124: + var grandparent = location.parent.parent; + if (grandparent.kind === 194 || grandparent.kind === 195) { + if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { + error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + return undefined; + } + } + break; + case 130: + case 129: + case 131: + case 132: + case 133: + case 193: + case 159: + if (name === "arguments") { + result = argumentsSymbol; + break loop; + } + break; + case 158: + if (name === "arguments") { + result = argumentsSymbol; + break loop; + } + var id = location.name; + if (id && name === id.text) { + result = location.symbol; + break loop; + } + break; + case 206: + var id = location.name; + if (name === id.text) { + result = location.symbol; + break loop; + } + break; + } + lastLocation = location; + location = location.parent; + } + if (!result) { + result = getSymbol(globals, name, meaning); + } + if (!result) { + if (nameNotFoundMessage) { + error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + } + return undefined; + } + if (nameNotFoundMessage) { + if (propertyWithInvalidInitializer) { + var propertyName = propertyWithInvalidInitializer.name; + error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + return undefined; + } + if (result.flags & 2) { + var declaration = ts.forEach(result.declarations, function (d) { return ts.getCombinedNodeFlags(d) & 6144 ? d : undefined; }); + ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); + if (!isDefinedBefore(declaration, errorLocation)) { + error(errorLocation, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.declarationNameToString(declaration.name)); + } + } + } + return result; + } + function resolveImport(symbol) { + ts.Debug.assert((symbol.flags & 8388608) !== 0, "Should only get Imports here."); + var links = getSymbolLinks(symbol); + if (!links.target) { + links.target = resolvingSymbol; + var node = ts.getDeclarationOfKind(symbol, 200); + if (node.moduleReference.kind === 202) { + if (node.moduleReference.expression.kind !== 8) { + grammarErrorOnNode(node.moduleReference.expression, ts.Diagnostics.String_literal_expected); + } + } + var target = node.moduleReference.kind === 202 ? resolveExternalModuleName(node, ts.getExternalModuleImportDeclarationExpression(node)) : getSymbolOfPartOfRightHandSideOfImport(node.moduleReference, node); + if (links.target === resolvingSymbol) { + links.target = target || unknownSymbol; + } + else { + error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol)); + } + } + else if (links.target === resolvingSymbol) { + links.target = unknownSymbol; + } + return links.target; + } + function getSymbolOfPartOfRightHandSideOfImport(entityName, importDeclaration) { + if (!importDeclaration) { + importDeclaration = ts.getAncestor(entityName, 200); + ts.Debug.assert(importDeclaration !== undefined); + } + if (entityName.kind === 64 && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + entityName = entityName.parent; + } + if (entityName.kind === 64 || entityName.parent.kind === 123) { + return resolveEntityName(importDeclaration, entityName, 1536); + } + else { + ts.Debug.assert(entityName.parent.kind === 200); + return resolveEntityName(importDeclaration, entityName, 107455 | 793056 | 1536); + } + } + function getFullyQualifiedName(symbol) { + return symbol.parent ? getFullyQualifiedName(symbol.parent) + "." + symbolToString(symbol) : symbolToString(symbol); + } + function resolveEntityName(location, name, meaning) { + if (ts.getFullWidth(name) === 0) { + return undefined; + } + if (name.kind === 64) { + var symbol = resolveName(location, name.text, meaning, ts.Diagnostics.Cannot_find_name_0, name); + if (!symbol) { + return; + } + } + else if (name.kind === 123) { + var namespace = resolveEntityName(location, name.left, 1536); + if (!namespace || namespace === unknownSymbol || ts.getFullWidth(name.right) === 0) + return; + var symbol = getSymbol(namespace.exports, name.right.text, meaning); + if (!symbol) { + error(location, ts.Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(name.right)); + return; + } + } + ts.Debug.assert((symbol.flags & 16777216) === 0, "Should never get an instantiated symbol here."); + return symbol.flags & meaning ? symbol : resolveImport(symbol); + } + function isExternalModuleNameRelative(moduleName) { + return moduleName.substr(0, 2) === "./" || moduleName.substr(0, 3) === "../" || moduleName.substr(0, 2) === ".\\" || moduleName.substr(0, 3) === "..\\"; + } + function resolveExternalModuleName(location, moduleReferenceExpression) { + if (moduleReferenceExpression.kind !== 8) { + return; + } + var moduleReferenceLiteral = moduleReferenceExpression; + var searchPath = ts.getDirectoryPath(getSourceFile(location).fileName); + var moduleName = ts.escapeIdentifier(moduleReferenceLiteral.text); + if (!moduleName) + return; + var isRelative = isExternalModuleNameRelative(moduleName); + if (!isRelative) { + var symbol = getSymbol(globals, '"' + moduleName + '"', 512); + if (symbol) { + return getResolvedExportSymbol(symbol); + } + } + while (true) { + var fileName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + var sourceFile = host.getSourceFile(fileName + ".ts") || host.getSourceFile(fileName + ".d.ts"); + if (sourceFile || isRelative) + break; + var parentPath = ts.getDirectoryPath(searchPath); + if (parentPath === searchPath) + break; + searchPath = parentPath; + } + if (sourceFile) { + if (sourceFile.symbol) { + return getResolvedExportSymbol(sourceFile.symbol); + } + error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_an_external_module, sourceFile.fileName); + return; + } + error(moduleReferenceLiteral, ts.Diagnostics.Cannot_find_external_module_0, moduleName); + } + function getResolvedExportSymbol(moduleSymbol) { + var symbol = getExportAssignmentSymbol(moduleSymbol); + if (symbol) { + if (symbol.flags & (107455 | 793056 | 1536)) { + return symbol; + } + if (symbol.flags & 8388608) { + return resolveImport(symbol); + } + } + return moduleSymbol; + } + function getExportAssignmentSymbol(symbol) { + checkTypeOfExportAssignmentSymbol(symbol); + var symbolLinks = getSymbolLinks(symbol); + return symbolLinks.exportAssignSymbol === unknownSymbol ? undefined : symbolLinks.exportAssignSymbol; + } + function checkTypeOfExportAssignmentSymbol(containerSymbol) { + var symbolLinks = getSymbolLinks(containerSymbol); + if (!symbolLinks.exportAssignSymbol) { + var exportInformation = collectExportInformationForSourceFileOrModule(containerSymbol); + if (exportInformation.exportAssignments.length) { + if (exportInformation.exportAssignments.length > 1) { + ts.forEach(exportInformation.exportAssignments, function (node) { return error(node, ts.Diagnostics.A_module_cannot_have_more_than_one_export_assignment); }); + } + var node = exportInformation.exportAssignments[0]; + if (exportInformation.hasExportedMember) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements); + } + if (node.exportName.text) { + var meaning = 107455 | 793056 | 1536; + var exportSymbol = resolveName(node, node.exportName.text, meaning, ts.Diagnostics.Cannot_find_name_0, node.exportName); + } + } + symbolLinks.exportAssignSymbol = exportSymbol || unknownSymbol; + } + } + function collectExportInformationForSourceFileOrModule(symbol) { + var seenExportedMember = false; + var result = []; + ts.forEach(symbol.declarations, function (declaration) { + var block = (declaration.kind === 210 ? declaration : declaration.body); + ts.forEach(block.statements, function (node) { + if (node.kind === 201) { + result.push(node); + } + else { + seenExportedMember = seenExportedMember || (node.flags & 1) !== 0; + } + }); + }); + return { + hasExportedMember: seenExportedMember, + exportAssignments: result + }; + } + function getMergedSymbol(symbol) { + var merged; + return symbol && symbol.mergeId && (merged = mergedSymbols[symbol.mergeId]) ? merged : symbol; + } + function getSymbolOfNode(node) { + return getMergedSymbol(node.symbol); + } + function getParentOfSymbol(symbol) { + return getMergedSymbol(symbol.parent); + } + function getExportSymbolOfValueSymbolIfExported(symbol) { + return symbol && (symbol.flags & 1048576) !== 0 ? getMergedSymbol(symbol.exportSymbol) : symbol; + } + function symbolIsValue(symbol) { + if (symbol.flags & 16777216) { + return symbolIsValue(getSymbolLinks(symbol).target); + } + if (symbol.flags & 107455) { + return true; + } + if (symbol.flags & 8388608) { + return (resolveImport(symbol).flags & 107455) !== 0; + } + return false; + } + function findConstructorDeclaration(node) { + var members = node.members; + for (var i = 0; i < members.length; i++) { + var member = members[i]; + if (member.kind === 131 && ts.nodeIsPresent(member.body)) { + return member; + } + } + } + function createType(flags) { + var result = new Type(checker, flags); + result.id = typeCount++; + return result; + } + function createIntrinsicType(kind, intrinsicName) { + var type = createType(kind); + type.intrinsicName = intrinsicName; + return type; + } + function createObjectType(kind, symbol) { + var type = createType(kind); + type.symbol = symbol; + return type; + } + function isReservedMemberName(name) { + return name.charCodeAt(0) === 95 && + name.charCodeAt(1) === 95 && + name.charCodeAt(2) !== 95 && + name.charCodeAt(2) !== 64; + } + function getNamedMembers(members) { + var result; + for (var id in members) { + if (ts.hasProperty(members, id)) { + if (!isReservedMemberName(id)) { + if (!result) + result = []; + var symbol = members[id]; + if (symbolIsValue(symbol)) { + result.push(symbol); + } + } + } + } + return result || emptyArray; + } + function setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { + type.members = members; + type.properties = getNamedMembers(members); + type.callSignatures = callSignatures; + type.constructSignatures = constructSignatures; + if (stringIndexType) + type.stringIndexType = stringIndexType; + if (numberIndexType) + type.numberIndexType = numberIndexType; + return type; + } + function createAnonymousType(symbol, members, callSignatures, constructSignatures, stringIndexType, numberIndexType) { + return setObjectTypeMembers(createObjectType(32768, symbol), members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function forEachSymbolTableInScope(enclosingDeclaration, callback) { + var result; + for (var location = enclosingDeclaration; location; location = location.parent) { + if (location.locals && !isGlobalSourceFile(location)) { + if (result = callback(location.locals)) { + return result; + } + } + switch (location.kind) { + case 210: + if (!ts.isExternalModule(location)) { + break; + } + case 198: + if (result = callback(getSymbolOfNode(location).exports)) { + return result; + } + break; + case 194: + case 195: + if (result = callback(getSymbolOfNode(location).members)) { + return result; + } + break; + } + } + return callback(globals); + } + function getQualifiedLeftMeaning(rightMeaning) { + return rightMeaning === 107455 ? 107455 : 1536; + } + function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) { + function getAccessibleSymbolChainFromSymbolTable(symbols) { + function canQualifySymbol(symbolFromSymbolTable, meaning) { + if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) { + return true; + } + var accessibleParent = getAccessibleSymbolChain(symbolFromSymbolTable.parent, enclosingDeclaration, getQualifiedLeftMeaning(meaning), useOnlyExternalAliasing); + return !!accessibleParent; + } + function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { + if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { + return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && + canQualifySymbol(symbolFromSymbolTable, meaning); + } + } + if (isAccessible(ts.lookUp(symbols, symbol.name))) { + return [symbol]; + } + return ts.forEachValue(symbols, function (symbolFromSymbolTable) { + if (symbolFromSymbolTable.flags & 8388608) { + if (!useOnlyExternalAliasing || + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportDeclaration)) { + var resolvedImportedSymbol = resolveImport(symbolFromSymbolTable); + if (isAccessible(symbolFromSymbolTable, resolveImport(symbolFromSymbolTable))) { + return [symbolFromSymbolTable]; + } + var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined; + if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) { + return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports); + } + } + } + }); + } + if (symbol) { + return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); + } + } + function needsQualification(symbol, enclosingDeclaration, meaning) { + var qualify = false; + forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) { + if (!ts.hasProperty(symbolTable, symbol.name)) { + return false; + } + var symbolFromSymbolTable = symbolTable[symbol.name]; + if (symbolFromSymbolTable === symbol) { + return true; + } + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608) ? resolveImport(symbolFromSymbolTable) : symbolFromSymbolTable; + if (symbolFromSymbolTable.flags & meaning) { + qualify = true; + return true; + } + return false; + }); + return qualify; + } + function isSymbolAccessible(symbol, enclosingDeclaration, meaning) { + if (symbol && enclosingDeclaration && !(symbol.flags & 262144)) { + var initialSymbol = symbol; + var meaningToLook = meaning; + while (symbol) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaningToLook, false); + if (accessibleSymbolChain) { + var hasAccessibleDeclarations = hasVisibleDeclarations(accessibleSymbolChain[0]); + if (!hasAccessibleDeclarations) { + return { + accessibility: 1, + errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning), + errorModuleName: symbol !== initialSymbol ? symbolToString(symbol, enclosingDeclaration, 1536) : undefined + }; + } + return hasAccessibleDeclarations; + } + meaningToLook = getQualifiedLeftMeaning(meaning); + symbol = getParentOfSymbol(symbol); + } + var symbolExternalModule = ts.forEach(initialSymbol.declarations, getExternalModuleContainer); + if (symbolExternalModule) { + var enclosingExternalModule = getExternalModuleContainer(enclosingDeclaration); + if (symbolExternalModule !== enclosingExternalModule) { + return { + accessibility: 2, + errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning), + errorModuleName: symbolToString(symbolExternalModule) + }; + } + } + return { + accessibility: 1, + errorSymbolName: symbolToString(initialSymbol, enclosingDeclaration, meaning) + }; + } + return { accessibility: 0 }; + function getExternalModuleContainer(declaration) { + for (; declaration; declaration = declaration.parent) { + if (hasExternalModuleSymbol(declaration)) { + return getSymbolOfNode(declaration); + } + } + } + } + function hasExternalModuleSymbol(declaration) { + return (declaration.kind === 198 && declaration.name.kind === 8) || + (declaration.kind === 210 && ts.isExternalModule(declaration)); + } + function hasVisibleDeclarations(symbol) { + var aliasesToMakeVisible; + if (ts.forEach(symbol.declarations, function (declaration) { return !getIsDeclarationVisible(declaration); })) { + return undefined; + } + return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible }; + function getIsDeclarationVisible(declaration) { + if (!isDeclarationVisible(declaration)) { + if (declaration.kind === 200 && + !(declaration.flags & 1) && + isDeclarationVisible(declaration.parent)) { + getNodeLinks(declaration).isVisible = true; + if (aliasesToMakeVisible) { + if (!ts.contains(aliasesToMakeVisible, declaration)) { + aliasesToMakeVisible.push(declaration); + } + } + else { + aliasesToMakeVisible = [declaration]; + } + return true; + } + return false; + } + return true; + } + } + function isEntityNameVisible(entityName, enclosingDeclaration) { + var meaning; + if (entityName.parent.kind === 140) { + meaning = 107455 | 1048576; + } + else if (entityName.kind === 123 || + entityName.parent.kind === 200) { + meaning = 1536; + } + else { + meaning = 793056; + } + var firstIdentifier = getFirstIdentifier(entityName); + var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, undefined, undefined); + return (symbol && hasVisibleDeclarations(symbol)) || { + accessibility: 1, + errorSymbolName: ts.getTextOfNode(firstIdentifier), + errorNode: firstIdentifier + }; + } + function writeKeyword(writer, kind) { + writer.writeKeyword(ts.tokenToString(kind)); + } + function writePunctuation(writer, kind) { + writer.writePunctuation(ts.tokenToString(kind)); + } + function writeSpace(writer) { + writer.writeSpace(" "); + } + function symbolToString(symbol, enclosingDeclaration, meaning) { + var writer = ts.getSingleLineStringWriter(); + getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning); + var result = writer.string(); + ts.releaseStringWriter(writer); + return result; + } + function typeToString(type, enclosingDeclaration, flags) { + var writer = ts.getSingleLineStringWriter(); + getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); + var result = writer.string(); + ts.releaseStringWriter(writer); + var maxLength = compilerOptions.noErrorTruncation || flags & 4 ? undefined : 100; + if (maxLength && result.length >= maxLength) { + result = result.substr(0, maxLength - "...".length) + "..."; + } + return result; + } + function getTypeAliasForTypeLiteral(type) { + if (type.symbol && type.symbol.flags & 2048) { + var node = type.symbol.declarations[0].parent; + while (node.kind === 145) { + node = node.parent; + } + if (node.kind === 196) { + return getSymbolOfNode(node); + } + } + return undefined; + } + var _displayBuilder; + function getSymbolDisplayBuilder() { + function appendSymbolNameOnly(symbol, writer) { + if (symbol.declarations && symbol.declarations.length > 0) { + var declaration = symbol.declarations[0]; + if (declaration.name) { + writer.writeSymbol(ts.declarationNameToString(declaration.name), symbol); + return; + } + } + writer.writeSymbol(symbol.name, symbol); + } + function buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags, typeFlags) { + var parentSymbol; + function appendParentTypeArgumentsAndSymbolName(symbol) { + if (parentSymbol) { + if (flags & 1) { + if (symbol.flags & 16777216) { + buildDisplayForTypeArgumentsAndDelimiters(getTypeParametersOfClassOrInterface(parentSymbol), symbol.mapper, writer, enclosingDeclaration); + } + else { + buildTypeParameterDisplayFromSymbol(parentSymbol, writer, enclosingDeclaration); + } + } + writePunctuation(writer, 20); + } + parentSymbol = symbol; + appendSymbolNameOnly(symbol, writer); + } + writer.trackSymbol(symbol, enclosingDeclaration, meaning); + function walkSymbol(symbol, meaning) { + if (symbol) { + var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); + if (!accessibleSymbolChain || + needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); + } + if (accessibleSymbolChain) { + for (var i = 0, n = accessibleSymbolChain.length; i < n; i++) { + appendParentTypeArgumentsAndSymbolName(accessibleSymbolChain[i]); + } + } + else { + if (!parentSymbol && ts.forEach(symbol.declarations, hasExternalModuleSymbol)) { + return; + } + if (symbol.flags & 2048 || symbol.flags & 4096) { + return; + } + appendParentTypeArgumentsAndSymbolName(symbol); + } + } + } + var isTypeParameter = symbol.flags & 262144; + var typeFormatFlag = 128 & typeFlags; + if (!isTypeParameter && (enclosingDeclaration || typeFormatFlag)) { + walkSymbol(symbol, meaning); + return; + } + return appendParentTypeArgumentsAndSymbolName(symbol); + } + function buildTypeDisplay(type, writer, enclosingDeclaration, globalFlags, typeStack) { + var globalFlagsToPass = globalFlags & 16; + return writeType(type, globalFlags); + function writeType(type, flags) { + if (type.flags & 1048703) { + writer.writeKeyword(!(globalFlags & 16) && + (type.flags & 1) ? "any" : type.intrinsicName); + } + else if (type.flags & 4096) { + writeTypeReference(type, flags); + } + else if (type.flags & (1024 | 2048 | 128 | 512)) { + buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793056, 0, flags); + } + else if (type.flags & 8192) { + writeTupleType(type); + } + else if (type.flags & 16384) { + writeUnionType(type, flags); + } + else if (type.flags & 32768) { + writeAnonymousType(type, flags); + } + else if (type.flags & 256) { + writer.writeStringLiteral(type.text); + } + else { + writePunctuation(writer, 14); + writeSpace(writer); + writePunctuation(writer, 21); + writeSpace(writer); + writePunctuation(writer, 15); + } + } + function writeTypeList(types, union) { + for (var i = 0; i < types.length; i++) { + if (i > 0) { + if (union) { + writeSpace(writer); + } + writePunctuation(writer, union ? 44 : 23); + writeSpace(writer); + } + writeType(types[i], union ? 64 : 0); + } + } + function writeTypeReference(type, flags) { + if (type.target === globalArrayType && !(flags & 1)) { + writeType(type.typeArguments[0], 64); + writePunctuation(writer, 18); + writePunctuation(writer, 19); + } + else { + buildSymbolDisplay(type.target.symbol, writer, enclosingDeclaration, 793056); + writePunctuation(writer, 24); + writeTypeList(type.typeArguments, false); + writePunctuation(writer, 25); + } + } + function writeTupleType(type) { + writePunctuation(writer, 18); + writeTypeList(type.elementTypes, false); + writePunctuation(writer, 19); + } + function writeUnionType(type, flags) { + if (flags & 64) { + writePunctuation(writer, 16); + } + writeTypeList(type.types, true); + if (flags & 64) { + writePunctuation(writer, 17); + } + } + function writeAnonymousType(type, flags) { + if (type.symbol && type.symbol.flags & (32 | 384 | 512)) { + writeTypeofSymbol(type, flags); + } + else if (shouldWriteTypeOfFunctionSymbol()) { + writeTypeofSymbol(type, flags); + } + else if (typeStack && ts.contains(typeStack, type)) { + var typeAlias = getTypeAliasForTypeLiteral(type); + if (typeAlias) { + buildSymbolDisplay(typeAlias, writer, enclosingDeclaration, 793056, 0, flags); + } + else { + writeKeyword(writer, 110); + } + } + else { + if (!typeStack) { + typeStack = []; + } + typeStack.push(type); + writeLiteralType(type, flags); + typeStack.pop(); + } + function shouldWriteTypeOfFunctionSymbol() { + if (type.symbol) { + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && + ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128; })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && + (type.symbol.parent || + ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.parent.kind === 210 || declaration.parent.kind === 199; + })); + if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { + return !!(flags & 2) || + (typeStack && ts.contains(typeStack, type)); + } + } + } + } + function writeTypeofSymbol(type, typeFormatFlags) { + writeKeyword(writer, 96); + writeSpace(writer); + buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags); + } + function getIndexerParameterName(type, indexKind, fallbackName) { + var declaration = getIndexDeclarationOfSymbol(type.symbol, indexKind); + if (!declaration) { + return fallbackName; + } + ts.Debug.assert(declaration.parameters.length !== 0); + return ts.declarationNameToString(declaration.parameters[0].name); + } + function writeLiteralType(type, flags) { + var resolved = resolveObjectOrUnionTypeMembers(type); + if (!resolved.properties.length && !resolved.stringIndexType && !resolved.numberIndexType) { + if (!resolved.callSignatures.length && !resolved.constructSignatures.length) { + writePunctuation(writer, 14); + writePunctuation(writer, 15); + return; + } + if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { + if (flags & 64) { + writePunctuation(writer, 16); + } + buildSignatureDisplay(resolved.callSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, typeStack); + if (flags & 64) { + writePunctuation(writer, 17); + } + return; + } + if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { + if (flags & 64) { + writePunctuation(writer, 16); + } + writeKeyword(writer, 87); + writeSpace(writer); + buildSignatureDisplay(resolved.constructSignatures[0], writer, enclosingDeclaration, globalFlagsToPass | 8, typeStack); + if (flags & 64) { + writePunctuation(writer, 17); + } + return; + } + } + writePunctuation(writer, 14); + writer.writeLine(); + writer.increaseIndent(); + for (var i = 0; i < resolved.callSignatures.length; i++) { + buildSignatureDisplay(resolved.callSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + writePunctuation(writer, 22); + writer.writeLine(); + } + for (var i = 0; i < resolved.constructSignatures.length; i++) { + writeKeyword(writer, 87); + writeSpace(writer); + buildSignatureDisplay(resolved.constructSignatures[i], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + writePunctuation(writer, 22); + writer.writeLine(); + } + if (resolved.stringIndexType) { + writePunctuation(writer, 18); + writer.writeParameter(getIndexerParameterName(resolved, 0, "x")); + writePunctuation(writer, 51); + writeSpace(writer); + writeKeyword(writer, 119); + writePunctuation(writer, 19); + writePunctuation(writer, 51); + writeSpace(writer); + writeType(resolved.stringIndexType, 0); + writePunctuation(writer, 22); + writer.writeLine(); + } + if (resolved.numberIndexType) { + writePunctuation(writer, 18); + writer.writeParameter(getIndexerParameterName(resolved, 1, "x")); + writePunctuation(writer, 51); + writeSpace(writer); + writeKeyword(writer, 117); + writePunctuation(writer, 19); + writePunctuation(writer, 51); + writeSpace(writer); + writeType(resolved.numberIndexType, 0); + writePunctuation(writer, 22); + writer.writeLine(); + } + for (var i = 0; i < resolved.properties.length; i++) { + var p = resolved.properties[i]; + var t = getTypeOfSymbol(p); + if (p.flags & (16 | 8192) && !getPropertiesOfObjectType(t).length) { + var signatures = getSignaturesOfType(t, 0); + for (var j = 0; j < signatures.length; j++) { + buildSymbolDisplay(p, writer); + if (p.flags & 536870912) { + writePunctuation(writer, 50); + } + buildSignatureDisplay(signatures[j], writer, enclosingDeclaration, globalFlagsToPass, typeStack); + writePunctuation(writer, 22); + writer.writeLine(); + } + } + else { + buildSymbolDisplay(p, writer); + if (p.flags & 536870912) { + writePunctuation(writer, 50); + } + writePunctuation(writer, 51); + writeSpace(writer); + writeType(t, 0); + writePunctuation(writer, 22); + writer.writeLine(); + } + } + writer.decreaseIndent(); + writePunctuation(writer, 15); + } + } + function buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaraiton, flags) { + var targetSymbol = getTargetSymbol(symbol); + if (targetSymbol.flags & 32 || targetSymbol.flags & 64) { + buildDisplayForTypeParametersAndDelimiters(getTypeParametersOfClassOrInterface(symbol), writer, enclosingDeclaraiton, flags); + } + } + function buildTypeParameterDisplay(tp, writer, enclosingDeclaration, flags, typeStack) { + appendSymbolNameOnly(tp.symbol, writer); + var constraint = getConstraintOfTypeParameter(tp); + if (constraint) { + writeSpace(writer); + writeKeyword(writer, 78); + writeSpace(writer); + buildTypeDisplay(constraint, writer, enclosingDeclaration, flags, typeStack); + } + } + function buildParameterDisplay(p, writer, enclosingDeclaration, flags, typeStack) { + if (ts.hasDotDotDotToken(p.valueDeclaration)) { + writePunctuation(writer, 21); + } + appendSymbolNameOnly(p, writer); + if (ts.hasQuestionToken(p.valueDeclaration) || p.valueDeclaration.initializer) { + writePunctuation(writer, 50); + } + writePunctuation(writer, 51); + writeSpace(writer); + buildTypeDisplay(getTypeOfSymbol(p), writer, enclosingDeclaration, flags, typeStack); + } + function buildDisplayForTypeParametersAndDelimiters(typeParameters, writer, enclosingDeclaration, flags, typeStack) { + if (typeParameters && typeParameters.length) { + writePunctuation(writer, 24); + for (var i = 0; i < typeParameters.length; i++) { + if (i > 0) { + writePunctuation(writer, 23); + writeSpace(writer); + } + buildTypeParameterDisplay(typeParameters[i], writer, enclosingDeclaration, flags, typeStack); + } + writePunctuation(writer, 25); + } + } + function buildDisplayForTypeArgumentsAndDelimiters(typeParameters, mapper, writer, enclosingDeclaration, flags, typeStack) { + if (typeParameters && typeParameters.length) { + writePunctuation(writer, 24); + for (var i = 0; i < typeParameters.length; i++) { + if (i > 0) { + writePunctuation(writer, 23); + writeSpace(writer); + } + buildTypeDisplay(mapper(typeParameters[i]), writer, enclosingDeclaration, 0); + } + writePunctuation(writer, 25); + } + } + function buildDisplayForParametersAndDelimiters(parameters, writer, enclosingDeclaration, flags, typeStack) { + writePunctuation(writer, 16); + for (var i = 0; i < parameters.length; i++) { + if (i > 0) { + writePunctuation(writer, 23); + writeSpace(writer); + } + buildParameterDisplay(parameters[i], writer, enclosingDeclaration, flags, typeStack); + } + writePunctuation(writer, 17); + } + function buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, typeStack) { + if (flags & 8) { + writeSpace(writer); + writePunctuation(writer, 32); + } + else { + writePunctuation(writer, 51); + } + writeSpace(writer); + buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags, typeStack); + } + function buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, typeStack) { + if (signature.target && (flags & 32)) { + buildDisplayForTypeArgumentsAndDelimiters(signature.target.typeParameters, signature.mapper, writer, enclosingDeclaration); + } + else { + buildDisplayForTypeParametersAndDelimiters(signature.typeParameters, writer, enclosingDeclaration, flags, typeStack); + } + buildDisplayForParametersAndDelimiters(signature.parameters, writer, enclosingDeclaration, flags, typeStack); + buildReturnTypeDisplay(signature, writer, enclosingDeclaration, flags, typeStack); + } + return _displayBuilder || (_displayBuilder = { + symbolToString: symbolToString, + typeToString: typeToString, + buildSymbolDisplay: buildSymbolDisplay, + buildTypeDisplay: buildTypeDisplay, + buildTypeParameterDisplay: buildTypeParameterDisplay, + buildParameterDisplay: buildParameterDisplay, + buildDisplayForParametersAndDelimiters: buildDisplayForParametersAndDelimiters, + buildDisplayForTypeParametersAndDelimiters: buildDisplayForTypeParametersAndDelimiters, + buildDisplayForTypeArgumentsAndDelimiters: buildDisplayForTypeArgumentsAndDelimiters, + buildTypeParameterDisplayFromSymbol: buildTypeParameterDisplayFromSymbol, + buildSignatureDisplay: buildSignatureDisplay, + buildReturnTypeDisplay: buildReturnTypeDisplay + }); + } + function isDeclarationVisible(node) { + function getContainingExternalModule(node) { + for (; node; node = node.parent) { + if (node.kind === 198) { + if (node.name.kind === 8) { + return node; + } + } + else if (node.kind === 210) { + return ts.isExternalModule(node) ? node : undefined; + } + } + ts.Debug.fail("getContainingModule cant reach here"); + } + function isUsedInExportAssignment(node) { + var externalModule = getContainingExternalModule(node); + if (externalModule) { + var externalModuleSymbol = getSymbolOfNode(externalModule); + var exportAssignmentSymbol = getExportAssignmentSymbol(externalModuleSymbol); + var resolvedExportSymbol; + var symbolOfNode = getSymbolOfNode(node); + if (isSymbolUsedInExportAssignment(symbolOfNode)) { + return true; + } + if (symbolOfNode.flags & 8388608) { + return isSymbolUsedInExportAssignment(resolveImport(symbolOfNode)); + } + } + function isSymbolUsedInExportAssignment(symbol) { + if (exportAssignmentSymbol === symbol) { + return true; + } + if (exportAssignmentSymbol && !!(exportAssignmentSymbol.flags & 8388608)) { + resolvedExportSymbol = resolvedExportSymbol || resolveImport(exportAssignmentSymbol); + if (resolvedExportSymbol === symbol) { + return true; + } + return ts.forEach(resolvedExportSymbol.declarations, function (current) { + while (current) { + if (current === node) { + return true; + } + current = current.parent; + } + }); + } + } + } + function determineIfDeclarationIsVisible() { + switch (node.kind) { + case 191: + case 148: + case 198: + case 194: + case 195: + case 196: + case 193: + case 197: + case 200: + var parent = getDeclarationContainer(node); + if (!(ts.getCombinedNodeFlags(node) & 1) && + !(node.kind !== 200 && parent.kind !== 210 && ts.isInAmbientContext(parent))) { + return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); + } + return isDeclarationVisible(parent); + case 128: + case 127: + case 132: + case 133: + case 130: + case 129: + if (node.flags & (32 | 64)) { + return false; + } + case 131: + case 135: + case 134: + case 136: + case 126: + case 199: + case 138: + case 139: + case 141: + case 137: + case 142: + case 143: + case 144: + case 145: + return isDeclarationVisible(node.parent); + case 125: + case 210: + return true; + default: + ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); + } + } + if (node) { + var links = getNodeLinks(node); + if (links.isVisible === undefined) { + links.isVisible = !!determineIfDeclarationIsVisible(); + } + return links.isVisible; + } + } + function getRootDeclaration(node) { + while (node.kind === 148) { + node = node.parent.parent; + } + return node; + } + function getDeclarationContainer(node) { + node = getRootDeclaration(node); + return node.kind === 191 ? node.parent.parent.parent : node.parent; + } + function getTypeOfPrototypeProperty(prototype) { + var classType = getDeclaredTypeOfSymbol(prototype.parent); + return classType.typeParameters ? createTypeReference(classType, ts.map(classType.typeParameters, function (_) { return anyType; })) : classType; + } + function getTypeOfPropertyOfType(type, name) { + var prop = getPropertyOfType(type, name); + return prop ? getTypeOfSymbol(prop) : undefined; + } + function getTypeForBindingElement(declaration) { + var pattern = declaration.parent; + var parentType = getTypeForVariableLikeDeclaration(pattern.parent); + if (parentType === unknownType) { + return unknownType; + } + if (!parentType || parentType === anyType) { + if (declaration.initializer) { + return checkExpressionCached(declaration.initializer); + } + return parentType; + } + if (pattern.kind === 146) { + var name = declaration.propertyName || declaration.name; + var type = getTypeOfPropertyOfType(parentType, name.text) || + isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1) || + getIndexTypeOfType(parentType, 0); + if (!type) { + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); + return unknownType; + } + } + else { + if (!isArrayLikeType(parentType)) { + error(pattern, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(parentType)); + return unknownType; + } + if (!declaration.dotDotDotToken) { + var propName = "" + ts.indexOf(pattern.elements, declaration); + var type = isTupleLikeType(parentType) ? getTypeOfPropertyOfType(parentType, propName) : getIndexTypeOfType(parentType, 1); + if (!type) { + error(declaration, ts.Diagnostics.Type_0_has_no_property_1, typeToString(parentType), propName); + return unknownType; + } + } + else { + var type = createArrayType(getIndexTypeOfType(parentType, 1)); + } + } + return type; + } + function getTypeForVariableLikeDeclaration(declaration) { + if (declaration.parent.parent.kind === 180) { + return anyType; + } + if (ts.isBindingPattern(declaration.parent)) { + return getTypeForBindingElement(declaration); + } + if (declaration.type) { + return getTypeFromTypeNode(declaration.type); + } + if (declaration.kind === 126) { + var func = declaration.parent; + if (func.kind === 133 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 132); + if (getter) { + return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); + } + } + var type = getContextuallyTypedParameterType(declaration); + if (type) { + return type; + } + } + if (declaration.initializer) { + return checkExpressionCached(declaration.initializer); + } + if (declaration.kind === 208) { + return checkIdentifier(declaration.name); + } + return undefined; + } + function getTypeFromBindingElement(element) { + if (element.initializer) { + return getWidenedType(checkExpressionCached(element.initializer)); + } + if (ts.isBindingPattern(element.name)) { + return getTypeFromBindingPattern(element.name); + } + return anyType; + } + function getTypeFromObjectBindingPattern(pattern) { + var members = {}; + ts.forEach(pattern.elements, function (e) { + var flags = 4 | 67108864 | (e.initializer ? 536870912 : 0); + var name = e.propertyName || e.name; + var symbol = createSymbol(flags, name.text); + symbol.type = getTypeFromBindingElement(e); + members[symbol.name] = symbol; + }); + return createAnonymousType(undefined, members, emptyArray, emptyArray, undefined, undefined); + } + function getTypeFromArrayBindingPattern(pattern) { + var hasSpreadElement = false; + var elementTypes = []; + ts.forEach(pattern.elements, function (e) { + elementTypes.push(e.kind === 170 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + if (e.dotDotDotToken) { + hasSpreadElement = true; + } + }); + return !elementTypes.length ? anyArrayType : hasSpreadElement ? createArrayType(getUnionType(elementTypes)) : createTupleType(elementTypes); + } + function getTypeFromBindingPattern(pattern) { + return pattern.kind === 146 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); + } + function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { + var type = getTypeForVariableLikeDeclaration(declaration); + if (type) { + if (reportErrors) { + reportErrorsFromWidening(declaration, type); + } + return declaration.kind !== 207 ? getWidenedType(type) : type; + } + if (ts.isBindingPattern(declaration.name)) { + return getTypeFromBindingPattern(declaration.name); + } + type = declaration.dotDotDotToken ? anyArrayType : anyType; + if (reportErrors && compilerOptions.noImplicitAny) { + var root = getRootDeclaration(declaration); + if (!isPrivateWithinAmbient(root) && !(root.kind === 126 && isPrivateWithinAmbient(root.parent))) { + reportImplicitAnyError(declaration, type); + } + } + return type; + } + function getTypeOfVariableOrParameterOrProperty(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + if (symbol.flags & 134217728) { + return links.type = getTypeOfPrototypeProperty(symbol); + } + var declaration = symbol.valueDeclaration; + if (declaration.kind === 206) { + return links.type = anyType; + } + links.type = resolvingType; + var type = getWidenedTypeForVariableLikeDeclaration(declaration, true); + if (links.type === resolvingType) { + links.type = type; + } + } + else if (links.type === resolvingType) { + links.type = anyType; + if (compilerOptions.noImplicitAny) { + var diagnostic = symbol.valueDeclaration.type ? ts.Diagnostics._0_implicitly_has_type_any_because_it_is_referenced_directly_or_indirectly_in_its_own_type_annotation : ts.Diagnostics._0_implicitly_has_type_any_because_it_is_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer; + error(symbol.valueDeclaration, diagnostic, symbolToString(symbol)); + } + } + return links.type; + } + function getSetAccessorTypeAnnotationNode(accessor) { + return accessor && accessor.parameters.length > 0 && accessor.parameters[0].type; + } + function getAnnotatedAccessorType(accessor) { + if (accessor) { + if (accessor.kind === 132) { + return accessor.type && getTypeFromTypeNode(accessor.type); + } + else { + var setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation); + } + } + return undefined; + } + function getTypeOfAccessors(symbol) { + var links = getSymbolLinks(symbol); + checkAndStoreTypeOfAccessors(symbol, links); + return links.type; + } + function checkAndStoreTypeOfAccessors(symbol, links) { + links = links || getSymbolLinks(symbol); + if (!links.type) { + links.type = resolvingType; + var getter = ts.getDeclarationOfKind(symbol, 132); + var setter = ts.getDeclarationOfKind(symbol, 133); + var type; + var getterReturnType = getAnnotatedAccessorType(getter); + if (getterReturnType) { + type = getterReturnType; + } + else { + var setterParameterType = getAnnotatedAccessorType(setter); + if (setterParameterType) { + type = setterParameterType; + } + else { + if (getter && getter.body) { + type = getReturnTypeFromBody(getter); + } + else { + if (compilerOptions.noImplicitAny) { + error(setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_type_annotation, symbolToString(symbol)); + } + type = anyType; + } + } + } + if (links.type === resolvingType) { + links.type = type; + } + } + else if (links.type === resolvingType) { + links.type = anyType; + if (compilerOptions.noImplicitAny) { + var getter = ts.getDeclarationOfKind(symbol, 132); + error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); + } + } + } + function getTypeOfFuncClassEnumModule(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = createObjectType(32768, symbol); + } + return links.type; + } + function getTypeOfEnumMember(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = getDeclaredTypeOfEnum(getParentOfSymbol(symbol)); + } + return links.type; + } + function getTypeOfImport(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = getTypeOfSymbol(resolveImport(symbol)); + } + return links.type; + } + function getTypeOfInstantiatedSymbol(symbol) { + var links = getSymbolLinks(symbol); + if (!links.type) { + links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper); + } + return links.type; + } + function getTypeOfSymbol(symbol) { + if (symbol.flags & 16777216) { + return getTypeOfInstantiatedSymbol(symbol); + } + if (symbol.flags & (3 | 4)) { + return getTypeOfVariableOrParameterOrProperty(symbol); + } + if (symbol.flags & (16 | 8192 | 32 | 384 | 512)) { + return getTypeOfFuncClassEnumModule(symbol); + } + if (symbol.flags & 8) { + return getTypeOfEnumMember(symbol); + } + if (symbol.flags & 98304) { + return getTypeOfAccessors(symbol); + } + if (symbol.flags & 8388608) { + return getTypeOfImport(symbol); + } + return unknownType; + } + function getTargetType(type) { + return type.flags & 4096 ? type.target : type; + } + function hasBaseType(type, checkBase) { + return check(type); + function check(type) { + var target = getTargetType(type); + return target === checkBase || ts.forEach(target.baseTypes, check); + } + } + function getTypeParametersOfClassOrInterface(symbol) { + var result; + ts.forEach(symbol.declarations, function (node) { + if (node.kind === 195 || node.kind === 194) { + var declaration = node; + if (declaration.typeParameters && declaration.typeParameters.length) { + ts.forEach(declaration.typeParameters, function (node) { + var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node)); + if (!result) { + result = [tp]; + } + else if (!ts.contains(result, tp)) { + result.push(tp); + } + }); + } + } + }); + return result; + } + function getDeclaredTypeOfClass(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var type = links.declaredType = createObjectType(1024, symbol); + var typeParameters = getTypeParametersOfClassOrInterface(symbol); + if (typeParameters) { + type.flags |= 4096; + type.typeParameters = typeParameters; + type.instantiations = {}; + type.instantiations[getTypeListId(type.typeParameters)] = type; + type.target = type; + type.typeArguments = type.typeParameters; + } + type.baseTypes = []; + var declaration = ts.getDeclarationOfKind(symbol, 194); + var baseTypeNode = ts.getClassBaseTypeNode(declaration); + if (baseTypeNode) { + var baseType = getTypeFromTypeReferenceNode(baseTypeNode); + if (baseType !== unknownType) { + if (getTargetType(baseType).flags & 1024) { + if (type !== baseType && !hasBaseType(baseType, type)) { + type.baseTypes.push(baseType); + } + else { + error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); + } + } + else { + error(baseTypeNode, ts.Diagnostics.A_class_may_only_extend_another_class); + } + } + } + type.declaredProperties = getNamedMembers(symbol.members); + type.declaredCallSignatures = emptyArray; + type.declaredConstructSignatures = emptyArray; + type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0); + type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1); + } + return links.declaredType; + } + function getDeclaredTypeOfInterface(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var type = links.declaredType = createObjectType(2048, symbol); + var typeParameters = getTypeParametersOfClassOrInterface(symbol); + if (typeParameters) { + type.flags |= 4096; + type.typeParameters = typeParameters; + type.instantiations = {}; + type.instantiations[getTypeListId(type.typeParameters)] = type; + type.target = type; + type.typeArguments = type.typeParameters; + } + type.baseTypes = []; + ts.forEach(symbol.declarations, function (declaration) { + if (declaration.kind === 195 && ts.getInterfaceBaseTypeNodes(declaration)) { + ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), function (node) { + var baseType = getTypeFromTypeReferenceNode(node); + if (baseType !== unknownType) { + if (getTargetType(baseType).flags & (1024 | 2048)) { + if (type !== baseType && !hasBaseType(baseType, type)) { + type.baseTypes.push(baseType); + } + else { + error(declaration, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); + } + } + else { + error(node, ts.Diagnostics.An_interface_may_only_extend_a_class_or_another_interface); + } + } + }); + } + }); + type.declaredProperties = getNamedMembers(symbol.members); + type.declaredCallSignatures = getSignaturesOfSymbol(symbol.members["__call"]); + type.declaredConstructSignatures = getSignaturesOfSymbol(symbol.members["__new"]); + type.declaredStringIndexType = getIndexTypeOfSymbol(symbol, 0); + type.declaredNumberIndexType = getIndexTypeOfSymbol(symbol, 1); + } + return links.declaredType; + } + function getDeclaredTypeOfTypeAlias(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + links.declaredType = resolvingType; + var declaration = ts.getDeclarationOfKind(symbol, 196); + var type = getTypeFromTypeNode(declaration.type); + if (links.declaredType === resolvingType) { + links.declaredType = type; + } + } + else if (links.declaredType === resolvingType) { + links.declaredType = unknownType; + var declaration = ts.getDeclarationOfKind(symbol, 196); + error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); + } + return links.declaredType; + } + function getDeclaredTypeOfEnum(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var type = createType(128); + type.symbol = symbol; + links.declaredType = type; + } + return links.declaredType; + } + function getDeclaredTypeOfTypeParameter(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + var type = createType(512); + type.symbol = symbol; + if (!ts.getDeclarationOfKind(symbol, 125).constraint) { + type.constraint = noConstraintType; + } + links.declaredType = type; + } + return links.declaredType; + } + function getDeclaredTypeOfImport(symbol) { + var links = getSymbolLinks(symbol); + if (!links.declaredType) { + links.declaredType = getDeclaredTypeOfSymbol(resolveImport(symbol)); + } + return links.declaredType; + } + function getDeclaredTypeOfSymbol(symbol) { + ts.Debug.assert((symbol.flags & 16777216) === 0); + if (symbol.flags & 32) { + return getDeclaredTypeOfClass(symbol); + } + if (symbol.flags & 64) { + return getDeclaredTypeOfInterface(symbol); + } + if (symbol.flags & 524288) { + return getDeclaredTypeOfTypeAlias(symbol); + } + if (symbol.flags & 384) { + return getDeclaredTypeOfEnum(symbol); + } + if (symbol.flags & 262144) { + return getDeclaredTypeOfTypeParameter(symbol); + } + if (symbol.flags & 8388608) { + return getDeclaredTypeOfImport(symbol); + } + return unknownType; + } + function createSymbolTable(symbols) { + var result = {}; + for (var i = 0; i < symbols.length; i++) { + var symbol = symbols[i]; + result[symbol.name] = symbol; + } + return result; + } + function createInstantiatedSymbolTable(symbols, mapper) { + var result = {}; + for (var i = 0; i < symbols.length; i++) { + var symbol = symbols[i]; + result[symbol.name] = instantiateSymbol(symbol, mapper); + } + return result; + } + function addInheritedMembers(symbols, baseSymbols) { + for (var i = 0; i < baseSymbols.length; i++) { + var s = baseSymbols[i]; + if (!ts.hasProperty(symbols, s.name)) { + symbols[s.name] = s; + } + } + } + function addInheritedSignatures(signatures, baseSignatures) { + if (baseSignatures) { + for (var i = 0; i < baseSignatures.length; i++) { + signatures.push(baseSignatures[i]); + } + } + } + function resolveClassOrInterfaceMembers(type) { + var members = type.symbol.members; + var callSignatures = type.declaredCallSignatures; + var constructSignatures = type.declaredConstructSignatures; + var stringIndexType = type.declaredStringIndexType; + var numberIndexType = type.declaredNumberIndexType; + if (type.baseTypes.length) { + members = createSymbolTable(type.declaredProperties); + ts.forEach(type.baseTypes, function (baseType) { + addInheritedMembers(members, getPropertiesOfObjectType(baseType)); + callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(baseType, 0)); + constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(baseType, 1)); + stringIndexType = stringIndexType || getIndexTypeOfType(baseType, 0); + numberIndexType = numberIndexType || getIndexTypeOfType(baseType, 1); + }); + } + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function resolveTypeReferenceMembers(type) { + var target = type.target; + var mapper = createTypeMapper(target.typeParameters, type.typeArguments); + var members = createInstantiatedSymbolTable(target.declaredProperties, mapper); + var callSignatures = instantiateList(target.declaredCallSignatures, mapper, instantiateSignature); + var constructSignatures = instantiateList(target.declaredConstructSignatures, mapper, instantiateSignature); + var stringIndexType = target.declaredStringIndexType ? instantiateType(target.declaredStringIndexType, mapper) : undefined; + var numberIndexType = target.declaredNumberIndexType ? instantiateType(target.declaredNumberIndexType, mapper) : undefined; + ts.forEach(target.baseTypes, function (baseType) { + var instantiatedBaseType = instantiateType(baseType, mapper); + addInheritedMembers(members, getPropertiesOfObjectType(instantiatedBaseType)); + callSignatures = ts.concatenate(callSignatures, getSignaturesOfType(instantiatedBaseType, 0)); + constructSignatures = ts.concatenate(constructSignatures, getSignaturesOfType(instantiatedBaseType, 1)); + stringIndexType = stringIndexType || getIndexTypeOfType(instantiatedBaseType, 0); + numberIndexType = numberIndexType || getIndexTypeOfType(instantiatedBaseType, 1); + }); + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function createSignature(declaration, typeParameters, parameters, resolvedReturnType, minArgumentCount, hasRestParameter, hasStringLiterals) { + var sig = new Signature(checker); + sig.declaration = declaration; + sig.typeParameters = typeParameters; + sig.parameters = parameters; + sig.resolvedReturnType = resolvedReturnType; + sig.minArgumentCount = minArgumentCount; + sig.hasRestParameter = hasRestParameter; + sig.hasStringLiterals = hasStringLiterals; + return sig; + } + function cloneSignature(sig) { + return createSignature(sig.declaration, sig.typeParameters, sig.parameters, sig.resolvedReturnType, sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals); + } + function getDefaultConstructSignatures(classType) { + if (classType.baseTypes.length) { + var baseType = classType.baseTypes[0]; + var baseSignatures = getSignaturesOfType(getTypeOfSymbol(baseType.symbol), 1); + return ts.map(baseSignatures, function (baseSignature) { + var signature = baseType.flags & 4096 ? getSignatureInstantiation(baseSignature, baseType.typeArguments) : cloneSignature(baseSignature); + signature.typeParameters = classType.typeParameters; + signature.resolvedReturnType = classType; + return signature; + }); + } + return [createSignature(undefined, classType.typeParameters, emptyArray, classType, 0, false, false)]; + } + function createTupleTypeMemberSymbols(memberTypes) { + var members = {}; + for (var i = 0; i < memberTypes.length; i++) { + var symbol = createSymbol(4 | 67108864, "" + i); + symbol.type = memberTypes[i]; + members[i] = symbol; + } + return members; + } + function resolveTupleTypeMembers(type) { + var arrayType = resolveObjectOrUnionTypeMembers(createArrayType(getUnionType(type.elementTypes))); + var members = createTupleTypeMemberSymbols(type.elementTypes); + addInheritedMembers(members, arrayType.properties); + setObjectTypeMembers(type, members, arrayType.callSignatures, arrayType.constructSignatures, arrayType.stringIndexType, arrayType.numberIndexType); + } + function signatureListsIdentical(s, t) { + if (s.length !== t.length) { + return false; + } + for (var i = 0; i < s.length; i++) { + if (!compareSignatures(s[i], t[i], false, compareTypes)) { + return false; + } + } + return true; + } + function getUnionSignatures(types, kind) { + var signatureLists = ts.map(types, function (t) { return getSignaturesOfType(t, kind); }); + var signatures = signatureLists[0]; + for (var i = 0; i < signatures.length; i++) { + if (signatures[i].typeParameters) { + return emptyArray; + } + } + for (var i = 1; i < signatureLists.length; i++) { + if (!signatureListsIdentical(signatures, signatureLists[i])) { + return emptyArray; + } + } + var result = ts.map(signatures, cloneSignature); + for (var i = 0; i < result.length; i++) { + var s = result[i]; + s.resolvedReturnType = undefined; + s.unionSignatures = ts.map(signatureLists, function (signatures) { return signatures[i]; }); + } + return result; + } + function getUnionIndexType(types, kind) { + var indexTypes = []; + for (var i = 0; i < types.length; i++) { + var indexType = getIndexTypeOfType(types[i], kind); + if (!indexType) { + return undefined; + } + indexTypes.push(indexType); + } + return getUnionType(indexTypes); + } + function resolveUnionTypeMembers(type) { + var callSignatures = getUnionSignatures(type.types, 0); + var constructSignatures = getUnionSignatures(type.types, 1); + var stringIndexType = getUnionIndexType(type.types, 0); + var numberIndexType = getUnionIndexType(type.types, 1); + setObjectTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function resolveAnonymousTypeMembers(type) { + var symbol = type.symbol; + if (symbol.flags & 2048) { + var members = symbol.members; + var callSignatures = getSignaturesOfSymbol(members["__call"]); + var constructSignatures = getSignaturesOfSymbol(members["__new"]); + var stringIndexType = getIndexTypeOfSymbol(symbol, 0); + var numberIndexType = getIndexTypeOfSymbol(symbol, 1); + } + else { + var members = emptySymbols; + var callSignatures = emptyArray; + var constructSignatures = emptyArray; + if (symbol.flags & 1952) { + members = symbol.exports; + } + if (symbol.flags & (16 | 8192)) { + callSignatures = getSignaturesOfSymbol(symbol); + } + if (symbol.flags & 32) { + var classType = getDeclaredTypeOfClass(symbol); + constructSignatures = getSignaturesOfSymbol(symbol.members["__constructor"]); + if (!constructSignatures.length) { + constructSignatures = getDefaultConstructSignatures(classType); + } + if (classType.baseTypes.length) { + members = createSymbolTable(getNamedMembers(members)); + addInheritedMembers(members, getPropertiesOfObjectType(getTypeOfSymbol(classType.baseTypes[0].symbol))); + } + } + var stringIndexType = undefined; + var numberIndexType = (symbol.flags & 384) ? stringType : undefined; + } + setObjectTypeMembers(type, members, callSignatures, constructSignatures, stringIndexType, numberIndexType); + } + function resolveObjectOrUnionTypeMembers(type) { + if (!type.members) { + if (type.flags & (1024 | 2048)) { + resolveClassOrInterfaceMembers(type); + } + else if (type.flags & 32768) { + resolveAnonymousTypeMembers(type); + } + else if (type.flags & 8192) { + resolveTupleTypeMembers(type); + } + else if (type.flags & 16384) { + resolveUnionTypeMembers(type); + } + else { + resolveTypeReferenceMembers(type); + } + } + return type; + } + function getPropertiesOfObjectType(type) { + if (type.flags & 48128) { + return resolveObjectOrUnionTypeMembers(type).properties; + } + return emptyArray; + } + function getPropertyOfObjectType(type, name) { + if (type.flags & 48128) { + var resolved = resolveObjectOrUnionTypeMembers(type); + if (ts.hasProperty(resolved.members, name)) { + var symbol = resolved.members[name]; + if (symbolIsValue(symbol)) { + return symbol; + } + } + } + } + function getPropertiesOfUnionType(type) { + var result = []; + ts.forEach(getPropertiesOfType(type.types[0]), function (prop) { + var unionProp = getPropertyOfUnionType(type, prop.name); + if (unionProp) { + result.push(unionProp); + } + }); + return result; + } + function getPropertiesOfType(type) { + if (type.flags & 16384) { + return getPropertiesOfUnionType(type); + } + return getPropertiesOfObjectType(getApparentType(type)); + } + function getApparentType(type) { + if (type.flags & 512) { + do { + type = getConstraintOfTypeParameter(type); + } while (type && type.flags & 512); + if (!type) { + type = emptyObjectType; + } + } + if (type.flags & 258) { + type = globalStringType; + } + else if (type.flags & 132) { + type = globalNumberType; + } + else if (type.flags & 8) { + type = globalBooleanType; + } + else if (type.flags & 1048576) { + type = globalESSymbolType; + } + return type; + } + function createUnionProperty(unionType, name) { + var types = unionType.types; + var props; + for (var i = 0; i < types.length; i++) { + var type = getApparentType(types[i]); + if (type !== unknownType) { + var prop = getPropertyOfType(type, name); + if (!prop) { + return undefined; + } + if (!props) { + props = [prop]; + } + else { + props.push(prop); + } + } + } + var propTypes = []; + var declarations = []; + for (var i = 0; i < props.length; i++) { + var prop = props[i]; + if (prop.declarations) { + declarations.push.apply(declarations, prop.declarations); + } + propTypes.push(getTypeOfSymbol(prop)); + } + var result = createSymbol(4 | 67108864 | 268435456, name); + result.unionType = unionType; + result.declarations = declarations; + result.type = getUnionType(propTypes); + return result; + } + function getPropertyOfUnionType(type, name) { + var properties = type.resolvedProperties || (type.resolvedProperties = {}); + if (ts.hasProperty(properties, name)) { + return properties[name]; + } + var property = createUnionProperty(type, name); + if (property) { + properties[name] = property; + } + return property; + } + function getPropertyOfType(type, name) { + if (type.flags & 16384) { + return getPropertyOfUnionType(type, name); + } + if (!(type.flags & 48128)) { + type = getApparentType(type); + if (!(type.flags & 48128)) { + return undefined; + } + } + var resolved = resolveObjectOrUnionTypeMembers(type); + if (ts.hasProperty(resolved.members, name)) { + var symbol = resolved.members[name]; + if (symbolIsValue(symbol)) { + return symbol; + } + } + if (resolved === anyFunctionType || resolved.callSignatures.length || resolved.constructSignatures.length) { + var symbol = getPropertyOfObjectType(globalFunctionType, name); + if (symbol) + return symbol; + } + return getPropertyOfObjectType(globalObjectType, name); + } + function getSignaturesOfObjectOrUnionType(type, kind) { + if (type.flags & (48128 | 16384)) { + var resolved = resolveObjectOrUnionTypeMembers(type); + return kind === 0 ? resolved.callSignatures : resolved.constructSignatures; + } + return emptyArray; + } + function getSignaturesOfType(type, kind) { + return getSignaturesOfObjectOrUnionType(getApparentType(type), kind); + } + function getIndexTypeOfObjectOrUnionType(type, kind) { + if (type.flags & (48128 | 16384)) { + var resolved = resolveObjectOrUnionTypeMembers(type); + return kind === 0 ? resolved.stringIndexType : resolved.numberIndexType; + } + } + function getIndexTypeOfType(type, kind) { + return getIndexTypeOfObjectOrUnionType(getApparentType(type), kind); + } + function getTypeParametersFromDeclaration(typeParameterDeclarations) { + var result = []; + ts.forEach(typeParameterDeclarations, function (node) { + var tp = getDeclaredTypeOfTypeParameter(node.symbol); + if (!ts.contains(result, tp)) { + result.push(tp); + } + }); + return result; + } + function getSignatureFromDeclaration(declaration) { + var links = getNodeLinks(declaration); + if (!links.resolvedSignature) { + var classType = declaration.kind === 131 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; + var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; + var parameters = []; + var hasStringLiterals = false; + var minArgumentCount = -1; + for (var i = 0, n = declaration.parameters.length; i < n; i++) { + var param = declaration.parameters[i]; + parameters.push(param.symbol); + if (param.type && param.type.kind === 8) { + hasStringLiterals = true; + } + if (minArgumentCount < 0) { + if (param.initializer || param.questionToken || param.dotDotDotToken) { + minArgumentCount = i; + } + } + } + if (minArgumentCount < 0) { + minArgumentCount = declaration.parameters.length; + } + var returnType; + if (classType) { + returnType = classType; + } + else if (declaration.type) { + returnType = getTypeFromTypeNode(declaration.type); + } + else { + if (declaration.kind === 132 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 133); + returnType = getAnnotatedAccessorType(setter); + } + if (!returnType && ts.nodeIsMissing(declaration.body)) { + returnType = anyType; + } + } + links.resolvedSignature = createSignature(declaration, typeParameters, parameters, returnType, minArgumentCount, ts.hasRestParameters(declaration), hasStringLiterals); + } + return links.resolvedSignature; + } + function getSignaturesOfSymbol(symbol) { + if (!symbol) + return emptyArray; + var result = []; + for (var i = 0, len = symbol.declarations.length; i < len; i++) { + var node = symbol.declarations[i]; + switch (node.kind) { + case 138: + case 139: + case 193: + case 130: + case 129: + case 131: + case 134: + case 135: + case 136: + case 132: + case 133: + case 158: + case 159: + if (i > 0 && node.body) { + var previous = symbol.declarations[i - 1]; + if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { + break; + } + } + result.push(getSignatureFromDeclaration(node)); + } + } + return result; + } + function getReturnTypeOfSignature(signature) { + if (!signature.resolvedReturnType) { + signature.resolvedReturnType = resolvingType; + if (signature.target) { + var type = instantiateType(getReturnTypeOfSignature(signature.target), signature.mapper); + } + else if (signature.unionSignatures) { + var type = getUnionType(ts.map(signature.unionSignatures, getReturnTypeOfSignature)); + } + else { + var type = getReturnTypeFromBody(signature.declaration); + } + if (signature.resolvedReturnType === resolvingType) { + signature.resolvedReturnType = type; + } + } + else if (signature.resolvedReturnType === resolvingType) { + signature.resolvedReturnType = anyType; + if (compilerOptions.noImplicitAny) { + var declaration = signature.declaration; + if (declaration.name) { + error(declaration.name, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, ts.declarationNameToString(declaration.name)); + } + else { + error(declaration, ts.Diagnostics.Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions); + } + } + } + return signature.resolvedReturnType; + } + function getRestTypeOfSignature(signature) { + if (signature.hasRestParameter) { + var type = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]); + if (type.flags & 4096 && type.target === globalArrayType) { + return type.typeArguments[0]; + } + } + return anyType; + } + function getSignatureInstantiation(signature, typeArguments) { + return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), true); + } + function getErasedSignature(signature) { + if (!signature.typeParameters) + return signature; + if (!signature.erasedSignatureCache) { + if (signature.target) { + signature.erasedSignatureCache = instantiateSignature(getErasedSignature(signature.target), signature.mapper); + } + else { + signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), true); + } + } + return signature.erasedSignatureCache; + } + function getOrCreateTypeFromSignature(signature) { + if (!signature.isolatedSignatureType) { + var isConstructor = signature.declaration.kind === 131 || signature.declaration.kind === 135; + var type = createObjectType(32768 | 65536); + type.members = emptySymbols; + type.properties = emptyArray; + type.callSignatures = !isConstructor ? [signature] : emptyArray; + type.constructSignatures = isConstructor ? [signature] : emptyArray; + signature.isolatedSignatureType = type; + } + return signature.isolatedSignatureType; + } + function getIndexSymbol(symbol) { + return symbol.members["__index"]; + } + function getIndexDeclarationOfSymbol(symbol, kind) { + var syntaxKind = kind === 1 ? 117 : 119; + var indexSymbol = getIndexSymbol(symbol); + if (indexSymbol) { + var len = indexSymbol.declarations.length; + for (var i = 0; i < len; i++) { + var node = indexSymbol.declarations[i]; + if (node.parameters.length === 1) { + var parameter = node.parameters[0]; + if (parameter && parameter.type && parameter.type.kind === syntaxKind) { + return node; + } + } + } + } + return undefined; + } + function getIndexTypeOfSymbol(symbol, kind) { + var declaration = getIndexDeclarationOfSymbol(symbol, kind); + return declaration ? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType : undefined; + } + function getConstraintOfTypeParameter(type) { + if (!type.constraint) { + if (type.target) { + var targetConstraint = getConstraintOfTypeParameter(type.target); + type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; + } + else { + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 125).constraint); + } + } + return type.constraint === noConstraintType ? undefined : type.constraint; + } + function getTypeListId(types) { + switch (types.length) { + case 1: + return "" + types[0].id; + case 2: + return types[0].id + "," + types[1].id; + default: + var result = ""; + for (var i = 0; i < types.length; i++) { + if (i > 0) + result += ","; + result += types[i].id; + } + return result; + } + } + function getWideningFlagsOfTypes(types) { + var result = 0; + for (var i = 0; i < types.length; i++) { + result |= types[i].flags; + } + return result & 786432; + } + function createTypeReference(target, typeArguments) { + var id = getTypeListId(typeArguments); + var type = target.instantiations[id]; + if (!type) { + var flags = 4096 | getWideningFlagsOfTypes(typeArguments); + type = target.instantiations[id] = createObjectType(flags, target.symbol); + type.target = target; + type.typeArguments = typeArguments; + } + return type; + } + function isTypeParameterReferenceIllegalInConstraint(typeReferenceNode, typeParameterSymbol) { + var links = getNodeLinks(typeReferenceNode); + if (links.isIllegalTypeReferenceInConstraint !== undefined) { + return links.isIllegalTypeReferenceInConstraint; + } + var currentNode = typeReferenceNode; + while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { + currentNode = currentNode.parent; + } + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 125; + return links.isIllegalTypeReferenceInConstraint; + } + function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { + var typeParameterSymbol; + function check(n) { + if (n.kind === 137 && n.typeName.kind === 64) { + var links = getNodeLinks(n); + if (links.isIllegalTypeReferenceInConstraint === undefined) { + var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); + if (symbol && (symbol.flags & 262144)) { + links.isIllegalTypeReferenceInConstraint = ts.forEach(symbol.declarations, function (d) { return d.parent == typeParameter.parent; }); + } + } + if (links.isIllegalTypeReferenceInConstraint) { + error(typeParameter, ts.Diagnostics.Constraint_of_a_type_parameter_cannot_reference_any_type_parameter_from_the_same_type_parameter_list); + } + } + ts.forEachChild(n, check); + } + if (typeParameter.constraint) { + typeParameterSymbol = getSymbolOfNode(typeParameter); + check(typeParameter.constraint); + } + } + function getTypeFromTypeReferenceNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + var symbol = resolveEntityName(node, node.typeName, 793056); + if (symbol) { + var type; + if ((symbol.flags & 262144) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) { + type = unknownType; + } + else { + type = getDeclaredTypeOfSymbol(symbol); + if (type.flags & (1024 | 2048) && type.flags & 4096) { + var typeParameters = type.typeParameters; + if (node.typeArguments && node.typeArguments.length === typeParameters.length) { + type = createTypeReference(type, ts.map(node.typeArguments, getTypeFromTypeNode)); + } + else { + error(node, ts.Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, undefined, 1), typeParameters.length); + type = undefined; + } + } + else { + if (node.typeArguments) { + error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); + type = undefined; + } + } + } + } + links.resolvedType = type || unknownType; + } + return links.resolvedType; + } + function getTypeFromTypeQueryNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getWidenedType(checkExpressionOrQualifiedName(node.exprName)); + } + return links.resolvedType; + } + function getTypeOfGlobalSymbol(symbol, arity) { + function getTypeDeclaration(symbol) { + var declarations = symbol.declarations; + for (var i = 0; i < declarations.length; i++) { + var declaration = declarations[i]; + switch (declaration.kind) { + case 194: + case 195: + case 197: + return declaration; + } + } + } + if (!symbol) { + return emptyObjectType; + } + var type = getDeclaredTypeOfSymbol(symbol); + if (!(type.flags & 48128)) { + error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name); + return emptyObjectType; + } + if ((type.typeParameters ? type.typeParameters.length : 0) !== arity) { + error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbol.name, arity); + return emptyObjectType; + } + return type; + } + function getGlobalValueSymbol(name) { + return getGlobalSymbol(name, 107455, ts.Diagnostics.Cannot_find_global_value_0); + } + function getGlobalTypeSymbol(name) { + return getGlobalSymbol(name, 793056, ts.Diagnostics.Cannot_find_global_type_0); + } + function getGlobalSymbol(name, meaning, diagnostic) { + return resolveName(undefined, name, meaning, diagnostic, name); + } + function getGlobalType(name) { + return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), 0); + } + function getGlobalESSymbolConstructorSymbol() { + return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); + } + function createArrayType(elementType) { + var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); + return arrayType !== emptyObjectType ? createTypeReference(arrayType, [elementType]) : emptyObjectType; + } + function getTypeFromArrayTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType)); + } + return links.resolvedType; + } + function createTupleType(elementTypes) { + var id = getTypeListId(elementTypes); + var type = tupleTypes[id]; + if (!type) { + type = tupleTypes[id] = createObjectType(8192); + type.elementTypes = elementTypes; + } + return type; + } + function getTypeFromTupleTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = createTupleType(ts.map(node.elementTypes, getTypeFromTypeNode)); + } + return links.resolvedType; + } + function addTypeToSortedSet(sortedSet, type) { + if (type.flags & 16384) { + addTypesToSortedSet(sortedSet, type.types); + } + else { + var i = 0; + var id = type.id; + while (i < sortedSet.length && sortedSet[i].id < id) { + i++; + } + if (i === sortedSet.length || sortedSet[i].id !== id) { + sortedSet.splice(i, 0, type); + } + } + } + function addTypesToSortedSet(sortedTypes, types) { + for (var i = 0, len = types.length; i < len; i++) { + addTypeToSortedSet(sortedTypes, types[i]); + } + } + function isSubtypeOfAny(candidate, types) { + for (var i = 0, len = types.length; i < len; i++) { + if (candidate !== types[i] && isTypeSubtypeOf(candidate, types[i])) { + return true; + } + } + return false; + } + function removeSubtypes(types) { + var i = types.length; + while (i > 0) { + i--; + if (isSubtypeOfAny(types[i], types)) { + types.splice(i, 1); + } + } + } + function containsAnyType(types) { + for (var i = 0; i < types.length; i++) { + if (types[i].flags & 1) { + return true; + } + } + return false; + } + function removeAllButLast(types, typeToRemove) { + var i = types.length; + while (i > 0 && types.length > 1) { + i--; + if (types[i] === typeToRemove) { + types.splice(i, 1); + } + } + } + function getUnionType(types, noSubtypeReduction) { + if (types.length === 0) { + return emptyObjectType; + } + var sortedTypes = []; + addTypesToSortedSet(sortedTypes, types); + if (noSubtypeReduction) { + if (containsAnyType(sortedTypes)) { + return anyType; + } + removeAllButLast(sortedTypes, undefinedType); + removeAllButLast(sortedTypes, nullType); + } + else { + removeSubtypes(sortedTypes); + } + if (sortedTypes.length === 1) { + return sortedTypes[0]; + } + var id = getTypeListId(sortedTypes); + var type = unionTypes[id]; + if (!type) { + type = unionTypes[id] = createObjectType(16384 | getWideningFlagsOfTypes(sortedTypes)); + type.types = sortedTypes; + } + return type; + } + function getTypeFromUnionTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getUnionType(ts.map(node.types, getTypeFromTypeNode), true); + } + return links.resolvedType; + } + function getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = createObjectType(32768, node.symbol); + } + return links.resolvedType; + } + function getStringLiteralType(node) { + if (ts.hasProperty(stringLiteralTypes, node.text)) { + return stringLiteralTypes[node.text]; + } + var type = stringLiteralTypes[node.text] = createType(256); + type.text = ts.getTextOfNode(node); + return type; + } + function getTypeFromStringLiteral(node) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = getStringLiteralType(node); + } + return links.resolvedType; + } + function getTypeFromTypeNode(node) { + switch (node.kind) { + case 110: + return anyType; + case 119: + return stringType; + case 117: + return numberType; + case 111: + return booleanType; + case 120: + return esSymbolType; + case 98: + return voidType; + case 8: + return getTypeFromStringLiteral(node); + case 137: + return getTypeFromTypeReferenceNode(node); + case 140: + return getTypeFromTypeQueryNode(node); + case 142: + return getTypeFromArrayTypeNode(node); + case 143: + return getTypeFromTupleTypeNode(node); + case 144: + return getTypeFromUnionTypeNode(node); + case 145: + return getTypeFromTypeNode(node.type); + case 138: + case 139: + case 141: + return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); + case 64: + case 123: + var symbol = getSymbolInfo(node); + return symbol && getDeclaredTypeOfSymbol(symbol); + default: + return unknownType; + } + } + function instantiateList(items, mapper, instantiator) { + if (items && items.length) { + var result = []; + for (var i = 0; i < items.length; i++) { + result.push(instantiator(items[i], mapper)); + } + return result; + } + return items; + } + function createUnaryTypeMapper(source, target) { + return function (t) { return t === source ? target : t; }; + } + function createBinaryTypeMapper(source1, target1, source2, target2) { + return function (t) { return t === source1 ? target1 : t === source2 ? target2 : t; }; + } + function createTypeMapper(sources, targets) { + switch (sources.length) { + case 1: return createUnaryTypeMapper(sources[0], targets[0]); + case 2: return createBinaryTypeMapper(sources[0], targets[0], sources[1], targets[1]); + } + return function (t) { + for (var i = 0; i < sources.length; i++) { + if (t === sources[i]) + return targets[i]; + } + return t; + }; + } + function createUnaryTypeEraser(source) { + return function (t) { return t === source ? anyType : t; }; + } + function createBinaryTypeEraser(source1, source2) { + return function (t) { return t === source1 || t === source2 ? anyType : t; }; + } + function createTypeEraser(sources) { + switch (sources.length) { + case 1: return createUnaryTypeEraser(sources[0]); + case 2: return createBinaryTypeEraser(sources[0], sources[1]); + } + return function (t) { + for (var i = 0; i < sources.length; i++) { + if (t === sources[i]) + return anyType; + } + return t; + }; + } + function createInferenceMapper(context) { + return function (t) { + for (var i = 0; i < context.typeParameters.length; i++) { + if (t === context.typeParameters[i]) { + return getInferredType(context, i); + } + } + return t; + }; + } + function identityMapper(type) { + return type; + } + function combineTypeMappers(mapper1, mapper2) { + return function (t) { return mapper2(mapper1(t)); }; + } + function instantiateTypeParameter(typeParameter, mapper) { + var result = createType(512); + result.symbol = typeParameter.symbol; + if (typeParameter.constraint) { + result.constraint = instantiateType(typeParameter.constraint, mapper); + } + else { + result.target = typeParameter; + result.mapper = mapper; + } + return result; + } + function instantiateSignature(signature, mapper, eraseTypeParameters) { + if (signature.typeParameters && !eraseTypeParameters) { + var freshTypeParameters = instantiateList(signature.typeParameters, mapper, instantiateTypeParameter); + mapper = combineTypeMappers(createTypeMapper(signature.typeParameters, freshTypeParameters), mapper); + } + var result = createSignature(signature.declaration, freshTypeParameters, instantiateList(signature.parameters, mapper, instantiateSymbol), signature.resolvedReturnType ? instantiateType(signature.resolvedReturnType, mapper) : undefined, signature.minArgumentCount, signature.hasRestParameter, signature.hasStringLiterals); + result.target = signature; + result.mapper = mapper; + return result; + } + function instantiateSymbol(symbol, mapper) { + if (symbol.flags & 16777216) { + var links = getSymbolLinks(symbol); + symbol = links.target; + mapper = combineTypeMappers(links.mapper, mapper); + } + var result = createSymbol(16777216 | 67108864 | symbol.flags, symbol.name); + result.declarations = symbol.declarations; + result.parent = symbol.parent; + result.target = symbol; + result.mapper = mapper; + if (symbol.valueDeclaration) { + result.valueDeclaration = symbol.valueDeclaration; + } + return result; + } + function instantiateAnonymousType(type, mapper) { + var result = createObjectType(32768, type.symbol); + result.properties = instantiateList(getPropertiesOfObjectType(type), mapper, instantiateSymbol); + result.members = createSymbolTable(result.properties); + result.callSignatures = instantiateList(getSignaturesOfType(type, 0), mapper, instantiateSignature); + result.constructSignatures = instantiateList(getSignaturesOfType(type, 1), mapper, instantiateSignature); + var stringIndexType = getIndexTypeOfType(type, 0); + var numberIndexType = getIndexTypeOfType(type, 1); + if (stringIndexType) + result.stringIndexType = instantiateType(stringIndexType, mapper); + if (numberIndexType) + result.numberIndexType = instantiateType(numberIndexType, mapper); + return result; + } + function instantiateType(type, mapper) { + if (mapper !== identityMapper) { + if (type.flags & 512) { + return mapper(type); + } + if (type.flags & 32768) { + return type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 4096) ? instantiateAnonymousType(type, mapper) : type; + } + if (type.flags & 4096) { + return createTypeReference(type.target, instantiateList(type.typeArguments, mapper, instantiateType)); + } + if (type.flags & 8192) { + return createTupleType(instantiateList(type.elementTypes, mapper, instantiateType)); + } + if (type.flags & 16384) { + return getUnionType(instantiateList(type.types, mapper, instantiateType), true); + } + } + return type; + } + function isContextSensitive(node) { + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); + switch (node.kind) { + case 158: + case 159: + return isContextSensitiveFunctionLikeDeclaration(node); + case 150: + return ts.forEach(node.properties, isContextSensitive); + case 149: + return ts.forEach(node.elements, isContextSensitive); + case 166: + return isContextSensitive(node.whenTrue) || + isContextSensitive(node.whenFalse); + case 165: + return node.operatorToken.kind === 49 && + (isContextSensitive(node.left) || isContextSensitive(node.right)); + case 207: + return isContextSensitive(node.initializer); + case 130: + case 129: + return isContextSensitiveFunctionLikeDeclaration(node); + case 157: + return isContextSensitive(node.expression); + } + return false; + } + function isContextSensitiveFunctionLikeDeclaration(node) { + return !node.typeParameters && node.parameters.length && !ts.forEach(node.parameters, function (p) { return p.type; }); + } + function getTypeWithoutConstructors(type) { + if (type.flags & 48128) { + var resolved = resolveObjectOrUnionTypeMembers(type); + if (resolved.constructSignatures.length) { + var result = createObjectType(32768, type.symbol); + result.members = resolved.members; + result.properties = resolved.properties; + result.callSignatures = resolved.callSignatures; + result.constructSignatures = emptyArray; + type = result; + } + } + return type; + } + var subtypeRelation = {}; + var assignableRelation = {}; + var identityRelation = {}; + function isTypeIdenticalTo(source, target) { + return checkTypeRelatedTo(source, target, identityRelation, undefined); + } + function compareTypes(source, target) { + return checkTypeRelatedTo(source, target, identityRelation, undefined) ? -1 : 0; + } + function isTypeSubtypeOf(source, target) { + return checkTypeSubtypeOf(source, target, undefined); + } + function isTypeAssignableTo(source, target) { + return checkTypeAssignableTo(source, target, undefined); + } + function checkTypeSubtypeOf(source, target, errorNode, headMessage, containingMessageChain) { + return checkTypeRelatedTo(source, target, subtypeRelation, errorNode, headMessage, containingMessageChain); + } + function checkTypeAssignableTo(source, target, errorNode, headMessage) { + return checkTypeRelatedTo(source, target, assignableRelation, errorNode, headMessage); + } + function isSignatureAssignableTo(source, target) { + var sourceType = getOrCreateTypeFromSignature(source); + var targetType = getOrCreateTypeFromSignature(target); + return checkTypeRelatedTo(sourceType, targetType, assignableRelation, undefined); + } + function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain) { + var errorInfo; + var sourceStack; + var targetStack; + var maybeStack; + var expandingFlags; + var depth = 0; + var overflow = false; + ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); + var result = isRelatedTo(source, target, errorNode !== undefined, headMessage); + if (overflow) { + error(errorNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); + } + else if (errorInfo) { + if (errorInfo.next === undefined) { + errorInfo = undefined; + isRelatedTo(source, target, errorNode !== undefined, headMessage, true); + } + if (containingMessageChain) { + errorInfo = ts.concatenateDiagnosticMessageChains(containingMessageChain, errorInfo); + } + diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, errorInfo)); + } + return result !== 0; + function reportError(message, arg0, arg1, arg2) { + errorInfo = ts.chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2); + } + function isRelatedTo(source, target, reportErrors, headMessage, elaborateErrors) { + if (elaborateErrors === void 0) { elaborateErrors = false; } + var result; + if (source === target) + return -1; + if (relation !== identityRelation) { + if (target.flags & 1) + return -1; + if (source === undefinedType) + return -1; + if (source === nullType && target !== undefinedType) + return -1; + if (source.flags & 128 && target === numberType) + return -1; + if (source.flags & 256 && target === stringType) + return -1; + if (relation === assignableRelation) { + if (source.flags & 1) + return -1; + if (source === numberType && target.flags & 128) + return -1; + } + } + if (source.flags & 16384 || target.flags & 16384) { + if (relation === identityRelation) { + if (source.flags & 16384 && target.flags & 16384) { + if (result = unionTypeRelatedToUnionType(source, target)) { + if (result &= unionTypeRelatedToUnionType(target, source)) { + return result; + } + } + } + else if (source.flags & 16384) { + if (result = unionTypeRelatedToType(source, target, reportErrors)) { + return result; + } + } + else { + if (result = unionTypeRelatedToType(target, source, reportErrors)) { + return result; + } + } + } + else { + if (source.flags & 16384) { + if (result = unionTypeRelatedToType(source, target, reportErrors)) { + return result; + } + } + else { + if (result = typeRelatedToUnionType(source, target, reportErrors)) { + return result; + } + } + } + } + else if (source.flags & 512 && target.flags & 512) { + if (result = typeParameterRelatedTo(source, target, reportErrors)) { + return result; + } + } + else { + var saveErrorInfo = errorInfo; + if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { + if (result = typesRelatedTo(source.typeArguments, target.typeArguments, reportErrors)) { + return result; + } + } + var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; + var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && + (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { + errorInfo = saveErrorInfo; + return result; + } + } + if (reportErrors) { + headMessage = headMessage || ts.Diagnostics.Type_0_is_not_assignable_to_type_1; + var sourceType = typeToString(source); + var targetType = typeToString(target); + if (sourceType === targetType) { + sourceType = typeToString(source, undefined, 128); + targetType = typeToString(target, undefined, 128); + } + reportError(headMessage, sourceType, targetType); + } + return 0; + } + function unionTypeRelatedToUnionType(source, target) { + var result = -1; + var sourceTypes = source.types; + for (var i = 0, len = sourceTypes.length; i < len; i++) { + var related = typeRelatedToUnionType(sourceTypes[i], target, false); + if (!related) { + return 0; + } + result &= related; + } + return result; + } + function typeRelatedToUnionType(source, target, reportErrors) { + var targetTypes = target.types; + for (var i = 0, len = targetTypes.length; i < len; i++) { + var related = isRelatedTo(source, targetTypes[i], reportErrors && i === len - 1); + if (related) { + return related; + } + } + return 0; + } + function unionTypeRelatedToType(source, target, reportErrors) { + var result = -1; + var sourceTypes = source.types; + for (var i = 0, len = sourceTypes.length; i < len; i++) { + var related = isRelatedTo(sourceTypes[i], target, reportErrors); + if (!related) { + return 0; + } + result &= related; + } + return result; + } + function typesRelatedTo(sources, targets, reportErrors) { + var result = -1; + for (var i = 0, len = sources.length; i < len; i++) { + var related = isRelatedTo(sources[i], targets[i], reportErrors); + if (!related) { + return 0; + } + result &= related; + } + return result; + } + function typeParameterRelatedTo(source, target, reportErrors) { + if (relation === identityRelation) { + if (source.symbol.name !== target.symbol.name) { + return 0; + } + if (source.constraint === target.constraint) { + return -1; + } + if (source.constraint === noConstraintType || target.constraint === noConstraintType) { + return 0; + } + return isRelatedTo(source.constraint, target.constraint, reportErrors); + } + else { + while (true) { + var constraint = getConstraintOfTypeParameter(source); + if (constraint === target) + return -1; + if (!(constraint && constraint.flags & 512)) + break; + source = constraint; + } + return 0; + } + } + function objectTypeRelatedTo(source, target, reportErrors, elaborateErrors) { + if (elaborateErrors === void 0) { elaborateErrors = false; } + if (overflow) { + return 0; + } + var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; + var related = relation[id]; + if (related !== undefined) { + if (!elaborateErrors || (related === 3)) { + return related === 1 ? -1 : 0; + } + } + if (depth > 0) { + for (var i = 0; i < depth; i++) { + if (maybeStack[i][id]) { + return 1; + } + } + if (depth === 100) { + overflow = true; + return 0; + } + } + else { + sourceStack = []; + targetStack = []; + maybeStack = []; + expandingFlags = 0; + } + sourceStack[depth] = source; + targetStack[depth] = target; + maybeStack[depth] = {}; + maybeStack[depth][id] = 1; + depth++; + var saveExpandingFlags = expandingFlags; + if (!(expandingFlags & 1) && isDeeplyNestedGeneric(source, sourceStack)) + expandingFlags |= 1; + if (!(expandingFlags & 2) && isDeeplyNestedGeneric(target, targetStack)) + expandingFlags |= 2; + if (expandingFlags === 3) { + var result = 1; + } + else { + var result = propertiesRelatedTo(source, target, reportErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 0, reportErrors); + if (result) { + result &= signaturesRelatedTo(source, target, 1, reportErrors); + if (result) { + result &= stringIndexTypesRelatedTo(source, target, reportErrors); + if (result) { + result &= numberIndexTypesRelatedTo(source, target, reportErrors); + } + } + } + } + } + expandingFlags = saveExpandingFlags; + depth--; + if (result) { + var maybeCache = maybeStack[depth]; + var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; + ts.copyMap(maybeCache, destinationCache); + } + else { + relation[id] = reportErrors ? 3 : 2; + } + return result; + } + function isDeeplyNestedGeneric(type, stack) { + if (type.flags & 4096 && depth >= 10) { + var target = type.target; + var count = 0; + for (var i = 0; i < depth; i++) { + var t = stack[i]; + if (t.flags & 4096 && t.target === target) { + count++; + if (count >= 10) + return true; + } + } + } + return false; + } + function propertiesRelatedTo(source, target, reportErrors) { + if (relation === identityRelation) { + return propertiesIdenticalTo(source, target); + } + var result = -1; + var properties = getPropertiesOfObjectType(target); + var requireOptionalProperties = relation === subtypeRelation && !(source.flags & 131072); + for (var i = 0; i < properties.length; i++) { + var targetProp = properties[i]; + var sourceProp = getPropertyOfType(source, targetProp.name); + if (sourceProp !== targetProp) { + if (!sourceProp) { + if (!(targetProp.flags & 536870912) || requireOptionalProperties) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); + } + return 0; + } + } + else if (!(targetProp.flags & 134217728)) { + var sourceFlags = getDeclarationFlagsFromSymbol(sourceProp); + var targetFlags = getDeclarationFlagsFromSymbol(targetProp); + if (sourceFlags & 32 || targetFlags & 32) { + if (sourceProp.valueDeclaration !== targetProp.valueDeclaration) { + if (reportErrors) { + if (sourceFlags & 32 && targetFlags & 32) { + reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp)); + } + else { + reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourceFlags & 32 ? source : target), typeToString(sourceFlags & 32 ? target : source)); + } + } + return 0; + } + } + else if (targetFlags & 64) { + var sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & 32; + var sourceClass = sourceDeclaredInClass ? getDeclaredTypeOfSymbol(sourceProp.parent) : undefined; + var targetClass = getDeclaredTypeOfSymbol(targetProp.parent); + if (!sourceClass || !hasBaseType(sourceClass, targetClass)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(sourceClass || source), typeToString(targetClass)); + } + return 0; + } + } + else if (sourceFlags & 64) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return 0; + } + var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp)); + } + return 0; + } + result &= related; + if (sourceProp.flags & 536870912 && !(targetProp.flags & 536870912)) { + if (reportErrors) { + reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); + } + return 0; + } + } + } + } + return result; + } + function propertiesIdenticalTo(source, target) { + var sourceProperties = getPropertiesOfObjectType(source); + var targetProperties = getPropertiesOfObjectType(target); + if (sourceProperties.length !== targetProperties.length) { + return 0; + } + var result = -1; + for (var i = 0, len = sourceProperties.length; i < len; ++i) { + var sourceProp = sourceProperties[i]; + var targetProp = getPropertyOfObjectType(target, sourceProp.name); + if (!targetProp) { + return 0; + } + var related = compareProperties(sourceProp, targetProp, isRelatedTo); + if (!related) { + return 0; + } + result &= related; + } + return result; + } + function signaturesRelatedTo(source, target, kind, reportErrors) { + if (relation === identityRelation) { + return signaturesIdenticalTo(source, target, kind); + } + if (target === anyFunctionType || source === anyFunctionType) { + return -1; + } + var sourceSignatures = getSignaturesOfType(source, kind); + var targetSignatures = getSignaturesOfType(target, kind); + var result = -1; + var saveErrorInfo = errorInfo; + outer: for (var i = 0; i < targetSignatures.length; i++) { + var t = targetSignatures[i]; + if (!t.hasStringLiterals || target.flags & 65536) { + var localErrors = reportErrors; + for (var j = 0; j < sourceSignatures.length; j++) { + var s = sourceSignatures[j]; + if (!s.hasStringLiterals || source.flags & 65536) { + var related = signatureRelatedTo(s, t, localErrors); + if (related) { + result &= related; + errorInfo = saveErrorInfo; + continue outer; + } + localErrors = false; + } + } + return 0; + } + } + return result; + } + function signatureRelatedTo(source, target, reportErrors) { + if (source === target) { + return -1; + } + if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { + return 0; + } + var sourceMax = source.parameters.length; + var targetMax = target.parameters.length; + var checkCount; + if (source.hasRestParameter && target.hasRestParameter) { + checkCount = sourceMax > targetMax ? sourceMax : targetMax; + sourceMax--; + targetMax--; + } + else if (source.hasRestParameter) { + sourceMax--; + checkCount = targetMax; + } + else if (target.hasRestParameter) { + targetMax--; + checkCount = sourceMax; + } + else { + checkCount = sourceMax < targetMax ? sourceMax : targetMax; + } + source = getErasedSignature(source); + target = getErasedSignature(target); + var result = -1; + for (var i = 0; i < checkCount; i++) { + var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); + var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); + var saveErrorInfo = errorInfo; + var related = isRelatedTo(s, t, reportErrors); + if (!related) { + related = isRelatedTo(t, s, false); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, source.parameters[i < sourceMax ? i : sourceMax].name, target.parameters[i < targetMax ? i : targetMax].name); + } + return 0; + } + errorInfo = saveErrorInfo; + } + result &= related; + } + var t = getReturnTypeOfSignature(target); + if (t === voidType) + return result; + var s = getReturnTypeOfSignature(source); + return result & isRelatedTo(s, t, reportErrors); + } + function signaturesIdenticalTo(source, target, kind) { + var sourceSignatures = getSignaturesOfType(source, kind); + var targetSignatures = getSignaturesOfType(target, kind); + if (sourceSignatures.length !== targetSignatures.length) { + return 0; + } + var result = -1; + for (var i = 0, len = sourceSignatures.length; i < len; ++i) { + var related = compareSignatures(sourceSignatures[i], targetSignatures[i], true, isRelatedTo); + if (!related) { + return 0; + } + result &= related; + } + return result; + } + function stringIndexTypesRelatedTo(source, target, reportErrors) { + if (relation === identityRelation) { + return indexTypesIdenticalTo(0, source, target); + } + var targetType = getIndexTypeOfType(target, 0); + if (targetType) { + var sourceType = getIndexTypeOfType(source, 0); + if (!sourceType) { + if (reportErrors) { + reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); + } + return 0; + } + var related = isRelatedTo(sourceType, targetType, reportErrors); + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Index_signatures_are_incompatible); + } + return 0; + } + return related; + } + return -1; + } + function numberIndexTypesRelatedTo(source, target, reportErrors) { + if (relation === identityRelation) { + return indexTypesIdenticalTo(1, source, target); + } + var targetType = getIndexTypeOfType(target, 1); + if (targetType) { + var sourceStringType = getIndexTypeOfType(source, 0); + var sourceNumberType = getIndexTypeOfType(source, 1); + if (!(sourceStringType || sourceNumberType)) { + if (reportErrors) { + reportError(ts.Diagnostics.Index_signature_is_missing_in_type_0, typeToString(source)); + } + return 0; + } + if (sourceStringType && sourceNumberType) { + var related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); + } + else { + var related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); + } + if (!related) { + if (reportErrors) { + reportError(ts.Diagnostics.Index_signatures_are_incompatible); + } + return 0; + } + return related; + } + return -1; + } + function indexTypesIdenticalTo(indexKind, source, target) { + var targetType = getIndexTypeOfType(target, indexKind); + var sourceType = getIndexTypeOfType(source, indexKind); + if (!sourceType && !targetType) { + return -1; + } + if (sourceType && targetType) { + return isRelatedTo(sourceType, targetType); + } + return 0; + } + } + function isPropertyIdenticalTo(sourceProp, targetProp) { + return compareProperties(sourceProp, targetProp, compareTypes) !== 0; + } + function compareProperties(sourceProp, targetProp, compareTypes) { + if (sourceProp === targetProp) { + return -1; + } + var sourcePropAccessibility = getDeclarationFlagsFromSymbol(sourceProp) & (32 | 64); + var targetPropAccessibility = getDeclarationFlagsFromSymbol(targetProp) & (32 | 64); + if (sourcePropAccessibility !== targetPropAccessibility) { + return 0; + } + if (sourcePropAccessibility) { + if (getTargetSymbol(sourceProp) !== getTargetSymbol(targetProp)) { + return 0; + } + } + else { + if ((sourceProp.flags & 536870912) !== (targetProp.flags & 536870912)) { + return 0; + } + } + return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); + } + function compareSignatures(source, target, compareReturnTypes, compareTypes) { + if (source === target) { + return -1; + } + if (source.parameters.length !== target.parameters.length || + source.minArgumentCount !== target.minArgumentCount || + source.hasRestParameter !== target.hasRestParameter) { + return 0; + } + var result = -1; + if (source.typeParameters && target.typeParameters) { + if (source.typeParameters.length !== target.typeParameters.length) { + return 0; + } + for (var i = 0, len = source.typeParameters.length; i < len; ++i) { + var related = compareTypes(source.typeParameters[i], target.typeParameters[i]); + if (!related) { + return 0; + } + result &= related; + } + } + else if (source.typeParameters || target.typeParameters) { + return 0; + } + source = getErasedSignature(source); + target = getErasedSignature(target); + for (var i = 0, len = source.parameters.length; i < len; i++) { + var s = source.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(source) : getTypeOfSymbol(source.parameters[i]); + var t = target.hasRestParameter && i === len - 1 ? getRestTypeOfSignature(target) : getTypeOfSymbol(target.parameters[i]); + var related = compareTypes(s, t); + if (!related) { + return 0; + } + result &= related; + } + if (compareReturnTypes) { + result &= compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + } + return result; + } + function isSupertypeOfEach(candidate, types) { + for (var i = 0, len = types.length; i < len; i++) { + if (candidate !== types[i] && !isTypeSubtypeOf(types[i], candidate)) + return false; + } + return true; + } + function getCommonSupertype(types) { + return ts.forEach(types, function (t) { return isSupertypeOfEach(t, types) ? t : undefined; }); + } + function reportNoCommonSupertypeError(types, errorLocation, errorMessageChainHead) { + var bestSupertype; + var bestSupertypeDownfallType; + var bestSupertypeScore = 0; + for (var i = 0; i < types.length; i++) { + var score = 0; + var downfallType = undefined; + for (var j = 0; j < types.length; j++) { + if (isTypeSubtypeOf(types[j], types[i])) { + score++; + } + else if (!downfallType) { + downfallType = types[j]; + } + } + if (score > bestSupertypeScore) { + bestSupertype = types[i]; + bestSupertypeDownfallType = downfallType; + bestSupertypeScore = score; + } + if (bestSupertypeScore === types.length - 1) { + break; + } + } + checkTypeSubtypeOf(bestSupertypeDownfallType, bestSupertype, errorLocation, ts.Diagnostics.Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0, errorMessageChainHead); + } + function isArrayType(type) { + return type.flags & 4096 && type.target === globalArrayType; + } + function isArrayLikeType(type) { + return !(type.flags & (32 | 64)) && isTypeAssignableTo(type, anyArrayType); + } + function isTupleLikeType(type) { + return !!getPropertyOfType(type, "0"); + } + function getWidenedTypeOfObjectLiteral(type) { + var properties = getPropertiesOfObjectType(type); + var members = {}; + ts.forEach(properties, function (p) { + var propType = getTypeOfSymbol(p); + var widenedType = getWidenedType(propType); + if (propType !== widenedType) { + var symbol = createSymbol(p.flags | 67108864, p.name); + symbol.declarations = p.declarations; + symbol.parent = p.parent; + symbol.type = widenedType; + symbol.target = p; + if (p.valueDeclaration) + symbol.valueDeclaration = p.valueDeclaration; + p = symbol; + } + members[p.name] = p; + }); + var stringIndexType = getIndexTypeOfType(type, 0); + var numberIndexType = getIndexTypeOfType(type, 1); + if (stringIndexType) + stringIndexType = getWidenedType(stringIndexType); + if (numberIndexType) + numberIndexType = getWidenedType(numberIndexType); + return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexType, numberIndexType); + } + function getWidenedType(type) { + if (type.flags & 786432) { + if (type.flags & (32 | 64)) { + return anyType; + } + if (type.flags & 131072) { + return getWidenedTypeOfObjectLiteral(type); + } + if (type.flags & 16384) { + return getUnionType(ts.map(type.types, getWidenedType)); + } + if (isArrayType(type)) { + return createArrayType(getWidenedType(type.typeArguments[0])); + } + } + return type; + } + function reportWideningErrorsInType(type) { + if (type.flags & 16384) { + var errorReported = false; + ts.forEach(type.types, function (t) { + if (reportWideningErrorsInType(t)) { + errorReported = true; + } + }); + return errorReported; + } + if (isArrayType(type)) { + return reportWideningErrorsInType(type.typeArguments[0]); + } + if (type.flags & 131072) { + var errorReported = false; + ts.forEach(getPropertiesOfObjectType(type), function (p) { + var t = getTypeOfSymbol(p); + if (t.flags & 262144) { + if (!reportWideningErrorsInType(t)) { + error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); + } + errorReported = true; + } + }); + return errorReported; + } + return false; + } + function reportImplicitAnyError(declaration, type) { + var typeAsString = typeToString(getWidenedType(type)); + switch (declaration.kind) { + case 128: + case 127: + var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; + break; + case 126: + var diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + break; + case 193: + case 130: + case 129: + case 132: + case 133: + case 158: + case 159: + if (!declaration.name) { + error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); + return; + } + var diagnostic = ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; + break; + default: + var diagnostic = ts.Diagnostics.Variable_0_implicitly_has_an_1_type; + } + error(declaration, diagnostic, ts.declarationNameToString(declaration.name), typeAsString); + } + function reportErrorsFromWidening(declaration, type) { + if (produceDiagnostics && compilerOptions.noImplicitAny && type.flags & 262144) { + if (!reportWideningErrorsInType(type)) { + reportImplicitAnyError(declaration, type); + } + } + } + function forEachMatchingParameterType(source, target, callback) { + var sourceMax = source.parameters.length; + var targetMax = target.parameters.length; + var count; + if (source.hasRestParameter && target.hasRestParameter) { + count = sourceMax > targetMax ? sourceMax : targetMax; + sourceMax--; + targetMax--; + } + else if (source.hasRestParameter) { + sourceMax--; + count = targetMax; + } + else if (target.hasRestParameter) { + targetMax--; + count = sourceMax; + } + else { + count = sourceMax < targetMax ? sourceMax : targetMax; + } + for (var i = 0; i < count; i++) { + var s = i < sourceMax ? getTypeOfSymbol(source.parameters[i]) : getRestTypeOfSignature(source); + var t = i < targetMax ? getTypeOfSymbol(target.parameters[i]) : getRestTypeOfSignature(target); + callback(s, t); + } + } + function createInferenceContext(typeParameters, inferUnionTypes) { + var inferences = []; + for (var i = 0; i < typeParameters.length; i++) { + inferences.push({ primary: undefined, secondary: undefined }); + } + return { + typeParameters: typeParameters, + inferUnionTypes: inferUnionTypes, + inferenceCount: 0, + inferences: inferences, + inferredTypes: new Array(typeParameters.length) + }; + } + function inferTypes(context, source, target) { + var sourceStack; + var targetStack; + var depth = 0; + var inferiority = 0; + inferFromTypes(source, target); + function isInProcess(source, target) { + for (var i = 0; i < depth; i++) { + if (source === sourceStack[i] && target === targetStack[i]) + return true; + } + return false; + } + function isWithinDepthLimit(type, stack) { + if (depth >= 5) { + var target = type.target; + var count = 0; + for (var i = 0; i < depth; i++) { + var t = stack[i]; + if (t.flags & 4096 && t.target === target) + count++; + } + return count < 5; + } + return true; + } + function inferFromTypes(source, target) { + if (source === anyFunctionType) { + return; + } + if (target.flags & 512) { + var typeParameters = context.typeParameters; + for (var i = 0; i < typeParameters.length; i++) { + if (target === typeParameters[i]) { + var inferences = context.inferences[i]; + var candidates = inferiority ? inferences.secondary || (inferences.secondary = []) : inferences.primary || (inferences.primary = []); + if (!ts.contains(candidates, source)) + candidates.push(source); + break; + } + } + } + else if (source.flags & 4096 && target.flags & 4096 && source.target === target.target) { + var sourceTypes = source.typeArguments; + var targetTypes = target.typeArguments; + for (var i = 0; i < sourceTypes.length; i++) { + inferFromTypes(sourceTypes[i], targetTypes[i]); + } + } + else if (target.flags & 16384) { + var targetTypes = target.types; + var typeParameterCount = 0; + var typeParameter; + for (var i = 0; i < targetTypes.length; i++) { + var t = targetTypes[i]; + if (t.flags & 512 && ts.contains(context.typeParameters, t)) { + typeParameter = t; + typeParameterCount++; + } + else { + inferFromTypes(source, t); + } + } + if (typeParameterCount === 1) { + inferiority++; + inferFromTypes(source, typeParameter); + inferiority--; + } + } + else if (source.flags & 16384) { + var sourceTypes = source.types; + for (var i = 0; i < sourceTypes.length; i++) { + inferFromTypes(sourceTypes[i], target); + } + } + else if (source.flags & 48128 && (target.flags & (4096 | 8192) || + (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { + if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { + if (depth === 0) { + sourceStack = []; + targetStack = []; + } + sourceStack[depth] = source; + targetStack[depth] = target; + depth++; + inferFromProperties(source, target); + inferFromSignatures(source, target, 0); + inferFromSignatures(source, target, 1); + inferFromIndexTypes(source, target, 0, 0); + inferFromIndexTypes(source, target, 1, 1); + inferFromIndexTypes(source, target, 0, 1); + depth--; + } + } + } + function inferFromProperties(source, target) { + var properties = getPropertiesOfObjectType(target); + for (var i = 0; i < properties.length; i++) { + var targetProp = properties[i]; + var sourceProp = getPropertyOfObjectType(source, targetProp.name); + if (sourceProp) { + inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); + } + } + } + function inferFromSignatures(source, target, kind) { + var sourceSignatures = getSignaturesOfType(source, kind); + var targetSignatures = getSignaturesOfType(target, kind); + var sourceLen = sourceSignatures.length; + var targetLen = targetSignatures.length; + var len = sourceLen < targetLen ? sourceLen : targetLen; + for (var i = 0; i < len; i++) { + inferFromSignature(getErasedSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i])); + } + } + function inferFromSignature(source, target) { + forEachMatchingParameterType(source, target, inferFromTypes); + inferFromTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + } + function inferFromIndexTypes(source, target, sourceKind, targetKind) { + var targetIndexType = getIndexTypeOfType(target, targetKind); + if (targetIndexType) { + var sourceIndexType = getIndexTypeOfType(source, sourceKind); + if (sourceIndexType) { + inferFromTypes(sourceIndexType, targetIndexType); + } + } + } + } + function getInferenceCandidates(context, index) { + var inferences = context.inferences[index]; + return inferences.primary || inferences.secondary || emptyArray; + } + function getInferredType(context, index) { + var inferredType = context.inferredTypes[index]; + if (!inferredType) { + var inferences = getInferenceCandidates(context, index); + if (inferences.length) { + var unionOrSuperType = context.inferUnionTypes ? getUnionType(inferences) : getCommonSupertype(inferences); + inferredType = unionOrSuperType ? getWidenedType(unionOrSuperType) : inferenceFailureType; + } + else { + inferredType = emptyObjectType; + } + if (inferredType !== inferenceFailureType) { + var constraint = getConstraintOfTypeParameter(context.typeParameters[index]); + inferredType = constraint && !isTypeAssignableTo(inferredType, constraint) ? constraint : inferredType; + } + context.inferredTypes[index] = inferredType; + } + return inferredType; + } + function getInferredTypes(context) { + for (var i = 0; i < context.inferredTypes.length; i++) { + getInferredType(context, i); + } + return context.inferredTypes; + } + function hasAncestor(node, kind) { + return ts.getAncestor(node, kind) !== undefined; + } + function getResolvedSymbol(node) { + var links = getNodeLinks(node); + if (!links.resolvedSymbol) { + links.resolvedSymbol = (ts.getFullWidth(node) > 0 && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node)) || unknownSymbol; + } + return links.resolvedSymbol; + } + function isInTypeQuery(node) { + while (node) { + switch (node.kind) { + case 140: + return true; + case 64: + case 123: + node = node.parent; + continue; + default: + return false; + } + } + ts.Debug.fail("should not get here"); + } + function removeTypesFromUnionType(type, typeKind, isOfTypeKind) { + if (type.flags & 16384) { + var types = type.types; + if (ts.forEach(types, function (t) { return !!(t.flags & typeKind) === isOfTypeKind; })) { + var narrowedType = getUnionType(ts.filter(types, function (t) { return !(t.flags & typeKind) === isOfTypeKind; })); + if (narrowedType !== emptyObjectType) { + return narrowedType; + } + } + } + return type; + } + function hasInitializer(node) { + return !!(node.initializer || ts.isBindingPattern(node.parent) && hasInitializer(node.parent.parent)); + } + function isVariableAssignedWithin(symbol, node) { + var links = getNodeLinks(node); + if (links.assignmentChecks) { + var cachedResult = links.assignmentChecks[symbol.id]; + if (cachedResult !== undefined) { + return cachedResult; + } + } + else { + links.assignmentChecks = {}; + } + return links.assignmentChecks[symbol.id] = isAssignedIn(node); + function isAssignedInBinaryExpression(node) { + if (node.operatorToken.kind >= 52 && node.operatorToken.kind <= 63) { + var n = node.left; + while (n.kind === 157) { + n = n.expression; + } + if (n.kind === 64 && getResolvedSymbol(n) === symbol) { + return true; + } + } + return ts.forEachChild(node, isAssignedIn); + } + function isAssignedInVariableDeclaration(node) { + if (!ts.isBindingPattern(node.name) && getSymbolOfNode(node) === symbol && hasInitializer(node)) { + return true; + } + return ts.forEachChild(node, isAssignedIn); + } + function isAssignedIn(node) { + switch (node.kind) { + case 165: + return isAssignedInBinaryExpression(node); + case 191: + case 148: + return isAssignedInVariableDeclaration(node); + case 146: + case 147: + case 149: + case 150: + case 151: + case 152: + case 153: + case 154: + case 156: + case 157: + case 163: + case 160: + case 161: + case 162: + case 164: + case 166: + case 169: + case 172: + case 173: + case 175: + case 176: + case 177: + case 178: + case 179: + case 180: + case 181: + case 184: + case 185: + case 186: + case 203: + case 204: + case 187: + case 188: + case 189: + case 206: + return ts.forEachChild(node, isAssignedIn); + } + return false; + } + } + function resolveLocation(node) { + var containerNodes = []; + for (var parent = node.parent; parent; parent = parent.parent) { + if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && + isContextSensitive(parent)) { + containerNodes.unshift(parent); + } + } + ts.forEach(containerNodes, function (node) { getTypeOfNode(node); }); + } + function getSymbolAtLocation(node) { + resolveLocation(node); + return getSymbolInfo(node); + } + function getTypeAtLocation(node) { + resolveLocation(node); + return getTypeOfNode(node); + } + function getTypeOfSymbolAtLocation(symbol, node) { + resolveLocation(node); + return getNarrowedTypeOfSymbol(symbol, node); + } + function getNarrowedTypeOfSymbol(symbol, node) { + var type = getTypeOfSymbol(symbol); + if (node && symbol.flags & 3 && type.flags & (1 | 48128 | 16384 | 512)) { + loop: while (node.parent) { + var child = node; + node = node.parent; + var narrowedType = type; + switch (node.kind) { + case 176: + if (child !== node.expression) { + narrowedType = narrowType(type, node.expression, child === node.thenStatement); + } + break; + case 166: + if (child !== node.condition) { + narrowedType = narrowType(type, node.condition, child === node.whenTrue); + } + break; + case 165: + if (child === node.right) { + if (node.operatorToken.kind === 48) { + narrowedType = narrowType(type, node.left, true); + } + else if (node.operatorToken.kind === 49) { + narrowedType = narrowType(type, node.left, false); + } + } + break; + case 210: + case 198: + case 193: + case 130: + case 129: + case 132: + case 133: + case 131: + break loop; + } + if (narrowedType !== type) { + if (isVariableAssignedWithin(symbol, node)) { + break; + } + type = narrowedType; + } + } + } + return type; + function narrowTypeByEquality(type, expr, assumeTrue) { + if (expr.left.kind !== 161 || expr.right.kind !== 8) { + return type; + } + var left = expr.left; + var right = expr.right; + if (left.expression.kind !== 64 || getResolvedSymbol(left.expression) !== symbol) { + return type; + } + var typeInfo = primitiveTypeInfo[right.text]; + if (expr.operatorToken.kind === 31) { + assumeTrue = !assumeTrue; + } + if (assumeTrue) { + if (!typeInfo) { + return removeTypesFromUnionType(type, 258 | 132 | 8 | 1048576, true); + } + if (isTypeSubtypeOf(typeInfo.type, type)) { + return typeInfo.type; + } + return removeTypesFromUnionType(type, typeInfo.flags, false); + } + else { + if (typeInfo) { + return removeTypesFromUnionType(type, typeInfo.flags, true); + } + return type; + } + } + function narrowTypeByAnd(type, expr, assumeTrue) { + if (assumeTrue) { + return narrowType(narrowType(type, expr.left, true), expr.right, true); + } + else { + return getUnionType([ + narrowType(type, expr.left, false), + narrowType(narrowType(type, expr.left, true), expr.right, false) + ]); + } + } + function narrowTypeByOr(type, expr, assumeTrue) { + if (assumeTrue) { + return getUnionType([ + narrowType(type, expr.left, true), + narrowType(narrowType(type, expr.left, false), expr.right, true) + ]); + } + else { + return narrowType(narrowType(type, expr.left, false), expr.right, false); + } + } + function narrowTypeByInstanceof(type, expr, assumeTrue) { + if (type.flags & 1 || !assumeTrue || expr.left.kind !== 64 || getResolvedSymbol(expr.left) !== symbol) { + return type; + } + var rightType = checkExpression(expr.right); + if (!isTypeSubtypeOf(rightType, globalFunctionType)) { + return type; + } + var prototypeProperty = getPropertyOfType(rightType, "prototype"); + if (!prototypeProperty) { + return type; + } + var targetType = getTypeOfSymbol(prototypeProperty); + if (isTypeSubtypeOf(targetType, type)) { + return targetType; + } + if (type.flags & 16384) { + return getUnionType(ts.filter(type.types, function (t) { return isTypeSubtypeOf(t, targetType); })); + } + return type; + } + function narrowType(type, expr, assumeTrue) { + switch (expr.kind) { + case 157: + return narrowType(type, expr.expression, assumeTrue); + case 165: + var operator = expr.operatorToken.kind; + if (operator === 30 || operator === 31) { + return narrowTypeByEquality(type, expr, assumeTrue); + } + else if (operator === 48) { + return narrowTypeByAnd(type, expr, assumeTrue); + } + else if (operator === 49) { + return narrowTypeByOr(type, expr, assumeTrue); + } + else if (operator === 86) { + return narrowTypeByInstanceof(type, expr, assumeTrue); + } + break; + case 163: + if (expr.operator === 46) { + return narrowType(type, expr.operand, !assumeTrue); + } + break; + } + return type; + } + } + function markLinkedImportsAsReferenced(node) { + var nodeLinks = getNodeLinks(node); + while (nodeLinks.importOnRightSide) { + var rightSide = nodeLinks.importOnRightSide; + nodeLinks.importOnRightSide = undefined; + getSymbolLinks(rightSide).referenced = true; + ts.Debug.assert((rightSide.flags & 8388608) !== 0); + nodeLinks = getNodeLinks(ts.getDeclarationOfKind(rightSide, 200)); + } + } + function checkIdentifier(node) { + var symbol = getResolvedSymbol(node); + if (symbol === argumentsSymbol && ts.getContainingFunction(node).kind === 159) { + error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression); + } + if (symbol.flags & 8388608) { + var symbolLinks = getSymbolLinks(symbol); + if (!symbolLinks.referenced) { + var importOrExportAssignment = getLeftSideOfImportOrExportAssignment(node); + if (!importOrExportAssignment || + (importOrExportAssignment.flags & 1) || + (importOrExportAssignment.kind === 201)) { + symbolLinks.referenced = !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol)); + } + else { + var nodeLinks = getNodeLinks(importOrExportAssignment); + ts.Debug.assert(!nodeLinks.importOnRightSide); + nodeLinks.importOnRightSide = symbol; + } + } + if (symbolLinks.referenced) { + markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 200)); + } + } + checkCollisionWithCapturedSuperVariable(node, node); + checkCollisionWithCapturedThisVariable(node, node); + return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); + } + function captureLexicalThis(node, container) { + var classNode = container.parent && container.parent.kind === 194 ? container.parent : undefined; + getNodeLinks(node).flags |= 2; + if (container.kind === 128 || container.kind === 131) { + getNodeLinks(classNode).flags |= 4; + } + else { + getNodeLinks(container).flags |= 4; + } + } + function checkThisExpression(node) { + var container = ts.getThisContainer(node, true); + var needToCaptureLexicalThis = false; + if (container.kind === 159) { + container = ts.getThisContainer(container, false); + needToCaptureLexicalThis = (languageVersion < 2); + } + switch (container.kind) { + case 198: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); + break; + case 197: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); + break; + case 131: + if (isInConstructorArgumentInitializer(node, container)) { + error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); + } + break; + case 128: + case 127: + if (container.flags & 128) { + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); + } + break; + case 124: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); + break; + } + if (needToCaptureLexicalThis) { + captureLexicalThis(node, container); + } + var classNode = container.parent && container.parent.kind === 194 ? container.parent : undefined; + if (classNode) { + var symbol = getSymbolOfNode(classNode); + return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); + } + return anyType; + } + function isInConstructorArgumentInitializer(node, constructorDecl) { + for (var n = node; n && n !== constructorDecl; n = n.parent) { + if (n.kind === 126) { + return true; + } + } + return false; + } + function checkSuperExpression(node) { + var isCallExpression = node.parent.kind === 153 && node.parent.expression === node; + var enclosingClass = ts.getAncestor(node, 194); + var baseClass; + if (enclosingClass && ts.getClassBaseTypeNode(enclosingClass)) { + var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); + baseClass = classType.baseTypes.length && classType.baseTypes[0]; + } + if (!baseClass) { + error(node, ts.Diagnostics.super_can_only_be_referenced_in_a_derived_class); + return unknownType; + } + var container = ts.getSuperContainer(node, true); + if (container) { + var canUseSuperExpression = false; + if (isCallExpression) { + canUseSuperExpression = container.kind === 131; + } + else { + var needToCaptureLexicalThis = false; + while (container && container.kind === 159) { + container = ts.getSuperContainer(container, true); + needToCaptureLexicalThis = true; + } + if (container && container.parent && container.parent.kind === 194) { + if (container.flags & 128) { + canUseSuperExpression = + container.kind === 130 || + container.kind === 129 || + container.kind === 132 || + container.kind === 133; + } + else { + canUseSuperExpression = + container.kind === 130 || + container.kind === 129 || + container.kind === 132 || + container.kind === 133 || + container.kind === 128 || + container.kind === 127 || + container.kind === 131; + } + } + } + if (canUseSuperExpression) { + var returnType; + if ((container.flags & 128) || isCallExpression) { + getNodeLinks(node).flags |= 32; + returnType = getTypeOfSymbol(baseClass.symbol); + } + else { + getNodeLinks(node).flags |= 16; + returnType = baseClass; + } + if (container.kind === 131 && isInConstructorArgumentInitializer(node, container)) { + error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); + returnType = unknownType; + } + if (!isCallExpression && needToCaptureLexicalThis) { + captureLexicalThis(node.parent, container); + } + return returnType; + } + } + if (container.kind === 124) { + error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); + } + else if (isCallExpression) { + error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); + } + else { + error(node, ts.Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class); + } + return unknownType; + } + function getContextuallyTypedParameterType(parameter) { + if (isFunctionExpressionOrArrowFunction(parameter.parent)) { + var func = parameter.parent; + if (isContextSensitive(func)) { + var contextualSignature = getContextualSignature(func); + if (contextualSignature) { + var funcHasRestParameters = ts.hasRestParameters(func); + var len = func.parameters.length - (funcHasRestParameters ? 1 : 0); + var indexOfParameter = ts.indexOf(func.parameters, parameter); + if (indexOfParameter < len) { + return getTypeAtPosition(contextualSignature, indexOfParameter); + } + if (indexOfParameter === (func.parameters.length - 1) && + funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); + } + } + } + } + return undefined; + } + function getContextualTypeForInitializerExpression(node) { + var declaration = node.parent; + if (node === declaration.initializer) { + if (declaration.type) { + return getTypeFromTypeNode(declaration.type); + } + if (declaration.kind === 126) { + var type = getContextuallyTypedParameterType(declaration); + if (type) { + return type; + } + } + if (ts.isBindingPattern(declaration.name)) { + return getTypeFromBindingPattern(declaration.name); + } + } + return undefined; + } + function getContextualTypeForReturnExpression(node) { + var func = ts.getContainingFunction(node); + if (func) { + if (func.type || func.kind === 131 || func.kind === 132 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 133))) { + return getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + } + var signature = getContextualSignatureForFunctionLikeDeclaration(func); + if (signature) { + return getReturnTypeOfSignature(signature); + } + } + return undefined; + } + function getContextualTypeForArgument(callTarget, arg) { + var args = getEffectiveCallArguments(callTarget); + var argIndex = ts.indexOf(args, arg); + if (argIndex >= 0) { + var signature = getResolvedSignature(callTarget); + return getTypeAtPosition(signature, argIndex); + } + return undefined; + } + function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { + if (template.parent.kind === 155) { + return getContextualTypeForArgument(template.parent, substitutionExpression); + } + return undefined; + } + function getContextualTypeForBinaryOperand(node) { + var binaryExpression = node.parent; + var operator = binaryExpression.operatorToken.kind; + if (operator >= 52 && operator <= 63) { + if (node === binaryExpression.right) { + return checkExpression(binaryExpression.left); + } + } + else if (operator === 49) { + var type = getContextualType(binaryExpression); + if (!type && node === binaryExpression.right) { + type = checkExpression(binaryExpression.left); + } + return type; + } + return undefined; + } + function applyToContextualType(type, mapper) { + if (!(type.flags & 16384)) { + return mapper(type); + } + var types = type.types; + var mappedType; + var mappedTypes; + for (var i = 0; i < types.length; i++) { + var t = mapper(types[i]); + if (t) { + if (!mappedType) { + mappedType = t; + } + else if (!mappedTypes) { + mappedTypes = [mappedType, t]; + } + else { + mappedTypes.push(t); + } + } + } + return mappedTypes ? getUnionType(mappedTypes) : mappedType; + } + function getTypeOfPropertyOfContextualType(type, name) { + return applyToContextualType(type, function (t) { + var prop = getPropertyOfObjectType(t, name); + return prop ? getTypeOfSymbol(prop) : undefined; + }); + } + function getIndexTypeOfContextualType(type, kind) { + return applyToContextualType(type, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }); + } + function contextualTypeIsTupleLikeType(type) { + return !!(type.flags & 16384 ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type)); + } + function contextualTypeHasIndexSignature(type, kind) { + return !!(type.flags & 16384 ? ts.forEach(type.types, function (t) { return getIndexTypeOfObjectOrUnionType(t, kind); }) : getIndexTypeOfObjectOrUnionType(type, kind)); + } + function getContextualTypeForObjectLiteralMethod(node) { + ts.Debug.assert(ts.isObjectLiteralMethod(node)); + if (isInsideWithStatementBody(node)) { + return undefined; + } + return getContextualTypeForObjectLiteralElement(node); + } + function getContextualTypeForObjectLiteralElement(element) { + var objectLiteral = element.parent; + var type = getContextualType(objectLiteral); + if (type) { + if (!ts.hasDynamicName(element)) { + var symbolName = getSymbolOfNode(element).name; + var propertyType = getTypeOfPropertyOfContextualType(type, symbolName); + if (propertyType) { + return propertyType; + } + } + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || + getIndexTypeOfContextualType(type, 0); + } + return undefined; + } + function getContextualTypeForElementExpression(node) { + var arrayLiteral = node.parent; + var type = getContextualType(arrayLiteral); + if (type) { + var index = ts.indexOf(arrayLiteral.elements, node); + return getTypeOfPropertyOfContextualType(type, "" + index) || getIndexTypeOfContextualType(type, 1); + } + return undefined; + } + function getContextualTypeForConditionalOperand(node) { + var conditional = node.parent; + return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined; + } + function getContextualType(node) { + if (isInsideWithStatementBody(node)) { + return undefined; + } + if (node.contextualType) { + return node.contextualType; + } + var parent = node.parent; + switch (parent.kind) { + case 191: + case 126: + case 128: + case 127: + case 148: + return getContextualTypeForInitializerExpression(node); + case 159: + case 184: + return getContextualTypeForReturnExpression(node); + case 153: + case 154: + return getContextualTypeForArgument(parent, node); + case 156: + return getTypeFromTypeNode(parent.type); + case 165: + return getContextualTypeForBinaryOperand(node); + case 207: + return getContextualTypeForObjectLiteralElement(parent); + case 149: + return getContextualTypeForElementExpression(node); + case 166: + return getContextualTypeForConditionalOperand(node); + case 171: + ts.Debug.assert(parent.parent.kind === 167); + return getContextualTypeForSubstitutionExpression(parent.parent, node); + case 157: + return getContextualType(parent); + } + return undefined; + } + function getNonGenericSignature(type) { + var signatures = getSignaturesOfObjectOrUnionType(type, 0); + if (signatures.length === 1) { + var signature = signatures[0]; + if (!signature.typeParameters) { + return signature; + } + } + } + function isFunctionExpressionOrArrowFunction(node) { + return node.kind === 158 || node.kind === 159; + } + function getContextualSignatureForFunctionLikeDeclaration(node) { + return isFunctionExpressionOrArrowFunction(node) ? getContextualSignature(node) : undefined; + } + function getContextualSignature(node) { + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); + var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); + if (!type) { + return undefined; + } + if (!(type.flags & 16384)) { + return getNonGenericSignature(type); + } + var signatureList; + var types = type.types; + for (var i = 0; i < types.length; i++) { + if (signatureList && + getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { + return undefined; + } + var signature = getNonGenericSignature(types[i]); + if (signature) { + if (!signatureList) { + signatureList = [signature]; + } + else if (!compareSignatures(signatureList[0], signature, false, compareTypes)) { + return undefined; + } + else { + signatureList.push(signature); + } + } + } + var result; + if (signatureList) { + result = cloneSignature(signatureList[0]); + result.resolvedReturnType = undefined; + result.unionSignatures = signatureList; + } + return result; + } + function isInferentialContext(mapper) { + return mapper && mapper !== identityMapper; + } + function isAssignmentTarget(node) { + var parent = node.parent; + if (parent.kind === 165 && parent.operatorToken.kind === 52 && parent.left === node) { + return true; + } + if (parent.kind === 207) { + return isAssignmentTarget(parent.parent); + } + if (parent.kind === 149) { + return isAssignmentTarget(parent); + } + return false; + } + function checkSpreadElementExpression(node, contextualMapper) { + var type = checkExpressionCached(node.expression, contextualMapper); + if (!isArrayLikeType(type)) { + error(node.expression, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(type)); + return unknownType; + } + return type; + } + function checkArrayLiteral(node, contextualMapper) { + var elements = node.elements; + if (!elements.length) { + return createArrayType(undefinedType); + } + var hasSpreadElement = false; + var elementTypes = []; + ts.forEach(elements, function (e) { + var type = checkExpression(e, contextualMapper); + if (e.kind === 169) { + elementTypes.push(getIndexTypeOfType(type, 1) || anyType); + hasSpreadElement = true; + } + else { + elementTypes.push(type); + } + }); + if (!hasSpreadElement) { + var contextualType = getContextualType(node); + if (contextualType && contextualTypeIsTupleLikeType(contextualType) || isAssignmentTarget(node)) { + return createTupleType(elementTypes); + } + } + return createArrayType(getUnionType(elementTypes)); + } + function isNumericName(name) { + return name.kind === 124 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + } + function isNumericComputedName(name) { + return allConstituentTypesHaveKind(checkComputedPropertyName(name), 1 | 132); + } + function isNumericLiteralName(name) { + return (+name).toString() === name; + } + function checkComputedPropertyName(node) { + var links = getNodeLinks(node.expression); + if (!links.resolvedType) { + links.resolvedType = checkExpression(node.expression); + if (!allConstituentTypesHaveKind(links.resolvedType, 1 | 132 | 258 | 1048576)) { + error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); + } + else { + checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, true); + } + } + return links.resolvedType; + } + function checkObjectLiteral(node, contextualMapper) { + checkGrammarObjectLiteralExpression(node); + var propertiesTable = {}; + var propertiesArray = []; + var contextualType = getContextualType(node); + var typeFlags; + for (var i = 0; i < node.properties.length; i++) { + var memberDecl = node.properties[i]; + var member = memberDecl.symbol; + if (memberDecl.kind === 207 || + memberDecl.kind === 208 || + ts.isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === 207) { + var type = checkPropertyAssignment(memberDecl, contextualMapper); + } + else if (memberDecl.kind === 130) { + var type = checkObjectLiteralMethod(memberDecl, contextualMapper); + } + else { + ts.Debug.assert(memberDecl.kind === 208); + var type = memberDecl.name.kind === 124 ? unknownType : checkExpression(memberDecl.name, contextualMapper); + } + typeFlags |= type.flags; + var prop = createSymbol(4 | 67108864 | member.flags, member.name); + prop.declarations = member.declarations; + prop.parent = member.parent; + if (member.valueDeclaration) { + prop.valueDeclaration = member.valueDeclaration; + } + prop.type = type; + prop.target = member; + member = prop; + } + else { + ts.Debug.assert(memberDecl.kind === 132 || memberDecl.kind === 133); + checkAccessorDeclaration(memberDecl); + } + if (!ts.hasDynamicName(memberDecl)) { + propertiesTable[member.name] = member; + } + propertiesArray.push(member); + } + var stringIndexType = getIndexType(0); + var numberIndexType = getIndexType(1); + var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexType, numberIndexType); + result.flags |= 131072 | 524288 | (typeFlags & 262144); + return result; + function getIndexType(kind) { + if (contextualType && contextualTypeHasIndexSignature(contextualType, kind)) { + var propTypes = []; + for (var i = 0; i < propertiesArray.length; i++) { + var propertyDecl = node.properties[i]; + if (kind === 0 || isNumericName(propertyDecl.name)) { + var type = getTypeOfSymbol(propertiesArray[i]); + if (!ts.contains(propTypes, type)) { + propTypes.push(type); + } + } + } + var result = propTypes.length ? getUnionType(propTypes) : undefinedType; + typeFlags |= result.flags; + return result; + } + return undefined; + } + } + function getDeclarationKindFromSymbol(s) { + return s.valueDeclaration ? s.valueDeclaration.kind : 128; + } + function getDeclarationFlagsFromSymbol(s) { + return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 16 | 128 : 0; + } + function checkClassPropertyAccess(node, left, type, prop) { + var flags = getDeclarationFlagsFromSymbol(prop); + if (!(flags & (32 | 64))) { + return; + } + var enclosingClassDeclaration = ts.getAncestor(node, 194); + var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; + var declaringClass = getDeclaredTypeOfSymbol(prop.parent); + if (flags & 32) { + if (declaringClass !== enclosingClass) { + error(node, ts.Diagnostics.Property_0_is_private_and_only_accessible_within_class_1, symbolToString(prop), typeToString(declaringClass)); + } + return; + } + if (left.kind === 90) { + return; + } + if (!enclosingClass || !hasBaseType(enclosingClass, declaringClass)) { + error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses, symbolToString(prop), typeToString(declaringClass)); + return; + } + if (flags & 128) { + return; + } + if (!(getTargetType(type).flags & (1024 | 2048) && hasBaseType(type, enclosingClass))) { + error(node, ts.Diagnostics.Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1, symbolToString(prop), typeToString(enclosingClass)); + } + } + function checkPropertyAccessExpression(node) { + return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name); + } + function checkQualifiedName(node) { + return checkPropertyAccessExpressionOrQualifiedName(node, node.left, node.right); + } + function checkPropertyAccessExpressionOrQualifiedName(node, left, right) { + var type = checkExpressionOrQualifiedName(left); + if (type === unknownType) + return type; + if (type !== anyType) { + var apparentType = getApparentType(getWidenedType(type)); + if (apparentType === unknownType) { + return unknownType; + } + var prop = getPropertyOfType(apparentType, right.text); + if (!prop) { + if (right.text) { + error(right, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(right), typeToString(type)); + } + return unknownType; + } + getNodeLinks(node).resolvedSymbol = prop; + if (prop.parent && prop.parent.flags & 32) { + if (left.kind === 90 && getDeclarationKindFromSymbol(prop) !== 130) { + error(right, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); + } + else { + checkClassPropertyAccess(node, left, type, prop); + } + } + return getTypeOfSymbol(prop); + } + return anyType; + } + function isValidPropertyAccess(node, propertyName) { + var left = node.kind === 151 ? node.expression : node.left; + var type = checkExpressionOrQualifiedName(left); + if (type !== unknownType && type !== anyType) { + var prop = getPropertyOfType(getWidenedType(type), propertyName); + if (prop && prop.parent && prop.parent.flags & 32) { + if (left.kind === 90 && getDeclarationKindFromSymbol(prop) !== 130) { + return false; + } + else { + var modificationCount = diagnostics.getModificationCount(); + checkClassPropertyAccess(node, left, type, prop); + return diagnostics.getModificationCount() === modificationCount; + } + } + } + return true; + } + function checkIndexedAccess(node) { + if (!node.argumentExpression) { + var sourceFile = getSourceFile(node); + if (node.parent.kind === 154 && node.parent.expression === node) { + var start = ts.skipTrivia(sourceFile.text, node.expression.end); + var end = node.end; + grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); + } + else { + var start = node.end - "]".length; + var end = node.end; + grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Expression_expected); + } + } + var objectType = getApparentType(checkExpression(node.expression)); + var indexType = node.argumentExpression ? checkExpression(node.argumentExpression) : unknownType; + if (objectType === unknownType) { + return unknownType; + } + var isConstEnum = isConstEnumObjectType(objectType); + if (isConstEnum && + (!node.argumentExpression || node.argumentExpression.kind !== 8)) { + error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); + return unknownType; + } + if (node.argumentExpression) { + var name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name !== undefined) { + var prop = getPropertyOfType(objectType, name); + if (prop) { + getNodeLinks(node).resolvedSymbol = prop; + return getTypeOfSymbol(prop); + } + else if (isConstEnum) { + error(node.argumentExpression, ts.Diagnostics.Property_0_does_not_exist_on_const_enum_1, name, symbolToString(objectType.symbol)); + return unknownType; + } + } + } + if (allConstituentTypesHaveKind(indexType, 1 | 258 | 132 | 1048576)) { + if (allConstituentTypesHaveKind(indexType, 1 | 132)) { + var numberIndexType = getIndexTypeOfType(objectType, 1); + if (numberIndexType) { + return numberIndexType; + } + } + var stringIndexType = getIndexTypeOfType(objectType, 0); + if (stringIndexType) { + return stringIndexType; + } + if (compilerOptions.noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && objectType !== anyType) { + error(node, ts.Diagnostics.Index_signature_of_object_type_implicitly_has_an_any_type); + } + return anyType; + } + error(node, ts.Diagnostics.An_index_expression_argument_must_be_of_type_string_number_symbol_or_any); + return unknownType; + } + function getPropertyNameForIndexedAccess(indexArgumentExpression, indexArgumentType) { + if (indexArgumentExpression.kind === 8 || indexArgumentExpression.kind === 7) { + return indexArgumentExpression.text; + } + if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, false)) { + var rightHandSideName = indexArgumentExpression.name.text; + return ts.getPropertyNameForKnownSymbolName(rightHandSideName); + } + return undefined; + } + function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { + if (expressionType === unknownType) { + return false; + } + if (!ts.isWellKnownSymbolSyntactically(expression)) { + return false; + } + if ((expressionType.flags & 1048576) === 0) { + if (reportError) { + error(expression, ts.Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, ts.getTextOfNode(expression)); + } + return false; + } + var leftHandSide = expression.expression; + var leftHandSideSymbol = getResolvedSymbol(leftHandSide); + if (!leftHandSideSymbol) { + return false; + } + var globalESSymbol = getGlobalESSymbolConstructorSymbol(); + if (!globalESSymbol) { + return false; + } + if (leftHandSideSymbol !== globalESSymbol) { + if (reportError) { + error(leftHandSide, ts.Diagnostics.Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object); + } + return false; + } + return true; + } + function resolveUntypedCall(node) { + if (node.kind === 155) { + checkExpression(node.template); + } + else { + ts.forEach(node.arguments, function (argument) { + checkExpression(argument); + }); + } + return anySignature; + } + function resolveErrorCall(node) { + resolveUntypedCall(node); + return unknownSignature; + } + function reorderCandidates(signatures, result) { + var lastParent; + var lastSymbol; + var cutoffIndex = 0; + var index; + var specializedIndex = -1; + var spliceIndex; + ts.Debug.assert(!result.length); + for (var i = 0; i < signatures.length; i++) { + var signature = signatures[i]; + var symbol = signature.declaration && getSymbolOfNode(signature.declaration); + var parent = signature.declaration && signature.declaration.parent; + if (!lastSymbol || symbol === lastSymbol) { + if (lastParent && parent === lastParent) { + index++; + } + else { + lastParent = parent; + index = cutoffIndex; + } + } + else { + index = cutoffIndex = result.length; + lastParent = parent; + } + lastSymbol = symbol; + if (signature.hasStringLiterals) { + specializedIndex++; + spliceIndex = specializedIndex; + cutoffIndex++; + } + else { + spliceIndex = index; + } + result.splice(spliceIndex, 0, signature); + } + } + function getSpreadArgumentIndex(args) { + for (var i = 0; i < args.length; i++) { + if (args[i].kind === 169) { + return i; + } + } + return -1; + } + function hasCorrectArity(node, args, signature) { + var adjustedArgCount; + var typeArguments; + var callIsIncomplete; + if (node.kind === 155) { + var tagExpression = node; + adjustedArgCount = args.length; + typeArguments = undefined; + if (tagExpression.template.kind === 167) { + var templateExpression = tagExpression.template; + var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); + ts.Debug.assert(lastSpan !== undefined); + callIsIncomplete = ts.getFullWidth(lastSpan.literal) === 0 || !!lastSpan.literal.isUnterminated; + } + else { + var templateLiteral = tagExpression.template; + ts.Debug.assert(templateLiteral.kind === 10); + callIsIncomplete = !!templateLiteral.isUnterminated; + } + } + else { + var callExpression = node; + if (!callExpression.arguments) { + ts.Debug.assert(callExpression.kind === 154); + return signature.minArgumentCount === 0; + } + adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; + callIsIncomplete = callExpression.arguments.end === callExpression.end; + typeArguments = callExpression.typeArguments; + } + var hasRightNumberOfTypeArgs = !typeArguments || + (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + if (!hasRightNumberOfTypeArgs) { + return false; + } + var spreadArgIndex = getSpreadArgumentIndex(args); + if (spreadArgIndex >= 0) { + return signature.hasRestParameter && spreadArgIndex >= signature.parameters.length - 1; + } + if (!signature.hasRestParameter && adjustedArgCount > signature.parameters.length) { + return false; + } + var hasEnoughArguments = adjustedArgCount >= signature.minArgumentCount; + return callIsIncomplete || hasEnoughArguments; + } + function getSingleCallSignature(type) { + if (type.flags & 48128) { + var resolved = resolveObjectOrUnionTypeMembers(type); + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && + resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + return resolved.callSignatures[0]; + } + } + return undefined; + } + function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) { + var context = createInferenceContext(signature.typeParameters, true); + forEachMatchingParameterType(contextualSignature, signature, function (source, target) { + inferTypes(context, instantiateType(source, contextualMapper), target); + }); + return getSignatureInstantiation(signature, getInferredTypes(context)); + } + function inferTypeArguments(signature, args, excludeArgument) { + var typeParameters = signature.typeParameters; + var context = createInferenceContext(typeParameters, false); + var inferenceMapper = createInferenceMapper(context); + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + if (arg.kind !== 170) { + var paramType = getTypeAtPosition(signature, arg.kind === 169 ? -1 : i); + if (i === 0 && args[i].parent.kind === 155) { + var argType = globalTemplateStringsArrayType; + } + else { + var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : inferenceMapper; + var argType = checkExpressionWithContextualType(arg, paramType, mapper); + } + inferTypes(context, argType, paramType); + } + } + if (excludeArgument) { + for (var i = 0; i < args.length; i++) { + if (excludeArgument[i] === false) { + var arg = args[i]; + var paramType = getTypeAtPosition(signature, arg.kind === 169 ? -1 : i); + inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); + } + } + } + var inferredTypes = getInferredTypes(context); + context.failedTypeParameterIndex = ts.indexOf(inferredTypes, inferenceFailureType); + for (var i = 0; i < inferredTypes.length; i++) { + if (inferredTypes[i] === inferenceFailureType) { + inferredTypes[i] = unknownType; + } + } + return context; + } + function checkTypeArguments(signature, typeArguments, typeArgumentResultTypes, reportErrors) { + var typeParameters = signature.typeParameters; + var typeArgumentsAreAssignable = true; + for (var i = 0; i < typeParameters.length; i++) { + var typeArgNode = typeArguments[i]; + var typeArgument = getTypeFromTypeNode(typeArgNode); + typeArgumentResultTypes[i] = typeArgument; + if (typeArgumentsAreAssignable) { + var constraint = getConstraintOfTypeParameter(typeParameters[i]); + if (constraint) { + typeArgumentsAreAssignable = checkTypeAssignableTo(typeArgument, constraint, reportErrors ? typeArgNode : undefined, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + } + } + } + return typeArgumentsAreAssignable; + } + function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { + for (var i = 0; i < args.length; i++) { + var arg = args[i]; + if (arg.kind !== 170) { + var paramType = getTypeAtPosition(signature, arg.kind === 169 ? -1 : i); + var argType = i === 0 && node.kind === 155 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + if (!checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1)) { + return false; + } + } + } + return true; + } + function getEffectiveCallArguments(node) { + var args; + if (node.kind === 155) { + var template = node.template; + args = [template]; + if (template.kind === 167) { + ts.forEach(template.templateSpans, function (span) { + args.push(span.expression); + }); + } + } + else { + args = node.arguments || emptyArray; + } + return args; + } + function getEffectiveTypeArguments(callExpression) { + if (callExpression.expression.kind === 90) { + var containingClass = ts.getAncestor(callExpression, 194); + var baseClassTypeNode = containingClass && ts.getClassBaseTypeNode(containingClass); + return baseClassTypeNode && baseClassTypeNode.typeArguments; + } + else { + return callExpression.typeArguments; + } + } + function resolveCall(node, signatures, candidatesOutArray) { + var isTaggedTemplate = node.kind === 155; + var typeArguments; + if (!isTaggedTemplate) { + typeArguments = getEffectiveTypeArguments(node); + if (node.expression.kind !== 90) { + ts.forEach(typeArguments, checkSourceElement); + } + } + var candidates = candidatesOutArray || []; + reorderCandidates(signatures, candidates); + if (!candidates.length) { + error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); + return resolveErrorCall(node); + } + var args = getEffectiveCallArguments(node); + var excludeArgument; + for (var i = isTaggedTemplate ? 1 : 0; i < args.length; i++) { + if (isContextSensitive(args[i])) { + if (!excludeArgument) { + excludeArgument = new Array(args.length); + } + excludeArgument[i] = true; + } + } + var candidateForArgumentError; + var candidateForTypeArgumentError; + var resultOfFailedInference; + var result; + if (candidates.length > 1) { + result = chooseOverload(candidates, subtypeRelation); + } + if (!result) { + candidateForArgumentError = undefined; + candidateForTypeArgumentError = undefined; + resultOfFailedInference = undefined; + result = chooseOverload(candidates, assignableRelation); + } + if (result) { + return result; + } + if (candidateForArgumentError) { + checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, undefined, true); + } + else if (candidateForTypeArgumentError) { + if (!isTaggedTemplate && node.typeArguments) { + checkTypeArguments(candidateForTypeArgumentError, node.typeArguments, [], true); + } + else { + ts.Debug.assert(resultOfFailedInference.failedTypeParameterIndex >= 0); + var failedTypeParameter = candidateForTypeArgumentError.typeParameters[resultOfFailedInference.failedTypeParameterIndex]; + var inferenceCandidates = getInferenceCandidates(resultOfFailedInference, resultOfFailedInference.failedTypeParameterIndex); + var diagnosticChainHead = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly, typeToString(failedTypeParameter)); + reportNoCommonSupertypeError(inferenceCandidates, node.expression || node.tag, diagnosticChainHead); + } + } + else { + error(node, ts.Diagnostics.Supplied_parameters_do_not_match_any_signature_of_call_target); + } + if (!produceDiagnostics) { + for (var i = 0, n = candidates.length; i < n; i++) { + if (hasCorrectArity(node, args, candidates[i])) { + return candidates[i]; + } + } + } + return resolveErrorCall(node); + function chooseOverload(candidates, relation) { + for (var i = 0; i < candidates.length; i++) { + if (!hasCorrectArity(node, args, candidates[i])) { + continue; + } + var originalCandidate = candidates[i]; + var inferenceResult; + while (true) { + var candidate = originalCandidate; + if (candidate.typeParameters) { + var typeArgumentTypes; + var typeArgumentsAreValid; + if (typeArguments) { + typeArgumentTypes = new Array(candidate.typeParameters.length); + typeArgumentsAreValid = checkTypeArguments(candidate, typeArguments, typeArgumentTypes, false); + } + else { + inferenceResult = inferTypeArguments(candidate, args, excludeArgument); + typeArgumentsAreValid = inferenceResult.failedTypeParameterIndex < 0; + typeArgumentTypes = inferenceResult.inferredTypes; + } + if (!typeArgumentsAreValid) { + break; + } + candidate = getSignatureInstantiation(candidate, typeArgumentTypes); + } + if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) { + break; + } + var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1; + if (index < 0) { + return candidate; + } + excludeArgument[index] = false; + } + if (originalCandidate.typeParameters) { + var instantiatedCandidate = candidate; + if (typeArgumentsAreValid) { + candidateForArgumentError = instantiatedCandidate; + } + else { + candidateForTypeArgumentError = originalCandidate; + if (!typeArguments) { + resultOfFailedInference = inferenceResult; + } + } + } + else { + ts.Debug.assert(originalCandidate === candidate); + candidateForArgumentError = originalCandidate; + } + } + return undefined; + } + } + function resolveCallExpression(node, candidatesOutArray) { + if (node.expression.kind === 90) { + var superType = checkSuperExpression(node.expression); + if (superType !== unknownType) { + return resolveCall(node, getSignaturesOfType(superType, 1), candidatesOutArray); + } + return resolveUntypedCall(node); + } + var funcType = checkExpression(node.expression); + var apparentType = getApparentType(funcType); + if (apparentType === unknownType) { + return resolveErrorCall(node); + } + var callSignatures = getSignaturesOfType(apparentType, 0); + var constructSignatures = getSignaturesOfType(apparentType, 1); + if (funcType === anyType || (!callSignatures.length && !constructSignatures.length && !(funcType.flags & 16384) && isTypeAssignableTo(funcType, globalFunctionType))) { + if (node.typeArguments) { + error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); + } + return resolveUntypedCall(node); + } + if (!callSignatures.length) { + if (constructSignatures.length) { + error(node, ts.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType)); + } + else { + error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + } + return resolveErrorCall(node); + } + return resolveCall(node, callSignatures, candidatesOutArray); + } + function resolveNewExpression(node, candidatesOutArray) { + if (node.arguments && languageVersion < 2) { + var spreadIndex = getSpreadArgumentIndex(node.arguments); + if (spreadIndex >= 0) { + error(node.arguments[spreadIndex], ts.Diagnostics.Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher); + } + } + var expressionType = checkExpression(node.expression); + if (expressionType === anyType) { + if (node.typeArguments) { + error(node, ts.Diagnostics.Untyped_function_calls_may_not_accept_type_arguments); + } + return resolveUntypedCall(node); + } + expressionType = getApparentType(expressionType); + if (expressionType === unknownType) { + return resolveErrorCall(node); + } + var constructSignatures = getSignaturesOfType(expressionType, 1); + if (constructSignatures.length) { + return resolveCall(node, constructSignatures, candidatesOutArray); + } + var callSignatures = getSignaturesOfType(expressionType, 0); + if (callSignatures.length) { + var signature = resolveCall(node, callSignatures, candidatesOutArray); + if (getReturnTypeOfSignature(signature) !== voidType) { + error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword); + } + return signature; + } + error(node, ts.Diagnostics.Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature); + return resolveErrorCall(node); + } + function resolveTaggedTemplateExpression(node, candidatesOutArray) { + var tagType = checkExpression(node.tag); + var apparentType = getApparentType(tagType); + if (apparentType === unknownType) { + return resolveErrorCall(node); + } + var callSignatures = getSignaturesOfType(apparentType, 0); + if (tagType === anyType || (!callSignatures.length && !(tagType.flags & 16384) && isTypeAssignableTo(tagType, globalFunctionType))) { + return resolveUntypedCall(node); + } + if (!callSignatures.length) { + error(node, ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature); + return resolveErrorCall(node); + } + return resolveCall(node, callSignatures, candidatesOutArray); + } + function getResolvedSignature(node, candidatesOutArray) { + var links = getNodeLinks(node); + if (!links.resolvedSignature || candidatesOutArray) { + links.resolvedSignature = anySignature; + if (node.kind === 153) { + links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); + } + else if (node.kind === 154) { + links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); + } + else if (node.kind === 155) { + links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); + } + else { + ts.Debug.fail("Branch in 'getResolvedSignature' should be unreachable."); + } + } + return links.resolvedSignature; + } + function checkCallExpression(node) { + checkGrammarTypeArguments(node, node.typeArguments) || checkGrammarArguments(node, node.arguments); + var signature = getResolvedSignature(node); + if (node.expression.kind === 90) { + return voidType; + } + if (node.kind === 154) { + var declaration = signature.declaration; + if (declaration && + declaration.kind !== 131 && + declaration.kind !== 135 && + declaration.kind !== 139) { + if (compilerOptions.noImplicitAny) { + error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); + } + return anyType; + } + } + return getReturnTypeOfSignature(signature); + } + function checkTaggedTemplateExpression(node) { + if (languageVersion < 2) { + grammarErrorOnFirstToken(node.template, ts.Diagnostics.Tagged_templates_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + return getReturnTypeOfSignature(getResolvedSignature(node)); + } + function checkTypeAssertion(node) { + var exprType = checkExpression(node.expression); + var targetType = getTypeFromTypeNode(node.type); + if (produceDiagnostics && targetType !== unknownType) { + var widenedType = getWidenedType(exprType); + if (!(isTypeAssignableTo(targetType, widenedType))) { + checkTypeAssignableTo(exprType, targetType, node, ts.Diagnostics.Neither_type_0_nor_type_1_is_assignable_to_the_other); + } + } + return targetType; + } + function getTypeAtPosition(signature, pos) { + if (pos >= 0) { + return signature.hasRestParameter ? pos < signature.parameters.length - 1 ? getTypeOfSymbol(signature.parameters[pos]) : getRestTypeOfSignature(signature) : pos < signature.parameters.length ? getTypeOfSymbol(signature.parameters[pos]) : anyType; + } + return signature.hasRestParameter ? getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]) : anyArrayType; + } + function assignContextualParameterTypes(signature, context, mapper) { + var len = signature.parameters.length - (signature.hasRestParameter ? 1 : 0); + for (var i = 0; i < len; i++) { + var parameter = signature.parameters[i]; + var links = getSymbolLinks(parameter); + links.type = instantiateType(getTypeAtPosition(context, i), mapper); + } + if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { + var parameter = signature.parameters[signature.parameters.length - 1]; + var links = getSymbolLinks(parameter); + links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper); + } + } + function getReturnTypeFromBody(func, contextualMapper) { + var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func); + if (!func.body) { + return unknownType; + } + if (func.body.kind !== 172) { + var type = checkExpressionCached(func.body, contextualMapper); + } + else { + var types = checkAndAggregateReturnExpressionTypes(func.body, contextualMapper); + if (types.length === 0) { + return voidType; + } + var type = contextualSignature ? getUnionType(types) : getCommonSupertype(types); + if (!type) { + error(func, ts.Diagnostics.No_best_common_type_exists_among_return_expressions); + return unknownType; + } + } + if (!contextualSignature) { + reportErrorsFromWidening(func, type); + } + return getWidenedType(type); + } + function checkAndAggregateReturnExpressionTypes(body, contextualMapper) { + var aggregatedTypes = []; + ts.forEachReturnStatement(body, function (returnStatement) { + var expr = returnStatement.expression; + if (expr) { + var type = checkExpressionCached(expr, contextualMapper); + if (!ts.contains(aggregatedTypes, type)) { + aggregatedTypes.push(type); + } + } + }); + return aggregatedTypes; + } + function bodyContainsAReturnStatement(funcBody) { + return ts.forEachReturnStatement(funcBody, function (returnStatement) { + return true; + }); + } + function bodyContainsSingleThrowStatement(body) { + return (body.statements.length === 1) && (body.statements[0].kind === 188); + } + function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { + if (!produceDiagnostics) { + return; + } + if (returnType === voidType || returnType === anyType) { + return; + } + if (ts.nodeIsMissing(func.body) || func.body.kind !== 172) { + return; + } + var bodyBlock = func.body; + if (bodyContainsAReturnStatement(bodyBlock)) { + return; + } + if (bodyContainsSingleThrowStatement(bodyBlock)) { + return; + } + error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement); + } + function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); + var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); + if (!hasGrammarError && node.kind === 158) { + checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); + } + if (contextualMapper === identityMapper && isContextSensitive(node)) { + return anyFunctionType; + } + var links = getNodeLinks(node); + var type = getTypeOfSymbol(node.symbol); + if (!(links.flags & 64)) { + var contextualSignature = getContextualSignature(node); + if (!(links.flags & 64)) { + links.flags |= 64; + if (contextualSignature) { + var signature = getSignaturesOfType(type, 0)[0]; + if (isContextSensitive(node)) { + assignContextualParameterTypes(signature, contextualSignature, contextualMapper || identityMapper); + } + if (!node.type) { + signature.resolvedReturnType = resolvingType; + var returnType = getReturnTypeFromBody(node, contextualMapper); + if (signature.resolvedReturnType === resolvingType) { + signature.resolvedReturnType = returnType; + } + } + } + checkSignatureDeclaration(node); + } + } + if (produceDiagnostics && node.kind !== 130 && node.kind !== 129) { + checkCollisionWithCapturedSuperVariable(node, node.name); + checkCollisionWithCapturedThisVariable(node, node.name); + } + return type; + } + function checkFunctionExpressionOrObjectLiteralMethodBody(node) { + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); + if (node.type) { + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + } + if (node.body) { + if (node.body.kind === 172) { + checkSourceElement(node.body); + } + else { + var exprType = checkExpression(node.body); + if (node.type) { + checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, undefined); + } + checkFunctionExpressionBodies(node.body); + } + } + } + function checkArithmeticOperandType(operand, type, diagnostic) { + if (!allConstituentTypesHaveKind(type, 1 | 132)) { + error(operand, diagnostic); + return false; + } + return true; + } + function checkReferenceExpression(n, invalidReferenceMessage, constantVarianleMessage) { + function findSymbol(n) { + var symbol = getNodeLinks(n).resolvedSymbol; + return symbol && getExportSymbolOfValueSymbolIfExported(symbol); + } + function isReferenceOrErrorExpression(n) { + switch (n.kind) { + case 64: + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; + case 151: + var symbol = findSymbol(n); + return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; + case 152: + return true; + case 157: + return isReferenceOrErrorExpression(n.expression); + default: + return false; + } + } + function isConstVariableReference(n) { + switch (n.kind) { + case 64: + case 151: + var symbol = findSymbol(n); + return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 4096) !== 0; + case 152: + var index = n.argumentExpression; + var symbol = findSymbol(n.expression); + if (symbol && index && index.kind === 8) { + var name = index.text; + var prop = getPropertyOfType(getTypeOfSymbol(symbol), name); + return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 4096) !== 0; + } + return false; + case 157: + return isConstVariableReference(n.expression); + default: + return false; + } + } + if (!isReferenceOrErrorExpression(n)) { + error(n, invalidReferenceMessage); + return false; + } + if (isConstVariableReference(n)) { + error(n, constantVarianleMessage); + return false; + } + return true; + } + function checkDeleteExpression(node) { + if (node.parserContextFlags & 1 && node.expression.kind === 64) { + grammarErrorOnNode(node.expression, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode); + } + var operandType = checkExpression(node.expression); + return booleanType; + } + function checkTypeOfExpression(node) { + var operandType = checkExpression(node.expression); + return stringType; + } + function checkVoidExpression(node) { + var operandType = checkExpression(node.expression); + return undefinedType; + } + function checkPrefixUnaryExpression(node) { + if ((node.operator === 38 || node.operator === 39)) { + checkGrammarEvalOrArgumentsInStrictMode(node, node.operand); + } + var operandType = checkExpression(node.operand); + switch (node.operator) { + case 33: + case 34: + case 47: + if (someConstituentTypeHasKind(operandType, 1048576)) { + error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); + } + return numberType; + case 46: + return booleanType; + case 38: + case 39: + var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + if (ok) { + checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); + } + return numberType; + } + return unknownType; + } + function checkPostfixUnaryExpression(node) { + checkGrammarEvalOrArgumentsInStrictMode(node, node.operand); + var operandType = checkExpression(node.operand); + var ok = checkArithmeticOperandType(node.operand, operandType, ts.Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type); + if (ok) { + checkReferenceExpression(node.operand, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer, ts.Diagnostics.The_operand_of_an_increment_or_decrement_operator_cannot_be_a_constant); + } + return numberType; + } + function someConstituentTypeHasKind(type, kind) { + if (type.flags & kind) { + return true; + } + if (type.flags & 16384) { + var types = type.types; + for (var i = 0; i < types.length; i++) { + if (types[i].flags & kind) { + return true; + } + } + return false; + } + return false; + } + function allConstituentTypesHaveKind(type, kind) { + if (type.flags & kind) { + return true; + } + if (type.flags & 16384) { + var types = type.types; + for (var i = 0; i < types.length; i++) { + if (!(types[i].flags & kind)) { + return false; + } + } + return true; + } + return false; + } + function isConstEnumObjectType(type) { + return type.flags & (48128 | 32768) && type.symbol && isConstEnumSymbol(type.symbol); + } + function isConstEnumSymbol(symbol) { + return (symbol.flags & 128) !== 0; + } + function checkInstanceOfExpression(node, leftType, rightType) { + if (allConstituentTypesHaveKind(leftType, 1049086)) { + error(node.left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); + } + if (!(rightType.flags & 1 || isTypeSubtypeOf(rightType, globalFunctionType))) { + error(node.right, ts.Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type); + } + return booleanType; + } + function checkInExpression(node, leftType, rightType) { + if (!allConstituentTypesHaveKind(leftType, 1 | 258 | 132 | 1048576)) { + error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); + } + if (!allConstituentTypesHaveKind(rightType, 1 | 48128 | 512)) { + error(node.right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); + } + return booleanType; + } + function checkObjectLiteralAssignment(node, sourceType, contextualMapper) { + var properties = node.properties; + for (var i = 0; i < properties.length; i++) { + var p = properties[i]; + if (p.kind === 207 || p.kind === 208) { + var name = p.name; + var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || + isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || + getIndexTypeOfType(sourceType, 0); + if (type) { + checkDestructuringAssignment(p.initializer || name, type); + } + else { + error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(sourceType), ts.declarationNameToString(name)); + } + } + else { + error(p, ts.Diagnostics.Property_assignment_expected); + } + } + return sourceType; + } + function checkArrayLiteralAssignment(node, sourceType, contextualMapper) { + if (!isArrayLikeType(sourceType)) { + error(node, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(sourceType)); + return sourceType; + } + var elements = node.elements; + for (var i = 0; i < elements.length; i++) { + var e = elements[i]; + if (e.kind !== 170) { + if (e.kind !== 169) { + var propName = "" + i; + var type = sourceType.flags & 1 ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : getIndexTypeOfType(sourceType, 1); + if (type) { + checkDestructuringAssignment(e, type, contextualMapper); + } + else { + error(e, ts.Diagnostics.Type_0_has_no_property_1, typeToString(sourceType), propName); + } + } + else { + if (i === elements.length - 1) { + checkReferenceAssignment(e.expression, sourceType, contextualMapper); + } + else { + error(e, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + } + } + } + } + return sourceType; + } + function checkDestructuringAssignment(target, sourceType, contextualMapper) { + if (target.kind === 165 && target.operatorToken.kind === 52) { + checkBinaryExpression(target, contextualMapper); + target = target.left; + } + if (target.kind === 150) { + return checkObjectLiteralAssignment(target, sourceType, contextualMapper); + } + if (target.kind === 149) { + return checkArrayLiteralAssignment(target, sourceType, contextualMapper); + } + return checkReferenceAssignment(target, sourceType, contextualMapper); + } + function checkReferenceAssignment(target, sourceType, contextualMapper) { + var targetType = checkExpression(target, contextualMapper); + if (checkReferenceExpression(target, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant)) { + checkTypeAssignableTo(sourceType, targetType, target, undefined); + } + return sourceType; + } + function checkBinaryExpression(node, contextualMapper) { + if (ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operatorToken.kind)) { + checkGrammarEvalOrArgumentsInStrictMode(node, node.left); + } + var operator = node.operatorToken.kind; + if (operator === 52 && (node.left.kind === 150 || node.left.kind === 149)) { + return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); + } + var leftType = checkExpression(node.left, contextualMapper); + var rightType = checkExpression(node.right, contextualMapper); + switch (operator) { + case 35: + case 55: + case 36: + case 56: + case 37: + case 57: + case 34: + case 54: + case 40: + case 58: + case 41: + case 59: + case 42: + case 60: + case 44: + case 62: + case 45: + case 63: + case 43: + case 61: + if (leftType.flags & (32 | 64)) + leftType = rightType; + if (rightType.flags & (32 | 64)) + rightType = leftType; + var suggestedOperator; + if ((leftType.flags & 8) && + (rightType.flags & 8) && + (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { + error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operatorToken.kind), ts.tokenToString(suggestedOperator)); + } + else { + var leftOk = checkArithmeticOperandType(node.left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + var rightOk = checkArithmeticOperandType(node.right, rightType, ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); + if (leftOk && rightOk) { + checkAssignmentOperator(numberType); + } + } + return numberType; + case 33: + case 53: + if (leftType.flags & (32 | 64)) + leftType = rightType; + if (rightType.flags & (32 | 64)) + rightType = leftType; + var resultType; + if (allConstituentTypesHaveKind(leftType, 132) && allConstituentTypesHaveKind(rightType, 132)) { + resultType = numberType; + } + else { + if (allConstituentTypesHaveKind(leftType, 258) || allConstituentTypesHaveKind(rightType, 258)) { + resultType = stringType; + } + else if (leftType.flags & 1 || rightType.flags & 1) { + resultType = anyType; + } + if (resultType && !checkForDisallowedESSymbolOperand(operator)) { + return resultType; + } + } + if (!resultType) { + reportOperatorError(); + return anyType; + } + if (operator === 53) { + checkAssignmentOperator(resultType); + } + return resultType; + case 24: + case 25: + case 26: + case 27: + if (!checkForDisallowedESSymbolOperand(operator)) { + return booleanType; + } + case 28: + case 29: + case 30: + case 31: + if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { + reportOperatorError(); + } + return booleanType; + case 86: + return checkInstanceOfExpression(node, leftType, rightType); + case 85: + return checkInExpression(node, leftType, rightType); + case 48: + return rightType; + case 49: + return getUnionType([leftType, rightType]); + case 52: + checkAssignmentOperator(rightType); + return rightType; + case 23: + return rightType; + } + function checkForDisallowedESSymbolOperand(operator) { + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : someConstituentTypeHasKind(rightType, 1048576) ? node.right : undefined; + if (offendingSymbolOperand) { + error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); + return false; + } + return true; + } + function getSuggestedBooleanOperator(operator) { + switch (operator) { + case 44: + case 62: + return 49; + case 45: + case 63: + return 31; + case 43: + case 61: + return 48; + default: + return undefined; + } + } + function checkAssignmentOperator(valueType) { + if (produceDiagnostics && operator >= 52 && operator <= 63) { + var ok = checkReferenceExpression(node.left, ts.Diagnostics.Invalid_left_hand_side_of_assignment_expression, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + if (ok) { + checkTypeAssignableTo(valueType, leftType, node.left, undefined); + } + } + } + function reportOperatorError() { + error(node, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(node.operatorToken.kind), typeToString(leftType), typeToString(rightType)); + } + } + function checkYieldExpression(node) { + if (!(node.parserContextFlags & 4)) { + grammarErrorOnFirstToken(node, ts.Diagnostics.yield_expression_must_be_contained_within_a_generator_declaration); + } + else { + grammarErrorOnFirstToken(node, ts.Diagnostics.yield_expressions_are_not_currently_supported); + } + } + function checkConditionalExpression(node, contextualMapper) { + checkExpression(node.condition); + var type1 = checkExpression(node.whenTrue, contextualMapper); + var type2 = checkExpression(node.whenFalse, contextualMapper); + return getUnionType([type1, type2]); + } + function checkTemplateExpression(node) { + ts.forEach(node.templateSpans, function (templateSpan) { + checkExpression(templateSpan.expression); + }); + return stringType; + } + function checkExpressionWithContextualType(node, contextualType, contextualMapper) { + var saveContextualType = node.contextualType; + node.contextualType = contextualType; + var result = checkExpression(node, contextualMapper); + node.contextualType = saveContextualType; + return result; + } + function checkExpressionCached(node, contextualMapper) { + var links = getNodeLinks(node); + if (!links.resolvedType) { + links.resolvedType = checkExpression(node, contextualMapper); + } + return links.resolvedType; + } + function checkPropertyAssignment(node, contextualMapper) { + if (node.name.kind === 124) { + checkComputedPropertyName(node.name); + } + return checkExpression(node.initializer, contextualMapper); + } + function checkObjectLiteralMethod(node, contextualMapper) { + checkGrammarMethod(node); + if (node.name.kind === 124) { + checkComputedPropertyName(node.name); + } + var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); + return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + } + function instantiateTypeWithSingleGenericCallSignature(node, type, contextualMapper) { + if (contextualMapper && contextualMapper !== identityMapper) { + var signature = getSingleCallSignature(type); + if (signature && signature.typeParameters) { + var contextualType = getContextualType(node); + if (contextualType) { + var contextualSignature = getSingleCallSignature(contextualType); + if (contextualSignature && !contextualSignature.typeParameters) { + return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper)); + } + } + } + } + return type; + } + function checkExpression(node, contextualMapper) { + return checkExpressionOrQualifiedName(node, contextualMapper); + } + function checkExpressionOrQualifiedName(node, contextualMapper) { + var type; + if (node.kind == 123) { + type = checkQualifiedName(node); + } + else { + var uninstantiatedType = checkExpressionWorker(node, contextualMapper); + type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); + } + if (isConstEnumObjectType(type)) { + var ok = (node.parent.kind === 151 && node.parent.expression === node) || + (node.parent.kind === 152 && node.parent.expression === node) || + ((node.kind === 64 || node.kind === 123) && isInRightSideOfImportOrExportAssignment(node)); + if (!ok) { + error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); + } + } + return type; + } + function checkNumericLiteral(node) { + checkGrammarNumbericLiteral(node); + return numberType; + } + function checkExpressionWorker(node, contextualMapper) { + switch (node.kind) { + case 64: + return checkIdentifier(node); + case 92: + return checkThisExpression(node); + case 90: + return checkSuperExpression(node); + case 88: + return nullType; + case 94: + case 79: + return booleanType; + case 7: + return checkNumericLiteral(node); + case 167: + return checkTemplateExpression(node); + case 8: + case 10: + return stringType; + case 9: + return globalRegExpType; + case 149: + return checkArrayLiteral(node, contextualMapper); + case 150: + return checkObjectLiteral(node, contextualMapper); + case 151: + return checkPropertyAccessExpression(node); + case 152: + return checkIndexedAccess(node); + case 153: + case 154: + return checkCallExpression(node); + case 155: + return checkTaggedTemplateExpression(node); + case 156: + return checkTypeAssertion(node); + case 157: + return checkExpression(node.expression, contextualMapper); + case 158: + case 159: + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); + case 161: + return checkTypeOfExpression(node); + case 160: + return checkDeleteExpression(node); + case 162: + return checkVoidExpression(node); + case 163: + return checkPrefixUnaryExpression(node); + case 164: + return checkPostfixUnaryExpression(node); + case 165: + return checkBinaryExpression(node, contextualMapper); + case 166: + return checkConditionalExpression(node, contextualMapper); + case 169: + return checkSpreadElementExpression(node, contextualMapper); + case 170: + return undefinedType; + case 168: + checkYieldExpression(node); + return unknownType; + } + return unknownType; + } + function checkTypeParameter(node) { + if (node.expression) { + grammarErrorOnFirstToken(node.expression, ts.Diagnostics.Type_expected); + } + checkSourceElement(node.constraint); + if (produceDiagnostics) { + checkTypeParameterHasIllegalReferencesInConstraint(node); + checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); + } + } + function checkParameter(node) { + checkGrammarModifiers(node) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + checkVariableLikeDeclaration(node); + var func = ts.getContainingFunction(node); + if (node.flags & 112) { + func = ts.getContainingFunction(node); + if (!(func.kind === 131 && ts.nodeIsPresent(func.body))) { + error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); + } + } + if (node.questionToken && ts.isBindingPattern(node.name) && func.body) { + error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); + } + if (node.dotDotDotToken) { + if (!isArrayType(getTypeOfSymbol(node.symbol))) { + error(node, ts.Diagnostics.A_rest_parameter_must_be_of_an_array_type); + } + } + } + function checkSignatureDeclaration(node) { + if (node.kind === 136) { + checkGrammarIndexSignature(node); + } + else if (node.kind === 138 || node.kind === 193 || node.kind === 139 || + node.kind === 134 || node.kind === 131 || + node.kind === 135) { + checkGrammarFunctionLikeDeclaration(node); + } + checkTypeParameters(node.typeParameters); + ts.forEach(node.parameters, checkParameter); + if (node.type) { + checkSourceElement(node.type); + } + if (produceDiagnostics) { + checkCollisionWithArgumentsInGeneratedCode(node); + if (compilerOptions.noImplicitAny && !node.type) { + switch (node.kind) { + case 135: + error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); + break; + case 134: + error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); + break; + } + } + } + checkSpecializedSignatureDeclaration(node); + } + function checkTypeForDuplicateIndexSignatures(node) { + if (node.kind === 195) { + var nodeSymbol = getSymbolOfNode(node); + if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { + return; + } + } + var indexSymbol = getIndexSymbol(getSymbolOfNode(node)); + if (indexSymbol) { + var seenNumericIndexer = false; + var seenStringIndexer = false; + for (var i = 0, len = indexSymbol.declarations.length; i < len; ++i) { + var declaration = indexSymbol.declarations[i]; + if (declaration.parameters.length === 1 && declaration.parameters[0].type) { + switch (declaration.parameters[0].type.kind) { + case 119: + if (!seenStringIndexer) { + seenStringIndexer = true; + } + else { + error(declaration, ts.Diagnostics.Duplicate_string_index_signature); + } + break; + case 117: + if (!seenNumericIndexer) { + seenNumericIndexer = true; + } + else { + error(declaration, ts.Diagnostics.Duplicate_number_index_signature); + } + break; + } + } + } + } + } + function checkPropertyDeclaration(node) { + checkGrammarModifiers(node) || checkGrammarProperty(node) || checkGrammarComputedPropertyName(node.name); + checkVariableLikeDeclaration(node); + } + function checkMethodDeclaration(node) { + checkGrammarMethod(node) || checkGrammarComputedPropertyName(node.name); + checkFunctionLikeDeclaration(node); + } + function checkConstructorDeclaration(node) { + checkSignatureDeclaration(node); + checkGrammarConstructorTypeParameters(node) || checkGrammarConstructorTypeAnnotation(node); + checkSourceElement(node.body); + var symbol = getSymbolOfNode(node); + var firstDeclaration = ts.getDeclarationOfKind(symbol, node.kind); + if (node === firstDeclaration) { + checkFunctionOrConstructorSymbol(symbol); + } + if (ts.nodeIsMissing(node.body)) { + return; + } + if (!produceDiagnostics) { + return; + } + function isSuperCallExpression(n) { + return n.kind === 153 && n.expression.kind === 90; + } + function containsSuperCall(n) { + if (isSuperCallExpression(n)) { + return true; + } + switch (n.kind) { + case 158: + case 193: + case 159: + case 150: return false; + default: return ts.forEachChild(n, containsSuperCall); + } + } + function markThisReferencesAsErrors(n) { + if (n.kind === 92) { + error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); + } + else if (n.kind !== 158 && n.kind !== 193) { + ts.forEachChild(n, markThisReferencesAsErrors); + } + } + function isInstancePropertyWithInitializer(n) { + return n.kind === 128 && + !(n.flags & 128) && + !!n.initializer; + } + if (ts.getClassBaseTypeNode(node.parent)) { + if (containsSuperCall(node.body)) { + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || + ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); + if (superCallShouldBeFirst) { + var statements = node.body.statements; + if (!statements.length || statements[0].kind !== 175 || !isSuperCallExpression(statements[0].expression)) { + error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); + } + else { + markThisReferencesAsErrors(statements[0].expression); + } + } + } + else { + error(node, ts.Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call); + } + } + } + function checkAccessorDeclaration(node) { + if (produceDiagnostics) { + checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); + if (node.kind === 132) { + if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && !(bodyContainsAReturnStatement(node.body) || bodyContainsSingleThrowStatement(node.body))) { + error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); + } + } + if (!ts.hasDynamicName(node)) { + var otherKind = node.kind === 132 ? 133 : 132; + var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); + if (otherAccessor) { + if (((node.flags & 112) !== (otherAccessor.flags & 112))) { + error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); + } + var currentAccessorType = getAnnotatedAccessorType(node); + var otherAccessorType = getAnnotatedAccessorType(otherAccessor); + if (currentAccessorType && otherAccessorType) { + if (!isTypeIdenticalTo(currentAccessorType, otherAccessorType)) { + error(node, ts.Diagnostics.get_and_set_accessor_must_have_the_same_type); + } + } + } + } + checkAndStoreTypeOfAccessors(getSymbolOfNode(node)); + } + checkFunctionLikeDeclaration(node); + } + function checkTypeReference(node) { + checkGrammarTypeArguments(node, node.typeArguments); + var type = getTypeFromTypeReferenceNode(node); + if (type !== unknownType && node.typeArguments) { + var len = node.typeArguments.length; + for (var i = 0; i < len; i++) { + checkSourceElement(node.typeArguments[i]); + var constraint = getConstraintOfTypeParameter(type.target.typeParameters[i]); + if (produceDiagnostics && constraint) { + var typeArgument = type.typeArguments[i]; + checkTypeAssignableTo(typeArgument, constraint, node, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1); + } + } + } + } + function checkTypeQuery(node) { + getTypeFromTypeQueryNode(node); + } + function checkTypeLiteral(node) { + ts.forEach(node.members, checkSourceElement); + if (produceDiagnostics) { + var type = getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); + checkIndexConstraints(type); + checkTypeForDuplicateIndexSignatures(node); + } + } + function checkArrayType(node) { + checkSourceElement(node.elementType); + } + function checkTupleType(node) { + var hasErrorFromDisallowedTrailingComma = checkGrammarForDisallowedTrailingComma(node.elementTypes); + if (!hasErrorFromDisallowedTrailingComma && node.elementTypes.length === 0) { + grammarErrorOnNode(node, ts.Diagnostics.A_tuple_type_element_list_cannot_be_empty); + } + ts.forEach(node.elementTypes, checkSourceElement); + } + function checkUnionType(node) { + ts.forEach(node.types, checkSourceElement); + } + function isPrivateWithinAmbient(node) { + return (node.flags & 32) && ts.isInAmbientContext(node); + } + function checkSpecializedSignatureDeclaration(signatureDeclarationNode) { + if (!produceDiagnostics) { + return; + } + var signature = getSignatureFromDeclaration(signatureDeclarationNode); + if (!signature.hasStringLiterals) { + return; + } + if (ts.nodeIsPresent(signatureDeclarationNode.body)) { + error(signatureDeclarationNode, ts.Diagnostics.A_signature_with_an_implementation_cannot_use_a_string_literal_type); + return; + } + var signaturesToCheck; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 195) { + ts.Debug.assert(signatureDeclarationNode.kind === 134 || signatureDeclarationNode.kind === 135); + var signatureKind = signatureDeclarationNode.kind === 134 ? 0 : 1; + var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); + var containingType = getDeclaredTypeOfSymbol(containingSymbol); + signaturesToCheck = getSignaturesOfType(containingType, signatureKind); + } + else { + signaturesToCheck = getSignaturesOfSymbol(getSymbolOfNode(signatureDeclarationNode)); + } + for (var i = 0; i < signaturesToCheck.length; i++) { + var otherSignature = signaturesToCheck[i]; + if (!otherSignature.hasStringLiterals && isSignatureAssignableTo(signature, otherSignature)) { + return; + } + } + error(signatureDeclarationNode, ts.Diagnostics.Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature); + } + function getEffectiveDeclarationFlags(n, flagsToCheck) { + var flags = ts.getCombinedNodeFlags(n); + if (n.parent.kind !== 195 && ts.isInAmbientContext(n)) { + if (!(flags & 2)) { + flags |= 1; + } + flags |= 2; + } + return flags & flagsToCheck; + } + function checkFunctionOrConstructorSymbol(symbol) { + if (!produceDiagnostics) { + return; + } + function getCanonicalOverload(overloads, implementation) { + var implementationSharesContainerWithFirstOverload = implementation !== undefined && implementation.parent === overloads[0].parent; + return implementationSharesContainerWithFirstOverload ? implementation : overloads[0]; + } + function checkFlagAgreementBetweenOverloads(overloads, implementation, flagsToCheck, someOverloadFlags, allOverloadFlags) { + var someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags; + if (someButNotAllOverloadFlags !== 0) { + var canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck); + ts.forEach(overloads, function (o) { + var deviation = getEffectiveDeclarationFlags(o, flagsToCheck) ^ canonicalFlags; + if (deviation & 1) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_exported_or_not_exported); + } + else if (deviation & 2) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient); + } + else if (deviation & (32 | 64)) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); + } + }); + } + } + function checkQuestionTokenAgreementBetweenOverloads(overloads, implementation, someHaveQuestionToken, allHaveQuestionToken) { + if (someHaveQuestionToken !== allHaveQuestionToken) { + var canonicalHasQuestionToken = ts.hasQuestionToken(getCanonicalOverload(overloads, implementation)); + ts.forEach(overloads, function (o) { + var deviation = ts.hasQuestionToken(o) !== canonicalHasQuestionToken; + if (deviation) { + error(o.name, ts.Diagnostics.Overload_signatures_must_all_be_optional_or_required); + } + }); + } + } + var flagsToCheck = 1 | 2 | 32 | 64; + var someNodeFlags = 0; + var allNodeFlags = flagsToCheck; + var someHaveQuestionToken = false; + var allHaveQuestionToken = true; + var hasOverloads = false; + var bodyDeclaration; + var lastSeenNonAmbientDeclaration; + var previousDeclaration; + var declarations = symbol.declarations; + var isConstructor = (symbol.flags & 16384) !== 0; + function reportImplementationExpectedError(node) { + if (node.name && ts.getFullWidth(node.name) === 0) { + return; + } + var seen = false; + var subsequentNode = ts.forEachChild(node.parent, function (c) { + if (seen) { + return c; + } + else { + seen = c === node; + } + }); + if (subsequentNode) { + if (subsequentNode.kind === node.kind) { + var errorNode = subsequentNode.name || subsequentNode; + if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { + ts.Debug.assert(node.kind === 130 || node.kind === 129); + ts.Debug.assert((node.flags & 128) !== (subsequentNode.flags & 128)); + var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + error(errorNode, diagnostic); + return; + } + else if (ts.nodeIsPresent(subsequentNode.body)) { + error(errorNode, ts.Diagnostics.Function_implementation_name_must_be_0, ts.declarationNameToString(node.name)); + return; + } + } + } + var errorNode = node.name || node; + if (isConstructor) { + error(errorNode, ts.Diagnostics.Constructor_implementation_is_missing); + } + else { + error(errorNode, ts.Diagnostics.Function_implementation_is_missing_or_not_immediately_following_the_declaration); + } + } + var isExportSymbolInsideModule = symbol.parent && symbol.parent.flags & 1536; + var duplicateFunctionDeclaration = false; + var multipleConstructorImplementation = false; + for (var i = 0; i < declarations.length; i++) { + var node = declarations[i]; + var inAmbientContext = ts.isInAmbientContext(node); + var inAmbientContextOrInterface = node.parent.kind === 195 || node.parent.kind === 141 || inAmbientContext; + if (inAmbientContextOrInterface) { + previousDeclaration = undefined; + } + if (node.kind === 193 || node.kind === 130 || node.kind === 129 || node.kind === 131) { + var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); + someNodeFlags |= currentNodeFlags; + allNodeFlags &= currentNodeFlags; + someHaveQuestionToken = someHaveQuestionToken || ts.hasQuestionToken(node); + allHaveQuestionToken = allHaveQuestionToken && ts.hasQuestionToken(node); + if (ts.nodeIsPresent(node.body) && bodyDeclaration) { + if (isConstructor) { + multipleConstructorImplementation = true; + } + else { + duplicateFunctionDeclaration = true; + } + } + else if (!isExportSymbolInsideModule && previousDeclaration && previousDeclaration.parent === node.parent && previousDeclaration.end !== node.pos) { + reportImplementationExpectedError(previousDeclaration); + } + if (ts.nodeIsPresent(node.body)) { + if (!bodyDeclaration) { + bodyDeclaration = node; + } + } + else { + hasOverloads = true; + } + previousDeclaration = node; + if (!inAmbientContextOrInterface) { + lastSeenNonAmbientDeclaration = node; + } + } + } + if (multipleConstructorImplementation) { + ts.forEach(declarations, function (declaration) { + error(declaration, ts.Diagnostics.Multiple_constructor_implementations_are_not_allowed); + }); + } + if (duplicateFunctionDeclaration) { + ts.forEach(declarations, function (declaration) { + error(declaration.name, ts.Diagnostics.Duplicate_function_implementation); + }); + } + if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body) { + reportImplementationExpectedError(lastSeenNonAmbientDeclaration); + } + if (hasOverloads) { + checkFlagAgreementBetweenOverloads(declarations, bodyDeclaration, flagsToCheck, someNodeFlags, allNodeFlags); + checkQuestionTokenAgreementBetweenOverloads(declarations, bodyDeclaration, someHaveQuestionToken, allHaveQuestionToken); + if (bodyDeclaration) { + var signatures = getSignaturesOfSymbol(symbol); + var bodySignature = getSignatureFromDeclaration(bodyDeclaration); + if (!bodySignature.hasStringLiterals) { + for (var i = 0, len = signatures.length; i < len; ++i) { + if (!signatures[i].hasStringLiterals && !isSignatureAssignableTo(bodySignature, signatures[i])) { + error(signatures[i].declaration, ts.Diagnostics.Overload_signature_is_not_compatible_with_function_implementation); + break; + } + } + } + } + } + } + function checkExportsOnMergedDeclarations(node) { + if (!produceDiagnostics) { + return; + } + var symbol; + var symbol = node.localSymbol; + if (!symbol) { + symbol = getSymbolOfNode(node); + if (!(symbol.flags & 7340032)) { + return; + } + } + if (ts.getDeclarationOfKind(symbol, node.kind) !== node) { + return; + } + var exportedDeclarationSpaces = 0; + var nonExportedDeclarationSpaces = 0; + ts.forEach(symbol.declarations, function (d) { + var declarationSpaces = getDeclarationSpaces(d); + if (getEffectiveDeclarationFlags(d, 1)) { + exportedDeclarationSpaces |= declarationSpaces; + } + else { + nonExportedDeclarationSpaces |= declarationSpaces; + } + }); + var commonDeclarationSpace = exportedDeclarationSpaces & nonExportedDeclarationSpaces; + if (commonDeclarationSpace) { + ts.forEach(symbol.declarations, function (d) { + if (getDeclarationSpaces(d) & commonDeclarationSpace) { + error(d.name, ts.Diagnostics.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local, ts.declarationNameToString(d.name)); + } + }); + } + function getDeclarationSpaces(d) { + switch (d.kind) { + case 195: + return 2097152; + case 198: + return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; + case 194: + case 197: + return 2097152 | 1048576; + case 200: + var result = 0; + var target = resolveImport(getSymbolOfNode(d)); + ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); + return result; + default: + return 1048576; + } + } + } + function checkFunctionDeclaration(node) { + if (produceDiagnostics) { + checkFunctionLikeDeclaration(node) || + checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionName(node.name) || + checkGrammarForGenerator(node); + checkCollisionWithCapturedSuperVariable(node, node.name); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + } + } + function checkFunctionLikeDeclaration(node) { + checkSignatureDeclaration(node); + if (node.name.kind === 124) { + checkComputedPropertyName(node.name); + } + if (!ts.hasDynamicName(node)) { + var symbol = getSymbolOfNode(node); + var localSymbol = node.localSymbol || symbol; + var firstDeclaration = ts.getDeclarationOfKind(localSymbol, node.kind); + if (node === firstDeclaration) { + checkFunctionOrConstructorSymbol(localSymbol); + } + if (symbol.parent) { + if (ts.getDeclarationOfKind(symbol, node.kind) === node) { + checkFunctionOrConstructorSymbol(symbol); + } + } + } + checkSourceElement(node.body); + if (node.type && !isAccessor(node.kind)) { + checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); + } + if (compilerOptions.noImplicitAny && ts.nodeIsMissing(node.body) && !node.type && !isPrivateWithinAmbient(node)) { + reportImplicitAnyError(node, anyType); + } + } + function checkBlock(node) { + if (node.kind === 172) { + checkGrammarStatementInAmbientContext(node); + } + ts.forEach(node.statements, checkSourceElement); + if (ts.isFunctionBlock(node) || node.kind === 199) { + checkFunctionExpressionBodies(node); + } + } + function checkCollisionWithArgumentsInGeneratedCode(node) { + if (!ts.hasRestParameters(node) || ts.isInAmbientContext(node) || ts.nodeIsMissing(node.body)) { + return; + } + ts.forEach(node.parameters, function (p) { + if (p.name && !ts.isBindingPattern(p.name) && p.name.text === argumentsSymbol.name) { + error(p, ts.Diagnostics.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters); + } + }); + } + function needCollisionCheckForIdentifier(node, identifier, name) { + if (!(identifier && identifier.text === name)) { + return false; + } + if (node.kind === 128 || + node.kind === 127 || + node.kind === 130 || + node.kind === 129 || + node.kind === 132 || + node.kind === 133) { + return false; + } + if (ts.isInAmbientContext(node)) { + return false; + } + var root = getRootDeclaration(node); + if (root.kind === 126 && ts.nodeIsMissing(root.parent.body)) { + return false; + } + return true; + } + function checkCollisionWithCapturedThisVariable(node, name) { + if (needCollisionCheckForIdentifier(node, name, "_this")) { + potentialThisCollisions.push(node); + } + } + function checkIfThisIsCapturedInEnclosingScope(node) { + var current = node; + while (current) { + if (getNodeCheckFlags(current) & 4) { + var isDeclaration = node.kind !== 64; + if (isDeclaration) { + error(node.name, ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference); + } + return; + } + current = current.parent; + } + } + function checkCollisionWithCapturedSuperVariable(node, name) { + if (!needCollisionCheckForIdentifier(node, name, "_super")) { + return; + } + var enclosingClass = ts.getAncestor(node, 194); + if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { + return; + } + if (ts.getClassBaseTypeNode(enclosingClass)) { + var isDeclaration = node.kind !== 64; + if (isDeclaration) { + error(node, ts.Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference); + } + else { + error(node, ts.Diagnostics.Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference); + } + } + } + function checkCollisionWithRequireExportsInGeneratedCode(node, name) { + if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { + return; + } + if (node.kind === 198 && ts.getModuleInstanceState(node) !== 1) { + return; + } + var parent = getDeclarationContainer(node); + if (parent.kind === 210 && ts.isExternalModule(parent)) { + error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); + } + } + function checkVarDeclaredNamesNotShadowed(node) { + if (node.initializer && (ts.getCombinedNodeFlags(node) & 6144) === 0) { + var symbol = getSymbolOfNode(node); + if (symbol.flags & 1) { + var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined); + if (localDeclarationSymbol && + localDeclarationSymbol !== symbol && + localDeclarationSymbol.flags & 2) { + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 6144) { + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 192); + var container = varDeclList.parent.kind === 173 && + varDeclList.parent.parent; + var namesShareScope = container && + (container.kind === 172 && ts.isAnyFunction(container.parent) || + (container.kind === 199 && container.kind === 198) || + container.kind === 210); + if (!namesShareScope) { + var name = symbolToString(localDeclarationSymbol); + error(ts.getErrorSpanForNode(node), ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); + } + } + } + } + } + } + function isParameterDeclaration(node) { + while (node.kind === 148) { + node = node.parent.parent; + } + return node.kind === 126; + } + function checkParameterInitializer(node) { + if (getRootDeclaration(node).kind === 126) { + var func = ts.getContainingFunction(node); + visit(node.initializer); + } + function visit(n) { + if (n.kind === 64) { + var referencedSymbol = getNodeLinks(n).resolvedSymbol; + if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455) === referencedSymbol) { + if (referencedSymbol.valueDeclaration.kind === 126) { + if (referencedSymbol.valueDeclaration === node) { + error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); + return; + } + if (referencedSymbol.valueDeclaration.pos < node.pos) { + return; + } + } + error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n)); + } + } + else { + ts.forEachChild(n, visit); + } + } + } + function checkVariableLikeDeclaration(node) { + checkSourceElement(node.type); + if (node.name.kind === 124) { + checkComputedPropertyName(node.name); + if (node.initializer) { + checkExpressionCached(node.initializer); + } + } + if (ts.isBindingPattern(node.name)) { + ts.forEach(node.name.elements, checkSourceElement); + } + if (node.initializer && getRootDeclaration(node).kind === 126 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); + return; + } + if (ts.isBindingPattern(node.name)) { + if (node.initializer) { + checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration(node), node, undefined); + checkParameterInitializer(node); + } + return; + } + var symbol = getSymbolOfNode(node); + var type = getTypeOfVariableOrParameterOrProperty(symbol); + if (node === symbol.valueDeclaration) { + if (node.initializer) { + checkTypeAssignableTo(checkExpressionCached(node.initializer), type, node, undefined); + checkParameterInitializer(node); + } + } + else { + var declarationType = getWidenedTypeForVariableLikeDeclaration(node); + if (type !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(type, declarationType)) { + error(node.name, ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, ts.declarationNameToString(node.name), typeToString(type), typeToString(declarationType)); + } + if (node.initializer) { + checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); + } + } + if (node.kind !== 128 && node.kind !== 127) { + checkExportsOnMergedDeclarations(node); + if (node.kind === 191 || node.kind === 148) { + checkVarDeclaredNamesNotShadowed(node); + } + checkCollisionWithCapturedSuperVariable(node, node.name); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + } + } + function checkVariableDeclaration(node) { + checkGrammarVariableDeclaration(node); + return checkVariableLikeDeclaration(node); + } + function checkBindingElement(node) { + checkGrammarBindingElement(node); + return checkVariableLikeDeclaration(node); + } + function checkVariableStatement(node) { + checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarModifiers(node) || checkGrammarVariableDeclarationList(node.declarationList) || checkGrammarForDisallowedLetOrConstStatement(node); + ts.forEach(node.declarationList.declarations, checkSourceElement); + } + function checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) { + if (node.modifiers) { + if (inBlockOrObjectLiteralExpression(node)) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); + } + } + } + function inBlockOrObjectLiteralExpression(node) { + while (node) { + if (node.kind === 172 || node.kind === 150) { + return true; + } + node = node.parent; + } + } + function checkExpressionStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkExpression(node.expression); + } + function checkIfStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkExpression(node.expression); + checkSourceElement(node.thenStatement); + checkSourceElement(node.elseStatement); + } + function checkDoStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkSourceElement(node.statement); + checkExpression(node.expression); + } + function checkWhileStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkExpression(node.expression); + checkSourceElement(node.statement); + } + function checkForStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + if (node.initializer && node.initializer.kind == 192) { + checkGrammarVariableDeclarationList(node.initializer); + } + } + if (node.initializer) { + if (node.initializer.kind === 192) { + ts.forEach(node.initializer.declarations, checkVariableDeclaration); + } + else { + checkExpression(node.initializer); + } + } + if (node.condition) + checkExpression(node.condition); + if (node.iterator) + checkExpression(node.iterator); + checkSourceElement(node.statement); + } + function checkForOfStatement(node) { + checkGrammarForOfStatement(node); + } + function checkForInStatement(node) { + checkGrammarForInOrForOfStatement(node); + if (node.initializer.kind === 192) { + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length >= 1) { + var decl = variableDeclarationList.declarations[0]; + checkVariableDeclaration(decl); + } + } + else { + var varExpr = node.initializer; + var exprType = checkExpression(varExpr); + if (!allConstituentTypesHaveKind(exprType, 1 | 258)) { + error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); + } + else { + checkReferenceExpression(varExpr, ts.Diagnostics.Invalid_left_hand_side_in_for_in_statement, ts.Diagnostics.Left_hand_side_of_assignment_expression_cannot_be_a_constant); + } + } + var exprType = checkExpression(node.expression); + if (!allConstituentTypesHaveKind(exprType, 1 | 48128 | 512)) { + error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); + } + checkSourceElement(node.statement); + } + function checkBreakOrContinueStatement(node) { + checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); + } + function isGetAccessorWithAnnotatatedSetAccessor(node) { + return !!(node.kind === 132 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 133))); + } + function checkReturnStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + var functionBlock = ts.getContainingFunction(node); + if (!functionBlock) { + grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); + } + } + if (node.expression) { + var func = ts.getContainingFunction(node); + if (func) { + var returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); + var exprType = checkExpressionCached(node.expression); + if (func.kind === 133) { + error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); + } + else { + if (func.kind === 131) { + if (!isTypeAssignableTo(exprType, returnType)) { + error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); + } + } + else if (func.type || isGetAccessorWithAnnotatatedSetAccessor(func)) { + checkTypeAssignableTo(exprType, returnType, node.expression, undefined); + } + } + } + } + } + function checkWithStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + if (node.parserContextFlags & 1) { + grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); + } + } + checkExpression(node.expression); + error(node.expression, ts.Diagnostics.All_symbols_within_a_with_block_will_be_resolved_to_any); + } + function checkSwitchStatement(node) { + checkGrammarStatementInAmbientContext(node); + var firstDefaultClause; + var hasDuplicateDefaultClause = false; + var expressionType = checkExpression(node.expression); + ts.forEach(node.clauses, function (clause) { + if (clause.kind === 204 && !hasDuplicateDefaultClause) { + if (firstDefaultClause === undefined) { + firstDefaultClause = clause; + } + else { + var sourceFile = ts.getSourceFileOfNode(node); + var start = ts.skipTrivia(sourceFile.text, clause.pos); + var end = clause.statements.length > 0 ? clause.statements[0].pos : clause.end; + grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement); + hasDuplicateDefaultClause = true; + } + } + if (produceDiagnostics && clause.kind === 203) { + var caseClause = clause; + var caseType = checkExpression(caseClause.expression); + if (!isTypeAssignableTo(expressionType, caseType)) { + checkTypeAssignableTo(caseType, expressionType, caseClause.expression, undefined); + } + } + ts.forEach(clause.statements, checkSourceElement); + }); + } + function checkLabeledStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + var current = node.parent; + while (current) { + if (ts.isAnyFunction(current)) { + break; + } + if (current.kind === 187 && current.label.text === node.label.text) { + var sourceFile = ts.getSourceFileOfNode(node); + grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); + break; + } + current = current.parent; + } + } + checkSourceElement(node.statement); + } + function checkThrowStatement(node) { + if (!checkGrammarStatementInAmbientContext(node)) { + if (node.expression === undefined) { + grammarErrorAfterFirstToken(node, ts.Diagnostics.Line_break_not_permitted_here); + } + } + if (node.expression) { + checkExpression(node.expression); + } + } + function checkTryStatement(node) { + checkGrammarStatementInAmbientContext(node); + checkBlock(node.tryBlock); + var catchClause = node.catchClause; + if (catchClause) { + if (catchClause.type) { + var sourceFile = ts.getSourceFileOfNode(node); + var colonStart = ts.skipTrivia(sourceFile.text, catchClause.name.end); + grammarErrorAtPos(sourceFile, colonStart, ":".length, ts.Diagnostics.Catch_clause_parameter_cannot_have_a_type_annotation); + } + checkGrammarEvalOrArgumentsInStrictMode(node, catchClause.name); + checkBlock(catchClause.block); + } + if (node.finallyBlock) + checkBlock(node.finallyBlock); + } + function checkIndexConstraints(type) { + var declaredNumberIndexer = getIndexDeclarationOfSymbol(type.symbol, 1); + var declaredStringIndexer = getIndexDeclarationOfSymbol(type.symbol, 0); + var stringIndexType = getIndexTypeOfType(type, 0); + var numberIndexType = getIndexTypeOfType(type, 1); + if (stringIndexType || numberIndexType) { + ts.forEach(getPropertiesOfObjectType(type), function (prop) { + var propType = getTypeOfSymbol(prop); + checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0); + checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1); + }); + if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 194) { + var classDeclaration = type.symbol.valueDeclaration; + for (var i = 0; i < classDeclaration.members.length; i++) { + var member = classDeclaration.members[i]; + if (!(member.flags & 128) && ts.hasDynamicName(member)) { + var propType = getTypeOfSymbol(member.symbol); + checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0); + checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1); + } + } + } + } + var errorNode; + if (stringIndexType && numberIndexType) { + errorNode = declaredNumberIndexer || declaredStringIndexer; + if (!errorNode && (type.flags & 2048)) { + var someBaseTypeHasBothIndexers = ts.forEach(type.baseTypes, function (base) { return getIndexTypeOfType(base, 0) && getIndexTypeOfType(base, 1); }); + errorNode = someBaseTypeHasBothIndexers ? undefined : type.symbol.declarations[0]; + } + } + if (errorNode && !isTypeAssignableTo(numberIndexType, stringIndexType)) { + error(errorNode, ts.Diagnostics.Numeric_index_type_0_is_not_assignable_to_string_index_type_1, typeToString(numberIndexType), typeToString(stringIndexType)); + } + function checkIndexConstraintForProperty(prop, propertyType, containingType, indexDeclaration, indexType, indexKind) { + if (!indexType) { + return; + } + if (indexKind === 1 && !isNumericName(prop.valueDeclaration.name)) { + return; + } + var errorNode; + if (prop.valueDeclaration.name.kind === 124 || prop.parent === containingType.symbol) { + errorNode = prop.valueDeclaration; + } + else if (indexDeclaration) { + errorNode = indexDeclaration; + } + else if (containingType.flags & 2048) { + var someBaseClassHasBothPropertyAndIndexer = ts.forEach(containingType.baseTypes, function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); + errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; + } + if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { + var errorMessage = indexKind === 0 ? ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_string_index_type_2 : ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2; + error(errorNode, errorMessage, symbolToString(prop), typeToString(propertyType), typeToString(indexType)); + } + } + } + function checkTypeNameIsReserved(name, message) { + switch (name.text) { + case "any": + case "number": + case "boolean": + case "string": + case "symbol": + case "void": + error(name, message, name.text); + } + } + function checkTypeParameters(typeParameterDeclarations) { + if (typeParameterDeclarations) { + for (var i = 0; i < typeParameterDeclarations.length; i++) { + var node = typeParameterDeclarations[i]; + checkTypeParameter(node); + if (produceDiagnostics) { + for (var j = 0; j < i; j++) { + if (typeParameterDeclarations[j].symbol === node.symbol) { + error(node.name, ts.Diagnostics.Duplicate_identifier_0, ts.declarationNameToString(node.name)); + } + } + } + } + } + } + function checkClassDeclaration(node) { + checkGrammarClassDeclarationHeritageClauses(node); + checkTypeNameIsReserved(node.name, ts.Diagnostics.Class_name_cannot_be_0); + checkTypeParameters(node.typeParameters); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkExportsOnMergedDeclarations(node); + var symbol = getSymbolOfNode(node); + var type = getDeclaredTypeOfSymbol(symbol); + var staticType = getTypeOfSymbol(symbol); + var baseTypeNode = ts.getClassBaseTypeNode(node); + if (baseTypeNode) { + emitExtends = emitExtends || !ts.isInAmbientContext(node); + checkTypeReference(baseTypeNode); + } + if (type.baseTypes.length) { + if (produceDiagnostics) { + var baseType = type.baseTypes[0]; + checkTypeAssignableTo(type, baseType, node.name, ts.Diagnostics.Class_0_incorrectly_extends_base_class_1); + var staticBaseType = getTypeOfSymbol(baseType.symbol); + checkTypeAssignableTo(staticType, getTypeWithoutConstructors(staticBaseType), node.name, ts.Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); + if (baseType.symbol !== resolveEntityName(node, baseTypeNode.typeName, 107455)) { + error(baseTypeNode, ts.Diagnostics.Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0, typeToString(baseType)); + } + checkKindsOfPropertyMemberOverrides(type, baseType); + } + checkExpressionOrQualifiedName(baseTypeNode.typeName); + } + var implementedTypeNodes = ts.getClassImplementedTypeNodes(node); + if (implementedTypeNodes) { + ts.forEach(implementedTypeNodes, function (typeRefNode) { + checkTypeReference(typeRefNode); + if (produceDiagnostics) { + var t = getTypeFromTypeReferenceNode(typeRefNode); + if (t !== unknownType) { + var declaredType = (t.flags & 4096) ? t.target : t; + if (declaredType.flags & (1024 | 2048)) { + checkTypeAssignableTo(type, t, node.name, ts.Diagnostics.Class_0_incorrectly_implements_interface_1); + } + else { + error(typeRefNode, ts.Diagnostics.A_class_may_only_implement_another_class_or_interface); + } + } + } + }); + } + ts.forEach(node.members, checkSourceElement); + if (produceDiagnostics) { + checkIndexConstraints(type); + checkTypeForDuplicateIndexSignatures(node); + } + } + function getTargetSymbol(s) { + return s.flags & 16777216 ? getSymbolLinks(s).target : s; + } + function checkKindsOfPropertyMemberOverrides(type, baseType) { + var baseProperties = getPropertiesOfObjectType(baseType); + for (var i = 0, len = baseProperties.length; i < len; ++i) { + var base = getTargetSymbol(baseProperties[i]); + if (base.flags & 134217728) { + continue; + } + var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name)); + if (derived) { + var baseDeclarationFlags = getDeclarationFlagsFromSymbol(base); + var derivedDeclarationFlags = getDeclarationFlagsFromSymbol(derived); + if ((baseDeclarationFlags & 32) || (derivedDeclarationFlags & 32)) { + continue; + } + if ((baseDeclarationFlags & 128) !== (derivedDeclarationFlags & 128)) { + continue; + } + if ((base.flags & derived.flags & 8192) || ((base.flags & 98308) && (derived.flags & 98308))) { + continue; + } + var errorMessage; + if (base.flags & 8192) { + if (derived.flags & 98304) { + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor; + } + else { + ts.Debug.assert((derived.flags & 4) !== 0); + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property; + } + } + else if (base.flags & 4) { + ts.Debug.assert((derived.flags & 8192) !== 0); + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function; + } + else { + ts.Debug.assert((base.flags & 98304) !== 0); + ts.Debug.assert((derived.flags & 8192) !== 0); + errorMessage = ts.Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function; + } + error(derived.valueDeclaration.name, errorMessage, typeToString(baseType), symbolToString(base), typeToString(type)); + } + } + } + function isAccessor(kind) { + return kind === 132 || kind === 133; + } + function areTypeParametersIdentical(list1, list2) { + if (!list1 && !list2) { + return true; + } + if (!list1 || !list2 || list1.length !== list2.length) { + return false; + } + for (var i = 0, len = list1.length; i < len; i++) { + var tp1 = list1[i]; + var tp2 = list2[i]; + if (tp1.name.text !== tp2.name.text) { + return false; + } + if (!tp1.constraint && !tp2.constraint) { + continue; + } + if (!tp1.constraint || !tp2.constraint) { + return false; + } + if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) { + return false; + } + } + return true; + } + function checkInheritedPropertiesAreIdentical(type, typeNode) { + if (!type.baseTypes.length || type.baseTypes.length === 1) { + return true; + } + var seen = {}; + ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); + var ok = true; + for (var i = 0, len = type.baseTypes.length; i < len; ++i) { + var base = type.baseTypes[i]; + var properties = getPropertiesOfObjectType(base); + for (var j = 0, proplen = properties.length; j < proplen; ++j) { + var prop = properties[j]; + if (!ts.hasProperty(seen, prop.name)) { + seen[prop.name] = { prop: prop, containingType: base }; + } + else { + var existing = seen[prop.name]; + var isInheritedProperty = existing.containingType !== type; + if (isInheritedProperty && !isPropertyIdenticalTo(existing.prop, prop)) { + ok = false; + var typeName1 = typeToString(existing.containingType); + var typeName2 = typeToString(base); + var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); + errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); + diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo)); + } + } + } + } + return ok; + } + function checkInterfaceDeclaration(node) { + checkGrammarModifiers(node) || checkGrammarInterfaceDeclaration(node); + checkTypeParameters(node.typeParameters); + if (produceDiagnostics) { + checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); + checkExportsOnMergedDeclarations(node); + var symbol = getSymbolOfNode(node); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 195); + if (symbol.declarations.length > 1) { + if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { + error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); + } + } + if (node === firstInterfaceDecl) { + var type = getDeclaredTypeOfSymbol(symbol); + if (checkInheritedPropertiesAreIdentical(type, node.name)) { + ts.forEach(type.baseTypes, function (baseType) { + checkTypeAssignableTo(type, baseType, node.name, ts.Diagnostics.Interface_0_incorrectly_extends_interface_1); + }); + checkIndexConstraints(type); + } + } + } + ts.forEach(ts.getInterfaceBaseTypeNodes(node), checkTypeReference); + ts.forEach(node.members, checkSourceElement); + if (produceDiagnostics) { + checkTypeForDuplicateIndexSignatures(node); + } + } + function checkTypeAliasDeclaration(node) { + checkGrammarModifiers(node); + checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); + checkSourceElement(node.type); + } + function computeEnumMemberValues(node) { + var nodeLinks = getNodeLinks(node); + if (!(nodeLinks.flags & 128)) { + var enumSymbol = getSymbolOfNode(node); + var enumType = getDeclaredTypeOfSymbol(enumSymbol); + var autoValue = 0; + var ambient = ts.isInAmbientContext(node); + var enumIsConst = ts.isConst(node); + ts.forEach(node.members, function (member) { + if (member.name.kind !== 124 && isNumericLiteralName(member.name.text)) { + error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); + } + var initializer = member.initializer; + if (initializer) { + autoValue = getConstantValueForEnumMemberInitializer(initializer, enumIsConst); + if (autoValue === undefined) { + if (enumIsConst) { + error(initializer, ts.Diagnostics.In_const_enum_declarations_member_initializer_must_be_constant_expression); + } + else if (!ambient) { + checkTypeAssignableTo(checkExpression(initializer), enumType, initializer, undefined); + } + } + else if (enumIsConst) { + if (isNaN(autoValue)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN); + } + else if (!isFinite(autoValue)) { + error(initializer, ts.Diagnostics.const_enum_member_initializer_was_evaluated_to_a_non_finite_value); + } + } + } + else if (ambient && !enumIsConst) { + autoValue = undefined; + } + if (autoValue !== undefined) { + getNodeLinks(member).enumMemberValue = autoValue++; + } + }); + nodeLinks.flags |= 128; + } + function getConstantValueForEnumMemberInitializer(initializer, enumIsConst) { + return evalConstant(initializer); + function evalConstant(e) { + switch (e.kind) { + case 163: + var value = evalConstant(e.operand); + if (value === undefined) { + return undefined; + } + switch (e.operator) { + case 33: return value; + case 34: return -value; + case 47: return enumIsConst ? ~value : undefined; + } + return undefined; + case 165: + if (!enumIsConst) { + return undefined; + } + var left = evalConstant(e.left); + if (left === undefined) { + return undefined; + } + var right = evalConstant(e.right); + if (right === undefined) { + return undefined; + } + switch (e.operatorToken.kind) { + case 44: return left | right; + case 43: return left & right; + case 41: return left >> right; + case 42: return left >>> right; + case 40: return left << right; + case 45: return left ^ right; + case 35: return left * right; + case 36: return left / right; + case 33: return left + right; + case 34: return left - right; + case 37: return left % right; + } + return undefined; + case 7: + return +e.text; + case 157: + return enumIsConst ? evalConstant(e.expression) : undefined; + case 64: + case 152: + case 151: + if (!enumIsConst) { + return undefined; + } + var member = initializer.parent; + var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); + var enumType; + var propertyName; + if (e.kind === 64) { + enumType = currentType; + propertyName = e.text; + } + else { + if (e.kind === 152) { + if (e.argumentExpression === undefined || + e.argumentExpression.kind !== 8) { + return undefined; + } + var enumType = getTypeOfNode(e.expression); + propertyName = e.argumentExpression.text; + } + else { + var enumType = getTypeOfNode(e.expression); + propertyName = e.name.text; + } + if (enumType !== currentType) { + return undefined; + } + } + if (propertyName === undefined) { + return undefined; + } + var property = getPropertyOfObjectType(enumType, propertyName); + if (!property || !(property.flags & 8)) { + return undefined; + } + var propertyDecl = property.valueDeclaration; + if (member === propertyDecl) { + return undefined; + } + if (!isDefinedBefore(propertyDecl, member)) { + return undefined; + } + return getNodeLinks(propertyDecl).enumMemberValue; + } + } + } + } + function checkEnumDeclaration(node) { + if (!produceDiagnostics) { + return; + } + checkGrammarModifiers(node) || checkGrammarEnumDeclaration(node); + checkTypeNameIsReserved(node.name, ts.Diagnostics.Enum_name_cannot_be_0); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkExportsOnMergedDeclarations(node); + computeEnumMemberValues(node); + var enumSymbol = getSymbolOfNode(node); + var firstDeclaration = ts.getDeclarationOfKind(enumSymbol, node.kind); + if (node === firstDeclaration) { + if (enumSymbol.declarations.length > 1) { + var enumIsConst = ts.isConst(node); + ts.forEach(enumSymbol.declarations, function (decl) { + if (ts.isConstEnumDeclaration(decl) !== enumIsConst) { + error(decl.name, ts.Diagnostics.Enum_declarations_must_all_be_const_or_non_const); + } + }); + } + var seenEnumMissingInitialInitializer = false; + ts.forEach(enumSymbol.declarations, function (declaration) { + if (declaration.kind !== 197) { + return false; + } + var enumDeclaration = declaration; + if (!enumDeclaration.members.length) { + return false; + } + var firstEnumMember = enumDeclaration.members[0]; + if (!firstEnumMember.initializer) { + if (seenEnumMissingInitialInitializer) { + error(firstEnumMember.name, ts.Diagnostics.In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element); + } + else { + seenEnumMissingInitialInitializer = true; + } + } + }); + } + } + function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { + var declarations = symbol.declarations; + for (var i = 0; i < declarations.length; i++) { + var declaration = declarations[i]; + if ((declaration.kind === 194 || (declaration.kind === 193 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { + return declaration; + } + } + return undefined; + } + function checkModuleDeclaration(node) { + if (produceDiagnostics) { + if (!checkGrammarModifiers(node)) { + if (!ts.isInAmbientContext(node) && node.name.kind === 8) { + grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names); + } + else if (node.name.kind === 64 && node.body.kind === 199) { + var statements = node.body.statements; + for (var i = 0, n = statements.length; i < n; i++) { + var statement = statements[i]; + if (statement.kind === 201) { + grammarErrorOnNode(statement, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); + } + else if (ts.isExternalModuleImportDeclaration(statement)) { + grammarErrorOnNode(ts.getExternalModuleImportDeclarationExpression(statement), ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + } + } + } + } + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + checkExportsOnMergedDeclarations(node); + var symbol = getSymbolOfNode(node); + if (symbol.flags & 512 && symbol.declarations.length > 1 && !ts.isInAmbientContext(node) && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums)) { + var classOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); + if (classOrFunc) { + if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(classOrFunc)) { + error(node.name, ts.Diagnostics.A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged); + } + else if (node.pos < classOrFunc.pos) { + error(node.name, ts.Diagnostics.A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); + } + } + } + if (node.name.kind === 8) { + if (!isGlobalSourceFile(node.parent)) { + error(node.name, ts.Diagnostics.Ambient_external_modules_cannot_be_nested_in_other_modules); + } + if (isExternalModuleNameRelative(node.name.text)) { + error(node.name, ts.Diagnostics.Ambient_external_module_declaration_cannot_specify_relative_module_name); + } + } + } + checkSourceElement(node.body); + } + function getFirstIdentifier(node) { + while (node.kind === 123) { + node = node.left; + } + return node; + } + function checkImportDeclaration(node) { + checkGrammarModifiers(node); + checkCollisionWithCapturedThisVariable(node, node.name); + checkCollisionWithRequireExportsInGeneratedCode(node, node.name); + var symbol = getSymbolOfNode(node); + var target; + if (ts.isInternalModuleImportDeclaration(node)) { + target = resolveImport(symbol); + if (target !== unknownSymbol) { + if (target.flags & 107455) { + var moduleName = getFirstIdentifier(node.moduleReference); + if (resolveEntityName(node, moduleName, 107455 | 1536).flags & 1536) { + checkExpressionOrQualifiedName(node.moduleReference); + } + else { + error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName)); + } + } + if (target.flags & 793056) { + checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0); + } + } + } + else { + if (node.parent.kind === 210) { + target = resolveImport(symbol); + } + else if (node.parent.kind === 199 && node.parent.parent.name.kind === 8) { + if (ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { + if (isExternalModuleNameRelative(ts.getExternalModuleImportDeclarationExpression(node).text)) { + error(node, ts.Diagnostics.Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); + target = unknownSymbol; + } + else { + target = resolveImport(symbol); + } + } + else { + target = unknownSymbol; + } + } + else { + target = unknownSymbol; + } + } + if (target !== unknownSymbol) { + var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | + (symbol.flags & 793056 ? 793056 : 0) | + (symbol.flags & 1536 ? 1536 : 0); + if (target.flags & excludedMeanings) { + error(node, ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0, symbolToString(symbol)); + } + } + } + function checkExportAssignment(node) { + if (!checkGrammarModifiers(node) && (node.flags & 243)) { + grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); + } + var container = node.parent; + if (container.kind !== 210) { + container = container.parent; + } + checkTypeOfExportAssignmentSymbol(getSymbolOfNode(container)); + } + function checkSourceElement(node) { + if (!node) + return; + switch (node.kind) { + case 125: + return checkTypeParameter(node); + case 126: + return checkParameter(node); + case 128: + case 127: + return checkPropertyDeclaration(node); + case 138: + case 139: + case 134: + case 135: + return checkSignatureDeclaration(node); + case 136: + return checkSignatureDeclaration(node); + case 130: + case 129: + return checkMethodDeclaration(node); + case 131: + return checkConstructorDeclaration(node); + case 132: + case 133: + return checkAccessorDeclaration(node); + case 137: + return checkTypeReference(node); + case 140: + return checkTypeQuery(node); + case 141: + return checkTypeLiteral(node); + case 142: + return checkArrayType(node); + case 143: + return checkTupleType(node); + case 144: + return checkUnionType(node); + case 145: + return checkSourceElement(node.type); + case 193: + return checkFunctionDeclaration(node); + case 172: + case 199: + return checkBlock(node); + case 173: + return checkVariableStatement(node); + case 175: + return checkExpressionStatement(node); + case 176: + return checkIfStatement(node); + case 177: + return checkDoStatement(node); + case 178: + return checkWhileStatement(node); + case 179: + return checkForStatement(node); + case 180: + return checkForInStatement(node); + case 181: + return checkForOfStatement(node); + case 182: + case 183: + return checkBreakOrContinueStatement(node); + case 184: + return checkReturnStatement(node); + case 185: + return checkWithStatement(node); + case 186: + return checkSwitchStatement(node); + case 187: + return checkLabeledStatement(node); + case 188: + return checkThrowStatement(node); + case 189: + return checkTryStatement(node); + case 191: + return checkVariableDeclaration(node); + case 148: + return checkBindingElement(node); + case 194: + return checkClassDeclaration(node); + case 195: + return checkInterfaceDeclaration(node); + case 196: + return checkTypeAliasDeclaration(node); + case 197: + return checkEnumDeclaration(node); + case 198: + return checkModuleDeclaration(node); + case 200: + return checkImportDeclaration(node); + case 201: + return checkExportAssignment(node); + case 174: + checkGrammarStatementInAmbientContext(node); + return; + case 190: + checkGrammarStatementInAmbientContext(node); + return; + } + } + function checkFunctionExpressionBodies(node) { + switch (node.kind) { + case 158: + case 159: + ts.forEach(node.parameters, checkFunctionExpressionBodies); + checkFunctionExpressionOrObjectLiteralMethodBody(node); + break; + case 130: + case 129: + ts.forEach(node.parameters, checkFunctionExpressionBodies); + if (ts.isObjectLiteralMethod(node)) { + checkFunctionExpressionOrObjectLiteralMethodBody(node); + } + break; + case 131: + case 132: + case 133: + case 193: + ts.forEach(node.parameters, checkFunctionExpressionBodies); + break; + case 185: + checkFunctionExpressionBodies(node.expression); + break; + case 126: + case 128: + case 127: + case 146: + case 147: + case 148: + case 149: + case 150: + case 207: + case 151: + case 152: + case 153: + case 154: + case 155: + case 167: + case 171: + case 156: + case 157: + case 161: + case 162: + case 160: + case 163: + case 164: + case 165: + case 166: + case 169: + case 172: + case 199: + case 173: + case 175: + case 176: + case 177: + case 178: + case 179: + case 180: + case 181: + case 182: + case 183: + case 184: + case 186: + case 203: + case 204: + case 187: + case 188: + case 189: + case 206: + case 191: + case 192: + case 194: + case 197: + case 209: + case 210: + ts.forEachChild(node, checkFunctionExpressionBodies); + break; + } + } + function checkSourceFile(node) { + var start = new Date().getTime(); + checkSourceFileWorker(node); + ts.checkTime += new Date().getTime() - start; + } + function checkSourceFileWorker(node) { + var links = getNodeLinks(node); + if (!(links.flags & 1)) { + checkGrammarSourceFile(node); + emitExtends = false; + potentialThisCollisions.length = 0; + ts.forEach(node.statements, checkSourceElement); + checkFunctionExpressionBodies(node); + if (ts.isExternalModule(node)) { + var symbol = getExportAssignmentSymbol(node.symbol); + if (symbol && symbol.flags & 8388608) { + getSymbolLinks(symbol).referenced = true; + markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 200)); + } + } + if (potentialThisCollisions.length) { + ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); + potentialThisCollisions.length = 0; + } + if (emitExtends) { + links.flags |= 8; + } + links.flags |= 1; + } + } + function getDiagnostics(sourceFile) { + throwIfNonDiagnosticsProducing(); + if (sourceFile) { + checkSourceFile(sourceFile); + return diagnostics.getDiagnostics(sourceFile.fileName); + } + ts.forEach(host.getSourceFiles(), checkSourceFile); + return diagnostics.getDiagnostics(); + } + function getGlobalDiagnostics() { + throwIfNonDiagnosticsProducing(); + return diagnostics.getGlobalDiagnostics(); + } + function throwIfNonDiagnosticsProducing() { + if (!produceDiagnostics) { + throw new Error("Trying to get diagnostics from a type checker that does not produce them."); + } + } + function isInsideWithStatementBody(node) { + if (node) { + while (node.parent) { + if (node.parent.kind === 185 && node.parent.statement === node) { + return true; + } + node = node.parent; + } + } + return false; + } + function getSymbolsInScope(location, meaning) { + var symbols = {}; + var memberFlags = 0; + function copySymbol(symbol, meaning) { + if (symbol.flags & meaning) { + var id = symbol.name; + if (!isReservedMemberName(id) && !ts.hasProperty(symbols, id)) { + symbols[id] = symbol; + } + } + } + function copySymbols(source, meaning) { + if (meaning) { + for (var id in source) { + if (ts.hasProperty(source, id)) { + copySymbol(source[id], meaning); + } + } + } + } + if (isInsideWithStatementBody(location)) { + return []; + } + while (location) { + if (location.locals && !isGlobalSourceFile(location)) { + copySymbols(location.locals, meaning); + } + switch (location.kind) { + case 210: + if (!ts.isExternalModule(location)) + break; + case 198: + copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); + break; + case 197: + copySymbols(getSymbolOfNode(location).exports, meaning & 8); + break; + case 194: + case 195: + if (!(memberFlags & 128)) { + copySymbols(getSymbolOfNode(location).members, meaning & 793056); + } + break; + case 158: + if (location.name) { + copySymbol(location.symbol, meaning); + } + break; + case 206: + if (location.name.text) { + copySymbol(location.symbol, meaning); + } + break; + } + memberFlags = location.flags; + location = location.parent; + } + copySymbols(globals, meaning); + return ts.mapToArray(symbols); + } + function isTypeDeclarationName(name) { + return name.kind == 64 && + isTypeDeclaration(name.parent) && + name.parent.name === name; + } + function isTypeDeclaration(node) { + switch (node.kind) { + case 125: + case 194: + case 195: + case 196: + case 197: + return true; + } + } + function isTypeReferenceIdentifier(entityName) { + var node = entityName; + while (node.parent && node.parent.kind === 123) + node = node.parent; + return node.parent && node.parent.kind === 137; + } + function isTypeNode(node) { + if (137 <= node.kind && node.kind <= 145) { + return true; + } + switch (node.kind) { + case 110: + case 117: + case 119: + case 111: + case 120: + return true; + case 98: + return node.parent.kind !== 162; + case 8: + return node.parent.kind === 126; + case 64: + if (node.parent.kind === 123 && node.parent.right === node) { + node = node.parent; + } + case 123: + ts.Debug.assert(node.kind === 64 || node.kind === 123, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + var parent = node.parent; + if (parent.kind === 140) { + return false; + } + if (137 <= parent.kind && parent.kind <= 145) { + return true; + } + switch (parent.kind) { + case 125: + return node === parent.constraint; + case 128: + case 127: + case 126: + case 191: + return node === parent.type; + case 193: + case 158: + case 159: + case 131: + case 130: + case 129: + case 132: + case 133: + return node === parent.type; + case 134: + case 135: + case 136: + return node === parent.type; + case 156: + return node === parent.type; + case 153: + case 154: + return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + case 155: + return false; + } + } + return false; + } + function getLeftSideOfImportOrExportAssignment(nodeOnRightSide) { + while (nodeOnRightSide.parent.kind === 123) { + nodeOnRightSide = nodeOnRightSide.parent; + } + if (nodeOnRightSide.parent.kind === 200) { + return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; + } + if (nodeOnRightSide.parent.kind === 201) { + return nodeOnRightSide.parent.exportName === nodeOnRightSide && nodeOnRightSide.parent; + } + return undefined; + } + function isInRightSideOfImportOrExportAssignment(node) { + return getLeftSideOfImportOrExportAssignment(node) !== undefined; + } + function isRightSideOfQualifiedNameOrPropertyAccess(node) { + return (node.parent.kind === 123 && node.parent.right === node) || + (node.parent.kind === 151 && node.parent.name === node); + } + function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { + if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) { + return getSymbolOfNode(entityName.parent); + } + if (entityName.parent.kind === 201) { + return resolveEntityName(entityName.parent.parent, entityName, 107455 | 793056 | 1536 | 8388608); + } + if (entityName.kind !== 151) { + if (isInRightSideOfImportOrExportAssignment(entityName)) { + return getSymbolOfPartOfRightHandSideOfImport(entityName); + } + } + if (isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + entityName = entityName.parent; + } + if (ts.isExpression(entityName)) { + if (ts.getFullWidth(entityName) === 0) { + return undefined; + } + if (entityName.kind === 64) { + var meaning = 107455 | 8388608; + return resolveEntityName(entityName, entityName, meaning); + } + else if (entityName.kind === 151) { + var symbol = getNodeLinks(entityName).resolvedSymbol; + if (!symbol) { + checkPropertyAccessExpression(entityName); + } + return getNodeLinks(entityName).resolvedSymbol; + } + else if (entityName.kind === 123) { + var symbol = getNodeLinks(entityName).resolvedSymbol; + if (!symbol) { + checkQualifiedName(entityName); + } + return getNodeLinks(entityName).resolvedSymbol; + } + } + else if (isTypeReferenceIdentifier(entityName)) { + var meaning = entityName.parent.kind === 137 ? 793056 : 1536; + meaning |= 8388608; + return resolveEntityName(entityName, entityName, meaning); + } + return undefined; + } + function getSymbolInfo(node) { + if (isInsideWithStatementBody(node)) { + return undefined; + } + if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + return getSymbolOfNode(node.parent); + } + if (node.kind === 64 && isInRightSideOfImportOrExportAssignment(node)) { + return node.parent.kind === 201 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImport(node); + } + switch (node.kind) { + case 64: + case 151: + case 123: + return getSymbolOfEntityNameOrPropertyAccessExpression(node); + case 92: + case 90: + var type = checkExpression(node); + return type.symbol; + case 112: + var constructorDeclaration = node.parent; + if (constructorDeclaration && constructorDeclaration.kind === 131) { + return constructorDeclaration.parent.symbol; + } + return undefined; + case 8: + if (ts.isExternalModuleImportDeclaration(node.parent.parent) && + ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node) { + var importSymbol = getSymbolOfNode(node.parent.parent); + var moduleType = getTypeOfSymbol(importSymbol); + return moduleType ? moduleType.symbol : undefined; + } + case 7: + if (node.parent.kind == 152 && node.parent.argumentExpression === node) { + var objectType = checkExpression(node.parent.expression); + if (objectType === unknownType) + return undefined; + var apparentType = getApparentType(objectType); + if (apparentType === unknownType) + return undefined; + return getPropertyOfType(apparentType, node.text); + } + break; + } + return undefined; + } + function getShorthandAssignmentValueSymbol(location) { + if (location && location.kind === 208) { + return resolveEntityName(location, location.name, 107455); + } + return undefined; + } + function getTypeOfNode(node) { + if (isInsideWithStatementBody(node)) { + return unknownType; + } + if (ts.isExpression(node)) { + return getTypeOfExpression(node); + } + if (isTypeNode(node)) { + return getTypeFromTypeNode(node); + } + if (isTypeDeclaration(node)) { + var symbol = getSymbolOfNode(node); + return getDeclaredTypeOfSymbol(symbol); + } + if (isTypeDeclarationName(node)) { + var symbol = getSymbolInfo(node); + return symbol && getDeclaredTypeOfSymbol(symbol); + } + if (ts.isDeclaration(node)) { + var symbol = getSymbolOfNode(node); + return getTypeOfSymbol(symbol); + } + if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + var symbol = getSymbolInfo(node); + return symbol && getTypeOfSymbol(symbol); + } + if (isInRightSideOfImportOrExportAssignment(node)) { + var symbol = getSymbolInfo(node); + var declaredType = symbol && getDeclaredTypeOfSymbol(symbol); + return declaredType !== unknownType ? declaredType : getTypeOfSymbol(symbol); + } + return unknownType; + } + function getTypeOfExpression(expr) { + if (isRightSideOfQualifiedNameOrPropertyAccess(expr)) { + expr = expr.parent; + } + return checkExpression(expr); + } + function getAugmentedPropertiesOfType(type) { + var type = getApparentType(type); + var propsByName = createSymbolTable(getPropertiesOfType(type)); + if (getSignaturesOfType(type, 0).length || getSignaturesOfType(type, 1).length) { + ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { + if (!ts.hasProperty(propsByName, p.name)) { + propsByName[p.name] = p; + } + }); + } + return getNamedMembers(propsByName); + } + function getRootSymbols(symbol) { + if (symbol.flags & 268435456) { + var symbols = []; + var name = symbol.name; + ts.forEach(getSymbolLinks(symbol).unionType.types, function (t) { + symbols.push(getPropertyOfType(t, name)); + }); + return symbols; + } + else if (symbol.flags & 67108864) { + var target = getSymbolLinks(symbol).target; + if (target) { + return [target]; + } + } + return [symbol]; + } + function isExternalModuleSymbol(symbol) { + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 210; + } + function isNodeDescendentOf(node, ancestor) { + while (node) { + if (node === ancestor) + return true; + node = node.parent; + } + return false; + } + function isUniqueLocalName(name, container) { + for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { + if (node.locals && ts.hasProperty(node.locals, name)) { + var symbolWithRelevantName = node.locals[name]; + if (symbolWithRelevantName.flags & (107455 | 1048576)) { + return false; + } + if (symbolWithRelevantName.flags & 8388608) { + var importDeclarationWithRelevantName = ts.getDeclarationOfKind(symbolWithRelevantName, 200); + if (isReferencedImportDeclaration(importDeclarationWithRelevantName)) { + return false; + } + } + } + } + return true; + } + function getLocalNameOfContainer(container) { + var links = getNodeLinks(container); + if (!links.localModuleName) { + var prefix = ""; + var name = ts.unescapeIdentifier(container.name.text); + while (!isUniqueLocalName(ts.escapeIdentifier(prefix + name), container)) { + prefix += "_"; + } + links.localModuleName = prefix + ts.getTextOfNode(container.name); + } + return links.localModuleName; + } + function getLocalNameForSymbol(symbol, location) { + var node = location; + while (node) { + if ((node.kind === 198 || node.kind === 197) && getSymbolOfNode(node) === symbol) { + return getLocalNameOfContainer(node); + } + node = node.parent; + } + ts.Debug.fail("getLocalNameForSymbol failed"); + } + function getExpressionNamePrefix(node) { + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol) { + var exportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); + if (symbol !== exportSymbol && !(exportSymbol.flags & 944)) { + symbol = exportSymbol; + } + if (symbol.parent) { + return isExternalModuleSymbol(symbol.parent) ? "exports" : getLocalNameForSymbol(getParentOfSymbol(symbol), node.parent); + } + } + } + function getExportAssignmentName(node) { + var symbol = getExportAssignmentSymbol(getSymbolOfNode(node)); + return symbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol) ? symbolToString(symbol) : undefined; + } + function isTopLevelValueImportWithEntityName(node) { + if (node.parent.kind !== 210 || !ts.isInternalModuleImportDeclaration(node)) { + return false; + } + return isImportResolvedToValue(getSymbolOfNode(node)); + } + function isImportResolvedToValue(symbol) { + var target = resolveImport(symbol); + return target !== unknownSymbol && target.flags & 107455 && !isConstEnumOrConstEnumOnlyModule(target); + } + function isConstEnumOrConstEnumOnlyModule(s) { + return isConstEnumSymbol(s) || s.constEnumOnlyModule; + } + function isReferencedImportDeclaration(node) { + var symbol = getSymbolOfNode(node); + if (getSymbolLinks(symbol).referenced) { + return true; + } + if (node.flags & 1) { + return isImportResolvedToValue(symbol); + } + return false; + } + function isImplementationOfOverload(node) { + if (ts.nodeIsPresent(node.body)) { + var symbol = getSymbolOfNode(node); + var signaturesOfSymbol = getSignaturesOfSymbol(symbol); + return signaturesOfSymbol.length > 1 || + (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + } + return false; + } + function getNodeCheckFlags(node) { + return getNodeLinks(node).flags; + } + function getEnumMemberValue(node) { + computeEnumMemberValues(node.parent); + return getNodeLinks(node).enumMemberValue; + } + function getConstantValue(node) { + if (node.kind === 209) { + return getEnumMemberValue(node); + } + var symbol = getNodeLinks(node).resolvedSymbol; + if (symbol && (symbol.flags & 8)) { + var declaration = symbol.valueDeclaration; + var constantValue; + if (declaration.kind === 209) { + return getEnumMemberValue(declaration); + } + } + return undefined; + } + function writeTypeOfDeclaration(declaration, enclosingDeclaration, flags, writer) { + var symbol = getSymbolOfNode(declaration); + var type = symbol && !(symbol.flags & (2048 | 131072)) ? getTypeOfSymbol(symbol) : unknownType; + getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); + } + function writeReturnTypeOfSignatureDeclaration(signatureDeclaration, enclosingDeclaration, flags, writer) { + var signature = getSignatureFromDeclaration(signatureDeclaration); + getSymbolDisplayBuilder().buildTypeDisplay(getReturnTypeOfSignature(signature), writer, enclosingDeclaration, flags); + } + function isUnknownIdentifier(location, name) { + return !resolveName(location, name, 107455, undefined, undefined); + } + function createResolver() { + return { + getLocalNameOfContainer: getLocalNameOfContainer, + getExpressionNamePrefix: getExpressionNamePrefix, + getExportAssignmentName: getExportAssignmentName, + isReferencedImportDeclaration: isReferencedImportDeclaration, + getNodeCheckFlags: getNodeCheckFlags, + isTopLevelValueImportWithEntityName: isTopLevelValueImportWithEntityName, + isDeclarationVisible: isDeclarationVisible, + isImplementationOfOverload: isImplementationOfOverload, + writeTypeOfDeclaration: writeTypeOfDeclaration, + writeReturnTypeOfSignatureDeclaration: writeReturnTypeOfSignatureDeclaration, + isSymbolAccessible: isSymbolAccessible, + isEntityNameVisible: isEntityNameVisible, + getConstantValue: getConstantValue, + isUnknownIdentifier: isUnknownIdentifier + }; + } + function initializeTypeChecker() { + ts.forEach(host.getSourceFiles(), function (file) { + ts.bindSourceFile(file); + }); + ts.forEach(host.getSourceFiles(), function (file) { + if (!ts.isExternalModule(file)) { + extendSymbolTable(globals, file.locals); + } + }); + getSymbolLinks(undefinedSymbol).type = undefinedType; + getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); + getSymbolLinks(unknownSymbol).type = unknownType; + globals[undefinedSymbol.name] = undefinedSymbol; + globalArraySymbol = getGlobalTypeSymbol("Array"); + globalArrayType = getTypeOfGlobalSymbol(globalArraySymbol, 1); + globalObjectType = getGlobalType("Object"); + globalFunctionType = getGlobalType("Function"); + globalStringType = getGlobalType("String"); + globalNumberType = getGlobalType("Number"); + globalBooleanType = getGlobalType("Boolean"); + globalRegExpType = getGlobalType("RegExp"); + if (languageVersion >= 2) { + globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); + globalESSymbolType = getGlobalType("Symbol"); + globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); + } + else { + globalTemplateStringsArrayType = unknownType; + globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + globalESSymbolConstructorSymbol = undefined; + } + anyArrayType = createArrayType(anyType); + } + function checkGrammarModifiers(node) { + switch (node.kind) { + case 132: + case 133: + case 131: + case 128: + case 127: + case 130: + case 129: + case 136: + case 194: + case 195: + case 198: + case 197: + case 201: + case 173: + case 193: + case 196: + case 200: + case 126: + break; + default: + return false; + } + if (!node.modifiers) { + return; + } + var lastStatic, lastPrivate, lastProtected, lastDeclare; + var flags = 0; + for (var i = 0, n = node.modifiers.length; i < n; i++) { + var modifier = node.modifiers[i]; + switch (modifier.kind) { + case 107: + case 106: + case 105: + var text; + if (modifier.kind === 107) { + text = "public"; + } + else if (modifier.kind === 106) { + text = "protected"; + lastProtected = modifier; + } + else { + text = "private"; + lastPrivate = modifier; + } + if (flags & 112) { + return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen); + } + else if (flags & 128) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); + } + else if (node.parent.kind === 199 || node.parent.kind === 210) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); + } + flags |= ts.modifierToFlag(modifier.kind); + break; + case 108: + if (flags & 128) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); + } + else if (node.parent.kind === 199 || node.parent.kind === 210) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); + } + else if (node.kind === 126) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); + } + flags |= 128; + lastStatic = modifier; + break; + case 77: + if (flags & 1) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export"); + } + else if (flags & 2) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); + } + else if (node.parent.kind === 194) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); + } + else if (node.kind === 126) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); + } + flags |= 1; + break; + case 113: + if (flags & 2) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); + } + else if (node.parent.kind === 194) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); + } + else if (node.kind === 126) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); + } + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 199) { + return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); + } + flags |= 2; + lastDeclare = modifier; + break; + } + } + if (node.kind === 131) { + if (flags & 128) { + return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); + } + else if (flags & 64) { + return grammarErrorOnNode(lastProtected, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "protected"); + } + else if (flags & 32) { + return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); + } + } + else if (node.kind === 200 && flags & 2) { + return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); + } + else if (node.kind === 195 && flags & 2) { + return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); + } + else if (node.kind === 126 && (flags & 112) && ts.isBindingPattern(node.name)) { + return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); + } + } + function checkGrammarForDisallowedTrailingComma(list) { + if (list && list.hasTrailingComma) { + var start = list.end - ",".length; + var end = list.end; + var sourceFile = ts.getSourceFileOfNode(list[0]); + return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Trailing_comma_not_allowed); + } + } + function checkGrammarTypeParameterList(node, typeParameters) { + if (checkGrammarForDisallowedTrailingComma(typeParameters)) { + return true; + } + if (typeParameters && typeParameters.length === 0) { + var start = typeParameters.pos - "<".length; + var sourceFile = ts.getSourceFileOfNode(node); + var end = ts.skipTrivia(sourceFile.text, typeParameters.end) + ">".length; + return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Type_parameter_list_cannot_be_empty); + } + } + function checkGrammarParameterList(parameters) { + if (checkGrammarForDisallowedTrailingComma(parameters)) { + return true; + } + var seenOptionalParameter = false; + var parameterCount = parameters.length; + for (var i = 0; i < parameterCount; i++) { + var parameter = parameters[i]; + if (parameter.dotDotDotToken) { + if (i !== (parameterCount - 1)) { + return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list); + } + if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_rest_parameter_cannot_be_optional); + } + if (parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer); + } + } + else if (parameter.questionToken || parameter.initializer) { + seenOptionalParameter = true; + if (parameter.questionToken && parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.Parameter_cannot_have_question_mark_and_initializer); + } + } + else { + if (seenOptionalParameter) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.A_required_parameter_cannot_follow_an_optional_parameter); + } + } + } + } + function checkGrammarFunctionLikeDeclaration(node) { + return checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node.typeParameters) || checkGrammarParameterList(node.parameters); + } + function checkGrammarIndexSignatureParameters(node) { + var parameter = node.parameters[0]; + if (node.parameters.length !== 1) { + if (parameter) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter); + } + else { + return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter); + } + } + if (parameter.dotDotDotToken) { + return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); + } + if (parameter.flags & 243) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); + } + if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark); + } + if (parameter.initializer) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_initializer); + } + if (!parameter.type) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); + } + if (parameter.type.kind !== 119 && parameter.type.kind !== 117) { + return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); + } + if (!node.type) { + return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_a_type_annotation); + } + } + function checkGrammarForIndexSignatureModifier(node) { + if (node.flags & 243) { + grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_not_permitted_on_index_signature_members); + } + } + function checkGrammarIndexSignature(node) { + checkGrammarModifiers(node) || checkGrammarIndexSignatureParameters(node) || checkGrammarForIndexSignatureModifier(node); + } + function checkGrammarForAtLeastOneTypeArgument(node, typeArguments) { + if (typeArguments && typeArguments.length === 0) { + var sourceFile = ts.getSourceFileOfNode(node); + var start = typeArguments.pos - "<".length; + var end = ts.skipTrivia(sourceFile.text, typeArguments.end) + ">".length; + return grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.Type_argument_list_cannot_be_empty); + } + } + function checkGrammarTypeArguments(node, typeArguments) { + return checkGrammarForDisallowedTrailingComma(typeArguments) || + checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + } + function checkGrammarForOmittedArgument(node, arguments) { + if (arguments) { + var sourceFile = ts.getSourceFileOfNode(node); + for (var i = 0, n = arguments.length; i < n; i++) { + var arg = arguments[i]; + if (arg.kind === 170) { + return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); + } + } + } + } + function checkGrammarArguments(node, arguments) { + return checkGrammarForDisallowedTrailingComma(arguments) || + checkGrammarForOmittedArgument(node, arguments); + } + function checkGrammarHeritageClause(node) { + var types = node.types; + if (checkGrammarForDisallowedTrailingComma(types)) { + return true; + } + if (types && types.length === 0) { + var listType = ts.tokenToString(node.token); + var sourceFile = ts.getSourceFileOfNode(node); + return grammarErrorAtPos(sourceFile, types.pos, 0, ts.Diagnostics._0_list_cannot_be_empty, listType); + } + } + function checkGrammarClassDeclarationHeritageClauses(node) { + var seenExtendsClause = false; + var seenImplementsClause = false; + if (!checkGrammarModifiers(node) && node.heritageClauses) { + for (var i = 0, n = node.heritageClauses.length; i < n; i++) { + ts.Debug.assert(i <= 2); + var heritageClause = node.heritageClauses[i]; + if (heritageClause.token === 78) { + if (seenExtendsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); + } + if (seenImplementsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_must_precede_implements_clause); + } + if (heritageClause.types.length > 1) { + return grammarErrorOnFirstToken(heritageClause.types[1], ts.Diagnostics.Classes_can_only_extend_a_single_class); + } + seenExtendsClause = true; + } + else { + ts.Debug.assert(heritageClause.token === 101); + if (seenImplementsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen); + } + seenImplementsClause = true; + } + checkGrammarHeritageClause(heritageClause); + } + } + } + function checkGrammarInterfaceDeclaration(node) { + var seenExtendsClause = false; + if (node.heritageClauses) { + for (var i = 0, n = node.heritageClauses.length; i < n; i++) { + ts.Debug.assert(i <= 1); + var heritageClause = node.heritageClauses[i]; + if (heritageClause.token === 78) { + if (seenExtendsClause) { + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen); + } + seenExtendsClause = true; + } + else { + ts.Debug.assert(heritageClause.token === 101); + return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause); + } + checkGrammarHeritageClause(heritageClause); + } + } + return false; + } + function checkGrammarComputedPropertyName(node) { + if (node.kind !== 124) { + return false; + } + var computedPropertyName = node; + if (computedPropertyName.expression.kind === 165 && computedPropertyName.expression.operatorToken.kind === 23) { + return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); + } + } + function checkGrammarForGenerator(node) { + if (node.asteriskToken) { + return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_currently_supported); + } + } + function checkGrammarFunctionName(name) { + return checkGrammarEvalOrArgumentsInStrictMode(name, name); + } + function checkGrammarForInvalidQuestionMark(node, questionToken, message) { + if (questionToken) { + return grammarErrorOnNode(questionToken, message); + } + } + function checkGrammarObjectLiteralExpression(node) { + var seen = {}; + var Property = 1; + var GetAccessor = 2; + var SetAccesor = 4; + var GetOrSetAccessor = GetAccessor | SetAccesor; + var inStrictMode = (node.parserContextFlags & 1) !== 0; + for (var i = 0, n = node.properties.length; i < n; i++) { + var prop = node.properties[i]; + var name = prop.name; + if (prop.kind === 170 || + name.kind === 124) { + checkGrammarComputedPropertyName(name); + continue; + } + var currentKind; + if (prop.kind === 207 || prop.kind === 208) { + checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); + if (name.kind === 7) { + checkGrammarNumbericLiteral(name); + } + currentKind = Property; + } + else if (prop.kind === 130) { + currentKind = Property; + } + else if (prop.kind === 132) { + currentKind = GetAccessor; + } + else if (prop.kind === 133) { + currentKind = SetAccesor; + } + else { + ts.Debug.fail("Unexpected syntax kind:" + prop.kind); + } + if (!ts.hasProperty(seen, name.text)) { + seen[name.text] = currentKind; + } + else { + var existingKind = seen[name.text]; + if (currentKind === Property && existingKind === Property) { + if (inStrictMode) { + grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode); + } + } + else if ((currentKind & GetOrSetAccessor) && (existingKind & GetOrSetAccessor)) { + if (existingKind !== GetOrSetAccessor && currentKind !== existingKind) { + seen[name.text] = currentKind | existingKind; + } + else { + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name); + } + } + else { + return grammarErrorOnNode(name, ts.Diagnostics.An_object_literal_cannot_have_property_and_accessor_with_the_same_name); + } + } + } + } + function checkGrammarForInOrForOfStatement(forInOrOfStatement) { + if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { + return true; + } + if (forInOrOfStatement.initializer.kind === 192) { + var variableList = forInOrOfStatement.initializer; + if (!checkGrammarVariableDeclarationList(variableList)) { + if (variableList.declarations.length > 1) { + var diagnostic = forInOrOfStatement.kind === 180 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); + } + var firstDeclaration = variableList.declarations[0]; + if (firstDeclaration.initializer) { + var diagnostic = forInOrOfStatement.kind === 180 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + return grammarErrorOnNode(firstDeclaration.name, diagnostic); + } + if (firstDeclaration.type) { + var diagnostic = forInOrOfStatement.kind === 180 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + return grammarErrorOnNode(firstDeclaration, diagnostic); + } + } + } + return false; + } + function checkGrammarForOfStatement(forOfStatement) { + return grammarErrorOnFirstToken(forOfStatement, ts.Diagnostics.for_of_statements_are_not_currently_supported); + if (languageVersion < 2) { + return grammarErrorOnFirstToken(forOfStatement, ts.Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); + } + return checkGrammarForInOrForOfStatement(forOfStatement); + } + function checkGrammarAccessor(accessor) { + var kind = accessor.kind; + if (languageVersion < 1) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); + } + else if (ts.isInAmbientContext(accessor)) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context); + } + else if (accessor.body === undefined) { + return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); + } + else if (accessor.typeParameters) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); + } + else if (kind === 132 && accessor.parameters.length) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); + } + else if (kind === 133) { + if (accessor.type) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); + } + else if (accessor.parameters.length !== 1) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); + } + else { + var parameter = accessor.parameters[0]; + if (parameter.dotDotDotToken) { + return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter); + } + else if (parameter.flags & 243) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); + } + else if (parameter.questionToken) { + return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.A_set_accessor_cannot_have_an_optional_parameter); + } + else if (parameter.initializer) { + return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_parameter_cannot_have_an_initializer); + } + } + } + } + function checkGrammarForNonSymbolComputedProperty(node, message) { + if (node.kind === 124 && !ts.isWellKnownSymbolSyntactically(node.expression)) { + return grammarErrorOnNode(node, message); + } + } + function checkGrammarMethod(node) { + if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionLikeDeclaration(node) || + checkGrammarForGenerator(node)) { + return true; + } + if (node.parent.kind === 150) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { + return true; + } + else if (node.body === undefined) { + return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); + } + } + if (node.parent.kind === 194) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { + return true; + } + if (ts.isInAmbientContext(node)) { + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol); + } + else if (!node.body) { + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); + } + } + else if (node.parent.kind === 195) { + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); + } + else if (node.parent.kind === 141) { + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); + } + } + function isIterationStatement(node, lookInLabeledStatements) { + switch (node.kind) { + case 179: + case 180: + case 181: + case 177: + case 178: + return true; + case 187: + return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); + } + return false; + } + function checkGrammarBreakOrContinueStatement(node) { + var current = node; + while (current) { + if (ts.isAnyFunction(current)) { + return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); + } + switch (current.kind) { + case 187: + if (node.label && current.label.text === node.label.text) { + var isMisplacedContinueLabel = node.kind === 182 && !isIterationStatement(current.statement, true); + if (isMisplacedContinueLabel) { + return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); + } + return false; + } + break; + case 186: + if (node.kind === 183 && !node.label) { + return false; + } + break; + default: + if (isIterationStatement(current, false) && !node.label) { + return false; + } + break; + } + current = current.parent; + } + if (node.label) { + var message = node.kind === 183 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + return grammarErrorOnNode(node, message); + } + else { + var message = node.kind === 183 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + return grammarErrorOnNode(node, message); + } + } + function checkGrammarBindingElement(node) { + if (node.dotDotDotToken) { + var elements = node.parent.elements; + if (node !== elements[elements.length - 1]) { + return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); + } + if (node.initializer) { + return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - 1, 1, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); + } + } + return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + } + function checkGrammarVariableDeclaration(node) { + if (ts.isInAmbientContext(node)) { + if (ts.isBindingPattern(node.name)) { + return grammarErrorOnNode(node, ts.Diagnostics.Destructuring_declarations_are_not_allowed_in_ambient_contexts); + } + if (node.initializer) { + return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.initializer.pos - 1, 1, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); + } + } + else { + if (!node.initializer) { + if (ts.isBindingPattern(node.name) && !ts.isBindingPattern(node.parent)) { + return grammarErrorOnNode(node, ts.Diagnostics.A_destructuring_declaration_must_have_an_initializer); + } + if (ts.isConst(node)) { + return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_must_be_initialized); + } + } + } + var checkLetConstNames = languageVersion >= 2 && (ts.isLet(node) || ts.isConst(node)); + return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || + checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + } + function checkGrammarNameInLetOrConstDeclarations(name) { + if (name.kind === 64) { + if (name.text === "let") { + return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); + } + } + else { + var elements = name.elements; + for (var i = 0; i < elements.length; ++i) { + checkGrammarNameInLetOrConstDeclarations(elements[i].name); + } + } + } + function checkGrammarVariableDeclarationList(declarationList) { + var declarations = declarationList.declarations; + if (checkGrammarForDisallowedTrailingComma(declarationList.declarations)) { + return true; + } + if (!declarationList.declarations.length) { + return grammarErrorAtPos(ts.getSourceFileOfNode(declarationList), declarations.pos, declarations.end - declarations.pos, ts.Diagnostics.Variable_declaration_list_cannot_be_empty); + } + if (languageVersion < 2) { + if (ts.isLet(declarationList)) { + return grammarErrorOnFirstToken(declarationList, ts.Diagnostics.let_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + else if (ts.isConst(declarationList)) { + return grammarErrorOnFirstToken(declarationList, ts.Diagnostics.const_declarations_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + } + } + function allowLetAndConstDeclarations(parent) { + switch (parent.kind) { + case 176: + case 177: + case 178: + case 185: + case 179: + case 180: + case 181: + return false; + case 187: + return allowLetAndConstDeclarations(parent.parent); + } + return true; + } + function checkGrammarForDisallowedLetOrConstStatement(node) { + if (!allowLetAndConstDeclarations(node.parent)) { + if (ts.isLet(node.declarationList)) { + return grammarErrorOnNode(node, ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block); + } + else if (ts.isConst(node.declarationList)) { + return grammarErrorOnNode(node, ts.Diagnostics.const_declarations_can_only_be_declared_inside_a_block); + } + } + } + function isIntegerLiteral(expression) { + if (expression.kind === 163) { + var unaryExpression = expression; + if (unaryExpression.operator === 33 || unaryExpression.operator === 34) { + expression = unaryExpression.operand; + } + } + if (expression.kind === 7) { + return /^[0-9]+([eE]\+?[0-9]+)?$/.test(expression.text); + } + return false; + } + function checkGrammarEnumDeclaration(enumDecl) { + var enumIsConst = (enumDecl.flags & 4096) !== 0; + var hasError = false; + if (!enumIsConst) { + var inConstantEnumMemberSection = true; + var inAmbientContext = ts.isInAmbientContext(enumDecl); + for (var i = 0, n = enumDecl.members.length; i < n; i++) { + var node = enumDecl.members[i]; + if (node.name.kind === 124) { + hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); + } + else if (inAmbientContext) { + if (node.initializer && !isIntegerLiteral(node.initializer)) { + hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Ambient_enum_elements_can_only_have_integer_literal_initializers) || hasError; + } + } + else if (node.initializer) { + inConstantEnumMemberSection = isIntegerLiteral(node.initializer); + } + else if (!inConstantEnumMemberSection) { + hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Enum_member_must_have_initializer) || hasError; + } + } + } + return hasError; + } + function hasParseDiagnostics(sourceFile) { + return sourceFile.parseDiagnostics.length > 0; + } + function scanToken(scanner, pos) { + scanner.setTextPos(pos); + scanner.scan(); + var start = scanner.getTokenPos(); + return start; + } + function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) { + var sourceFile = ts.getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + var scanner = ts.createScanner(languageVersion, true, sourceFile.text); + var start = scanToken(scanner, node.pos); + diagnostics.add(ts.createFileDiagnostic(sourceFile, start, scanner.getTextPos() - start, message, arg0, arg1, arg2)); + return true; + } + } + function grammarErrorAtPos(sourceFile, start, length, message, arg0, arg1, arg2) { + if (!hasParseDiagnostics(sourceFile)) { + diagnostics.add(ts.createFileDiagnostic(sourceFile, start, length, message, arg0, arg1, arg2)); + return true; + } + } + function grammarErrorOnNode(node, message, arg0, arg1, arg2) { + var sourceFile = ts.getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + var span = ts.getErrorSpanForNode(node); + var start = span.end > span.pos ? ts.skipTrivia(sourceFile.text, span.pos) : span.pos; + diagnostics.add(ts.createFileDiagnostic(sourceFile, start, span.end - start, message, arg0, arg1, arg2)); + return true; + } + } + function checkGrammarEvalOrArgumentsInStrictMode(contextNode, identifier) { + if (contextNode && (contextNode.parserContextFlags & 1) && ts.isEvalOrArgumentsIdentifier(identifier)) { + var name = ts.declarationNameToString(identifier); + return grammarErrorOnNode(identifier, ts.Diagnostics.Invalid_use_of_0_in_strict_mode, name); + } + } + function checkGrammarConstructorTypeParameters(node) { + if (node.typeParameters) { + return grammarErrorAtPos(ts.getSourceFileOfNode(node), node.typeParameters.pos, node.typeParameters.end - node.typeParameters.pos, ts.Diagnostics.Type_parameters_cannot_appear_on_a_constructor_declaration); + } + } + function checkGrammarConstructorTypeAnnotation(node) { + if (node.type) { + return grammarErrorOnNode(node.type, ts.Diagnostics.Type_annotation_cannot_appear_on_a_constructor_declaration); + } + } + function checkGrammarProperty(node) { + if (node.parent.kind === 194) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || + checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { + return true; + } + } + else if (node.parent.kind === 195) { + if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { + return true; + } + } + else if (node.parent.kind === 141) { + if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { + return true; + } + } + if (ts.isInAmbientContext(node) && node.initializer) { + return grammarErrorOnFirstToken(node.initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts); + } + } + function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { + if (node.kind === 195 || + node.kind === 200 || + node.kind === 201 || + (node.flags & 2)) { + return false; + } + return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); + } + function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { + for (var i = 0, n = file.statements.length; i < n; i++) { + var decl = file.statements[i]; + if (ts.isDeclaration(decl) || decl.kind === 173) { + if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { + return true; + } + } + } + } + function checkGrammarSourceFile(node) { + return ts.isInAmbientContext(node) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node); + } + function checkGrammarStatementInAmbientContext(node) { + if (ts.isInAmbientContext(node)) { + if (isAccessor(node.parent.kind)) { + return getNodeLinks(node).hasReportedStatementInAmbientContext = true; + } + var links = getNodeLinks(node); + if (!links.hasReportedStatementInAmbientContext && ts.isAnyFunction(node.parent)) { + return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); + } + if (node.parent.kind === 172 || node.parent.kind === 199 || node.parent.kind === 210) { + var links = getNodeLinks(node.parent); + if (!links.hasReportedStatementInAmbientContext) { + return links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); + } + } + else { + } + } + } + function checkGrammarNumbericLiteral(node) { + if (node.flags & 8192) { + if (node.parserContextFlags & 1) { + return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode); + } + else if (languageVersion >= 1) { + return grammarErrorOnNode(node, ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher); + } + } + } + function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { + var sourceFile = ts.getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + var scanner = ts.createScanner(languageVersion, true, sourceFile.text); + scanToken(scanner, node.pos); + diagnostics.add(ts.createFileDiagnostic(sourceFile, scanner.getTextPos(), 0, message, arg0, arg1, arg2)); + return true; + } + } + initializeTypeChecker(); + return checker; + } + ts.createTypeChecker = createTypeChecker; +})(ts || (ts = {})); +var ts; +(function (ts) { + var indentStrings = ["", " "]; + function getIndentString(level) { + if (indentStrings[level] === undefined) { + indentStrings[level] = getIndentString(level - 1) + indentStrings[1]; + } + return indentStrings[level]; + } + ts.getIndentString = getIndentString; + function getIndentSize() { + return indentStrings[1].length; + } + function shouldEmitToOwnFile(sourceFile, compilerOptions) { + if (!ts.isDeclarationFile(sourceFile)) { + if ((ts.isExternalModule(sourceFile) || !compilerOptions.out) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { + return true; + } + return false; + } + return false; + } + ts.shouldEmitToOwnFile = shouldEmitToOwnFile; + function isExternalModuleOrDeclarationFile(sourceFile) { + return ts.isExternalModule(sourceFile) || ts.isDeclarationFile(sourceFile); + } + ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; + function createTextWriter(newLine) { + var output = ""; + var indent = 0; + var lineStart = true; + var lineCount = 0; + var linePos = 0; + function write(s) { + if (s && s.length) { + if (lineStart) { + output += getIndentString(indent); + lineStart = false; + } + output += s; + } + } + function rawWrite(s) { + if (s !== undefined) { + if (lineStart) { + lineStart = false; + } + output += s; + } + } + function writeLiteral(s) { + if (s && s.length) { + write(s); + var lineStartsOfS = ts.computeLineStarts(s); + if (lineStartsOfS.length > 1) { + lineCount = lineCount + lineStartsOfS.length - 1; + linePos = output.length - s.length + lineStartsOfS[lineStartsOfS.length - 1]; + } + } + } + function writeLine() { + if (!lineStart) { + output += newLine; + lineCount++; + linePos = output.length; + lineStart = true; + } + } + function writeTextOfNode(sourceFile, node) { + write(ts.getSourceTextOfNodeFromSourceFile(sourceFile, node)); + } + return { + write: write, + rawWrite: rawWrite, + writeTextOfNode: writeTextOfNode, + writeLiteral: writeLiteral, + writeLine: writeLine, + increaseIndent: function () { return indent++; }, + decreaseIndent: function () { return indent--; }, + getIndent: function () { return indent; }, + getTextPos: function () { return output.length; }, + getLine: function () { return lineCount + 1; }, + getColumn: function () { return lineStart ? indent * getIndentSize() + 1 : output.length - linePos + 1; }, + getText: function () { return output; } + }; + } + function getLineOfLocalPosition(currentSourceFile, pos) { + return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; + } + function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && + getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + writer.writeLine(); + } + } + function emitComments(currentSourceFile, writer, comments, trailingSeparator, newLine, writeComment) { + var emitLeadingSpace = !trailingSeparator; + ts.forEach(comments, function (comment) { + if (emitLeadingSpace) { + writer.write(" "); + emitLeadingSpace = false; + } + writeComment(currentSourceFile, writer, comment, newLine); + if (comment.hasTrailingNewLine) { + writer.writeLine(); + } + else if (trailingSeparator) { + writer.write(" "); + } + else { + emitLeadingSpace = true; + } + }); + } + function writeCommentRange(currentSourceFile, writer, comment, newLine) { + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { + var firstCommentLineAndCharacter = ts.getLineAndCharacterOfPosition(currentSourceFile, comment.pos); + var lineCount = ts.getLineStarts(currentSourceFile).length; + var firstCommentLineIndent; + for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { + var nextLineStart = (currentLine + 1) === lineCount ? currentSourceFile.text.length + 1 : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); + if (pos !== comment.pos) { + if (firstCommentLineIndent === undefined) { + firstCommentLineIndent = calculateIndent(ts.getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); + } + var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); + var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(pos, nextLineStart); + if (spacesToEmit > 0) { + var numberOfSingleSpacesToEmit = spacesToEmit % getIndentSize(); + var indentSizeSpaceString = getIndentString((spacesToEmit - numberOfSingleSpacesToEmit) / getIndentSize()); + writer.rawWrite(indentSizeSpaceString); + while (numberOfSingleSpacesToEmit) { + writer.rawWrite(" "); + numberOfSingleSpacesToEmit--; + } + } + else { + writer.rawWrite(""); + } + } + writeTrimmedCurrentLine(pos, nextLineStart); + pos = nextLineStart; + } + } + else { + writer.write(currentSourceFile.text.substring(comment.pos, comment.end)); + } + function writeTrimmedCurrentLine(pos, nextLineStart) { + var end = Math.min(comment.end, nextLineStart - 1); + var currentLineText = currentSourceFile.text.substring(pos, end).replace(/^\s+|\s+$/g, ''); + if (currentLineText) { + writer.write(currentLineText); + if (end !== comment.end) { + writer.writeLine(); + } + } + else { + writer.writeLiteral(newLine); + } + } + function calculateIndent(pos, end) { + var currentLineIndent = 0; + for (; pos < end && ts.isWhiteSpace(currentSourceFile.text.charCodeAt(pos)); pos++) { + if (currentSourceFile.text.charCodeAt(pos) === 9) { + currentLineIndent += getIndentSize() - (currentLineIndent % getIndentSize()); + } + else { + currentLineIndent++; + } + } + return currentLineIndent; + } + } + function getFirstConstructorWithBody(node) { + return ts.forEach(node.members, function (member) { + if (member.kind === 131 && ts.nodeIsPresent(member.body)) { + return member; + } + }); + } + function getAllAccessorDeclarations(declarations, accessor) { + var firstAccessor; + var getAccessor; + var setAccessor; + if (ts.hasDynamicName(accessor)) { + firstAccessor = accessor; + if (accessor.kind === 132) { + getAccessor = accessor; + } + else if (accessor.kind === 133) { + setAccessor = accessor; + } + else { + ts.Debug.fail("Accessor has wrong kind"); + } + } + else { + ts.forEach(declarations, function (member) { + if ((member.kind === 132 || member.kind === 133) && (member.flags & 128) === (accessor.flags & 128)) { + var memberName = ts.getPropertyNameForPropertyNameNode(member.name); + var accessorName = ts.getPropertyNameForPropertyNameNode(accessor.name); + if (memberName === accessorName) { + if (!firstAccessor) { + firstAccessor = member; + } + if (member.kind === 132 && !getAccessor) { + getAccessor = member; + } + if (member.kind === 133 && !setAccessor) { + setAccessor = member; + } + } + } + }); + } + return { + firstAccessor: firstAccessor, + getAccessor: getAccessor, + setAccessor: setAccessor + }; + } + function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { + var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); + sourceFilePath = sourceFilePath.replace(host.getCommonSourceDirectory(), ""); + return ts.combinePaths(newDirPath, sourceFilePath); + } + function getOwnEmitOutputFilePath(sourceFile, host, extension) { + var compilerOptions = host.getCompilerOptions(); + if (compilerOptions.outDir) { + var emitOutputFilePathWithoutExtension = ts.removeFileExtension(getSourceFilePathInNewDir(sourceFile, host, compilerOptions.outDir)); + } + else { + var emitOutputFilePathWithoutExtension = ts.removeFileExtension(sourceFile.fileName); + } + return emitOutputFilePathWithoutExtension + extension; + } + function writeFile(host, diagnostics, fileName, data, writeByteOrderMark) { + host.writeFile(fileName, data, writeByteOrderMark, function (hostErrorMessage) { + diagnostics.push(ts.createCompilerDiagnostic(ts.Diagnostics.Could_not_write_file_0_Colon_1, fileName, hostErrorMessage)); + }); + } + function emitDeclarations(host, resolver, diagnostics, jsFilePath, root) { + var newLine = host.getNewLine(); + var compilerOptions = host.getCompilerOptions(); + var languageVersion = compilerOptions.target || 0; + var write; + var writeLine; + var increaseIndent; + var decreaseIndent; + var writeTextOfNode; + var writer = createAndSetNewTextWriterWithSymbolWriter(); + var enclosingDeclaration; + var currentSourceFile; + var reportedDeclarationError = false; + var emitJsDocComments = compilerOptions.removeComments ? function (declaration) { } : writeJsDocComments; + var emit = compilerOptions.stripInternal ? stripInternal : emitNode; + var aliasDeclarationEmitInfo = []; + var referencePathsOutput = ""; + if (root) { + if (!compilerOptions.noResolve) { + var addedGlobalFileReference = false; + ts.forEach(root.referencedFiles, function (fileReference) { + var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); + if (referencedFile && ((referencedFile.flags & 1024) || + shouldEmitToOwnFile(referencedFile, compilerOptions) || + !addedGlobalFileReference)) { + writeReferencePath(referencedFile); + if (!isExternalModuleOrDeclarationFile(referencedFile)) { + addedGlobalFileReference = true; + } + } + }); + } + emitSourceFile(root); + } + else { + var emittedReferencedFiles = []; + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (!isExternalModuleOrDeclarationFile(sourceFile)) { + if (!compilerOptions.noResolve) { + ts.forEach(sourceFile.referencedFiles, function (fileReference) { + var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); + if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && + !ts.contains(emittedReferencedFiles, referencedFile))) { + writeReferencePath(referencedFile); + emittedReferencedFiles.push(referencedFile); + } + }); + } + emitSourceFile(sourceFile); + } + }); + } + return { + reportedDeclarationError: reportedDeclarationError, + aliasDeclarationEmitInfo: aliasDeclarationEmitInfo, + synchronousDeclarationOutput: writer.getText(), + referencePathsOutput: referencePathsOutput + }; + function hasInternalAnnotation(range) { + var text = currentSourceFile.text; + var comment = text.substring(range.pos, range.end); + return comment.indexOf("@internal") >= 0; + } + function stripInternal(node) { + if (node) { + var leadingCommentRanges = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + if (ts.forEach(leadingCommentRanges, hasInternalAnnotation)) { + return; + } + emitNode(node); + } + } + function createAndSetNewTextWriterWithSymbolWriter() { + var writer = createTextWriter(newLine); + writer.trackSymbol = trackSymbol; + writer.writeKeyword = writer.write; + writer.writeOperator = writer.write; + writer.writePunctuation = writer.write; + writer.writeSpace = writer.write; + writer.writeStringLiteral = writer.writeLiteral; + writer.writeParameter = writer.write; + writer.writeSymbol = writer.write; + setWriter(writer); + return writer; + } + function setWriter(newWriter) { + writer = newWriter; + write = newWriter.write; + writeTextOfNode = newWriter.writeTextOfNode; + writeLine = newWriter.writeLine; + increaseIndent = newWriter.increaseIndent; + decreaseIndent = newWriter.decreaseIndent; + } + function writeAsychronousImportDeclarations(importDeclarations) { + var oldWriter = writer; + ts.forEach(importDeclarations, function (aliasToWrite) { + var aliasEmitInfo = ts.forEach(aliasDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined; }); + if (aliasEmitInfo) { + createAndSetNewTextWriterWithSymbolWriter(); + for (var declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) { + increaseIndent(); + } + writeImportDeclaration(aliasToWrite); + aliasEmitInfo.asynchronousOutput = writer.getText(); + } + }); + setWriter(oldWriter); + } + function handleSymbolAccessibilityError(symbolAccesibilityResult) { + if (symbolAccesibilityResult.accessibility === 0) { + if (symbolAccesibilityResult && symbolAccesibilityResult.aliasesToMakeVisible) { + writeAsychronousImportDeclarations(symbolAccesibilityResult.aliasesToMakeVisible); + } + } + else { + reportedDeclarationError = true; + var errorInfo = writer.getSymbolAccessibilityDiagnostic(symbolAccesibilityResult); + if (errorInfo) { + if (errorInfo.typeName) { + diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, errorInfo.typeName), symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); + } + else { + diagnostics.push(ts.createDiagnosticForNode(symbolAccesibilityResult.errorNode || errorInfo.errorNode, errorInfo.diagnosticMessage, symbolAccesibilityResult.errorSymbolName, symbolAccesibilityResult.errorModuleName)); + } + } + } + } + function trackSymbol(symbol, enclosingDeclaration, meaning) { + handleSymbolAccessibilityError(resolver.isSymbolAccessible(symbol, enclosingDeclaration, meaning)); + } + function writeTypeOfDeclaration(declaration, type, getSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + write(": "); + if (type) { + emitType(type); + } + else { + resolver.writeTypeOfDeclaration(declaration, enclosingDeclaration, 2, writer); + } + } + function writeReturnTypeAtSignature(signature, getSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + write(": "); + if (signature.type) { + emitType(signature.type); + } + else { + resolver.writeReturnTypeOfSignatureDeclaration(signature, enclosingDeclaration, 2, writer); + } + } + function emitLines(nodes) { + for (var i = 0, n = nodes.length; i < n; i++) { + emit(nodes[i]); + } + } + function emitSeparatedList(nodes, separator, eachNodeEmitFn) { + var currentWriterPos = writer.getTextPos(); + for (var i = 0, n = nodes.length; i < n; i++) { + if (currentWriterPos !== writer.getTextPos()) { + write(separator); + } + currentWriterPos = writer.getTextPos(); + eachNodeEmitFn(nodes[i]); + } + } + function emitCommaList(nodes, eachNodeEmitFn) { + emitSeparatedList(nodes, ", ", eachNodeEmitFn); + } + function writeJsDocComments(declaration) { + if (declaration) { + var jsDocComments = ts.getJsDocComments(declaration, currentSourceFile); + emitNewLineBeforeLeadingComments(currentSourceFile, writer, declaration, jsDocComments); + emitComments(currentSourceFile, writer, jsDocComments, true, newLine, writeCommentRange); + } + } + function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type, getSymbolAccessibilityDiagnostic) { + writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic; + emitType(type); + } + function emitType(type) { + switch (type.kind) { + case 110: + case 119: + case 117: + case 111: + case 120: + case 98: + case 8: + return writeTextOfNode(currentSourceFile, type); + case 137: + return emitTypeReference(type); + case 140: + return emitTypeQuery(type); + case 142: + return emitArrayType(type); + case 143: + return emitTupleType(type); + case 144: + return emitUnionType(type); + case 145: + return emitParenType(type); + case 138: + case 139: + return emitSignatureDeclarationWithJsDocComments(type); + case 141: + return emitTypeLiteral(type); + case 64: + return emitEntityName(type); + case 123: + return emitEntityName(type); + default: + ts.Debug.fail("Unknown type annotation: " + type.kind); + } + function emitEntityName(entityName) { + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 200 ? entityName.parent : enclosingDeclaration); + handleSymbolAccessibilityError(visibilityResult); + writeEntityName(entityName); + function writeEntityName(entityName) { + if (entityName.kind === 64) { + writeTextOfNode(currentSourceFile, entityName); + } + else { + var qualifiedName = entityName; + writeEntityName(qualifiedName.left); + write("."); + writeTextOfNode(currentSourceFile, qualifiedName.right); + } + } + } + function emitTypeReference(type) { + emitEntityName(type.typeName); + if (type.typeArguments) { + write("<"); + emitCommaList(type.typeArguments, emitType); + write(">"); + } + } + function emitTypeQuery(type) { + write("typeof "); + emitEntityName(type.exprName); + } + function emitArrayType(type) { + emitType(type.elementType); + write("[]"); + } + function emitTupleType(type) { + write("["); + emitCommaList(type.elementTypes, emitType); + write("]"); + } + function emitUnionType(type) { + emitSeparatedList(type.types, " | ", emitType); + } + function emitParenType(type) { + write("("); + emitType(type.type); + write(")"); + } + function emitTypeLiteral(type) { + write("{"); + if (type.members.length) { + writeLine(); + increaseIndent(); + emitLines(type.members); + decreaseIndent(); + } + write("}"); + } + } + function emitSourceFile(node) { + currentSourceFile = node; + enclosingDeclaration = node; + emitLines(node.statements); + } + function emitExportAssignment(node) { + write("export = "); + writeTextOfNode(currentSourceFile, node.exportName); + write(";"); + writeLine(); + } + function emitModuleElementDeclarationFlags(node) { + if (node.parent === currentSourceFile) { + if (node.flags & 1) { + write("export "); + } + if (node.kind !== 195) { + write("declare "); + } + } + } + function emitClassMemberDeclarationFlags(node) { + if (node.flags & 32) { + write("private "); + } + else if (node.flags & 64) { + write("protected "); + } + if (node.flags & 128) { + write("static "); + } + } + function emitImportDeclaration(node) { + var nodeEmitInfo = { + declaration: node, + outputPos: writer.getTextPos(), + indent: writer.getIndent(), + hasWritten: resolver.isDeclarationVisible(node) + }; + aliasDeclarationEmitInfo.push(nodeEmitInfo); + if (nodeEmitInfo.hasWritten) { + writeImportDeclaration(node); + } + } + function writeImportDeclaration(node) { + emitJsDocComments(node); + if (node.flags & 1) { + write("export "); + } + write("import "); + writeTextOfNode(currentSourceFile, node.name); + write(" = "); + if (ts.isInternalModuleImportDeclaration(node)) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.moduleReference, getImportEntityNameVisibilityError); + write(";"); + } + else { + write("require("); + writeTextOfNode(currentSourceFile, ts.getExternalModuleImportDeclarationExpression(node)); + write(");"); + } + writer.writeLine(); + function getImportEntityNameVisibilityError(symbolAccesibilityResult) { + return { + diagnosticMessage: ts.Diagnostics.Import_declaration_0_is_using_private_name_1, + errorNode: node, + typeName: node.name + }; + } + } + function emitModuleDeclaration(node) { + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("module "); + writeTextOfNode(currentSourceFile, node.name); + while (node.body.kind !== 199) { + node = node.body; + write("."); + writeTextOfNode(currentSourceFile, node.name); + } + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + write(" {"); + writeLine(); + increaseIndent(); + emitLines(node.body.statements); + decreaseIndent(); + write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + } + } + function emitTypeAliasDeclaration(node) { + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("type "); + writeTextOfNode(currentSourceFile, node.name); + write(" = "); + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.type, getTypeAliasDeclarationVisibilityError); + write(";"); + writeLine(); + } + function getTypeAliasDeclarationVisibilityError(symbolAccesibilityResult) { + return { + diagnosticMessage: ts.Diagnostics.Exported_type_alias_0_has_or_is_using_private_name_1, + errorNode: node.type, + typeName: node.name + }; + } + } + function emitEnumDeclaration(node) { + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + if (ts.isConst(node)) { + write("const "); + } + write("enum "); + writeTextOfNode(currentSourceFile, node.name); + write(" {"); + writeLine(); + increaseIndent(); + emitLines(node.members); + decreaseIndent(); + write("}"); + writeLine(); + } + } + function emitEnumMemberDeclaration(node) { + emitJsDocComments(node); + writeTextOfNode(currentSourceFile, node.name); + var enumMemberValue = resolver.getConstantValue(node); + if (enumMemberValue !== undefined) { + write(" = "); + write(enumMemberValue.toString()); + } + write(","); + writeLine(); + } + function isPrivateMethodTypeParameter(node) { + return node.parent.kind === 130 && (node.parent.flags & 32); + } + function emitTypeParameters(typeParameters) { + function emitTypeParameter(node) { + increaseIndent(); + emitJsDocComments(node); + decreaseIndent(); + writeTextOfNode(currentSourceFile, node.name); + if (node.constraint && !isPrivateMethodTypeParameter(node)) { + write(" extends "); + if (node.parent.kind === 138 || + node.parent.kind === 139 || + (node.parent.parent && node.parent.parent.kind === 141)) { + ts.Debug.assert(node.parent.kind === 130 || + node.parent.kind === 129 || + node.parent.kind === 138 || + node.parent.kind === 139 || + node.parent.kind === 134 || + node.parent.kind === 135); + emitType(node.constraint); + } + else { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.constraint, getTypeParameterConstraintVisibilityError); + } + } + function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + switch (node.parent.kind) { + case 194: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; + break; + case 195: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; + break; + case 135: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 134: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 130: + case 129: + if (node.parent.flags & 128) { + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.parent.kind === 194) { + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + } + break; + case 193: + diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; + break; + default: + ts.Debug.fail("This is unknown parent for type parameter: " + node.parent.kind); + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + }; + } + } + if (typeParameters) { + write("<"); + emitCommaList(typeParameters, emitTypeParameter); + write(">"); + } + } + function emitHeritageClause(typeReferences, isImplementsList) { + if (typeReferences) { + write(isImplementsList ? " implements " : " extends "); + emitCommaList(typeReferences, emitTypeOfTypeReference); + } + function emitTypeOfTypeReference(node) { + emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); + function getHeritageClauseVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + if (node.parent.parent.kind === 194) { + diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = ts.Diagnostics.Extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.parent.parent.name + }; + } + } + } + function emitClassDeclaration(node) { + function emitParameterProperties(constructorDeclaration) { + if (constructorDeclaration) { + ts.forEach(constructorDeclaration.parameters, function (param) { + if (param.flags & 112) { + emitPropertyDeclaration(param); + } + }); + } + } + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("class "); + writeTextOfNode(currentSourceFile, node.name); + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + emitTypeParameters(node.typeParameters); + var baseTypeNode = ts.getClassBaseTypeNode(node); + if (baseTypeNode) { + emitHeritageClause([baseTypeNode], false); + } + emitHeritageClause(ts.getClassImplementedTypeNodes(node), true); + write(" {"); + writeLine(); + increaseIndent(); + emitParameterProperties(getFirstConstructorWithBody(node)); + emitLines(node.members); + decreaseIndent(); + write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + } + } + function emitInterfaceDeclaration(node) { + if (resolver.isDeclarationVisible(node)) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + write("interface "); + writeTextOfNode(currentSourceFile, node.name); + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + emitTypeParameters(node.typeParameters); + emitHeritageClause(ts.getInterfaceBaseTypeNodes(node), false); + write(" {"); + writeLine(); + increaseIndent(); + emitLines(node.members); + decreaseIndent(); + write("}"); + writeLine(); + enclosingDeclaration = prevEnclosingDeclaration; + } + } + function emitPropertyDeclaration(node) { + if (ts.hasDynamicName(node)) { + return; + } + emitJsDocComments(node); + emitClassMemberDeclarationFlags(node); + emitVariableDeclaration(node); + write(";"); + writeLine(); + } + function emitVariableDeclaration(node) { + if (node.kind !== 191 || resolver.isDeclarationVisible(node)) { + writeTextOfNode(currentSourceFile, node.name); + if ((node.kind === 128 || node.kind === 127) && ts.hasQuestionToken(node)) { + write("?"); + } + if ((node.kind === 128 || node.kind === 127) && node.parent.kind === 141) { + emitTypeOfVariableDeclarationFromTypeLiteral(node); + } + else if (!(node.flags & 32)) { + writeTypeOfDeclaration(node, node.type, getVariableDeclarationTypeVisibilityError); + } + } + function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + if (node.kind === 191) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; + } + else if (node.kind === 128 || node.kind === 127) { + if (node.flags & 128) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.kind === 194) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; + } + } + return diagnosticMessage !== undefined ? { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + } : undefined; + } + } + function emitTypeOfVariableDeclarationFromTypeLiteral(node) { + if (node.type) { + write(": "); + emitType(node.type); + } + } + function emitVariableStatement(node) { + var hasDeclarationWithEmit = ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); }); + if (hasDeclarationWithEmit) { + emitJsDocComments(node); + emitModuleElementDeclarationFlags(node); + if (ts.isLet(node.declarationList)) { + write("let "); + } + else if (ts.isConst(node.declarationList)) { + write("const "); + } + else { + write("var "); + } + emitCommaList(node.declarationList.declarations, emitVariableDeclaration); + write(";"); + writeLine(); + } + } + function emitAccessorDeclaration(node) { + if (ts.hasDynamicName(node)) { + return; + } + var accessors = getAllAccessorDeclarations(node.parent.members, node); + if (node === accessors.firstAccessor) { + emitJsDocComments(accessors.getAccessor); + emitJsDocComments(accessors.setAccessor); + emitClassMemberDeclarationFlags(node); + writeTextOfNode(currentSourceFile, node.name); + if (!(node.flags & 32)) { + var accessorWithTypeAnnotation = node; + var type = getTypeAnnotationFromAccessor(node); + if (!type) { + var anotherAccessor = node.kind === 132 ? accessors.setAccessor : accessors.getAccessor; + type = getTypeAnnotationFromAccessor(anotherAccessor); + if (type) { + accessorWithTypeAnnotation = anotherAccessor; + } + } + writeTypeOfDeclaration(node, type, getAccessorDeclarationTypeVisibilityError); + } + write(";"); + writeLine(); + } + function getTypeAnnotationFromAccessor(accessor) { + if (accessor) { + return accessor.kind === 132 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; + } + } + function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + if (accessorWithTypeAnnotation.kind === 133) { + if (accessorWithTypeAnnotation.parent.flags & 128) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1; + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: accessorWithTypeAnnotation.parameters[0], + typeName: accessorWithTypeAnnotation.name + }; + } + else { + if (accessorWithTypeAnnotation.flags & 128) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0; + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: accessorWithTypeAnnotation.name, + typeName: undefined + }; + } + } + } + function emitFunctionDeclaration(node) { + if (ts.hasDynamicName(node)) { + return; + } + if ((node.kind !== 193 || resolver.isDeclarationVisible(node)) && + !resolver.isImplementationOfOverload(node)) { + emitJsDocComments(node); + if (node.kind === 193) { + emitModuleElementDeclarationFlags(node); + } + else if (node.kind === 130) { + emitClassMemberDeclarationFlags(node); + } + if (node.kind === 193) { + write("function "); + writeTextOfNode(currentSourceFile, node.name); + } + else if (node.kind === 131) { + write("constructor"); + } + else { + writeTextOfNode(currentSourceFile, node.name); + if (ts.hasQuestionToken(node)) { + write("?"); + } + } + emitSignatureDeclaration(node); + } + } + function emitSignatureDeclarationWithJsDocComments(node) { + emitJsDocComments(node); + emitSignatureDeclaration(node); + } + function emitSignatureDeclaration(node) { + if (node.kind === 135 || node.kind === 139) { + write("new "); + } + emitTypeParameters(node.typeParameters); + if (node.kind === 136) { + write("["); + } + else { + write("("); + } + var prevEnclosingDeclaration = enclosingDeclaration; + enclosingDeclaration = node; + emitCommaList(node.parameters, emitParameterDeclaration); + if (node.kind === 136) { + write("]"); + } + else { + write(")"); + } + var isFunctionTypeOrConstructorType = node.kind === 138 || node.kind === 139; + if (isFunctionTypeOrConstructorType || node.parent.kind === 141) { + if (node.type) { + write(isFunctionTypeOrConstructorType ? " => " : ": "); + emitType(node.type); + } + } + else if (node.kind !== 131 && !(node.flags & 32)) { + writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); + } + enclosingDeclaration = prevEnclosingDeclaration; + if (!isFunctionTypeOrConstructorType) { + write(";"); + writeLine(); + } + function getReturnTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + switch (node.kind) { + case 135: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; + break; + case 134: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; + break; + case 136: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; + break; + case 130: + case 129: + if (node.flags & 128) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; + } + else if (node.parent.kind === 194) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; + } + break; + case 193: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; + break; + default: + ts.Debug.fail("This is unknown kind for signature: " + node.kind); + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node.name || node + }; + } + } + function emitParameterDeclaration(node) { + increaseIndent(); + emitJsDocComments(node); + if (node.dotDotDotToken) { + write("..."); + } + if (ts.isBindingPattern(node.name)) { + write("_" + ts.indexOf(node.parent.parameters, node)); + } + else { + writeTextOfNode(currentSourceFile, node.name); + } + if (node.initializer || ts.hasQuestionToken(node)) { + write("?"); + } + decreaseIndent(); + if (node.parent.kind === 138 || + node.parent.kind === 139 || + node.parent.parent.kind === 141) { + emitTypeOfVariableDeclarationFromTypeLiteral(node); + } + else if (!(node.parent.flags & 32)) { + writeTypeOfDeclaration(node, node.type, getParameterDeclarationTypeVisibilityError); + } + function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { + var diagnosticMessage; + switch (node.parent.kind) { + case 131: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; + break; + case 135: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 134: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; + break; + case 130: + case 129: + if (node.parent.flags & 128) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; + } + else if (node.parent.parent.kind === 194) { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; + } + else { + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; + } + break; + case 193: + diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; + break; + default: + ts.Debug.fail("This is unknown parent for parameter: " + node.parent.kind); + } + return { + diagnosticMessage: diagnosticMessage, + errorNode: node, + typeName: node.name + }; + } + } + function emitNode(node) { + switch (node.kind) { + case 131: + case 193: + case 130: + case 129: + return emitFunctionDeclaration(node); + case 135: + case 134: + case 136: + return emitSignatureDeclarationWithJsDocComments(node); + case 132: + case 133: + return emitAccessorDeclaration(node); + case 173: + return emitVariableStatement(node); + case 128: + case 127: + return emitPropertyDeclaration(node); + case 195: + return emitInterfaceDeclaration(node); + case 194: + return emitClassDeclaration(node); + case 196: + return emitTypeAliasDeclaration(node); + case 209: + return emitEnumMemberDeclaration(node); + case 197: + return emitEnumDeclaration(node); + case 198: + return emitModuleDeclaration(node); + case 200: + return emitImportDeclaration(node); + case 201: + return emitExportAssignment(node); + case 210: + return emitSourceFile(node); + } + } + function writeReferencePath(referencedFile) { + var declFileName = referencedFile.flags & 1024 ? referencedFile.fileName : shouldEmitToOwnFile(referencedFile, compilerOptions) ? getOwnEmitOutputFilePath(referencedFile, host, ".d.ts") : ts.removeFileExtension(compilerOptions.out) + ".d.ts"; + declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(jsFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, false); + referencePathsOutput += "/// " + newLine; + } + } + function getDeclarationDiagnostics(host, resolver, targetSourceFile) { + var diagnostics = []; + var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, ".js"); + emitDeclarations(host, resolver, diagnostics, jsFilePath, targetSourceFile); + return diagnostics; + } + ts.getDeclarationDiagnostics = getDeclarationDiagnostics; + function emitFiles(resolver, host, targetSourceFile) { + var compilerOptions = host.getCompilerOptions(); + var languageVersion = compilerOptions.target || 0; + var sourceMapDataList = compilerOptions.sourceMap ? [] : undefined; + var diagnostics = []; + var newLine = host.getNewLine(); + if (targetSourceFile === undefined) { + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (shouldEmitToOwnFile(sourceFile, compilerOptions)) { + var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, ".js"); + emitFile(jsFilePath, sourceFile); + } + }); + if (compilerOptions.out) { + emitFile(compilerOptions.out); + } + } + else { + if (shouldEmitToOwnFile(targetSourceFile, compilerOptions)) { + var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, ".js"); + emitFile(jsFilePath, targetSourceFile); + } + else if (!ts.isDeclarationFile(targetSourceFile) && compilerOptions.out) { + emitFile(compilerOptions.out); + } + } + diagnostics = ts.sortAndDeduplicateDiagnostics(diagnostics); + return { + emitSkipped: false, + diagnostics: diagnostics, + sourceMaps: sourceMapDataList + }; + function emitJavaScript(jsFilePath, root) { + var writer = createTextWriter(newLine); + var write = writer.write; + var writeTextOfNode = writer.writeTextOfNode; + var writeLine = writer.writeLine; + var increaseIndent = writer.increaseIndent; + var decreaseIndent = writer.decreaseIndent; + var currentSourceFile; + var extendsEmitted = false; + var tempCount = 0; + var tempVariables; + var tempParameters; + var writeEmittedFiles = writeJavaScriptFile; + var emitLeadingComments = compilerOptions.removeComments ? function (node) { } : emitLeadingDeclarationComments; + var emitTrailingComments = compilerOptions.removeComments ? function (node) { } : emitTrailingDeclarationComments; + var emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos) { } : emitLeadingCommentsOfLocalPosition; + var detachedCommentsInfo; + var emitDetachedComments = compilerOptions.removeComments ? function (node) { } : emitDetachedCommentsAtPosition; + var emitPinnedOrTripleSlashComments = compilerOptions.removeComments ? function (node) { } : emitPinnedOrTripleSlashCommentsOfNode; + var writeComment = writeCommentRange; + var emit = emitNode; + var emitStart = function (node) { }; + var emitEnd = function (node) { }; + var emitToken = emitTokenText; + var scopeEmitStart = function (scopeDeclaration, scopeName) { }; + var scopeEmitEnd = function () { }; + var sourceMapData; + if (compilerOptions.sourceMap) { + initializeEmitterWithSourceMaps(); + } + if (root) { + emit(root); + } + else { + ts.forEach(host.getSourceFiles(), function (sourceFile) { + if (!isExternalModuleOrDeclarationFile(sourceFile)) { + emit(sourceFile); + } + }); + } + writeLine(); + writeEmittedFiles(writer.getText(), compilerOptions.emitBOM); + return; + function initializeEmitterWithSourceMaps() { + var sourceMapDir; + var sourceMapSourceIndex = -1; + var sourceMapNameIndexMap = {}; + var sourceMapNameIndices = []; + function getSourceMapNameIndex() { + return sourceMapNameIndices.length ? sourceMapNameIndices[sourceMapNameIndices.length - 1] : -1; + } + var lastRecordedSourceMapSpan; + var lastEncodedSourceMapSpan = { + emittedLine: 1, + emittedColumn: 1, + sourceLine: 1, + sourceColumn: 1, + sourceIndex: 0 + }; + var lastEncodedNameIndex = 0; + function encodeLastRecordedSourceMapSpan() { + if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { + return; + } + var prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn; + if (lastEncodedSourceMapSpan.emittedLine == lastRecordedSourceMapSpan.emittedLine) { + if (sourceMapData.sourceMapMappings) { + sourceMapData.sourceMapMappings += ","; + } + } + else { + for (var encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) { + sourceMapData.sourceMapMappings += ";"; + } + prevEncodedEmittedColumn = 1; + } + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); + if (lastRecordedSourceMapSpan.nameIndex >= 0) { + sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex); + lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; + } + lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; + sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan); + function base64VLQFormatEncode(inValue) { + function base64FormatEncode(inValue) { + if (inValue < 64) { + return 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.charAt(inValue); + } + throw TypeError(inValue + ": not a 64 based value"); + } + if (inValue < 0) { + inValue = ((-inValue) << 1) + 1; + } + else { + inValue = inValue << 1; + } + var encodedStr = ""; + do { + var currentDigit = inValue & 31; + inValue = inValue >> 5; + if (inValue > 0) { + currentDigit = currentDigit | 32; + } + encodedStr = encodedStr + base64FormatEncode(currentDigit); + } while (inValue > 0); + return encodedStr; + } + } + function recordSourceMapSpan(pos) { + var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); + sourceLinePos.line++; + sourceLinePos.character++; + var emittedLine = writer.getLine(); + var emittedColumn = writer.getColumn(); + if (!lastRecordedSourceMapSpan || + lastRecordedSourceMapSpan.emittedLine != emittedLine || + lastRecordedSourceMapSpan.emittedColumn != emittedColumn || + (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + encodeLastRecordedSourceMapSpan(); + lastRecordedSourceMapSpan = { + emittedLine: emittedLine, + emittedColumn: emittedColumn, + sourceLine: sourceLinePos.line, + sourceColumn: sourceLinePos.character, + nameIndex: getSourceMapNameIndex(), + sourceIndex: sourceMapSourceIndex + }; + } + else { + lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line; + lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character; + lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex; + } + } + function recordEmitNodeStartSpan(node) { + recordSourceMapSpan(ts.skipTrivia(currentSourceFile.text, node.pos)); + } + function recordEmitNodeEndSpan(node) { + recordSourceMapSpan(node.end); + } + function writeTextWithSpanRecord(tokenKind, startPos, emitFn) { + var tokenStartPos = ts.skipTrivia(currentSourceFile.text, startPos); + recordSourceMapSpan(tokenStartPos); + var tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn); + recordSourceMapSpan(tokenEndPos); + return tokenEndPos; + } + function recordNewSourceFileStart(node) { + var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; + sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true)); + sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; + sourceMapData.inputSourceFileNames.push(node.fileName); + } + function recordScopeNameOfNode(node, scopeName) { + function recordScopeNameIndex(scopeNameIndex) { + sourceMapNameIndices.push(scopeNameIndex); + } + function recordScopeNameStart(scopeName) { + var scopeNameIndex = -1; + if (scopeName) { + var parentIndex = getSourceMapNameIndex(); + if (parentIndex !== -1) { + var name = node.name; + if (!name || name.kind !== 124) { + scopeName = "." + scopeName; + } + scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; + } + scopeNameIndex = ts.getProperty(sourceMapNameIndexMap, scopeName); + if (scopeNameIndex === undefined) { + scopeNameIndex = sourceMapData.sourceMapNames.length; + sourceMapData.sourceMapNames.push(scopeName); + sourceMapNameIndexMap[scopeName] = scopeNameIndex; + } + } + recordScopeNameIndex(scopeNameIndex); + } + if (scopeName) { + recordScopeNameStart(scopeName); + } + else if (node.kind === 193 || + node.kind === 158 || + node.kind === 130 || + node.kind === 129 || + node.kind === 132 || + node.kind === 133 || + node.kind === 198 || + node.kind === 194 || + node.kind === 197) { + if (node.name) { + var name = node.name; + scopeName = name.kind === 124 ? ts.getTextOfNode(name) : node.name.text; + } + recordScopeNameStart(scopeName); + } + else { + recordScopeNameIndex(getSourceMapNameIndex()); + } + } + function recordScopeNameEnd() { + sourceMapNameIndices.pop(); + } + ; + function writeCommentRangeWithMap(curentSourceFile, writer, comment, newLine) { + recordSourceMapSpan(comment.pos); + writeCommentRange(currentSourceFile, writer, comment, newLine); + recordSourceMapSpan(comment.end); + } + function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings) { + if (typeof JSON !== "undefined") { + return JSON.stringify({ + version: version, + file: file, + sourceRoot: sourceRoot, + sources: sources, + names: names, + mappings: mappings + }); + } + return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\"}"; + function serializeStringArray(list) { + var output = ""; + for (var i = 0, n = list.length; i < n; i++) { + if (i) { + output += ","; + } + output += "\"" + ts.escapeString(list[i]) + "\""; + } + return output; + } + } + function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { + encodeLastRecordedSourceMapSpan(); + writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings), false); + sourceMapDataList.push(sourceMapData); + writeJavaScriptFile(emitOutput + "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL, writeByteOrderMark); + } + var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); + sourceMapData = { + sourceMapFilePath: jsFilePath + ".map", + jsSourceMappingURL: sourceMapJsFile + ".map", + sourceMapFile: sourceMapJsFile, + sourceMapSourceRoot: compilerOptions.sourceRoot || "", + sourceMapSources: [], + inputSourceFileNames: [], + sourceMapNames: [], + sourceMapMappings: "", + sourceMapDecodedMappings: [] + }; + sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); + if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== 47) { + sourceMapData.sourceMapSourceRoot += ts.directorySeparator; + } + if (compilerOptions.mapRoot) { + sourceMapDir = ts.normalizeSlashes(compilerOptions.mapRoot); + if (root) { + sourceMapDir = ts.getDirectoryPath(getSourceFilePathInNewDir(root, host, sourceMapDir)); + } + if (!ts.isRootedDiskPath(sourceMapDir) && !ts.isUrl(sourceMapDir)) { + sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); + sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(jsFilePath)), ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), host.getCurrentDirectory(), host.getCanonicalFileName, true); + } + else { + sourceMapData.jsSourceMappingURL = ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL); + } + } + else { + sourceMapDir = ts.getDirectoryPath(ts.normalizePath(jsFilePath)); + } + function emitNodeWithMap(node) { + if (node) { + if (node.kind != 210) { + recordEmitNodeStartSpan(node); + emitNode(node); + recordEmitNodeEndSpan(node); + } + else { + recordNewSourceFileStart(node); + emitNode(node); + } + } + } + writeEmittedFiles = writeJavaScriptAndSourceMapFile; + emit = emitNodeWithMap; + emitStart = recordEmitNodeStartSpan; + emitEnd = recordEmitNodeEndSpan; + emitToken = writeTextWithSpanRecord; + scopeEmitStart = recordScopeNameOfNode; + scopeEmitEnd = recordScopeNameEnd; + writeComment = writeCommentRangeWithMap; + } + function writeJavaScriptFile(emitOutput, writeByteOrderMark) { + writeFile(host, diagnostics, jsFilePath, emitOutput, writeByteOrderMark); + } + function createTempVariable(location, forLoopVariable) { + var name = forLoopVariable ? "_i" : undefined; + while (true) { + if (name && resolver.isUnknownIdentifier(location, name)) { + break; + } + name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + 97) : tempCount - 25); + tempCount++; + } + var result = ts.createNode(64); + result.text = name; + return result; + } + function recordTempDeclaration(name) { + if (!tempVariables) { + tempVariables = []; + } + tempVariables.push(name); + } + function createAndRecordTempVariable(location) { + var temp = createTempVariable(location, false); + recordTempDeclaration(temp); + return temp; + } + function emitTempDeclarations(newLine) { + if (tempVariables) { + if (newLine) { + writeLine(); + } + else { + write(" "); + } + write("var "); + emitCommaList(tempVariables); + write(";"); + } + } + function emitTokenText(tokenKind, startPos, emitFn) { + var tokenString = ts.tokenToString(tokenKind); + if (emitFn) { + emitFn(); + } + else { + write(tokenString); + } + return startPos + tokenString.length; + } + function emitOptional(prefix, node) { + if (node) { + write(prefix); + emit(node); + } + } + function emitParenthesized(node, parenthesized) { + if (parenthesized) { + write("("); + } + emit(node); + if (parenthesized) { + write(")"); + } + } + function emitTrailingCommaIfPresent(nodeList) { + if (nodeList.hasTrailingComma) { + write(","); + } + } + function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { + ts.Debug.assert(nodes.length > 0); + increaseIndent(); + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + for (var i = 0, n = nodes.length; i < n; i++) { + if (i) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + write(", "); + } + else { + write(","); + writeLine(); + } + } + emit(nodes[i]); + } + var closeTokenIsOnSameLineAsLastElement = nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes)); + if (nodes.hasTrailingComma && allowTrailingComma) { + write(","); + } + decreaseIndent(); + if (closeTokenIsOnSameLineAsLastElement) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + } + function emitList(nodes, start, count, multiLine, trailingComma) { + for (var i = 0; i < count; i++) { + if (multiLine) { + if (i) { + write(","); + } + writeLine(); + } + else { + if (i) { + write(", "); + } + } + emit(nodes[start + i]); + } + if (trailingComma) { + write(","); + } + if (multiLine) { + writeLine(); + } + } + function emitCommaList(nodes) { + if (nodes) { + emitList(nodes, 0, nodes.length, false, false); + } + } + function emitLines(nodes) { + emitLinesStartingAt(nodes, 0); + } + function emitLinesStartingAt(nodes, startIndex) { + for (var i = startIndex; i < nodes.length; i++) { + writeLine(); + emit(nodes[i]); + } + } + function isBinaryOrOctalIntegerLiteral(text) { + if (text.length <= 0) { + return false; + } + if (text.charCodeAt(1) === 66 || text.charCodeAt(1) === 98 || + text.charCodeAt(1) === 79 || text.charCodeAt(1) === 111) { + return true; + } + return false; + } + function emitLiteral(node) { + var text = languageVersion < 2 && ts.isTemplateLiteralKind(node.kind) ? getTemplateLiteralAsStringLiteral(node) : node.parent ? ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node) : node.text; + if (compilerOptions.sourceMap && (node.kind === 8 || ts.isTemplateLiteralKind(node.kind))) { + writer.writeLiteral(text); + } + else if (languageVersion < 2 && node.kind === 7 && isBinaryOrOctalIntegerLiteral(text)) { + write(node.text); + } + else { + write(text); + } + } + function getTemplateLiteralAsStringLiteral(node) { + return '"' + ts.escapeString(node.text) + '"'; + } + function emitTemplateExpression(node) { + if (languageVersion >= 2) { + ts.forEachChild(node, emit); + return; + } + var emitOuterParens = ts.isExpression(node.parent) && templateNeedsParens(node, node.parent); + if (emitOuterParens) { + write("("); + } + var headEmitted = false; + if (shouldEmitTemplateHead()) { + emitLiteral(node.head); + headEmitted = true; + } + for (var i = 0; i < node.templateSpans.length; i++) { + var templateSpan = node.templateSpans[i]; + var needsParens = templateSpan.expression.kind !== 157 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + if (i > 0 || headEmitted) { + write(" + "); + } + emitParenthesized(templateSpan.expression, needsParens); + if (templateSpan.literal.text.length !== 0) { + write(" + "); + emitLiteral(templateSpan.literal); + } + } + if (emitOuterParens) { + write(")"); + } + function shouldEmitTemplateHead() { + ts.Debug.assert(node.templateSpans.length !== 0); + return node.head.text.length !== 0 || node.templateSpans[0].literal.text.length === 0; + } + function templateNeedsParens(template, parent) { + switch (parent.kind) { + case 153: + case 154: + return parent.expression === template; + case 155: + case 157: + return false; + default: + return comparePrecedenceToBinaryPlus(parent) !== -1; + } + } + function comparePrecedenceToBinaryPlus(expression) { + switch (expression.kind) { + case 165: + switch (expression.operatorToken.kind) { + case 35: + case 36: + case 37: + return 1; + case 33: + case 34: + return 0; + default: + return -1; + } + case 166: + return -1; + default: + return 1; + } + } + } + function emitTemplateSpan(span) { + emit(span.expression); + emit(span.literal); + } + function emitExpressionForPropertyName(node) { + ts.Debug.assert(node.kind !== 148); + if (node.kind === 8) { + emitLiteral(node); + } + else if (node.kind === 124) { + emit(node.expression); + } + else { + write("\""); + if (node.kind === 7) { + write(node.text); + } + else { + writeTextOfNode(currentSourceFile, node); + } + write("\""); + } + } + function isNotExpressionIdentifier(node) { + var parent = node.parent; + switch (parent.kind) { + case 126: + case 191: + case 148: + case 128: + case 127: + case 207: + case 208: + case 209: + case 130: + case 129: + case 193: + case 132: + case 133: + case 158: + case 194: + case 195: + case 197: + case 198: + case 200: + return parent.name === node; + case 183: + case 182: + case 201: + return false; + case 187: + return node.parent.label === node; + case 206: + return node.parent.name === node; + } + } + function emitExpressionIdentifier(node) { + var prefix = resolver.getExpressionNamePrefix(node); + if (prefix) { + write(prefix); + write("."); + } + writeTextOfNode(currentSourceFile, node); + } + function emitIdentifier(node) { + if (!node.parent) { + write(node.text); + } + else if (!isNotExpressionIdentifier(node)) { + emitExpressionIdentifier(node); + } + else { + writeTextOfNode(currentSourceFile, node); + } + } + function emitThis(node) { + if (resolver.getNodeCheckFlags(node) & 2) { + write("_this"); + } + else { + write("this"); + } + } + function emitSuper(node) { + var flags = resolver.getNodeCheckFlags(node); + if (flags & 16) { + write("_super.prototype"); + } + else if (flags & 32) { + write("_super"); + } + else { + write("super"); + } + } + function emitObjectBindingPattern(node) { + write("{ "); + var elements = node.elements; + emitList(elements, 0, elements.length, false, elements.hasTrailingComma); + write(" }"); + } + function emitArrayBindingPattern(node) { + write("["); + var elements = node.elements; + emitList(elements, 0, elements.length, false, elements.hasTrailingComma); + write("]"); + } + function emitBindingElement(node) { + if (node.propertyName) { + emit(node.propertyName); + write(": "); + } + if (node.dotDotDotToken) { + write("..."); + } + if (ts.isBindingPattern(node.name)) { + emit(node.name); + } + else { + emitModuleMemberName(node); + } + emitOptional(" = ", node.initializer); + } + function emitSpreadElementExpression(node) { + write("..."); + emit(node.expression); + } + function needsParenthesisForPropertyAccess(node) { + switch (node.kind) { + case 64: + case 149: + case 151: + case 152: + case 153: + case 157: + return false; + } + return true; + } + function emitListWithSpread(elements, multiLine, trailingComma) { + var pos = 0; + var group = 0; + var length = elements.length; + while (pos < length) { + if (group === 1) { + write(".concat("); + } + else if (group > 1) { + write(", "); + } + var e = elements[pos]; + if (e.kind === 169) { + e = e.expression; + emitParenthesized(e, group === 0 && needsParenthesisForPropertyAccess(e)); + pos++; + } + else { + var i = pos; + while (i < length && elements[i].kind !== 169) { + i++; + } + write("["); + if (multiLine) { + increaseIndent(); + } + emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + if (multiLine) { + decreaseIndent(); + } + write("]"); + pos = i; + } + group++; + } + if (group > 1) { + write(")"); + } + } + function isSpreadElementExpression(node) { + return node.kind === 169; + } + function emitArrayLiteral(node) { + var elements = node.elements; + if (elements.length === 0) { + write("[]"); + } + else if (languageVersion >= 2 || !ts.forEach(elements, isSpreadElementExpression)) { + write("["); + emitLinePreservingList(node, node.elements, elements.hasTrailingComma, false); + write("]"); + } + else { + emitListWithSpread(elements, (node.flags & 256) !== 0, elements.hasTrailingComma); + } + } + function createSynthesizedNode(kind) { + var node = ts.createNode(kind); + node.pos = -1; + node.end = -1; + return node; + } + function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { + var parenthesizedObjectLiteral = createDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex); + return emit(parenthesizedObjectLiteral); + } + function createDownlevelObjectLiteralWithComputedProperties(originalObjectLiteral, firstComputedPropertyIndex) { + var tempVar = createAndRecordTempVariable(originalObjectLiteral); + var initialObjectLiteral = createSynthesizedNode(150); + initialObjectLiteral.properties = originalObjectLiteral.properties.slice(0, firstComputedPropertyIndex); + initialObjectLiteral.flags |= 256; + var propertyPatches = createBinaryExpression(tempVar, 52, initialObjectLiteral); + ts.forEach(originalObjectLiteral.properties, function (property) { + var patchedProperty = tryCreatePatchingPropertyAssignment(originalObjectLiteral, tempVar, property); + if (patchedProperty) { + propertyPatches = createBinaryExpression(propertyPatches, 23, patchedProperty); + } + }); + propertyPatches = createBinaryExpression(propertyPatches, 23, tempVar); + var result = createParenthesizedExpression(propertyPatches); + return result; + } + function addCommentsToSynthesizedNode(node, leadingCommentRanges, trailingCommentRanges) { + node.leadingCommentRanges = leadingCommentRanges; + node.trailingCommentRanges = trailingCommentRanges; + } + function tryCreatePatchingPropertyAssignment(objectLiteral, tempVar, property) { + var leftHandSide = createMemberAccessForPropertyName(tempVar, property.name); + var maybeRightHandSide = tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property); + return maybeRightHandSide && createBinaryExpression(leftHandSide, 52, maybeRightHandSide); + } + function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property) { + switch (property.kind) { + case 207: + return property.initializer; + case 208: + var prefix = createIdentifier(resolver.getExpressionNamePrefix(property.name)); + return createPropertyAccessExpression(prefix, property.name); + case 130: + return createFunctionExpression(property.parameters, property.body); + case 132: + case 133: + var _a = getAllAccessorDeclarations(objectLiteral.properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + if (firstAccessor !== property) { + return undefined; + } + var propertyDescriptor = createSynthesizedNode(150); + var descriptorProperties = []; + if (getAccessor) { + var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); + descriptorProperties.push(getProperty); + } + if (setAccessor) { + var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpression(setAccessor.parameters, setAccessor.body)); + descriptorProperties.push(setProperty); + } + var trueExpr = createSynthesizedNode(94); + var enumerableTrue = createPropertyAssignment(createIdentifier("enumerable"), trueExpr); + descriptorProperties.push(enumerableTrue); + var configurableTrue = createPropertyAssignment(createIdentifier("configurable"), trueExpr); + descriptorProperties.push(configurableTrue); + propertyDescriptor.properties = descriptorProperties; + var objectDotDefineProperty = createPropertyAccessExpression(createIdentifier("Object"), createIdentifier("defineProperty")); + return createCallExpression(objectDotDefineProperty, createNodeArray(propertyDescriptor)); + default: + ts.Debug.fail("ObjectLiteralElement kind " + property.kind + " not accounted for."); + } + } + function createParenthesizedExpression(expression) { + var result = createSynthesizedNode(157); + result.expression = expression; + return result; + } + function createNodeArray() { + var elements = []; + for (var _i = 0; _i < arguments.length; _i++) { + elements[_i - 0] = arguments[_i]; + } + var result = elements; + result.pos = -1; + result.end = -1; + return result; + } + function createBinaryExpression(left, operator, right) { + var result = createSynthesizedNode(165); + result.operatorToken = createSynthesizedNode(operator); + result.left = left; + result.right = right; + return result; + } + function createMemberAccessForPropertyName(expression, memberName) { + if (memberName.kind === 64) { + return createPropertyAccessExpression(expression, memberName); + } + else if (memberName.kind === 8 || memberName.kind === 7) { + return createElementAccessExpression(expression, memberName); + } + else if (memberName.kind === 124) { + return createElementAccessExpression(expression, memberName.expression); + } + else { + ts.Debug.fail("Kind '" + memberName.kind + "' not accounted for."); + } + } + function createPropertyAssignment(name, initializer) { + var result = createSynthesizedNode(207); + result.name = name; + result.initializer = initializer; + return result; + } + function createFunctionExpression(parameters, body) { + var result = createSynthesizedNode(158); + result.parameters = parameters; + result.body = body; + return result; + } + function createPropertyAccessExpression(expression, name) { + var result = createSynthesizedNode(151); + result.expression = expression; + result.name = name; + return result; + } + function createElementAccessExpression(expression, argumentExpression) { + var result = createSynthesizedNode(152); + result.expression = expression; + result.argumentExpression = argumentExpression; + return result; + } + function createIdentifier(name) { + var result = createSynthesizedNode(64); + result.text = name; + return result; + } + function createCallExpression(invokedExpression, arguments) { + var result = createSynthesizedNode(153); + result.expression = invokedExpression; + result.arguments = arguments; + return result; + } + function emitObjectLiteral(node) { + var properties = node.properties; + if (languageVersion < 2) { + var numProperties = properties.length; + var numInitialNonComputedProperties = numProperties; + for (var i = 0, n = properties.length; i < n; i++) { + if (properties[i].name.kind === 124) { + numInitialNonComputedProperties = i; + break; + } + } + var hasComputedProperty = numInitialNonComputedProperties !== properties.length; + if (hasComputedProperty) { + emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); + return; + } + } + write("{"); + var properties = node.properties; + if (properties.length) { + emitLinePreservingList(node, properties, languageVersion >= 1, true); + } + write("}"); + } + function emitComputedPropertyName(node) { + write("["); + emit(node.expression); + write("]"); + } + function emitMethod(node) { + emit(node.name); + if (languageVersion < 2) { + write(": function "); + } + emitSignatureAndBody(node); + } + function emitPropertyAssignment(node) { + emit(node.name); + write(": "); + emit(node.initializer); + } + function emitShorthandPropertyAssignment(node) { + emit(node.name); + if (languageVersion <= 1 || resolver.getExpressionNamePrefix(node.name)) { + write(": "); + emitExpressionIdentifier(node.name); + } + } + function tryEmitConstantValue(node) { + var constantValue = resolver.getConstantValue(node); + if (constantValue !== undefined) { + write(constantValue.toString()); + if (!compilerOptions.removeComments) { + var propertyName = node.kind === 151 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + write(" /* " + propertyName + " */"); + } + return true; + } + return false; + } + function emitPropertyAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } + emit(node.expression); + write("."); + emit(node.name); + } + function emitQualifiedName(node) { + emit(node.left); + write("."); + emit(node.right); + } + function emitIndexedAccess(node) { + if (tryEmitConstantValue(node)) { + return; + } + emit(node.expression); + write("["); + emit(node.argumentExpression); + write("]"); + } + function hasSpreadElement(elements) { + return ts.forEach(elements, function (e) { return e.kind === 169; }); + } + function skipParentheses(node) { + while (node.kind === 157 || node.kind === 156) { + node = node.expression; + } + return node; + } + function emitCallTarget(node) { + if (node.kind === 64 || node.kind === 92 || node.kind === 90) { + emit(node); + return node; + } + var temp = createAndRecordTempVariable(node); + write("("); + emit(temp); + write(" = "); + emit(node); + write(")"); + return temp; + } + function emitCallWithSpread(node) { + var target; + var expr = skipParentheses(node.expression); + if (expr.kind === 151) { + target = emitCallTarget(expr.expression); + write("."); + emit(expr.name); + } + else if (expr.kind === 152) { + target = emitCallTarget(expr.expression); + write("["); + emit(expr.argumentExpression); + write("]"); + } + else if (expr.kind === 90) { + target = expr; + write("_super"); + } + else { + emit(node.expression); + } + write(".apply("); + if (target) { + if (target.kind === 90) { + emitThis(target); + } + else { + emit(target); + } + } + else { + write("void 0"); + } + write(", "); + emitListWithSpread(node.arguments, false, false); + write(")"); + } + function emitCallExpression(node) { + if (languageVersion < 2 && hasSpreadElement(node.arguments)) { + emitCallWithSpread(node); + return; + } + var superCall = false; + if (node.expression.kind === 90) { + write("_super"); + superCall = true; + } + else { + emit(node.expression); + superCall = node.expression.kind === 151 && node.expression.expression.kind === 90; + } + if (superCall) { + write(".call("); + emitThis(node.expression); + if (node.arguments.length) { + write(", "); + emitCommaList(node.arguments); + } + write(")"); + } + else { + write("("); + emitCommaList(node.arguments); + write(")"); + } + } + function emitNewExpression(node) { + write("new "); + emit(node.expression); + if (node.arguments) { + write("("); + emitCommaList(node.arguments); + write(")"); + } + } + function emitTaggedTemplateExpression(node) { + emit(node.tag); + write(" "); + emit(node.template); + } + function emitParenExpression(node) { + if (node.expression.kind === 156) { + var operand = node.expression.expression; + while (operand.kind == 156) { + operand = operand.expression; + } + if (operand.kind !== 163 && + operand.kind !== 162 && + operand.kind !== 161 && + operand.kind !== 160 && + operand.kind !== 164 && + operand.kind !== 154 && + !(operand.kind === 153 && node.parent.kind === 154) && + !(operand.kind === 158 && node.parent.kind === 153)) { + emit(operand); + return; + } + } + write("("); + emit(node.expression); + write(")"); + } + function emitDeleteExpression(node) { + write(ts.tokenToString(73)); + write(" "); + emit(node.expression); + } + function emitVoidExpression(node) { + write(ts.tokenToString(98)); + write(" "); + emit(node.expression); + } + function emitTypeOfExpression(node) { + write(ts.tokenToString(96)); + write(" "); + emit(node.expression); + } + function emitPrefixUnaryExpression(node) { + write(ts.tokenToString(node.operator)); + if (node.operand.kind === 163) { + var operand = node.operand; + if (node.operator === 33 && (operand.operator === 33 || operand.operator === 38)) { + write(" "); + } + else if (node.operator === 34 && (operand.operator === 34 || operand.operator === 39)) { + write(" "); + } + } + emit(node.operand); + } + function emitPostfixUnaryExpression(node) { + emit(node.operand); + write(ts.tokenToString(node.operator)); + } + function emitBinaryExpression(node) { + if (languageVersion < 2 && node.operatorToken.kind === 52 && + (node.left.kind === 150 || node.left.kind === 149)) { + emitDestructuring(node); + } + else { + emit(node.left); + if (node.operatorToken.kind !== 23) { + write(" "); + } + write(ts.tokenToString(node.operatorToken.kind)); + var operatorEnd = ts.getLineAndCharacterOfPosition(currentSourceFile, node.operatorToken.end); + var rightStart = ts.getLineAndCharacterOfPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.right.pos)); + var onDifferentLine = operatorEnd.line !== rightStart.line; + if (onDifferentLine) { + var exprStart = ts.getLineAndCharacterOfPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + var firstCharOfExpr = getFirstNonWhitespaceCharacterIndexOnLine(exprStart.line); + var shouldIndent = rightStart.character > firstCharOfExpr; + if (shouldIndent) { + increaseIndent(); + } + writeLine(); + } + else { + write(" "); + } + emit(node.right); + if (shouldIndent) { + decreaseIndent(); + } + } + } + function getFirstNonWhitespaceCharacterIndexOnLine(line) { + var lineStart = ts.getLineStarts(currentSourceFile)[line]; + var text = currentSourceFile.text; + for (var i = lineStart; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (!ts.isWhiteSpace(text.charCodeAt(i)) || ts.isLineBreak(ch)) { + break; + } + } + return i - lineStart; + } + function emitConditionalExpression(node) { + emit(node.condition); + write(" ? "); + emit(node.whenTrue); + write(" : "); + emit(node.whenFalse); + } + function isSingleLineEmptyBlock(node) { + if (node && node.kind === 172) { + var block = node; + return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); + } + } + function emitBlock(node) { + if (isSingleLineEmptyBlock(node)) { + emitToken(14, node.pos); + write(" "); + emitToken(15, node.statements.end); + return; + } + emitToken(14, node.pos); + increaseIndent(); + scopeEmitStart(node.parent); + if (node.kind === 199) { + ts.Debug.assert(node.parent.kind === 198); + emitCaptureThisForNodeIfNecessary(node.parent); + } + emitLines(node.statements); + if (node.kind === 199) { + emitTempDeclarations(true); + } + decreaseIndent(); + writeLine(); + emitToken(15, node.statements.end); + scopeEmitEnd(); + } + function emitEmbeddedStatement(node) { + if (node.kind === 172) { + write(" "); + emit(node); + } + else { + increaseIndent(); + writeLine(); + emit(node); + decreaseIndent(); + } + } + function emitExpressionStatement(node) { + emitParenthesized(node.expression, node.expression.kind === 159); + write(";"); + } + function emitIfStatement(node) { + var endPos = emitToken(83, node.pos); + write(" "); + endPos = emitToken(16, endPos); + emit(node.expression); + emitToken(17, node.expression.end); + emitEmbeddedStatement(node.thenStatement); + if (node.elseStatement) { + writeLine(); + emitToken(75, node.thenStatement.end); + if (node.elseStatement.kind === 176) { + write(" "); + emit(node.elseStatement); + } + else { + emitEmbeddedStatement(node.elseStatement); + } + } + } + function emitDoStatement(node) { + write("do"); + emitEmbeddedStatement(node.statement); + if (node.statement.kind === 172) { + write(" "); + } + else { + writeLine(); + } + write("while ("); + emit(node.expression); + write(");"); + } + function emitWhileStatement(node) { + write("while ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitForStatement(node) { + var endPos = emitToken(81, node.pos); + write(" "); + endPos = emitToken(16, endPos); + if (node.initializer && node.initializer.kind === 192) { + var variableDeclarationList = node.initializer; + var declarations = variableDeclarationList.declarations; + if (declarations[0] && ts.isLet(declarations[0])) { + emitToken(103, endPos); + } + else if (declarations[0] && ts.isConst(declarations[0])) { + emitToken(69, endPos); + } + else { + emitToken(97, endPos); + } + write(" "); + emitCommaList(variableDeclarationList.declarations); + } + else if (node.initializer) { + emit(node.initializer); + } + write(";"); + emitOptional(" ", node.condition); + write(";"); + emitOptional(" ", node.iterator); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitForInOrForOfStatement(node) { + var endPos = emitToken(81, node.pos); + write(" "); + endPos = emitToken(16, endPos); + if (node.initializer.kind === 192) { + var variableDeclarationList = node.initializer; + if (variableDeclarationList.declarations.length >= 1) { + var decl = variableDeclarationList.declarations[0]; + if (ts.isLet(decl)) { + emitToken(103, endPos); + } + else { + emitToken(97, endPos); + } + write(" "); + emit(decl); + } + } + else { + emit(node.initializer); + } + if (node.kind === 180) { + write(" in "); + } + else { + write(" of "); + } + emit(node.expression); + emitToken(17, node.expression.end); + emitEmbeddedStatement(node.statement); + } + function emitBreakOrContinueStatement(node) { + emitToken(node.kind === 183 ? 65 : 70, node.pos); + emitOptional(" ", node.label); + write(";"); + } + function emitReturnStatement(node) { + emitToken(89, node.pos); + emitOptional(" ", node.expression); + write(";"); + } + function emitWithStatement(node) { + write("with ("); + emit(node.expression); + write(")"); + emitEmbeddedStatement(node.statement); + } + function emitSwitchStatement(node) { + var endPos = emitToken(91, node.pos); + write(" "); + emitToken(16, endPos); + emit(node.expression); + endPos = emitToken(17, node.expression.end); + write(" "); + emitToken(14, endPos); + increaseIndent(); + emitLines(node.clauses); + decreaseIndent(); + writeLine(); + emitToken(15, node.clauses.end); + } + function nodeStartPositionsAreOnSameLine(node1, node2) { + return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function nodeEndPositionsAreOnSameLine(node1, node2) { + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, node2.end); + } + function nodeEndIsOnSameLineAsNodeStart(node1, node2) { + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function emitCaseOrDefaultClause(node) { + if (node.kind === 203) { + write("case "); + emit(node.expression); + write(":"); + } + else { + write("default:"); + } + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { + write(" "); + emit(node.statements[0]); + } + else { + increaseIndent(); + emitLines(node.statements); + decreaseIndent(); + } + } + function emitThrowStatement(node) { + write("throw "); + emit(node.expression); + write(";"); + } + function emitTryStatement(node) { + write("try "); + emit(node.tryBlock); + emit(node.catchClause); + if (node.finallyBlock) { + writeLine(); + write("finally "); + emit(node.finallyBlock); + } + } + function emitCatchClause(node) { + writeLine(); + var endPos = emitToken(67, node.pos); + write(" "); + emitToken(16, endPos); + emit(node.name); + emitToken(17, node.name.end); + write(" "); + emitBlock(node.block); + } + function emitDebuggerStatement(node) { + emitToken(71, node.pos); + write(";"); + } + function emitLabelledStatement(node) { + emit(node.label); + write(": "); + emit(node.statement); + } + function getContainingModule(node) { + do { + node = node.parent; + } while (node && node.kind !== 198); + return node; + } + function emitModuleMemberName(node) { + emitStart(node.name); + if (ts.getCombinedNodeFlags(node) & 1) { + var container = getContainingModule(node); + write(container ? resolver.getLocalNameOfContainer(container) : "exports"); + write("."); + } + emitNode(node.name); + emitEnd(node.name); + } + function emitDestructuring(root, value) { + var emitCount = 0; + var isDeclaration = (root.kind === 191 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 126; + if (root.kind === 165) { + emitAssignmentExpression(root); + } + else { + emitBindingElement(root, value); + } + function emitAssignment(name, value) { + if (emitCount++) { + write(", "); + } + if (name.parent && (name.parent.kind === 191 || name.parent.kind === 148)) { + emitModuleMemberName(name.parent); + } + else { + emit(name); + } + write(" = "); + emit(value); + } + function ensureIdentifier(expr) { + if (expr.kind !== 64) { + var identifier = createTempVariable(root); + if (!isDeclaration) { + recordTempDeclaration(identifier); + } + emitAssignment(identifier, expr); + expr = identifier; + } + return expr; + } + function createVoidZero() { + var zero = ts.createNode(7); + zero.text = "0"; + var result = ts.createNode(162); + result.expression = zero; + return result; + } + function createDefaultValueCheck(value, defaultValue) { + value = ensureIdentifier(value); + var equals = ts.createNode(165); + equals.left = value; + equals.operatorToken = ts.createNode(30); + equals.right = createVoidZero(); + var cond = ts.createNode(166); + cond.condition = equals; + cond.whenTrue = defaultValue; + cond.whenFalse = value; + return cond; + } + function createNumericLiteral(value) { + var node = ts.createNode(7); + node.text = "" + value; + return node; + } + function parenthesizeForAccess(expr) { + if (expr.kind === 64 || expr.kind === 151 || expr.kind === 152) { + return expr; + } + var node = ts.createNode(157); + node.expression = expr; + return node; + } + function createPropertyAccess(object, propName) { + if (propName.kind !== 64) { + return createElementAccess(object, propName); + } + var node = ts.createNode(151); + node.expression = parenthesizeForAccess(object); + node.name = propName; + return node; + } + function createElementAccess(object, index) { + var node = ts.createNode(152); + node.expression = parenthesizeForAccess(object); + node.argumentExpression = index; + return node; + } + function emitObjectLiteralAssignment(target, value) { + var properties = target.properties; + if (properties.length !== 1) { + value = ensureIdentifier(value); + } + for (var i = 0; i < properties.length; i++) { + var p = properties[i]; + if (p.kind === 207 || p.kind === 208) { + var propName = (p.name); + emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); + } + } + } + function emitArrayLiteralAssignment(target, value) { + var elements = target.elements; + if (elements.length !== 1) { + value = ensureIdentifier(value); + } + for (var i = 0; i < elements.length; i++) { + var e = elements[i]; + if (e.kind !== 170) { + if (e.kind !== 169) { + emitDestructuringAssignment(e, createElementAccess(value, createNumericLiteral(i))); + } + else { + if (i === elements.length - 1) { + value = ensureIdentifier(value); + emitAssignment(e.expression, value); + write(".slice(" + i + ")"); + } + } + } + } + } + function emitDestructuringAssignment(target, value) { + if (target.kind === 165 && target.operatorToken.kind === 52) { + value = createDefaultValueCheck(value, target.right); + target = target.left; + } + if (target.kind === 150) { + emitObjectLiteralAssignment(target, value); + } + else if (target.kind === 149) { + emitArrayLiteralAssignment(target, value); + } + else { + emitAssignment(target, value); + } + } + function emitAssignmentExpression(root) { + var target = root.left; + var value = root.right; + if (root.parent.kind === 175) { + emitDestructuringAssignment(target, value); + } + else { + if (root.parent.kind !== 157) { + write("("); + } + value = ensureIdentifier(value); + emitDestructuringAssignment(target, value); + write(", "); + emit(value); + if (root.parent.kind !== 157) { + write(")"); + } + } + } + function emitBindingElement(target, value) { + if (target.initializer) { + value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer; + } + else if (!value) { + value = createVoidZero(); + } + if (ts.isBindingPattern(target.name)) { + var pattern = target.name; + var elements = pattern.elements; + if (elements.length !== 1) { + value = ensureIdentifier(value); + } + for (var i = 0; i < elements.length; i++) { + var element = elements[i]; + if (pattern.kind === 146) { + var propName = element.propertyName || element.name; + emitBindingElement(element, createPropertyAccess(value, propName)); + } + else if (element.kind !== 170) { + if (!element.dotDotDotToken) { + emitBindingElement(element, createElementAccess(value, createNumericLiteral(i))); + } + else { + if (i === elements.length - 1) { + value = ensureIdentifier(value); + emitAssignment(element.name, value); + write(".slice(" + i + ")"); + } + } + } + } + } + else { + emitAssignment(target.name, value); + } + } + } + function emitVariableDeclaration(node) { + if (ts.isBindingPattern(node.name)) { + if (languageVersion < 2) { + emitDestructuring(node); + } + else { + emit(node.name); + emitOptional(" = ", node.initializer); + } + } + else { + emitModuleMemberName(node); + emitOptional(" = ", node.initializer); + } + } + function emitVariableStatement(node) { + if (!(node.flags & 1)) { + if (ts.isLet(node.declarationList)) { + write("let "); + } + else if (ts.isConst(node.declarationList)) { + write("const "); + } + else { + write("var "); + } + } + emitCommaList(node.declarationList.declarations); + write(";"); + } + function emitParameter(node) { + if (languageVersion < 2) { + if (ts.isBindingPattern(node.name)) { + var name = createTempVariable(node); + if (!tempParameters) { + tempParameters = []; + } + tempParameters.push(name); + emit(name); + } + else { + emit(node.name); + } + } + else { + if (node.dotDotDotToken) { + write("..."); + } + emit(node.name); + emitOptional(" = ", node.initializer); + } + } + function emitDefaultValueAssignments(node) { + if (languageVersion < 2) { + var tempIndex = 0; + ts.forEach(node.parameters, function (p) { + if (ts.isBindingPattern(p.name)) { + writeLine(); + write("var "); + emitDestructuring(p, tempParameters[tempIndex]); + write(";"); + tempIndex++; + } + else if (p.initializer) { + writeLine(); + emitStart(p); + write("if ("); + emitNode(p.name); + write(" === void 0)"); + emitEnd(p); + write(" { "); + emitStart(p); + emitNode(p.name); + write(" = "); + emitNode(p.initializer); + emitEnd(p); + write("; }"); + } + }); + } + } + function emitRestParameter(node) { + if (languageVersion < 2 && ts.hasRestParameters(node)) { + var restIndex = node.parameters.length - 1; + var restParam = node.parameters[restIndex]; + var tempName = createTempVariable(node, true).text; + writeLine(); + emitLeadingComments(restParam); + emitStart(restParam); + write("var "); + emitNode(restParam.name); + write(" = [];"); + emitEnd(restParam); + emitTrailingComments(restParam); + writeLine(); + write("for ("); + emitStart(restParam); + write("var " + tempName + " = " + restIndex + ";"); + emitEnd(restParam); + write(" "); + emitStart(restParam); + write(tempName + " < arguments.length;"); + emitEnd(restParam); + write(" "); + emitStart(restParam); + write(tempName + "++"); + emitEnd(restParam); + write(") {"); + increaseIndent(); + writeLine(); + emitStart(restParam); + emitNode(restParam.name); + write("[" + tempName + " - " + restIndex + "] = arguments[" + tempName + "];"); + emitEnd(restParam); + decreaseIndent(); + writeLine(); + write("}"); + } + } + function emitAccessor(node) { + write(node.kind === 132 ? "get " : "set "); + emit(node.name); + emitSignatureAndBody(node); + } + function shouldEmitAsArrowFunction(node) { + return node.kind === 159 && languageVersion >= 2; + } + function emitFunctionDeclaration(node) { + if (ts.nodeIsMissing(node.body)) { + return emitPinnedOrTripleSlashComments(node); + } + if (node.kind !== 130 && node.kind !== 129) { + emitLeadingComments(node); + } + if (!shouldEmitAsArrowFunction(node)) { + write("function "); + } + if (node.kind === 193 || (node.kind === 158 && node.name)) { + emit(node.name); + } + emitSignatureAndBody(node); + if (node.kind !== 130 && node.kind !== 129) { + emitTrailingComments(node); + } + } + function emitCaptureThisForNodeIfNecessary(node) { + if (resolver.getNodeCheckFlags(node) & 4) { + writeLine(); + emitStart(node); + write("var _this = this;"); + emitEnd(node); + } + } + function emitSignatureParameters(node) { + increaseIndent(); + write("("); + if (node) { + var parameters = node.parameters; + var omitCount = languageVersion < 2 && ts.hasRestParameters(node) ? 1 : 0; + emitList(parameters, 0, parameters.length - omitCount, false, false); + } + write(")"); + decreaseIndent(); + } + function emitSignatureParametersForArrow(node) { + if (node.parameters.length === 1 && node.pos === node.parameters[0].pos) { + emit(node.parameters[0]); + return; + } + emitSignatureParameters(node); + } + function emitSignatureAndBody(node) { + var saveTempCount = tempCount; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + tempCount = 0; + tempVariables = undefined; + tempParameters = undefined; + if (shouldEmitAsArrowFunction(node)) { + emitSignatureParametersForArrow(node); + write(" =>"); + } + else { + emitSignatureParameters(node); + } + if (isSingleLineEmptyBlock(node.body) || !node.body) { + write(" { }"); + } + else if (node.body.kind === 172) { + emitBlockFunctionBody(node, node.body); + } + else { + emitExpressionFunctionBody(node, node.body); + } + if (node.flags & 1) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emit(node.name); + emitEnd(node); + write(";"); + } + tempCount = saveTempCount; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + } + function emitFunctionBodyPreamble(node) { + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + } + function emitExpressionFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + increaseIndent(); + var outPos = writer.getTextPos(); + emitDetachedComments(node.body); + emitFunctionBodyPreamble(node); + var preambleEmitted = writer.getTextPos() !== outPos; + decreaseIndent(); + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + write(" "); + emitStart(body); + write("return "); + emitNode(body, true); + emitEnd(body); + write(";"); + emitTempDeclarations(false); + write(" "); + } + else { + increaseIndent(); + writeLine(); + emitLeadingComments(node.body); + write("return "); + emit(node.body, true); + write(";"); + emitTrailingComments(node.body); + emitTempDeclarations(true); + decreaseIndent(); + writeLine(); + } + emitStart(node.body); + write("}"); + emitEnd(node.body); + scopeEmitEnd(); + } + function emitBlockFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + var outPos = writer.getTextPos(); + increaseIndent(); + emitDetachedComments(body.statements); + var startIndex = emitDirectivePrologues(body.statements, true); + emitFunctionBodyPreamble(node); + decreaseIndent(); + var preambleEmitted = writer.getTextPos() !== outPos; + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var i = 0, n = body.statements.length; i < n; i++) { + write(" "); + emit(body.statements[i]); + } + emitTempDeclarations(false); + write(" "); + emitLeadingCommentsOfPosition(body.statements.end); + } + else { + increaseIndent(); + emitLinesStartingAt(body.statements, startIndex); + emitTempDeclarations(true); + writeLine(); + emitLeadingCommentsOfPosition(body.statements.end); + decreaseIndent(); + } + emitToken(15, body.statements.end); + scopeEmitEnd(); + } + function findInitialSuperCall(ctor) { + if (ctor.body) { + var statement = ctor.body.statements[0]; + if (statement && statement.kind === 175) { + var expr = statement.expression; + if (expr && expr.kind === 153) { + var func = expr.expression; + if (func && func.kind === 90) { + return statement; + } + } + } + } + } + function emitParameterPropertyAssignments(node) { + ts.forEach(node.parameters, function (param) { + if (param.flags & 112) { + writeLine(); + emitStart(param); + emitStart(param.name); + write("this."); + emitNode(param.name); + emitEnd(param.name); + write(" = "); + emit(param.name); + write(";"); + emitEnd(param); + } + }); + } + function emitMemberAccessForPropertyName(memberName) { + if (memberName.kind === 8 || memberName.kind === 7) { + write("["); + emitNode(memberName); + write("]"); + } + else if (memberName.kind === 124) { + emitComputedPropertyName(memberName); + } + else { + write("."); + emitNode(memberName); + } + } + function emitMemberAssignments(node, staticFlag) { + ts.forEach(node.members, function (member) { + if (member.kind === 128 && (member.flags & 128) === staticFlag && member.initializer) { + writeLine(); + emitLeadingComments(member); + emitStart(member); + emitStart(member.name); + if (staticFlag) { + emitNode(node.name); + } + else { + write("this"); + } + emitMemberAccessForPropertyName(member.name); + emitEnd(member.name); + write(" = "); + emit(member.initializer); + write(";"); + emitEnd(member); + emitTrailingComments(member); + } + }); + } + function emitMemberFunctions(node) { + ts.forEach(node.members, function (member) { + if (member.kind === 130 || node.kind === 129) { + if (!member.body) { + return emitPinnedOrTripleSlashComments(member); + } + writeLine(); + emitLeadingComments(member); + emitStart(member); + emitStart(member.name); + emitNode(node.name); + if (!(member.flags & 128)) { + write(".prototype"); + } + emitMemberAccessForPropertyName(member.name); + emitEnd(member.name); + write(" = "); + emitStart(member); + emitFunctionDeclaration(member); + emitEnd(member); + emitEnd(member); + write(";"); + emitTrailingComments(member); + } + else if (member.kind === 132 || member.kind === 133) { + var accessors = getAllAccessorDeclarations(node.members, member); + if (member === accessors.firstAccessor) { + writeLine(); + emitStart(member); + write("Object.defineProperty("); + emitStart(member.name); + emitNode(node.name); + if (!(member.flags & 128)) { + write(".prototype"); + } + write(", "); + emitExpressionForPropertyName(member.name); + emitEnd(member.name); + write(", {"); + increaseIndent(); + if (accessors.getAccessor) { + writeLine(); + emitLeadingComments(accessors.getAccessor); + write("get: "); + emitStart(accessors.getAccessor); + write("function "); + emitSignatureAndBody(accessors.getAccessor); + emitEnd(accessors.getAccessor); + emitTrailingComments(accessors.getAccessor); + write(","); + } + if (accessors.setAccessor) { + writeLine(); + emitLeadingComments(accessors.setAccessor); + write("set: "); + emitStart(accessors.setAccessor); + write("function "); + emitSignatureAndBody(accessors.setAccessor); + emitEnd(accessors.setAccessor); + emitTrailingComments(accessors.setAccessor); + write(","); + } + writeLine(); + write("enumerable: true,"); + writeLine(); + write("configurable: true"); + decreaseIndent(); + writeLine(); + write("});"); + emitEnd(member); + } + } + }); + } + function emitClassDeclaration(node) { + write("var "); + emit(node.name); + write(" = (function ("); + var baseTypeNode = ts.getClassBaseTypeNode(node); + if (baseTypeNode) { + write("_super"); + } + write(") {"); + increaseIndent(); + scopeEmitStart(node); + if (baseTypeNode) { + writeLine(); + emitStart(baseTypeNode); + write("__extends("); + emit(node.name); + write(", _super);"); + emitEnd(baseTypeNode); + } + writeLine(); + emitConstructorOfClass(); + emitMemberFunctions(node); + emitMemberAssignments(node, 128); + writeLine(); + function emitClassReturnStatement() { + write("return "); + emitNode(node.name); + } + emitToken(15, node.members.end, emitClassReturnStatement); + write(";"); + decreaseIndent(); + writeLine(); + emitToken(15, node.members.end); + scopeEmitEnd(); + emitStart(node); + write(")("); + if (baseTypeNode) { + emit(baseTypeNode.typeName); + } + write(");"); + emitEnd(node); + if (node.flags & 1) { + writeLine(); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emit(node.name); + emitEnd(node); + write(";"); + } + function emitConstructorOfClass() { + var saveTempCount = tempCount; + var saveTempVariables = tempVariables; + var saveTempParameters = tempParameters; + tempCount = 0; + tempVariables = undefined; + tempParameters = undefined; + ts.forEach(node.members, function (member) { + if (member.kind === 131 && !member.body) { + emitPinnedOrTripleSlashComments(member); + } + }); + var ctor = getFirstConstructorWithBody(node); + if (ctor) { + emitLeadingComments(ctor); + } + emitStart(ctor || node); + write("function "); + emit(node.name); + emitSignatureParameters(ctor); + write(" {"); + scopeEmitStart(node, "constructor"); + increaseIndent(); + if (ctor) { + emitDetachedComments(ctor.body.statements); + } + emitCaptureThisForNodeIfNecessary(node); + if (ctor) { + emitDefaultValueAssignments(ctor); + emitRestParameter(ctor); + if (baseTypeNode) { + var superCall = findInitialSuperCall(ctor); + if (superCall) { + writeLine(); + emit(superCall); + } + } + emitParameterPropertyAssignments(ctor); + } + else { + if (baseTypeNode) { + writeLine(); + emitStart(baseTypeNode); + write("_super.apply(this, arguments);"); + emitEnd(baseTypeNode); + } + } + emitMemberAssignments(node, 0); + if (ctor) { + var statements = ctor.body.statements; + if (superCall) + statements = statements.slice(1); + emitLines(statements); + } + emitTempDeclarations(true); + writeLine(); + if (ctor) { + emitLeadingCommentsOfPosition(ctor.body.statements.end); + } + decreaseIndent(); + emitToken(15, ctor ? ctor.body.statements.end : node.members.end); + scopeEmitEnd(); + emitEnd(ctor || node); + if (ctor) { + emitTrailingComments(ctor); + } + tempCount = saveTempCount; + tempVariables = saveTempVariables; + tempParameters = saveTempParameters; + } + } + function emitInterfaceDeclaration(node) { + emitPinnedOrTripleSlashComments(node); + } + function shouldEmitEnumDeclaration(node) { + var isConstEnum = ts.isConst(node); + return !isConstEnum || compilerOptions.preserveConstEnums; + } + function emitEnumDeclaration(node) { + if (!shouldEmitEnumDeclaration(node)) { + return; + } + if (!(node.flags & 1)) { + emitStart(node); + write("var "); + emit(node.name); + emitEnd(node); + write(";"); + } + writeLine(); + emitStart(node); + write("(function ("); + emitStart(node.name); + write(resolver.getLocalNameOfContainer(node)); + emitEnd(node.name); + write(") {"); + increaseIndent(); + scopeEmitStart(node); + emitLines(node.members); + decreaseIndent(); + writeLine(); + emitToken(15, node.members.end); + scopeEmitEnd(); + write(")("); + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + if (node.flags & 1) { + writeLine(); + emitStart(node); + write("var "); + emit(node.name); + write(" = "); + emitModuleMemberName(node); + emitEnd(node); + write(";"); + } + } + function emitEnumMember(node) { + var enumParent = node.parent; + emitStart(node); + write(resolver.getLocalNameOfContainer(enumParent)); + write("["); + write(resolver.getLocalNameOfContainer(enumParent)); + write("["); + emitExpressionForPropertyName(node.name); + write("] = "); + writeEnumMemberDeclarationValue(node); + write("] = "); + emitExpressionForPropertyName(node.name); + emitEnd(node); + write(";"); + } + function writeEnumMemberDeclarationValue(member) { + if (!member.initializer || ts.isConst(member.parent)) { + var value = resolver.getConstantValue(member); + if (value !== undefined) { + write(value.toString()); + return; + } + } + if (member.initializer) { + emit(member.initializer); + } + else { + write("undefined"); + } + } + function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { + if (moduleDeclaration.body.kind === 198) { + var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); + return recursiveInnerModule || moduleDeclaration.body; + } + } + function shouldEmitModuleDeclaration(node) { + return ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums); + } + function emitModuleDeclaration(node) { + var shouldEmit = shouldEmitModuleDeclaration(node); + if (!shouldEmit) { + return emitPinnedOrTripleSlashComments(node); + } + emitStart(node); + write("var "); + emit(node.name); + write(";"); + emitEnd(node); + writeLine(); + emitStart(node); + write("(function ("); + emitStart(node.name); + write(resolver.getLocalNameOfContainer(node)); + emitEnd(node.name); + write(") "); + if (node.body.kind === 199) { + var saveTempCount = tempCount; + var saveTempVariables = tempVariables; + tempCount = 0; + tempVariables = undefined; + emit(node.body); + tempCount = saveTempCount; + tempVariables = saveTempVariables; + } + else { + write("{"); + increaseIndent(); + scopeEmitStart(node); + emitCaptureThisForNodeIfNecessary(node); + writeLine(); + emit(node.body); + decreaseIndent(); + writeLine(); + var moduleBlock = getInnerMostModuleDeclarationFromDottedModule(node).body; + emitToken(15, moduleBlock.statements.end); + scopeEmitEnd(); + } + write(")("); + if (node.flags & 1) { + emit(node.name); + write(" = "); + } + emitModuleMemberName(node); + write(" || ("); + emitModuleMemberName(node); + write(" = {}));"); + emitEnd(node); + } + function emitImportDeclaration(node) { + var emitImportDeclaration = resolver.isReferencedImportDeclaration(node); + if (!emitImportDeclaration) { + emitImportDeclaration = !ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportWithEntityName(node); + } + if (emitImportDeclaration) { + if (ts.isExternalModuleImportDeclaration(node) && node.parent.kind === 210 && compilerOptions.module === 2) { + if (node.flags & 1) { + writeLine(); + emitLeadingComments(node); + emitStart(node); + emitModuleMemberName(node); + write(" = "); + emit(node.name); + write(";"); + emitEnd(node); + emitTrailingComments(node); + } + } + else { + writeLine(); + emitLeadingComments(node); + emitStart(node); + if (!(node.flags & 1)) + write("var "); + emitModuleMemberName(node); + write(" = "); + if (ts.isInternalModuleImportDeclaration(node)) { + emit(node.moduleReference); + } + else { + var literal = ts.getExternalModuleImportDeclarationExpression(node); + write("require("); + emitStart(literal); + emitLiteral(literal); + emitEnd(literal); + emitToken(17, literal.end); + } + write(";"); + emitEnd(node); + emitTrailingComments(node); + } + } + } + function getExternalImportDeclarations(node) { + var result = []; + ts.forEach(node.statements, function (statement) { + if (ts.isExternalModuleImportDeclaration(statement) && resolver.isReferencedImportDeclaration(statement)) { + result.push(statement); + } + }); + return result; + } + function getFirstExportAssignment(sourceFile) { + return ts.forEach(sourceFile.statements, function (node) { + if (node.kind === 201) { + return node; + } + }); + } + function sortAMDModules(amdModules) { + return amdModules.sort(function (moduleA, moduleB) { + if (moduleA.name === moduleB.name) { + return 0; + } + else if (!moduleA.name) { + return 1; + } + else { + return -1; + } + }); + } + function emitAMDModule(node, startIndex) { + var imports = getExternalImportDeclarations(node); + writeLine(); + write("define("); + sortAMDModules(node.amdDependencies); + if (node.amdModuleName) { + write("\"" + node.amdModuleName + "\", "); + } + write("[\"require\", \"exports\""); + ts.forEach(imports, function (imp) { + write(", "); + emitLiteral(ts.getExternalModuleImportDeclarationExpression(imp)); + }); + ts.forEach(node.amdDependencies, function (amdDependency) { + var text = "\"" + amdDependency.path + "\""; + write(", "); + write(text); + }); + write("], function (require, exports"); + ts.forEach(imports, function (imp) { + write(", "); + emit(imp.name); + }); + ts.forEach(node.amdDependencies, function (amdDependency) { + if (amdDependency.name) { + write(", "); + write(amdDependency.name); + } + }); + write(") {"); + increaseIndent(); + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + var exportName = resolver.getExportAssignmentName(node); + if (exportName) { + writeLine(); + var exportAssignment = getFirstExportAssignment(node); + emitStart(exportAssignment); + write("return "); + emitStart(exportAssignment.exportName); + write(exportName); + emitEnd(exportAssignment.exportName); + write(";"); + emitEnd(exportAssignment); + } + decreaseIndent(); + writeLine(); + write("});"); + } + function emitCommonJSModule(node, startIndex) { + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + var exportName = resolver.getExportAssignmentName(node); + if (exportName) { + writeLine(); + var exportAssignment = getFirstExportAssignment(node); + emitStart(exportAssignment); + write("module.exports = "); + emitStart(exportAssignment.exportName); + write(exportName); + emitEnd(exportAssignment.exportName); + write(";"); + emitEnd(exportAssignment); + } + } + function emitDirectivePrologues(statements, startWithNewLine) { + for (var i = 0; i < statements.length; ++i) { + if (ts.isPrologueDirective(statements[i])) { + if (startWithNewLine || i > 0) { + writeLine(); + } + emit(statements[i]); + } + else { + return i; + } + } + return statements.length; + } + function emitSourceFile(node) { + currentSourceFile = node; + writeLine(); + emitDetachedComments(node); + var startIndex = emitDirectivePrologues(node.statements, false); + if (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8) { + writeLine(); + write("var __extends = this.__extends || function (d, b) {"); + increaseIndent(); + writeLine(); + write("for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];"); + writeLine(); + write("function __() { this.constructor = d; }"); + writeLine(); + write("__.prototype = b.prototype;"); + writeLine(); + write("d.prototype = new __();"); + decreaseIndent(); + writeLine(); + write("};"); + extendsEmitted = true; + } + if (ts.isExternalModule(node)) { + if (compilerOptions.module === 2) { + emitAMDModule(node, startIndex); + } + else { + emitCommonJSModule(node, startIndex); + } + } + else { + emitCaptureThisForNodeIfNecessary(node); + emitLinesStartingAt(node.statements, startIndex); + emitTempDeclarations(true); + } + emitLeadingComments(node.endOfFileToken); + } + function emitNode(node, disableComments) { + if (!node) { + return; + } + if (node.flags & 2) { + return emitPinnedOrTripleSlashComments(node); + } + var emitComments = !disableComments && shouldEmitLeadingAndTrailingComments(node); + if (emitComments) { + emitLeadingComments(node); + } + emitJavaScriptWorker(node); + if (emitComments) { + emitTrailingComments(node); + } + } + function shouldEmitLeadingAndTrailingComments(node) { + switch (node.kind) { + case 195: + case 193: + case 200: + case 196: + case 201: + return false; + case 198: + return shouldEmitModuleDeclaration(node); + case 197: + return shouldEmitEnumDeclaration(node); + } + return true; + } + function emitJavaScriptWorker(node) { + switch (node.kind) { + case 64: + return emitIdentifier(node); + case 126: + return emitParameter(node); + case 130: + case 129: + return emitMethod(node); + case 132: + case 133: + return emitAccessor(node); + case 92: + return emitThis(node); + case 90: + return emitSuper(node); + case 88: + return write("null"); + case 94: + return write("true"); + case 79: + return write("false"); + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + return emitLiteral(node); + case 167: + return emitTemplateExpression(node); + case 171: + return emitTemplateSpan(node); + case 123: + return emitQualifiedName(node); + case 146: + return emitObjectBindingPattern(node); + case 147: + return emitArrayBindingPattern(node); + case 148: + return emitBindingElement(node); + case 149: + return emitArrayLiteral(node); + case 150: + return emitObjectLiteral(node); + case 207: + return emitPropertyAssignment(node); + case 208: + return emitShorthandPropertyAssignment(node); + case 124: + return emitComputedPropertyName(node); + case 151: + return emitPropertyAccess(node); + case 152: + return emitIndexedAccess(node); + case 153: + return emitCallExpression(node); + case 154: + return emitNewExpression(node); + case 155: + return emitTaggedTemplateExpression(node); + case 156: + return emit(node.expression); + case 157: + return emitParenExpression(node); + case 193: + case 158: + case 159: + return emitFunctionDeclaration(node); + case 160: + return emitDeleteExpression(node); + case 161: + return emitTypeOfExpression(node); + case 162: + return emitVoidExpression(node); + case 163: + return emitPrefixUnaryExpression(node); + case 164: + return emitPostfixUnaryExpression(node); + case 165: + return emitBinaryExpression(node); + case 166: + return emitConditionalExpression(node); + case 169: + return emitSpreadElementExpression(node); + case 170: + return; + case 172: + case 199: + return emitBlock(node); + case 173: + return emitVariableStatement(node); + case 174: + return write(";"); + case 175: + return emitExpressionStatement(node); + case 176: + return emitIfStatement(node); + case 177: + return emitDoStatement(node); + case 178: + return emitWhileStatement(node); + case 179: + return emitForStatement(node); + case 181: + case 180: + return emitForInOrForOfStatement(node); + case 182: + case 183: + return emitBreakOrContinueStatement(node); + case 184: + return emitReturnStatement(node); + case 185: + return emitWithStatement(node); + case 186: + return emitSwitchStatement(node); + case 203: + case 204: + return emitCaseOrDefaultClause(node); + case 187: + return emitLabelledStatement(node); + case 188: + return emitThrowStatement(node); + case 189: + return emitTryStatement(node); + case 206: + return emitCatchClause(node); + case 190: + return emitDebuggerStatement(node); + case 191: + return emitVariableDeclaration(node); + case 194: + return emitClassDeclaration(node); + case 195: + return emitInterfaceDeclaration(node); + case 197: + return emitEnumDeclaration(node); + case 209: + return emitEnumMember(node); + case 198: + return emitModuleDeclaration(node); + case 200: + return emitImportDeclaration(node); + case 210: + return emitSourceFile(node); + } + } + function hasDetachedComments(pos) { + return detachedCommentsInfo !== undefined && detachedCommentsInfo[detachedCommentsInfo.length - 1].nodePos === pos; + } + function getLeadingCommentsWithoutDetachedComments() { + var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos); + if (detachedCommentsInfo.length - 1) { + detachedCommentsInfo.pop(); + } + else { + detachedCommentsInfo = undefined; + } + return leadingComments; + } + function getLeadingCommentsToEmit(node) { + if (node.parent) { + if (node.parent.kind === 210 || node.pos !== node.parent.pos) { + var leadingComments; + if (hasDetachedComments(node.pos)) { + leadingComments = getLeadingCommentsWithoutDetachedComments(); + } + else { + leadingComments = ts.getLeadingCommentRangesOfNode(node, currentSourceFile); + } + return leadingComments; + } + } + } + function emitLeadingDeclarationComments(node) { + var leadingComments = getLeadingCommentsToEmit(node); + emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + } + function emitTrailingDeclarationComments(node) { + if (node.parent) { + if (node.parent.kind === 210 || node.end !== node.parent.end) { + var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); + emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); + } + } + } + function emitLeadingCommentsOfLocalPosition(pos) { + var leadingComments; + if (hasDetachedComments(pos)) { + leadingComments = getLeadingCommentsWithoutDetachedComments(); + } + else { + leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, pos); + } + emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); + emitComments(currentSourceFile, writer, leadingComments, true, newLine, writeComment); + } + function emitDetachedCommentsAtPosition(node) { + var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, node.pos); + if (leadingComments) { + var detachedComments = []; + var lastComment; + ts.forEach(leadingComments, function (comment) { + if (lastComment) { + var lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); + var commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); + if (commentLine >= lastCommentLine + 2) { + return detachedComments; + } + } + detachedComments.push(comment); + lastComment = comment; + }); + if (detachedComments.length) { + var lastCommentLine = getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); + var nodeLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { + emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); + emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); + var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; + if (detachedCommentsInfo) { + detachedCommentsInfo.push(currentDetachedCommentInfo); + } + else { + detachedCommentsInfo = [currentDetachedCommentInfo]; + } + } + } + } + } + function emitPinnedOrTripleSlashCommentsOfNode(node) { + var pinnedComments = ts.filter(getLeadingCommentsToEmit(node), isPinnedOrTripleSlashComment); + function isPinnedOrTripleSlashComment(comment) { + if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { + return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; + } + else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && + currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { + return true; + } + } + emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, pinnedComments); + emitComments(currentSourceFile, writer, pinnedComments, true, newLine, writeComment); + } + } + function writeDeclarationFile(jsFilePath, sourceFile) { + var emitDeclarationResult = emitDeclarations(host, resolver, diagnostics, jsFilePath, sourceFile); + if (!emitDeclarationResult.reportedDeclarationError) { + var declarationOutput = emitDeclarationResult.referencePathsOutput; + var appliedSyncOutputPos = 0; + ts.forEach(emitDeclarationResult.aliasDeclarationEmitInfo, function (aliasEmitInfo) { + if (aliasEmitInfo.asynchronousOutput) { + declarationOutput += emitDeclarationResult.synchronousDeclarationOutput.substring(appliedSyncOutputPos, aliasEmitInfo.outputPos); + declarationOutput += aliasEmitInfo.asynchronousOutput; + appliedSyncOutputPos = aliasEmitInfo.outputPos; + } + }); + declarationOutput += emitDeclarationResult.synchronousDeclarationOutput.substring(appliedSyncOutputPos); + writeFile(host, diagnostics, ts.removeFileExtension(jsFilePath) + ".d.ts", declarationOutput, compilerOptions.emitBOM); + } + } + function emitFile(jsFilePath, sourceFile) { + emitJavaScript(jsFilePath, sourceFile); + if (compilerOptions.declaration) { + writeDeclarationFile(jsFilePath, sourceFile); + } + } + } + ts.emitFiles = emitFiles; +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.emitTime = 0; + function createCompilerHost(options) { + var currentDirectory; + var existingDirectories = {}; + function getCanonicalFileName(fileName) { + return ts.sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase(); + } + var unsupportedFileEncodingErrorCode = -2147024809; + function getSourceFile(fileName, languageVersion, onError) { + try { + var text = ts.sys.readFile(fileName, options.charset); + } + catch (e) { + if (onError) { + onError(e.number === unsupportedFileEncodingErrorCode ? ts.createCompilerDiagnostic(ts.Diagnostics.Unsupported_file_encoding).messageText : e.message); + } + text = ""; + } + return text !== undefined ? ts.createSourceFile(fileName, text, languageVersion) : undefined; + } + function writeFile(fileName, data, writeByteOrderMark, onError) { + function directoryExists(directoryPath) { + if (ts.hasProperty(existingDirectories, directoryPath)) { + return true; + } + if (ts.sys.directoryExists(directoryPath)) { + existingDirectories[directoryPath] = true; + return true; + } + return false; + } + function ensureDirectoriesExist(directoryPath) { + if (directoryPath.length > ts.getRootLength(directoryPath) && !directoryExists(directoryPath)) { + var parentDirectory = ts.getDirectoryPath(directoryPath); + ensureDirectoriesExist(parentDirectory); + ts.sys.createDirectory(directoryPath); + } + } + try { + ensureDirectoriesExist(ts.getDirectoryPath(ts.normalizePath(fileName))); + ts.sys.writeFile(fileName, data, writeByteOrderMark); + } + catch (e) { + if (onError) { + onError(e.message); + } + } + } + return { + getSourceFile: getSourceFile, + getDefaultLibFileName: function (options) { return ts.combinePaths(ts.getDirectoryPath(ts.normalizePath(ts.sys.getExecutingFilePath())), ts.getDefaultLibFileName(options)); }, + writeFile: writeFile, + getCurrentDirectory: function () { return currentDirectory || (currentDirectory = ts.sys.getCurrentDirectory()); }, + useCaseSensitiveFileNames: function () { return ts.sys.useCaseSensitiveFileNames; }, + getCanonicalFileName: getCanonicalFileName, + getNewLine: function () { return ts.sys.newLine; } + }; + } + ts.createCompilerHost = createCompilerHost; + function getPreEmitDiagnostics(program) { + var diagnostics = program.getSyntacticDiagnostics().concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics()); + return ts.sortAndDeduplicateDiagnostics(diagnostics); + } + ts.getPreEmitDiagnostics = getPreEmitDiagnostics; + function flattenDiagnosticMessageText(messageText, newLine) { + if (typeof messageText === "string") { + return messageText; + } + else { + var diagnosticChain = messageText; + var result = ""; + var indent = 0; + while (diagnosticChain) { + if (indent) { + result += newLine; + for (var i = 0; i < indent; i++) { + result += " "; + } + } + result += diagnosticChain.messageText; + indent++; + diagnosticChain = diagnosticChain.next; + } + return result; + } + } + ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText; + function createProgram(rootNames, options, host) { + var program; + var files = []; + var filesByName = {}; + var diagnostics = ts.createDiagnosticCollection(); + var seenNoDefaultLib = options.noLib; + var commonSourceDirectory; + host = host || createCompilerHost(options); + ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); + if (!seenNoDefaultLib) { + processRootFile(host.getDefaultLibFileName(options), true); + } + verifyCompilerOptions(); + var diagnosticsProducingTypeChecker; + var noDiagnosticsTypeChecker; + program = { + getSourceFile: getSourceFile, + getSourceFiles: function () { return files; }, + getCompilerOptions: function () { return options; }, + getSyntacticDiagnostics: getSyntacticDiagnostics, + getGlobalDiagnostics: getGlobalDiagnostics, + getSemanticDiagnostics: getSemanticDiagnostics, + getDeclarationDiagnostics: getDeclarationDiagnostics, + getTypeChecker: getTypeChecker, + getDiagnosticsProducingTypeChecker: getDiagnosticsProducingTypeChecker, + getCommonSourceDirectory: function () { return commonSourceDirectory; }, + emit: emit, + getCurrentDirectory: host.getCurrentDirectory, + getNodeCount: function () { return getDiagnosticsProducingTypeChecker().getNodeCount(); }, + getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); }, + getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); }, + getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); } + }; + return program; + function getEmitHost(writeFileCallback) { + return { + getCanonicalFileName: host.getCanonicalFileName, + getCommonSourceDirectory: program.getCommonSourceDirectory, + getCompilerOptions: program.getCompilerOptions, + getCurrentDirectory: host.getCurrentDirectory, + getNewLine: host.getNewLine, + getSourceFile: program.getSourceFile, + getSourceFiles: program.getSourceFiles, + writeFile: writeFileCallback || host.writeFile + }; + } + function getDiagnosticsProducingTypeChecker() { + return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = ts.createTypeChecker(program, true)); + } + function getTypeChecker() { + return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = ts.createTypeChecker(program, false)); + } + function getDeclarationDiagnostics(targetSourceFile) { + var resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(targetSourceFile); + return ts.getDeclarationDiagnostics(getEmitHost(), resolver, targetSourceFile); + } + function emit(sourceFile, writeFileCallback) { + if (options.noEmitOnError && getPreEmitDiagnostics(this).length > 0) { + return { diagnostics: [], sourceMaps: undefined, emitSkipped: true }; + } + var start = new Date().getTime(); + var emitResult = ts.emitFiles(getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile), getEmitHost(writeFileCallback), sourceFile); + ts.emitTime += new Date().getTime() - start; + return emitResult; + } + function getSourceFile(fileName) { + fileName = host.getCanonicalFileName(fileName); + return ts.hasProperty(filesByName, fileName) ? filesByName[fileName] : undefined; + } + function getDiagnosticsHelper(sourceFile, getDiagnostics) { + if (sourceFile) { + return getDiagnostics(sourceFile); + } + var allDiagnostics = []; + ts.forEach(program.getSourceFiles(), function (sourceFile) { + ts.addRange(allDiagnostics, getDiagnostics(sourceFile)); + }); + return ts.sortAndDeduplicateDiagnostics(allDiagnostics); + } + function getSyntacticDiagnostics(sourceFile) { + return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile); + } + function getSemanticDiagnostics(sourceFile) { + return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile); + } + function getSyntacticDiagnosticsForFile(sourceFile) { + return sourceFile.parseDiagnostics; + } + function getSemanticDiagnosticsForFile(sourceFile) { + var typeChecker = getDiagnosticsProducingTypeChecker(); + ts.Debug.assert(!!sourceFile.bindDiagnostics); + var bindDiagnostics = sourceFile.bindDiagnostics; + var checkDiagnostics = typeChecker.getDiagnostics(sourceFile); + var programDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName); + return bindDiagnostics.concat(checkDiagnostics).concat(programDiagnostics); + } + function getGlobalDiagnostics() { + var typeChecker = getDiagnosticsProducingTypeChecker(); + var allDiagnostics = []; + ts.addRange(allDiagnostics, typeChecker.getGlobalDiagnostics()); + ts.addRange(allDiagnostics, diagnostics.getGlobalDiagnostics()); + return ts.sortAndDeduplicateDiagnostics(allDiagnostics); + } + function hasExtension(fileName) { + return ts.getBaseFileName(fileName).indexOf(".") >= 0; + } + function processRootFile(fileName, isDefaultLib) { + processSourceFile(ts.normalizePath(fileName), isDefaultLib); + } + function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { + if (refEnd !== undefined && refPos !== undefined) { + var start = refPos; + var length = refEnd - refPos; + } + var diagnostic; + if (hasExtension(fileName)) { + if (!options.allowNonTsExtensions && !ts.fileExtensionIs(host.getCanonicalFileName(fileName), ".ts")) { + diagnostic = ts.Diagnostics.File_0_must_have_extension_ts_or_d_ts; + } + else if (!findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { + diagnostic = ts.Diagnostics.File_0_not_found; + } + else if (refFile && host.getCanonicalFileName(fileName) === host.getCanonicalFileName(refFile.fileName)) { + diagnostic = ts.Diagnostics.A_file_cannot_have_a_reference_to_itself; + } + } + else { + if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) { + diagnostic = ts.Diagnostics.File_0_not_found; + } + else if (!findSourceFile(fileName + ".ts", isDefaultLib, refFile, refPos, refEnd) && !findSourceFile(fileName + ".d.ts", isDefaultLib, refFile, refPos, refEnd)) { + diagnostic = ts.Diagnostics.File_0_not_found; + fileName += ".ts"; + } + } + if (diagnostic) { + if (refFile) { + diagnostics.add(ts.createFileDiagnostic(refFile, start, length, diagnostic, fileName)); + } + else { + diagnostics.add(ts.createCompilerDiagnostic(diagnostic, fileName)); + } + } + } + function findSourceFile(fileName, isDefaultLib, refFile, refStart, refLength) { + var canonicalName = host.getCanonicalFileName(fileName); + if (ts.hasProperty(filesByName, canonicalName)) { + return getSourceFileFromCache(fileName, canonicalName, false); + } + else { + var normalizedAbsolutePath = ts.getNormalizedAbsolutePath(fileName, host.getCurrentDirectory()); + var canonicalAbsolutePath = host.getCanonicalFileName(normalizedAbsolutePath); + if (ts.hasProperty(filesByName, canonicalAbsolutePath)) { + return getSourceFileFromCache(normalizedAbsolutePath, canonicalAbsolutePath, true); + } + var file = filesByName[canonicalName] = host.getSourceFile(fileName, options.target, function (hostErrorMessage) { + if (refFile) { + diagnostics.add(ts.createFileDiagnostic(refFile, refStart, refLength, ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + } + else { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); + } + }); + if (file) { + seenNoDefaultLib = seenNoDefaultLib || file.hasNoDefaultLib; + filesByName[canonicalAbsolutePath] = file; + if (!options.noResolve) { + var basePath = ts.getDirectoryPath(fileName); + processReferencedFiles(file, basePath); + processImportedModules(file, basePath); + } + if (isDefaultLib) { + files.unshift(file); + } + else { + files.push(file); + } + } + } + return file; + function getSourceFileFromCache(fileName, canonicalName, useAbsolutePath) { + var file = filesByName[canonicalName]; + if (file && host.useCaseSensitiveFileNames()) { + var sourceFileName = useAbsolutePath ? ts.getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()) : file.fileName; + if (canonicalName !== sourceFileName) { + diagnostics.add(ts.createFileDiagnostic(refFile, refStart, refLength, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, sourceFileName)); + } + } + return file; + } + } + function processReferencedFiles(file, basePath) { + ts.forEach(file.referencedFiles, function (ref) { + var referencedFileName = ts.isRootedDiskPath(ref.fileName) ? ref.fileName : ts.combinePaths(basePath, ref.fileName); + processSourceFile(ts.normalizePath(referencedFileName), false, file, ref.pos, ref.end); + }); + } + function processImportedModules(file, basePath) { + ts.forEach(file.statements, function (node) { + if (ts.isExternalModuleImportDeclaration(node) && + ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { + var nameLiteral = ts.getExternalModuleImportDeclarationExpression(node); + var moduleName = nameLiteral.text; + if (moduleName) { + var searchPath = basePath; + while (true) { + var searchName = ts.normalizePath(ts.combinePaths(searchPath, moduleName)); + if (findModuleSourceFile(searchName + ".ts", nameLiteral) || findModuleSourceFile(searchName + ".d.ts", nameLiteral)) { + break; + } + var parentPath = ts.getDirectoryPath(searchPath); + if (parentPath === searchPath) { + break; + } + searchPath = parentPath; + } + } + } + else if (node.kind === 198 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { + ts.forEachChild(node.body, function (node) { + if (ts.isExternalModuleImportDeclaration(node) && + ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { + var nameLiteral = ts.getExternalModuleImportDeclarationExpression(node); + var moduleName = nameLiteral.text; + if (moduleName) { + var searchName = ts.normalizePath(ts.combinePaths(basePath, moduleName)); + var tsFile = findModuleSourceFile(searchName + ".ts", nameLiteral); + if (!tsFile) { + findModuleSourceFile(searchName + ".d.ts", nameLiteral); + } + } + } + }); + } + }); + function findModuleSourceFile(fileName, nameLiteral) { + return findSourceFile(fileName, false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos); + } + } + function verifyCompilerOptions() { + if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { + if (options.mapRoot) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option)); + } + if (options.sourceRoot) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option)); + } + return; + } + var firstExternalModule = ts.forEach(files, function (f) { return ts.isExternalModule(f) ? f : undefined; }); + if (firstExternalModule && !options.module) { + var externalModuleErrorSpan = ts.getErrorSpanForNode(firstExternalModule.externalModuleIndicator); + var errorStart = ts.skipTrivia(firstExternalModule.text, externalModuleErrorSpan.pos); + var errorLength = externalModuleErrorSpan.end - errorStart; + diagnostics.add(ts.createFileDiagnostic(firstExternalModule, errorStart, errorLength, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + } + if (options.outDir || + options.sourceRoot || + (options.mapRoot && + (!options.out || firstExternalModule !== undefined))) { + var commonPathComponents; + ts.forEach(files, function (sourceFile) { + if (!(sourceFile.flags & 1024) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { + var sourcePathComponents = ts.getNormalizedPathComponents(sourceFile.fileName, host.getCurrentDirectory()); + sourcePathComponents.pop(); + if (commonPathComponents) { + for (var i = 0; i < Math.min(commonPathComponents.length, sourcePathComponents.length); i++) { + if (commonPathComponents[i] !== sourcePathComponents[i]) { + if (i === 0) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + return; + } + commonPathComponents.length = i; + break; + } + } + if (sourcePathComponents.length < commonPathComponents.length) { + commonPathComponents.length = sourcePathComponents.length; + } + } + else { + commonPathComponents = sourcePathComponents; + } + } + }); + commonSourceDirectory = ts.getNormalizedPathFromPathComponents(commonPathComponents); + if (commonSourceDirectory) { + commonSourceDirectory += ts.directorySeparator; + } + } + if (options.noEmit) { + if (options.out || options.outDir) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmit_cannot_be_specified_with_option_out_or_outDir)); + } + if (options.declaration) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_noEmit_cannot_be_specified_with_option_declaration)); + } + } + } + } + ts.createProgram = createProgram; +})(ts || (ts = {})); +var ts; +(function (ts) { + ts.optionDeclarations = [ + { + name: "charset", + type: "string" + }, + { + name: "codepage", + type: "number" + }, + { + name: "declaration", + shortName: "d", + type: "boolean", + description: ts.Diagnostics.Generates_corresponding_d_ts_file + }, + { + name: "diagnostics", + type: "boolean" + }, + { + name: "emitBOM", + type: "boolean" + }, + { + name: "help", + shortName: "h", + type: "boolean", + description: ts.Diagnostics.Print_this_message + }, + { + name: "listFiles", + type: "boolean" + }, + { + name: "locale", + type: "string" + }, + { + name: "mapRoot", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + paramType: ts.Diagnostics.LOCATION + }, + { + name: "module", + shortName: "m", + type: { + "commonjs": 1, + "amd": 2 + }, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_or_amd, + paramType: ts.Diagnostics.KIND, + error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_or_amd + }, + { + name: "noEmit", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_outputs + }, + { + name: "noEmitOnError", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_outputs_if_any_type_checking_errors_were_reported + }, + { + name: "noImplicitAny", + type: "boolean", + description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type + }, + { + name: "noLib", + type: "boolean" + }, + { + name: "noLibCheck", + type: "boolean" + }, + { + name: "noResolve", + type: "boolean" + }, + { + name: "out", + type: "string", + description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, + paramType: ts.Diagnostics.FILE + }, + { + name: "outDir", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Redirect_output_structure_to_the_directory, + paramType: ts.Diagnostics.DIRECTORY + }, + { + name: "preserveConstEnums", + type: "boolean", + description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code + }, + { + name: "project", + shortName: "p", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Compile_the_project_in_the_given_directory, + paramType: ts.Diagnostics.DIRECTORY + }, + { + name: "removeComments", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_comments_to_output + }, + { + name: "sourceMap", + type: "boolean", + description: ts.Diagnostics.Generates_corresponding_map_file + }, + { + name: "sourceRoot", + type: "string", + isFilePath: true, + description: ts.Diagnostics.Specifies_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + paramType: ts.Diagnostics.LOCATION + }, + { + name: "suppressImplicitAnyIndexErrors", + type: "boolean", + description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures + }, + { + name: "stripInternal", + type: "boolean", + description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, + experimental: true + }, + { + name: "target", + shortName: "t", + type: { "es3": 0, "es5": 1, "es6": 2 }, + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental, + paramType: ts.Diagnostics.VERSION, + error: ts.Diagnostics.Argument_for_target_option_must_be_es3_es5_or_es6 + }, + { + name: "version", + shortName: "v", + type: "boolean", + description: ts.Diagnostics.Print_the_compiler_s_version + }, + { + name: "watch", + shortName: "w", + type: "boolean", + description: ts.Diagnostics.Watch_input_files + } + ]; + function parseCommandLine(commandLine) { + var options = {}; + var fileNames = []; + var errors = []; + var shortOptionNames = {}; + var optionNameMap = {}; + ts.forEach(ts.optionDeclarations, function (option) { + optionNameMap[option.name.toLowerCase()] = option; + if (option.shortName) { + shortOptionNames[option.shortName] = option.name; + } + }); + parseStrings(commandLine); + return { + options: options, + fileNames: fileNames, + errors: errors + }; + function parseStrings(args) { + var i = 0; + while (i < args.length) { + var s = args[i++]; + if (s.charCodeAt(0) === 64) { + parseResponseFile(s.slice(1)); + } + else if (s.charCodeAt(0) === 45) { + s = s.slice(s.charCodeAt(1) === 45 ? 2 : 1).toLowerCase(); + if (ts.hasProperty(shortOptionNames, s)) { + s = shortOptionNames[s]; + } + if (ts.hasProperty(optionNameMap, s)) { + var opt = optionNameMap[s]; + if (!args[i] && opt.type !== "boolean") { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name)); + } + switch (opt.type) { + case "number": + options[opt.name] = parseInt(args[i++]); + break; + case "boolean": + options[opt.name] = true; + break; + case "string": + options[opt.name] = args[i++] || ""; + break; + default: + var map = opt.type; + var key = (args[i++] || "").toLowerCase(); + if (ts.hasProperty(map, key)) { + options[opt.name] = map[key]; + } + else { + errors.push(ts.createCompilerDiagnostic(opt.error)); + } + } + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, s)); + } + } + else { + fileNames.push(s); + } + } + } + function parseResponseFile(fileName) { + var text = ts.sys.readFile(fileName); + if (!text) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName)); + return; + } + var args = []; + var pos = 0; + while (true) { + while (pos < text.length && text.charCodeAt(pos) <= 32) + pos++; + if (pos >= text.length) + break; + var start = pos; + if (text.charCodeAt(start) === 34) { + pos++; + while (pos < text.length && text.charCodeAt(pos) !== 34) + pos++; + if (pos < text.length) { + args.push(text.substring(start + 1, pos)); + pos++; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unterminated_quoted_string_in_response_file_0, fileName)); + } + } + else { + while (text.charCodeAt(pos) > 32) + pos++; + args.push(text.substring(start, pos)); + } + } + parseStrings(args); + } + } + ts.parseCommandLine = parseCommandLine; + function readConfigFile(fileName) { + try { + var text = ts.sys.readFile(fileName); + return /\S/.test(text) ? JSON.parse(text) : {}; + } + catch (e) { + } + } + ts.readConfigFile = readConfigFile; + function parseConfigFile(json, basePath) { + var errors = []; + return { + options: getCompilerOptions(), + fileNames: getFiles(), + errors: errors + }; + function getCompilerOptions() { + var options = {}; + var optionNameMap = {}; + ts.forEach(ts.optionDeclarations, function (option) { + optionNameMap[option.name] = option; + }); + var jsonOptions = json["compilerOptions"]; + if (jsonOptions) { + for (var id in jsonOptions) { + if (ts.hasProperty(optionNameMap, id)) { + var opt = optionNameMap[id]; + var optType = opt.type; + var value = jsonOptions[id]; + var expectedType = typeof optType === "string" ? optType : "string"; + if (typeof value === expectedType) { + if (typeof optType !== "string") { + var key = value.toLowerCase(); + if (ts.hasProperty(optType, key)) { + value = optType[key]; + } + else { + errors.push(ts.createCompilerDiagnostic(opt.error)); + value = 0; + } + } + if (opt.isFilePath) { + value = ts.normalizePath(ts.combinePaths(basePath, value)); + } + options[opt.name] = value; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, id, expectedType)); + } + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, id)); + } + } + } + return options; + } + function getFiles() { + var files = []; + if (ts.hasProperty(json, "files")) { + if (json["files"] instanceof Array) { + var files = ts.map(json["files"], function (s) { return ts.combinePaths(basePath, s); }); + } + } + else { + var sysFiles = ts.sys.readDirectory(basePath, ".ts"); + for (var i = 0; i < sysFiles.length; i++) { + var name = sysFiles[i]; + if (!ts.fileExtensionIs(name, ".d.ts") || !ts.contains(sysFiles, name.substr(0, name.length - 5) + ".ts")) { + files.push(name); + } + } + } + return files; + } + } + ts.parseConfigFile = parseConfigFile; +})(ts || (ts = {})); +var ts; +(function (ts) { + var OutliningElementsCollector; + (function (OutliningElementsCollector) { + function collectElements(sourceFile) { + var elements = []; + var collapseText = "..."; + function addOutliningSpan(hintSpanNode, startElement, endElement, autoCollapse) { + if (hintSpanNode && startElement && endElement) { + var span = { + textSpan: ts.createTextSpanFromBounds(startElement.pos, endElement.end), + hintSpan: ts.createTextSpanFromBounds(hintSpanNode.getStart(), hintSpanNode.end), + bannerText: collapseText, + autoCollapse: autoCollapse + }; + elements.push(span); + } + } + function autoCollapse(node) { + switch (node.kind) { + case 199: + case 194: + case 195: + case 197: + return false; + } + return true; + } + var depth = 0; + var maxDepth = 20; + function walk(n) { + if (depth > maxDepth) { + return; + } + switch (n.kind) { + case 172: + if (!ts.isFunctionBlock(n)) { + var parent = n.parent; + var openBrace = ts.findChildOfKind(n, 14, sourceFile); + var closeBrace = ts.findChildOfKind(n, 15, sourceFile); + if (parent.kind === 177 || + parent.kind === 180 || + parent.kind === 181 || + parent.kind === 179 || + parent.kind === 176 || + parent.kind === 178 || + parent.kind === 185 || + parent.kind === 206) { + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); + break; + } + if (parent.kind === 189) { + var tryStatement = parent; + if (tryStatement.tryBlock === n) { + addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); + break; + } + else if (tryStatement.finallyBlock === n) { + var finallyKeyword = ts.findChildOfKind(tryStatement, 80, sourceFile); + if (finallyKeyword) { + addOutliningSpan(finallyKeyword, openBrace, closeBrace, autoCollapse(n)); + break; + } + } + } + var span = ts.createTextSpanFromBounds(n.getStart(), n.end); + elements.push({ + textSpan: span, + hintSpan: span, + bannerText: collapseText, + autoCollapse: autoCollapse(n) + }); + break; + } + case 199: + var openBrace = ts.findChildOfKind(n, 14, sourceFile); + var closeBrace = ts.findChildOfKind(n, 15, sourceFile); + addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); + break; + case 194: + case 195: + case 197: + case 150: + case 186: + var openBrace = ts.findChildOfKind(n, 14, sourceFile); + var closeBrace = ts.findChildOfKind(n, 15, sourceFile); + addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); + break; + case 149: + var openBracket = ts.findChildOfKind(n, 18, sourceFile); + var closeBracket = ts.findChildOfKind(n, 19, sourceFile); + addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); + break; + } + depth++; + ts.forEachChild(n, walk); + depth--; + } + walk(sourceFile); + return elements; + } + OutliningElementsCollector.collectElements = collectElements; + })(OutliningElementsCollector = ts.OutliningElementsCollector || (ts.OutliningElementsCollector = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var NavigateTo; + (function (NavigateTo) { + var MatchKind; + (function (MatchKind) { + MatchKind[MatchKind["none"] = 0] = "none"; + MatchKind[MatchKind["exact"] = 1] = "exact"; + MatchKind[MatchKind["substring"] = 2] = "substring"; + MatchKind[MatchKind["prefix"] = 3] = "prefix"; + })(MatchKind || (MatchKind = {})); + function getNavigateToItems(program, cancellationToken, searchValue, maxResultCount) { + var terms = searchValue.split(" "); + var searchTerms = ts.map(terms, function (t) { return ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t }); }); + var rawItems = []; + ts.forEach(program.getSourceFiles(), function (sourceFile) { + cancellationToken.throwIfCancellationRequested(); + var fileName = sourceFile.fileName; + var declarations = sourceFile.getNamedDeclarations(); + for (var i = 0, n = declarations.length; i < n; i++) { + var declaration = declarations[i]; + var name = declaration.name.text; + var matchKind = getMatchKind(searchTerms, name); + if (matchKind !== 0) { + rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, declaration: declaration }); + } + } + }); + rawItems.sort(compareNavigateToItems); + if (maxResultCount !== undefined) { + rawItems = rawItems.slice(0, maxResultCount); + } + var items = ts.map(rawItems, createNavigateToItem); + return items; + var baseSensitivity = { sensitivity: "base" }; + function compareNavigateToItems(i1, i2) { + return i1.matchKind - i2.matchKind || + i1.name.localeCompare(i2.name, undefined, baseSensitivity) || + i1.name.localeCompare(i2.name); + } + function createNavigateToItem(rawItem) { + var declaration = rawItem.declaration; + var container = ts.getContainerNode(declaration); + return { + name: rawItem.name, + kind: ts.getNodeKind(declaration), + kindModifiers: ts.getNodeModifiers(declaration), + matchKind: MatchKind[rawItem.matchKind], + fileName: rawItem.fileName, + textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + containerName: container && container.name ? container.name.text : "", + containerKind: container && container.name ? ts.getNodeKind(container) : "" + }; + } + function hasAnyUpperCaseCharacter(s) { + for (var i = 0, n = s.length; i < n; i++) { + var c = s.charCodeAt(i); + if ((65 <= c && c <= 90) || + (c >= 127 && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) { + return true; + } + } + return false; + } + function getMatchKind(searchTerms, name) { + var matchKind = 0; + if (name) { + for (var j = 0, n = searchTerms.length; j < n; j++) { + var searchTerm = searchTerms[j]; + var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase(); + var index = nameToSearch.indexOf(searchTerm.term); + if (index < 0) { + return 0; + } + var termKind = 2; + if (index === 0) { + termKind = name.length === searchTerm.term.length ? 1 : 3; + } + if (matchKind === 0 || termKind < matchKind) { + matchKind = termKind; + } + } + } + return matchKind; + } + } + NavigateTo.getNavigateToItems = getNavigateToItems; + })(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var NavigationBar; + (function (NavigationBar) { + function getNavigationBarItems(sourceFile) { + var hasGlobalNode = false; + return getItemsWorker(getTopLevelNodes(sourceFile), createTopLevelItem); + function getIndent(node) { + var indent = hasGlobalNode ? 1 : 0; + var current = node.parent; + while (current) { + switch (current.kind) { + case 198: + do { + current = current.parent; + } while (current.kind === 198); + case 194: + case 197: + case 195: + case 193: + indent++; + } + current = current.parent; + } + return indent; + } + function getChildNodes(nodes) { + var childNodes = []; + function visit(node) { + switch (node.kind) { + case 173: + ts.forEach(node.declarationList.declarations, visit); + break; + case 146: + case 147: + ts.forEach(node.elements, visit); + break; + case 148: + case 191: + if (ts.isBindingPattern(node.name)) { + visit(node.name); + break; + } + case 194: + case 197: + case 195: + case 198: + case 193: + childNodes.push(node); + } + } + ts.forEach(nodes, visit); + return sortNodes(childNodes); + } + function getTopLevelNodes(node) { + var topLevelNodes = []; + topLevelNodes.push(node); + addTopLevelNodes(node.statements, topLevelNodes); + return topLevelNodes; + } + function sortNodes(nodes) { + return nodes.slice(0).sort(function (n1, n2) { + if (n1.name && n2.name) { + return ts.getPropertyNameForPropertyNameNode(n1.name).localeCompare(ts.getPropertyNameForPropertyNameNode(n2.name)); + } + else if (n1.name) { + return 1; + } + else if (n2.name) { + return -1; + } + else { + return n1.kind - n2.kind; + } + }); + } + function addTopLevelNodes(nodes, topLevelNodes) { + nodes = sortNodes(nodes); + for (var i = 0, n = nodes.length; i < n; i++) { + var node = nodes[i]; + switch (node.kind) { + case 194: + case 197: + case 195: + topLevelNodes.push(node); + break; + case 198: + var moduleDeclaration = node; + topLevelNodes.push(node); + addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); + break; + case 193: + var functionDeclaration = node; + if (isTopLevelFunctionDeclaration(functionDeclaration)) { + topLevelNodes.push(node); + addTopLevelNodes(functionDeclaration.body.statements, topLevelNodes); + } + break; + } + } + } + function isTopLevelFunctionDeclaration(functionDeclaration) { + if (functionDeclaration.kind === 193) { + if (functionDeclaration.body && functionDeclaration.body.kind === 172) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 193 && !isEmpty(s.name.text); })) { + return true; + } + if (!ts.isFunctionBlock(functionDeclaration.parent)) { + return true; + } + } + } + return false; + } + function getItemsWorker(nodes, createItem) { + var items = []; + var keyToItem = {}; + for (var i = 0, n = nodes.length; i < n; i++) { + var child = nodes[i]; + var item = createItem(child); + if (item !== undefined) { + if (item.text.length > 0) { + var key = item.text + "-" + item.kind + "-" + item.indent; + var itemWithSameName = keyToItem[key]; + if (itemWithSameName) { + merge(itemWithSameName, item); + } + else { + keyToItem[key] = item; + items.push(item); + } + } + } + } + return items; + } + function merge(target, source) { + target.spans.push.apply(target.spans, source.spans); + if (source.childItems) { + if (!target.childItems) { + target.childItems = []; + } + outer: for (var i = 0, n = source.childItems.length; i < n; i++) { + var sourceChild = source.childItems[i]; + for (var j = 0, m = target.childItems.length; j < m; j++) { + var targetChild = target.childItems[j]; + if (targetChild.text === sourceChild.text && targetChild.kind === sourceChild.kind) { + merge(targetChild, sourceChild); + continue outer; + } + } + target.childItems.push(sourceChild); + } + } + } + function createChildItem(node) { + switch (node.kind) { + case 126: + if (ts.isBindingPattern(node.name)) { + break; + } + if ((node.flags & 243) === 0) { + return undefined; + } + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 130: + case 129: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); + case 132: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); + case 133: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); + case 136: + return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); + case 209: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 134: + return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); + case 135: + return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); + case 128: + case 127: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 193: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); + case 191: + case 148: + var variableDeclarationNode; + var name; + if (node.kind === 148) { + name = node.name; + variableDeclarationNode = node; + while (variableDeclarationNode && variableDeclarationNode.kind !== 191) { + variableDeclarationNode = variableDeclarationNode.parent; + } + ts.Debug.assert(variableDeclarationNode !== undefined); + } + else { + ts.Debug.assert(!ts.isBindingPattern(node.name)); + variableDeclarationNode = node; + name = node.name; + } + if (ts.isConst(variableDeclarationNode)) { + return createItem(node, getTextOfNode(name), ts.ScriptElementKind.constElement); + } + else if (ts.isLet(variableDeclarationNode)) { + return createItem(node, getTextOfNode(name), ts.ScriptElementKind.letElement); + } + else { + return createItem(node, getTextOfNode(name), ts.ScriptElementKind.variableElement); + } + case 131: + return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); + } + return undefined; + function createItem(node, name, scriptElementKind) { + return getNavigationBarItem(name, scriptElementKind, ts.getNodeModifiers(node), [getNodeSpan(node)]); + } + } + function isEmpty(text) { + return !text || text.trim() === ""; + } + function getNavigationBarItem(text, kind, kindModifiers, spans, childItems, indent) { + if (childItems === void 0) { childItems = []; } + if (indent === void 0) { indent = 0; } + if (isEmpty(text)) { + return undefined; + } + return { + text: text, + kind: kind, + kindModifiers: kindModifiers, + spans: spans, + childItems: childItems, + indent: indent, + bolded: false, + grayed: false + }; + } + function createTopLevelItem(node) { + switch (node.kind) { + case 210: + return createSourceFileItem(node); + case 194: + return createClassItem(node); + case 197: + return createEnumItem(node); + case 195: + return createIterfaceItem(node); + case 198: + return createModuleItem(node); + case 193: + return createFunctionItem(node); + } + return undefined; + function getModuleName(moduleDeclaration) { + if (moduleDeclaration.name.kind === 8) { + return getTextOfNode(moduleDeclaration.name); + } + var result = []; + result.push(moduleDeclaration.name.text); + while (moduleDeclaration.body && moduleDeclaration.body.kind === 198) { + moduleDeclaration = moduleDeclaration.body; + result.push(moduleDeclaration.name.text); + } + return result.join("."); + } + function createModuleItem(node) { + var moduleName = getModuleName(node); + var childItems = getItemsWorker(getChildNodes(getInnermostModule(node).body.statements), createChildItem); + return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + function createFunctionItem(node) { + if (node.name && node.body && node.body.kind === 172) { + var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + return undefined; + } + function createSourceFileItem(node) { + var childItems = getItemsWorker(getChildNodes(node.statements), createChildItem); + if (childItems === undefined || childItems.length === 0) { + return undefined; + } + hasGlobalNode = true; + var rootName = ts.isExternalModule(node) ? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(node.fileName)))) + "\"" : ""; + return getNavigationBarItem(rootName, ts.ScriptElementKind.moduleElement, ts.ScriptElementKindModifier.none, [getNodeSpan(node)], childItems); + } + function createClassItem(node) { + var childItems; + if (node.members) { + var constructor = ts.forEach(node.members, function (member) { + return member.kind === 131 && member; + }); + var nodes = removeDynamicallyNamedProperties(node); + if (constructor) { + nodes.push.apply(nodes, constructor.parameters); + } + var childItems = getItemsWorker(sortNodes(nodes), createChildItem); + } + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.classElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + function createEnumItem(node) { + var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + function createIterfaceItem(node) { + var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); + return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); + } + } + function removeComputedProperties(node) { + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 124; }); + } + function removeDynamicallyNamedProperties(node) { + return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); + } + function getInnermostModule(node) { + while (node.body.kind === 198) { + node = node.body; + } + return node; + } + function getNodeSpan(node) { + return node.kind === 210 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); + } + function getTextOfNode(node) { + return ts.getTextOfNodeFromSourceText(sourceFile.text, node); + } + } + NavigationBar.getNavigationBarItems = getNavigationBarItems; + })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + (function (PatternMatchKind) { + PatternMatchKind[PatternMatchKind["Exact"] = 0] = "Exact"; + PatternMatchKind[PatternMatchKind["Prefix"] = 1] = "Prefix"; + PatternMatchKind[PatternMatchKind["Substring"] = 2] = "Substring"; + PatternMatchKind[PatternMatchKind["CamelCase"] = 3] = "CamelCase"; + })(ts.PatternMatchKind || (ts.PatternMatchKind = {})); + var PatternMatchKind = ts.PatternMatchKind; + function createPatternMatch(kind, punctuationStripped, isCaseSensitive, camelCaseWeight) { + return { + kind: kind, + punctuationStripped: punctuationStripped, + isCaseSensitive: isCaseSensitive, + camelCaseWeight: camelCaseWeight + }; + } + function createPatternMatcher(pattern) { + var stringToWordSpans = {}; + pattern = pattern.trim(); + var fullPatternSegment = createSegment(pattern); + var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); }); + var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid); + return { + getMatches: getMatches, + getMatchesForLastSegmentOfPattern: getMatchesForLastSegmentOfPattern, + patternContainsDots: dotSeparatedSegments.length > 1 + }; + function skipMatch(candidate) { + return invalidPattern || !candidate; + } + function getMatchesForLastSegmentOfPattern(candidate) { + if (skipMatch(candidate)) { + return undefined; + } + return matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments)); + } + function getMatches(candidate, dottedContainer) { + if (skipMatch(candidate)) { + return undefined; + } + var candidateMatch = matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments)); + if (!candidateMatch) { + return undefined; + } + dottedContainer = dottedContainer || ""; + var containerParts = dottedContainer.split("."); + if (dotSeparatedSegments.length - 1 > containerParts.length) { + return null; + } + var totalMatch = candidateMatch; + for (var i = dotSeparatedSegments.length - 2, j = containerParts.length - 1; i >= 0; i--, j--) { + var segment = dotSeparatedSegments[i]; + var containerName = containerParts[j]; + var containerMatch = matchSegment(containerName, segment); + if (!containerMatch) { + return undefined; + } + ts.addRange(totalMatch, containerMatch); + } + return totalMatch; + } + function getWordSpans(word) { + if (!ts.hasProperty(stringToWordSpans, word)) { + stringToWordSpans[word] = breakIntoWordSpans(word); + } + return stringToWordSpans[word]; + } + function matchTextChunk(candidate, chunk, punctuationStripped) { + var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); + if (index === 0) { + if (chunk.text.length === candidate.length) { + return createPatternMatch(0, punctuationStripped, candidate === chunk.text); + } + else { + return createPatternMatch(1, punctuationStripped, startsWith(candidate, chunk.text)); + } + } + var isLowercase = chunk.isLowerCase; + if (isLowercase) { + if (index > 0) { + var wordSpans = getWordSpans(candidate); + for (var i = 0, n = wordSpans.length; i < n; i++) { + var span = wordSpans[i]; + if (partStartsWith(candidate, span, chunk.text, true)) { + return createPatternMatch(2, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); + } + } + } + } + else { + if (candidate.indexOf(chunk.text) > 0) { + return createPatternMatch(2, punctuationStripped, true); + } + } + if (!isLowercase) { + if (chunk.characterSpans.length > 0) { + var candidateParts = getWordSpans(candidate); + var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, false); + if (camelCaseWeight !== undefined) { + return createPatternMatch(3, punctuationStripped, true, camelCaseWeight); + } + camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, true); + if (camelCaseWeight !== undefined) { + return createPatternMatch(3, punctuationStripped, false, camelCaseWeight); + } + } + } + if (isLowercase) { + if (chunk.text.length < candidate.length) { + if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) { + return createPatternMatch(2, punctuationStripped, false); + } + } + } + return undefined; + } + function containsSpaceOrAsterisk(text) { + for (var i = 0; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (ch === 32 || ch === 42) { + return true; + } + } + return false; + } + function matchSegment(candidate, segment) { + if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { + var match = matchTextChunk(candidate, segment.totalTextChunk, false); + if (match) { + return [match]; + } + } + var subWordTextChunks = segment.subWordTextChunks; + var matches = undefined; + for (var i = 0, n = subWordTextChunks.length; i < n; i++) { + var subWordTextChunk = subWordTextChunks[i]; + var result = matchTextChunk(candidate, subWordTextChunk, true); + if (!result) { + return undefined; + } + matches = matches || []; + matches.push(result); + } + return matches; + } + function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { + var patternPartStart = patternSpan ? patternSpan.start : 0; + var patternPartLength = patternSpan ? patternSpan.length : pattern.length; + if (patternPartLength > candidateSpan.length) { + return false; + } + if (ignoreCase) { + for (var i = 0; i < patternPartLength; i++) { + var ch1 = pattern.charCodeAt(patternPartStart + i); + var ch2 = candidate.charCodeAt(candidateSpan.start + i); + if (toLowerCase(ch1) !== toLowerCase(ch2)) { + return false; + } + } + } + else { + for (var i = 0; i < patternPartLength; i++) { + var ch1 = pattern.charCodeAt(patternPartStart + i); + var ch2 = candidate.charCodeAt(candidateSpan.start + i); + if (ch1 !== ch2) { + return false; + } + } + } + return true; + } + function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) { + var chunkCharacterSpans = chunk.characterSpans; + var currentCandidate = 0; + var currentChunkSpan = 0; + var firstMatch = undefined; + var contiguous = undefined; + while (true) { + if (currentChunkSpan === chunkCharacterSpans.length) { + var weight = 0; + if (contiguous) { + weight += 1; + } + if (firstMatch === 0) { + weight += 2; + } + return weight; + } + else if (currentCandidate === candidateParts.length) { + return undefined; + } + var candidatePart = candidateParts[currentCandidate]; + var gotOneMatchThisCandidate = false; + for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { + var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; + if (gotOneMatchThisCandidate) { + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || + !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + break; + } + } + if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) { + break; + } + gotOneMatchThisCandidate = true; + firstMatch = firstMatch === undefined ? currentCandidate : firstMatch; + contiguous = contiguous === undefined ? true : contiguous; + candidatePart = ts.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length); + } + if (!gotOneMatchThisCandidate && contiguous !== undefined) { + contiguous = false; + } + currentCandidate++; + } + } + } + ts.createPatternMatcher = createPatternMatcher; + function patternMatchCompareTo(match1, match2) { + return compareType(match1, match2) || + compareCamelCase(match1, match2) || + compareCase(match1, match2) || + comparePunctuation(match1, match2); + } + function comparePunctuation(result1, result2) { + if (result1.punctuationStripped !== result2.punctuationStripped) { + return result1.punctuationStripped ? 1 : -1; + } + return 0; + } + function compareCase(result1, result2) { + if (result1.isCaseSensitive !== result2.isCaseSensitive) { + return result1.isCaseSensitive ? -1 : 1; + } + return 0; + } + function compareType(result1, result2) { + return result1.kind - result2.kind; + } + function compareCamelCase(result1, result2) { + if (result1.kind === 3 && result2.kind === 3) { + return result2.camelCaseWeight - result1.camelCaseWeight; + } + return 0; + } + function createSegment(text) { + return { + totalTextChunk: createTextChunk(text), + subWordTextChunks: breakPatternIntoTextChunks(text) + }; + } + function segmentIsInvalid(segment) { + return segment.subWordTextChunks.length === 0; + } + function isUpperCaseLetter(ch) { + if (ch >= 65 && ch <= 90) { + return true; + } + if (ch < 127 || !ts.isUnicodeIdentifierStart(ch, 2)) { + return false; + } + var str = String.fromCharCode(ch); + return str === str.toUpperCase(); + } + function isLowerCaseLetter(ch) { + if (ch >= 97 && ch <= 122) { + return true; + } + if (ch < 127 || !ts.isUnicodeIdentifierStart(ch, 2)) { + return false; + } + var str = String.fromCharCode(ch); + return str === str.toLowerCase(); + } + function containsUpperCaseLetter(string) { + for (var i = 0, n = string.length; i < n; i++) { + if (isUpperCaseLetter(string.charCodeAt(i))) { + return true; + } + } + return false; + } + function startsWith(string, search) { + for (var i = 0, n = search.length; i < n; i++) { + if (string.charCodeAt(i) !== search.charCodeAt(i)) { + return false; + } + } + return true; + } + function indexOfIgnoringCase(string, value) { + for (var i = 0, n = string.length - value.length; i <= n; i++) { + if (startsWithIgnoringCase(string, value, i)) { + return i; + } + } + return -1; + } + function startsWithIgnoringCase(string, value, start) { + for (var i = 0, n = value.length; i < n; i++) { + var ch1 = toLowerCase(string.charCodeAt(i + start)); + var ch2 = value.charCodeAt(i); + if (ch1 !== ch2) { + return false; + } + } + return true; + } + function toLowerCase(ch) { + if (ch >= 65 && ch <= 90) { + return 97 + (ch - 65); + } + if (ch < 127) { + return ch; + } + return String.fromCharCode(ch).toLowerCase().charCodeAt(0); + } + function isDigit(ch) { + return ch >= 48 && ch <= 57; + } + function isWordChar(ch) { + return isUpperCaseLetter(ch) || isLowerCaseLetter(ch) || isDigit(ch) || ch === 95 || ch === 36; + } + function breakPatternIntoTextChunks(pattern) { + var result = []; + var wordStart = 0; + var wordLength = 0; + for (var i = 0; i < pattern.length; i++) { + var ch = pattern.charCodeAt(i); + if (isWordChar(ch)) { + if (wordLength++ === 0) { + wordStart = i; + } + } + else { + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + wordLength = 0; + } + } + } + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + } + return result; + } + function createTextChunk(text) { + var textLowerCase = text.toLowerCase(); + return { + text: text, + textLowerCase: textLowerCase, + isLowerCase: text === textLowerCase, + characterSpans: breakIntoCharacterSpans(text) + }; + } + function breakIntoCharacterSpans(identifier) { + return breakIntoSpans(identifier, false); + } + ts.breakIntoCharacterSpans = breakIntoCharacterSpans; + function breakIntoWordSpans(identifier) { + return breakIntoSpans(identifier, true); + } + ts.breakIntoWordSpans = breakIntoWordSpans; + function breakIntoSpans(identifier, word) { + var result = []; + var wordStart = 0; + for (var i = 1, n = identifier.length; i < n; i++) { + var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); + var currentIsDigit = isDigit(identifier.charCodeAt(i)); + var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); + var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); + if (charIsPunctuation(identifier.charCodeAt(i - 1)) || + charIsPunctuation(identifier.charCodeAt(i)) || + lastIsDigit != currentIsDigit || + hasTransitionFromLowerToUpper || + hasTransitionFromUpperToLower) { + if (!isAllPunctuation(identifier, wordStart, i)) { + result.push(ts.createTextSpan(wordStart, i - wordStart)); + } + wordStart = i; + } + } + if (!isAllPunctuation(identifier, wordStart, identifier.length)) { + result.push(ts.createTextSpan(wordStart, identifier.length - wordStart)); + } + return result; + } + function charIsPunctuation(ch) { + switch (ch) { + case 33: + case 34: + case 35: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 44: + case 45: + case 46: + case 47: + case 58: + case 59: + case 63: + case 64: + case 91: + case 92: + case 93: + case 95: + case 123: + case 125: + return true; + } + return false; + } + function isAllPunctuation(identifier, start, end) { + for (var i = start; i < end; i++) { + var ch = identifier.charCodeAt(i); + if (!charIsPunctuation(ch) || ch === 95 || ch === 36) { + return false; + } + } + return true; + } + function transitionFromUpperToLower(identifier, word, index, wordStart) { + if (word) { + if (index != wordStart && + index + 1 < identifier.length) { + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); + if (currentIsUpper && nextIsLower) { + for (var i = wordStart; i < index; i++) { + if (!isUpperCaseLetter(identifier.charCodeAt(i))) { + return false; + } + } + return true; + } + } + } + return false; + } + function transitionFromLowerToUpper(identifier, word, index) { + var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + var transition = word ? (currentIsUpper && !lastIsUpper) : currentIsUpper; + return transition; + } +})(ts || (ts = {})); +var ts; +(function (ts) { + var SignatureHelp; + (function (SignatureHelp) { + var emptyArray = []; + var ArgumentListKind; + (function (ArgumentListKind) { + ArgumentListKind[ArgumentListKind["TypeArguments"] = 0] = "TypeArguments"; + ArgumentListKind[ArgumentListKind["CallArguments"] = 1] = "CallArguments"; + ArgumentListKind[ArgumentListKind["TaggedTemplateArguments"] = 2] = "TaggedTemplateArguments"; + })(ArgumentListKind || (ArgumentListKind = {})); + function getSignatureHelpItems(sourceFile, position, typeInfoResolver, cancellationToken) { + var startingToken = ts.findTokenOnLeftOfPosition(sourceFile, position); + if (!startingToken) { + return undefined; + } + var argumentInfo = getContainingArgumentInfo(startingToken); + cancellationToken.throwIfCancellationRequested(); + if (!argumentInfo) { + return undefined; + } + var call = argumentInfo.invocation; + var candidates = []; + var resolvedSignature = typeInfoResolver.getResolvedSignature(call, candidates); + cancellationToken.throwIfCancellationRequested(); + if (!candidates.length) { + return undefined; + } + return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); + function getImmediatelyContainingArgumentInfo(node) { + if (node.parent.kind === 153 || node.parent.kind === 154) { + var callExpression = node.parent; + if (node.kind === 24 || + node.kind === 16) { + var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); + var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; + ts.Debug.assert(list !== undefined); + return { + kind: isTypeArgList ? 0 : 1, + invocation: callExpression, + argumentsSpan: getApplicableSpanForArguments(list), + argumentIndex: 0, + argumentCount: getCommaBasedArgCount(list) + }; + } + var listItemInfo = ts.findListItemInfo(node); + if (listItemInfo) { + var list = listItemInfo.list; + var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; + var argumentIndex = (listItemInfo.listItemIndex + 1) >> 1; + return { + kind: isTypeArgList ? 0 : 1, + invocation: callExpression, + argumentsSpan: getApplicableSpanForArguments(list), + argumentIndex: argumentIndex, + argumentCount: getCommaBasedArgCount(list) + }; + } + } + else if (node.kind === 10 && node.parent.kind === 155) { + if (ts.isInsideTemplateLiteral(node, position)) { + return getArgumentListInfoForTemplate(node.parent, 0); + } + } + else if (node.kind === 11 && node.parent.parent.kind === 155) { + var templateExpression = node.parent; + var tagExpression = templateExpression.parent; + ts.Debug.assert(templateExpression.kind === 167); + var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; + return getArgumentListInfoForTemplate(tagExpression, argumentIndex); + } + else if (node.parent.kind === 171 && node.parent.parent.parent.kind === 155) { + var templateSpan = node.parent; + var templateExpression = templateSpan.parent; + var tagExpression = templateExpression.parent; + ts.Debug.assert(templateExpression.kind === 167); + if (node.kind === 13 && !ts.isInsideTemplateLiteral(node, position)) { + return undefined; + } + var spanIndex = templateExpression.templateSpans.indexOf(templateSpan); + var argumentIndex = getArgumentIndexForTemplatePiece(spanIndex, node); + return getArgumentListInfoForTemplate(tagExpression, argumentIndex); + } + return undefined; + } + function getCommaBasedArgCount(argumentsList) { + return argumentsList.getChildCount() === 0 ? 0 : 1 + ts.countWhere(argumentsList.getChildren(), function (arg) { return arg.kind === 23; }); + } + function getArgumentIndexForTemplatePiece(spanIndex, node) { + ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node."); + if (ts.isTemplateLiteralKind(node.kind)) { + if (ts.isInsideTemplateLiteral(node, position)) { + return 0; + } + return spanIndex + 2; + } + return spanIndex + 1; + } + function getArgumentListInfoForTemplate(tagExpression, argumentIndex) { + var argumentCount = tagExpression.template.kind === 10 ? 1 : tagExpression.template.templateSpans.length + 1; + return { + kind: 2, + invocation: tagExpression, + argumentsSpan: getApplicableSpanForTaggedTemplate(tagExpression), + argumentIndex: argumentIndex, + argumentCount: argumentCount + }; + } + function getApplicableSpanForArguments(argumentsList) { + var applicableSpanStart = argumentsList.getFullStart(); + var applicableSpanEnd = ts.skipTrivia(sourceFile.text, argumentsList.getEnd(), false); + return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); + } + function getApplicableSpanForTaggedTemplate(taggedTemplate) { + var template = taggedTemplate.template; + var applicableSpanStart = template.getStart(); + var applicableSpanEnd = template.getEnd(); + if (template.kind === 167) { + var lastSpan = ts.lastOrUndefined(template.templateSpans); + if (lastSpan.literal.getFullWidth() === 0) { + applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); + } + } + return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); + } + function getContainingArgumentInfo(node) { + for (var n = node; n.kind !== 210; n = n.parent) { + if (ts.isFunctionBlock(n)) { + return undefined; + } + if (n.pos < n.parent.pos || n.end > n.parent.end) { + ts.Debug.fail("Node of kind " + n.kind + " is not a subspan of its parent of kind " + n.parent.kind); + } + var argumentInfo = getImmediatelyContainingArgumentInfo(n); + if (argumentInfo) { + return argumentInfo; + } + } + return undefined; + } + function getChildListThatStartsWithOpenerToken(parent, openerToken, sourceFile) { + var children = parent.getChildren(sourceFile); + var indexOfOpenerToken = children.indexOf(openerToken); + ts.Debug.assert(indexOfOpenerToken >= 0 && children.length > indexOfOpenerToken + 1); + return children[indexOfOpenerToken + 1]; + } + function selectBestInvalidOverloadIndex(candidates, argumentCount) { + var maxParamsSignatureIndex = -1; + var maxParams = -1; + for (var i = 0; i < candidates.length; i++) { + var candidate = candidates[i]; + if (candidate.hasRestParameter || candidate.parameters.length >= argumentCount) { + return i; + } + if (candidate.parameters.length > maxParams) { + maxParams = candidate.parameters.length; + maxParamsSignatureIndex = i; + } + } + return maxParamsSignatureIndex; + } + function createSignatureHelpItems(candidates, bestSignature, argumentListInfo) { + var applicableSpan = argumentListInfo.argumentsSpan; + var isTypeParameterList = argumentListInfo.kind === 0; + var invocation = argumentListInfo.invocation; + var callTarget = ts.getInvokedExpression(invocation); + var callTargetSymbol = typeInfoResolver.getSymbolAtLocation(callTarget); + var callTargetDisplayParts = callTargetSymbol && ts.symbolToDisplayParts(typeInfoResolver, callTargetSymbol, undefined, undefined); + var items = ts.map(candidates, function (candidateSignature) { + var signatureHelpParameters; + var prefixDisplayParts = []; + var suffixDisplayParts = []; + if (callTargetDisplayParts) { + prefixDisplayParts.push.apply(prefixDisplayParts, callTargetDisplayParts); + } + if (isTypeParameterList) { + prefixDisplayParts.push(ts.punctuationPart(24)); + var typeParameters = candidateSignature.typeParameters; + signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; + suffixDisplayParts.push(ts.punctuationPart(25)); + var parameterParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation); + }); + suffixDisplayParts.push.apply(suffixDisplayParts, parameterParts); + } + else { + var typeParameterParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation); + }); + prefixDisplayParts.push.apply(prefixDisplayParts, typeParameterParts); + prefixDisplayParts.push(ts.punctuationPart(16)); + var parameters = candidateSignature.parameters; + signatureHelpParameters = parameters.length > 0 ? ts.map(parameters, createSignatureHelpParameterForParameter) : emptyArray; + suffixDisplayParts.push(ts.punctuationPart(17)); + } + var returnTypeParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation); + }); + suffixDisplayParts.push.apply(suffixDisplayParts, returnTypeParts); + return { + isVariadic: candidateSignature.hasRestParameter, + prefixDisplayParts: prefixDisplayParts, + suffixDisplayParts: suffixDisplayParts, + separatorDisplayParts: [ts.punctuationPart(23), ts.spacePart()], + parameters: signatureHelpParameters, + documentation: candidateSignature.getDocumentationComment() + }; + }); + var argumentIndex = argumentListInfo.argumentIndex; + var argumentCount = argumentListInfo.argumentCount; + var selectedItemIndex = candidates.indexOf(bestSignature); + if (selectedItemIndex < 0) { + selectedItemIndex = selectBestInvalidOverloadIndex(candidates, argumentCount); + } + return { + items: items, + applicableSpan: applicableSpan, + selectedItemIndex: selectedItemIndex, + argumentIndex: argumentIndex, + argumentCount: argumentCount + }; + function createSignatureHelpParameterForParameter(parameter) { + var displayParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation); + }); + var isOptional = ts.hasQuestionToken(parameter.valueDeclaration); + return { + name: parameter.name, + documentation: parameter.getDocumentationComment(), + displayParts: displayParts, + isOptional: isOptional + }; + } + function createSignatureHelpParameterForTypeParameter(typeParameter) { + var displayParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildTypeParameterDisplay(typeParameter, writer, invocation); + }); + return { + name: typeParameter.symbol.name, + documentation: emptyArray, + displayParts: displayParts, + isOptional: false + }; + } + } + } + SignatureHelp.getSignatureHelpItems = getSignatureHelpItems; + })(SignatureHelp = ts.SignatureHelp || (ts.SignatureHelp = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + function getEndLinePosition(line, sourceFile) { + ts.Debug.assert(line >= 0); + var lineStarts = sourceFile.getLineStarts(); + var lineIndex = line; + if (lineIndex + 1 === lineStarts.length) { + return sourceFile.text.length - 1; + } + else { + var start = lineStarts[lineIndex]; + var pos = lineStarts[lineIndex + 1] - 1; + ts.Debug.assert(ts.isLineBreak(sourceFile.text.charCodeAt(pos))); + while (start <= pos && ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + pos--; + } + return pos; + } + } + ts.getEndLinePosition = getEndLinePosition; + function getLineStartPositionForPosition(position, sourceFile) { + var lineStarts = sourceFile.getLineStarts(); + var line = sourceFile.getLineAndCharacterOfPosition(position).line; + return lineStarts[line]; + } + ts.getLineStartPositionForPosition = getLineStartPositionForPosition; + function rangeContainsRange(r1, r2) { + return startEndContainsRange(r1.pos, r1.end, r2); + } + ts.rangeContainsRange = rangeContainsRange; + function startEndContainsRange(start, end, range) { + return start <= range.pos && end >= range.end; + } + ts.startEndContainsRange = startEndContainsRange; + function rangeContainsStartEnd(range, start, end) { + return range.pos <= start && range.end >= end; + } + ts.rangeContainsStartEnd = rangeContainsStartEnd; + function rangeOverlapsWithStartEnd(r1, start, end) { + return startEndOverlapsWithStartEnd(r1.pos, r1.end, start, end); + } + ts.rangeOverlapsWithStartEnd = rangeOverlapsWithStartEnd; + function startEndOverlapsWithStartEnd(start1, end1, start2, end2) { + var start = Math.max(start1, start2); + var end = Math.min(end1, end2); + return start < end; + } + ts.startEndOverlapsWithStartEnd = startEndOverlapsWithStartEnd; + function findListItemInfo(node) { + var list = findContainingList(node); + if (!list) { + return undefined; + } + var children = list.getChildren(); + var listItemIndex = ts.indexOf(children, node); + return { + listItemIndex: listItemIndex, + list: list + }; + } + ts.findListItemInfo = findListItemInfo; + function findChildOfKind(n, kind, sourceFile) { + return ts.forEach(n.getChildren(sourceFile), function (c) { return c.kind === kind && c; }); + } + ts.findChildOfKind = findChildOfKind; + function findContainingList(node) { + var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { + if (c.kind === 211 && c.pos <= node.pos && c.end >= node.end) { + return c; + } + }); + return syntaxList; + } + ts.findContainingList = findContainingList; + function getTouchingWord(sourceFile, position) { + return getTouchingToken(sourceFile, position, function (n) { return isWord(n.kind); }); + } + ts.getTouchingWord = getTouchingWord; + function getTouchingPropertyName(sourceFile, position) { + return getTouchingToken(sourceFile, position, function (n) { return isPropertyName(n.kind); }); + } + ts.getTouchingPropertyName = getTouchingPropertyName; + function getTouchingToken(sourceFile, position, includeItemAtEndPosition) { + return getTokenAtPositionWorker(sourceFile, position, false, includeItemAtEndPosition); + } + ts.getTouchingToken = getTouchingToken; + function getTokenAtPosition(sourceFile, position) { + return getTokenAtPositionWorker(sourceFile, position, true, undefined); + } + ts.getTokenAtPosition = getTokenAtPosition; + function getTokenAtPositionWorker(sourceFile, position, allowPositionInLeadingTrivia, includeItemAtEndPosition) { + var current = sourceFile; + outer: while (true) { + if (isToken(current)) { + return current; + } + for (var i = 0, n = current.getChildCount(sourceFile); i < n; i++) { + var child = current.getChildAt(i); + var start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile); + if (start <= position) { + var end = child.getEnd(); + if (position < end || (position === end && child.kind === 1)) { + current = child; + continue outer; + } + else if (includeItemAtEndPosition && end === position) { + var previousToken = findPrecedingToken(position, sourceFile, child); + if (previousToken && includeItemAtEndPosition(previousToken)) { + return previousToken; + } + } + } + } + return current; + } + } + function findTokenOnLeftOfPosition(file, position) { + var tokenAtPosition = getTokenAtPosition(file, position); + if (isToken(tokenAtPosition) && position > tokenAtPosition.getStart(file) && position < tokenAtPosition.getEnd()) { + return tokenAtPosition; + } + return findPrecedingToken(position, file); + } + ts.findTokenOnLeftOfPosition = findTokenOnLeftOfPosition; + function findNextToken(previousToken, parent) { + return find(parent); + function find(n) { + if (isToken(n) && n.pos === previousToken.end) { + return n; + } + var children = n.getChildren(); + for (var i = 0, len = children.length; i < len; ++i) { + var child = children[i]; + var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || + (child.pos === previousToken.end); + if (shouldDiveInChildNode && nodeHasTokens(child)) { + return find(child); + } + } + return undefined; + } + } + ts.findNextToken = findNextToken; + function findPrecedingToken(position, sourceFile, startNode) { + return find(startNode || sourceFile); + function findRightmostToken(n) { + if (isToken(n)) { + return n; + } + var children = n.getChildren(); + var candidate = findRightmostChildNodeWithTokens(children, children.length); + return candidate && findRightmostToken(candidate); + } + function find(n) { + if (isToken(n)) { + return n; + } + var children = n.getChildren(); + for (var i = 0, len = children.length; i < len; ++i) { + var child = children[i]; + if (nodeHasTokens(child)) { + if (position <= child.end) { + if (child.getStart(sourceFile) >= position) { + var candidate = findRightmostChildNodeWithTokens(children, i); + return candidate && findRightmostToken(candidate); + } + else { + return find(child); + } + } + } + } + ts.Debug.assert(startNode !== undefined || n.kind === 210); + if (children.length) { + var candidate = findRightmostChildNodeWithTokens(children, children.length); + return candidate && findRightmostToken(candidate); + } + } + function findRightmostChildNodeWithTokens(children, exclusiveStartPosition) { + for (var i = exclusiveStartPosition - 1; i >= 0; --i) { + if (nodeHasTokens(children[i])) { + return children[i]; + } + } + } + } + ts.findPrecedingToken = findPrecedingToken; + function nodeHasTokens(n) { + return n.getWidth() !== 0; + } + function getNodeModifiers(node) { + var flags = ts.getCombinedNodeFlags(node); + var result = []; + if (flags & 32) + result.push(ts.ScriptElementKindModifier.privateMemberModifier); + if (flags & 64) + result.push(ts.ScriptElementKindModifier.protectedMemberModifier); + if (flags & 16) + result.push(ts.ScriptElementKindModifier.publicMemberModifier); + if (flags & 128) + result.push(ts.ScriptElementKindModifier.staticModifier); + if (flags & 1) + result.push(ts.ScriptElementKindModifier.exportedModifier); + if (ts.isInAmbientContext(node)) + result.push(ts.ScriptElementKindModifier.ambientModifier); + return result.length > 0 ? result.join(',') : ts.ScriptElementKindModifier.none; + } + ts.getNodeModifiers = getNodeModifiers; + function getTypeArgumentOrTypeParameterList(node) { + if (node.kind === 137 || node.kind === 153) { + return node.typeArguments; + } + if (ts.isAnyFunction(node) || node.kind === 194 || node.kind === 195) { + return node.typeParameters; + } + return undefined; + } + ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; + function isToken(n) { + return n.kind >= 0 && n.kind <= 122; + } + ts.isToken = isToken; + function isWord(kind) { + return kind === 64 || ts.isKeyword(kind); + } + function isPropertyName(kind) { + return kind === 8 || kind === 7 || isWord(kind); + } + function isComment(kind) { + return kind === 2 || kind === 3; + } + ts.isComment = isComment; + function isPunctuation(kind) { + return 14 <= kind && kind <= 63; + } + ts.isPunctuation = isPunctuation; + function isInsideTemplateLiteral(node, position) { + return ts.isTemplateLiteralKind(node.kind) && (node.getStart() < position && position < node.getEnd()) || (!!node.isUnterminated && position === node.getEnd()); + } + ts.isInsideTemplateLiteral = isInsideTemplateLiteral; + function compareDataObjects(dst, src) { + for (var e in dst) { + if (typeof dst[e] === "object") { + if (!compareDataObjects(dst[e], src[e])) { + return false; + } + } + else if (typeof dst[e] !== "function") { + if (dst[e] !== src[e]) { + return false; + } + } + } + return true; + } + ts.compareDataObjects = compareDataObjects; +})(ts || (ts = {})); +var ts; +(function (ts) { + function isFirstDeclarationOfSymbolParameter(symbol) { + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 126; + } + ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; + var displayPartWriter = getDisplayPartWriter(); + function getDisplayPartWriter() { + var displayParts; + var lineStart; + var indent; + resetWriter(); + return { + displayParts: function () { return displayParts; }, + writeKeyword: function (text) { return writeKind(text, 5); }, + writeOperator: function (text) { return writeKind(text, 12); }, + writePunctuation: function (text) { return writeKind(text, 15); }, + writeSpace: function (text) { return writeKind(text, 16); }, + writeStringLiteral: function (text) { return writeKind(text, 8); }, + writeParameter: function (text) { return writeKind(text, 13); }, + writeSymbol: writeSymbol, + writeLine: writeLine, + increaseIndent: function () { indent++; }, + decreaseIndent: function () { indent--; }, + clear: resetWriter, + trackSymbol: function () { } + }; + function writeIndent() { + if (lineStart) { + var indentString = ts.getIndentString(indent); + if (indentString) { + displayParts.push(displayPart(indentString, 16)); + } + lineStart = false; + } + } + function writeKind(text, kind) { + writeIndent(); + displayParts.push(displayPart(text, kind)); + } + function writeSymbol(text, symbol) { + writeIndent(); + displayParts.push(symbolPart(text, symbol)); + } + function writeLine() { + displayParts.push(lineBreakPart()); + lineStart = true; + } + function resetWriter() { + displayParts = []; + lineStart = true; + indent = 0; + } + } + function symbolPart(text, symbol) { + return displayPart(text, displayPartKind(symbol), symbol); + function displayPartKind(symbol) { + var flags = symbol.flags; + if (flags & 3) { + return isFirstDeclarationOfSymbolParameter(symbol) ? 13 : 9; + } + else if (flags & 4) { + return 14; + } + else if (flags & 32768) { + return 14; + } + else if (flags & 65536) { + return 14; + } + else if (flags & 8) { + return 19; + } + else if (flags & 16) { + return 20; + } + else if (flags & 32) { + return 1; + } + else if (flags & 64) { + return 4; + } + else if (flags & 384) { + return 2; + } + else if (flags & 1536) { + return 11; + } + else if (flags & 8192) { + return 10; + } + else if (flags & 262144) { + return 18; + } + else if (flags & 524288) { + return 0; + } + else if (flags & 8388608) { + return 0; + } + return 17; + } + } + ts.symbolPart = symbolPart; + function displayPart(text, kind, symbol) { + return { + text: text, + kind: ts.SymbolDisplayPartKind[kind] + }; + } + ts.displayPart = displayPart; + function spacePart() { + return displayPart(" ", 16); + } + ts.spacePart = spacePart; + function keywordPart(kind) { + return displayPart(ts.tokenToString(kind), 5); + } + ts.keywordPart = keywordPart; + function punctuationPart(kind) { + return displayPart(ts.tokenToString(kind), 15); + } + ts.punctuationPart = punctuationPart; + function operatorPart(kind) { + return displayPart(ts.tokenToString(kind), 12); + } + ts.operatorPart = operatorPart; + function textPart(text) { + return displayPart(text, 17); + } + ts.textPart = textPart; + function lineBreakPart() { + return displayPart("\n", 6); + } + ts.lineBreakPart = lineBreakPart; + function mapToDisplayParts(writeDisplayParts) { + writeDisplayParts(displayPartWriter); + var result = displayPartWriter.displayParts(); + displayPartWriter.clear(); + return result; + } + ts.mapToDisplayParts = mapToDisplayParts; + function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags) { + return mapToDisplayParts(function (writer) { + typechecker.getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); + }); + } + ts.typeToDisplayParts = typeToDisplayParts; + function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning, flags) { + return mapToDisplayParts(function (writer) { + typeChecker.getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning, flags); + }); + } + ts.symbolToDisplayParts = symbolToDisplayParts; + function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, flags) { + return mapToDisplayParts(function (writer) { + typechecker.getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags); + }); + } + ts.signatureToDisplayParts = signatureToDisplayParts; +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var scanner = ts.createScanner(2, false); + var ScanAction; + (function (ScanAction) { + ScanAction[ScanAction["Scan"] = 0] = "Scan"; + ScanAction[ScanAction["RescanGreaterThanToken"] = 1] = "RescanGreaterThanToken"; + ScanAction[ScanAction["RescanSlashToken"] = 2] = "RescanSlashToken"; + ScanAction[ScanAction["RescanTemplateToken"] = 3] = "RescanTemplateToken"; + })(ScanAction || (ScanAction = {})); + function getFormattingScanner(sourceFile, startPos, endPos) { + scanner.setText(sourceFile.text); + scanner.setTextPos(startPos); + var wasNewLine = true; + var leadingTrivia; + var trailingTrivia; + var savedPos; + var lastScanAction; + var lastTokenInfo; + return { + advance: advance, + readTokenInfo: readTokenInfo, + isOnToken: isOnToken, + lastTrailingTriviaWasNewLine: function () { return wasNewLine; }, + close: function () { + lastTokenInfo = undefined; + scanner.setText(undefined); + } + }; + function advance() { + lastTokenInfo = undefined; + var isStarted = scanner.getStartPos() !== startPos; + if (isStarted) { + if (trailingTrivia) { + ts.Debug.assert(trailingTrivia.length !== 0); + wasNewLine = trailingTrivia[trailingTrivia.length - 1].kind === 4; + } + else { + wasNewLine = false; + } + } + leadingTrivia = undefined; + trailingTrivia = undefined; + if (!isStarted) { + scanner.scan(); + } + var t; + var pos = scanner.getStartPos(); + while (pos < endPos) { + var t = scanner.getToken(); + if (!ts.isTrivia(t)) { + break; + } + scanner.scan(); + var item = { + pos: pos, + end: scanner.getStartPos(), + kind: t + }; + pos = scanner.getStartPos(); + if (!leadingTrivia) { + leadingTrivia = []; + } + leadingTrivia.push(item); + } + savedPos = scanner.getStartPos(); + } + function shouldRescanGreaterThanToken(node) { + if (node) { + switch (node.kind) { + case 27: + case 59: + case 60: + case 42: + case 41: + return true; + } + } + return false; + } + function shouldRescanSlashToken(container) { + return container.kind === 9; + } + function shouldRescanTemplateToken(container) { + return container.kind === 12 || + container.kind === 13; + } + function startsWithSlashToken(t) { + return t === 36 || t === 56; + } + function readTokenInfo(n) { + if (!isOnToken()) { + return { + leadingTrivia: leadingTrivia, + trailingTrivia: undefined, + token: undefined + }; + } + var expectedScanAction = shouldRescanGreaterThanToken(n) ? 1 : shouldRescanSlashToken(n) ? 2 : shouldRescanTemplateToken(n) ? 3 : 0; + if (lastTokenInfo && expectedScanAction === lastScanAction) { + return fixTokenKind(lastTokenInfo, n); + } + if (scanner.getStartPos() !== savedPos) { + ts.Debug.assert(lastTokenInfo !== undefined); + scanner.setTextPos(savedPos); + scanner.scan(); + } + var currentToken = scanner.getToken(); + if (expectedScanAction === 1 && currentToken === 25) { + currentToken = scanner.reScanGreaterToken(); + ts.Debug.assert(n.kind === currentToken); + lastScanAction = 1; + } + else if (expectedScanAction === 2 && startsWithSlashToken(currentToken)) { + currentToken = scanner.reScanSlashToken(); + ts.Debug.assert(n.kind === currentToken); + lastScanAction = 2; + } + else if (expectedScanAction === 3 && currentToken === 15) { + currentToken = scanner.reScanTemplateToken(); + lastScanAction = 3; + } + else { + lastScanAction = 0; + } + var token = { + pos: scanner.getStartPos(), + end: scanner.getTextPos(), + kind: currentToken + }; + if (trailingTrivia) { + trailingTrivia = undefined; + } + while (scanner.getStartPos() < endPos) { + currentToken = scanner.scan(); + if (!ts.isTrivia(currentToken)) { + break; + } + var trivia = { + pos: scanner.getStartPos(), + end: scanner.getTextPos(), + kind: currentToken + }; + if (!trailingTrivia) { + trailingTrivia = []; + } + trailingTrivia.push(trivia); + if (currentToken === 4) { + scanner.scan(); + break; + } + } + lastTokenInfo = { + leadingTrivia: leadingTrivia, + trailingTrivia: trailingTrivia, + token: token + }; + return fixTokenKind(lastTokenInfo, n); + } + function isOnToken() { + var current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken(); + var startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos(); + return startPos < endPos && current !== 1 && !ts.isTrivia(current); + } + function fixTokenKind(tokenInfo, container) { + if (ts.isToken(container) && tokenInfo.token.kind !== container.kind) { + tokenInfo.token.kind = container.kind; + } + return tokenInfo; + } + } + formatting.getFormattingScanner = getFormattingScanner; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var FormattingContext = (function () { + function FormattingContext(sourceFile, formattingRequestKind) { + this.sourceFile = sourceFile; + this.formattingRequestKind = formattingRequestKind; + } + FormattingContext.prototype.updateContext = function (currentRange, currentTokenParent, nextRange, nextTokenParent, commonParent) { + ts.Debug.assert(currentRange !== undefined, "currentTokenSpan is null"); + ts.Debug.assert(currentTokenParent !== undefined, "currentTokenParent is null"); + ts.Debug.assert(nextRange !== undefined, "nextTokenSpan is null"); + ts.Debug.assert(nextTokenParent !== undefined, "nextTokenParent is null"); + ts.Debug.assert(commonParent !== undefined, "commonParent is null"); + this.currentTokenSpan = currentRange; + this.currentTokenParent = currentTokenParent; + this.nextTokenSpan = nextRange; + this.nextTokenParent = nextTokenParent; + this.contextNode = commonParent; + this.contextNodeAllOnSameLine = undefined; + this.nextNodeAllOnSameLine = undefined; + this.tokensAreOnSameLine = undefined; + this.contextNodeBlockIsOnOneLine = undefined; + this.nextNodeBlockIsOnOneLine = undefined; + }; + FormattingContext.prototype.ContextNodeAllOnSameLine = function () { + if (this.contextNodeAllOnSameLine === undefined) { + this.contextNodeAllOnSameLine = this.NodeIsOnOneLine(this.contextNode); + } + return this.contextNodeAllOnSameLine; + }; + FormattingContext.prototype.NextNodeAllOnSameLine = function () { + if (this.nextNodeAllOnSameLine === undefined) { + this.nextNodeAllOnSameLine = this.NodeIsOnOneLine(this.nextTokenParent); + } + return this.nextNodeAllOnSameLine; + }; + FormattingContext.prototype.TokensAreOnSameLine = function () { + if (this.tokensAreOnSameLine === undefined) { + var startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line; + this.tokensAreOnSameLine = (startLine == endLine); + } + return this.tokensAreOnSameLine; + }; + FormattingContext.prototype.ContextNodeBlockIsOnOneLine = function () { + if (this.contextNodeBlockIsOnOneLine === undefined) { + this.contextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.contextNode); + } + return this.contextNodeBlockIsOnOneLine; + }; + FormattingContext.prototype.NextNodeBlockIsOnOneLine = function () { + if (this.nextNodeBlockIsOnOneLine === undefined) { + this.nextNodeBlockIsOnOneLine = this.BlockIsOnOneLine(this.nextTokenParent); + } + return this.nextNodeBlockIsOnOneLine; + }; + FormattingContext.prototype.NodeIsOnOneLine = function (node) { + var startLine = this.sourceFile.getLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line; + return startLine == endLine; + }; + FormattingContext.prototype.BlockIsOnOneLine = function (node) { + var openBrace = ts.findChildOfKind(node, 14, this.sourceFile); + var closeBrace = ts.findChildOfKind(node, 15, this.sourceFile); + if (openBrace && closeBrace) { + var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; + return startLine === endLine; + } + return false; + }; + return FormattingContext; + })(); + formatting.FormattingContext = FormattingContext; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + (function (FormattingRequestKind) { + FormattingRequestKind[FormattingRequestKind["FormatDocument"] = 0] = "FormatDocument"; + FormattingRequestKind[FormattingRequestKind["FormatSelection"] = 1] = "FormatSelection"; + FormattingRequestKind[FormattingRequestKind["FormatOnEnter"] = 2] = "FormatOnEnter"; + FormattingRequestKind[FormattingRequestKind["FormatOnSemicolon"] = 3] = "FormatOnSemicolon"; + FormattingRequestKind[FormattingRequestKind["FormatOnClosingCurlyBrace"] = 4] = "FormatOnClosingCurlyBrace"; + })(formatting.FormattingRequestKind || (formatting.FormattingRequestKind = {})); + var FormattingRequestKind = formatting.FormattingRequestKind; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var Rule = (function () { + function Rule(Descriptor, Operation, Flag) { + if (Flag === void 0) { Flag = 0; } + this.Descriptor = Descriptor; + this.Operation = Operation; + this.Flag = Flag; + } + Rule.prototype.toString = function () { + return "[desc=" + this.Descriptor + "," + + "operation=" + this.Operation + "," + + "flag=" + this.Flag + "]"; + }; + return Rule; + })(); + formatting.Rule = Rule; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + (function (RuleAction) { + RuleAction[RuleAction["Ignore"] = 1] = "Ignore"; + RuleAction[RuleAction["Space"] = 2] = "Space"; + RuleAction[RuleAction["NewLine"] = 4] = "NewLine"; + RuleAction[RuleAction["Delete"] = 8] = "Delete"; + })(formatting.RuleAction || (formatting.RuleAction = {})); + var RuleAction = formatting.RuleAction; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleDescriptor = (function () { + function RuleDescriptor(LeftTokenRange, RightTokenRange) { + this.LeftTokenRange = LeftTokenRange; + this.RightTokenRange = RightTokenRange; + } + RuleDescriptor.prototype.toString = function () { + return "[leftRange=" + this.LeftTokenRange + "," + + "rightRange=" + this.RightTokenRange + "]"; + }; + RuleDescriptor.create1 = function (left, right) { + return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), formatting.Shared.TokenRange.FromToken(right)); + }; + RuleDescriptor.create2 = function (left, right) { + return RuleDescriptor.create4(left, formatting.Shared.TokenRange.FromToken(right)); + }; + RuleDescriptor.create3 = function (left, right) { + return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), right); + }; + RuleDescriptor.create4 = function (left, right) { + return new RuleDescriptor(left, right); + }; + return RuleDescriptor; + })(); + formatting.RuleDescriptor = RuleDescriptor; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + (function (RuleFlags) { + RuleFlags[RuleFlags["None"] = 0] = "None"; + RuleFlags[RuleFlags["CanDeleteNewLines"] = 1] = "CanDeleteNewLines"; + })(formatting.RuleFlags || (formatting.RuleFlags = {})); + var RuleFlags = formatting.RuleFlags; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleOperation = (function () { + function RuleOperation() { + this.Context = null; + this.Action = null; + } + RuleOperation.prototype.toString = function () { + return "[context=" + this.Context + "," + + "action=" + this.Action + "]"; + }; + RuleOperation.create1 = function (action) { + return RuleOperation.create2(formatting.RuleOperationContext.Any, action); + }; + RuleOperation.create2 = function (context, action) { + var result = new RuleOperation(); + result.Context = context; + result.Action = action; + return result; + }; + return RuleOperation; + })(); + formatting.RuleOperation = RuleOperation; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RuleOperationContext = (function () { + function RuleOperationContext() { + var funcs = []; + for (var _i = 0; _i < arguments.length; _i++) { + funcs[_i - 0] = arguments[_i]; + } + this.customContextChecks = funcs; + } + RuleOperationContext.prototype.IsAny = function () { + return this == RuleOperationContext.Any; + }; + RuleOperationContext.prototype.InContext = function (context) { + if (this.IsAny()) { + return true; + } + for (var i = 0, len = this.customContextChecks.length; i < len; i++) { + if (!this.customContextChecks[i](context)) { + return false; + } + } + return true; + }; + RuleOperationContext.Any = new RuleOperationContext(); + return RuleOperationContext; + })(); + formatting.RuleOperationContext = RuleOperationContext; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var Rules = (function () { + function Rules() { + this.IgnoreBeforeComment = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.Comments), formatting.RuleOperation.create1(1)); + this.IgnoreAfterLineComment = new formatting.Rule(formatting.RuleDescriptor.create3(2, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create1(1)); + this.NoSpaceBeforeSemicolon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeColon = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 51), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceBeforeQMark = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 50), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.SpaceAfterColon = new formatting.Rule(formatting.RuleDescriptor.create3(51, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2)); + this.SpaceAfterQMark = new formatting.Rule(formatting.RuleDescriptor.create3(50, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 2)); + this.SpaceAfterSemicolon = new formatting.Rule(formatting.RuleDescriptor.create3(22, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsAfterCodeBlockContext), 2)); + this.SpaceBetweenCloseBraceAndElse = new formatting.Rule(formatting.RuleDescriptor.create1(15, 75), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBetweenCloseBraceAndWhile = new formatting.Rule(formatting.RuleDescriptor.create1(15, 99), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create3(15, formatting.Shared.TokenRange.FromTokens([17, 19, 23, 22])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeDot = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterDot = new formatting.Rule(formatting.RuleDescriptor.create3(20, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create3(18, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 19), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; + this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); + this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([64, 3]); + this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); + this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([17, 3, 74, 95, 80, 75]); + this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); + this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(14, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); + this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSingleLineBlockContext), 2)); + this.NoSpaceBetweenEmptyBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(14, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectContext), 8)); + this.NewLineAfterOpenBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create3(14, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); + this.NewLineBeforeCloseBraceInBlockContext = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyIncludingMultilineComments, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsMultilineBlockContext), 4)); + this.NoSpaceAfterUnaryPrefixOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.UnaryPrefixOperators, formatting.Shared.TokenRange.UnaryPrefixExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceAfterUnaryPreincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(38, formatting.Shared.TokenRange.UnaryPreincrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterUnaryPredecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create3(39, formatting.Shared.TokenRange.UnaryPredecrementExpressions), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeUnaryPostincrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostincrementExpressions, 38), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeUnaryPostdecrementOperator = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.UnaryPostdecrementExpressions, 39), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterPostincrementWhenFollowedByAdd = new formatting.Rule(formatting.RuleDescriptor.create1(38, 33), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterAddWhenFollowedByUnaryPlus = new formatting.Rule(formatting.RuleDescriptor.create1(33, 33), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterAddWhenFollowedByPreincrement = new formatting.Rule(formatting.RuleDescriptor.create1(33, 38), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterPostdecrementWhenFollowedBySubtract = new formatting.Rule(formatting.RuleDescriptor.create1(39, 34), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterSubtractWhenFollowedByUnaryMinus = new formatting.Rule(formatting.RuleDescriptor.create1(34, 34), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterSubtractWhenFollowedByPredecrement = new formatting.Rule(formatting.RuleDescriptor.create1(34, 39), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.NoSpaceBeforeComma = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 23), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterCertainKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([97, 93, 87, 73, 89, 96]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceBeforeOpenParenInFuncCall = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionCallOrNewContext, Rules.IsPreviousTokenNotComma), 8)); + this.SpaceAfterFunctionInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create3(82, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.NoSpaceBeforeOpenParenInFuncDecl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsFunctionDeclContext), 8)); + this.SpaceAfterVoidOperator = new formatting.Rule(formatting.RuleDescriptor.create3(98, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsVoidOpContext), 2)); + this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(89, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([17, 74, 75, 66]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotForContext), 2)); + this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([95, 80]), 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([114, 118]), 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceBeforeBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryKeywordOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterBinaryKeywordOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryKeywordOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(112, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([115, 116]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([68, 113, 76, 77, 78, 114, 101, 84, 102, 115, 105, 107, 118, 108]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([78, 101])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(8, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2)); + this.SpaceAfterArrow = new formatting.Rule(formatting.RuleDescriptor.create3(32, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterEllipsis = new formatting.Rule(formatting.RuleDescriptor.create1(21, 64), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterOptionalParameters = new formatting.Rule(formatting.RuleDescriptor.create3(50, formatting.Shared.TokenRange.FromTokens([17, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsNotBinaryOpContext), 8)); + this.NoSpaceBeforeOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.TypeNames, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); + this.NoSpaceBetweenCloseParenAndAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create1(17, 24), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); + this.NoSpaceAfterOpenAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(24, formatting.Shared.TokenRange.TypeNames), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); + this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); + this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.FromTokens([16, 18, 25, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); + this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(14, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8)); + this.HighPriorityCommonRules = + [ + this.IgnoreBeforeComment, this.IgnoreAfterLineComment, + this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQMark, this.SpaceAfterQMark, + this.NoSpaceBeforeDot, this.NoSpaceAfterDot, + this.NoSpaceAfterUnaryPrefixOperator, + this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator, + this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator, + this.SpaceAfterPostincrementWhenFollowedByAdd, + this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement, + this.SpaceAfterPostdecrementWhenFollowedBySubtract, + this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement, + this.NoSpaceAfterCloseBrace, + this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext, + this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets, + this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember, + this.NoSpaceBetweenReturnAndSemicolon, + this.SpaceAfterCertainKeywords, + this.NoSpaceBeforeOpenParenInFuncCall, + this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, + this.SpaceAfterVoidOperator, + this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, + this.SpaceAfterModuleName, + this.SpaceAfterArrow, + this.NoSpaceAfterEllipsis, + this.NoSpaceAfterOptionalParameters, + this.NoSpaceBetweenEmptyInterfaceBraceBrackets, + this.NoSpaceBeforeOpenAngularBracket, + this.NoSpaceBetweenCloseParenAndAngularBracket, + this.NoSpaceAfterOpenAngularBracket, + this.NoSpaceBeforeCloseAngularBracket, + this.NoSpaceAfterCloseAngularBracket + ]; + this.LowPriorityCommonRules = + [ + this.NoSpaceBeforeSemicolon, + this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, + this.NoSpaceBeforeComma, + this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterOpenBracket, + this.NoSpaceBeforeCloseBracket, this.NoSpaceAfterCloseBracket, + this.SpaceAfterSemicolon, + this.NoSpaceBeforeOpenParenInFuncDecl, + this.SpaceBetweenStatements, this.SpaceAfterTryFinally + ]; + this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.SpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 2)); + this.NoSpaceBeforeBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.BinaryOperators), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 8)); + this.NoSpaceAfterBinaryOperator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.BinaryOperators, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsBinaryOpContext), 8)); + this.SpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 2)); + this.NoSpaceAfterKeywordInControl = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Keywords, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext), 8)); + this.NewLineBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeMultilineBlockContext), 4), 1); + this.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsBeforeMultilineBlockContext), 4), 1); + this.NewLineBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsBeforeMultilineBlockContext), 4), 1); + this.SpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(22, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 2)); + this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(22, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsForContext), 8)); + this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(16, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(16, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(82, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.NoSpaceAfterAnonymousFunctionKeyword = new formatting.Rule(formatting.RuleDescriptor.create1(82, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 8)); + } + Rules.prototype.getRuleName = function (rule) { + var o = this; + for (var name in o) { + if (o[name] === rule) { + return name; + } + } + throw new Error("Unknown rule"); + }; + Rules.IsForContext = function (context) { + return context.contextNode.kind === 179; + }; + Rules.IsNotForContext = function (context) { + return !Rules.IsForContext(context); + }; + Rules.IsBinaryOpContext = function (context) { + switch (context.contextNode.kind) { + case 165: + case 166: + return true; + case 200: + case 191: + case 126: + case 209: + case 128: + case 127: + return context.currentTokenSpan.kind === 52 || context.nextTokenSpan.kind === 52; + case 180: + return context.currentTokenSpan.kind === 85 || context.nextTokenSpan.kind === 85; + case 181: + return context.currentTokenSpan.kind === 122 || context.nextTokenSpan.kind === 122; + } + return false; + }; + Rules.IsNotBinaryOpContext = function (context) { + return !Rules.IsBinaryOpContext(context); + }; + Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { + return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); + }; + Rules.IsBeforeMultilineBlockContext = function (context) { + return Rules.IsBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); + }; + Rules.IsMultilineBlockContext = function (context) { + return Rules.IsBlockContext(context) && !(context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine()); + }; + Rules.IsSingleLineBlockContext = function (context) { + return Rules.IsBlockContext(context) && (context.ContextNodeAllOnSameLine() || context.ContextNodeBlockIsOnOneLine()); + }; + Rules.IsBlockContext = function (context) { + return Rules.NodeIsBlockContext(context.contextNode); + }; + Rules.IsBeforeBlockContext = function (context) { + return Rules.NodeIsBlockContext(context.nextTokenParent); + }; + Rules.NodeIsBlockContext = function (node) { + if (Rules.NodeIsTypeScriptDeclWithBlockContext(node)) { + return true; + } + switch (node.kind) { + case 172: + case 186: + case 150: + case 199: + return true; + } + return false; + }; + Rules.IsFunctionDeclContext = function (context) { + switch (context.contextNode.kind) { + case 193: + case 130: + case 129: + case 132: + case 133: + case 134: + case 158: + case 131: + case 159: + case 195: + return true; + } + return false; + }; + Rules.IsTypeScriptDeclWithBlockContext = function (context) { + return Rules.NodeIsTypeScriptDeclWithBlockContext(context.contextNode); + }; + Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { + switch (node.kind) { + case 194: + case 195: + case 197: + case 141: + case 198: + return true; + } + return false; + }; + Rules.IsAfterCodeBlockContext = function (context) { + switch (context.currentTokenParent.kind) { + case 194: + case 198: + case 197: + case 172: + case 206: + case 199: + case 186: + return true; + } + return false; + }; + Rules.IsControlDeclContext = function (context) { + switch (context.contextNode.kind) { + case 176: + case 186: + case 179: + case 180: + case 181: + case 178: + case 189: + case 177: + case 185: + case 206: + return true; + default: + return false; + } + }; + Rules.IsObjectContext = function (context) { + return context.contextNode.kind === 150; + }; + Rules.IsFunctionCallContext = function (context) { + return context.contextNode.kind === 153; + }; + Rules.IsNewContext = function (context) { + return context.contextNode.kind === 154; + }; + Rules.IsFunctionCallOrNewContext = function (context) { + return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); + }; + Rules.IsPreviousTokenNotComma = function (context) { + return context.currentTokenSpan.kind !== 23; + }; + Rules.IsSameLineTokenContext = function (context) { + return context.TokensAreOnSameLine(); + }; + Rules.IsNotFormatOnEnter = function (context) { + return context.formattingRequestKind != 2; + }; + Rules.IsModuleDeclContext = function (context) { + return context.contextNode.kind === 198; + }; + Rules.IsObjectTypeContext = function (context) { + return context.contextNode.kind === 141; + }; + Rules.IsTypeArgumentOrParameter = function (token, parent) { + if (token.kind !== 24 && token.kind !== 25) { + return false; + } + switch (parent.kind) { + case 137: + case 194: + case 195: + case 193: + case 158: + case 159: + case 130: + case 129: + case 134: + case 135: + case 153: + case 154: + return true; + default: + return false; + } + }; + Rules.IsTypeArgumentOrParameterContext = function (context) { + return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || + Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); + }; + Rules.IsVoidOpContext = function (context) { + return context.currentTokenSpan.kind === 98 && context.currentTokenParent.kind === 162; + }; + return Rules; + })(); + formatting.Rules = Rules; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RulesMap = (function () { + function RulesMap() { + this.map = []; + this.mapRowLength = 0; + } + RulesMap.create = function (rules) { + var result = new RulesMap(); + result.Initialize(rules); + return result; + }; + RulesMap.prototype.Initialize = function (rules) { + this.mapRowLength = 122 + 1; + this.map = new Array(this.mapRowLength * this.mapRowLength); + var rulesBucketConstructionStateList = new Array(this.map.length); + this.FillRules(rules, rulesBucketConstructionStateList); + return this.map; + }; + RulesMap.prototype.FillRules = function (rules, rulesBucketConstructionStateList) { + var _this = this; + rules.forEach(function (rule) { + _this.FillRule(rule, rulesBucketConstructionStateList); + }); + }; + RulesMap.prototype.GetRuleBucketIndex = function (row, column) { + var rulesBucketIndex = (row * this.mapRowLength) + column; + return rulesBucketIndex; + }; + RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) { + var _this = this; + var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && + rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; + rule.Descriptor.LeftTokenRange.GetTokens().forEach(function (left) { + rule.Descriptor.RightTokenRange.GetTokens().forEach(function (right) { + var rulesBucketIndex = _this.GetRuleBucketIndex(left, right); + var rulesBucket = _this.map[rulesBucketIndex]; + if (rulesBucket == undefined) { + rulesBucket = _this.map[rulesBucketIndex] = new RulesBucket(); + } + rulesBucket.AddRule(rule, specificRule, rulesBucketConstructionStateList, rulesBucketIndex); + }); + }); + }; + RulesMap.prototype.GetRule = function (context) { + var bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind); + var bucket = this.map[bucketIndex]; + if (bucket != null) { + for (var i = 0, len = bucket.Rules().length; i < len; i++) { + var rule = bucket.Rules()[i]; + if (rule.Operation.Context.InContext(context)) + return rule; + } + } + return null; + }; + return RulesMap; + })(); + formatting.RulesMap = RulesMap; + var MaskBitSize = 5; + var Mask = 0x1f; + (function (RulesPosition) { + RulesPosition[RulesPosition["IgnoreRulesSpecific"] = 0] = "IgnoreRulesSpecific"; + RulesPosition[RulesPosition["IgnoreRulesAny"] = MaskBitSize * 1] = "IgnoreRulesAny"; + RulesPosition[RulesPosition["ContextRulesSpecific"] = MaskBitSize * 2] = "ContextRulesSpecific"; + RulesPosition[RulesPosition["ContextRulesAny"] = MaskBitSize * 3] = "ContextRulesAny"; + RulesPosition[RulesPosition["NoContextRulesSpecific"] = MaskBitSize * 4] = "NoContextRulesSpecific"; + RulesPosition[RulesPosition["NoContextRulesAny"] = MaskBitSize * 5] = "NoContextRulesAny"; + })(formatting.RulesPosition || (formatting.RulesPosition = {})); + var RulesPosition = formatting.RulesPosition; + var RulesBucketConstructionState = (function () { + function RulesBucketConstructionState() { + this.rulesInsertionIndexBitmap = 0; + } + RulesBucketConstructionState.prototype.GetInsertionIndex = function (maskPosition) { + var index = 0; + var pos = 0; + var indexBitmap = this.rulesInsertionIndexBitmap; + while (pos <= maskPosition) { + index += (indexBitmap & Mask); + indexBitmap >>= MaskBitSize; + pos += MaskBitSize; + } + return index; + }; + RulesBucketConstructionState.prototype.IncreaseInsertionIndex = function (maskPosition) { + var value = (this.rulesInsertionIndexBitmap >> maskPosition) & Mask; + value++; + ts.Debug.assert((value & Mask) == value, "Adding more rules into the sub-bucket than allowed. Maximum allowed is 32 rules."); + var temp = this.rulesInsertionIndexBitmap & ~(Mask << maskPosition); + temp |= value << maskPosition; + this.rulesInsertionIndexBitmap = temp; + }; + return RulesBucketConstructionState; + })(); + formatting.RulesBucketConstructionState = RulesBucketConstructionState; + var RulesBucket = (function () { + function RulesBucket() { + this.rules = []; + } + RulesBucket.prototype.Rules = function () { + return this.rules; + }; + RulesBucket.prototype.AddRule = function (rule, specificTokens, constructionState, rulesBucketIndex) { + var position; + if (rule.Operation.Action == 1) { + position = specificTokens ? 0 : RulesPosition.IgnoreRulesAny; + } + else if (!rule.Operation.Context.IsAny()) { + position = specificTokens ? RulesPosition.ContextRulesSpecific : RulesPosition.ContextRulesAny; + } + else { + position = specificTokens ? RulesPosition.NoContextRulesSpecific : RulesPosition.NoContextRulesAny; + } + var state = constructionState[rulesBucketIndex]; + if (state === undefined) { + state = constructionState[rulesBucketIndex] = new RulesBucketConstructionState(); + } + var index = state.GetInsertionIndex(position); + this.rules.splice(index, 0, rule); + state.IncreaseInsertionIndex(position); + }; + return RulesBucket; + })(); + formatting.RulesBucket = RulesBucket; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var Shared; + (function (Shared) { + var TokenRangeAccess = (function () { + function TokenRangeAccess(from, to, except) { + this.tokens = []; + for (var token = from; token <= to; token++) { + if (except.indexOf(token) < 0) { + this.tokens.push(token); + } + } + } + TokenRangeAccess.prototype.GetTokens = function () { + return this.tokens; + }; + TokenRangeAccess.prototype.Contains = function (token) { + return this.tokens.indexOf(token) >= 0; + }; + return TokenRangeAccess; + })(); + Shared.TokenRangeAccess = TokenRangeAccess; + var TokenValuesAccess = (function () { + function TokenValuesAccess(tks) { + this.tokens = tks && tks.length ? tks : []; + } + TokenValuesAccess.prototype.GetTokens = function () { + return this.tokens; + }; + TokenValuesAccess.prototype.Contains = function (token) { + return this.tokens.indexOf(token) >= 0; + }; + return TokenValuesAccess; + })(); + Shared.TokenValuesAccess = TokenValuesAccess; + var TokenSingleValueAccess = (function () { + function TokenSingleValueAccess(token) { + this.token = token; + } + TokenSingleValueAccess.prototype.GetTokens = function () { + return [this.token]; + }; + TokenSingleValueAccess.prototype.Contains = function (tokenValue) { + return tokenValue == this.token; + }; + return TokenSingleValueAccess; + })(); + Shared.TokenSingleValueAccess = TokenSingleValueAccess; + var TokenAllAccess = (function () { + function TokenAllAccess() { + } + TokenAllAccess.prototype.GetTokens = function () { + var result = []; + for (var token = 0; token <= 122; token++) { + result.push(token); + } + return result; + }; + TokenAllAccess.prototype.Contains = function (tokenValue) { + return true; + }; + TokenAllAccess.prototype.toString = function () { + return "[allTokens]"; + }; + return TokenAllAccess; + })(); + Shared.TokenAllAccess = TokenAllAccess; + var TokenRange = (function () { + function TokenRange(tokenAccess) { + this.tokenAccess = tokenAccess; + } + TokenRange.FromToken = function (token) { + return new TokenRange(new TokenSingleValueAccess(token)); + }; + TokenRange.FromTokens = function (tokens) { + return new TokenRange(new TokenValuesAccess(tokens)); + }; + TokenRange.FromRange = function (f, to, except) { + if (except === void 0) { except = []; } + return new TokenRange(new TokenRangeAccess(f, to, except)); + }; + TokenRange.AllTokens = function () { + return new TokenRange(new TokenAllAccess()); + }; + TokenRange.prototype.GetTokens = function () { + return this.tokenAccess.GetTokens(); + }; + TokenRange.prototype.Contains = function (token) { + return this.tokenAccess.Contains(token); + }; + TokenRange.prototype.toString = function () { + return this.tokenAccess.toString(); + }; + TokenRange.Any = TokenRange.AllTokens(); + TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); + TokenRange.Keywords = TokenRange.FromRange(65, 122); + TokenRange.BinaryOperators = TokenRange.FromRange(24, 63); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([85, 86, 122]); + TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([38, 39, 47, 46]); + TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([7, 64, 16, 18, 14, 92, 87]); + TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); + TokenRange.UnaryPostincrementExpressions = TokenRange.FromTokens([64, 17, 19, 87]); + TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); + TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([64, 17, 19, 87]); + TokenRange.Comments = TokenRange.FromTokens([2, 3]); + TokenRange.TypeNames = TokenRange.FromTokens([64, 117, 119, 111, 120, 98, 110]); + return TokenRange; + })(); + Shared.TokenRange = TokenRange; + })(Shared = formatting.Shared || (formatting.Shared = {})); + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var RulesProvider = (function () { + function RulesProvider() { + this.globalRules = new formatting.Rules(); + } + RulesProvider.prototype.getRuleName = function (rule) { + return this.globalRules.getRuleName(rule); + }; + RulesProvider.prototype.getRuleByName = function (name) { + return this.globalRules[name]; + }; + RulesProvider.prototype.getRulesMap = function () { + return this.rulesMap; + }; + RulesProvider.prototype.ensureUpToDate = function (options) { + if (this.options == null || !ts.compareDataObjects(this.options, options)) { + var activeRules = this.createActiveRules(options); + var rulesMap = formatting.RulesMap.create(activeRules); + this.activeRules = activeRules; + this.rulesMap = rulesMap; + this.options = ts.clone(options); + } + }; + RulesProvider.prototype.createActiveRules = function (options) { + var rules = this.globalRules.HighPriorityCommonRules.slice(0); + if (options.InsertSpaceAfterCommaDelimiter) { + rules.push(this.globalRules.SpaceAfterComma); + } + else { + rules.push(this.globalRules.NoSpaceAfterComma); + } + if (options.InsertSpaceAfterFunctionKeywordForAnonymousFunctions) { + rules.push(this.globalRules.SpaceAfterAnonymousFunctionKeyword); + } + else { + rules.push(this.globalRules.NoSpaceAfterAnonymousFunctionKeyword); + } + if (options.InsertSpaceAfterKeywordsInControlFlowStatements) { + rules.push(this.globalRules.SpaceAfterKeywordInControl); + } + else { + rules.push(this.globalRules.NoSpaceAfterKeywordInControl); + } + if (options.InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis) { + rules.push(this.globalRules.SpaceAfterOpenParen); + rules.push(this.globalRules.SpaceBeforeCloseParen); + rules.push(this.globalRules.NoSpaceBetweenParens); + } + else { + rules.push(this.globalRules.NoSpaceAfterOpenParen); + rules.push(this.globalRules.NoSpaceBeforeCloseParen); + rules.push(this.globalRules.NoSpaceBetweenParens); + } + if (options.InsertSpaceAfterSemicolonInForStatements) { + rules.push(this.globalRules.SpaceAfterSemicolonInFor); + } + else { + rules.push(this.globalRules.NoSpaceAfterSemicolonInFor); + } + if (options.InsertSpaceBeforeAndAfterBinaryOperators) { + rules.push(this.globalRules.SpaceBeforeBinaryOperator); + rules.push(this.globalRules.SpaceAfterBinaryOperator); + } + else { + rules.push(this.globalRules.NoSpaceBeforeBinaryOperator); + rules.push(this.globalRules.NoSpaceAfterBinaryOperator); + } + if (options.PlaceOpenBraceOnNewLineForControlBlocks) { + rules.push(this.globalRules.NewLineBeforeOpenBraceInControl); + } + if (options.PlaceOpenBraceOnNewLineForFunctions) { + rules.push(this.globalRules.NewLineBeforeOpenBraceInFunction); + rules.push(this.globalRules.NewLineBeforeOpenBraceInTypeScriptDeclWithBlock); + } + rules = rules.concat(this.globalRules.LowPriorityCommonRules); + return rules; + }; + return RulesProvider; + })(); + formatting.RulesProvider = RulesProvider; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var Constants; + (function (Constants) { + Constants[Constants["Unknown"] = -1] = "Unknown"; + })(Constants || (Constants = {})); + function formatOnEnter(position, sourceFile, rulesProvider, options) { + var line = sourceFile.getLineAndCharacterOfPosition(position).line; + if (line === 0) { + return []; + } + var span = { + pos: ts.getStartPositionOfLine(line - 1, sourceFile), + end: ts.getEndLinePosition(line, sourceFile) + 1 + }; + return formatSpan(span, sourceFile, options, rulesProvider, 2); + } + formatting.formatOnEnter = formatOnEnter; + function formatOnSemicolon(position, sourceFile, rulesProvider, options) { + return formatOutermostParent(position, 22, sourceFile, options, rulesProvider, 3); + } + formatting.formatOnSemicolon = formatOnSemicolon; + function formatOnClosingCurly(position, sourceFile, rulesProvider, options) { + return formatOutermostParent(position, 15, sourceFile, options, rulesProvider, 4); + } + formatting.formatOnClosingCurly = formatOnClosingCurly; + function formatDocument(sourceFile, rulesProvider, options) { + var span = { + pos: 0, + end: sourceFile.text.length + }; + return formatSpan(span, sourceFile, options, rulesProvider, 0); + } + formatting.formatDocument = formatDocument; + function formatSelection(start, end, sourceFile, rulesProvider, options) { + var span = { + pos: ts.getLineStartPositionForPosition(start, sourceFile), + end: end + }; + return formatSpan(span, sourceFile, options, rulesProvider, 1); + } + formatting.formatSelection = formatSelection; + function formatOutermostParent(position, expectedLastToken, sourceFile, options, rulesProvider, requestKind) { + var parent = findOutermostParent(position, expectedLastToken, sourceFile); + if (!parent) { + return []; + } + var span = { + pos: ts.getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile), + end: parent.end + }; + return formatSpan(span, sourceFile, options, rulesProvider, requestKind); + } + function findOutermostParent(position, expectedTokenKind, sourceFile) { + var precedingToken = ts.findPrecedingToken(position, sourceFile); + if (!precedingToken || + precedingToken.kind !== expectedTokenKind || + position !== precedingToken.getEnd()) { + return undefined; + } + var current = precedingToken; + while (current && + current.parent && + current.parent.end === precedingToken.end && + !isListElement(current.parent, current)) { + current = current.parent; + } + return current; + } + function isListElement(parent, node) { + switch (parent.kind) { + case 194: + case 195: + return ts.rangeContainsRange(parent.members, node); + case 198: + var body = parent.body; + return body && body.kind === 172 && ts.rangeContainsRange(body.statements, node); + case 210: + case 172: + case 199: + return ts.rangeContainsRange(parent.statements, node); + case 206: + return ts.rangeContainsRange(parent.block.statements, node); + } + return false; + } + function findEnclosingNode(range, sourceFile) { + return find(sourceFile); + function find(n) { + var candidate = ts.forEachChild(n, function (c) { return ts.startEndContainsRange(c.getStart(sourceFile), c.end, range) && c; }); + if (candidate) { + var result = find(candidate); + if (result) { + return result; + } + } + return n; + } + } + function prepareRangeContainsErrorFunction(errors, originalRange) { + if (!errors.length) { + return rangeHasNoErrors; + } + var sorted = errors.filter(function (d) { return ts.rangeOverlapsWithStartEnd(originalRange, d.start, d.start + d.length); }).sort(function (e1, e2) { return e1.start - e2.start; }); + if (!sorted.length) { + return rangeHasNoErrors; + } + var index = 0; + return function (r) { + while (true) { + if (index >= sorted.length) { + return false; + } + var error = sorted[index]; + if (r.end <= error.start) { + return false; + } + if (ts.startEndOverlapsWithStartEnd(r.pos, r.end, error.start, error.start + error.length)) { + return true; + } + index++; + } + }; + function rangeHasNoErrors(r) { + return false; + } + } + function getScanStartPosition(enclosingNode, originalRange, sourceFile) { + var start = enclosingNode.getStart(sourceFile); + if (start === originalRange.pos && enclosingNode.end === originalRange.end) { + return start; + } + var precedingToken = ts.findPrecedingToken(originalRange.pos, sourceFile); + if (!precedingToken) { + return enclosingNode.pos; + } + if (precedingToken.end >= originalRange.pos) { + return enclosingNode.pos; + } + return precedingToken.end; + } + function getOwnOrInheritedDelta(n, options, sourceFile) { + var previousLine = -1; + var childKind = 0; + while (n) { + var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; + if (previousLine !== -1 && line !== previousLine) { + break; + } + if (formatting.SmartIndenter.shouldIndentChildNode(n.kind, childKind)) { + return options.IndentSize; + } + previousLine = line; + childKind = n.kind; + n = n.parent; + } + return 0; + } + function formatSpan(originalRange, sourceFile, options, rulesProvider, requestKind) { + var rangeContainsError = prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange); + var formattingContext = new formatting.FormattingContext(sourceFile, requestKind); + var enclosingNode = findEnclosingNode(originalRange, sourceFile); + var formattingScanner = formatting.getFormattingScanner(sourceFile, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end); + var initialIndentation = formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options); + var previousRangeHasError; + var previousRange; + var previousParent; + var previousRangeStartLine; + var edits = []; + formattingScanner.advance(); + if (formattingScanner.isOnToken()) { + var startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line; + var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); + processNode(enclosingNode, enclosingNode, startLine, initialIndentation, delta); + } + formattingScanner.close(); + return edits; + function tryComputeIndentationForListItem(startPos, endPos, parentStartLine, range, inheritedIndentation) { + if (ts.rangeOverlapsWithStartEnd(range, startPos, endPos)) { + if (inheritedIndentation !== -1) { + return inheritedIndentation; + } + } + else { + var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line; + var startLinePosition = ts.getLineStartPositionForPosition(startPos, sourceFile); + var column = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); + if (startLine !== parentStartLine || startPos === column) { + return column; + } + } + return -1; + } + function computeIndentation(node, startLine, inheritedIndentation, parent, parentDynamicIndentation, effectiveParentStartLine) { + var indentation = inheritedIndentation; + if (indentation === -1) { + if (isSomeBlock(node.kind)) { + if (isSomeBlock(parent.kind) || + parent.kind === 210 || + parent.kind === 203 || + parent.kind === 204) { + indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); + } + else { + indentation = parentDynamicIndentation.getIndentation(); + } + } + else { + if (formatting.SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent, node, startLine, sourceFile)) { + indentation = parentDynamicIndentation.getIndentation(); + } + else { + indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); + } + } + } + var delta = formatting.SmartIndenter.shouldIndentChildNode(node.kind, 0) ? options.IndentSize : 0; + if (effectiveParentStartLine === startLine) { + indentation = parentDynamicIndentation.getIndentation(); + delta = Math.min(options.IndentSize, parentDynamicIndentation.getDelta() + delta); + } + return { + indentation: indentation, + delta: delta + }; + } + function getDynamicIndentation(node, nodeStartLine, indentation, delta) { + return { + getIndentationForComment: function (kind) { + switch (kind) { + case 15: + case 19: + return indentation + delta; + } + return indentation; + }, + getIndentationForToken: function (line, kind) { + switch (kind) { + case 14: + case 15: + case 18: + case 19: + case 75: + case 99: + return indentation; + default: + return nodeStartLine !== line ? indentation + delta : indentation; + } + }, + getIndentation: function () { return indentation; }, + getDelta: function () { return delta; }, + recomputeIndentation: function (lineAdded) { + if (node.parent && formatting.SmartIndenter.shouldIndentChildNode(node.parent.kind, node.kind)) { + if (lineAdded) { + indentation += options.IndentSize; + } + else { + indentation -= options.IndentSize; + } + if (formatting.SmartIndenter.shouldIndentChildNode(node.kind, 0)) { + delta = options.IndentSize; + } + else { + delta = 0; + } + } + } + }; + } + function processNode(node, contextNode, nodeStartLine, indentation, delta) { + if (!ts.rangeOverlapsWithStartEnd(originalRange, node.getStart(sourceFile), node.getEnd())) { + return; + } + var nodeDynamicIndentation = getDynamicIndentation(node, nodeStartLine, indentation, delta); + var childContextNode = contextNode; + ts.forEachChild(node, function (child) { + processChildNode(child, -1, node, nodeDynamicIndentation, nodeStartLine, false); + }, function (nodes) { + processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation); + }); + while (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(node); + if (tokenInfo.token.end > node.end) { + break; + } + consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation); + } + function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, isListItem) { + var childStartPos = child.getStart(sourceFile); + var childStart = sourceFile.getLineAndCharacterOfPosition(childStartPos); + var childIndentationAmount = -1; + if (isListItem) { + childIndentationAmount = tryComputeIndentationForListItem(childStartPos, child.end, parentStartLine, originalRange, inheritedIndentation); + if (childIndentationAmount !== -1) { + inheritedIndentation = childIndentationAmount; + } + } + if (!ts.rangeOverlapsWithStartEnd(originalRange, child.pos, child.end)) { + return inheritedIndentation; + } + if (child.getFullWidth() === 0) { + return inheritedIndentation; + } + while (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(node); + if (tokenInfo.token.end > childStartPos) { + break; + } + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + } + if (!formattingScanner.isOnToken()) { + return inheritedIndentation; + } + if (ts.isToken(child)) { + var tokenInfo = formattingScanner.readTokenInfo(child); + ts.Debug.assert(tokenInfo.token.end === child.end); + consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); + return inheritedIndentation; + } + var childIndentation = computeIndentation(child, childStart.line, childIndentationAmount, node, parentDynamicIndentation, parentStartLine); + processNode(child, childContextNode, childStart.line, childIndentation.indentation, childIndentation.delta); + childContextNode = node; + return inheritedIndentation; + } + function processChildNodes(nodes, parent, parentStartLine, parentDynamicIndentation) { + var listStartToken = getOpenTokenForList(parent, nodes); + var listEndToken = getCloseTokenForOpenToken(listStartToken); + var listDynamicIndentation = parentDynamicIndentation; + var startLine = parentStartLine; + if (listStartToken !== 0) { + while (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(parent); + if (tokenInfo.token.end > nodes.pos) { + break; + } + else if (tokenInfo.token.kind === listStartToken) { + startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; + var indentation = computeIndentation(tokenInfo.token, startLine, -1, parent, parentDynamicIndentation, startLine); + listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation.indentation, indentation.delta); + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + } + else { + consumeTokenAndAdvanceScanner(tokenInfo, parent, parentDynamicIndentation); + } + } + } + var inheritedIndentation = -1; + for (var i = 0, len = nodes.length; i < len; ++i) { + inheritedIndentation = processChildNode(nodes[i], inheritedIndentation, node, listDynamicIndentation, startLine, true); + } + if (listEndToken !== 0) { + if (formattingScanner.isOnToken()) { + var tokenInfo = formattingScanner.readTokenInfo(parent); + if (tokenInfo.token.kind === listEndToken && ts.rangeContainsRange(parent, tokenInfo.token)) { + consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); + } + } + } + } + function consumeTokenAndAdvanceScanner(currentTokenInfo, parent, dynamicIndentation) { + ts.Debug.assert(ts.rangeContainsRange(parent, currentTokenInfo.token)); + var lastTriviaWasNewLine = formattingScanner.lastTrailingTriviaWasNewLine(); + var indentToken = false; + if (currentTokenInfo.leadingTrivia) { + processTrivia(currentTokenInfo.leadingTrivia, parent, childContextNode, dynamicIndentation); + } + var lineAdded; + var isTokenInRange = ts.rangeContainsRange(originalRange, currentTokenInfo.token); + var tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos); + if (isTokenInRange) { + var rangeHasError = rangeContainsError(currentTokenInfo.token); + var prevStartLine = previousRangeStartLine; + lineAdded = processRange(currentTokenInfo.token, tokenStart, parent, childContextNode, dynamicIndentation); + if (rangeHasError) { + indentToken = false; + } + else { + if (lineAdded !== undefined) { + indentToken = lineAdded; + } + else { + indentToken = lastTriviaWasNewLine && tokenStart.line !== prevStartLine; + } + } + } + if (currentTokenInfo.trailingTrivia) { + processTrivia(currentTokenInfo.trailingTrivia, parent, childContextNode, dynamicIndentation); + } + if (indentToken) { + var indentNextTokenOrTrivia = true; + if (currentTokenInfo.leadingTrivia) { + for (var i = 0, len = currentTokenInfo.leadingTrivia.length; i < len; ++i) { + var triviaItem = currentTokenInfo.leadingTrivia[i]; + if (!ts.rangeContainsRange(originalRange, triviaItem)) { + continue; + } + var triviaStartLine = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos).line; + switch (triviaItem.kind) { + case 3: + var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); + indentMultilineComment(triviaItem, commentIndentation, !indentNextTokenOrTrivia); + indentNextTokenOrTrivia = false; + break; + case 2: + if (indentNextTokenOrTrivia) { + var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); + insertIndentation(triviaItem.pos, commentIndentation, false); + indentNextTokenOrTrivia = false; + } + break; + case 4: + indentNextTokenOrTrivia = true; + break; + } + } + } + if (isTokenInRange && !rangeContainsError(currentTokenInfo.token)) { + var tokenIndentation = dynamicIndentation.getIndentationForToken(tokenStart.line, currentTokenInfo.token.kind); + insertIndentation(currentTokenInfo.token.pos, tokenIndentation, lineAdded); + } + } + formattingScanner.advance(); + childContextNode = parent; + } + } + function processTrivia(trivia, parent, contextNode, dynamicIndentation) { + for (var i = 0, len = trivia.length; i < len; ++i) { + var triviaItem = trivia[i]; + if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { + var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); + processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); + } + } + } + function processRange(range, rangeStart, parent, contextNode, dynamicIndentation) { + var rangeHasError = rangeContainsError(range); + var lineAdded; + if (!rangeHasError && !previousRangeHasError) { + if (!previousRange) { + var originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos); + trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); + } + else { + lineAdded = + processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); + } + } + previousRange = range; + previousParent = parent; + previousRangeStartLine = rangeStart.line; + previousRangeHasError = rangeHasError; + return lineAdded; + } + function processPair(currentItem, currentStartLine, currentParent, previousItem, previousStartLine, previousParent, contextNode, dynamicIndentation) { + formattingContext.updateContext(previousItem, previousParent, currentItem, currentParent, contextNode); + var rule = rulesProvider.getRulesMap().GetRule(formattingContext); + var trimTrailingWhitespaces; + var lineAdded; + if (rule) { + applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine); + if (rule.Operation.Action & (2 | 8) && currentStartLine !== previousStartLine) { + lineAdded = false; + if (currentParent.getStart(sourceFile) === currentItem.pos) { + dynamicIndentation.recomputeIndentation(false); + } + } + else if (rule.Operation.Action & 4 && currentStartLine === previousStartLine) { + lineAdded = true; + if (currentParent.getStart(sourceFile) === currentItem.pos) { + dynamicIndentation.recomputeIndentation(true); + } + } + trimTrailingWhitespaces = + (rule.Operation.Action & (4 | 2)) && + rule.Flag !== 1; + } + else { + trimTrailingWhitespaces = true; + } + if (currentStartLine !== previousStartLine && trimTrailingWhitespaces) { + trimTrailingWhitespacesForLines(previousStartLine, currentStartLine, previousItem); + } + return lineAdded; + } + function insertIndentation(pos, indentation, lineAdded) { + var indentationString = getIndentationString(indentation, options); + if (lineAdded) { + recordReplace(pos, 0, indentationString); + } + else { + var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); + if (indentation !== tokenStart.character) { + var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile); + recordReplace(startLinePosition, tokenStart.character, indentationString); + } + } + } + function indentMultilineComment(commentRange, indentation, firstLineIsIndented) { + var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; + if (startLine === endLine) { + if (!firstLineIsIndented) { + insertIndentation(commentRange.pos, indentation, false); + } + return; + } + else { + var parts = []; + var startPos = commentRange.pos; + for (var line = startLine; line < endLine; ++line) { + var endOfLine = ts.getEndLinePosition(line, sourceFile); + parts.push({ pos: startPos, end: endOfLine }); + startPos = ts.getStartPositionOfLine(line + 1, sourceFile); + } + parts.push({ pos: startPos, end: commentRange.end }); + } + var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); + var nonWhitespaceColumnInFirstPart = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePos, parts[0].pos, sourceFile, options); + if (indentation === nonWhitespaceColumnInFirstPart) { + return; + } + var startIndex = 0; + if (firstLineIsIndented) { + startIndex = 1; + startLine++; + } + var delta = indentation - nonWhitespaceColumnInFirstPart; + for (var i = startIndex, len = parts.length; i < len; ++i, ++startLine) { + var startLinePos = ts.getStartPositionOfLine(startLine, sourceFile); + var nonWhitespaceColumn = i === 0 ? nonWhitespaceColumnInFirstPart : formatting.SmartIndenter.findFirstNonWhitespaceColumn(parts[i].pos, parts[i].end, sourceFile, options); + var newIndentation = nonWhitespaceColumn + delta; + if (newIndentation > 0) { + var indentationString = getIndentationString(newIndentation, options); + recordReplace(startLinePos, nonWhitespaceColumn, indentationString); + } + else { + recordDelete(startLinePos, nonWhitespaceColumn); + } + } + } + function trimTrailingWhitespacesForLines(line1, line2, range) { + for (var line = line1; line < line2; ++line) { + var lineStartPosition = ts.getStartPositionOfLine(line, sourceFile); + var lineEndPosition = ts.getEndLinePosition(line, sourceFile); + if (range && ts.isComment(range.kind) && range.pos <= lineEndPosition && range.end > lineEndPosition) { + continue; + } + var pos = lineEndPosition; + while (pos >= lineStartPosition && ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))) { + pos--; + } + if (pos !== lineEndPosition) { + ts.Debug.assert(pos === lineStartPosition || !ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))); + recordDelete(pos + 1, lineEndPosition - pos); + } + } + } + function newTextChange(start, len, newText) { + return { span: ts.createTextSpan(start, len), newText: newText }; + } + function recordDelete(start, len) { + if (len) { + edits.push(newTextChange(start, len, "")); + } + } + function recordReplace(start, len, newText) { + if (len || newText) { + edits.push(newTextChange(start, len, newText)); + } + } + function applyRuleEdits(rule, previousRange, previousStartLine, currentRange, currentStartLine) { + var between; + switch (rule.Operation.Action) { + case 1: + return; + case 8: + if (previousRange.end !== currentRange.pos) { + recordDelete(previousRange.end, currentRange.pos - previousRange.end); + } + break; + case 4: + if (rule.Flag !== 1 && previousStartLine !== currentStartLine) { + return; + } + var lineDelta = currentStartLine - previousStartLine; + if (lineDelta !== 1) { + recordReplace(previousRange.end, currentRange.pos - previousRange.end, options.NewLineCharacter); + } + break; + case 2: + if (rule.Flag !== 1 && previousStartLine !== currentStartLine) { + return; + } + var posDelta = currentRange.pos - previousRange.end; + if (posDelta !== 1 || sourceFile.text.charCodeAt(previousRange.end) !== 32) { + recordReplace(previousRange.end, currentRange.pos - previousRange.end, " "); + } + break; + } + } + } + function isSomeBlock(kind) { + switch (kind) { + case 172: + case 199: + return true; + } + return false; + } + function getOpenTokenForList(node, list) { + switch (node.kind) { + case 131: + case 193: + case 158: + case 130: + case 129: + case 159: + if (node.typeParameters === list) { + return 24; + } + else if (node.parameters === list) { + return 16; + } + break; + case 153: + case 154: + if (node.typeArguments === list) { + return 24; + } + else if (node.arguments === list) { + return 16; + } + break; + case 137: + if (node.typeArguments === list) { + return 24; + } + } + return 0; + } + function getCloseTokenForOpenToken(kind) { + switch (kind) { + case 16: + return 17; + case 24: + return 25; + } + return 0; + } + var internedTabsIndentation; + var internedSpacesIndentation; + function getIndentationString(indentation, options) { + if (!options.ConvertTabsToSpaces) { + var tabs = Math.floor(indentation / options.TabSize); + var spaces = indentation - tabs * options.TabSize; + var tabString; + if (!internedTabsIndentation) { + internedTabsIndentation = []; + } + if (internedTabsIndentation[tabs] === undefined) { + internedTabsIndentation[tabs] = tabString = repeat('\t', tabs); + } + else { + tabString = internedTabsIndentation[tabs]; + } + return spaces ? tabString + repeat(" ", spaces) : tabString; + } + else { + var spacesString; + var quotient = Math.floor(indentation / options.IndentSize); + var remainder = indentation % options.IndentSize; + if (!internedSpacesIndentation) { + internedSpacesIndentation = []; + } + if (internedSpacesIndentation[quotient] === undefined) { + spacesString = repeat(" ", options.IndentSize * quotient); + internedSpacesIndentation[quotient] = spacesString; + } + else { + spacesString = internedSpacesIndentation[quotient]; + } + return remainder ? spacesString + repeat(" ", remainder) : spacesString; + } + function repeat(value, count) { + var s = ""; + for (var i = 0; i < count; ++i) { + s += value; + } + return s; + } + } + formatting.getIndentationString = getIndentationString; + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var formatting; + (function (formatting) { + var SmartIndenter; + (function (SmartIndenter) { + function getIndentation(position, sourceFile, options) { + if (position > sourceFile.text.length) { + return 0; + } + var precedingToken = ts.findPrecedingToken(position, sourceFile); + if (!precedingToken) { + return 0; + } + var precedingTokenIsLiteral = precedingToken.kind === 8 || + precedingToken.kind === 9 || + precedingToken.kind === 10 || + precedingToken.kind === 11 || + precedingToken.kind === 12 || + precedingToken.kind === 13; + if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { + return 0; + } + var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; + if (precedingToken.kind === 23 && precedingToken.parent.kind !== 165) { + var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation; + } + } + var previous; + var current = precedingToken; + var currentStart; + var indentationDelta; + while (current) { + if (positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current.kind, previous ? previous.kind : 0)) { + currentStart = getStartLineAndCharacterForNode(current, sourceFile); + if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { + indentationDelta = 0; + } + else { + indentationDelta = lineAtPosition !== currentStart.line ? options.IndentSize : 0; + } + break; + } + var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation; + } + previous = current; + current = current.parent; + } + if (!current) { + return 0; + } + return getIndentationForNodeWorker(current, currentStart, undefined, indentationDelta, sourceFile, options); + } + SmartIndenter.getIndentation = getIndentation; + function getIndentationForNode(n, ignoreActualIndentationRange, sourceFile, options) { + var start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); + return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, 0, sourceFile, options); + } + SmartIndenter.getIndentationForNode = getIndentationForNode; + function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, options) { + var parent = current.parent; + var parentStart; + while (parent) { + var useActualIndentation = true; + if (ignoreActualIndentationRange) { + var start = current.getStart(sourceFile); + useActualIndentation = start < ignoreActualIndentationRange.pos || start > ignoreActualIndentationRange.end; + } + if (useActualIndentation) { + var actualIndentation = getActualIndentationForListItem(current, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation + indentationDelta; + } + } + parentStart = getParentStart(parent, current, sourceFile); + var parentAndChildShareLine = parentStart.line === currentStart.line || + childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); + if (useActualIndentation) { + var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); + if (actualIndentation !== -1) { + return actualIndentation + indentationDelta; + } + } + if (shouldIndentChildNode(parent.kind, current.kind) && !parentAndChildShareLine) { + indentationDelta += options.IndentSize; + } + current = parent; + currentStart = parentStart; + parent = current.parent; + } + return indentationDelta; + } + function getParentStart(parent, child, sourceFile) { + var containingList = getContainingList(child, sourceFile); + if (containingList) { + return sourceFile.getLineAndCharacterOfPosition(containingList.pos); + } + return sourceFile.getLineAndCharacterOfPosition(parent.getStart(sourceFile)); + } + function getActualIndentationForListItemBeforeComma(commaToken, sourceFile, options) { + var commaItemInfo = ts.findListItemInfo(commaToken); + ts.Debug.assert(commaItemInfo && commaItemInfo.listItemIndex > 0); + return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options); + } + function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { + var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && + (parent.kind === 210 || !parentAndChildShareLine); + if (!useActualIndentation) { + return -1; + } + return findColumnForFirstNonWhitespaceCharacterInLine(currentLineAndChar, sourceFile, options); + } + function nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile) { + var nextToken = ts.findNextToken(precedingToken, current); + if (!nextToken) { + return false; + } + if (nextToken.kind === 14) { + return true; + } + else if (nextToken.kind === 15) { + var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; + return lineAtPosition === nextTokenStartLine; + } + return false; + } + function getStartLineAndCharacterForNode(n, sourceFile) { + return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); + } + function positionBelongsToNode(candidate, position, sourceFile) { + return candidate.end > position || !isCompletedNode(candidate, sourceFile); + } + function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { + if (parent.kind === 176 && parent.elseStatement === child) { + var elseKeyword = ts.findChildOfKind(parent, 75, sourceFile); + ts.Debug.assert(elseKeyword !== undefined); + var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; + return elseKeywordStartLine === childStartLine; + } + return false; + } + SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement = childStartsOnTheSameLineWithElseInIfStatement; + function getContainingList(node, sourceFile) { + if (node.parent) { + switch (node.parent.kind) { + case 137: + if (node.parent.typeArguments && + ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { + return node.parent.typeArguments; + } + break; + case 150: + return node.parent.properties; + case 149: + return node.parent.elements; + case 193: + case 158: + case 159: + case 130: + case 129: + case 134: + case 135: + var start = node.getStart(sourceFile); + if (node.parent.typeParameters && + ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { + return node.parent.typeParameters; + } + if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { + return node.parent.parameters; + } + break; + case 154: + case 153: + var start = node.getStart(sourceFile); + if (node.parent.typeArguments && + ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { + return node.parent.typeArguments; + } + if (node.parent.arguments && + ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { + return node.parent.arguments; + } + break; + } + } + return undefined; + } + function getActualIndentationForListItem(node, sourceFile, options) { + var containingList = getContainingList(node, sourceFile); + return containingList ? getActualIndentationFromList(containingList) : -1; + function getActualIndentationFromList(list) { + var index = ts.indexOf(list, node); + return index !== -1 ? deriveActualIndentationFromList(list, index, sourceFile, options) : -1; + } + } + function deriveActualIndentationFromList(list, index, sourceFile, options) { + ts.Debug.assert(index >= 0 && index < list.length); + var node = list[index]; + var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile); + for (var i = index - 1; i >= 0; --i) { + if (list[i].kind === 23) { + continue; + } + var prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line; + if (prevEndLine !== lineAndCharacter.line) { + return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); + } + lineAndCharacter = getStartLineAndCharacterForNode(list[i], sourceFile); + } + return -1; + } + function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options) { + var lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0); + return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options); + } + function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) { + var column = 0; + for (var pos = startPos; pos < endPos; ++pos) { + var ch = sourceFile.text.charCodeAt(pos); + if (!ts.isWhiteSpace(ch)) { + return column; + } + if (ch === 9) { + column += options.TabSize + (column % options.TabSize); + } + else { + column++; + } + } + return column; + } + SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; + function nodeContentIsAlwaysIndented(kind) { + switch (kind) { + case 194: + case 195: + case 197: + case 149: + case 172: + case 199: + case 150: + case 141: + case 186: + case 204: + case 203: + case 157: + case 153: + case 154: + case 173: + case 191: + case 201: + case 184: + case 166: + return true; + } + return false; + } + function shouldIndentChildNode(parent, child) { + if (nodeContentIsAlwaysIndented(parent)) { + return true; + } + switch (parent) { + case 177: + case 178: + case 180: + case 181: + case 179: + case 176: + case 193: + case 158: + case 130: + case 129: + case 159: + case 131: + case 132: + case 133: + return child !== 172; + default: + return false; + } + } + SmartIndenter.shouldIndentChildNode = shouldIndentChildNode; + function nodeEndsWith(n, expectedLastToken, sourceFile) { + var children = n.getChildren(sourceFile); + if (children.length) { + var last = children[children.length - 1]; + if (last.kind === expectedLastToken) { + return true; + } + else if (last.kind === 22 && children.length !== 1) { + return children[children.length - 2].kind === expectedLastToken; + } + } + return false; + } + function isCompletedNode(n, sourceFile) { + if (n.getFullWidth() === 0) { + return false; + } + switch (n.kind) { + case 194: + case 195: + case 197: + case 150: + case 172: + case 199: + case 186: + return nodeEndsWith(n, 15, sourceFile); + case 206: + return isCompletedNode(n.block, sourceFile); + case 157: + case 134: + case 153: + case 135: + return nodeEndsWith(n, 17, sourceFile); + case 193: + case 158: + case 130: + case 129: + case 159: + return !n.body || isCompletedNode(n.body, sourceFile); + case 198: + return n.body && isCompletedNode(n.body, sourceFile); + case 176: + if (n.elseStatement) { + return isCompletedNode(n.elseStatement, sourceFile); + } + return isCompletedNode(n.thenStatement, sourceFile); + case 175: + return isCompletedNode(n.expression, sourceFile); + case 149: + return nodeEndsWith(n, 19, sourceFile); + case 203: + case 204: + return false; + case 178: + return isCompletedNode(n.statement, sourceFile); + case 177: + var hasWhileKeyword = ts.findChildOfKind(n, 99, sourceFile); + if (hasWhileKeyword) { + return nodeEndsWith(n, 17, sourceFile); + } + return isCompletedNode(n.statement, sourceFile); + default: + return true; + } + } + })(SmartIndenter = formatting.SmartIndenter || (formatting.SmartIndenter = {})); + })(formatting = ts.formatting || (ts.formatting = {})); +})(ts || (ts = {})); +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var ts; +(function (ts) { + ts.servicesVersion = "0.4"; + var ScriptSnapshot; + (function (ScriptSnapshot) { + var StringScriptSnapshot = (function () { + function StringScriptSnapshot(text) { + this.text = text; + this._lineStartPositions = undefined; + } + StringScriptSnapshot.prototype.getText = function (start, end) { + return this.text.substring(start, end); + }; + StringScriptSnapshot.prototype.getLength = function () { + return this.text.length; + }; + StringScriptSnapshot.prototype.getChangeRange = function (oldSnapshot) { + return undefined; + }; + return StringScriptSnapshot; + })(); + function fromString(text) { + return new StringScriptSnapshot(text); + } + ScriptSnapshot.fromString = fromString; + })(ScriptSnapshot = ts.ScriptSnapshot || (ts.ScriptSnapshot = {})); + var scanner = ts.createScanner(2, true); + var emptyArray = []; + function createNode(kind, pos, end, flags, parent) { + var node = new (ts.getNodeConstructor(kind))(); + node.pos = pos; + node.end = end; + node.flags = flags; + node.parent = parent; + return node; + } + var NodeObject = (function () { + function NodeObject() { + } + NodeObject.prototype.getSourceFile = function () { + return ts.getSourceFileOfNode(this); + }; + NodeObject.prototype.getStart = function (sourceFile) { + return ts.getTokenPosOfNode(this, sourceFile); + }; + NodeObject.prototype.getFullStart = function () { + return this.pos; + }; + NodeObject.prototype.getEnd = function () { + return this.end; + }; + NodeObject.prototype.getWidth = function (sourceFile) { + return this.getEnd() - this.getStart(sourceFile); + }; + NodeObject.prototype.getFullWidth = function () { + return this.end - this.getFullStart(); + }; + NodeObject.prototype.getLeadingTriviaWidth = function (sourceFile) { + return this.getStart(sourceFile) - this.pos; + }; + NodeObject.prototype.getFullText = function (sourceFile) { + return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); + }; + NodeObject.prototype.getText = function (sourceFile) { + return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd()); + }; + NodeObject.prototype.addSyntheticNodes = function (nodes, pos, end) { + scanner.setTextPos(pos); + while (pos < end) { + var token = scanner.scan(); + var textPos = scanner.getTextPos(); + nodes.push(createNode(token, pos, textPos, 512, this)); + pos = textPos; + } + return pos; + }; + NodeObject.prototype.createSyntaxList = function (nodes) { + var list = createNode(211, nodes.pos, nodes.end, 512, this); + list._children = []; + var pos = nodes.pos; + for (var i = 0, len = nodes.length; i < len; i++) { + var node = nodes[i]; + if (pos < node.pos) { + pos = this.addSyntheticNodes(list._children, pos, node.pos); + } + list._children.push(node); + pos = node.end; + } + if (pos < nodes.end) { + this.addSyntheticNodes(list._children, pos, nodes.end); + } + return list; + }; + NodeObject.prototype.createChildren = function (sourceFile) { + var _this = this; + if (this.kind >= 123) { + scanner.setText((sourceFile || this.getSourceFile()).text); + var children = []; + var pos = this.pos; + var processNode = function (node) { + if (pos < node.pos) { + pos = _this.addSyntheticNodes(children, pos, node.pos); + } + children.push(node); + pos = node.end; + }; + var processNodes = function (nodes) { + if (pos < nodes.pos) { + pos = _this.addSyntheticNodes(children, pos, nodes.pos); + } + children.push(_this.createSyntaxList(nodes)); + pos = nodes.end; + }; + ts.forEachChild(this, processNode, processNodes); + if (pos < this.end) { + this.addSyntheticNodes(children, pos, this.end); + } + scanner.setText(undefined); + } + this._children = children || emptyArray; + }; + NodeObject.prototype.getChildCount = function (sourceFile) { + if (!this._children) + this.createChildren(sourceFile); + return this._children.length; + }; + NodeObject.prototype.getChildAt = function (index, sourceFile) { + if (!this._children) + this.createChildren(sourceFile); + return this._children[index]; + }; + NodeObject.prototype.getChildren = function (sourceFile) { + if (!this._children) + this.createChildren(sourceFile); + return this._children; + }; + NodeObject.prototype.getFirstToken = function (sourceFile) { + var children = this.getChildren(); + for (var i = 0; i < children.length; i++) { + var child = children[i]; + if (child.kind < 123) { + return child; + } + return child.getFirstToken(sourceFile); + } + }; + NodeObject.prototype.getLastToken = function (sourceFile) { + var children = this.getChildren(sourceFile); + for (var i = children.length - 1; i >= 0; i--) { + var child = children[i]; + if (child.kind < 123) { + return child; + } + return child.getLastToken(sourceFile); + } + }; + return NodeObject; + })(); + var SymbolObject = (function () { + function SymbolObject(flags, name) { + this.flags = flags; + this.name = name; + } + SymbolObject.prototype.getFlags = function () { + return this.flags; + }; + SymbolObject.prototype.getName = function () { + return this.name; + }; + SymbolObject.prototype.getDeclarations = function () { + return this.declarations; + }; + SymbolObject.prototype.getDocumentationComment = function () { + if (this.documentationComment === undefined) { + this.documentationComment = getJsDocCommentsFromDeclarations(this.declarations, this.name, !(this.flags & 4)); + } + return this.documentationComment; + }; + return SymbolObject; + })(); + function getJsDocCommentsFromDeclarations(declarations, name, canUseParsedParamTagComments) { + var documentationComment = []; + var docComments = getJsDocCommentsSeparatedByNewLines(); + ts.forEach(docComments, function (docComment) { + if (documentationComment.length) { + documentationComment.push(ts.lineBreakPart()); + } + documentationComment.push(docComment); + }); + return documentationComment; + function getJsDocCommentsSeparatedByNewLines() { + var paramTag = "@param"; + var jsDocCommentParts = []; + ts.forEach(declarations, function (declaration, indexOfDeclaration) { + if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { + var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); + if (canUseParsedParamTagComments && declaration.kind === 126) { + ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); + if (cleanedParamJsDocComment) { + jsDocCommentParts.push.apply(jsDocCommentParts, cleanedParamJsDocComment); + } + }); + } + if (declaration.kind === 198 && declaration.body.kind === 198) { + return; + } + while (declaration.kind === 198 && declaration.parent.kind === 198) { + declaration = declaration.parent; + } + ts.forEach(getJsDocCommentTextRange(declaration.kind === 191 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); + if (cleanedJsDocComment) { + jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); + } + }); + } + }); + return jsDocCommentParts; + function getJsDocCommentTextRange(node, sourceFile) { + return ts.map(ts.getJsDocComments(node, sourceFile), function (jsDocComment) { + return { + pos: jsDocComment.pos + "/*".length, + end: jsDocComment.end - "*/".length + }; + }); + } + function consumeWhiteSpacesOnTheLine(pos, end, sourceFile, maxSpacesToRemove) { + if (maxSpacesToRemove !== undefined) { + end = Math.min(end, pos + maxSpacesToRemove); + } + for (; pos < end; pos++) { + var ch = sourceFile.text.charCodeAt(pos); + if (!ts.isWhiteSpace(ch) || ts.isLineBreak(ch)) { + return pos; + } + } + return end; + } + function consumeLineBreaks(pos, end, sourceFile) { + while (pos < end && ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + pos++; + } + return pos; + } + function isName(pos, end, sourceFile, name) { + return pos + name.length < end && + sourceFile.text.substr(pos, name.length) === name && + (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || + ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); + } + function isParamTag(pos, end, sourceFile) { + return isName(pos, end, sourceFile, paramTag); + } + function pushDocCommentLineText(docComments, text, blankLineCount) { + while (blankLineCount--) + docComments.push(ts.textPart("")); + docComments.push(ts.textPart(text)); + } + function getCleanedJsDocComment(pos, end, sourceFile) { + var spacesToRemoveAfterAsterisk; + var docComments = []; + var blankLineCount = 0; + var isInParamTag = false; + while (pos < end) { + var docCommentTextOfLine = ""; + pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile); + if (pos < end && sourceFile.text.charCodeAt(pos) === 42) { + var lineStartPos = pos + 1; + pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, spacesToRemoveAfterAsterisk); + if (spacesToRemoveAfterAsterisk === undefined && pos < end && !ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + spacesToRemoveAfterAsterisk = pos - lineStartPos; + } + } + else if (spacesToRemoveAfterAsterisk === undefined) { + spacesToRemoveAfterAsterisk = 0; + } + while (pos < end && !ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + var ch = sourceFile.text.charAt(pos); + if (ch === "@") { + if (isParamTag(pos, end, sourceFile)) { + isInParamTag = true; + pos += paramTag.length; + continue; + } + else { + isInParamTag = false; + } + } + if (!isInParamTag) { + docCommentTextOfLine += ch; + } + pos++; + } + pos = consumeLineBreaks(pos, end, sourceFile); + if (docCommentTextOfLine) { + pushDocCommentLineText(docComments, docCommentTextOfLine, blankLineCount); + blankLineCount = 0; + } + else if (!isInParamTag && docComments.length) { + blankLineCount++; + } + } + return docComments; + } + function getCleanedParamJsDocComment(pos, end, sourceFile) { + var paramHelpStringMargin; + var paramDocComments = []; + while (pos < end) { + if (isParamTag(pos, end, sourceFile)) { + var blankLineCount = 0; + var recordedParamTag = false; + pos = consumeWhiteSpaces(pos + paramTag.length); + if (pos >= end) { + break; + } + if (sourceFile.text.charCodeAt(pos) === 123) { + pos++; + for (var curlies = 1; pos < end; pos++) { + var charCode = sourceFile.text.charCodeAt(pos); + if (charCode === 123) { + curlies++; + continue; + } + if (charCode === 125) { + curlies--; + if (curlies === 0) { + pos++; + break; + } + else { + continue; + } + } + if (charCode === 64) { + break; + } + } + pos = consumeWhiteSpaces(pos); + if (pos >= end) { + break; + } + } + if (isName(pos, end, sourceFile, name)) { + pos = consumeWhiteSpaces(pos + name.length); + if (pos >= end) { + break; + } + var paramHelpString = ""; + var firstLineParamHelpStringPos = pos; + while (pos < end) { + var ch = sourceFile.text.charCodeAt(pos); + if (ts.isLineBreak(ch)) { + if (paramHelpString) { + pushDocCommentLineText(paramDocComments, paramHelpString, blankLineCount); + paramHelpString = ""; + blankLineCount = 0; + recordedParamTag = true; + } + else if (recordedParamTag) { + blankLineCount++; + } + setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos); + continue; + } + if (ch === 64) { + break; + } + paramHelpString += sourceFile.text.charAt(pos); + pos++; + } + if (paramHelpString) { + pushDocCommentLineText(paramDocComments, paramHelpString, blankLineCount); + } + paramHelpStringMargin = undefined; + } + if (sourceFile.text.charCodeAt(pos) === 64) { + continue; + } + } + pos++; + } + return paramDocComments; + function consumeWhiteSpaces(pos) { + while (pos < end && ts.isWhiteSpace(sourceFile.text.charCodeAt(pos))) { + pos++; + } + return pos; + } + function setPosForParamHelpStringOnNextLine(firstLineParamHelpStringPos) { + pos = consumeLineBreaks(pos, end, sourceFile); + if (pos >= end) { + return; + } + if (paramHelpStringMargin === undefined) { + paramHelpStringMargin = sourceFile.getLineAndCharacterOfPosition(firstLineParamHelpStringPos).character; + } + var startOfLinePos = pos; + pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile, paramHelpStringMargin); + if (pos >= end) { + return; + } + var consumedSpaces = pos - startOfLinePos; + if (consumedSpaces < paramHelpStringMargin) { + var ch = sourceFile.text.charCodeAt(pos); + if (ch === 42) { + pos = consumeWhiteSpacesOnTheLine(pos + 1, end, sourceFile, paramHelpStringMargin - consumedSpaces - 1); + } + } + } + } + } + } + var TypeObject = (function () { + function TypeObject(checker, flags) { + this.checker = checker; + this.flags = flags; + } + TypeObject.prototype.getFlags = function () { + return this.flags; + }; + TypeObject.prototype.getSymbol = function () { + return this.symbol; + }; + TypeObject.prototype.getProperties = function () { + return this.checker.getPropertiesOfType(this); + }; + TypeObject.prototype.getProperty = function (propertyName) { + return this.checker.getPropertyOfType(this, propertyName); + }; + TypeObject.prototype.getApparentProperties = function () { + return this.checker.getAugmentedPropertiesOfType(this); + }; + TypeObject.prototype.getCallSignatures = function () { + return this.checker.getSignaturesOfType(this, 0); + }; + TypeObject.prototype.getConstructSignatures = function () { + return this.checker.getSignaturesOfType(this, 1); + }; + TypeObject.prototype.getStringIndexType = function () { + return this.checker.getIndexTypeOfType(this, 0); + }; + TypeObject.prototype.getNumberIndexType = function () { + return this.checker.getIndexTypeOfType(this, 1); + }; + return TypeObject; + })(); + var SignatureObject = (function () { + function SignatureObject(checker) { + this.checker = checker; + } + SignatureObject.prototype.getDeclaration = function () { + return this.declaration; + }; + SignatureObject.prototype.getTypeParameters = function () { + return this.typeParameters; + }; + SignatureObject.prototype.getParameters = function () { + return this.parameters; + }; + SignatureObject.prototype.getReturnType = function () { + return this.checker.getReturnTypeOfSignature(this); + }; + SignatureObject.prototype.getDocumentationComment = function () { + if (this.documentationComment === undefined) { + this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([this.declaration], undefined, false) : []; + } + return this.documentationComment; + }; + return SignatureObject; + })(); + var SourceFileObject = (function (_super) { + __extends(SourceFileObject, _super); + function SourceFileObject() { + _super.apply(this, arguments); + } + SourceFileObject.prototype.update = function (newText, textChangeRange) { + return ts.updateSourceFile(this, newText, textChangeRange); + }; + SourceFileObject.prototype.getLineAndCharacterOfPosition = function (position) { + return ts.getLineAndCharacterOfPosition(this, position); + }; + SourceFileObject.prototype.getLineStarts = function () { + return ts.getLineStarts(this); + }; + SourceFileObject.prototype.getPositionOfLineAndCharacter = function (line, character) { + return ts.getPositionOfLineAndCharacter(this, line, character); + }; + SourceFileObject.prototype.getNamedDeclarations = function () { + if (!this.namedDeclarations) { + var sourceFile = this; + var namedDeclarations = []; + ts.forEachChild(sourceFile, function visit(node) { + switch (node.kind) { + case 193: + case 130: + case 129: + var functionDeclaration = node; + if (functionDeclaration.name && functionDeclaration.name.getFullWidth() > 0) { + var lastDeclaration = namedDeclarations.length > 0 ? namedDeclarations[namedDeclarations.length - 1] : undefined; + if (lastDeclaration && functionDeclaration.symbol === lastDeclaration.symbol) { + if (functionDeclaration.body && !lastDeclaration.body) { + namedDeclarations[namedDeclarations.length - 1] = functionDeclaration; + } + } + else { + namedDeclarations.push(functionDeclaration); + } + ts.forEachChild(node, visit); + } + break; + case 194: + case 195: + case 196: + case 197: + case 198: + case 200: + case 132: + case 133: + case 141: + if (node.name) { + namedDeclarations.push(node); + } + case 131: + case 173: + case 192: + case 146: + case 147: + case 199: + ts.forEachChild(node, visit); + break; + case 172: + if (ts.isFunctionBlock(node)) { + ts.forEachChild(node, visit); + } + break; + case 126: + if (!(node.flags & 112)) { + break; + } + case 191: + case 148: + if (ts.isBindingPattern(node.name)) { + ts.forEachChild(node.name, visit); + break; + } + case 209: + case 128: + case 127: + namedDeclarations.push(node); + break; + } + }); + this.namedDeclarations = namedDeclarations; + } + return this.namedDeclarations; + }; + return SourceFileObject; + })(NodeObject); + var TextChange = (function () { + function TextChange() { + } + return TextChange; + })(); + ts.TextChange = TextChange; + (function (SymbolDisplayPartKind) { + SymbolDisplayPartKind[SymbolDisplayPartKind["aliasName"] = 0] = "aliasName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["className"] = 1] = "className"; + SymbolDisplayPartKind[SymbolDisplayPartKind["enumName"] = 2] = "enumName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["fieldName"] = 3] = "fieldName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["interfaceName"] = 4] = "interfaceName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["keyword"] = 5] = "keyword"; + SymbolDisplayPartKind[SymbolDisplayPartKind["lineBreak"] = 6] = "lineBreak"; + SymbolDisplayPartKind[SymbolDisplayPartKind["numericLiteral"] = 7] = "numericLiteral"; + SymbolDisplayPartKind[SymbolDisplayPartKind["stringLiteral"] = 8] = "stringLiteral"; + SymbolDisplayPartKind[SymbolDisplayPartKind["localName"] = 9] = "localName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["methodName"] = 10] = "methodName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["moduleName"] = 11] = "moduleName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["operator"] = 12] = "operator"; + SymbolDisplayPartKind[SymbolDisplayPartKind["parameterName"] = 13] = "parameterName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["propertyName"] = 14] = "propertyName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["punctuation"] = 15] = "punctuation"; + SymbolDisplayPartKind[SymbolDisplayPartKind["space"] = 16] = "space"; + SymbolDisplayPartKind[SymbolDisplayPartKind["text"] = 17] = "text"; + SymbolDisplayPartKind[SymbolDisplayPartKind["typeParameterName"] = 18] = "typeParameterName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["enumMemberName"] = 19] = "enumMemberName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["functionName"] = 20] = "functionName"; + SymbolDisplayPartKind[SymbolDisplayPartKind["regularExpressionLiteral"] = 21] = "regularExpressionLiteral"; + })(ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {})); + var SymbolDisplayPartKind = ts.SymbolDisplayPartKind; + (function (OutputFileType) { + OutputFileType[OutputFileType["JavaScript"] = 0] = "JavaScript"; + OutputFileType[OutputFileType["SourceMap"] = 1] = "SourceMap"; + OutputFileType[OutputFileType["Declaration"] = 2] = "Declaration"; + })(ts.OutputFileType || (ts.OutputFileType = {})); + var OutputFileType = ts.OutputFileType; + (function (EndOfLineState) { + EndOfLineState[EndOfLineState["Start"] = 0] = "Start"; + EndOfLineState[EndOfLineState["InMultiLineCommentTrivia"] = 1] = "InMultiLineCommentTrivia"; + EndOfLineState[EndOfLineState["InSingleQuoteStringLiteral"] = 2] = "InSingleQuoteStringLiteral"; + EndOfLineState[EndOfLineState["InDoubleQuoteStringLiteral"] = 3] = "InDoubleQuoteStringLiteral"; + EndOfLineState[EndOfLineState["InTemplateHeadOrNoSubstitutionTemplate"] = 4] = "InTemplateHeadOrNoSubstitutionTemplate"; + EndOfLineState[EndOfLineState["InTemplateMiddleOrTail"] = 5] = "InTemplateMiddleOrTail"; + EndOfLineState[EndOfLineState["InTemplateSubstitutionPosition"] = 6] = "InTemplateSubstitutionPosition"; + })(ts.EndOfLineState || (ts.EndOfLineState = {})); + var EndOfLineState = ts.EndOfLineState; + (function (TokenClass) { + TokenClass[TokenClass["Punctuation"] = 0] = "Punctuation"; + TokenClass[TokenClass["Keyword"] = 1] = "Keyword"; + TokenClass[TokenClass["Operator"] = 2] = "Operator"; + TokenClass[TokenClass["Comment"] = 3] = "Comment"; + TokenClass[TokenClass["Whitespace"] = 4] = "Whitespace"; + TokenClass[TokenClass["Identifier"] = 5] = "Identifier"; + TokenClass[TokenClass["NumberLiteral"] = 6] = "NumberLiteral"; + TokenClass[TokenClass["StringLiteral"] = 7] = "StringLiteral"; + TokenClass[TokenClass["RegExpLiteral"] = 8] = "RegExpLiteral"; + })(ts.TokenClass || (ts.TokenClass = {})); + var TokenClass = ts.TokenClass; + var ScriptElementKind = (function () { + function ScriptElementKind() { + } + ScriptElementKind.unknown = ""; + ScriptElementKind.keyword = "keyword"; + ScriptElementKind.scriptElement = "script"; + ScriptElementKind.moduleElement = "module"; + ScriptElementKind.classElement = "class"; + ScriptElementKind.interfaceElement = "interface"; + ScriptElementKind.typeElement = "type"; + ScriptElementKind.enumElement = "enum"; + ScriptElementKind.variableElement = "var"; + ScriptElementKind.localVariableElement = "local var"; + ScriptElementKind.functionElement = "function"; + ScriptElementKind.localFunctionElement = "local function"; + ScriptElementKind.memberFunctionElement = "method"; + ScriptElementKind.memberGetAccessorElement = "getter"; + ScriptElementKind.memberSetAccessorElement = "setter"; + ScriptElementKind.memberVariableElement = "property"; + ScriptElementKind.constructorImplementationElement = "constructor"; + ScriptElementKind.callSignatureElement = "call"; + ScriptElementKind.indexSignatureElement = "index"; + ScriptElementKind.constructSignatureElement = "construct"; + ScriptElementKind.parameterElement = "parameter"; + ScriptElementKind.typeParameterElement = "type parameter"; + ScriptElementKind.primitiveType = "primitive type"; + ScriptElementKind.label = "label"; + ScriptElementKind.alias = "alias"; + ScriptElementKind.constElement = "const"; + ScriptElementKind.letElement = "let"; + return ScriptElementKind; + })(); + ts.ScriptElementKind = ScriptElementKind; + var ScriptElementKindModifier = (function () { + function ScriptElementKindModifier() { + } + ScriptElementKindModifier.none = ""; + ScriptElementKindModifier.publicMemberModifier = "public"; + ScriptElementKindModifier.privateMemberModifier = "private"; + ScriptElementKindModifier.protectedMemberModifier = "protected"; + ScriptElementKindModifier.exportedModifier = "export"; + ScriptElementKindModifier.ambientModifier = "declare"; + ScriptElementKindModifier.staticModifier = "static"; + return ScriptElementKindModifier; + })(); + ts.ScriptElementKindModifier = ScriptElementKindModifier; + var ClassificationTypeNames = (function () { + function ClassificationTypeNames() { + } + ClassificationTypeNames.comment = "comment"; + ClassificationTypeNames.identifier = "identifier"; + ClassificationTypeNames.keyword = "keyword"; + ClassificationTypeNames.numericLiteral = "number"; + ClassificationTypeNames.operator = "operator"; + ClassificationTypeNames.stringLiteral = "string"; + ClassificationTypeNames.whiteSpace = "whitespace"; + ClassificationTypeNames.text = "text"; + ClassificationTypeNames.punctuation = "punctuation"; + ClassificationTypeNames.className = "class name"; + ClassificationTypeNames.enumName = "enum name"; + ClassificationTypeNames.interfaceName = "interface name"; + ClassificationTypeNames.moduleName = "module name"; + ClassificationTypeNames.typeParameterName = "type parameter name"; + ClassificationTypeNames.typeAlias = "type alias name"; + return ClassificationTypeNames; + })(); + ts.ClassificationTypeNames = ClassificationTypeNames; + function displayPartsToString(displayParts) { + if (displayParts) { + return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join(""); + } + return ""; + } + ts.displayPartsToString = displayPartsToString; + function isLocalVariableOrFunction(symbol) { + if (symbol.parent) { + return false; + } + return ts.forEach(symbol.declarations, function (declaration) { + if (declaration.kind === 158) { + return true; + } + if (declaration.kind !== 191 && declaration.kind !== 193) { + return false; + } + for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { + if (parent.kind === 210 || parent.kind === 199) { + return false; + } + } + return true; + }); + } + function getDefaultCompilerOptions() { + return { + target: 1, + module: 0 + }; + } + ts.getDefaultCompilerOptions = getDefaultCompilerOptions; + var OperationCanceledException = (function () { + function OperationCanceledException() { + } + return OperationCanceledException; + })(); + ts.OperationCanceledException = OperationCanceledException; + var CancellationTokenObject = (function () { + function CancellationTokenObject(cancellationToken) { + this.cancellationToken = cancellationToken; + } + CancellationTokenObject.prototype.isCancellationRequested = function () { + return this.cancellationToken && this.cancellationToken.isCancellationRequested(); + }; + CancellationTokenObject.prototype.throwIfCancellationRequested = function () { + if (this.isCancellationRequested()) { + throw new OperationCanceledException(); + } + }; + CancellationTokenObject.None = new CancellationTokenObject(null); + return CancellationTokenObject; + })(); + ts.CancellationTokenObject = CancellationTokenObject; + var HostCache = (function () { + function HostCache(host) { + this.host = host; + this.fileNameToEntry = {}; + var rootFileNames = host.getScriptFileNames(); + for (var i = 0, n = rootFileNames.length; i < n; i++) { + this.createEntry(rootFileNames[i]); + } + this._compilationSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); + } + HostCache.prototype.compilationSettings = function () { + return this._compilationSettings; + }; + HostCache.prototype.createEntry = function (fileName) { + var entry; + var scriptSnapshot = this.host.getScriptSnapshot(fileName); + if (scriptSnapshot) { + entry = { + hostFileName: fileName, + version: this.host.getScriptVersion(fileName), + scriptSnapshot: scriptSnapshot + }; + } + return this.fileNameToEntry[ts.normalizeSlashes(fileName)] = entry; + }; + HostCache.prototype.getEntry = function (fileName) { + return ts.lookUp(this.fileNameToEntry, ts.normalizeSlashes(fileName)); + }; + HostCache.prototype.contains = function (fileName) { + return ts.hasProperty(this.fileNameToEntry, ts.normalizeSlashes(fileName)); + }; + HostCache.prototype.getOrCreateEntry = function (fileName) { + if (this.contains(fileName)) { + return this.getEntry(fileName); + } + return this.createEntry(fileName); + }; + HostCache.prototype.getRootFileNames = function () { + var _this = this; + var fileNames = []; + ts.forEachKey(this.fileNameToEntry, function (key) { + if (ts.hasProperty(_this.fileNameToEntry, key) && _this.fileNameToEntry[key]) + fileNames.push(key); + }); + return fileNames; + }; + HostCache.prototype.getVersion = function (fileName) { + var file = this.getEntry(fileName); + return file && file.version; + }; + HostCache.prototype.getScriptSnapshot = function (fileName) { + var file = this.getEntry(fileName); + return file && file.scriptSnapshot; + }; + HostCache.prototype.getChangeRange = function (fileName, lastKnownVersion, oldScriptSnapshot) { + var currentVersion = this.getVersion(fileName); + if (lastKnownVersion === currentVersion) { + return ts.unchangedTextChangeRange; + } + var scriptSnapshot = this.getScriptSnapshot(fileName); + return scriptSnapshot.getChangeRange(oldScriptSnapshot); + }; + return HostCache; + })(); + var SyntaxTreeCache = (function () { + function SyntaxTreeCache(host) { + this.host = host; + this.currentFileName = ""; + this.currentFileVersion = null; + this.currentSourceFile = null; + } + SyntaxTreeCache.prototype.log = function (message) { + if (this.host.log) { + this.host.log(message); + } + }; + SyntaxTreeCache.prototype.initialize = function (fileName) { + var start = new Date().getTime(); + this.hostCache = new HostCache(this.host); + this.log("SyntaxTreeCache.Initialize: new HostCache: " + (new Date().getTime() - start)); + var version = this.hostCache.getVersion(fileName); + var sourceFile; + if (this.currentFileName !== fileName) { + var scriptSnapshot = this.hostCache.getScriptSnapshot(fileName); + var start = new Date().getTime(); + sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 2, version, true); + this.log("SyntaxTreeCache.Initialize: createSourceFile: " + (new Date().getTime() - start)); + } + else if (this.currentFileVersion !== version) { + var scriptSnapshot = this.hostCache.getScriptSnapshot(fileName); + var editRange = this.hostCache.getChangeRange(fileName, this.currentFileVersion, this.currentSourceFile.scriptSnapshot); + var start = new Date().getTime(); + sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, version, editRange); + this.log("SyntaxTreeCache.Initialize: updateSourceFile: " + (new Date().getTime() - start)); + } + if (sourceFile) { + this.currentFileVersion = version; + this.currentFileName = fileName; + this.currentSourceFile = sourceFile; + } + }; + SyntaxTreeCache.prototype.getCurrentSourceFile = function (fileName) { + this.initialize(fileName); + return this.currentSourceFile; + }; + SyntaxTreeCache.prototype.getCurrentScriptSnapshot = function (fileName) { + return this.getCurrentSourceFile(fileName).scriptSnapshot; + }; + return SyntaxTreeCache; + })(); + function setSourceFileFields(sourceFile, scriptSnapshot, version) { + sourceFile.version = version; + sourceFile.scriptSnapshot = scriptSnapshot; + } + function createLanguageServiceSourceFile(fileName, scriptSnapshot, scriptTarget, version, setNodeParents) { + var sourceFile = ts.createSourceFile(fileName, scriptSnapshot.getText(0, scriptSnapshot.getLength()), scriptTarget, setNodeParents); + setSourceFileFields(sourceFile, scriptSnapshot, version); + sourceFile.nameTable = sourceFile.identifiers; + return sourceFile; + } + ts.createLanguageServiceSourceFile = createLanguageServiceSourceFile; + ts.disableIncrementalParsing = false; + function updateLanguageServiceSourceFile(sourceFile, scriptSnapshot, version, textChangeRange, aggressiveChecks) { + if (textChangeRange) { + if (version !== sourceFile.version) { + if (!ts.disableIncrementalParsing) { + var newSourceFile = ts.updateSourceFile(sourceFile, scriptSnapshot.getText(0, scriptSnapshot.getLength()), textChangeRange, aggressiveChecks); + setSourceFileFields(newSourceFile, scriptSnapshot, version); + newSourceFile.nameTable = undefined; + return newSourceFile; + } + } + } + return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, true); + } + ts.updateLanguageServiceSourceFile = updateLanguageServiceSourceFile; + function createDocumentRegistry() { + var buckets = {}; + function getKeyFromCompilationSettings(settings) { + return "_" + settings.target; + } + function getBucketForCompilationSettings(settings, createIfMissing) { + var key = getKeyFromCompilationSettings(settings); + var bucket = ts.lookUp(buckets, key); + if (!bucket && createIfMissing) { + buckets[key] = bucket = {}; + } + return bucket; + } + function reportStats() { + var bucketInfoArray = Object.keys(buckets).filter(function (name) { return name && name.charAt(0) === '_'; }).map(function (name) { + var entries = ts.lookUp(buckets, name); + var sourceFiles = []; + for (var i in entries) { + var entry = entries[i]; + sourceFiles.push({ + name: i, + refCount: entry.refCount, + references: entry.owners.slice(0) + }); + } + sourceFiles.sort(function (x, y) { return y.refCount - x.refCount; }); + return { + bucket: name, + sourceFiles: sourceFiles + }; + }); + return JSON.stringify(bucketInfoArray, null, 2); + } + function acquireDocument(fileName, compilationSettings, scriptSnapshot, version) { + var bucket = getBucketForCompilationSettings(compilationSettings, true); + var entry = ts.lookUp(bucket, fileName); + if (!entry) { + var sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, false); + bucket[fileName] = entry = { + sourceFile: sourceFile, + refCount: 0, + owners: [] + }; + } + entry.refCount++; + return entry.sourceFile; + } + function updateDocument(sourceFile, fileName, compilationSettings, scriptSnapshot, version, textChangeRange) { + var bucket = getBucketForCompilationSettings(compilationSettings, false); + ts.Debug.assert(bucket !== undefined); + var entry = ts.lookUp(bucket, fileName); + ts.Debug.assert(entry !== undefined); + entry.sourceFile = updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, textChangeRange); + return entry.sourceFile; + } + function releaseDocument(fileName, compilationSettings) { + var bucket = getBucketForCompilationSettings(compilationSettings, false); + ts.Debug.assert(bucket !== undefined); + var entry = ts.lookUp(bucket, fileName); + entry.refCount--; + ts.Debug.assert(entry.refCount >= 0); + if (entry.refCount === 0) { + delete bucket[fileName]; + } + } + return { + acquireDocument: acquireDocument, + updateDocument: updateDocument, + releaseDocument: releaseDocument, + reportStats: reportStats + }; + } + ts.createDocumentRegistry = createDocumentRegistry; + function preProcessFile(sourceText, readImportFiles) { + if (readImportFiles === void 0) { readImportFiles = true; } + var referencedFiles = []; + var importedFiles = []; + var isNoDefaultLib = false; + function processTripleSlashDirectives() { + var commentRanges = ts.getLeadingCommentRanges(sourceText, 0); + ts.forEach(commentRanges, function (commentRange) { + var comment = sourceText.substring(commentRange.pos, commentRange.end); + var referencePathMatchResult = ts.getFileReferenceFromReferencePath(comment, commentRange); + if (referencePathMatchResult) { + isNoDefaultLib = referencePathMatchResult.isNoDefaultLib; + var fileReference = referencePathMatchResult.fileReference; + if (fileReference) { + referencedFiles.push(fileReference); + } + } + }); + } + function processImport() { + scanner.setText(sourceText); + var token = scanner.scan(); + while (token !== 1) { + if (token === 84) { + token = scanner.scan(); + if (token === 64) { + token = scanner.scan(); + if (token === 52) { + token = scanner.scan(); + if (token === 116) { + token = scanner.scan(); + if (token === 16) { + token = scanner.scan(); + if (token === 8) { + var importPath = scanner.getTokenValue(); + var pos = scanner.getTokenPos(); + importedFiles.push({ + fileName: importPath, + pos: pos, + end: pos + importPath.length + }); + } + } + } + } + } + } + token = scanner.scan(); + } + scanner.setText(undefined); + } + if (readImportFiles) { + processImport(); + } + processTripleSlashDirectives(); + return { referencedFiles: referencedFiles, importedFiles: importedFiles, isLibFile: isNoDefaultLib }; + } + ts.preProcessFile = preProcessFile; + function getTargetLabel(referenceNode, labelName) { + while (referenceNode) { + if (referenceNode.kind === 187 && referenceNode.label.text === labelName) { + return referenceNode.label; + } + referenceNode = referenceNode.parent; + } + return undefined; + } + function isJumpStatementTarget(node) { + return node.kind === 64 && + (node.parent.kind === 183 || node.parent.kind === 182) && + node.parent.label === node; + } + function isLabelOfLabeledStatement(node) { + return node.kind === 64 && + node.parent.kind === 187 && + node.parent.label === node; + } + function isLabeledBy(node, labelName) { + for (var owner = node.parent; owner.kind === 187; owner = owner.parent) { + if (owner.label.text === labelName) { + return true; + } + } + return false; + } + function isLabelName(node) { + return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); + } + function isRightSideOfQualifiedName(node) { + return node.parent.kind === 123 && node.parent.right === node; + } + function isRightSideOfPropertyAccess(node) { + return node && node.parent && node.parent.kind === 151 && node.parent.name === node; + } + function isCallExpressionTarget(node) { + if (isRightSideOfPropertyAccess(node)) { + node = node.parent; + } + return node && node.parent && node.parent.kind === 153 && node.parent.expression === node; + } + function isNewExpressionTarget(node) { + if (isRightSideOfPropertyAccess(node)) { + node = node.parent; + } + return node && node.parent && node.parent.kind === 154 && node.parent.expression === node; + } + function isNameOfModuleDeclaration(node) { + return node.parent.kind === 198 && node.parent.name === node; + } + function isNameOfFunctionDeclaration(node) { + return node.kind === 64 && + ts.isAnyFunction(node.parent) && node.parent.name === node; + } + function isNameOfPropertyAssignment(node) { + return (node.kind === 64 || node.kind === 8 || node.kind === 7) && + (node.parent.kind === 207 || node.parent.kind === 208) && node.parent.name === node; + } + function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { + if (node.kind === 8 || node.kind === 7) { + switch (node.parent.kind) { + case 128: + case 127: + case 207: + case 209: + case 130: + case 129: + case 132: + case 133: + case 198: + return node.parent.name === node; + case 152: + return node.parent.argumentExpression === node; + } + } + return false; + } + function isNameOfExternalModuleImportOrDeclaration(node) { + if (node.kind === 8) { + return isNameOfModuleDeclaration(node) || + (ts.isExternalModuleImportDeclaration(node.parent.parent) && ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node); + } + return false; + } + function isInsideComment(sourceFile, token, position) { + return position <= token.getStart(sourceFile) && + (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || + isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); + function isInsideCommentRange(comments) { + return ts.forEach(comments, function (comment) { + if (comment.pos < position && position < comment.end) { + return true; + } + else if (position === comment.end) { + var text = sourceFile.text; + var width = comment.end - comment.pos; + if (width <= 2 || text.charCodeAt(comment.pos + 1) === 47) { + return true; + } + else { + return !(text.charCodeAt(comment.end - 1) === 47 && + text.charCodeAt(comment.end - 2) === 42); + } + } + return false; + }); + } + } + var SemanticMeaning; + (function (SemanticMeaning) { + SemanticMeaning[SemanticMeaning["None"] = 0] = "None"; + SemanticMeaning[SemanticMeaning["Value"] = 1] = "Value"; + SemanticMeaning[SemanticMeaning["Type"] = 2] = "Type"; + SemanticMeaning[SemanticMeaning["Namespace"] = 4] = "Namespace"; + SemanticMeaning[SemanticMeaning["All"] = 7] = "All"; + })(SemanticMeaning || (SemanticMeaning = {})); + var BreakContinueSearchType; + (function (BreakContinueSearchType) { + BreakContinueSearchType[BreakContinueSearchType["None"] = 0] = "None"; + BreakContinueSearchType[BreakContinueSearchType["Unlabeled"] = 1] = "Unlabeled"; + BreakContinueSearchType[BreakContinueSearchType["Labeled"] = 2] = "Labeled"; + BreakContinueSearchType[BreakContinueSearchType["All"] = 3] = "All"; + })(BreakContinueSearchType || (BreakContinueSearchType = {})); + var keywordCompletions = []; + for (var i = 65; i <= 122; i++) { + keywordCompletions.push({ + name: ts.tokenToString(i), + kind: ScriptElementKind.keyword, + kindModifiers: ScriptElementKindModifier.none + }); + } + function getContainerNode(node) { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case 210: + case 130: + case 129: + case 193: + case 158: + case 132: + case 133: + case 194: + case 195: + case 197: + case 198: + return node; + } + } + } + ts.getContainerNode = getContainerNode; + function getNodeKind(node) { + switch (node.kind) { + case 198: return ScriptElementKind.moduleElement; + case 194: return ScriptElementKind.classElement; + case 195: return ScriptElementKind.interfaceElement; + case 196: return ScriptElementKind.typeElement; + case 197: return ScriptElementKind.enumElement; + case 191: + return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; + case 193: return ScriptElementKind.functionElement; + case 132: return ScriptElementKind.memberGetAccessorElement; + case 133: return ScriptElementKind.memberSetAccessorElement; + case 130: + case 129: + return ScriptElementKind.memberFunctionElement; + case 128: + case 127: + return ScriptElementKind.memberVariableElement; + case 136: return ScriptElementKind.indexSignatureElement; + case 135: return ScriptElementKind.constructSignatureElement; + case 134: return ScriptElementKind.callSignatureElement; + case 131: return ScriptElementKind.constructorImplementationElement; + case 125: return ScriptElementKind.typeParameterElement; + case 209: return ScriptElementKind.variableElement; + case 126: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + } + return ScriptElementKind.unknown; + } + ts.getNodeKind = getNodeKind; + function createLanguageService(host, documentRegistry) { + if (documentRegistry === void 0) { documentRegistry = createDocumentRegistry(); } + var syntaxTreeCache = new SyntaxTreeCache(host); + var ruleProvider; + var program; + var typeInfoResolver; + var useCaseSensitivefileNames = false; + var cancellationToken = new CancellationTokenObject(host.getCancellationToken && host.getCancellationToken()); + var activeCompletionSession; + if (!ts.localizedDiagnosticMessages && host.getLocalizedDiagnosticMessages) { + ts.localizedDiagnosticMessages = host.getLocalizedDiagnosticMessages(); + } + function log(message) { + if (host.log) { + host.log(message); + } + } + function getCanonicalFileName(fileName) { + return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); + } + function getValidSourceFile(fileName) { + var sourceFile = program.getSourceFile(getCanonicalFileName(fileName)); + if (!sourceFile) { + throw new Error("Could not find file: '" + fileName + "'."); + } + return sourceFile; + } + function getRuleProvider(options) { + if (!ruleProvider) { + ruleProvider = new ts.formatting.RulesProvider(); + } + ruleProvider.ensureUpToDate(options); + return ruleProvider; + } + function synchronizeHostData() { + var hostCache = new HostCache(host); + if (programUpToDate()) { + return; + } + var oldSettings = program && program.getCompilerOptions(); + var newSettings = hostCache.compilationSettings(); + var changesInCompilationSettingsAffectSyntax = oldSettings && oldSettings.target !== newSettings.target; + var newProgram = ts.createProgram(hostCache.getRootFileNames(), newSettings, { + getSourceFile: getOrCreateSourceFile, + getCancellationToken: function () { return cancellationToken; }, + getCanonicalFileName: function (fileName) { return useCaseSensitivefileNames ? fileName : fileName.toLowerCase(); }, + useCaseSensitiveFileNames: function () { return useCaseSensitivefileNames; }, + getNewLine: function () { return host.getNewLine ? host.getNewLine() : "\r\n"; }, + getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, + writeFile: function (fileName, data, writeByteOrderMark) { }, + getCurrentDirectory: function () { return host.getCurrentDirectory(); } + }); + if (program) { + var oldSourceFiles = program.getSourceFiles(); + for (var i = 0, n = oldSourceFiles.length; i < n; i++) { + var fileName = oldSourceFiles[i].fileName; + if (!newProgram.getSourceFile(fileName) || changesInCompilationSettingsAffectSyntax) { + documentRegistry.releaseDocument(fileName, oldSettings); + } + } + } + program = newProgram; + typeInfoResolver = program.getTypeChecker(); + return; + function getOrCreateSourceFile(fileName) { + var hostFileInformation = hostCache.getOrCreateEntry(fileName); + if (!hostFileInformation) { + return undefined; + } + if (!changesInCompilationSettingsAffectSyntax) { + var oldSourceFile = program && program.getSourceFile(fileName); + if (oldSourceFile) { + if (sourceFileUpToDate(oldSourceFile)) { + return oldSourceFile; + } + var textChangeRange = hostCache.getChangeRange(fileName, oldSourceFile.version, oldSourceFile.scriptSnapshot); + return documentRegistry.updateDocument(oldSourceFile, fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version, textChangeRange); + } + } + return documentRegistry.acquireDocument(fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version); + } + function sourceFileUpToDate(sourceFile) { + return sourceFile && sourceFile.version === hostCache.getVersion(sourceFile.fileName); + } + function programUpToDate() { + if (!program) { + return false; + } + var rootFileNames = hostCache.getRootFileNames(); + if (program.getSourceFiles().length !== rootFileNames.length) { + return false; + } + for (var i = 0, n = rootFileNames.length; i < n; i++) { + if (!sourceFileUpToDate(program.getSourceFile(rootFileNames[i]))) { + return false; + } + } + return ts.compareDataObjects(program.getCompilerOptions(), hostCache.compilationSettings()); + } + } + function getProgram() { + synchronizeHostData(); + return program; + } + function cleanupSemanticCache() { + if (program) { + typeInfoResolver = program.getTypeChecker(); + } + } + function dispose() { + if (program) { + ts.forEach(program.getSourceFiles(), function (f) { documentRegistry.releaseDocument(f.fileName, program.getCompilerOptions()); }); + } + } + function getSyntacticDiagnostics(fileName) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + return program.getSyntacticDiagnostics(getValidSourceFile(fileName)); + } + function getSemanticDiagnostics(fileName) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var targetSourceFile = getValidSourceFile(fileName); + var semanticDiagnostics = program.getSemanticDiagnostics(targetSourceFile); + if (!program.getCompilerOptions().declaration) { + return semanticDiagnostics; + } + var declarationDiagnostics = program.getDeclarationDiagnostics(targetSourceFile); + return semanticDiagnostics.concat(declarationDiagnostics); + } + function getCompilerOptionsDiagnostics() { + synchronizeHostData(); + return program.getGlobalDiagnostics(); + } + function getValidCompletionEntryDisplayName(symbol, target) { + var displayName = symbol.getName(); + if (displayName && displayName.length > 0) { + var firstCharCode = displayName.charCodeAt(0); + if ((symbol.flags & 1536) && (firstCharCode === 39 || firstCharCode === 34)) { + return undefined; + } + if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && + (firstCharCode === 39 || firstCharCode === 34)) { + displayName = displayName.substring(1, displayName.length - 1); + } + var isValid = ts.isIdentifierStart(displayName.charCodeAt(0), target); + for (var i = 1, n = displayName.length; isValid && i < n; i++) { + isValid = ts.isIdentifierPart(displayName.charCodeAt(i), target); + } + if (isValid) { + return ts.unescapeIdentifier(displayName); + } + } + return undefined; + } + function createCompletionEntry(symbol, typeChecker, location) { + var displayName = getValidCompletionEntryDisplayName(symbol, program.getCompilerOptions().target); + if (!displayName) { + return undefined; + } + return { + name: displayName, + kind: getSymbolKind(symbol, typeChecker, location), + kindModifiers: getSymbolModifiers(symbol) + }; + } + function getCompletionsAtPosition(fileName, position) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var syntacticStart = new Date().getTime(); + var sourceFile = getValidSourceFile(fileName); + var start = new Date().getTime(); + var currentToken = ts.getTokenAtPosition(sourceFile, position); + log("getCompletionsAtPosition: Get current token: " + (new Date().getTime() - start)); + var start = new Date().getTime(); + var insideComment = isInsideComment(sourceFile, currentToken, position); + log("getCompletionsAtPosition: Is inside comment: " + (new Date().getTime() - start)); + if (insideComment) { + log("Returning an empty list because completion was inside a comment."); + return undefined; + } + var start = new Date().getTime(); + var previousToken = ts.findPrecedingToken(position, sourceFile); + log("getCompletionsAtPosition: Get previous token 1: " + (new Date().getTime() - start)); + if (previousToken && position <= previousToken.end && previousToken.kind === 64) { + var start = new Date().getTime(); + previousToken = ts.findPrecedingToken(previousToken.pos, sourceFile); + log("getCompletionsAtPosition: Get previous token 2: " + (new Date().getTime() - start)); + } + if (previousToken && isCompletionListBlocker(previousToken)) { + log("Returning an empty list because completion was requested in an invalid position."); + return undefined; + } + var node; + var isRightOfDot; + if (previousToken && previousToken.kind === 20 && previousToken.parent.kind === 151) { + node = previousToken.parent.expression; + isRightOfDot = true; + } + else if (previousToken && previousToken.kind === 20 && previousToken.parent.kind === 123) { + node = previousToken.parent.left; + isRightOfDot = true; + } + else { + node = currentToken; + isRightOfDot = false; + } + activeCompletionSession = { + fileName: fileName, + position: position, + entries: [], + symbols: {}, + typeChecker: typeInfoResolver + }; + log("getCompletionsAtPosition: Syntactic work: " + (new Date().getTime() - syntacticStart)); + var location = ts.getTouchingPropertyName(sourceFile, position); + var semanticStart = new Date().getTime(); + if (isRightOfDot) { + var symbols = []; + var isMemberCompletion = true; + var isNewIdentifierLocation = false; + if (node.kind === 64 || node.kind === 123 || node.kind === 151) { + var symbol = typeInfoResolver.getSymbolAtLocation(node); + if (symbol && symbol.flags & 8388608) { + symbol = typeInfoResolver.getAliasedSymbol(symbol); + } + if (symbol && symbol.flags & 1952) { + ts.forEachValue(symbol.exports, function (symbol) { + if (typeInfoResolver.isValidPropertyAccess((node.parent), symbol.name)) { + symbols.push(symbol); + } + }); + } + } + var type = typeInfoResolver.getTypeAtLocation(node); + if (type) { + ts.forEach(type.getApparentProperties(), function (symbol) { + if (typeInfoResolver.isValidPropertyAccess((node.parent), symbol.name)) { + symbols.push(symbol); + } + }); + } + getCompletionEntriesFromSymbols(symbols, activeCompletionSession); + } + else { + var containingObjectLiteral = getContainingObjectLiteralApplicableForCompletion(previousToken); + if (containingObjectLiteral) { + isMemberCompletion = true; + isNewIdentifierLocation = true; + var contextualType = typeInfoResolver.getContextualType(containingObjectLiteral); + if (!contextualType) { + return undefined; + } + var contextualTypeMembers = typeInfoResolver.getPropertiesOfType(contextualType); + if (contextualTypeMembers && contextualTypeMembers.length > 0) { + var filteredMembers = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties); + getCompletionEntriesFromSymbols(filteredMembers, activeCompletionSession); + } + } + else { + isMemberCompletion = false; + isNewIdentifierLocation = isNewIdentifierDefinitionLocation(previousToken); + var symbolMeanings = 793056 | 107455 | 1536 | 8388608; + var symbols = typeInfoResolver.getSymbolsInScope(node, symbolMeanings); + getCompletionEntriesFromSymbols(symbols, activeCompletionSession); + } + } + if (!isMemberCompletion) { + Array.prototype.push.apply(activeCompletionSession.entries, keywordCompletions); + } + log("getCompletionsAtPosition: Semantic work: " + (new Date().getTime() - semanticStart)); + return { + isMemberCompletion: isMemberCompletion, + isNewIdentifierLocation: isNewIdentifierLocation, + isBuilder: isNewIdentifierDefinitionLocation, + entries: activeCompletionSession.entries + }; + function getCompletionEntriesFromSymbols(symbols, session) { + var start = new Date().getTime(); + ts.forEach(symbols, function (symbol) { + var entry = createCompletionEntry(symbol, session.typeChecker, location); + if (entry) { + var id = ts.escapeIdentifier(entry.name); + if (!ts.lookUp(session.symbols, id)) { + session.entries.push(entry); + session.symbols[id] = symbol; + } + } + }); + log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start)); + } + function isCompletionListBlocker(previousToken) { + var start = new Date().getTime(); + var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || + isIdentifierDefinitionLocation(previousToken) || + isRightOfIllegalDot(previousToken); + log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); + return result; + } + function isNewIdentifierDefinitionLocation(previousToken) { + if (previousToken) { + var containingNodeKind = previousToken.parent.kind; + switch (previousToken.kind) { + case 23: + return containingNodeKind === 153 || containingNodeKind === 131 || containingNodeKind === 154 || containingNodeKind === 149 || containingNodeKind === 165; + case 16: + return containingNodeKind === 153 || containingNodeKind === 131 || containingNodeKind === 154 || containingNodeKind === 157; + case 18: + return containingNodeKind === 149; + case 115: + return true; + case 20: + return containingNodeKind === 198; + case 14: + return containingNodeKind === 194; + case 52: + return containingNodeKind === 191 || containingNodeKind === 165; + case 11: + return containingNodeKind === 167; + case 12: + return containingNodeKind === 171; + case 107: + case 105: + case 106: + return containingNodeKind === 128; + } + switch (previousToken.getText()) { + case "public": + case "protected": + case "private": + return true; + } + } + return false; + } + function isInStringOrRegularExpressionOrTemplateLiteral(previousToken) { + if (previousToken.kind === 8 || previousToken.kind === 9 || ts.isTemplateLiteralKind(previousToken.kind)) { + var start = previousToken.getStart(); + var end = previousToken.getEnd(); + if (start < position && position < end) { + return true; + } + else if (position === end) { + return !!previousToken.isUnterminated; + } + } + return false; + } + function getContainingObjectLiteralApplicableForCompletion(previousToken) { + if (previousToken) { + var parent = previousToken.parent; + switch (previousToken.kind) { + case 14: + case 23: + if (parent && parent.kind === 150) { + return parent; + } + break; + } + } + return undefined; + } + function isFunction(kind) { + switch (kind) { + case 158: + case 159: + case 193: + case 130: + case 129: + case 132: + case 133: + case 134: + case 135: + case 136: + return true; + } + return false; + } + function isIdentifierDefinitionLocation(previousToken) { + if (previousToken) { + var containingNodeKind = previousToken.parent.kind; + switch (previousToken.kind) { + case 23: + return containingNodeKind === 191 || + containingNodeKind === 192 || + containingNodeKind === 173 || + containingNodeKind === 197 || + isFunction(containingNodeKind) || + containingNodeKind === 194 || + containingNodeKind === 193 || + containingNodeKind === 195 || + containingNodeKind === 147 || + containingNodeKind === 146; + case 20: + return containingNodeKind === 147; + case 18: + return containingNodeKind === 147; + case 16: + return containingNodeKind === 206 || + isFunction(containingNodeKind); + case 14: + return containingNodeKind === 197 || + containingNodeKind === 195 || + containingNodeKind === 141 || + containingNodeKind === 146; + case 22: + return containingNodeKind === 127 && + (previousToken.parent.parent.kind === 195 || + previousToken.parent.parent.kind === 141); + case 24: + return containingNodeKind === 194 || + containingNodeKind === 193 || + containingNodeKind === 195 || + isFunction(containingNodeKind); + case 108: + return containingNodeKind === 128; + case 21: + return containingNodeKind === 126 || + containingNodeKind === 131 || + (previousToken.parent.parent.kind === 147); + case 107: + case 105: + case 106: + return containingNodeKind === 126; + case 68: + case 76: + case 102: + case 82: + case 97: + case 114: + case 118: + case 84: + case 103: + case 69: + case 109: + return true; + } + switch (previousToken.getText()) { + case "class": + case "interface": + case "enum": + case "function": + case "var": + case "static": + case "let": + case "const": + case "yield": + return true; + } + } + return false; + } + function isRightOfIllegalDot(previousToken) { + if (previousToken && previousToken.kind === 7) { + var text = previousToken.getFullText(); + return text.charAt(text.length - 1) === "."; + } + return false; + } + function filterContextualMembersList(contextualMemberSymbols, existingMembers) { + if (!existingMembers || existingMembers.length === 0) { + return contextualMemberSymbols; + } + var existingMemberNames = {}; + ts.forEach(existingMembers, function (m) { + if (m.kind !== 207 && m.kind !== 208) { + return; + } + if (m.getStart() <= position && position <= m.getEnd()) { + return; + } + existingMemberNames[m.name.text] = true; + }); + var filteredMembers = []; + ts.forEach(contextualMemberSymbols, function (s) { + if (!existingMemberNames[s.name]) { + filteredMembers.push(s); + } + }); + return filteredMembers; + } + } + function getCompletionEntryDetails(fileName, position, entryName) { + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + var session = activeCompletionSession; + if (!session || session.fileName !== fileName || session.position !== position) { + return undefined; + } + var symbol = ts.lookUp(activeCompletionSession.symbols, ts.escapeIdentifier(entryName)); + if (symbol) { + var location = ts.getTouchingPropertyName(sourceFile, position); + var completionEntry = createCompletionEntry(symbol, session.typeChecker, location); + ts.Debug.assert(session.typeChecker.getTypeOfSymbolAtLocation(symbol, location) !== undefined, "Could not find type for symbol"); + var displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), location, session.typeChecker, location, 7); + return { + name: entryName, + kind: displayPartsDocumentationsAndSymbolKind.symbolKind, + kindModifiers: completionEntry.kindModifiers, + displayParts: displayPartsDocumentationsAndSymbolKind.displayParts, + documentation: displayPartsDocumentationsAndSymbolKind.documentation + }; + } + else { + return { + name: entryName, + kind: ScriptElementKind.keyword, + kindModifiers: ScriptElementKindModifier.none, + displayParts: [ts.displayPart(entryName, 5)], + documentation: undefined + }; + } + } + function getSymbolKind(symbol, typeResolver, location) { + var flags = symbol.getFlags(); + if (flags & 32) + return ScriptElementKind.classElement; + if (flags & 384) + return ScriptElementKind.enumElement; + if (flags & 524288) + return ScriptElementKind.typeElement; + if (flags & 64) + return ScriptElementKind.interfaceElement; + if (flags & 262144) + return ScriptElementKind.typeParameterElement; + var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags, typeResolver, location); + if (result === ScriptElementKind.unknown) { + if (flags & 262144) + return ScriptElementKind.typeParameterElement; + if (flags & 8) + return ScriptElementKind.variableElement; + if (flags & 8388608) + return ScriptElementKind.alias; + if (flags & 1536) + return ScriptElementKind.moduleElement; + } + return result; + } + function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, flags, typeResolver, location) { + if (typeResolver.isUndefinedSymbol(symbol)) { + return ScriptElementKind.variableElement; + } + if (typeResolver.isArgumentsSymbol(symbol)) { + return ScriptElementKind.localVariableElement; + } + if (flags & 3) { + if (ts.isFirstDeclarationOfSymbolParameter(symbol)) { + return ScriptElementKind.parameterElement; + } + else if (symbol.valueDeclaration && ts.isConst(symbol.valueDeclaration)) { + return ScriptElementKind.constElement; + } + else if (ts.forEach(symbol.declarations, ts.isLet)) { + return ScriptElementKind.letElement; + } + return isLocalVariableOrFunction(symbol) ? ScriptElementKind.localVariableElement : ScriptElementKind.variableElement; + } + if (flags & 16) + return isLocalVariableOrFunction(symbol) ? ScriptElementKind.localFunctionElement : ScriptElementKind.functionElement; + if (flags & 32768) + return ScriptElementKind.memberGetAccessorElement; + if (flags & 65536) + return ScriptElementKind.memberSetAccessorElement; + if (flags & 8192) + return ScriptElementKind.memberFunctionElement; + if (flags & 16384) + return ScriptElementKind.constructorImplementationElement; + if (flags & 4) { + if (flags & 268435456) { + var unionPropertyKind = ts.forEach(typeInfoResolver.getRootSymbols(symbol), function (rootSymbol) { + var rootSymbolFlags = rootSymbol.getFlags(); + if (rootSymbolFlags & (98308 | 3)) { + return ScriptElementKind.memberVariableElement; + } + ts.Debug.assert(!!(rootSymbolFlags & 8192)); + }); + if (!unionPropertyKind) { + var typeOfUnionProperty = typeInfoResolver.getTypeOfSymbolAtLocation(symbol, location); + if (typeOfUnionProperty.getCallSignatures().length) { + return ScriptElementKind.memberFunctionElement; + } + return ScriptElementKind.memberVariableElement; + } + return unionPropertyKind; + } + return ScriptElementKind.memberVariableElement; + } + return ScriptElementKind.unknown; + } + function getTypeKind(type) { + var flags = type.getFlags(); + if (flags & 128) + return ScriptElementKind.enumElement; + if (flags & 1024) + return ScriptElementKind.classElement; + if (flags & 2048) + return ScriptElementKind.interfaceElement; + if (flags & 512) + return ScriptElementKind.typeParameterElement; + if (flags & 1048703) + return ScriptElementKind.primitiveType; + if (flags & 256) + return ScriptElementKind.primitiveType; + return ScriptElementKind.unknown; + } + function getSymbolModifiers(symbol) { + return symbol && symbol.declarations && symbol.declarations.length > 0 ? ts.getNodeModifiers(symbol.declarations[0]) : ScriptElementKindModifier.none; + } + function getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, enclosingDeclaration, typeResolver, location, semanticMeaning) { + if (semanticMeaning === void 0) { semanticMeaning = getMeaningFromLocation(location); } + var displayParts = []; + var documentation; + var symbolFlags = symbol.flags; + var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(symbol, symbolFlags, typeResolver, location); + var hasAddedSymbolInfo; + if (symbolKind !== ScriptElementKind.unknown || symbolFlags & 32 || symbolFlags & 8388608) { + if (symbolKind === ScriptElementKind.memberGetAccessorElement || symbolKind === ScriptElementKind.memberSetAccessorElement) { + symbolKind = ScriptElementKind.memberVariableElement; + } + var type = typeResolver.getTypeOfSymbolAtLocation(symbol, location); + if (type) { + if (location.parent && location.parent.kind === 151) { + var right = location.parent.name; + if (right === location || (right && right.getFullWidth() === 0)) { + location = location.parent; + } + } + var callExpression; + if (location.kind === 153 || location.kind === 154) { + callExpression = location; + } + else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { + callExpression = location.parent; + } + if (callExpression) { + var candidateSignatures = []; + signature = typeResolver.getResolvedSignature(callExpression, candidateSignatures); + if (!signature && candidateSignatures.length) { + signature = candidateSignatures[0]; + } + var useConstructSignatures = callExpression.kind === 154 || callExpression.expression.kind === 90; + var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); + if (!ts.contains(allSignatures, signature.target || signature)) { + signature = allSignatures.length ? allSignatures[0] : undefined; + } + if (signature) { + if (useConstructSignatures && (symbolFlags & 32)) { + symbolKind = ScriptElementKind.constructorImplementationElement; + addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); + } + else if (symbolFlags & 8388608) { + symbolKind = ScriptElementKind.alias; + displayParts.push(ts.punctuationPart(16)); + displayParts.push(ts.textPart(symbolKind)); + displayParts.push(ts.punctuationPart(17)); + displayParts.push(ts.spacePart()); + if (useConstructSignatures) { + displayParts.push(ts.keywordPart(87)); + displayParts.push(ts.spacePart()); + } + addFullSymbolName(symbol); + } + else { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + } + switch (symbolKind) { + case ScriptElementKind.memberVariableElement: + case ScriptElementKind.variableElement: + case ScriptElementKind.constElement: + case ScriptElementKind.letElement: + case ScriptElementKind.parameterElement: + case ScriptElementKind.localVariableElement: + displayParts.push(ts.punctuationPart(51)); + displayParts.push(ts.spacePart()); + if (useConstructSignatures) { + displayParts.push(ts.keywordPart(87)); + displayParts.push(ts.spacePart()); + } + if (!(type.flags & 32768)) { + displayParts.push.apply(displayParts, ts.symbolToDisplayParts(typeResolver, type.symbol, enclosingDeclaration, undefined, 1)); + } + addSignatureDisplayParts(signature, allSignatures, 8); + break; + default: + addSignatureDisplayParts(signature, allSignatures); + } + hasAddedSymbolInfo = true; + } + } + else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || + (location.kind === 112 && location.parent.kind === 131)) { + var signature; + var functionDeclaration = location.parent; + var allSignatures = functionDeclaration.kind === 131 ? type.getConstructSignatures() : type.getCallSignatures(); + if (!typeResolver.isImplementationOfOverload(functionDeclaration)) { + signature = typeResolver.getSignatureFromDeclaration(functionDeclaration); + } + else { + signature = allSignatures[0]; + } + if (functionDeclaration.kind === 131) { + symbolKind = ScriptElementKind.constructorImplementationElement; + addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); + } + else { + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 134 && + !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); + } + addSignatureDisplayParts(signature, allSignatures); + hasAddedSymbolInfo = true; + } + } + } + if (symbolFlags & 32 && !hasAddedSymbolInfo) { + displayParts.push(ts.keywordPart(68)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); + } + if ((symbolFlags & 64) && (semanticMeaning & 2)) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(102)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + writeTypeParametersOfSymbol(symbol, sourceFile); + } + if (symbolFlags & 524288) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(121)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(52)); + displayParts.push(ts.spacePart()); + displayParts.push.apply(displayParts, ts.typeToDisplayParts(typeResolver, typeResolver.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration)); + } + if (symbolFlags & 384) { + addNewLineIfDisplayPartsExist(); + if (ts.forEach(symbol.declarations, ts.isConstEnumDeclaration)) { + displayParts.push(ts.keywordPart(69)); + displayParts.push(ts.spacePart()); + } + displayParts.push(ts.keywordPart(76)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + } + if (symbolFlags & 1536) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(115)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + } + if ((symbolFlags & 262144) && (semanticMeaning & 2)) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.punctuationPart(16)); + displayParts.push(ts.textPart("type parameter")); + displayParts.push(ts.punctuationPart(17)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + displayParts.push(ts.spacePart()); + displayParts.push(ts.keywordPart(85)); + displayParts.push(ts.spacePart()); + if (symbol.parent) { + addFullSymbolName(symbol.parent, enclosingDeclaration); + writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); + } + else { + var signatureDeclaration = ts.getDeclarationOfKind(symbol, 125).parent; + var signature = typeResolver.getSignatureFromDeclaration(signatureDeclaration); + if (signatureDeclaration.kind === 135) { + displayParts.push(ts.keywordPart(87)); + displayParts.push(ts.spacePart()); + } + else if (signatureDeclaration.kind !== 134 && signatureDeclaration.name) { + addFullSymbolName(signatureDeclaration.symbol); + } + displayParts.push.apply(displayParts, ts.signatureToDisplayParts(typeResolver, signature, sourceFile, 32)); + } + } + if (symbolFlags & 8) { + addPrefixForAnyFunctionOrVar(symbol, "enum member"); + var declaration = symbol.declarations[0]; + if (declaration.kind === 209) { + var constantValue = typeResolver.getConstantValue(declaration); + if (constantValue !== undefined) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(52)); + displayParts.push(ts.spacePart()); + displayParts.push(ts.displayPart(constantValue.toString(), 7)); + } + } + } + if (symbolFlags & 8388608) { + addNewLineIfDisplayPartsExist(); + displayParts.push(ts.keywordPart(84)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + ts.forEach(symbol.declarations, function (declaration) { + if (declaration.kind === 200) { + var importDeclaration = declaration; + if (ts.isExternalModuleImportDeclaration(importDeclaration)) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(52)); + displayParts.push(ts.spacePart()); + displayParts.push(ts.keywordPart(116)); + displayParts.push(ts.punctuationPart(16)); + displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportDeclarationExpression(importDeclaration)), 8)); + displayParts.push(ts.punctuationPart(17)); + } + else { + var internalAliasSymbol = typeResolver.getSymbolAtLocation(importDeclaration.moduleReference); + if (internalAliasSymbol) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.operatorPart(52)); + displayParts.push(ts.spacePart()); + addFullSymbolName(internalAliasSymbol, enclosingDeclaration); + } + } + return true; + } + }); + } + if (!hasAddedSymbolInfo) { + if (symbolKind !== ScriptElementKind.unknown) { + if (type) { + addPrefixForAnyFunctionOrVar(symbol, symbolKind); + if (symbolKind === ScriptElementKind.memberVariableElement || + symbolFlags & 3 || + symbolKind === ScriptElementKind.localVariableElement) { + displayParts.push(ts.punctuationPart(51)); + displayParts.push(ts.spacePart()); + if (type.symbol && type.symbol.flags & 262144) { + var typeParameterParts = ts.mapToDisplayParts(function (writer) { + typeResolver.getSymbolDisplayBuilder().buildTypeParameterDisplay(type, writer, enclosingDeclaration); + }); + displayParts.push.apply(displayParts, typeParameterParts); + } + else { + displayParts.push.apply(displayParts, ts.typeToDisplayParts(typeResolver, type, enclosingDeclaration)); + } + } + else if (symbolFlags & 16 || + symbolFlags & 8192 || + symbolFlags & 16384 || + symbolFlags & 131072 || + symbolFlags & 98304 || + symbolKind === ScriptElementKind.memberFunctionElement) { + var allSignatures = type.getCallSignatures(); + addSignatureDisplayParts(allSignatures[0], allSignatures); + } + } + } + else { + symbolKind = getSymbolKind(symbol, typeResolver, location); + } + } + if (!documentation) { + documentation = symbol.getDocumentationComment(); + } + return { displayParts: displayParts, documentation: documentation, symbolKind: symbolKind }; + function addNewLineIfDisplayPartsExist() { + if (displayParts.length) { + displayParts.push(ts.lineBreakPart()); + } + } + function addFullSymbolName(symbol, enclosingDeclaration) { + var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeResolver, symbol, enclosingDeclaration || sourceFile, undefined, 1 | 2); + displayParts.push.apply(displayParts, fullSymbolDisplayParts); + } + function addPrefixForAnyFunctionOrVar(symbol, symbolKind) { + addNewLineIfDisplayPartsExist(); + if (symbolKind) { + displayParts.push(ts.punctuationPart(16)); + displayParts.push(ts.textPart(symbolKind)); + displayParts.push(ts.punctuationPart(17)); + displayParts.push(ts.spacePart()); + addFullSymbolName(symbol); + } + } + function addSignatureDisplayParts(signature, allSignatures, flags) { + displayParts.push.apply(displayParts, ts.signatureToDisplayParts(typeResolver, signature, enclosingDeclaration, flags | 32)); + if (allSignatures.length > 1) { + displayParts.push(ts.spacePart()); + displayParts.push(ts.punctuationPart(16)); + displayParts.push(ts.operatorPart(33)); + displayParts.push(ts.displayPart((allSignatures.length - 1).toString(), 7)); + displayParts.push(ts.spacePart()); + displayParts.push(ts.textPart(allSignatures.length === 2 ? "overload" : "overloads")); + displayParts.push(ts.punctuationPart(17)); + } + documentation = signature.getDocumentationComment(); + } + function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { + var typeParameterParts = ts.mapToDisplayParts(function (writer) { + typeResolver.getSymbolDisplayBuilder().buildTypeParameterDisplayFromSymbol(symbol, writer, enclosingDeclaration); + }); + displayParts.push.apply(displayParts, typeParameterParts); + } + } + function getQuickInfoAtPosition(fileName, position) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + var node = ts.getTouchingPropertyName(sourceFile, position); + if (!node) { + return undefined; + } + var symbol = typeInfoResolver.getSymbolAtLocation(node); + if (!symbol) { + switch (node.kind) { + case 64: + case 151: + case 123: + case 92: + case 90: + var type = typeInfoResolver.getTypeAtLocation(node); + if (type) { + return { + kind: ScriptElementKind.unknown, + kindModifiers: ScriptElementKindModifier.none, + textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), + displayParts: ts.typeToDisplayParts(typeInfoResolver, type, getContainerNode(node)), + documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined + }; + } + } + return undefined; + } + var displayPartsDocumentationsAndKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, sourceFile, getContainerNode(node), typeInfoResolver, node); + return { + kind: displayPartsDocumentationsAndKind.symbolKind, + kindModifiers: getSymbolModifiers(symbol), + textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), + displayParts: displayPartsDocumentationsAndKind.displayParts, + documentation: displayPartsDocumentationsAndKind.documentation + }; + } + function getDefinitionAtPosition(fileName, position) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + var node = ts.getTouchingPropertyName(sourceFile, position); + if (!node) { + return undefined; + } + if (isJumpStatementTarget(node)) { + var labelName = node.text; + var label = getTargetLabel(node.parent, node.text); + return label ? [getDefinitionInfo(label, ScriptElementKind.label, labelName, undefined)] : undefined; + } + var comment = ts.forEach(sourceFile.referencedFiles, function (r) { return (r.pos <= position && position < r.end) ? r : undefined; }); + if (comment) { + var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); + if (referenceFile) { + return [{ + fileName: referenceFile.fileName, + textSpan: ts.createTextSpanFromBounds(0, 0), + kind: ScriptElementKind.scriptElement, + name: comment.fileName, + containerName: undefined, + containerKind: undefined + }]; + } + return undefined; + } + var symbol = typeInfoResolver.getSymbolAtLocation(node); + if (!symbol) { + return undefined; + } + var result = []; + if (node.parent.kind === 208) { + var shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); + var shorthandDeclarations = shorthandSymbol.getDeclarations(); + var shorthandSymbolKind = getSymbolKind(shorthandSymbol, typeInfoResolver, node); + var shorthandSymbolName = typeInfoResolver.symbolToString(shorthandSymbol); + var shorthandContainerName = typeInfoResolver.symbolToString(symbol.parent, node); + ts.forEach(shorthandDeclarations, function (declaration) { + result.push(getDefinitionInfo(declaration, shorthandSymbolKind, shorthandSymbolName, shorthandContainerName)); + }); + return result; + } + var declarations = symbol.getDeclarations(); + var symbolName = typeInfoResolver.symbolToString(symbol); + var symbolKind = getSymbolKind(symbol, typeInfoResolver, node); + var containerSymbol = symbol.parent; + var containerName = containerSymbol ? typeInfoResolver.symbolToString(containerSymbol, node) : ""; + if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && + !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { + ts.forEach(declarations, function (declaration) { + result.push(getDefinitionInfo(declaration, symbolKind, symbolName, containerName)); + }); + } + return result; + function getDefinitionInfo(node, symbolKind, symbolName, containerName) { + return { + fileName: node.getSourceFile().fileName, + textSpan: ts.createTextSpanFromBounds(node.getStart(), node.getEnd()), + kind: symbolKind, + name: symbolName, + containerKind: undefined, + containerName: containerName + }; + } + function tryAddSignature(signatureDeclarations, selectConstructors, symbolKind, symbolName, containerName, result) { + var declarations = []; + var definition; + ts.forEach(signatureDeclarations, function (d) { + if ((selectConstructors && d.kind === 131) || + (!selectConstructors && (d.kind === 193 || d.kind === 130 || d.kind === 129))) { + declarations.push(d); + if (d.body) + definition = d; + } + }); + if (definition) { + result.push(getDefinitionInfo(definition, symbolKind, symbolName, containerName)); + return true; + } + else if (declarations.length) { + result.push(getDefinitionInfo(declarations[declarations.length - 1], symbolKind, symbolName, containerName)); + return true; + } + return false; + } + function tryAddConstructSignature(symbol, location, symbolKind, symbolName, containerName, result) { + if (isNewExpressionTarget(location) || location.kind === 112) { + if (symbol.flags & 32) { + var classDeclaration = symbol.getDeclarations()[0]; + ts.Debug.assert(classDeclaration && classDeclaration.kind === 194); + return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); + } + } + return false; + } + function tryAddCallSignature(symbol, location, symbolKind, symbolName, containerName, result) { + if (isCallExpressionTarget(location) || isNewExpressionTarget(location) || isNameOfFunctionDeclaration(location)) { + return tryAddSignature(symbol.declarations, false, symbolKind, symbolName, containerName, result); + } + return false; + } + } + function getOccurrencesAtPosition(fileName, position) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + var node = ts.getTouchingWord(sourceFile, position); + if (!node) { + return undefined; + } + if (node.kind === 64 || node.kind === 92 || node.kind === 90 || + isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + return getReferencesForNode(node, [sourceFile], true, false, false); + } + switch (node.kind) { + case 83: + case 75: + if (hasKind(node.parent, 176)) { + return getIfElseOccurrences(node.parent); + } + break; + case 89: + if (hasKind(node.parent, 184)) { + return getReturnOccurrences(node.parent); + } + break; + case 93: + if (hasKind(node.parent, 188)) { + return getThrowOccurrences(node.parent); + } + break; + case 67: + if (hasKind(parent(parent(node)), 189)) { + return getTryCatchFinallyOccurrences(node.parent.parent); + } + break; + case 95: + case 80: + if (hasKind(parent(node), 189)) { + return getTryCatchFinallyOccurrences(node.parent); + } + break; + case 91: + if (hasKind(node.parent, 186)) { + return getSwitchCaseDefaultOccurrences(node.parent); + } + break; + case 66: + case 72: + if (hasKind(parent(parent(node)), 186)) { + return getSwitchCaseDefaultOccurrences(node.parent.parent); + } + break; + case 65: + case 70: + if (hasKind(node.parent, 183) || hasKind(node.parent, 182)) { + return getBreakOrContinueStatementOccurences(node.parent); + } + break; + case 81: + if (hasKind(node.parent, 179) || + hasKind(node.parent, 180) || + hasKind(node.parent, 181)) { + return getLoopBreakContinueOccurrences(node.parent); + } + break; + case 99: + case 74: + if (hasKind(node.parent, 178) || hasKind(node.parent, 177)) { + return getLoopBreakContinueOccurrences(node.parent); + } + break; + case 112: + if (hasKind(node.parent, 131)) { + return getConstructorOccurrences(node.parent); + } + break; + case 114: + case 118: + if (hasKind(node.parent, 132) || hasKind(node.parent, 133)) { + return getGetAndSetOccurrences(node.parent); + } + default: + if (ts.isModifier(node.kind) && node.parent && + (ts.isDeclaration(node.parent) || node.parent.kind === 173)) { + return getModifierOccurrences(node.kind, node.parent); + } + } + return undefined; + function getIfElseOccurrences(ifStatement) { + var keywords = []; + while (hasKind(ifStatement.parent, 176) && ifStatement.parent.elseStatement === ifStatement) { + ifStatement = ifStatement.parent; + } + while (ifStatement) { + var children = ifStatement.getChildren(); + pushKeywordIf(keywords, children[0], 83); + for (var i = children.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, children[i], 75)) { + break; + } + } + if (!hasKind(ifStatement.elseStatement, 176)) { + break; + } + ifStatement = ifStatement.elseStatement; + } + var result = []; + for (var i = 0; i < keywords.length; i++) { + if (keywords[i].kind === 75 && i < keywords.length - 1) { + var elseKeyword = keywords[i]; + var ifKeyword = keywords[i + 1]; + var shouldHighlightNextKeyword = true; + for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) { + if (!ts.isWhiteSpace(sourceFile.text.charCodeAt(j))) { + shouldHighlightNextKeyword = false; + break; + } + } + if (shouldHighlightNextKeyword) { + result.push({ + fileName: fileName, + textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), + isWriteAccess: false + }); + i++; + continue; + } + } + result.push(getReferenceEntryFromNode(keywords[i])); + } + return result; + } + function getReturnOccurrences(returnStatement) { + var func = ts.getContainingFunction(returnStatement); + if (!(func && hasKind(func.body, 172))) { + return undefined; + } + var keywords = []; + ts.forEachReturnStatement(func.body, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 89); + }); + ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 93); + }); + return ts.map(keywords, getReferenceEntryFromNode); + } + function getThrowOccurrences(throwStatement) { + var owner = getThrowStatementOwner(throwStatement); + if (!owner) { + return undefined; + } + var keywords = []; + ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) { + pushKeywordIf(keywords, throwStatement.getFirstToken(), 93); + }); + if (ts.isFunctionBlock(owner)) { + ts.forEachReturnStatement(owner, function (returnStatement) { + pushKeywordIf(keywords, returnStatement.getFirstToken(), 89); + }); + } + return ts.map(keywords, getReferenceEntryFromNode); + } + function aggregateOwnedThrowStatements(node) { + var statementAccumulator = []; + aggregate(node); + return statementAccumulator; + function aggregate(node) { + if (node.kind === 188) { + statementAccumulator.push(node); + } + else if (node.kind === 189) { + var tryStatement = node; + if (tryStatement.catchClause) { + aggregate(tryStatement.catchClause); + } + else { + aggregate(tryStatement.tryBlock); + } + if (tryStatement.finallyBlock) { + aggregate(tryStatement.finallyBlock); + } + } + else if (!ts.isAnyFunction(node)) { + ts.forEachChild(node, aggregate); + } + } + ; + } + function getThrowStatementOwner(throwStatement) { + var child = throwStatement; + while (child.parent) { + var parent = child.parent; + if (ts.isFunctionBlock(parent) || parent.kind === 210) { + return parent; + } + if (parent.kind === 189) { + var tryStatement = parent; + if (tryStatement.tryBlock === child && tryStatement.catchClause) { + return child; + } + } + child = parent; + } + return undefined; + } + function getTryCatchFinallyOccurrences(tryStatement) { + var keywords = []; + pushKeywordIf(keywords, tryStatement.getFirstToken(), 95); + if (tryStatement.catchClause) { + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 67); + } + if (tryStatement.finallyBlock) { + var finallyKeyword = ts.findChildOfKind(tryStatement, 80, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 80); + } + return ts.map(keywords, getReferenceEntryFromNode); + } + function getLoopBreakContinueOccurrences(loopNode) { + var keywords = []; + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 81, 99, 74)) { + if (loopNode.kind === 177) { + var loopTokens = loopNode.getChildren(); + for (var i = loopTokens.length - 1; i >= 0; i--) { + if (pushKeywordIf(keywords, loopTokens[i], 99)) { + break; + } + } + } + } + var breaksAndContinues = aggregateAllBreakAndContinueStatements(loopNode.statement); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(loopNode, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 65, 70); + } + }); + return ts.map(keywords, getReferenceEntryFromNode); + } + function getSwitchCaseDefaultOccurrences(switchStatement) { + var keywords = []; + pushKeywordIf(keywords, switchStatement.getFirstToken(), 91); + ts.forEach(switchStatement.clauses, function (clause) { + pushKeywordIf(keywords, clause.getFirstToken(), 66, 72); + var breaksAndContinues = aggregateAllBreakAndContinueStatements(clause); + ts.forEach(breaksAndContinues, function (statement) { + if (ownsBreakOrContinueStatement(switchStatement, statement)) { + pushKeywordIf(keywords, statement.getFirstToken(), 65); + } + }); + }); + return ts.map(keywords, getReferenceEntryFromNode); + } + function getBreakOrContinueStatementOccurences(breakOrContinueStatement) { + var owner = getBreakOrContinueOwner(breakOrContinueStatement); + if (owner) { + switch (owner.kind) { + case 179: + case 180: + case 181: + case 177: + case 178: + return getLoopBreakContinueOccurrences(owner); + case 186: + return getSwitchCaseDefaultOccurrences(owner); + } + } + return undefined; + } + function aggregateAllBreakAndContinueStatements(node) { + var statementAccumulator = []; + aggregate(node); + return statementAccumulator; + function aggregate(node) { + if (node.kind === 183 || node.kind === 182) { + statementAccumulator.push(node); + } + else if (!ts.isAnyFunction(node)) { + ts.forEachChild(node, aggregate); + } + } + ; + } + function ownsBreakOrContinueStatement(owner, statement) { + var actualOwner = getBreakOrContinueOwner(statement); + return actualOwner && actualOwner === owner; + } + function getBreakOrContinueOwner(statement) { + for (var node = statement.parent; node; node = node.parent) { + switch (node.kind) { + case 186: + if (statement.kind === 182) { + continue; + } + case 179: + case 180: + case 181: + case 178: + case 177: + if (!statement.label || isLabeledBy(node, statement.label.text)) { + return node; + } + break; + default: + if (ts.isAnyFunction(node)) { + return undefined; + } + break; + } + } + return undefined; + } + function getConstructorOccurrences(constructorDeclaration) { + var declarations = constructorDeclaration.symbol.getDeclarations(); + var keywords = []; + ts.forEach(declarations, function (declaration) { + ts.forEach(declaration.getChildren(), function (token) { + return pushKeywordIf(keywords, token, 112); + }); + }); + return ts.map(keywords, getReferenceEntryFromNode); + } + function getGetAndSetOccurrences(accessorDeclaration) { + var keywords = []; + tryPushAccessorKeyword(accessorDeclaration.symbol, 132); + tryPushAccessorKeyword(accessorDeclaration.symbol, 133); + return ts.map(keywords, getReferenceEntryFromNode); + function tryPushAccessorKeyword(accessorSymbol, accessorKind) { + var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); + if (accessor) { + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 114, 118); }); + } + } + } + function getModifierOccurrences(modifier, declaration) { + var container = declaration.parent; + if (declaration.flags & 112) { + if (!(container.kind === 194 || + (declaration.kind === 126 && hasKind(container, 131)))) { + return undefined; + } + } + else if (declaration.flags & 128) { + if (container.kind !== 194) { + return undefined; + } + } + else if (declaration.flags & (1 | 2)) { + if (!(container.kind === 199 || container.kind === 210)) { + return undefined; + } + } + else { + return undefined; + } + var keywords = []; + var modifierFlag = getFlagFromModifier(modifier); + var nodes; + switch (container.kind) { + case 199: + case 210: + nodes = container.statements; + break; + case 131: + nodes = container.parameters.concat(container.parent.members); + break; + case 194: + nodes = container.members; + if (modifierFlag & 112) { + var constructor = ts.forEach(container.members, function (member) { + return member.kind === 131 && member; + }); + if (constructor) { + nodes = nodes.concat(constructor.parameters); + } + } + break; + default: + ts.Debug.fail("Invalid container kind."); + } + ts.forEach(nodes, function (node) { + if (node.modifiers && node.flags & modifierFlag) { + ts.forEach(node.modifiers, function (child) { return pushKeywordIf(keywords, child, modifier); }); + } + }); + return ts.map(keywords, getReferenceEntryFromNode); + function getFlagFromModifier(modifier) { + switch (modifier) { + case 107: + return 16; + case 105: + return 32; + case 106: + return 64; + case 108: + return 128; + case 77: + return 1; + case 113: + return 2; + default: + ts.Debug.fail(); + } + } + } + function hasKind(node, kind) { + return node !== undefined && node.kind === kind; + } + function parent(node) { + return node && node.parent; + } + function pushKeywordIf(keywordList, token) { + var expected = []; + for (var _i = 2; _i < arguments.length; _i++) { + expected[_i - 2] = arguments[_i]; + } + if (token && ts.contains(expected, token.kind)) { + keywordList.push(token); + return true; + } + return false; + } + } + function findRenameLocations(fileName, position, findInStrings, findInComments) { + return findReferences(fileName, position, findInStrings, findInComments); + } + function getReferencesAtPosition(fileName, position) { + return findReferences(fileName, position, false, false); + } + function findReferences(fileName, position, findInStrings, findInComments) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + var node = ts.getTouchingPropertyName(sourceFile, position); + if (!node) { + return undefined; + } + if (node.kind !== 64 && + !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && + !isNameOfExternalModuleImportOrDeclaration(node)) { + return undefined; + } + ts.Debug.assert(node.kind === 64 || node.kind === 7 || node.kind === 8); + return getReferencesForNode(node, program.getSourceFiles(), false, findInStrings, findInComments); + } + function initializeNameTable(sourceFile) { + var nameTable = {}; + walk(sourceFile); + sourceFile.nameTable = nameTable; + function walk(node) { + switch (node.kind) { + case 64: + nameTable[node.text] = node.text; + break; + case 8: + case 7: + nameTable[node.text] = node.text; + break; + default: + ts.forEachChild(node, walk); + } + } + } + function getReferencesForNode(node, sourceFiles, searchOnlyInCurrentFile, findInStrings, findInComments) { + if (isLabelName(node)) { + if (isJumpStatementTarget(node)) { + var labelDefinition = getTargetLabel(node.parent, node.text); + return labelDefinition ? getLabelReferencesInNode(labelDefinition.parent, labelDefinition) : [getReferenceEntryFromNode(node)]; + } + else { + return getLabelReferencesInNode(node.parent, node); + } + } + if (node.kind === 92) { + return getReferencesForThisKeyword(node, sourceFiles); + } + if (node.kind === 90) { + return getReferencesForSuperKeyword(node); + } + var symbol = typeInfoResolver.getSymbolAtLocation(node); + if (!symbol) { + return [getReferenceEntryFromNode(node)]; + } + var declarations = symbol.declarations; + if (!declarations || !declarations.length) { + return undefined; + } + var result; + var searchMeaning = getIntersectingMeaningFromDeclarations(getMeaningFromLocation(node), declarations); + var declaredName = getDeclaredName(symbol); + var scope = getSymbolScope(symbol); + if (scope) { + result = []; + getReferencesInNode(scope, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result); + } + else { + if (searchOnlyInCurrentFile) { + ts.Debug.assert(sourceFiles.length === 1); + result = []; + getReferencesInNode(sourceFiles[0], symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result); + } + else { + var internedName = getInternedName(symbol, declarations); + ts.forEach(sourceFiles, function (sourceFile) { + cancellationToken.throwIfCancellationRequested(); + if (!sourceFile.nameTable) { + initializeNameTable(sourceFile); + } + ts.Debug.assert(sourceFile.nameTable !== undefined); + if (ts.lookUp(sourceFile.nameTable, internedName)) { + result = result || []; + getReferencesInNode(sourceFile, symbol, declaredName, node, searchMeaning, findInStrings, findInComments, result); + } + }); + } + } + return result; + function getDeclaredName(symbol) { + var name = typeInfoResolver.symbolToString(symbol); + return stripQuotes(name); + } + function getInternedName(symbol, declarations) { + var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 158 ? d : undefined; }); + if (functionExpression && functionExpression.name) { + var name = functionExpression.name.text; + } + else { + var name = symbol.name; + } + return stripQuotes(name); + } + function stripQuotes(name) { + var length = name.length; + if (length >= 2 && name.charCodeAt(0) === 34 && name.charCodeAt(length - 1) === 34) { + return name.substring(1, length - 1); + } + ; + return name; + } + function getSymbolScope(symbol) { + if (symbol.getFlags() && (4 | 8192)) { + var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); + if (privateDeclaration) { + return ts.getAncestor(privateDeclaration, 194); + } + } + if (symbol.parent || (symbol.getFlags() & 268435456)) { + return undefined; + } + var scope = undefined; + var declarations = symbol.getDeclarations(); + if (declarations) { + for (var i = 0, n = declarations.length; i < n; i++) { + var container = getContainerNode(declarations[i]); + if (!container) { + return undefined; + } + if (scope && scope !== container) { + return undefined; + } + if (container.kind === 210 && !ts.isExternalModule(container)) { + return undefined; + } + scope = container; + } + } + return scope; + } + function getPossibleSymbolReferencePositions(sourceFile, symbolName, start, end) { + var positions = []; + if (!symbolName || !symbolName.length) { + return positions; + } + var text = sourceFile.text; + var sourceLength = text.length; + var symbolNameLength = symbolName.length; + var position = text.indexOf(symbolName, start); + while (position >= 0) { + cancellationToken.throwIfCancellationRequested(); + if (position > end) + break; + var endPosition = position + symbolNameLength; + if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && + (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { + positions.push(position); + } + position = text.indexOf(symbolName, position + symbolNameLength + 1); + } + return positions; + } + function getLabelReferencesInNode(container, targetLabel) { + var result = []; + var sourceFile = container.getSourceFile(); + var labelName = targetLabel.text; + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, labelName, container.getStart(), container.getEnd()); + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.getWidth() !== labelName.length) { + return; + } + if (node === targetLabel || + (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { + result.push(getReferenceEntryFromNode(node)); + } + }); + return result; + } + function isValidReferencePosition(node, searchSymbolName) { + if (node) { + switch (node.kind) { + case 64: + return node.getWidth() === searchSymbolName.length; + case 8: + if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || + isNameOfExternalModuleImportOrDeclaration(node)) { + return node.getWidth() === searchSymbolName.length + 2; + } + break; + case 7: + if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node)) { + return node.getWidth() === searchSymbolName.length; + } + break; + } + } + return false; + } + function getReferencesInNode(container, searchSymbol, searchText, searchLocation, searchMeaning, findInStrings, findInComments, result) { + var sourceFile = container.getSourceFile(); + var tripleSlashDirectivePrefixRegex = /^\/\/\/\s*= 0) { + result.push(getReferenceEntryFromNode(referenceSymbolDeclaration.name)); + } + } + }); + } + function isInString(position) { + var token = ts.getTokenAtPosition(sourceFile, position); + return token && token.kind === 8 && position > token.getStart(); + } + function isInComment(position) { + var token = ts.getTokenAtPosition(sourceFile, position); + if (token && position < token.getStart()) { + var commentRanges = ts.getLeadingCommentRanges(sourceFile.text, token.pos); + return ts.forEach(commentRanges, function (c) { + if (c.pos < position && position < c.end) { + var commentText = sourceFile.text.substring(c.pos, c.end); + if (!tripleSlashDirectivePrefixRegex.test(commentText)) { + return true; + } + } + }); + } + return false; + } + } + function getReferencesForSuperKeyword(superKeyword) { + var searchSpaceNode = ts.getSuperContainer(superKeyword, false); + if (!searchSpaceNode) { + return undefined; + } + var staticFlag = 128; + switch (searchSpaceNode.kind) { + case 128: + case 127: + case 130: + case 129: + case 131: + case 132: + case 133: + staticFlag &= searchSpaceNode.flags; + searchSpaceNode = searchSpaceNode.parent; + break; + default: + return undefined; + } + var result = []; + var sourceFile = searchSpaceNode.getSourceFile(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "super", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.kind !== 90) { + return; + } + var container = ts.getSuperContainer(node, false); + if (container && (128 & container.flags) === staticFlag && container.parent.symbol === searchSpaceNode.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + }); + return result; + } + function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles) { + var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); + var staticFlag = 128; + switch (searchSpaceNode.kind) { + case 130: + case 129: + if (ts.isObjectLiteralMethod(searchSpaceNode)) { + break; + } + case 128: + case 127: + case 131: + case 132: + case 133: + staticFlag &= searchSpaceNode.flags; + searchSpaceNode = searchSpaceNode.parent; + break; + case 210: + if (ts.isExternalModule(searchSpaceNode)) { + return undefined; + } + case 193: + case 158: + break; + default: + return undefined; + } + var result = []; + if (searchSpaceNode.kind === 210) { + ts.forEach(sourceFiles, function (sourceFile) { + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); + getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, result); + }); + } + else { + var sourceFile = searchSpaceNode.getSourceFile(); + var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", searchSpaceNode.getStart(), searchSpaceNode.getEnd()); + getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result); + } + return result; + function getThisReferencesInFile(sourceFile, searchSpaceNode, possiblePositions, result) { + ts.forEach(possiblePositions, function (position) { + cancellationToken.throwIfCancellationRequested(); + var node = ts.getTouchingWord(sourceFile, position); + if (!node || node.kind !== 92) { + return; + } + var container = ts.getThisContainer(node, false); + switch (searchSpaceNode.kind) { + case 158: + case 193: + if (searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 130: + case 129: + if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 194: + if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { + result.push(getReferenceEntryFromNode(node)); + } + break; + case 210: + if (container.kind === 210 && !ts.isExternalModule(container)) { + result.push(getReferenceEntryFromNode(node)); + } + break; + } + }); + } + } + function populateSearchSymbolSet(symbol, location) { + var result = [symbol]; + if (isNameOfPropertyAssignment(location)) { + ts.forEach(getPropertySymbolsFromContextualType(location), function (contextualSymbol) { + result.push.apply(result, typeInfoResolver.getRootSymbols(contextualSymbol)); + }); + var shorthandValueSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(location.parent); + if (shorthandValueSymbol) { + result.push(shorthandValueSymbol); + } + } + ts.forEach(typeInfoResolver.getRootSymbols(symbol), function (rootSymbol) { + if (rootSymbol !== symbol) { + result.push(rootSymbol); + } + if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); + } + }); + return result; + } + function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { + if (symbol && symbol.flags & (32 | 64)) { + ts.forEach(symbol.getDeclarations(), function (declaration) { + if (declaration.kind === 194) { + getPropertySymbolFromTypeReference(ts.getClassBaseTypeNode(declaration)); + ts.forEach(ts.getClassImplementedTypeNodes(declaration), getPropertySymbolFromTypeReference); + } + else if (declaration.kind === 195) { + ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); + } + }); + } + return; + function getPropertySymbolFromTypeReference(typeReference) { + if (typeReference) { + var type = typeInfoResolver.getTypeAtLocation(typeReference); + if (type) { + var propertySymbol = typeInfoResolver.getPropertyOfType(type, propertyName); + if (propertySymbol) { + result.push(propertySymbol); + } + getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result); + } + } + } + } + function isRelatableToSearchSet(searchSymbols, referenceSymbol, referenceLocation) { + if (searchSymbols.indexOf(referenceSymbol) >= 0) { + return true; + } + if (isNameOfPropertyAssignment(referenceLocation)) { + return ts.forEach(getPropertySymbolsFromContextualType(referenceLocation), function (contextualSymbol) { + return ts.forEach(typeInfoResolver.getRootSymbols(contextualSymbol), function (s) { return searchSymbols.indexOf(s) >= 0; }); + }); + } + return ts.forEach(typeInfoResolver.getRootSymbols(referenceSymbol), function (rootSymbol) { + if (searchSymbols.indexOf(rootSymbol) >= 0) { + return true; + } + if (rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { + var result = []; + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result); + return ts.forEach(result, function (s) { return searchSymbols.indexOf(s) >= 0; }); + } + return false; + }); + } + function getPropertySymbolsFromContextualType(node) { + if (isNameOfPropertyAssignment(node)) { + var objectLiteral = node.parent.parent; + var contextualType = typeInfoResolver.getContextualType(objectLiteral); + var name = node.text; + if (contextualType) { + if (contextualType.flags & 16384) { + var unionProperty = contextualType.getProperty(name); + if (unionProperty) { + return [unionProperty]; + } + else { + var result = []; + ts.forEach(contextualType.types, function (t) { + var symbol = t.getProperty(name); + if (symbol) { + result.push(symbol); + } + }); + return result; + } + } + else { + var symbol = contextualType.getProperty(name); + if (symbol) { + return [symbol]; + } + } + } + } + return undefined; + } + function getIntersectingMeaningFromDeclarations(meaning, declarations) { + if (declarations) { + do { + var lastIterationMeaning = meaning; + for (var i = 0, n = declarations.length; i < n; i++) { + var declarationMeaning = getMeaningFromDeclaration(declarations[i]); + if (declarationMeaning & meaning) { + meaning |= declarationMeaning; + } + } + } while (meaning !== lastIterationMeaning); + } + return meaning; + } + } + function getReferenceEntryFromNode(node) { + var start = node.getStart(); + var end = node.getEnd(); + if (node.kind === 8) { + start += 1; + end -= 1; + } + return { + fileName: node.getSourceFile().fileName, + textSpan: ts.createTextSpanFromBounds(start, end), + isWriteAccess: isWriteAccess(node) + }; + } + function isWriteAccess(node) { + if (node.kind === 64 && ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + return true; + } + var parent = node.parent; + if (parent) { + if (parent.kind === 164 || parent.kind === 163) { + return true; + } + else if (parent.kind === 165 && parent.left === node) { + var operator = parent.operatorToken.kind; + return 52 <= operator && operator <= 63; + } + } + return false; + } + function getNavigateToItems(searchValue, maxResultCount) { + synchronizeHostData(); + return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount); + } + function containErrors(diagnostics) { + return ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1; }); + } + function getEmitOutput(fileName) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + var outputFiles = []; + function writeFile(fileName, data, writeByteOrderMark) { + outputFiles.push({ + name: fileName, + writeByteOrderMark: writeByteOrderMark, + text: data + }); + } + var emitOutput = program.emit(sourceFile, writeFile); + return { + outputFiles: outputFiles, + emitSkipped: emitOutput.emitSkipped + }; + } + function getMeaningFromDeclaration(node) { + switch (node.kind) { + case 126: + case 191: + case 148: + case 128: + case 127: + case 207: + case 208: + case 209: + case 130: + case 129: + case 131: + case 132: + case 133: + case 193: + case 158: + case 159: + case 206: + return 1; + case 125: + case 195: + case 196: + case 141: + return 2; + case 194: + case 197: + return 1 | 2; + case 198: + if (node.name.kind === 8) { + return 4 | 1; + } + else if (ts.getModuleInstanceState(node) === 1) { + return 4 | 1; + } + else { + return 4; + } + case 200: + return 1 | 2 | 4; + case 210: + return 4 | 1; + } + ts.Debug.fail("Unknown declaration type"); + } + function isTypeReference(node) { + if (isRightSideOfQualifiedName(node)) { + node = node.parent; + } + return node.parent.kind === 137; + } + function isNamespaceReference(node) { + var root = node; + var isLastClause = true; + if (root.parent.kind === 123) { + while (root.parent && root.parent.kind === 123) + root = root.parent; + isLastClause = root.right === node; + } + return root.parent.kind === 137 && !isLastClause; + } + function isInRightSideOfImport(node) { + while (node.parent.kind === 123) { + node = node.parent; + } + return ts.isInternalModuleImportDeclaration(node.parent) && node.parent.moduleReference === node; + } + function getMeaningFromRightHandSideOfImport(node) { + ts.Debug.assert(node.kind === 64); + if (node.parent.kind === 123 && + node.parent.right === node && + node.parent.parent.kind === 200) { + return 1 | 2 | 4; + } + return 4; + } + function getMeaningFromLocation(node) { + if (node.parent.kind === 201) { + return 1 | 2 | 4; + } + else if (isInRightSideOfImport(node)) { + return getMeaningFromRightHandSideOfImport(node); + } + else if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { + return getMeaningFromDeclaration(node.parent); + } + else if (isTypeReference(node)) { + return 2; + } + else if (isNamespaceReference(node)) { + return 4; + } + else { + return 1; + } + } + function getSignatureHelpItems(fileName, position) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + return ts.SignatureHelp.getSignatureHelpItems(sourceFile, position, typeInfoResolver, cancellationToken); + } + function getCurrentSourceFile(fileName) { + fileName = ts.normalizeSlashes(fileName); + var currentSourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + return currentSourceFile; + } + function getNameOrDottedNameSpan(fileName, startPos, endPos) { + fileName = ts.normalizeSlashes(fileName); + var node = ts.getTouchingPropertyName(getCurrentSourceFile(fileName), startPos); + if (!node) { + return; + } + switch (node.kind) { + case 151: + case 123: + case 8: + case 79: + case 94: + case 88: + case 90: + case 92: + case 64: + break; + default: + return; + } + var nodeForStartPos = node; + while (true) { + if (isRightSideOfPropertyAccess(nodeForStartPos) || isRightSideOfQualifiedName(nodeForStartPos)) { + nodeForStartPos = nodeForStartPos.parent; + } + else if (isNameOfModuleDeclaration(nodeForStartPos)) { + if (nodeForStartPos.parent.parent.kind === 198 && + nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { + nodeForStartPos = nodeForStartPos.parent.parent.name; + } + else { + break; + } + } + else { + break; + } + } + return ts.createTextSpanFromBounds(nodeForStartPos.getStart(), node.getEnd()); + } + function getBreakpointStatementAtPosition(fileName, position) { + fileName = ts.normalizeSlashes(fileName); + return ts.BreakpointResolver.spanInSourceFileAtLocation(getCurrentSourceFile(fileName), position); + } + function getNavigationBarItems(fileName) { + fileName = ts.normalizeSlashes(fileName); + return ts.NavigationBar.getNavigationBarItems(getCurrentSourceFile(fileName)); + } + function getSemanticClassifications(fileName, span) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + var result = []; + processNode(sourceFile); + return result; + function classifySymbol(symbol, meaningAtPosition) { + var flags = symbol.getFlags(); + if (flags & 32) { + return ClassificationTypeNames.className; + } + else if (flags & 384) { + return ClassificationTypeNames.enumName; + } + else if (flags & 524288) { + return ClassificationTypeNames.typeAlias; + } + else if (meaningAtPosition & 2) { + if (flags & 64) { + return ClassificationTypeNames.interfaceName; + } + else if (flags & 262144) { + return ClassificationTypeNames.typeParameterName; + } + } + else if (flags & 1536) { + if (meaningAtPosition & 4 || + (meaningAtPosition & 1 && hasValueSideModule(symbol))) { + return ClassificationTypeNames.moduleName; + } + } + return undefined; + function hasValueSideModule(symbol) { + return ts.forEach(symbol.declarations, function (declaration) { + return declaration.kind === 198 && ts.getModuleInstanceState(declaration) == 1; + }); + } + } + function processNode(node) { + if (node && ts.textSpanIntersectsWith(span, node.getStart(), node.getWidth())) { + if (node.kind === 64 && node.getWidth() > 0) { + var symbol = typeInfoResolver.getSymbolAtLocation(node); + if (symbol) { + var type = classifySymbol(symbol, getMeaningFromLocation(node)); + if (type) { + result.push({ + textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), + classificationType: type + }); + } + } + } + ts.forEachChild(node, processNode); + } + } + } + function getSyntacticClassifications(fileName, span) { + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); + var triviaScanner = ts.createScanner(2, false, sourceFile.text); + var mergeConflictScanner = ts.createScanner(2, false, sourceFile.text); + var result = []; + processElement(sourceFile); + return result; + function classifyLeadingTrivia(token) { + var tokenStart = ts.skipTrivia(sourceFile.text, token.pos, false); + if (tokenStart === token.pos) { + return; + } + triviaScanner.setTextPos(token.pos); + while (true) { + var start = triviaScanner.getTextPos(); + var kind = triviaScanner.scan(); + var end = triviaScanner.getTextPos(); + var width = end - start; + if (ts.textSpanIntersectsWith(span, start, width)) { + if (!ts.isTrivia(kind)) { + return; + } + if (ts.isComment(kind)) { + result.push({ + textSpan: ts.createTextSpan(start, width), + classificationType: ClassificationTypeNames.comment + }); + continue; + } + if (kind === 6) { + var text = sourceFile.text; + var ch = text.charCodeAt(start); + if (ch === 60 || ch === 62) { + result.push({ + textSpan: ts.createTextSpan(start, width), + classificationType: ClassificationTypeNames.comment + }); + continue; + } + ts.Debug.assert(ch === 61); + classifyDisabledMergeCode(text, start, end); + } + } + } + } + function classifyDisabledMergeCode(text, start, end) { + for (var i = start; i < end; i++) { + if (ts.isLineBreak(text.charCodeAt(i))) { + break; + } + } + result.push({ + textSpan: ts.createTextSpanFromBounds(start, i), + classificationType: ClassificationTypeNames.comment + }); + mergeConflictScanner.setTextPos(i); + while (mergeConflictScanner.getTextPos() < end) { + classifyDisabledCodeToken(); + } + } + function classifyDisabledCodeToken() { + var start = mergeConflictScanner.getTextPos(); + var tokenKind = mergeConflictScanner.scan(); + var end = mergeConflictScanner.getTextPos(); + var type = classifyTokenType(tokenKind); + if (type) { + result.push({ + textSpan: ts.createTextSpanFromBounds(start, end), + classificationType: type + }); + } + } + function classifyToken(token) { + classifyLeadingTrivia(token); + if (token.getWidth() > 0) { + var type = classifyTokenType(token.kind, token); + if (type) { + result.push({ + textSpan: ts.createTextSpan(token.getStart(), token.getWidth()), + classificationType: type + }); + } + } + } + function classifyTokenType(tokenKind, token) { + if (ts.isKeyword(tokenKind)) { + return ClassificationTypeNames.keyword; + } + if (tokenKind === 24 || tokenKind === 25) { + if (token && ts.getTypeArgumentOrTypeParameterList(token.parent)) { + return ClassificationTypeNames.punctuation; + } + } + if (ts.isPunctuation(tokenKind)) { + if (token) { + if (tokenKind === 52) { + if (token.parent.kind === 191 || + token.parent.kind === 128 || + token.parent.kind === 126) { + return ClassificationTypeNames.operator; + } + } + if (token.parent.kind === 165 || + token.parent.kind === 163 || + token.parent.kind === 164 || + token.parent.kind === 166) { + return ClassificationTypeNames.operator; + } + } + return ClassificationTypeNames.punctuation; + } + else if (tokenKind === 7) { + return ClassificationTypeNames.numericLiteral; + } + else if (tokenKind === 8) { + return ClassificationTypeNames.stringLiteral; + } + else if (tokenKind === 9) { + return ClassificationTypeNames.stringLiteral; + } + else if (ts.isTemplateLiteralKind(tokenKind)) { + return ClassificationTypeNames.stringLiteral; + } + else if (tokenKind === 64) { + if (token) { + switch (token.parent.kind) { + case 194: + if (token.parent.name === token) { + return ClassificationTypeNames.className; + } + return; + case 125: + if (token.parent.name === token) { + return ClassificationTypeNames.typeParameterName; + } + return; + case 195: + if (token.parent.name === token) { + return ClassificationTypeNames.interfaceName; + } + return; + case 197: + if (token.parent.name === token) { + return ClassificationTypeNames.enumName; + } + return; + case 198: + if (token.parent.name === token) { + return ClassificationTypeNames.moduleName; + } + return; + } + } + return ClassificationTypeNames.text; + } + } + function processElement(element) { + if (ts.textSpanIntersectsWith(span, element.getFullStart(), element.getFullWidth())) { + var children = element.getChildren(); + for (var i = 0, n = children.length; i < n; i++) { + var child = children[i]; + if (ts.isToken(child)) { + classifyToken(child); + } + else { + processElement(child); + } + } + } + } + } + function getOutliningSpans(fileName) { + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); + return ts.OutliningElementsCollector.collectElements(sourceFile); + } + function getBraceMatchingAtPosition(fileName, position) { + var sourceFile = getCurrentSourceFile(fileName); + var result = []; + var token = ts.getTouchingToken(sourceFile, position); + if (token.getStart(sourceFile) === position) { + var matchKind = getMatchingTokenKind(token); + if (matchKind) { + var parentElement = token.parent; + var childNodes = parentElement.getChildren(sourceFile); + for (var i = 0, n = childNodes.length; i < n; i++) { + var current = childNodes[i]; + if (current.kind === matchKind) { + var range1 = ts.createTextSpan(token.getStart(sourceFile), token.getWidth(sourceFile)); + var range2 = ts.createTextSpan(current.getStart(sourceFile), current.getWidth(sourceFile)); + if (range1.start < range2.start) { + result.push(range1, range2); + } + else { + result.push(range2, range1); + } + break; + } + } + } + } + return result; + function getMatchingTokenKind(token) { + switch (token.kind) { + case 14: return 15; + case 16: return 17; + case 18: return 19; + case 24: return 25; + case 15: return 14; + case 17: return 16; + case 19: return 18; + case 25: return 24; + } + return undefined; + } + } + function getIndentationAtPosition(fileName, position, editorOptions) { + fileName = ts.normalizeSlashes(fileName); + var start = new Date().getTime(); + var sourceFile = getCurrentSourceFile(fileName); + log("getIndentationAtPosition: getCurrentSourceFile: " + (new Date().getTime() - start)); + var start = new Date().getTime(); + var result = ts.formatting.SmartIndenter.getIndentation(position, sourceFile, editorOptions); + log("getIndentationAtPosition: computeIndentation : " + (new Date().getTime() - start)); + return result; + } + function getFormattingEditsForRange(fileName, start, end, options) { + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); + return ts.formatting.formatSelection(start, end, sourceFile, getRuleProvider(options), options); + } + function getFormattingEditsForDocument(fileName, options) { + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); + return ts.formatting.formatDocument(sourceFile, getRuleProvider(options), options); + } + function getFormattingEditsAfterKeystroke(fileName, position, key, options) { + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getCurrentSourceFile(fileName); + if (key === "}") { + return ts.formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(options), options); + } + else if (key === ";") { + return ts.formatting.formatOnSemicolon(position, sourceFile, getRuleProvider(options), options); + } + else if (key === "\n") { + return ts.formatting.formatOnEnter(position, sourceFile, getRuleProvider(options), options); + } + return []; + } + function getTodoComments(fileName, descriptors) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + cancellationToken.throwIfCancellationRequested(); + var fileContents = sourceFile.text; + var result = []; + if (descriptors.length > 0) { + var regExp = getTodoCommentsRegExp(); + var matchArray; + while (matchArray = regExp.exec(fileContents)) { + cancellationToken.throwIfCancellationRequested(); + var firstDescriptorCaptureIndex = 3; + ts.Debug.assert(matchArray.length === descriptors.length + firstDescriptorCaptureIndex); + var preamble = matchArray[1]; + var matchPosition = matchArray.index + preamble.length; + var token = ts.getTokenAtPosition(sourceFile, matchPosition); + if (!isInsideComment(sourceFile, token, matchPosition)) { + continue; + } + var descriptor = undefined; + for (var i = 0, n = descriptors.length; i < n; i++) { + if (matchArray[i + firstDescriptorCaptureIndex]) { + descriptor = descriptors[i]; + } + } + ts.Debug.assert(descriptor !== undefined); + if (isLetterOrDigit(fileContents.charCodeAt(matchPosition + descriptor.text.length))) { + continue; + } + var message = matchArray[2]; + result.push({ + descriptor: descriptor, + message: message, + position: matchPosition + }); + } + } + return result; + function escapeRegExp(str) { + return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + } + function getTodoCommentsRegExp() { + var singleLineCommentStart = /(?:\/\/+\s*)/.source; + var multiLineCommentStart = /(?:\/\*+\s*)/.source; + var anyNumberOfSpacesAndAsterixesAtStartOfLine = /(?:^(?:\s|\*)*)/.source; + var preamble = "(" + anyNumberOfSpacesAndAsterixesAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")"; + var literals = "(?:" + ts.map(descriptors, function (d) { return "(" + escapeRegExp(d.text) + ")"; }).join("|") + ")"; + var endOfLineOrEndOfComment = /(?:$|\*\/)/.source; + var messageRemainder = /(?:.*?)/.source; + var messagePortion = "(" + literals + messageRemainder + ")"; + var regExpString = preamble + messagePortion + endOfLineOrEndOfComment; + return new RegExp(regExpString, "gim"); + } + function isLetterOrDigit(char) { + return (char >= 97 && char <= 122) || + (char >= 65 && char <= 90) || + (char >= 48 && char <= 57); + } + } + function getRenameInfo(fileName, position) { + synchronizeHostData(); + fileName = ts.normalizeSlashes(fileName); + var sourceFile = getValidSourceFile(fileName); + var node = ts.getTouchingWord(sourceFile, position); + if (node && node.kind === 64) { + var symbol = typeInfoResolver.getSymbolAtLocation(node); + if (symbol) { + var declarations = symbol.getDeclarations(); + if (declarations && declarations.length > 0) { + var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); + if (defaultLibFileName) { + for (var i = 0; i < declarations.length; i++) { + var sourceFile = declarations[i].getSourceFile(); + if (sourceFile && getCanonicalFileName(ts.normalizePath(sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); + } + } + } + var kind = getSymbolKind(symbol, typeInfoResolver, node); + if (kind) { + return { + canRename: true, + localizedErrorMessage: undefined, + displayName: symbol.name, + fullDisplayName: typeInfoResolver.getFullyQualifiedName(symbol), + kind: kind, + kindModifiers: getSymbolModifiers(symbol), + triggerSpan: ts.createTextSpan(node.getStart(), node.getWidth()) + }; + } + } + } + } + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element.key)); + function getRenameInfoError(localizedErrorMessage) { + return { + canRename: false, + localizedErrorMessage: localizedErrorMessage, + displayName: undefined, + fullDisplayName: undefined, + kind: undefined, + kindModifiers: undefined, + triggerSpan: undefined + }; + } + } + return { + dispose: dispose, + cleanupSemanticCache: cleanupSemanticCache, + getSyntacticDiagnostics: getSyntacticDiagnostics, + getSemanticDiagnostics: getSemanticDiagnostics, + getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics, + getSyntacticClassifications: getSyntacticClassifications, + getSemanticClassifications: getSemanticClassifications, + getCompletionsAtPosition: getCompletionsAtPosition, + getCompletionEntryDetails: getCompletionEntryDetails, + getSignatureHelpItems: getSignatureHelpItems, + getQuickInfoAtPosition: getQuickInfoAtPosition, + getDefinitionAtPosition: getDefinitionAtPosition, + getReferencesAtPosition: getReferencesAtPosition, + getOccurrencesAtPosition: getOccurrencesAtPosition, + getNameOrDottedNameSpan: getNameOrDottedNameSpan, + getBreakpointStatementAtPosition: getBreakpointStatementAtPosition, + getNavigateToItems: getNavigateToItems, + getRenameInfo: getRenameInfo, + findRenameLocations: findRenameLocations, + getNavigationBarItems: getNavigationBarItems, + getOutliningSpans: getOutliningSpans, + getTodoComments: getTodoComments, + getBraceMatchingAtPosition: getBraceMatchingAtPosition, + getIndentationAtPosition: getIndentationAtPosition, + getFormattingEditsForRange: getFormattingEditsForRange, + getFormattingEditsForDocument: getFormattingEditsForDocument, + getFormattingEditsAfterKeystroke: getFormattingEditsAfterKeystroke, + getEmitOutput: getEmitOutput, + getSourceFile: getCurrentSourceFile, + getProgram: getProgram + }; + } + ts.createLanguageService = createLanguageService; + function createClassifier() { + var scanner = ts.createScanner(2, false); + var noRegexTable = []; + noRegexTable[64] = true; + noRegexTable[8] = true; + noRegexTable[7] = true; + noRegexTable[9] = true; + noRegexTable[92] = true; + noRegexTable[38] = true; + noRegexTable[39] = true; + noRegexTable[17] = true; + noRegexTable[19] = true; + noRegexTable[15] = true; + noRegexTable[94] = true; + noRegexTable[79] = true; + var templateStack = []; + function isAccessibilityModifier(kind) { + switch (kind) { + case 107: + case 105: + case 106: + return true; + } + return false; + } + function canFollow(keyword1, keyword2) { + if (isAccessibilityModifier(keyword1)) { + if (keyword2 === 114 || + keyword2 === 118 || + keyword2 === 112 || + keyword2 === 108) { + return true; + } + return false; + } + return true; + } + function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) { + var offset = 0; + var token = 0; + var lastNonTriviaToken = 0; + while (templateStack.length > 0) { + templateStack.pop(); + } + switch (lexState) { + case 3: + text = '"\\\n' + text; + offset = 3; + break; + case 2: + text = "'\\\n" + text; + offset = 3; + break; + case 1: + text = "/*\n" + text; + offset = 3; + break; + case 4: + text = "`\n" + text; + offset = 2; + break; + case 5: + text = "}\n" + text; + offset = 2; + case 6: + templateStack.push(11); + break; + } + scanner.setText(text); + var result = { + finalLexState: 0, + entries: [] + }; + var angleBracketStack = 0; + do { + token = scanner.scan(); + if (!ts.isTrivia(token)) { + if ((token === 36 || token === 56) && !noRegexTable[lastNonTriviaToken]) { + if (scanner.reScanSlashToken() === 9) { + token = 9; + } + } + else if (lastNonTriviaToken === 20 && isKeyword(token)) { + token = 64; + } + else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { + token = 64; + } + else if (lastNonTriviaToken === 64 && + token === 24) { + angleBracketStack++; + } + else if (token === 25 && angleBracketStack > 0) { + angleBracketStack--; + } + else if (token === 110 || + token === 119 || + token === 117 || + token === 111 || + token === 120) { + if (angleBracketStack > 0 && !syntacticClassifierAbsent) { + token = 64; + } + } + else if (token === 11) { + templateStack.push(token); + } + else if (token === 14) { + if (templateStack.length > 0) { + templateStack.push(token); + } + } + else if (token === 15) { + if (templateStack.length > 0) { + var lastTemplateStackToken = ts.lastOrUndefined(templateStack); + if (lastTemplateStackToken === 11) { + token = scanner.reScanTemplateToken(); + if (token === 13) { + templateStack.pop(); + } + else { + ts.Debug.assert(token === 12, "Should have been a template middle. Was " + token); + } + } + else { + ts.Debug.assert(lastTemplateStackToken === 14, "Should have been an open brace. Was: " + token); + templateStack.pop(); + } + } + } + lastNonTriviaToken = token; + } + processToken(); + } while (token !== 1); + return result; + function processToken() { + var start = scanner.getTokenPos(); + var end = scanner.getTextPos(); + addResult(end - start, classFromKind(token)); + if (end >= text.length) { + if (token === 8) { + var tokenText = scanner.getTokenText(); + if (scanner.isUnterminated()) { + var lastCharIndex = tokenText.length - 1; + var numBackslashes = 0; + while (tokenText.charCodeAt(lastCharIndex - numBackslashes) === 92) { + numBackslashes++; + } + if (numBackslashes & 1) { + var quoteChar = tokenText.charCodeAt(0); + result.finalLexState = quoteChar === 34 ? 3 : 2; + } + } + } + else if (token === 3) { + if (scanner.isUnterminated()) { + result.finalLexState = 1; + } + } + else if (ts.isTemplateLiteralKind(token)) { + if (scanner.isUnterminated()) { + if (token === 13) { + result.finalLexState = 5; + } + else if (token === 10) { + result.finalLexState = 4; + } + else { + ts.Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #" + token); + } + } + } + else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 11) { + result.finalLexState = 6; + } + } + } + function addResult(length, classification) { + if (length > 0) { + if (result.entries.length === 0) { + length -= offset; + } + result.entries.push({ length: length, classification: classification }); + } + } + } + function isBinaryExpressionOperatorToken(token) { + switch (token) { + case 35: + case 36: + case 37: + case 33: + case 34: + case 40: + case 41: + case 42: + case 24: + case 25: + case 26: + case 27: + case 86: + case 85: + case 28: + case 29: + case 30: + case 31: + case 43: + case 45: + case 44: + case 48: + case 49: + case 62: + case 61: + case 63: + case 58: + case 59: + case 60: + case 53: + case 54: + case 55: + case 56: + case 57: + case 52: + case 23: + return true; + default: + return false; + } + } + function isPrefixUnaryExpressionOperatorToken(token) { + switch (token) { + case 33: + case 34: + case 47: + case 46: + case 38: + case 39: + return true; + default: + return false; + } + } + function isKeyword(token) { + return token >= 65 && token <= 122; + } + function classFromKind(token) { + if (isKeyword(token)) { + return 1; + } + else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { + return 2; + } + else if (token >= 14 && token <= 63) { + return 0; + } + switch (token) { + case 7: + return 6; + case 8: + return 7; + case 9: + return 8; + case 6: + case 3: + case 2: + return 3; + case 5: + case 4: + return 4; + case 64: + default: + if (ts.isTemplateLiteralKind(token)) { + return 7; + } + return 5; + } + } + return { getClassificationsForLine: getClassificationsForLine }; + } + ts.createClassifier = createClassifier; + function getDefaultLibFilePath(options) { + if (typeof __dirname !== "undefined") { + return __dirname + ts.directorySeparator + ts.getDefaultLibFileName(options); + } + throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. "); + } + ts.getDefaultLibFilePath = getDefaultLibFilePath; + function initializeServices() { + ts.objectAllocator = { + getNodeConstructor: function (kind) { + function Node() { + } + var proto = kind === 210 ? new SourceFileObject() : new NodeObject(); + proto.kind = kind; + proto.pos = 0; + proto.end = 0; + proto.flags = 0; + proto.parent = undefined; + Node.prototype = proto; + return Node; + }, + getSymbolConstructor: function () { return SymbolObject; }, + getTypeConstructor: function () { return TypeObject; }, + getSignatureConstructor: function () { return SignatureObject; } + }; + } + initializeServices(); +})(ts || (ts = {})); +var ts; +(function (ts) { + var BreakpointResolver; + (function (BreakpointResolver) { + function spanInSourceFileAtLocation(sourceFile, position) { + if (sourceFile.flags & 1024) { + return undefined; + } + var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position); + var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line; + if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart()).line > lineOfPosition) { + tokenAtLocation = ts.findPrecedingToken(tokenAtLocation.pos, sourceFile); + if (!tokenAtLocation || sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { + return undefined; + } + } + if (ts.isInAmbientContext(tokenAtLocation)) { + return undefined; + } + return spanInNode(tokenAtLocation); + function textSpan(startNode, endNode) { + return ts.createTextSpanFromBounds(startNode.getStart(), (endNode || startNode).getEnd()); + } + function spanInNodeIfStartsOnSameLine(node, otherwiseOnNode) { + if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart()).line) { + return spanInNode(node); + } + return spanInNode(otherwiseOnNode); + } + function spanInPreviousNode(node) { + return spanInNode(ts.findPrecedingToken(node.pos, sourceFile)); + } + function spanInNextNode(node) { + return spanInNode(ts.findNextToken(node, node.parent)); + } + function spanInNode(node) { + if (node) { + if (ts.isExpression(node)) { + if (node.parent.kind === 177) { + return spanInPreviousNode(node); + } + if (node.parent.kind === 179) { + return textSpan(node); + } + if (node.parent.kind === 165 && node.parent.operatorToken.kind === 23) { + return textSpan(node); + } + if (node.parent.kind == 159 && node.parent.body == node) { + return textSpan(node); + } + } + switch (node.kind) { + case 173: + return spanInVariableDeclaration(node.declarationList.declarations[0]); + case 191: + case 128: + case 127: + return spanInVariableDeclaration(node); + case 126: + return spanInParameterDeclaration(node); + case 193: + case 130: + case 129: + case 132: + case 133: + case 131: + case 158: + case 159: + return spanInFunctionDeclaration(node); + case 172: + if (ts.isFunctionBlock(node)) { + return spanInFunctionBlock(node); + } + case 199: + return spanInBlock(node); + case 206: + return spanInBlock(node.block); + case 175: + return textSpan(node.expression); + case 184: + return textSpan(node.getChildAt(0), node.expression); + case 178: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 177: + return spanInNode(node.statement); + case 190: + return textSpan(node.getChildAt(0)); + case 176: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 187: + return spanInNode(node.statement); + case 183: + case 182: + return textSpan(node.getChildAt(0), node.label); + case 179: + return spanInForStatement(node); + case 180: + case 181: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 186: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 203: + case 204: + return spanInNode(node.statements[0]); + case 189: + return spanInBlock(node.tryBlock); + case 188: + return textSpan(node, node.expression); + case 201: + return textSpan(node, node.exportName); + case 200: + return textSpan(node, node.moduleReference); + case 198: + if (ts.getModuleInstanceState(node) !== 1) { + return undefined; + } + case 194: + case 197: + case 209: + case 153: + case 154: + return textSpan(node); + case 185: + return spanInNode(node.statement); + case 195: + case 196: + return undefined; + case 22: + case 1: + return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile)); + case 23: + return spanInPreviousNode(node); + case 14: + return spanInOpenBraceToken(node); + case 15: + return spanInCloseBraceToken(node); + case 16: + return spanInOpenParenToken(node); + case 17: + return spanInCloseParenToken(node); + case 51: + return spanInColonToken(node); + case 25: + case 24: + return spanInGreaterThanOrLessThanToken(node); + case 99: + return spanInWhileKeyword(node); + case 75: + case 67: + case 80: + return spanInNextNode(node); + default: + if (node.parent.kind === 207 && node.parent.name === node) { + return spanInNode(node.parent.initializer); + } + if (node.parent.kind === 156 && node.parent.type === node) { + return spanInNode(node.parent.expression); + } + if (ts.isAnyFunction(node.parent) && node.parent.type === node) { + return spanInPreviousNode(node); + } + return spanInNode(node.parent); + } + } + function spanInVariableDeclaration(variableDeclaration) { + if (variableDeclaration.parent.parent.kind === 180 || + variableDeclaration.parent.parent.kind === 181) { + return spanInNode(variableDeclaration.parent.parent); + } + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 173; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 179 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement ? variableDeclaration.parent.parent.initializer.declarations : undefined; + if (variableDeclaration.initializer || (variableDeclaration.flags & 1)) { + if (declarations && declarations[0] === variableDeclaration) { + if (isParentVariableStatement) { + return textSpan(variableDeclaration.parent, variableDeclaration); + } + else { + ts.Debug.assert(isDeclarationOfForStatement); + return textSpan(ts.findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration); + } + } + else { + return textSpan(variableDeclaration); + } + } + else if (declarations && declarations[0] !== variableDeclaration) { + var indexOfCurrentDeclaration = ts.indexOf(declarations, variableDeclaration); + return spanInVariableDeclaration(declarations[indexOfCurrentDeclaration - 1]); + } + } + function canHaveSpanInParameterDeclaration(parameter) { + return !!parameter.initializer || parameter.dotDotDotToken !== undefined || + !!(parameter.flags & 16) || !!(parameter.flags & 32); + } + function spanInParameterDeclaration(parameter) { + if (canHaveSpanInParameterDeclaration(parameter)) { + return textSpan(parameter); + } + else { + var functionDeclaration = parameter.parent; + var indexOfParameter = ts.indexOf(functionDeclaration.parameters, parameter); + if (indexOfParameter) { + return spanInParameterDeclaration(functionDeclaration.parameters[indexOfParameter - 1]); + } + else { + return spanInNode(functionDeclaration.body); + } + } + } + function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { + return !!(functionDeclaration.flags & 1) || + (functionDeclaration.parent.kind === 194 && functionDeclaration.kind !== 131); + } + function spanInFunctionDeclaration(functionDeclaration) { + if (!functionDeclaration.body) { + return undefined; + } + if (canFunctionHaveSpanInWholeDeclaration(functionDeclaration)) { + return textSpan(functionDeclaration); + } + return spanInNode(functionDeclaration.body); + } + function spanInFunctionBlock(block) { + var nodeForSpanInBlock = block.statements.length ? block.statements[0] : block.getLastToken(); + if (canFunctionHaveSpanInWholeDeclaration(block.parent)) { + return spanInNodeIfStartsOnSameLine(block.parent, nodeForSpanInBlock); + } + return spanInNode(nodeForSpanInBlock); + } + function spanInBlock(block) { + switch (block.parent.kind) { + case 198: + if (ts.getModuleInstanceState(block.parent) !== 1) { + return undefined; + } + case 178: + case 176: + case 180: + case 181: + return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + case 179: + return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); + } + return spanInNode(block.statements[0]); + } + function spanInForStatement(forStatement) { + if (forStatement.initializer) { + if (forStatement.initializer.kind === 192) { + var variableDeclarationList = forStatement.initializer; + if (variableDeclarationList.declarations.length > 0) { + return spanInNode(variableDeclarationList.declarations[0]); + } + } + else { + return spanInNode(forStatement.initializer); + } + } + if (forStatement.condition) { + return textSpan(forStatement.condition); + } + if (forStatement.iterator) { + return textSpan(forStatement.iterator); + } + } + function spanInOpenBraceToken(node) { + switch (node.parent.kind) { + case 197: + var enumDeclaration = node.parent; + return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); + case 194: + var classDeclaration = node.parent; + return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); + case 186: + return spanInNodeIfStartsOnSameLine(node.parent, node.parent.clauses[0]); + } + return spanInNode(node.parent); + } + function spanInCloseBraceToken(node) { + switch (node.parent.kind) { + case 199: + if (ts.getModuleInstanceState(node.parent.parent) !== 1) { + return undefined; + } + case 197: + case 194: + return textSpan(node); + case 172: + if (ts.isFunctionBlock(node.parent)) { + return textSpan(node); + } + case 206: + return spanInNode(node.parent.statements[node.parent.statements.length - 1]); + ; + case 186: + var switchStatement = node.parent; + var lastClause = switchStatement.clauses[switchStatement.clauses.length - 1]; + if (lastClause) { + return spanInNode(lastClause.statements[lastClause.statements.length - 1]); + } + return undefined; + default: + return spanInNode(node.parent); + } + } + function spanInOpenParenToken(node) { + if (node.parent.kind === 177) { + return spanInPreviousNode(node); + } + return spanInNode(node.parent); + } + function spanInCloseParenToken(node) { + switch (node.parent.kind) { + case 158: + case 193: + case 159: + case 130: + case 129: + case 132: + case 133: + case 131: + case 178: + case 177: + case 179: + return spanInPreviousNode(node); + default: + return spanInNode(node.parent); + } + return spanInNode(node.parent); + } + function spanInColonToken(node) { + if (ts.isAnyFunction(node.parent) || node.parent.kind === 207) { + return spanInPreviousNode(node); + } + return spanInNode(node.parent); + } + function spanInGreaterThanOrLessThanToken(node) { + if (node.parent.kind === 156) { + return spanInNode(node.parent.expression); + } + return spanInNode(node.parent); + } + function spanInWhileKeyword(node) { + if (node.parent.kind === 177) { + return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); + } + return spanInNode(node.parent); + } + } + } + BreakpointResolver.spanInSourceFileAtLocation = spanInSourceFileAtLocation; + })(BreakpointResolver = ts.BreakpointResolver || (ts.BreakpointResolver = {})); +})(ts || (ts = {})); +var debugObjectHost = this; +var ts; +(function (ts) { + function logInternalError(logger, err) { + logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message); + } + var ScriptSnapshotShimAdapter = (function () { + function ScriptSnapshotShimAdapter(scriptSnapshotShim) { + this.scriptSnapshotShim = scriptSnapshotShim; + this.lineStartPositions = null; + } + ScriptSnapshotShimAdapter.prototype.getText = function (start, end) { + return this.scriptSnapshotShim.getText(start, end); + }; + ScriptSnapshotShimAdapter.prototype.getLength = function () { + return this.scriptSnapshotShim.getLength(); + }; + ScriptSnapshotShimAdapter.prototype.getChangeRange = function (oldSnapshot) { + var oldSnapshotShim = oldSnapshot; + var encoded = this.scriptSnapshotShim.getChangeRange(oldSnapshotShim.scriptSnapshotShim); + if (encoded == null) { + return null; + } + var decoded = JSON.parse(encoded); + return ts.createTextChangeRange(ts.createTextSpan(decoded.span.start, decoded.span.length), decoded.newLength); + }; + return ScriptSnapshotShimAdapter; + })(); + var LanguageServiceShimHostAdapter = (function () { + function LanguageServiceShimHostAdapter(shimHost) { + this.shimHost = shimHost; + } + LanguageServiceShimHostAdapter.prototype.log = function (s) { + this.shimHost.log(s); + }; + LanguageServiceShimHostAdapter.prototype.trace = function (s) { + this.shimHost.trace(s); + }; + LanguageServiceShimHostAdapter.prototype.error = function (s) { + this.shimHost.error(s); + }; + LanguageServiceShimHostAdapter.prototype.getCompilationSettings = function () { + var settingsJson = this.shimHost.getCompilationSettings(); + if (settingsJson == null || settingsJson == "") { + throw Error("LanguageServiceShimHostAdapter.getCompilationSettings: empty compilationSettings"); + return null; + } + return JSON.parse(settingsJson); + }; + LanguageServiceShimHostAdapter.prototype.getScriptFileNames = function () { + var encoded = this.shimHost.getScriptFileNames(); + return this.files = JSON.parse(encoded); + }; + LanguageServiceShimHostAdapter.prototype.getScriptSnapshot = function (fileName) { + if (this.files && this.files.indexOf(fileName) < 0) { + return undefined; + } + var scriptSnapshot = this.shimHost.getScriptSnapshot(fileName); + return scriptSnapshot && new ScriptSnapshotShimAdapter(scriptSnapshot); + }; + LanguageServiceShimHostAdapter.prototype.getScriptVersion = function (fileName) { + return this.shimHost.getScriptVersion(fileName); + }; + LanguageServiceShimHostAdapter.prototype.getLocalizedDiagnosticMessages = function () { + var diagnosticMessagesJson = this.shimHost.getLocalizedDiagnosticMessages(); + if (diagnosticMessagesJson == null || diagnosticMessagesJson == "") { + return null; + } + try { + return JSON.parse(diagnosticMessagesJson); + } + catch (e) { + this.log(e.description || "diagnosticMessages.generated.json has invalid JSON format"); + return null; + } + }; + LanguageServiceShimHostAdapter.prototype.getCancellationToken = function () { + return this.shimHost.getCancellationToken(); + }; + LanguageServiceShimHostAdapter.prototype.getCurrentDirectory = function () { + return this.shimHost.getCurrentDirectory(); + }; + LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) { + return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); + }; + return LanguageServiceShimHostAdapter; + })(); + ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter; + function simpleForwardCall(logger, actionDescription, action) { + logger.log(actionDescription); + var start = Date.now(); + var result = action(); + var end = Date.now(); + logger.log(actionDescription + " completed in " + (end - start) + " msec"); + if (typeof (result) === "string") { + var str = result; + if (str.length > 128) { + str = str.substring(0, 128) + "..."; + } + logger.log(" result.length=" + str.length + ", result='" + JSON.stringify(str) + "'"); + } + return result; + } + function forwardJSONCall(logger, actionDescription, action) { + try { + var result = simpleForwardCall(logger, actionDescription, action); + return JSON.stringify({ result: result }); + } + catch (err) { + if (err instanceof ts.OperationCanceledException) { + return JSON.stringify({ canceled: true }); + } + logInternalError(logger, err); + err.description = actionDescription; + return JSON.stringify({ error: err }); + } + } + var ShimBase = (function () { + function ShimBase(factory) { + this.factory = factory; + factory.registerShim(this); + } + ShimBase.prototype.dispose = function (dummy) { + this.factory.unregisterShim(this); + }; + return ShimBase; + })(); + var LanguageServiceShimObject = (function (_super) { + __extends(LanguageServiceShimObject, _super); + function LanguageServiceShimObject(factory, host, languageService) { + _super.call(this, factory); + this.host = host; + this.languageService = languageService; + this.logger = this.host; + } + LanguageServiceShimObject.prototype.forwardJSONCall = function (actionDescription, action) { + return forwardJSONCall(this.logger, actionDescription, action); + }; + LanguageServiceShimObject.prototype.dispose = function (dummy) { + this.logger.log("dispose()"); + this.languageService.dispose(); + this.languageService = null; + if (debugObjectHost && debugObjectHost.CollectGarbage) { + debugObjectHost.CollectGarbage(); + this.logger.log("CollectGarbage()"); + } + this.logger = null; + _super.prototype.dispose.call(this, dummy); + }; + LanguageServiceShimObject.prototype.refresh = function (throwOnError) { + this.forwardJSONCall("refresh(" + throwOnError + ")", function () { + return null; + }); + }; + LanguageServiceShimObject.prototype.cleanupSemanticCache = function () { + var _this = this; + this.forwardJSONCall("cleanupSemanticCache()", function () { + _this.languageService.cleanupSemanticCache(); + return null; + }); + }; + LanguageServiceShimObject.prototype.realizeDiagnostics = function (diagnostics) { + var _this = this; + var newLine = this.getNewLine(); + return diagnostics.map(function (d) { return _this.realizeDiagnostic(d, newLine); }); + }; + LanguageServiceShimObject.prototype.realizeDiagnostic = function (diagnostic, newLine) { + return { + message: ts.flattenDiagnosticMessageText(diagnostic.messageText, newLine), + start: diagnostic.start, + length: diagnostic.length, + category: ts.DiagnosticCategory[diagnostic.category].toLowerCase(), + code: diagnostic.code + }; + }; + LanguageServiceShimObject.prototype.getSyntacticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { + var classifications = _this.languageService.getSyntacticClassifications(fileName, ts.createTextSpan(start, length)); + return classifications; + }); + }; + LanguageServiceShimObject.prototype.getSemanticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { + var classifications = _this.languageService.getSemanticClassifications(fileName, ts.createTextSpan(start, length)); + return classifications; + }); + }; + LanguageServiceShimObject.prototype.getNewLine = function () { + return this.host.getNewLine ? this.host.getNewLine() : "\r\n"; + }; + LanguageServiceShimObject.prototype.getSyntacticDiagnostics = function (fileName) { + var _this = this; + return this.forwardJSONCall("getSyntacticDiagnostics('" + fileName + "')", function () { + var diagnostics = _this.languageService.getSyntacticDiagnostics(fileName); + return _this.realizeDiagnostics(diagnostics); + }); + }; + LanguageServiceShimObject.prototype.getSemanticDiagnostics = function (fileName) { + var _this = this; + return this.forwardJSONCall("getSemanticDiagnostics('" + fileName + "')", function () { + var diagnostics = _this.languageService.getSemanticDiagnostics(fileName); + return _this.realizeDiagnostics(diagnostics); + }); + }; + LanguageServiceShimObject.prototype.getCompilerOptionsDiagnostics = function () { + var _this = this; + return this.forwardJSONCall("getCompilerOptionsDiagnostics()", function () { + var diagnostics = _this.languageService.getCompilerOptionsDiagnostics(); + return _this.realizeDiagnostics(diagnostics); + }); + }; + LanguageServiceShimObject.prototype.getQuickInfoAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getQuickInfoAtPosition('" + fileName + "', " + position + ")", function () { + var quickInfo = _this.languageService.getQuickInfoAtPosition(fileName, position); + return quickInfo; + }); + }; + LanguageServiceShimObject.prototype.getNameOrDottedNameSpan = function (fileName, startPos, endPos) { + var _this = this; + return this.forwardJSONCall("getNameOrDottedNameSpan('" + fileName + "', " + startPos + ", " + endPos + ")", function () { + var spanInfo = _this.languageService.getNameOrDottedNameSpan(fileName, startPos, endPos); + return spanInfo; + }); + }; + LanguageServiceShimObject.prototype.getBreakpointStatementAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getBreakpointStatementAtPosition('" + fileName + "', " + position + ")", function () { + var spanInfo = _this.languageService.getBreakpointStatementAtPosition(fileName, position); + return spanInfo; + }); + }; + LanguageServiceShimObject.prototype.getSignatureHelpItems = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getSignatureHelpItems('" + fileName + "', " + position + ")", function () { + var signatureInfo = _this.languageService.getSignatureHelpItems(fileName, position); + return signatureInfo; + }); + }; + LanguageServiceShimObject.prototype.getDefinitionAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getDefinitionAtPosition('" + fileName + "', " + position + ")", function () { + return _this.languageService.getDefinitionAtPosition(fileName, position); + }); + }; + LanguageServiceShimObject.prototype.getRenameInfo = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { + return _this.languageService.getRenameInfo(fileName, position); + }); + }; + LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments) { + var _this = this; + return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ")", function () { + return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments); + }); + }; + LanguageServiceShimObject.prototype.getBraceMatchingAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getBraceMatchingAtPosition('" + fileName + "', " + position + ")", function () { + var textRanges = _this.languageService.getBraceMatchingAtPosition(fileName, position); + return textRanges; + }); + }; + LanguageServiceShimObject.prototype.getIndentationAtPosition = function (fileName, position, options) { + var _this = this; + return this.forwardJSONCall("getIndentationAtPosition('" + fileName + "', " + position + ")", function () { + var localOptions = JSON.parse(options); + return _this.languageService.getIndentationAtPosition(fileName, position, localOptions); + }); + }; + LanguageServiceShimObject.prototype.getReferencesAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getReferencesAtPosition('" + fileName + "', " + position + ")", function () { + return _this.languageService.getReferencesAtPosition(fileName, position); + }); + }; + LanguageServiceShimObject.prototype.getOccurrencesAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getOccurrencesAtPosition('" + fileName + "', " + position + ")", function () { + return _this.languageService.getOccurrencesAtPosition(fileName, position); + }); + }; + LanguageServiceShimObject.prototype.getCompletionsAtPosition = function (fileName, position) { + var _this = this; + return this.forwardJSONCall("getCompletionsAtPosition('" + fileName + "', " + position + ")", function () { + var completion = _this.languageService.getCompletionsAtPosition(fileName, position); + return completion; + }); + }; + LanguageServiceShimObject.prototype.getCompletionEntryDetails = function (fileName, position, entryName) { + var _this = this; + return this.forwardJSONCall("getCompletionEntryDetails('" + fileName + "', " + position + ", " + entryName + ")", function () { + var details = _this.languageService.getCompletionEntryDetails(fileName, position, entryName); + return details; + }); + }; + LanguageServiceShimObject.prototype.getFormattingEditsForRange = function (fileName, start, end, options) { + var _this = this; + return this.forwardJSONCall("getFormattingEditsForRange('" + fileName + "', " + start + ", " + end + ")", function () { + var localOptions = JSON.parse(options); + var edits = _this.languageService.getFormattingEditsForRange(fileName, start, end, localOptions); + return edits; + }); + }; + LanguageServiceShimObject.prototype.getFormattingEditsForDocument = function (fileName, options) { + var _this = this; + return this.forwardJSONCall("getFormattingEditsForDocument('" + fileName + "')", function () { + var localOptions = JSON.parse(options); + var edits = _this.languageService.getFormattingEditsForDocument(fileName, localOptions); + return edits; + }); + }; + LanguageServiceShimObject.prototype.getFormattingEditsAfterKeystroke = function (fileName, position, key, options) { + var _this = this; + return this.forwardJSONCall("getFormattingEditsAfterKeystroke('" + fileName + "', " + position + ", '" + key + "')", function () { + var localOptions = JSON.parse(options); + var edits = _this.languageService.getFormattingEditsAfterKeystroke(fileName, position, key, localOptions); + return edits; + }); + }; + LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount) { + var _this = this; + return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ")", function () { + var items = _this.languageService.getNavigateToItems(searchValue, maxResultCount); + return items; + }); + }; + LanguageServiceShimObject.prototype.getNavigationBarItems = function (fileName) { + var _this = this; + return this.forwardJSONCall("getNavigationBarItems('" + fileName + "')", function () { + var items = _this.languageService.getNavigationBarItems(fileName); + return items; + }); + }; + LanguageServiceShimObject.prototype.getOutliningSpans = function (fileName) { + var _this = this; + return this.forwardJSONCall("getOutliningSpans('" + fileName + "')", function () { + var items = _this.languageService.getOutliningSpans(fileName); + return items; + }); + }; + LanguageServiceShimObject.prototype.getTodoComments = function (fileName, descriptors) { + var _this = this; + return this.forwardJSONCall("getTodoComments('" + fileName + "')", function () { + var items = _this.languageService.getTodoComments(fileName, JSON.parse(descriptors)); + return items; + }); + }; + LanguageServiceShimObject.prototype.getEmitOutput = function (fileName) { + var _this = this; + return this.forwardJSONCall("getEmitOutput('" + fileName + "')", function () { + var output = _this.languageService.getEmitOutput(fileName); + output.emitOutputStatus = output.emitSkipped ? 1 : 0; + return output; + }); + }; + return LanguageServiceShimObject; + })(ShimBase); + var ClassifierShimObject = (function (_super) { + __extends(ClassifierShimObject, _super); + function ClassifierShimObject(factory) { + _super.call(this, factory); + this.classifier = ts.createClassifier(); + } + ClassifierShimObject.prototype.getClassificationsForLine = function (text, lexState, classifyKeywordsInGenerics) { + var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics); + var items = classification.entries; + var result = ""; + for (var i = 0; i < items.length; i++) { + result += items[i].length + "\n"; + result += items[i].classification + "\n"; + } + result += classification.finalLexState; + return result; + }; + return ClassifierShimObject; + })(ShimBase); + var CoreServicesShimObject = (function (_super) { + __extends(CoreServicesShimObject, _super); + function CoreServicesShimObject(factory, logger) { + _super.call(this, factory); + this.logger = logger; + } + CoreServicesShimObject.prototype.forwardJSONCall = function (actionDescription, action) { + return forwardJSONCall(this.logger, actionDescription, action); + }; + CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { + return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { + var result = ts.preProcessFile(sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength())); + var convertResult = { + referencedFiles: [], + importedFiles: [], + isLibFile: result.isLibFile + }; + ts.forEach(result.referencedFiles, function (refFile) { + convertResult.referencedFiles.push({ + path: ts.normalizePath(refFile.fileName), + position: refFile.pos, + length: refFile.end - refFile.pos + }); + }); + ts.forEach(result.importedFiles, function (importedFile) { + convertResult.importedFiles.push({ + path: ts.normalizeSlashes(importedFile.fileName), + position: importedFile.pos, + length: importedFile.end - importedFile.pos + }); + }); + return convertResult; + }); + }; + CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () { + return this.forwardJSONCall("getDefaultCompilationSettings()", function () { + return ts.getDefaultCompilerOptions(); + }); + }; + return CoreServicesShimObject; + })(ShimBase); + var TypeScriptServicesFactory = (function () { + function TypeScriptServicesFactory() { + this._shims = []; + this.documentRegistry = ts.createDocumentRegistry(); + } + TypeScriptServicesFactory.prototype.getServicesVersion = function () { + return ts.servicesVersion; + }; + TypeScriptServicesFactory.prototype.createLanguageServiceShim = function (host) { + try { + var hostAdapter = new LanguageServiceShimHostAdapter(host); + var languageService = ts.createLanguageService(hostAdapter, this.documentRegistry); + return new LanguageServiceShimObject(this, host, languageService); + } + catch (err) { + logInternalError(host, err); + throw err; + } + }; + TypeScriptServicesFactory.prototype.createClassifierShim = function (logger) { + try { + return new ClassifierShimObject(this); + } + catch (err) { + logInternalError(logger, err); + throw err; + } + }; + TypeScriptServicesFactory.prototype.createCoreServicesShim = function (logger) { + try { + return new CoreServicesShimObject(this, logger); + } + catch (err) { + logInternalError(logger, err); + throw err; + } + }; + TypeScriptServicesFactory.prototype.close = function () { + this._shims = []; + this.documentRegistry = ts.createDocumentRegistry(); + }; + TypeScriptServicesFactory.prototype.registerShim = function (shim) { + this._shims.push(shim); + }; + TypeScriptServicesFactory.prototype.unregisterShim = function (shim) { + for (var i = 0, n = this._shims.length; i < n; i++) { + if (this._shims[i] === shim) { + delete this._shims[i]; + return; + } + } + throw new Error("Invalid operation"); + }; + return TypeScriptServicesFactory; + })(); + ts.TypeScriptServicesFactory = TypeScriptServicesFactory; + if (typeof module !== "undefined" && module.exports) { + module.exports = ts; + } +})(ts || (ts = {})); +var TypeScript; +(function (TypeScript) { + var Services; + (function (Services) { + Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory; + })(Services = TypeScript.Services || (TypeScript.Services = {})); +})(TypeScript || (TypeScript = {})); diff --git a/bin/typescriptServices.d.ts b/bin/typescriptServices.d.ts index 38a7d43c861..4421c8d7255 100644 --- a/bin/typescriptServices.d.ts +++ b/bin/typescriptServices.d.ts @@ -142,110 +142,113 @@ declare module ts { NumberKeyword = 117, SetKeyword = 118, StringKeyword = 119, - TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + SymbolKeyword = 120, + TypeKeyword = 121, + OfKeyword = 122, + QualifiedName = 123, + ComputedPropertyName = 124, + TypeParameter = 125, + Parameter = 126, + PropertySignature = 127, + PropertyDeclaration = 128, + MethodSignature = 129, + MethodDeclaration = 130, + Constructor = 131, + GetAccessor = 132, + SetAccessor = 133, + CallSignature = 134, + ConstructSignature = 135, + IndexSignature = 136, + TypeReference = 137, + FunctionType = 138, + ConstructorType = 139, + TypeQuery = 140, + TypeLiteral = 141, + ArrayType = 142, + TupleType = 143, + UnionType = 144, + ParenthesizedType = 145, + ObjectBindingPattern = 146, + ArrayBindingPattern = 147, + BindingElement = 148, + ArrayLiteralExpression = 149, + ObjectLiteralExpression = 150, + PropertyAccessExpression = 151, + ElementAccessExpression = 152, + CallExpression = 153, + NewExpression = 154, + TaggedTemplateExpression = 155, + TypeAssertionExpression = 156, + ParenthesizedExpression = 157, + FunctionExpression = 158, + ArrowFunction = 159, + DeleteExpression = 160, + TypeOfExpression = 161, + VoidExpression = 162, + PrefixUnaryExpression = 163, + PostfixUnaryExpression = 164, + BinaryExpression = 165, + ConditionalExpression = 166, + TemplateExpression = 167, + YieldExpression = 168, + SpreadElementExpression = 169, + OmittedExpression = 170, + TemplateSpan = 171, + Block = 172, + VariableStatement = 173, + EmptyStatement = 174, + ExpressionStatement = 175, + IfStatement = 176, + DoStatement = 177, + WhileStatement = 178, + ForStatement = 179, + ForInStatement = 180, + ForOfStatement = 181, + ContinueStatement = 182, + BreakStatement = 183, + ReturnStatement = 184, + WithStatement = 185, + SwitchStatement = 186, + LabeledStatement = 187, + ThrowStatement = 188, + TryStatement = 189, + DebuggerStatement = 190, + VariableDeclaration = 191, + VariableDeclarationList = 192, + FunctionDeclaration = 193, + ClassDeclaration = 194, + InterfaceDeclaration = 195, + TypeAliasDeclaration = 196, + EnumDeclaration = 197, + ModuleDeclaration = 198, + ModuleBlock = 199, + ImportDeclaration = 200, + ExportAssignment = 201, + ExternalModuleReference = 202, + CaseClause = 203, + DefaultClause = 204, + HeritageClause = 205, + CatchClause = 206, + PropertyAssignment = 207, + ShorthandPropertyAssignment = 208, + EnumMember = 209, + SourceFile = 210, + SyntaxList = 211, + Count = 212, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 122, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 137, + LastTypeNode = 145, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 120, + LastToken = 122, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -254,7 +257,7 @@ declare module ts { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 123, } const enum NodeFlags { Export = 1, @@ -487,7 +490,7 @@ declare module ts { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { @@ -585,6 +588,10 @@ declare module ts { initializer: VariableDeclarationList | Expression; expression: Expression; } + interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } interface BreakOrContinueStatement extends Statement { label?: Identifier; } @@ -994,8 +1001,9 @@ declare module ts { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, @@ -1281,6 +1289,7 @@ declare module ts { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, @@ -1347,8 +1356,8 @@ declare module ts { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; @@ -1432,9 +1441,9 @@ declare module ts { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -1496,7 +1505,7 @@ declare module ts { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; @@ -1571,6 +1580,7 @@ declare module ts { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number | string; } interface DefinitionInfo { fileName: string; @@ -1704,6 +1714,9 @@ declare module ts { InMultiLineCommentTrivia = 1, InSingleQuoteStringLiteral = 2, InDoubleQuoteStringLiteral = 3, + InTemplateHeadOrNoSubstitutionTemplate = 4, + InTemplateMiddleOrTail = 5, + InTemplateSubstitutionPosition = 6, } enum TokenClass { Punctuation = 0, @@ -1725,7 +1738,26 @@ declare module ts { classification: TokenClass; } interface Classifier { - getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): ClassificationResult; + /** + * Gives lexical classifications of tokens on a line without any syntactic context. + * For instance, a token consisting of the text 'string' can be either an identifier + * named 'string' or the keyword 'string', however, because this classifier is not aware, + * it relies on certain heuristics to give acceptable results. For classifications where + * speed trumps accuracy, this function is preferable; however, for true accuracy, the + * syntactic classifier is ideal. In fact, in certain editing scenarios, combining the + * lexical, syntactic, and semantic classifiers may issue the best user experience. + * + * @param text The text of a line to classify. + * @param lexState The state of the lexical classifier at the end of the previous line. + * @param syntacticClassifierAbsent Whether the client is *not* using a syntactic classifier. + * If there is no syntactic classifier (syntacticClassifierAbsent=true), + * certain heuristics may be used in its place; however, if there is a + * syntactic classifier (syntacticClassifierAbsent=false), certain + * classifications which may be incorrectly categorized will be given + * back as Identifiers in order to allow the syntactic classifier to + * subsume the classification. + */ + getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; } /** * The document registry represents a store of SourceFile objects that can be shared between diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index 6b06fcc1cd9..1d2c9f37ac8 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -136,110 +136,113 @@ var ts; SyntaxKind[SyntaxKind["NumberKeyword"] = 117] = "NumberKeyword"; SyntaxKind[SyntaxKind["SetKeyword"] = 118] = "SetKeyword"; SyntaxKind[SyntaxKind["StringKeyword"] = 119] = "StringKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 120] = "TypeKeyword"; - SyntaxKind[SyntaxKind["QualifiedName"] = 121] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 122] = "ComputedPropertyName"; - SyntaxKind[SyntaxKind["TypeParameter"] = 123] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 124] = "Parameter"; - SyntaxKind[SyntaxKind["PropertySignature"] = 125] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 126] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 127] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 128] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 129] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 130] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 131] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 132] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 133] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 134] = "IndexSignature"; - SyntaxKind[SyntaxKind["TypeReference"] = 135] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 136] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 137] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 138] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 139] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 140] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 141] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 142] = "UnionType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 143] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 144] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 145] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 146] = "BindingElement"; - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 147] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 148] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 149] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 150] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 151] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 152] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 153] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 154] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 155] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 156] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 157] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 158] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 159] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 160] = "VoidExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 161] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 162] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 163] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 164] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 165] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 166] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElementExpression"] = 167] = "SpreadElementExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 168] = "OmittedExpression"; - SyntaxKind[SyntaxKind["TemplateSpan"] = 169] = "TemplateSpan"; - SyntaxKind[SyntaxKind["Block"] = 170] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 171] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 172] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 173] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 174] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 175] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 176] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 177] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 178] = "ForInStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 179] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 180] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 181] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 182] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 183] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 184] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 185] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 186] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 187] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 188] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 189] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 190] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 191] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 192] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 193] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 194] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 195] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 196] = "ModuleBlock"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 197] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 198] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 199] = "ExternalModuleReference"; - SyntaxKind[SyntaxKind["CaseClause"] = 200] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 201] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 202] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 203] = "CatchClause"; - SyntaxKind[SyntaxKind["PropertyAssignment"] = 204] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 205] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["EnumMember"] = 206] = "EnumMember"; - SyntaxKind[SyntaxKind["SourceFile"] = 207] = "SourceFile"; - SyntaxKind[SyntaxKind["SyntaxList"] = 208] = "SyntaxList"; - SyntaxKind[SyntaxKind["Count"] = 209] = "Count"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 120] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 121] = "TypeKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 122] = "OfKeyword"; + SyntaxKind[SyntaxKind["QualifiedName"] = 123] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 124] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["TypeParameter"] = 125] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 126] = "Parameter"; + SyntaxKind[SyntaxKind["PropertySignature"] = 127] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 128] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 129] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 130] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 131] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 132] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 133] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 134] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 135] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 136] = "IndexSignature"; + SyntaxKind[SyntaxKind["TypeReference"] = 137] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 138] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 139] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 140] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 141] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 142] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 143] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 144] = "UnionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 145] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 146] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 147] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 148] = "BindingElement"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 149] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 150] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 151] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 152] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 153] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 154] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 155] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 156] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 157] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 158] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 159] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 160] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 161] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 162] = "VoidExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 163] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 164] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 165] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 166] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 167] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 168] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElementExpression"] = 169] = "SpreadElementExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 170] = "OmittedExpression"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 171] = "TemplateSpan"; + SyntaxKind[SyntaxKind["Block"] = 172] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 173] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 174] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 175] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 176] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 177] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 178] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 179] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 180] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 181] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 182] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 183] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 184] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 185] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 186] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 187] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 188] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 189] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 190] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 191] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 192] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 193] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 194] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 195] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 196] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 197] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 198] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 199] = "ModuleBlock"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 200] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 201] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 202] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["CaseClause"] = 203] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 204] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 205] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 206] = "CatchClause"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 207] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 208] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["EnumMember"] = 209] = "EnumMember"; + SyntaxKind[SyntaxKind["SourceFile"] = 210] = "SourceFile"; + SyntaxKind[SyntaxKind["SyntaxList"] = 211] = "SyntaxList"; + SyntaxKind[SyntaxKind["Count"] = 212] = "Count"; SyntaxKind[SyntaxKind["FirstAssignment"] = 52] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 63] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstReservedWord"] = 65] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 100] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 65] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 120] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 122] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 101] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 109] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 135] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 143] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 137] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 145] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 14] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 63] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 120] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 122] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 6] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 7] = "FirstLiteralToken"; @@ -248,7 +251,7 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 13] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 24] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 63] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstNode"] = 121] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstNode"] = 123] = "FirstNode"; })(ts.SyntaxKind || (ts.SyntaxKind = {})); var SyntaxKind = ts.SyntaxKind; (function (NodeFlags) { @@ -414,8 +417,9 @@ var ts; TypeFlags[TypeFlags["ObjectLiteral"] = 131072] = "ObjectLiteral"; TypeFlags[TypeFlags["ContainsUndefinedOrNull"] = 262144] = "ContainsUndefinedOrNull"; TypeFlags[TypeFlags["ContainsObjectLiteral"] = 524288] = "ContainsObjectLiteral"; - TypeFlags[TypeFlags["Intrinsic"] = 127] = "Intrinsic"; - TypeFlags[TypeFlags["Primitive"] = 510] = "Primitive"; + TypeFlags[TypeFlags["ESSymbol"] = 1048576] = "ESSymbol"; + TypeFlags[TypeFlags["Intrinsic"] = 1048703] = "Intrinsic"; + TypeFlags[TypeFlags["Primitive"] = 1049086] = "Primitive"; TypeFlags[TypeFlags["StringLike"] = 258] = "StringLike"; TypeFlags[TypeFlags["NumberLike"] = 132] = "NumberLike"; TypeFlags[TypeFlags["ObjectType"] = 48128] = "ObjectType"; @@ -558,6 +562,7 @@ var ts; CharacterCodes[CharacterCodes["equals"] = 61] = "equals"; CharacterCodes[CharacterCodes["exclamation"] = 33] = "exclamation"; CharacterCodes[CharacterCodes["greaterThan"] = 62] = "greaterThan"; + CharacterCodes[CharacterCodes["hash"] = 35] = "hash"; CharacterCodes[CharacterCodes["lessThan"] = 60] = "lessThan"; CharacterCodes[CharacterCodes["minus"] = 45] = "minus"; CharacterCodes[CharacterCodes["openBrace"] = 123] = "openBrace"; @@ -878,7 +883,12 @@ var ts; return diagnostic.file ? diagnostic.file.fileName : undefined; } function compareDiagnostics(d1, d2) { - return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || compareValues(d1.start, d2.start) || compareValues(d1.length, d2.length) || compareValues(d1.code, d2.code) || compareMessageText(d1.messageText, d2.messageText) || 0; + return compareValues(getDiagnosticFileName(d1), getDiagnosticFileName(d2)) || + compareValues(d1.start, d2.start) || + compareValues(d1.length, d2.length) || + compareValues(d1.code, d2.code) || + compareMessageText(d1.messageText, d2.messageText) || + 0; } ts.compareDiagnostics = compareDiagnostics; function compareMessageText(text1, text2) { @@ -1381,9 +1391,7 @@ var ts; watchFile: function (fileName, callback) { _fs.watchFile(fileName, { persistent: true, interval: 250 }, fileChanged); return { - close: function () { - _fs.unwatchFile(fileName, fileChanged); - } + close: function () { _fs.unwatchFile(fileName, fileChanged); } }; function fileChanged(curr, prev) { if (+curr.mtime <= +prev.mtime) { @@ -1560,12 +1568,12 @@ var ts; An_object_member_cannot_be_declared_optional: { code: 1162, category: 1, key: "An object member cannot be declared optional." }, yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: 1, key: "'yield' expression must be contained_within a generator declaration." }, Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: 1, key: "Computed property names are not allowed in enums." }, - Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: 1, key: "Computed property names are not allowed in an ambient context." }, - Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: 1, key: "Computed property names are not allowed in class property declarations." }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: 1, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: 1, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: 1, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, - Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: 1, key: "Computed property names are not allowed in method overloads." }, - Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: 1, key: "Computed property names are not allowed in interfaces." }, - Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: 1, key: "Computed property names are not allowed in type literals." }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: 1, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: 1, key: "A computed property name in an interface must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: 1, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: 1, key: "A comma expression is not allowed in a computed property name." }, extends_clause_already_seen: { code: 1172, category: 1, key: "'extends' clause already seen." }, extends_clause_must_precede_implements_clause: { code: 1173, category: 1, key: "'extends' clause must precede 'implements' clause." }, @@ -1584,6 +1592,9 @@ var ts; Merge_conflict_marker_encountered: { code: 1185, category: 1, key: "Merge conflict marker encountered." }, A_rest_element_cannot_have_an_initializer: { code: 1186, category: 1, key: "A rest element cannot have an initializer." }, A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: 1, key: "A parameter property may not be a binding pattern." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: 1, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: 1, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: 1, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, Duplicate_identifier_0: { code: 2300, category: 1, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: 1, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: 1, key: "Static members cannot reference class type parameters." }, @@ -1603,7 +1614,7 @@ var ts; Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: 1, key: "Global type '{0}' must be a class or interface type." }, Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: 1, key: "Global type '{0}' must have {1} type parameter(s)." }, Cannot_find_global_type_0: { code: 2318, category: 1, key: "Cannot find global type '{0}'." }, - Named_properties_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." }, + Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: 1, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: 1, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: 1, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, Type_0_is_not_assignable_to_type_1: { code: 2322, category: 1, key: "Type '{0}' is not assignable to type '{1}'." }, @@ -1625,7 +1636,7 @@ var ts; Property_0_does_not_exist_on_type_1: { code: 2339, category: 1, key: "Property '{0}' does not exist on type '{1}'." }, Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: 1, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: 1, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', or 'any'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: 1, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: 1, key: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: 1, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: 1, key: "Supplied parameters do not match any signature of call target." }, @@ -1641,7 +1652,7 @@ var ts; The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: 1, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: 1, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: 1, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, - The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'." }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: 1, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: 1, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: 1, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: 1, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, @@ -1736,11 +1747,26 @@ var ts; Type_0_is_not_an_array_type: { code: 2461, category: 1, key: "Type '{0}' is not an array type." }, A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: 1, key: "A rest element must be last in an array destructuring pattern" }, A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: 1, key: "A binding pattern parameter cannot be optional in an implementation signature." }, - A_computed_property_name_must_be_of_type_string_number_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', or 'any'." }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: 1, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: 1, key: "'this' cannot be referenced in a computed property name." }, super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: 1, key: "'super' cannot be referenced in a computed property name." }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2468, category: 1, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: 1, key: "A computed property name cannot reference a type parameter from its containing type." }, + Cannot_find_global_value_0: { code: 2468, category: 1, key: "Cannot find global value '{0}'." }, + The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: 1, key: "The '{0}' operator cannot be applied to type 'symbol'." }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: 1, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: 1, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2472, category: 1, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: 1, key: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: 1, key: "A const enum member can only be accessed using a string literal." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: 1, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, + for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: 1, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: 1, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: 1, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: 1, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: 1, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -1810,14 +1836,6 @@ var ts; Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: 1, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: 1, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: 1, key: "Exported type alias '{0}' has or is using private name '{1}'." }, - Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: 1, key: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: 1, key: "In 'const' enum declarations member initializer must be constant expression." }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 4084, category: 1, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 4085, category: 1, key: "A const enum member can only be accessed using a string literal." }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: 1, key: "'const' enum member initializer was evaluated to a non-finite value." }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 4087, category: 1, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - Property_0_does_not_exist_on_const_enum_1: { code: 4088, category: 1, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 4089, category: 1, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: 1, key: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: 1, key: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: 1, key: "Cannot read file '{0}': {1}" }, @@ -1893,7 +1911,8 @@ var ts; You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: 1, key: "You cannot rename elements that are defined in the standard TypeScript library." }, yield_expressions_are_not_currently_supported: { code: 9000, category: 1, key: "'yield' expressions are not currently supported." }, Generators_are_not_currently_supported: { code: 9001, category: 1, key: "Generators are not currently supported." }, - The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." } + The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: 1, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, + for_of_statements_are_not_currently_supported: { code: 9003, category: 1, key: "'for...of' statements are not currently supported." } }; })(ts || (ts = {})); var ts; @@ -1944,17 +1963,19 @@ var ts; "string": 119, "super": 90, "switch": 91, + "symbol": 120, "this": 92, "throw": 93, "true": 94, "try": 95, - "type": 120, + "type": 121, "typeof": 96, "var": 97, "void": 98, "while": 99, "with": 100, "yield": 109, + "of": 122, "{": 14, "}": 15, "(": 16, @@ -2035,6 +2056,7 @@ var ts; function isUnicodeIdentifierStart(code, languageVersion) { return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); } + ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; function isUnicodeIdentifierPart(code, languageVersion) { return languageVersion >= 1 ? lookupInUnicodeMap(code, unicodeES5IdentifierPart) : lookupInUnicodeMap(code, unicodeES3IdentifierPart); } @@ -2079,15 +2101,15 @@ var ts; return result; } ts.computeLineStarts = computeLineStarts; - function getPositionFromLineAndCharacter(sourceFile, line, character) { - return computePositionFromLineAndCharacter(getLineStarts(sourceFile), line, character); + function getPositionOfLineAndCharacter(sourceFile, line, character) { + return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character); } - ts.getPositionFromLineAndCharacter = getPositionFromLineAndCharacter; - function computePositionFromLineAndCharacter(lineStarts, line, character) { - ts.Debug.assert(line > 0 && line <= lineStarts.length); - return lineStarts[line - 1] + character - 1; + ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter; + function computePositionOfLineAndCharacter(lineStarts, line, character) { + ts.Debug.assert(line >= 0 && line < lineStarts.length); + return lineStarts[line] + character; } - ts.computePositionFromLineAndCharacter = computePositionFromLineAndCharacter; + ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter; function getLineStarts(sourceFile) { return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text)); } @@ -2095,11 +2117,11 @@ var ts; function computeLineAndCharacterOfPosition(lineStarts, position) { var lineNumber = ts.binarySearch(lineStarts, position); if (lineNumber < 0) { - lineNumber = (~lineNumber) - 1; + lineNumber = ~lineNumber - 1; } return { - line: lineNumber + 1, - character: position - lineStarts[lineNumber] + 1 + line: lineNumber, + character: position - lineStarts[lineNumber] }; } ts.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition; @@ -2109,7 +2131,9 @@ var ts; ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; var hasOwnProperty = Object.prototype.hasOwnProperty; function isWhiteSpace(ch) { - return ch === 32 || ch === 9 || ch === 11 || ch === 12 || ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; + return ch === 32 || ch === 9 || ch === 11 || ch === 12 || + ch === 160 || ch === 5760 || ch >= 8192 && ch <= 8203 || + ch === 8239 || ch === 8287 || ch === 12288 || ch === 65279; } ts.isWhiteSpace = isWhiteSpace; function isLineBreak(ch) { @@ -2196,7 +2220,8 @@ var ts; return false; } } - return ch === 61 || text.charCodeAt(pos + mergeConflictMarkerLength) === 32; + return ch === 61 || + text.charCodeAt(pos + mergeConflictMarkerLength) === 32; } } return false; @@ -2303,11 +2328,15 @@ var ts; } ts.getTrailingCommentRanges = getTrailingCommentRanges; function isIdentifierStart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } ts.isIdentifierStart = isIdentifierStart; function isIdentifierPart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } ts.isIdentifierPart = isIdentifierPart; function createScanner(languageVersion, skipTrivia, text, onError) { @@ -2325,10 +2354,14 @@ var ts; } } function isIdentifierStart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } function isIdentifierPart(ch) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } function scanNumber() { var start = pos; @@ -3074,7 +3107,8 @@ var ts; ts.containsParseError = containsParseError; function aggregateChildData(node) { if (!(node.parserContextFlags & 64)) { - var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || ts.forEachChild(node, containsParseError); + var thisNodeOrAnySubNodesHasError = ((node.parserContextFlags & 16) !== 0) || + ts.forEachChild(node, containsParseError); if (thisNodeOrAnySubNodesHasError) { node.parserContextFlags |= 32; } @@ -3082,16 +3116,21 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 207) { + while (node && node.kind !== 210) { node = node.parent; } return node; } ts.getSourceFileOfNode = getSourceFileOfNode; + function getStartPositionOfLine(line, sourceFile) { + ts.Debug.assert(line >= 0); + return ts.getLineStarts(sourceFile)[line]; + } + ts.getStartPositionOfLine = getStartPositionOfLine; function nodePosToString(node) { var file = getSourceFileOfNode(node); var loc = ts.getLineAndCharacterOfPosition(file, node.pos); - return file.fileName + "(" + loc.line + "," + loc.character + ")"; + return file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + ")"; } ts.nodePosToString = nodePosToString; function getStartPosOfNode(node) { @@ -3173,13 +3212,13 @@ var ts; function getErrorSpanForNode(node) { var errorSpan; switch (node.kind) { - case 188: - case 146: case 191: - case 192: - case 195: + case 148: case 194: - case 206: + case 195: + case 198: + case 197: + case 209: errorSpan = node.name; break; } @@ -3195,11 +3234,11 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 194 && isConst(node); + return node.kind === 197 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 146 || isBindingPattern(node))) { + while (node && (node.kind === 148 || isBindingPattern(node))) { node = node.parent; } return node; @@ -3207,14 +3246,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 188) { + if (node.kind === 191) { node = node.parent; } - if (node && node.kind === 189) { + if (node && node.kind === 192) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 171) { + if (node && node.kind === 173) { flags |= node.flags; } return flags; @@ -3229,12 +3268,12 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 173 && node.expression.kind === 8; + return node.kind === 175 && node.expression.kind === 8; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { sourceFileOfNode = sourceFileOfNode || getSourceFileOfNode(node); - if (node.kind === 124 || node.kind === 123) { + if (node.kind === 126 || node.kind === 125) { return ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)); } else { @@ -3245,7 +3284,9 @@ var ts; function getJsDocComments(node, sourceFileOfNode) { return ts.filter(getLeadingCommentRangesOfNode(node, sourceFileOfNode), isJsDocComment); function isJsDocComment(comment) { - return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; + return sourceFileOfNode.text.charCodeAt(comment.pos + 1) === 42 && + sourceFileOfNode.text.charCodeAt(comment.pos + 2) === 42 && + sourceFileOfNode.text.charCodeAt(comment.pos + 3) !== 47; } } ts.getJsDocComments = getJsDocComments; @@ -3254,21 +3295,22 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 181: + case 184: return visitor(node); - case 170: - case 174: - case 175: + case 172: case 176: case 177: case 178: - case 182: - case 183: - case 200: - case 201: - case 184: + case 179: + case 180: + case 181: + case 185: case 186: case 203: + case 204: + case 187: + case 189: + case 206: return ts.forEachChild(node, traverse); } } @@ -3277,22 +3319,22 @@ var ts; function isAnyFunction(node) { if (node) { switch (node.kind) { - case 129: - case 156: - case 190: - case 157: - case 128: - case 127: - case 130: case 131: + case 158: + case 193: + case 159: + case 130: + case 129: case 132: case 133: case 134: + case 135: case 136: - case 137: - case 156: - case 157: - case 190: + case 138: + case 139: + case 158: + case 159: + case 193: return true; } } @@ -3300,11 +3342,11 @@ var ts; } ts.isAnyFunction = isAnyFunction; function isFunctionBlock(node) { - return node && node.kind === 170 && isAnyFunction(node.parent); + return node && node.kind === 172 && isAnyFunction(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 128 && node.parent.kind === 148; + return node && node.kind === 130 && node.parent.kind === 150; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function getContainingFunction(node) { @@ -3323,28 +3365,28 @@ var ts; return undefined; } switch (node.kind) { - case 122: - if (node.parent.parent.kind === 191) { + case 124: + if (node.parent.parent.kind === 194) { return node; } node = node.parent; break; - case 157: + case 159: if (!includeArrowFunctions) { continue; } - case 190: - case 156: - case 195: - case 126: - case 125: + case 193: + case 158: + case 198: case 128: case 127: - case 129: case 130: + case 129: case 131: - case 194: - case 207: + case 132: + case 133: + case 197: + case 210: return node; } } @@ -3356,32 +3398,32 @@ var ts; if (!node) return node; switch (node.kind) { - case 122: - if (node.parent.parent.kind === 191) { + case 124: + if (node.parent.parent.kind === 194) { return node; } node = node.parent; break; - case 190: - case 156: - case 157: + case 193: + case 158: + case 159: if (!includeFunctions) { continue; } - case 126: - case 125: case 128: case 127: - case 129: case 130: + case 129: case 131: + case 132: + case 133: return node; } } } ts.getSuperContainer = getSuperContainer; function getInvokedExpression(node) { - if (node.kind === 153) { + if (node.kind === 155) { return node.tag; } return node.expression; @@ -3395,8 +3437,6 @@ var ts; case 94: case 79: case 9: - case 147: - case 148: case 149: case 150: case 151: @@ -3406,61 +3446,67 @@ var ts; case 155: case 156: case 157: - case 160: case 158: case 159: - case 161: case 162: + case 160: + case 161: case 163: case 164: - case 167: case 165: + case 166: + case 169: + case 167: case 10: - case 168: + case 170: return true; - case 121: - while (node.parent.kind === 121) { + case 123: + while (node.parent.kind === 123) { node = node.parent; } - return node.parent.kind === 138; + return node.parent.kind === 140; case 64: - if (node.parent.kind === 138) { + if (node.parent.kind === 140) { return true; } case 7: case 8: var parent = node.parent; switch (parent.kind) { - case 188: - case 124: + case 191: case 126: - case 125: - case 206: - case 204: - case 146: + case 128: + case 127: + case 209: + case 207: + case 148: return parent.initializer === node; - case 173: - case 174: case 175: case 176: - case 181: - case 182: - case 183: - case 200: - case 185: - case 183: - return parent.expression === node; case 177: - var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 189) || forStatement.condition === node || forStatement.iterator === node; case 178: + case 184: + case 185: + case 186: + case 203: + case 188: + case 186: + return parent.expression === node; + case 179: + var forStatement = parent; + return (forStatement.initializer === node && forStatement.initializer.kind !== 192) || + forStatement.condition === node || + forStatement.iterator === node; + case 180: + case 181: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 189) || forInStatement.expression === node; - case 154: + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 192) || + forInStatement.expression === node; + case 156: return node === parent.expression; - case 169: + case 171: return node === parent.expression; - case 122: + case 124: return node === parent.expression; default: if (isExpression(parent)) { @@ -3473,11 +3519,12 @@ var ts; ts.isExpression = isExpression; function isInstantiatedModule(node, preserveConstEnums) { var moduleState = ts.getModuleInstanceState(node); - return moduleState === 1 || (preserveConstEnums && moduleState === 2); + return moduleState === 1 || + (preserveConstEnums && moduleState === 2); } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportDeclaration(node) { - return node.kind === 197 && node.moduleReference.kind === 199; + return node.kind === 200 && node.moduleReference.kind === 202; } ts.isExternalModuleImportDeclaration = isExternalModuleImportDeclaration; function getExternalModuleImportDeclarationExpression(node) { @@ -3486,26 +3533,26 @@ var ts; } ts.getExternalModuleImportDeclarationExpression = getExternalModuleImportDeclarationExpression; function isInternalModuleImportDeclaration(node) { - return node.kind === 197 && node.moduleReference.kind !== 199; + return node.kind === 200 && node.moduleReference.kind !== 202; } ts.isInternalModuleImportDeclaration = isInternalModuleImportDeclaration; function hasDotDotDotToken(node) { - return node && node.kind === 124 && node.dotDotDotToken !== undefined; + return node && node.kind === 126 && node.dotDotDotToken !== undefined; } ts.hasDotDotDotToken = hasDotDotDotToken; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 124: + case 126: return node.questionToken !== undefined; + case 130: + case 129: + return node.questionToken !== undefined; + case 208: + case 207: case 128: case 127: return node.questionToken !== undefined; - case 205: - case 204: - case 126: - case 125: - return node.questionToken !== undefined; } } return false; @@ -3528,7 +3575,7 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return node.kind === 145 || node.kind === 144; + return node.kind === 147 || node.kind === 146; } ts.isBindingPattern = isBindingPattern; function isInAmbientContext(node) { @@ -3543,27 +3590,27 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 123: - case 124: - case 188: - case 146: - case 126: case 125: - case 204: - case 205: - case 206: + case 126: + case 191: + case 148: case 128: case 127: - case 190: + case 207: + case 208: + case 209: case 130: - case 131: case 129: - case 191: - case 192: case 193: + case 132: + case 133: + case 131: case 194: case 195: + case 196: case 197: + case 198: + case 200: return true; } return false; @@ -3571,24 +3618,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 180: - case 179: - case 187: - case 175: - case 173: - case 172: - case 178: - case 177: - case 174: - case 184: - case 181: case 183: - case 93: - case 186: - case 171: - case 176: case 182: - case 198: + case 190: + case 177: + case 175: + case 174: + case 180: + case 181: + case 179: + case 176: + case 187: + case 184: + case 186: + case 93: + case 189: + case 173: + case 178: + case 185: + case 201: return true; default: return false; @@ -3600,10 +3648,10 @@ var ts; return false; } var parent = name.parent; - if (isDeclaration(parent) || parent.kind === 156) { + if (isDeclaration(parent) || parent.kind === 158) { return parent.name === name; } - if (parent.kind === 203) { + if (parent.kind === 206) { return parent.name === name; } return false; @@ -3645,16 +3693,16 @@ var ts; ts.tryResolveScriptReference = tryResolveScriptReference; function getAncestor(node, kind) { switch (kind) { - case 191: + case 194: while (node) { switch (node.kind) { - case 191: - return node; case 194: - case 192: - case 193: - case 195: + return node; case 197: + case 195: + case 196: + case 198: + case 200: return undefined; default: node = node.parent; @@ -3709,13 +3757,45 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 65 <= token && token <= 120; + return 65 <= token && token <= 122; } ts.isKeyword = isKeyword; function isTrivia(token) { return 2 <= token && token <= 6; } ts.isTrivia = isTrivia; + function hasDynamicName(declaration) { + return declaration.name && + declaration.name.kind === 124 && + !isWellKnownSymbolSyntactically(declaration.name.expression); + } + ts.hasDynamicName = hasDynamicName; + function isWellKnownSymbolSyntactically(node) { + return node.kind === 151 && isESSymbolIdentifier(node.expression); + } + ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; + function getPropertyNameForPropertyNameNode(name) { + if (name.kind === 64 || name.kind === 8 || name.kind === 7) { + return name.text; + } + if (name.kind === 124) { + var nameExpression = name.expression; + if (isWellKnownSymbolSyntactically(nameExpression)) { + var rightHandSideName = nameExpression.name.text; + return getPropertyNameForKnownSymbolName(rightHandSideName); + } + } + return undefined; + } + ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode; + function getPropertyNameForKnownSymbolName(symbolName) { + return "__@" + symbolName; + } + ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName; + function isESSymbolIdentifier(node) { + return node.kind === 64 && node.text === "Symbol"; + } + ts.isESSymbolIdentifier = isESSymbolIdentifier; function isModifier(token) { switch (token) { case 107: @@ -3907,7 +3987,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var nodeConstructors = new Array(209); + var nodeConstructors = new Array(212); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -3944,152 +4024,224 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 121: - return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); case 123: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 124: - case 126: + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); case 125: - case 204: - case 205: - case 188: - case 146: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 136: - case 137: - case 132: - case 133: - case 134: - return visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.expression); + case 126: case 128: case 127: - case 129: - case 130: - case 131: - case 156: - case 190: - case 157: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.body); - case 135: - return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); + case 207: + case 208: + case 191: + case 148: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); case 138: - return visitNode(cbNode, node.exprName); case 139: - return visitNodes(cbNodes, node.members); + case 134: + case 135: + case 136: + return visitNodes(cbNodes, node.modifiers) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type); + case 130: + case 129: + case 131: + case 132: + case 133: + case 158: + case 193: + case 159: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + case 137: + return visitNode(cbNode, node.typeName) || + visitNodes(cbNodes, node.typeArguments); case 140: - return visitNode(cbNode, node.elementType); + return visitNode(cbNode, node.exprName); case 141: - return visitNodes(cbNodes, node.elementTypes); + return visitNodes(cbNodes, node.members); case 142: - return visitNodes(cbNodes, node.types); + return visitNode(cbNode, node.elementType); case 143: - return visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.elementTypes); case 144: + return visitNodes(cbNodes, node.types); case 145: - return visitNodes(cbNodes, node.elements); + return visitNode(cbNode, node.type); + case 146: case 147: return visitNodes(cbNodes, node.elements); - case 148: - return visitNodes(cbNodes, node.properties); case 149: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); + return visitNodes(cbNodes, node.elements); case 150: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); + return visitNodes(cbNodes, node.properties); case 151: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.name); case 152: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.argumentExpression); case 153: - return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); case 154: - return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.typeArguments) || + visitNodes(cbNodes, node.arguments); case 155: - return visitNode(cbNode, node.expression); - case 158: - return visitNode(cbNode, node.expression); - case 159: + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.template); + case 156: + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + case 157: return visitNode(cbNode, node.expression); case 160: return visitNode(cbNode, node.expression); case 161: - return visitNode(cbNode, node.operand); - case 166: - return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); + return visitNode(cbNode, node.expression); case 162: - return visitNode(cbNode, node.operand); + return visitNode(cbNode, node.expression); case 163: - return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); + return visitNode(cbNode, node.operand); + case 168: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); case 164: - return visitNode(cbNode, node.condition) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.whenFalse); - case 167: - return visitNode(cbNode, node.expression); - case 170: - case 196: - return visitNodes(cbNodes, node.statements); - case 207: - return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 171: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 189: - return visitNodes(cbNodes, node.declarations); - case 173: - return visitNode(cbNode, node.expression); - case 174: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 175: - return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 176: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 177: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.iterator) || visitNode(cbNode, node.statement); - case 178: - return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 179: - case 180: - return visitNode(cbNode, node.label); - case 181: - return visitNode(cbNode, node.expression); - case 182: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 183: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.clauses); - case 200: - return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 201: - return visitNodes(cbNodes, node.statements); - case 184: - return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 185: - return visitNode(cbNode, node.expression); - case 186: - return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 203: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.type) || visitNode(cbNode, node.block); - case 191: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 192: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 193: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 194: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 206: - return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 195: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 197: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 198: - return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportName); + return visitNode(cbNode, node.operand); case 165: - return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + case 166: + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.whenFalse); case 169: - return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 122: return visitNode(cbNode, node.expression); - case 202: - return visitNodes(cbNodes, node.types); + case 172: case 199: + return visitNodes(cbNodes, node.statements); + case 210: + return visitNodes(cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + case 173: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + case 192: + return visitNodes(cbNodes, node.declarations); + case 175: + return visitNode(cbNode, node.expression); + case 176: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + case 177: + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + case 178: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 179: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.iterator) || + visitNode(cbNode, node.statement); + case 180: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 181: + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 182: + case 183: + return visitNode(cbNode, node.label); + case 184: + return visitNode(cbNode, node.expression); + case 185: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 186: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.clauses); + case 203: + return visitNode(cbNode, node.expression) || + visitNodes(cbNodes, node.statements); + case 204: + return visitNodes(cbNodes, node.statements); + case 187: + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + case 188: + return visitNode(cbNode, node.expression); + case 189: + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + case 206: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.block); + case 194: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 195: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); + case 196: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.type); + case 197: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 209: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 198: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + case 200: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + case 201: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.exportName); + case 167: + return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); + case 171: + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); + case 124: + return visitNode(cbNode, node.expression); + case 205: + return visitNodes(cbNodes, node.types); + case 202: return visitNode(cbNode, node.expression); } } @@ -4388,7 +4540,8 @@ var ts; } ts.updateSourceFile = updateSourceFile; function isEvalOrArgumentsIdentifier(node) { - return node.kind === 64 && (node.text === "eval" || node.text === "arguments"); + return node.kind === 64 && + (node.text === "eval" || node.text === "arguments"); } ts.isEvalOrArgumentsIdentifier = isEvalOrArgumentsIdentifier; function isUseStrictPrologueDirective(sourceFile, node) { @@ -4474,7 +4627,7 @@ var ts; var identifierCount = 0; var nodeCount = 0; var token; - var sourceFile = createNode(207, 0); + var sourceFile = createNode(210, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -4662,6 +4815,11 @@ var ts; } return undefined; } + function parseTokenNode() { + var node = createNode(token); + nextToken(); + return finishNode(node); + } function canParseSemicolon() { if (token === 22) { return true; @@ -4732,7 +4890,9 @@ var ts; return createIdentifier(isIdentifierOrKeyword()); } function isLiteralPropertyName() { - return isIdentifierOrKeyword() || token === 8 || token === 7; + return isIdentifierOrKeyword() || + token === 8 || + token === 7; } function parsePropertyName() { if (token === 8 || token === 7) { @@ -4744,7 +4904,7 @@ var ts; return parseIdentifierName(); } function parseComputedPropertyName() { - var node = createNode(122); + var node = createNode(124); parseExpected(18); var yieldContext = inYieldContext(); if (inGeneratorParameterContext()) { @@ -4827,7 +4987,8 @@ var ts; return isIdentifier(); } function isNotHeritageClauseTypeName() { - if (token === 101 || token === 78) { + if (token === 101 || + token === 78) { return lookAhead(nextTokenIsIdentifier); } return false; @@ -4872,7 +5033,7 @@ var ts; if (canParseSemicolon()) { return true; } - if (token === 85) { + if (isInOrOfKeyword(token)) { return true; } if (token === 32) { @@ -4992,12 +5153,12 @@ var ts; function isReusableModuleElement(node) { if (node) { switch (node.kind) { - case 197: - case 198: - case 191: - case 192: - case 195: + case 200: + case 201: case 194: + case 195: + case 198: + case 197: return true; } return isReusableStatement(node); @@ -5007,12 +5168,12 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 129: - case 134: - case 128: - case 130: case 131: - case 126: + case 136: + case 130: + case 132: + case 133: + case 128: return true; } } @@ -5021,8 +5182,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 200: - case 201: + case 203: + case 204: return true; } } @@ -5031,55 +5192,56 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 190: - case 171: - case 170: - case 174: + case 193: case 173: - case 185: - case 181: + case 172: + case 176: + case 175: + case 188: + case 184: + case 186: case 183: + case 182: case 180: + case 181: case 179: case 178: - case 177: - case 176: - case 182: - case 172: - case 186: - case 184: - case 175: + case 185: + case 174: + case 189: case 187: + case 177: + case 190: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 206; + return node.kind === 209; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 133: + case 135: + case 129: + case 136: case 127: case 134: - case 125: - case 132: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 188) { + if (node.kind !== 191) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 124) { + if (node.kind !== 126) { return false; } var parameter = node; @@ -5148,7 +5310,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(20)) { - var node = createNode(121, entity.pos); + var node = createNode(123, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -5164,13 +5326,8 @@ var ts; } return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } - function parseTokenNode() { - var node = createNode(token); - nextToken(); - return finishNode(node); - } function parseTemplateExpression() { - var template = createNode(165); + var template = createNode(167); template.head = parseLiteralNode(); ts.Debug.assert(template.head.kind === 11, "Template head has wrong token kind"); var templateSpans = []; @@ -5183,7 +5340,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(169); + var span = createNode(171); span.expression = allowInAnd(parseExpression); var literal; if (token === 15) { @@ -5212,7 +5369,7 @@ var ts; return node; } function parseTypeReference() { - var node = createNode(135); + var node = createNode(137); node.typeName = parseEntityName(false, ts.Diagnostics.Type_expected); if (!scanner.hasPrecedingLineBreak() && token === 24) { node.typeArguments = parseBracketedList(17, parseType, 24, 25); @@ -5220,13 +5377,13 @@ var ts; return finishNode(node); } function parseTypeQuery() { - var node = createNode(138); + var node = createNode(140); parseExpected(96); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(123); + var node = createNode(125); node.name = parseIdentifier(); if (parseOptional(78)) { if (isStartOfType() || !isStartOfExpression()) { @@ -5259,7 +5416,7 @@ var ts; } } function parseParameter() { - var node = createNode(124); + var node = createNode(126); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(21); node.name = inGeneratorParameterContext() ? doInYieldContext(parseIdentifierOrPattern) : parseIdentifierOrPattern(); @@ -5310,7 +5467,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 133) { + if (kind === 135) { parseExpected(87); } fillSignature(51, false, false, node); @@ -5351,7 +5508,7 @@ var ts; } function parseIndexSignatureDeclaration(modifiers) { var fullStart = modifiers ? modifiers.pos : scanner.getStartPos(); - var node = createNode(134, fullStart); + var node = createNode(136, fullStart); setModifiers(node, modifiers); node.parameters = parseBracketedList(15, parseParameter, 18, 19); node.type = parseTypeAnnotation(); @@ -5363,7 +5520,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(50); if (token === 16 || token === 24) { - var method = createNode(127, fullStart); + var method = createNode(129, fullStart); method.name = name; method.questionToken = questionToken; fillSignature(51, false, false, method); @@ -5371,7 +5528,7 @@ var ts; return finishNode(method); } else { - var property = createNode(125, fullStart); + var property = createNode(127, fullStart); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -5403,18 +5560,22 @@ var ts; } function isTypeMemberWithLiteralPropertyName() { nextToken(); - return token === 16 || token === 24 || token === 50 || token === 51 || canParseSemicolon(); + return token === 16 || + token === 24 || + token === 50 || + token === 51 || + canParseSemicolon(); } function parseTypeMember() { switch (token) { case 16: case 24: - return parseSignatureMember(132); + return parseSignatureMember(134); case 18: return isIndexSignature() ? parseIndexSignatureDeclaration(undefined) : parsePropertyOrMethodSignature(); case 87: if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(133); + return parseSignatureMember(135); } case 8: case 7: @@ -5440,7 +5601,7 @@ var ts; return token === 16 || token === 24; } function parseTypeLiteral() { - var node = createNode(139); + var node = createNode(141); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -5456,12 +5617,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(141); + var node = createNode(143); node.elementTypes = parseBracketedList(18, parseType, 18, 19); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(143); + var node = createNode(145); parseExpected(16); node.type = parseType(); parseExpected(17); @@ -5469,7 +5630,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 137) { + if (kind === 139) { parseExpected(87); } fillSignature(32, false, false, node); @@ -5485,6 +5646,7 @@ var ts; case 119: case 117: case 111: + case 120: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); case 98: @@ -5507,6 +5669,7 @@ var ts; case 119: case 117: case 111: + case 120: case 98: case 96: case 14: @@ -5528,7 +5691,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(18)) { parseExpected(19); - var node = createNode(140, type.pos); + var node = createNode(142, type.pos); node.elementType = type; type = finishNode(node); } @@ -5543,7 +5706,7 @@ var ts; types.push(parseArrayTypeOrHigher()); } types.end = getNodeEnd(); - var node = createNode(142, type.pos); + var node = createNode(144, type.pos); node.types = types; type = finishNode(node); } @@ -5562,7 +5725,9 @@ var ts; } if (isIdentifier() || ts.isModifier(token)) { nextToken(); - if (token === 51 || token === 23 || token === 50 || token === 52 || isIdentifier() || ts.isModifier(token)) { + if (token === 51 || token === 23 || + token === 50 || token === 52 || + isIdentifier() || ts.isModifier(token)) { return true; } if (token === 17) { @@ -5586,10 +5751,10 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(136); + return parseFunctionOrConstructorType(138); } if (token === 87) { - return parseFunctionOrConstructorType(137); + return parseFunctionOrConstructorType(139); } return parseUnionTypeOrHigher(); } @@ -5639,8 +5804,9 @@ var ts; } function parseExpression() { var expr = parseAssignmentExpressionOrHigher(); - while (parseOptional(23)) { - expr = makeBinaryExpression(expr, 23, parseAssignmentExpressionOrHigher()); + var operatorToken; + while ((operatorToken = parseOptionalToken(23))) { + expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); } return expr; } @@ -5666,9 +5832,7 @@ var ts; return parseSimpleArrowFunctionExpression(expr); } if (isLeftHandSideExpression(expr) && isAssignmentOperator(reScanGreaterToken())) { - var operator = token; - nextToken(); - return makeBinaryExpression(expr, operator, parseAssignmentExpressionOrHigher()); + return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher()); } return parseConditionalExpressionRest(expr); } @@ -5689,9 +5853,10 @@ var ts; return !scanner.hasPrecedingLineBreak() && isIdentifier(); } function parseYieldExpression() { - var node = createNode(166); + var node = createNode(168); nextToken(); - if (!scanner.hasPrecedingLineBreak() && (token === 35 || isStartOfExpression())) { + if (!scanner.hasPrecedingLineBreak() && + (token === 35 || isStartOfExpression())) { node.asteriskToken = parseOptionalToken(35); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); @@ -5702,8 +5867,8 @@ var ts; } function parseSimpleArrowFunctionExpression(identifier) { ts.Debug.assert(token === 32, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(157, identifier.pos); - var parameter = createNode(124, identifier.pos); + var node = createNode(159, identifier.pos); + var parameter = createNode(126, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; @@ -5777,7 +5942,7 @@ var ts; return parseParenthesizedArrowFunctionExpressionHead(false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(157); + var node = createNode(159); fillSignature(51, false, !allowAmbiguity, node); if (!node.parameters) { return undefined; @@ -5800,7 +5965,7 @@ var ts; if (!parseOptional(50)) { return leftOperand; } - var node = createNode(164, leftOperand.pos); + var node = createNode(166, leftOperand.pos); node.condition = leftOperand; node.whenTrue = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(51); @@ -5811,6 +5976,9 @@ var ts; var leftOperand = parseUnaryExpressionOrHigher(); return parseBinaryExpressionRest(precedence, leftOperand); } + function isInOrOfKeyword(t) { + return t === 85 || t === 122; + } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { reScanGreaterToken(); @@ -5821,9 +5989,7 @@ var ts; if (token === 85 && inDisallowInContext()) { break; } - var operator = token; - nextToken(); - leftOperand = makeBinaryExpression(leftOperand, operator, parseBinaryExpressionOrHigher(newPrecedence)); + leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence)); } return leftOperand; } @@ -5871,34 +6037,34 @@ var ts; } return -1; } - function makeBinaryExpression(left, operator, right) { - var node = createNode(163, left.pos); + function makeBinaryExpression(left, operatorToken, right) { + var node = createNode(165, left.pos); node.left = left; - node.operator = operator; + node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(161); + var node = createNode(163); node.operator = token; nextToken(); node.operand = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(158); + var node = createNode(160); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(159); + var node = createNode(161); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(160); + var node = createNode(162); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); @@ -5928,7 +6094,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(isLeftHandSideExpression(expression)); if ((token === 38 || token === 39) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(162, expression.pos); + var node = createNode(164, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -5949,14 +6115,14 @@ var ts; if (token === 16 || token === 20) { return expression; } - var node = createNode(149, expression.pos); + var node = createNode(151, expression.pos); node.expression = expression; parseExpected(20, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); node.name = parseRightSideOfDot(true); return finishNode(node); } function parseTypeAssertion() { - var node = createNode(154); + var node = createNode(156); parseExpected(24); node.type = parseType(); parseExpected(25); @@ -5967,14 +6133,14 @@ var ts; while (true) { var dotOrBracketStart = scanner.getTokenPos(); if (parseOptional(20)) { - var propertyAccess = createNode(149, expression.pos); + var propertyAccess = createNode(151, expression.pos); propertyAccess.expression = expression; propertyAccess.name = parseRightSideOfDot(true); expression = finishNode(propertyAccess); continue; } if (parseOptional(18)) { - var indexedAccess = createNode(150, expression.pos); + var indexedAccess = createNode(152, expression.pos); indexedAccess.expression = expression; if (token !== 19) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -5988,7 +6154,7 @@ var ts; continue; } if (token === 10 || token === 11) { - var tagExpression = createNode(153, expression.pos); + var tagExpression = createNode(155, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 10 ? parseLiteralNode() : parseTemplateExpression(); expression = finishNode(tagExpression); @@ -6005,7 +6171,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(151, expression.pos); + var callExpr = createNode(153, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -6013,7 +6179,7 @@ var ts; continue; } else if (token === 16) { - var callExpr = createNode(151, expression.pos); + var callExpr = createNode(153, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -6098,26 +6264,26 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(155); + var node = createNode(157); parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); return finishNode(node); } function parseSpreadElement() { - var node = createNode(167); + var node = createNode(169); parseExpected(21); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { - return token === 21 ? parseSpreadElement() : token === 23 ? createNode(168) : parseAssignmentExpressionOrHigher(); + return token === 21 ? parseSpreadElement() : token === 23 ? createNode(170) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return allowInAnd(parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(147); + var node = createNode(149); parseExpected(18); if (scanner.hasPrecedingLineBreak()) node.flags |= 256; @@ -6127,10 +6293,10 @@ var ts; } function tryParseAccessorDeclaration(fullStart, modifiers) { if (parseContextualModifier(114)) { - return parseAccessorDeclaration(130, fullStart, modifiers); + return parseAccessorDeclaration(132, fullStart, modifiers); } else if (parseContextualModifier(118)) { - return parseAccessorDeclaration(131, fullStart, modifiers); + return parseAccessorDeclaration(133, fullStart, modifiers); } return undefined; } @@ -6150,13 +6316,13 @@ var ts; return parseMethodDeclaration(fullStart, modifiers, asteriskToken, propertyName, questionToken); } if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(205, fullStart); + var shorthandDeclaration = createNode(208, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(204, fullStart); + var propertyAssignment = createNode(207, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51); @@ -6165,7 +6331,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(148); + var node = createNode(150); parseExpected(14); if (scanner.hasPrecedingLineBreak()) { node.flags |= 256; @@ -6175,7 +6341,7 @@ var ts; return finishNode(node); } function parseFunctionExpression() { - var node = createNode(156); + var node = createNode(158); parseExpected(82); node.asteriskToken = parseOptionalToken(35); node.name = node.asteriskToken ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier(); @@ -6187,7 +6353,7 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(152); + var node = createNode(154); parseExpected(87); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); @@ -6197,7 +6363,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode, diagnosticMessage) { - var node = createNode(170); + var node = createNode(172); if (parseExpected(14, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(2, checkForStrictMode, parseStatement); parseExpected(15); @@ -6215,12 +6381,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(172); + var node = createNode(174); parseExpected(22); return finishNode(node); } function parseIfStatement() { - var node = createNode(174); + var node = createNode(176); parseExpected(83); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -6230,7 +6396,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(175); + var node = createNode(177); parseExpected(74); node.statement = parseStatement(); parseExpected(99); @@ -6241,7 +6407,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(176); + var node = createNode(178); parseExpected(99); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -6249,7 +6415,7 @@ var ts; node.statement = parseStatement(); return finishNode(node); } - function parseForOrForInStatement() { + function parseForOrForInOrForOfStatement() { var pos = getNodePos(); parseExpected(81); parseExpected(16); @@ -6262,16 +6428,23 @@ var ts; initializer = disallowInAnd(parseExpression); } } - var forOrForInStatement; + var forOrForInOrForOfStatement; if (parseOptional(85)) { - var forInStatement = createNode(178, pos); + var forInStatement = createNode(180, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(17); - forOrForInStatement = forInStatement; + forOrForInOrForOfStatement = forInStatement; + } + else if (parseOptional(122)) { + var forOfStatement = createNode(181, pos); + forOfStatement.initializer = initializer; + forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); + parseExpected(17); + forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(177, pos); + var forStatement = createNode(179, pos); forStatement.initializer = initializer; parseExpected(22); if (token !== 22 && token !== 17) { @@ -6282,14 +6455,14 @@ var ts; forStatement.iterator = allowInAnd(parseExpression); } parseExpected(17); - forOrForInStatement = forStatement; + forOrForInOrForOfStatement = forStatement; } - forOrForInStatement.statement = parseStatement(); - return finishNode(forOrForInStatement); + forOrForInOrForOfStatement.statement = parseStatement(); + return finishNode(forOrForInOrForOfStatement); } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 180 ? 65 : 70); + parseExpected(kind === 183 ? 65 : 70); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -6297,7 +6470,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(181); + var node = createNode(184); parseExpected(89); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -6306,7 +6479,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(182); + var node = createNode(185); parseExpected(100); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -6315,7 +6488,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(200); + var node = createNode(203); parseExpected(66); node.expression = allowInAnd(parseExpression); parseExpected(51); @@ -6323,7 +6496,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(201); + var node = createNode(204); parseExpected(72); parseExpected(51); node.statements = parseList(4, false, parseStatement); @@ -6333,7 +6506,7 @@ var ts; return token === 66 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(183); + var node = createNode(186); parseExpected(91); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -6344,14 +6517,14 @@ var ts; return finishNode(node); } function parseThrowStatement() { - var node = createNode(185); + var node = createNode(188); parseExpected(93); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(186); + var node = createNode(189); parseExpected(95); node.tryBlock = parseBlock(false, false); node.catchClause = token === 67 ? parseCatchClause() : undefined; @@ -6362,7 +6535,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(203); + var result = createNode(206); parseExpected(67); parseExpected(16); result.name = parseIdentifier(); @@ -6372,7 +6545,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(187); + var node = createNode(190); parseExpected(71); parseSemicolon(); return finishNode(node); @@ -6381,13 +6554,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 64 && parseOptional(51)) { - var labeledStatement = createNode(184, fullStart); + var labeledStatement = createNode(187, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(173, fullStart); + var expressionStatement = createNode(175, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -6429,7 +6602,7 @@ var ts; case 68: case 115: case 76: - case 120: + case 121: if (isDeclarationStart()) { return false; } @@ -6470,11 +6643,11 @@ var ts; case 99: return parseWhileStatement(); case 81: - return parseForOrForInStatement(); + return parseForOrForInOrForOfStatement(); case 70: - return parseBreakOrContinueStatement(179); + return parseBreakOrContinueStatement(182); case 65: - return parseBreakOrContinueStatement(180); + return parseBreakOrContinueStatement(183); case 89: return parseReturnStatement(); case 100: @@ -6534,16 +6707,16 @@ var ts; } function parseArrayBindingElement() { if (token === 23) { - return createNode(168); + return createNode(170); } - var node = createNode(146); + var node = createNode(148); node.dotDotDotToken = parseOptionalToken(21); node.name = parseIdentifierOrPattern(); node.initializer = parseInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(146); + var node = createNode(148); var id = parsePropertyName(); if (id.kind === 64 && token !== 51) { node.name = id; @@ -6557,14 +6730,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(144); + var node = createNode(146); parseExpected(14); node.elements = parseDelimitedList(10, parseObjectBindingElement); parseExpected(15); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(145); + var node = createNode(147); parseExpected(18); node.elements = parseDelimitedList(11, parseArrayBindingElement); parseExpected(19); @@ -6583,14 +6756,16 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(188); + var node = createNode(191); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); - node.initializer = parseInitializer(false); + if (!isInOrOfKeyword(token)) { + node.initializer = parseInitializer(false); + } return finishNode(node); } - function parseVariableDeclarationList(disallowIn) { - var node = createNode(189); + function parseVariableDeclarationList(inForStatementInitializer) { + var node = createNode(192); switch (token) { case 97: break; @@ -6604,21 +6779,29 @@ var ts; ts.Debug.fail(); } nextToken(); - var savedDisallowIn = inDisallowInContext(); - setDisallowInContext(disallowIn); - node.declarations = parseDelimitedList(9, parseVariableDeclaration); - setDisallowInContext(savedDisallowIn); + if (token === 122 && lookAhead(canFollowContextualOfKeyword)) { + node.declarations = createMissingList(); + } + else { + var savedDisallowIn = inDisallowInContext(); + setDisallowInContext(inForStatementInitializer); + node.declarations = parseDelimitedList(9, parseVariableDeclaration); + setDisallowInContext(savedDisallowIn); + } return finishNode(node); } + function canFollowContextualOfKeyword() { + return nextTokenIsIdentifier() && nextToken() === 17; + } function parseVariableStatement(fullStart, modifiers) { - var node = createNode(171, fullStart); + var node = createNode(173, fullStart); setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); parseSemicolon(); return finishNode(node); } function parseFunctionDeclaration(fullStart, modifiers) { - var node = createNode(190, fullStart); + var node = createNode(193, fullStart); setModifiers(node, modifiers); parseExpected(82); node.asteriskToken = parseOptionalToken(35); @@ -6628,7 +6811,7 @@ var ts; return finishNode(node); } function parseConstructorDeclaration(pos, modifiers) { - var node = createNode(129, pos); + var node = createNode(131, pos); setModifiers(node, modifiers); parseExpected(112); fillSignature(51, false, false, node); @@ -6636,7 +6819,7 @@ var ts; return finishNode(node); } function parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(128, fullStart); + var method = createNode(130, fullStart); setModifiers(method, modifiers); method.asteriskToken = asteriskToken; method.name = name; @@ -6653,7 +6836,7 @@ var ts; return parseMethodDeclaration(fullStart, modifiers, asteriskToken, name, questionToken, ts.Diagnostics.or_expected); } else { - var property = createNode(126, fullStart); + var property = createNode(128, fullStart); setModifiers(property, modifiers); property.name = name; property.questionToken = questionToken; @@ -6742,13 +6925,17 @@ var ts; if (isIndexSignature()) { return parseIndexSignatureDeclaration(modifiers); } - if (isIdentifierOrKeyword() || token === 8 || token === 7 || token === 35 || token === 18) { + if (isIdentifierOrKeyword() || + token === 8 || + token === 7 || + token === 35 || + token === 18) { return parsePropertyOrMethodDeclaration(fullStart, modifiers); } ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassDeclaration(fullStart, modifiers) { - var node = createNode(191, fullStart); + var node = createNode(194, fullStart); setModifiers(node, modifiers); parseExpected(68); node.name = parseIdentifier(); @@ -6774,7 +6961,7 @@ var ts; } function parseHeritageClause() { if (token === 78 || token === 101) { - var node = createNode(202); + var node = createNode(205); node.token = token; nextToken(); node.types = parseDelimitedList(8, parseTypeReference); @@ -6789,7 +6976,7 @@ var ts; return parseList(6, false, parseClassElement); } function parseInterfaceDeclaration(fullStart, modifiers) { - var node = createNode(192, fullStart); + var node = createNode(195, fullStart); setModifiers(node, modifiers); parseExpected(102); node.name = parseIdentifier(); @@ -6799,9 +6986,9 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, modifiers) { - var node = createNode(193, fullStart); + var node = createNode(196, fullStart); setModifiers(node, modifiers); - parseExpected(120); + parseExpected(121); node.name = parseIdentifier(); parseExpected(52); node.type = parseType(); @@ -6809,13 +6996,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(206, scanner.getStartPos()); + var node = createNode(209, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, modifiers) { - var node = createNode(194, fullStart); + var node = createNode(197, fullStart); setModifiers(node, modifiers); parseExpected(76); node.name = parseIdentifier(); @@ -6829,7 +7016,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(196, scanner.getStartPos()); + var node = createNode(199, scanner.getStartPos()); if (parseExpected(14)) { node.statements = parseList(1, false, parseModuleElement); parseExpected(15); @@ -6840,7 +7027,7 @@ var ts; return finishNode(node); } function parseInternalModuleTail(fullStart, modifiers, flags) { - var node = createNode(195, fullStart); + var node = createNode(198, fullStart); setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); @@ -6848,7 +7035,7 @@ var ts; return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, modifiers) { - var node = createNode(195, fullStart); + var node = createNode(198, fullStart); setModifiers(node, modifiers); node.name = parseLiteralNode(true); node.body = parseModuleBlock(); @@ -6859,13 +7046,14 @@ var ts; return token === 8 ? parseAmbientExternalModuleDeclaration(fullStart, modifiers) : parseInternalModuleTail(fullStart, modifiers, modifiers ? modifiers.flags : 0); } function isExternalModuleReference() { - return token === 116 && lookAhead(nextTokenIsOpenParen); + return token === 116 && + lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { return nextToken() === 16; } function parseImportDeclaration(fullStart, modifiers) { - var node = createNode(197, fullStart); + var node = createNode(200, fullStart); setModifiers(node, modifiers); parseExpected(84); node.name = parseIdentifier(); @@ -6878,7 +7066,7 @@ var ts; return isExternalModuleReference() ? parseExternalModuleReference() : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(199); + var node = createNode(202); parseExpected(116); parseExpected(16); node.expression = parseExpression(); @@ -6889,7 +7077,7 @@ var ts; return finishNode(node); } function parseExportAssignmentTail(fullStart, modifiers) { - var node = createNode(198, fullStart); + var node = createNode(201, fullStart); setModifiers(node, modifiers); node.exportName = parseIdentifier(); parseSemicolon(); @@ -6910,7 +7098,7 @@ var ts; case 102: case 76: case 84: - case 120: + case 121: return lookAhead(nextTokenIsIdentifierOrKeyword); case 115: return lookAhead(nextTokenIsIdentifierOrKeywordOrStringLiteral); @@ -6963,7 +7151,7 @@ var ts; return parseClassDeclaration(fullStart, modifiers); case 102: return parseInterfaceDeclaration(fullStart, modifiers); - case 120: + case 121: return parseTypeAliasDeclaration(fullStart, modifiers); case 76: return parseEnumDeclaration(fullStart, modifiers); @@ -7042,27 +7230,29 @@ var ts; sourceFile.amdModuleName = amdModuleName; } function setExternalModuleIndicator(sourceFile) { - sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 || node.kind === 197 && node.moduleReference.kind === 199 || node.kind === 198 ? node : undefined; }); + sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { + return node.flags & 1 || node.kind === 200 && node.moduleReference.kind === 202 || node.kind === 201 ? node : undefined; + }); } } function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 149: - case 150: - case 152: case 151: + case 152: + case 154: case 153: - case 147: case 155: - case 148: - case 156: + case 149: + case 157: + case 150: + case 158: case 64: case 9: case 7: case 8: case 10: - case 165: + case 167: case 79: case 88: case 92: @@ -7089,16 +7279,16 @@ var ts; })(ts.ModuleInstanceState || (ts.ModuleInstanceState = {})); var ModuleInstanceState = ts.ModuleInstanceState; function getModuleInstanceState(node) { - if (node.kind === 192 || node.kind === 193) { + if (node.kind === 195 || node.kind === 196) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if (node.kind === 197 && !(node.flags & 1)) { + else if (node.kind === 200 && !(node.flags & 1)) { return 0; } - else if (node.kind === 196) { + else if (node.kind === 199) { var state = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -7114,7 +7304,7 @@ var ts; }); return state; } - else if (node.kind === 195) { + else if (node.kind === 198) { return getModuleInstanceState(node.body); } else { @@ -7122,10 +7312,6 @@ var ts; } } ts.getModuleInstanceState = getModuleInstanceState; - function hasDynamicName(declaration) { - return declaration.name && declaration.name.kind === 122; - } - ts.hasDynamicName = hasDynamicName; function bindSourceFile(file) { var start = new Date().getTime(); bindSourceFileWorker(file); @@ -7164,22 +7350,26 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 195 && node.name.kind === 8) { + if (node.kind === 198 && node.name.kind === 8) { return '"' + node.name.text + '"'; } - ts.Debug.assert(!hasDynamicName(node)); + if (node.name.kind === 124) { + var nameExpression = node.name.expression; + ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); + return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); + } return node.name.text; } switch (node.kind) { - case 137: - case 129: + case 139: + case 131: return "__constructor"; - case 136: - case 132: - return "__call"; - case 133: - return "__new"; + case 138: case 134: + return "__call"; + case 135: + return "__new"; + case 136: return "__index"; } } @@ -7187,7 +7377,7 @@ var ts; return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); } function declareSymbol(symbols, parent, node, includes, excludes) { - ts.Debug.assert(!hasDynamicName(node)); + ts.Debug.assert(!ts.hasDynamicName(node)); var name = getDeclarationName(node); if (name !== undefined) { var symbol = ts.hasProperty(symbols, name) ? symbols[name] : (symbols[name] = createSymbol(0, name)); @@ -7208,7 +7398,7 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if (node.kind === 191 && symbol.exports) { + if (node.kind === 194 && symbol.exports) { var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { @@ -7240,7 +7430,7 @@ var ts; if (symbolKind & 1536) { exportKind |= 4194304; } - if (ts.getCombinedNodeFlags(node) & 1 || (node.kind !== 197 && isAmbientContext(container))) { + if (ts.getCombinedNodeFlags(node) & 1 || (node.kind !== 200 && isAmbientContext(container))) { if (exportKind) { var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); @@ -7279,40 +7469,40 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 195: + case 198: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 207: + case 210: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; } + case 138: + case 139: + case 134: + case 135: case 136: - case 137: + case 130: + case 129: + case 131: case 132: case 133: - case 134: - case 128: - case 127: - case 129: - case 130: - case 131: - case 190: - case 156: - case 157: + case 193: + case 158: + case 159: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 191: + case 194: if (node.flags & 128) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } - case 139: - case 148: - case 192: + case 141: + case 150: + case 195: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 194: + case 197: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } @@ -7345,7 +7535,7 @@ var ts; var typeLiteralSymbol = createSymbol(2048, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, 2048); typeLiteralSymbol.members = {}; - typeLiteralSymbol.members[node.kind === 136 ? "__call" : "__new"] = symbol; + typeLiteralSymbol.members[node.kind === 138 ? "__call" : "__new"] = symbol; } function bindAnonymousDeclaration(node, symbolKind, name, isBlockScopeContainer) { var symbol = createSymbol(symbolKind, name); @@ -7364,10 +7554,10 @@ var ts; } function bindBlockScopedVariableDeclaration(node) { switch (blockScopeContainer.kind) { - case 195: + case 198: declareModuleMember(node, 2, 107455); break; - case 207: + case 210: if (ts.isExternalModule(container)) { declareModuleMember(node, 2, 107455); break; @@ -7386,14 +7576,14 @@ var ts; function bind(node) { node.parent = parent; switch (node.kind) { - case 123: + case 125: bindDeclaration(node, 262144, 530912, false); break; - case 124: + case 126: bindParameter(node); break; - case 188: - case 146: + case 191: + case 148: if (ts.isBindingPattern(node.name)) { bindChildren(node, 0, false); } @@ -7404,65 +7594,65 @@ var ts; bindDeclaration(node, 1, 107454, false); } break; - case 126: - case 125: - bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); - break; - case 204: - case 205: - bindPropertyOrMethodOrAccessor(node, 4, 107455, false); - break; - case 206: - bindPropertyOrMethodOrAccessor(node, 8, 107455, false); - break; - case 132: - case 133: - case 134: - bindDeclaration(node, 131072, 0, false); - break; case 128: case 127: - bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263, true); + bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); break; - case 190: - bindDeclaration(node, 16, 106927, true); + case 207: + case 208: + bindPropertyOrMethodOrAccessor(node, 4, 107455, false); break; - case 129: - bindDeclaration(node, 16384, 0, true); + case 209: + bindPropertyOrMethodOrAccessor(node, 8, 107455, false); + break; + case 134: + case 135: + case 136: + bindDeclaration(node, 131072, 0, false); break; case 130: - bindPropertyOrMethodOrAccessor(node, 32768, 41919, true); - break; - case 131: - bindPropertyOrMethodOrAccessor(node, 65536, 74687, true); - break; - case 136: - case 137: - bindFunctionOrConstructorType(node); - break; - case 139: - bindAnonymousDeclaration(node, 2048, "__type", false); - break; - case 148: - bindAnonymousDeclaration(node, 4096, "__object", false); - break; - case 156: - case 157: - bindAnonymousDeclaration(node, 16, "__function", true); - break; - case 203: - bindCatchVariableDeclaration(node); - break; - case 191: - bindDeclaration(node, 32, 899583, false); - break; - case 192: - bindDeclaration(node, 64, 792992, false); + case 129: + bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263, true); break; case 193: - bindDeclaration(node, 524288, 793056, false); + bindDeclaration(node, 16, 106927, true); + break; + case 131: + bindDeclaration(node, 16384, 0, true); + break; + case 132: + bindPropertyOrMethodOrAccessor(node, 32768, 41919, true); + break; + case 133: + bindPropertyOrMethodOrAccessor(node, 65536, 74687, true); + break; + case 138: + case 139: + bindFunctionOrConstructorType(node); + break; + case 141: + bindAnonymousDeclaration(node, 2048, "__type", false); + break; + case 150: + bindAnonymousDeclaration(node, 4096, "__object", false); + break; + case 158: + case 159: + bindAnonymousDeclaration(node, 16, "__function", true); + break; + case 206: + bindCatchVariableDeclaration(node); break; case 194: + bindDeclaration(node, 32, 899583, false); + break; + case 195: + bindDeclaration(node, 64, 792992, false); + break; + case 196: + bindDeclaration(node, 524288, 793056, false); + break; + case 197: if (ts.isConst(node)) { bindDeclaration(node, 128, 899967, false); } @@ -7470,22 +7660,25 @@ var ts; bindDeclaration(node, 256, 899327, false); } break; - case 195: + case 198: bindModuleDeclaration(node); break; - case 197: + case 200: bindDeclaration(node, 8388608, 8388608, false); break; - case 207: + case 210: if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; } - case 170: - case 203: - case 177: - case 178: - case 183: + case 172: + bindChildren(node, 0, !ts.isAnyFunction(node.parent)); + break; + case 206: + case 179: + case 180: + case 181: + case 186: bindChildren(node, 0, true); break; default: @@ -7502,13 +7695,15 @@ var ts; else { bindDeclaration(node, 1, 107455, false); } - if (node.flags & 112 && node.parent.kind === 129 && node.parent.parent.kind === 191) { + if (node.flags & 112 && + node.parent.kind === 131 && + node.parent.parent.kind === 194) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } } function bindPropertyOrMethodOrAccessor(node, symbolKind, symbolExcludes, isBlockScopeContainer) { - if (hasDynamicName(node)) { + if (ts.hasDynamicName(node)) { bindAnonymousDeclaration(node, symbolKind, "__computed", isBlockScopeContainer); } else { @@ -7576,6 +7771,7 @@ var ts; var stringType = createIntrinsicType(2, "string"); var numberType = createIntrinsicType(4, "number"); var booleanType = createIntrinsicType(8, "boolean"); + var esSymbolType = createIntrinsicType(1048576, "symbol"); var voidType = createIntrinsicType(16, "void"); var undefinedType = createIntrinsicType(32 | 262144, "undefined"); var nullType = createIntrinsicType(64 | 262144, "null"); @@ -7589,6 +7785,7 @@ var ts; var unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, 0, false, false); var globals = {}; var globalArraySymbol; + var globalESSymbolConstructorSymbol; var globalObjectType; var globalFunctionType; var globalArrayType; @@ -7597,6 +7794,7 @@ var ts; var globalBooleanType; var globalRegExpType; var globalTemplateStringsArrayType; + var globalESSymbolType; var anyArrayType; var tupleTypes = {}; var unionTypes = {}; @@ -7619,6 +7817,10 @@ var ts; "boolean": { type: booleanType, flags: 8 + }, + "symbol": { + type: esSymbolType, + flags: 1048576 } }; function getEmitResolver(sourceFile) { @@ -7759,10 +7961,10 @@ var ts; return nodeLinks[node.id] || (nodeLinks[node.id] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 207); + return ts.getAncestor(node, 210); } function isGlobalSourceFile(node) { - return node.kind === 207 && !ts.isExternalModule(node); + return node.kind === 210 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -7803,22 +8005,22 @@ var ts; } } switch (location.kind) { - case 207: + case 210: if (!ts.isExternalModule(location)) break; - case 195: + case 198: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { break loop; } break; - case 194: + case 197: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; - case 126: - case 125: - if (location.parent.kind === 191 && !(location.flags & 128)) { + case 128: + case 127: + if (location.parent.kind === 194 && !(location.flags & 128)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455)) { @@ -7827,8 +8029,8 @@ var ts; } } break; - case 191: - case 192: + case 194: + case 195: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056)) { if (lastLocation && lastLocation.flags & 128) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); @@ -7837,28 +8039,28 @@ var ts; break loop; } break; - case 122: + case 124: var grandparent = location.parent.parent; - if (grandparent.kind === 191 || grandparent.kind === 192) { + if (grandparent.kind === 194 || grandparent.kind === 195) { if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); return undefined; } } break; - case 128: - case 127: - case 129: case 130: + case 129: case 131: - case 190: - case 157: + case 132: + case 133: + case 193: + case 159: if (name === "arguments") { result = argumentsSymbol; break loop; } break; - case 156: + case 158: if (name === "arguments") { result = argumentsSymbol; break loop; @@ -7869,7 +8071,7 @@ var ts; break loop; } break; - case 203: + case 206: var id = location.name; if (name === id.text) { result = location.symbol; @@ -7910,13 +8112,13 @@ var ts; var links = getSymbolLinks(symbol); if (!links.target) { links.target = resolvingSymbol; - var node = ts.getDeclarationOfKind(symbol, 197); - if (node.moduleReference.kind === 199) { + var node = ts.getDeclarationOfKind(symbol, 200); + if (node.moduleReference.kind === 202) { if (node.moduleReference.expression.kind !== 8) { grammarErrorOnNode(node.moduleReference.expression, ts.Diagnostics.String_literal_expected); } } - var target = node.moduleReference.kind === 199 ? resolveExternalModuleName(node, ts.getExternalModuleImportDeclarationExpression(node)) : getSymbolOfPartOfRightHandSideOfImport(node.moduleReference, node); + var target = node.moduleReference.kind === 202 ? resolveExternalModuleName(node, ts.getExternalModuleImportDeclarationExpression(node)) : getSymbolOfPartOfRightHandSideOfImport(node.moduleReference, node); if (links.target === resolvingSymbol) { links.target = target || unknownSymbol; } @@ -7931,17 +8133,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImport(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 197); + importDeclaration = ts.getAncestor(entityName, 200); ts.Debug.assert(importDeclaration !== undefined); } if (entityName.kind === 64 && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 64 || entityName.parent.kind === 121) { + if (entityName.kind === 64 || entityName.parent.kind === 123) { return resolveEntityName(importDeclaration, entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 197); + ts.Debug.assert(entityName.parent.kind === 200); return resolveEntityName(importDeclaration, entityName, 107455 | 793056 | 1536); } } @@ -7958,7 +8160,7 @@ var ts; return; } } - else if (name.kind === 121) { + else if (name.kind === 123) { var namespace = resolveEntityName(location, name.left, 1536); if (!namespace || namespace === unknownSymbol || ts.getFullWidth(name.right) === 0) return; @@ -8050,9 +8252,9 @@ var ts; var seenExportedMember = false; var result = []; ts.forEach(symbol.declarations, function (declaration) { - var block = (declaration.kind === 207 ? declaration : declaration.body); + var block = (declaration.kind === 210 ? declaration : declaration.body); ts.forEach(block.statements, function (node) { - if (node.kind === 198) { + if (node.kind === 201) { result.push(node); } else { @@ -8094,7 +8296,7 @@ var ts; var members = node.members; for (var i = 0; i < members.length; i++) { var member = members[i]; - if (member.kind === 129 && ts.nodeIsPresent(member.body)) { + if (member.kind === 131 && ts.nodeIsPresent(member.body)) { return member; } } @@ -8115,7 +8317,10 @@ var ts; return type; } function isReservedMemberName(name) { - return name.charCodeAt(0) === 95 && name.charCodeAt(1) === 95 && name.charCodeAt(2) !== 95; + return name.charCodeAt(0) === 95 && + name.charCodeAt(1) === 95 && + name.charCodeAt(2) !== 95 && + name.charCodeAt(2) !== 64; } function getNamedMembers(members) { var result; @@ -8156,17 +8361,17 @@ var ts; } } switch (location.kind) { - case 207: + case 210: if (!ts.isExternalModule(location)) { break; } - case 195: + case 198: if (result = callback(getSymbolOfNode(location).exports)) { return result; } break; - case 191: - case 192: + case 194: + case 195: if (result = callback(getSymbolOfNode(location).members)) { return result; } @@ -8189,7 +8394,8 @@ var ts; } function isAccessible(symbolFromSymbolTable, resolvedAliasSymbol) { if (symbol === (resolvedAliasSymbol || symbolFromSymbolTable)) { - return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && canQualifySymbol(symbolFromSymbolTable, meaning); + return !ts.forEach(symbolFromSymbolTable.declarations, hasExternalModuleSymbol) && + canQualifySymbol(symbolFromSymbolTable, meaning); } } if (isAccessible(ts.lookUp(symbols, symbol.name))) { @@ -8197,7 +8403,8 @@ var ts; } return ts.forEachValue(symbols, function (symbolFromSymbolTable) { if (symbolFromSymbolTable.flags & 8388608) { - if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportDeclaration)) { + if (!useOnlyExternalAliasing || + ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportDeclaration)) { var resolvedImportedSymbol = resolveImport(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveImport(symbolFromSymbolTable))) { return [symbolFromSymbolTable]; @@ -8279,7 +8486,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 195 && declaration.name.kind === 8) || (declaration.kind === 207 && ts.isExternalModule(declaration)); + return (declaration.kind === 198 && declaration.name.kind === 8) || + (declaration.kind === 210 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -8289,7 +8497,9 @@ var ts; return { accessibility: 0, aliasesToMakeVisible: aliasesToMakeVisible }; function getIsDeclarationVisible(declaration) { if (!isDeclarationVisible(declaration)) { - if (declaration.kind === 197 && !(declaration.flags & 1) && isDeclarationVisible(declaration.parent)) { + if (declaration.kind === 200 && + !(declaration.flags & 1) && + isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!ts.contains(aliasesToMakeVisible, declaration)) { @@ -8308,10 +8518,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 138) { + if (entityName.parent.kind === 140) { meaning = 107455 | 1048576; } - else if (entityName.kind === 121 || entityName.parent.kind === 197) { + else if (entityName.kind === 123 || + entityName.parent.kind === 200) { meaning = 1536; } else { @@ -8355,10 +8566,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { var node = type.symbol.declarations[0].parent; - while (node.kind === 143) { + while (node.kind === 145) { node = node.parent; } - if (node.kind === 193) { + if (node.kind === 196) { return getSymbolOfNode(node); } } @@ -8397,7 +8608,8 @@ var ts; function walkSymbol(symbol, meaning) { if (symbol) { var accessibleSymbolChain = getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, !!(flags & 2)); - if (!accessibleSymbolChain || needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { + if (!accessibleSymbolChain || + needsQualification(accessibleSymbolChain[0], enclosingDeclaration, accessibleSymbolChain.length === 1 ? meaning : getQualifiedLeftMeaning(meaning))) { walkSymbol(getParentOfSymbol(accessibleSymbolChain ? accessibleSymbolChain[0] : symbol), getQualifiedLeftMeaning(meaning)); } if (accessibleSymbolChain) { @@ -8428,8 +8640,9 @@ var ts; var globalFlagsToPass = globalFlags & 16; return writeType(type, globalFlags); function writeType(type, flags) { - if (type.flags & 127) { - writer.writeKeyword(!(globalFlags & 16) && (type.flags & 1) ? "any" : type.intrinsicName); + if (type.flags & 1048703) { + writer.writeKeyword(!(globalFlags & 16) && + (type.flags & 1) ? "any" : type.intrinsicName); } else if (type.flags & 4096) { writeTypeReference(type, flags); @@ -8522,10 +8735,16 @@ var ts; } function shouldWriteTypeOfFunctionSymbol() { if (type.symbol) { - var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128; })); - var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { return declaration.parent.kind === 207 || declaration.parent.kind === 196; })); + var isStaticMethodSymbol = !!(type.symbol.flags & 8192 && + ts.forEach(type.symbol.declarations, function (declaration) { return declaration.flags & 128; })); + var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && + (type.symbol.parent || + ts.forEach(type.symbol.declarations, function (declaration) { + return declaration.parent.kind === 210 || declaration.parent.kind === 199; + })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { - return !!(flags & 2) || (typeStack && ts.contains(typeStack, type)); + return !!(flags & 2) || + (typeStack && ts.contains(typeStack, type)); } } } @@ -8750,12 +8969,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 195) { + if (node.kind === 198) { if (node.name.kind === 8) { return node; } } - else if (node.kind === 207) { + else if (node.kind === 210) { return ts.isExternalModule(node) ? node : undefined; } } @@ -8797,46 +9016,47 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 188: - case 146: - case 195: case 191: - case 192: - case 193: - case 190: + case 148: + case 198: case 194: + case 195: + case 196: + case 193: case 197: + case 200: var parent = getDeclarationContainer(node); - if (!(ts.getCombinedNodeFlags(node) & 1) && !(node.kind !== 197 && parent.kind !== 207 && ts.isInAmbientContext(parent))) { + if (!(ts.getCombinedNodeFlags(node) & 1) && + !(node.kind !== 200 && parent.kind !== 210 && ts.isInAmbientContext(parent))) { return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); } return isDeclarationVisible(parent); - case 126: - case 125: - case 130: - case 131: case 128: case 127: + case 132: + case 133: + case 130: + case 129: if (node.flags & (32 | 64)) { return false; } - case 129: - case 133: - case 132: - case 134: - case 124: - case 196: - case 136: - case 137: - case 139: + case 131: case 135: - case 140: + case 134: + case 136: + case 126: + case 199: + case 138: + case 139: case 141: + case 137: case 142: case 143: + case 144: + case 145: return isDeclarationVisible(node.parent); - case 123: - case 207: + case 125: + case 210: return true; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -8851,14 +9071,14 @@ var ts; } } function getRootDeclaration(node) { - while (node.kind === 146) { + while (node.kind === 148) { node = node.parent.parent; } return node; } function getDeclarationContainer(node) { node = getRootDeclaration(node); - return node.kind === 188 ? node.parent.parent.parent : node.parent; + return node.kind === 191 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); @@ -8880,16 +9100,18 @@ var ts; } return parentType; } - if (pattern.kind === 144) { + if (pattern.kind === 146) { var name = declaration.propertyName || declaration.name; - var type = getTypeOfPropertyOfType(parentType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); + var type = getTypeOfPropertyOfType(parentType, name.text) || + isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, 1) || + getIndexTypeOfType(parentType, 0); if (!type) { error(name, ts.Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), ts.declarationNameToString(name)); return unknownType; } } else { - if (!isTypeAssignableTo(parentType, anyArrayType)) { + if (!isArrayLikeType(parentType)) { error(pattern, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(parentType)); return unknownType; } @@ -8908,7 +9130,7 @@ var ts; return type; } function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 178) { + if (declaration.parent.parent.kind === 180) { return anyType; } if (ts.isBindingPattern(declaration.parent)) { @@ -8917,10 +9139,10 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 124) { + if (declaration.kind === 126) { var func = declaration.parent; - if (func.kind === 131 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 130); + if (func.kind === 133 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 132); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -8933,7 +9155,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 205) { + if (declaration.kind === 208) { return checkIdentifier(declaration.name); } return undefined; @@ -8962,7 +9184,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 168 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 170 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -8970,7 +9192,7 @@ var ts; return !elementTypes.length ? anyArrayType : hasSpreadElement ? createArrayType(getUnionType(elementTypes)) : createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern) { - return pattern.kind === 144 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); + return pattern.kind === 146 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) { var type = getTypeForVariableLikeDeclaration(declaration); @@ -8978,7 +9200,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 204 ? getWidenedType(type) : type; + return declaration.kind !== 207 ? getWidenedType(type) : type; } if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name); @@ -8986,7 +9208,7 @@ var ts; type = declaration.dotDotDotToken ? anyArrayType : anyType; if (reportErrors && compilerOptions.noImplicitAny) { var root = getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 124 && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 126 && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -8999,7 +9221,7 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.kind === 203) { + if (declaration.kind === 206) { return links.type = anyType; } links.type = resolvingType; @@ -9022,7 +9244,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 130) { + if (accessor.kind === 132) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -9041,8 +9263,8 @@ var ts; links = links || getSymbolLinks(symbol); if (!links.type) { links.type = resolvingType; - var getter = ts.getDeclarationOfKind(symbol, 130); - var setter = ts.getDeclarationOfKind(symbol, 131); + var getter = ts.getDeclarationOfKind(symbol, 132); + var setter = ts.getDeclarationOfKind(symbol, 133); var type; var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { @@ -9072,7 +9294,7 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 130); + var getter = ts.getDeclarationOfKind(symbol, 132); error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } } @@ -9139,7 +9361,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 192 || node.kind === 191) { + if (node.kind === 195 || node.kind === 194) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -9170,7 +9392,7 @@ var ts; type.typeArguments = type.typeParameters; } type.baseTypes = []; - var declaration = ts.getDeclarationOfKind(symbol, 191); + var declaration = ts.getDeclarationOfKind(symbol, 194); var baseTypeNode = ts.getClassBaseTypeNode(declaration); if (baseTypeNode) { var baseType = getTypeFromTypeReferenceNode(baseTypeNode); @@ -9211,7 +9433,7 @@ var ts; } type.baseTypes = []; ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 192 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 195 && ts.getInterfaceBaseTypeNodes(declaration)) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), function (node) { var baseType = getTypeFromTypeReferenceNode(node); if (baseType !== unknownType) { @@ -9242,7 +9464,7 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = ts.getDeclarationOfKind(symbol, 193); + var declaration = ts.getDeclarationOfKind(symbol, 196); var type = getTypeFromTypeNode(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; @@ -9250,7 +9472,7 @@ var ts; } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 193); + var declaration = ts.getDeclarationOfKind(symbol, 196); error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; @@ -9269,7 +9491,7 @@ var ts; if (!links.declaredType) { var type = createType(512); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 123).constraint) { + if (!ts.getDeclarationOfKind(symbol, 125).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -9570,6 +9792,9 @@ var ts; else if (type.flags & 8) { type = globalBooleanType; } + else if (type.flags & 1048576) { + type = globalESSymbolType; + } return type; } function createUnionProperty(unionType, name) { @@ -9672,7 +9897,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 129 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 131 ? getDeclaredTypeOfClass(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; var hasStringLiterals = false; @@ -9700,8 +9925,8 @@ var ts; returnType = getTypeFromTypeNode(declaration.type); } else { - if (declaration.kind === 130 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 131); + if (declaration.kind === 132 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 133); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { @@ -9719,19 +9944,19 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 136: - case 137: - case 190: - case 128: - case 127: + case 138: + case 139: + case 193: + case 130: case 129: + case 131: + case 134: + case 135: + case 136: case 132: case 133: - case 134: - case 130: - case 131: - case 156: - case 157: + case 158: + case 159: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -9800,7 +10025,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 129 || signature.declaration.kind === 133; + var isConstructor = signature.declaration.kind === 131 || signature.declaration.kind === 135; var type = createObjectType(32768 | 65536); type.members = emptySymbols; type.properties = emptyArray; @@ -9841,7 +10066,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 123).constraint); + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 125).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -9889,13 +10114,13 @@ var ts; while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 123; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 125; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 135 && n.typeName.kind === 64) { + if (n.kind === 137 && n.typeName.kind === 64) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); @@ -9960,9 +10185,9 @@ var ts; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; switch (declaration.kind) { - case 191: - case 192: case 194: + case 195: + case 197: return declaration; } } @@ -9981,11 +10206,20 @@ var ts; } return type; } - function getGlobalSymbol(name) { - return resolveName(undefined, name, 793056, ts.Diagnostics.Cannot_find_global_type_0, name); + function getGlobalValueSymbol(name) { + return getGlobalSymbol(name, 107455, ts.Diagnostics.Cannot_find_global_value_0); + } + function getGlobalTypeSymbol(name) { + return getGlobalSymbol(name, 793056, ts.Diagnostics.Cannot_find_global_type_0); + } + function getGlobalSymbol(name, meaning, diagnostic) { + return resolveName(undefined, name, meaning, diagnostic, name); } function getGlobalType(name) { - return getTypeOfGlobalSymbol(getGlobalSymbol(name), 0); + return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), 0); + } + function getGlobalESSymbolConstructorSymbol() { + return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); } function createArrayType(elementType) { var arrayType = globalArrayType || getDeclaredTypeOfSymbol(globalArraySymbol); @@ -10134,28 +10368,30 @@ var ts; return numberType; case 111: return booleanType; + case 120: + return esSymbolType; case 98: return voidType; case 8: return getTypeFromStringLiteral(node); - case 135: - return getTypeFromTypeReferenceNode(node); - case 138: - return getTypeFromTypeQueryNode(node); - case 140: - return getTypeFromArrayTypeNode(node); - case 141: - return getTypeFromTupleTypeNode(node); - case 142: - return getTypeFromUnionTypeNode(node); - case 143: - return getTypeFromTypeNode(node.type); - case 136: case 137: + return getTypeFromTypeReferenceNode(node); + case 140: + return getTypeFromTypeQueryNode(node); + case 142: + return getTypeFromArrayTypeNode(node); + case 143: + return getTypeFromTupleTypeNode(node); + case 144: + return getTypeFromUnionTypeNode(node); + case 145: + return getTypeFromTypeNode(node.type); + case 138: case 139: + case 141: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 64: - case 121: + case 123: var symbol = getSymbolInfo(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: @@ -10299,25 +10535,27 @@ var ts; return type; } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 128 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 156: - case 157: + case 158: + case 159: return isContextSensitiveFunctionLikeDeclaration(node); - case 148: + case 150: return ts.forEach(node.properties, isContextSensitive); - case 147: + case 149: return ts.forEach(node.elements, isContextSensitive); - case 164: - return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 163: - return node.operator === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 204: + case 166: + return isContextSensitive(node.whenTrue) || + isContextSensitive(node.whenFalse); + case 165: + return node.operatorToken.kind === 49 && + (isContextSensitive(node.left) || isContextSensitive(node.right)); + case 207: return isContextSensitive(node.initializer); - case 128: - case 127: + case 130: + case 129: return isContextSensitiveFunctionLikeDeclaration(node); - case 155: + case 157: return isContextSensitive(node.expression); } return false; @@ -10462,7 +10700,8 @@ var ts; } var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo; var sourceOrApparentType = relation === identityRelation ? source : getApparentType(source); - if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { + if (sourceOrApparentType.flags & 48128 && target.flags & 48128 && + (result = objectTypeRelatedTo(sourceOrApparentType, target, reportStructuralErrors, elaborateErrors))) { errorInfo = saveErrorInfo; return result; } @@ -10919,7 +11158,9 @@ var ts; if (source === target) { return -1; } - if (source.parameters.length !== target.parameters.length || source.minArgumentCount !== target.minArgumentCount || source.hasRestParameter !== target.hasRestParameter) { + if (source.parameters.length !== target.parameters.length || + source.minArgumentCount !== target.minArgumentCount || + source.hasRestParameter !== target.hasRestParameter) { return 0; } var result = -1; @@ -10993,6 +11234,9 @@ var ts; function isArrayType(type) { return type.flags & 4096 && type.target === globalArrayType; } + function isArrayLikeType(type) { + return !(type.flags & (32 | 64)) && isTypeAssignableTo(type, anyArrayType); + } function isTupleLikeType(type) { return !!getPropertyOfType(type, "0"); } @@ -11070,20 +11314,20 @@ var ts; function reportImplicitAnyError(declaration, type) { var typeAsString = typeToString(getWidenedType(type)); switch (declaration.kind) { - case 126: - case 125: - var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; - break; - case 124: - var diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; - break; - case 190: case 128: case 127: + var diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; + break; + case 126: + var diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; + break; + case 193: case 130: - case 131: - case 156: - case 157: + case 129: + case 132: + case 133: + case 158: + case 159: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -11216,7 +11460,8 @@ var ts; inferFromTypes(sourceTypes[i], target); } } - else if (source.flags & 48128 && (target.flags & (4096 | 8192) || (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { + else if (source.flags & 48128 && (target.flags & (4096 | 8192) || + (target.flags & 32768) && target.symbol && target.symbol.flags & (8192 | 2048))) { if (!isInProcess(source, target) && isWithinDepthLimit(source, sourceStack) && isWithinDepthLimit(target, targetStack)) { if (depth === 0) { sourceStack = []; @@ -11311,10 +11556,10 @@ var ts; function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 138: + case 140: return true; case 64: - case 121: + case 123: node = node.parent; continue; default: @@ -11351,9 +11596,9 @@ var ts; } return links.assignmentChecks[symbol.id] = isAssignedIn(node); function isAssignedInBinaryExpression(node) { - if (node.operator >= 52 && node.operator <= 63) { + if (node.operatorToken.kind >= 52 && node.operatorToken.kind <= 63) { var n = node.left; - while (n.kind === 155) { + while (n.kind === 157) { n = n.expression; } if (n.kind === 64 && getResolvedSymbol(n) === symbol) { @@ -11370,45 +11615,46 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 163: + case 165: return isAssignedInBinaryExpression(node); - case 188: - case 146: - return isAssignedInVariableDeclaration(node); - case 144: - case 145: - case 147: + case 191: case 148: + return isAssignedInVariableDeclaration(node); + case 146: + case 147: case 149: case 150: case 151: case 152: + case 153: case 154: - case 155: - case 161: - case 158: - case 159: + case 156: + case 157: + case 163: case 160: + case 161: case 162: case 164: - case 167: - case 170: - case 171: + case 166: + case 169: + case 172: case 173: - case 174: case 175: case 176: case 177: case 178: + case 179: + case 180: case 181: - case 182: - case 183: - case 200: - case 201: case 184: case 185: case 186: case 203: + case 204: + case 187: + case 188: + case 189: + case 206: return ts.forEachChild(node, isAssignedIn); } return false; @@ -11417,13 +11663,12 @@ var ts; function resolveLocation(node) { var containerNodes = []; for (var parent = node.parent; parent; parent = parent.parent) { - if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && isContextSensitive(parent)) { + if ((ts.isExpression(parent) || ts.isObjectLiteralMethod(node)) && + isContextSensitive(parent)) { containerNodes.unshift(parent); } } - ts.forEach(containerNodes, function (node) { - getTypeOfNode(node); - }); + ts.forEach(containerNodes, function (node) { getTypeOfNode(node); }); } function getSymbolAtLocation(node) { resolveLocation(node); @@ -11445,34 +11690,34 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 174: + case 176: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } break; - case 164: + case 166: if (child !== node.condition) { narrowedType = narrowType(type, node.condition, child === node.whenTrue); } break; - case 163: + case 165: if (child === node.right) { - if (node.operator === 48) { + if (node.operatorToken.kind === 48) { narrowedType = narrowType(type, node.left, true); } - else if (node.operator === 49) { + else if (node.operatorToken.kind === 49) { narrowedType = narrowType(type, node.left, false); } } break; - case 207: - case 195: - case 190: - case 128: - case 127: + case 210: + case 198: + case 193: case 130: - case 131: case 129: + case 132: + case 133: + case 131: break loop; } if (narrowedType !== type) { @@ -11485,7 +11730,7 @@ var ts; } return type; function narrowTypeByEquality(type, expr, assumeTrue) { - if (expr.left.kind !== 159 || expr.right.kind !== 8) { + if (expr.left.kind !== 161 || expr.right.kind !== 8) { return type; } var left = expr.left; @@ -11494,12 +11739,12 @@ var ts; return type; } var typeInfo = primitiveTypeInfo[right.text]; - if (expr.operator === 31) { + if (expr.operatorToken.kind === 31) { assumeTrue = !assumeTrue; } if (assumeTrue) { if (!typeInfo) { - return removeTypesFromUnionType(type, 258 | 132 | 8, true); + return removeTypesFromUnionType(type, 258 | 132 | 8 | 1048576, true); } if (isTypeSubtypeOf(typeInfo.type, type)) { return typeInfo.type; @@ -11558,10 +11803,10 @@ var ts; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 155: + case 157: return narrowType(type, expr.expression, assumeTrue); - case 163: - var operator = expr.operator; + case 165: + var operator = expr.operatorToken.kind; if (operator === 30 || operator === 31) { return narrowTypeByEquality(type, expr, assumeTrue); } @@ -11575,7 +11820,7 @@ var ts; return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 161: + case 163: if (expr.operator === 46) { return narrowType(type, expr.operand, !assumeTrue); } @@ -11591,19 +11836,21 @@ var ts; nodeLinks.importOnRightSide = undefined; getSymbolLinks(rightSide).referenced = true; ts.Debug.assert((rightSide.flags & 8388608) !== 0); - nodeLinks = getNodeLinks(ts.getDeclarationOfKind(rightSide, 197)); + nodeLinks = getNodeLinks(ts.getDeclarationOfKind(rightSide, 200)); } } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); - if (symbol === argumentsSymbol && ts.getContainingFunction(node).kind === 157) { + if (symbol === argumentsSymbol && ts.getContainingFunction(node).kind === 159) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression); } if (symbol.flags & 8388608) { var symbolLinks = getSymbolLinks(symbol); if (!symbolLinks.referenced) { var importOrExportAssignment = getLeftSideOfImportOrExportAssignment(node); - if (!importOrExportAssignment || (importOrExportAssignment.flags & 1) || (importOrExportAssignment.kind === 198)) { + if (!importOrExportAssignment || + (importOrExportAssignment.flags & 1) || + (importOrExportAssignment.kind === 201)) { symbolLinks.referenced = !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol)); } else { @@ -11613,7 +11860,7 @@ var ts; } } if (symbolLinks.referenced) { - markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 197)); + markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 200)); } } checkCollisionWithCapturedSuperVariable(node, node); @@ -11621,9 +11868,9 @@ var ts; return getNarrowedTypeOfSymbol(getExportSymbolOfValueSymbolIfExported(symbol), node); } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 191 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 194 ? container.parent : undefined; getNodeLinks(node).flags |= 2; - if (container.kind === 126 || container.kind === 129) { + if (container.kind === 128 || container.kind === 131) { getNodeLinks(classNode).flags |= 4; } else { @@ -11633,36 +11880,36 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 157) { + if (container.kind === 159) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 195: + case 198: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); break; - case 194: + case 197: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 129: + case 131: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 126: - case 125: + case 128: + case 127: if (container.flags & 128) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 122: + case 124: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } if (needToCaptureLexicalThis) { captureLexicalThis(node, container); } - var classNode = container.parent && container.parent.kind === 191 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 194 ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -11671,15 +11918,15 @@ var ts; } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 124) { + if (n.kind === 126) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 151 && node.parent.expression === node; - var enclosingClass = ts.getAncestor(node, 191); + var isCallExpression = node.parent.kind === 153 && node.parent.expression === node; + var enclosingClass = ts.getAncestor(node, 194); var baseClass; if (enclosingClass && ts.getClassBaseTypeNode(enclosingClass)) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); @@ -11693,20 +11940,31 @@ var ts; if (container) { var canUseSuperExpression = false; if (isCallExpression) { - canUseSuperExpression = container.kind === 129; + canUseSuperExpression = container.kind === 131; } else { var needToCaptureLexicalThis = false; - while (container && container.kind === 157) { + while (container && container.kind === 159) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = true; } - if (container && container.parent && container.parent.kind === 191) { + if (container && container.parent && container.parent.kind === 194) { if (container.flags & 128) { - canUseSuperExpression = container.kind === 128 || container.kind === 127 || container.kind === 130 || container.kind === 131; + canUseSuperExpression = + container.kind === 130 || + container.kind === 129 || + container.kind === 132 || + container.kind === 133; } else { - canUseSuperExpression = container.kind === 128 || container.kind === 127 || container.kind === 130 || container.kind === 131 || container.kind === 126 || container.kind === 125 || container.kind === 129; + canUseSuperExpression = + container.kind === 130 || + container.kind === 129 || + container.kind === 132 || + container.kind === 133 || + container.kind === 128 || + container.kind === 127 || + container.kind === 131; } } } @@ -11720,7 +11978,7 @@ var ts; getNodeLinks(node).flags |= 16; returnType = baseClass; } - if (container.kind === 129 && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 131 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); returnType = unknownType; } @@ -11730,7 +11988,7 @@ var ts; return returnType; } } - if (container.kind === 122) { + if (container.kind === 124) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { @@ -11753,7 +12011,8 @@ var ts; if (indexOfParameter < len) { return getTypeAtPosition(contextualSignature, indexOfParameter); } - if (indexOfParameter === (func.parameters.length - 1) && funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { + if (indexOfParameter === (func.parameters.length - 1) && + funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); } } @@ -11767,7 +12026,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 124) { + if (declaration.kind === 126) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -11782,7 +12041,7 @@ var ts; function getContextualTypeForReturnExpression(node) { var func = ts.getContainingFunction(node); if (func) { - if (func.type || func.kind === 129 || func.kind === 130 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 131))) { + if (func.type || func.kind === 131 || func.kind === 132 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 133))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(func)); } var signature = getContextualSignatureForFunctionLikeDeclaration(func); @@ -11802,14 +12061,14 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 153) { + if (template.parent.kind === 155) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; } function getContextualTypeForBinaryOperand(node) { var binaryExpression = node.parent; - var operator = binaryExpression.operator; + var operator = binaryExpression.operatorToken.kind; if (operator >= 52 && operator <= 63) { if (node === binaryExpression.right) { return checkExpression(binaryExpression.left); @@ -11880,7 +12139,8 @@ var ts; return propertyType; } } - return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || getIndexTypeOfContextualType(type, 0); + return isNumericName(element.name) && getIndexTypeOfContextualType(type, 1) || + getIndexTypeOfContextualType(type, 0); } return undefined; } @@ -11906,32 +12166,32 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 188: - case 124: + case 191: case 126: - case 125: - case 146: + case 128: + case 127: + case 148: return getContextualTypeForInitializerExpression(node); - case 157: - case 181: + case 159: + case 184: return getContextualTypeForReturnExpression(node); - case 151: - case 152: - return getContextualTypeForArgument(parent, node); + case 153: case 154: + return getContextualTypeForArgument(parent, node); + case 156: return getTypeFromTypeNode(parent.type); - case 163: + case 165: return getContextualTypeForBinaryOperand(node); - case 204: + case 207: return getContextualTypeForObjectLiteralElement(parent); - case 147: + case 149: return getContextualTypeForElementExpression(node); - case 164: + case 166: return getContextualTypeForConditionalOperand(node); - case 169: - ts.Debug.assert(parent.parent.kind === 165); + case 171: + ts.Debug.assert(parent.parent.kind === 167); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 155: + case 157: return getContextualType(parent); } return undefined; @@ -11946,13 +12206,13 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 156 || node.kind === 157; + return node.kind === 158 || node.kind === 159; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) ? getContextualSignature(node) : undefined; } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 128 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); if (!type) { return undefined; @@ -11963,7 +12223,8 @@ var ts; var signatureList; var types = type.types; for (var i = 0; i < types.length; i++) { - if (signatureList && getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { + if (signatureList && + getSignaturesOfObjectOrUnionType(types[i], 0).length > 1) { return undefined; } var signature = getNonGenericSignature(types[i]); @@ -11992,20 +12253,20 @@ var ts; } function isAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 163 && parent.operator === 52 && parent.left === node) { + if (parent.kind === 165 && parent.operatorToken.kind === 52 && parent.left === node) { return true; } - if (parent.kind === 204) { + if (parent.kind === 207) { return isAssignmentTarget(parent.parent); } - if (parent.kind === 147) { + if (parent.kind === 149) { return isAssignmentTarget(parent); } return false; } function checkSpreadElementExpression(node, contextualMapper) { var type = checkExpressionCached(node.expression, contextualMapper); - if (!isTypeAssignableTo(type, anyArrayType)) { + if (!isArrayLikeType(type)) { error(node.expression, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(type)); return unknownType; } @@ -12020,7 +12281,7 @@ var ts; var elementTypes = []; ts.forEach(elements, function (e) { var type = checkExpression(e, contextualMapper); - if (e.kind === 167) { + if (e.kind === 169) { elementTypes.push(getIndexTypeOfType(type, 1) || anyType); hasSpreadElement = true; } @@ -12037,10 +12298,10 @@ var ts; return createArrayType(getUnionType(elementTypes)); } function isNumericName(name) { - return name.kind === 122 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 124 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { - return isTypeOfKind(checkComputedPropertyName(name), 1 | 132); + return allConstituentTypesHaveKind(checkComputedPropertyName(name), 1 | 132); } function isNumericLiteralName(name) { return (+name).toString() === name; @@ -12049,8 +12310,11 @@ var ts; var links = getNodeLinks(node.expression); if (!links.resolvedType) { links.resolvedType = checkExpression(node.expression); - if (!isTypeOfKind(links.resolvedType, 1 | 132 | 258)) { - error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_or_any); + if (!allConstituentTypesHaveKind(links.resolvedType, 1 | 132 | 258 | 1048576)) { + error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); + } + else { + checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, true); } } return links.resolvedType; @@ -12064,16 +12328,18 @@ var ts; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; var member = memberDecl.symbol; - if (memberDecl.kind === 204 || memberDecl.kind === 205 || ts.isObjectLiteralMethod(memberDecl)) { - if (memberDecl.kind === 204) { + if (memberDecl.kind === 207 || + memberDecl.kind === 208 || + ts.isObjectLiteralMethod(memberDecl)) { + if (memberDecl.kind === 207) { var type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 128) { + else if (memberDecl.kind === 130) { var type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 205); - var type = memberDecl.name.kind === 122 ? unknownType : checkExpression(memberDecl.name, contextualMapper); + ts.Debug.assert(memberDecl.kind === 208); + var type = memberDecl.name.kind === 124 ? unknownType : checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; var prop = createSymbol(4 | 67108864 | member.flags, member.name); @@ -12087,7 +12353,7 @@ var ts; member = prop; } else { - ts.Debug.assert(memberDecl.kind === 130 || memberDecl.kind === 131); + ts.Debug.assert(memberDecl.kind === 132 || memberDecl.kind === 133); checkAccessorDeclaration(memberDecl); } if (!ts.hasDynamicName(memberDecl)) { @@ -12120,7 +12386,7 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 126; + return s.valueDeclaration ? s.valueDeclaration.kind : 128; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 16 | 128 : 0; @@ -12130,7 +12396,7 @@ var ts; if (!(flags & (32 | 64))) { return; } - var enclosingClassDeclaration = ts.getAncestor(node, 191); + var enclosingClassDeclaration = ts.getAncestor(node, 194); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); if (flags & 32) { @@ -12177,7 +12443,7 @@ var ts; } getNodeLinks(node).resolvedSymbol = prop; if (prop.parent && prop.parent.flags & 32) { - if (left.kind === 90 && getDeclarationKindFromSymbol(prop) !== 128) { + if (left.kind === 90 && getDeclarationKindFromSymbol(prop) !== 130) { error(right, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); } else { @@ -12189,12 +12455,12 @@ var ts; return anyType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 149 ? node.expression : node.left; + var left = node.kind === 151 ? node.expression : node.left; var type = checkExpressionOrQualifiedName(left); if (type !== unknownType && type !== anyType) { var prop = getPropertyOfType(getWidenedType(type), propertyName); if (prop && prop.parent && prop.parent.flags & 32) { - if (left.kind === 90 && getDeclarationKindFromSymbol(prop) !== 128) { + if (left.kind === 90 && getDeclarationKindFromSymbol(prop) !== 130) { return false; } else { @@ -12209,7 +12475,7 @@ var ts; function checkIndexedAccess(node) { if (!node.argumentExpression) { var sourceFile = getSourceFile(node); - if (node.parent.kind === 152 && node.parent.expression === node) { + if (node.parent.kind === 154 && node.parent.expression === node) { var start = ts.skipTrivia(sourceFile.text, node.expression.end); var end = node.end; grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead); @@ -12226,13 +12492,14 @@ var ts; return unknownType; } var isConstEnum = isConstEnumObjectType(objectType); - if (isConstEnum && (!node.argumentExpression || node.argumentExpression.kind !== 8)) { + if (isConstEnum && + (!node.argumentExpression || node.argumentExpression.kind !== 8)) { error(node.argumentExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal); return unknownType; } if (node.argumentExpression) { - if (node.argumentExpression.kind === 8 || node.argumentExpression.kind === 7) { - var name = node.argumentExpression.text; + var name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); + if (name !== undefined) { var prop = getPropertyOfType(objectType, name); if (prop) { getNodeLinks(node).resolvedSymbol = prop; @@ -12244,8 +12511,8 @@ var ts; } } } - if (isTypeOfKind(indexType, 1 | 258 | 132)) { - if (isTypeOfKind(indexType, 1 | 132)) { + if (allConstituentTypesHaveKind(indexType, 1 | 258 | 132 | 1048576)) { + if (allConstituentTypesHaveKind(indexType, 1 | 132)) { var numberIndexType = getIndexTypeOfType(objectType, 1); if (numberIndexType) { return numberIndexType; @@ -12260,11 +12527,51 @@ var ts; } return anyType; } - error(node, ts.Diagnostics.An_index_expression_argument_must_be_of_type_string_number_or_any); + error(node, ts.Diagnostics.An_index_expression_argument_must_be_of_type_string_number_symbol_or_any); return unknownType; } + function getPropertyNameForIndexedAccess(indexArgumentExpression, indexArgumentType) { + if (indexArgumentExpression.kind === 8 || indexArgumentExpression.kind === 7) { + return indexArgumentExpression.text; + } + if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, false)) { + var rightHandSideName = indexArgumentExpression.name.text; + return ts.getPropertyNameForKnownSymbolName(rightHandSideName); + } + return undefined; + } + function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) { + if (expressionType === unknownType) { + return false; + } + if (!ts.isWellKnownSymbolSyntactically(expression)) { + return false; + } + if ((expressionType.flags & 1048576) === 0) { + if (reportError) { + error(expression, ts.Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, ts.getTextOfNode(expression)); + } + return false; + } + var leftHandSide = expression.expression; + var leftHandSideSymbol = getResolvedSymbol(leftHandSide); + if (!leftHandSideSymbol) { + return false; + } + var globalESSymbol = getGlobalESSymbolConstructorSymbol(); + if (!globalESSymbol) { + return false; + } + if (leftHandSideSymbol !== globalESSymbol) { + if (reportError) { + error(leftHandSide, ts.Diagnostics.Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object); + } + return false; + } + return true; + } function resolveUntypedCall(node) { - if (node.kind === 153) { + if (node.kind === 155) { checkExpression(node.template); } else { @@ -12317,7 +12624,7 @@ var ts; } function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { - if (args[i].kind === 167) { + if (args[i].kind === 169) { return i; } } @@ -12327,11 +12634,11 @@ var ts; var adjustedArgCount; var typeArguments; var callIsIncomplete; - if (node.kind === 153) { + if (node.kind === 155) { var tagExpression = node; adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 165) { + if (tagExpression.template.kind === 167) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -12346,14 +12653,15 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 152); + ts.Debug.assert(callExpression.kind === 154); return signature.minArgumentCount === 0; } adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; callIsIncomplete = callExpression.arguments.end === callExpression.end; typeArguments = callExpression.typeArguments; } - var hasRightNumberOfTypeArgs = !typeArguments || (signature.typeParameters && typeArguments.length === signature.typeParameters.length); + var hasRightNumberOfTypeArgs = !typeArguments || + (signature.typeParameters && typeArguments.length === signature.typeParameters.length); if (!hasRightNumberOfTypeArgs) { return false; } @@ -12370,7 +12678,8 @@ var ts; function getSingleCallSignature(type) { if (type.flags & 48128) { var resolved = resolveObjectOrUnionTypeMembers(type); - if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { + if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 && + resolved.properties.length === 0 && !resolved.stringIndexType && !resolved.numberIndexType) { return resolved.callSignatures[0]; } } @@ -12389,9 +12698,9 @@ var ts; var inferenceMapper = createInferenceMapper(context); for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 168) { - var paramType = getTypeAtPosition(signature, arg.kind === 167 ? -1 : i); - if (i === 0 && args[i].parent.kind === 153) { + if (arg.kind !== 170) { + var paramType = getTypeAtPosition(signature, arg.kind === 169 ? -1 : i); + if (i === 0 && args[i].parent.kind === 155) { var argType = globalTemplateStringsArrayType; } else { @@ -12405,7 +12714,7 @@ var ts; for (var i = 0; i < args.length; i++) { if (excludeArgument[i] === false) { var arg = args[i]; - var paramType = getTypeAtPosition(signature, arg.kind === 167 ? -1 : i); + var paramType = getTypeAtPosition(signature, arg.kind === 169 ? -1 : i); inferTypes(context, checkExpressionWithContextualType(arg, paramType, inferenceMapper), paramType); } } @@ -12438,9 +12747,9 @@ var ts; function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) { for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 168) { - var paramType = getTypeAtPosition(signature, arg.kind === 167 ? -1 : i); - var argType = i === 0 && node.kind === 153 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + if (arg.kind !== 170) { + var paramType = getTypeAtPosition(signature, arg.kind === 169 ? -1 : i); + var argType = i === 0 && node.kind === 155 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) : checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); if (!checkTypeRelatedTo(argType, paramType, relation, reportErrors ? arg : undefined, ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1)) { return false; } @@ -12450,10 +12759,10 @@ var ts; } function getEffectiveCallArguments(node) { var args; - if (node.kind === 153) { + if (node.kind === 155) { var template = node.template; args = [template]; - if (template.kind === 165) { + if (template.kind === 167) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); @@ -12466,7 +12775,7 @@ var ts; } function getEffectiveTypeArguments(callExpression) { if (callExpression.expression.kind === 90) { - var containingClass = ts.getAncestor(callExpression, 191); + var containingClass = ts.getAncestor(callExpression, 194); var baseClassTypeNode = containingClass && ts.getClassBaseTypeNode(containingClass); return baseClassTypeNode && baseClassTypeNode.typeArguments; } @@ -12475,7 +12784,7 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray) { - var isTaggedTemplate = node.kind === 153; + var isTaggedTemplate = node.kind === 155; var typeArguments; if (!isTaggedTemplate) { typeArguments = getEffectiveTypeArguments(node); @@ -12681,13 +12990,13 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 151) { + if (node.kind === 153) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 152) { + else if (node.kind === 154) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 153) { + else if (node.kind === 155) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } else { @@ -12702,9 +13011,12 @@ var ts; if (node.expression.kind === 90) { return voidType; } - if (node.kind === 152) { + if (node.kind === 154) { var declaration = signature.declaration; - if (declaration && declaration.kind !== 129 && declaration.kind !== 133 && declaration.kind !== 137) { + if (declaration && + declaration.kind !== 131 && + declaration.kind !== 135 && + declaration.kind !== 139) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -12754,7 +13066,7 @@ var ts; if (!func.body) { return unknownType; } - if (func.body.kind !== 170) { + if (func.body.kind !== 172) { var type = checkExpressionCached(func.body, contextualMapper); } else { @@ -12792,7 +13104,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 185); + return (body.statements.length === 1) && (body.statements[0].kind === 188); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -12801,7 +13113,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 170) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 172) { return; } var bodyBlock = func.body; @@ -12814,9 +13126,9 @@ var ts; error(func.type, ts.Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_or_consist_of_a_single_throw_statement); } function checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper) { - ts.Debug.assert(node.kind !== 128 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 156) { + if (!hasGrammarError && node.kind === 158) { checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { @@ -12844,19 +13156,19 @@ var ts; checkSignatureDeclaration(node); } } - if (produceDiagnostics && node.kind !== 128 && node.kind !== 127) { + if (produceDiagnostics && node.kind !== 130 && node.kind !== 129) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 128 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 130 || ts.isObjectLiteralMethod(node)); if (node.type) { checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); } if (node.body) { - if (node.body.kind === 170) { + if (node.body.kind === 172) { checkSourceElement(node.body); } else { @@ -12869,7 +13181,7 @@ var ts; } } function checkArithmeticOperandType(operand, type, diagnostic) { - if (!isTypeOfKind(type, 1 | 132)) { + if (!allConstituentTypesHaveKind(type, 1 | 132)) { error(operand, diagnostic); return false; } @@ -12885,12 +13197,12 @@ var ts; case 64: var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; - case 149: + case 151: var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; - case 150: + case 152: return true; - case 155: + case 157: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -12899,10 +13211,10 @@ var ts; function isConstVariableReference(n) { switch (n.kind) { case 64: - case 149: + case 151: var symbol = findSymbol(n); return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 4096) !== 0; - case 150: + case 152: var index = n.argumentExpression; var symbol = findSymbol(n.expression); if (symbol && index && index.kind === 8) { @@ -12911,7 +13223,7 @@ var ts; return prop && (prop.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(prop) & 4096) !== 0; } return false; - case 155: + case 157: return isConstVariableReference(n.expression); default: return false; @@ -12951,6 +13263,9 @@ var ts; case 33: case 34: case 47: + if (someConstituentTypeHasKind(operandType, 1048576)) { + error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator)); + } return numberType; case 46: return booleanType; @@ -12973,7 +13288,22 @@ var ts; } return numberType; } - function isTypeOfKind(type, kind) { + function someConstituentTypeHasKind(type, kind) { + if (type.flags & kind) { + return true; + } + if (type.flags & 16384) { + var types = type.types; + for (var i = 0; i < types.length; i++) { + if (types[i].flags & kind) { + return true; + } + } + return false; + } + return false; + } + function allConstituentTypesHaveKind(type, kind) { if (type.flags & kind) { return true; } @@ -12995,7 +13325,7 @@ var ts; return (symbol.flags & 128) !== 0; } function checkInstanceOfExpression(node, leftType, rightType) { - if (isTypeOfKind(leftType, 510)) { + if (allConstituentTypesHaveKind(leftType, 1049086)) { error(node.left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } if (!(rightType.flags & 1 || isTypeSubtypeOf(rightType, globalFunctionType))) { @@ -13004,10 +13334,10 @@ var ts; return booleanType; } function checkInExpression(node, leftType, rightType) { - if (!isTypeOfKind(leftType, 1 | 258 | 132)) { - error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number); + if (!allConstituentTypesHaveKind(leftType, 1 | 258 | 132 | 1048576)) { + error(node.left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeOfKind(rightType, 1 | 48128 | 512)) { + if (!allConstituentTypesHaveKind(rightType, 1 | 48128 | 512)) { error(node.right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; @@ -13016,9 +13346,11 @@ var ts; var properties = node.properties; for (var i = 0; i < properties.length; i++) { var p = properties[i]; - if (p.kind === 204 || p.kind === 205) { + if (p.kind === 207 || p.kind === 208) { var name = p.name; - var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || getIndexTypeOfType(sourceType, 0); + var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name.text) || + isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, 1) || + getIndexTypeOfType(sourceType, 0); if (type) { checkDestructuringAssignment(p.initializer || name, type); } @@ -13033,15 +13365,15 @@ var ts; return sourceType; } function checkArrayLiteralAssignment(node, sourceType, contextualMapper) { - if (!isTypeAssignableTo(sourceType, anyArrayType)) { + if (!isArrayLikeType(sourceType)) { error(node, ts.Diagnostics.Type_0_is_not_an_array_type, typeToString(sourceType)); return sourceType; } var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 168) { - if (e.kind !== 167) { + if (e.kind !== 170) { + if (e.kind !== 169) { var propName = "" + i; var type = sourceType.flags & 1 ? sourceType : isTupleLikeType(sourceType) ? getTypeOfPropertyOfType(sourceType, propName) : getIndexTypeOfType(sourceType, 1); if (type) { @@ -13064,14 +13396,14 @@ var ts; return sourceType; } function checkDestructuringAssignment(target, sourceType, contextualMapper) { - if (target.kind === 163 && target.operator === 52) { + if (target.kind === 165 && target.operatorToken.kind === 52) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 148) { + if (target.kind === 150) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 147) { + if (target.kind === 149) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -13084,11 +13416,11 @@ var ts; return sourceType; } function checkBinaryExpression(node, contextualMapper) { - if (ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operator)) { + if (ts.isLeftHandSideExpression(node.left) && ts.isAssignmentOperator(node.operatorToken.kind)) { checkGrammarEvalOrArgumentsInStrictMode(node, node.left); } - var operator = node.operator; - if (operator === 52 && (node.left.kind === 148 || node.left.kind === 147)) { + var operator = node.operatorToken.kind; + if (operator === 52 && (node.left.kind === 150 || node.left.kind === 149)) { return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); } var leftType = checkExpression(node.left, contextualMapper); @@ -13119,8 +13451,10 @@ var ts; if (rightType.flags & (32 | 64)) rightType = leftType; var suggestedOperator; - if ((leftType.flags & 8) && (rightType.flags & 8) && (suggestedOperator = getSuggestedBooleanOperator(node.operator)) !== undefined) { - error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operator), ts.tokenToString(suggestedOperator)); + if ((leftType.flags & 8) && + (rightType.flags & 8) && + (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { + error(node, ts.Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, ts.tokenToString(node.operatorToken.kind), ts.tokenToString(suggestedOperator)); } else { var leftOk = checkArithmeticOperandType(node.left, leftType, ts.Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type); @@ -13137,14 +13471,19 @@ var ts; if (rightType.flags & (32 | 64)) rightType = leftType; var resultType; - if (isTypeOfKind(leftType, 132) && isTypeOfKind(rightType, 132)) { + if (allConstituentTypesHaveKind(leftType, 132) && allConstituentTypesHaveKind(rightType, 132)) { resultType = numberType; } - else if (isTypeOfKind(leftType, 258) || isTypeOfKind(rightType, 258)) { - resultType = stringType; - } - else if (leftType.flags & 1 || rightType.flags & 1) { - resultType = anyType; + else { + if (allConstituentTypesHaveKind(leftType, 258) || allConstituentTypesHaveKind(rightType, 258)) { + resultType = stringType; + } + else if (leftType.flags & 1 || rightType.flags & 1) { + resultType = anyType; + } + if (resultType && !checkForDisallowedESSymbolOperand(operator)) { + return resultType; + } } if (!resultType) { reportOperatorError(); @@ -13154,14 +13493,17 @@ var ts; checkAssignmentOperator(resultType); } return resultType; - case 28: - case 29: - case 30: - case 31: case 24: case 25: case 26: case 27: + if (!checkForDisallowedESSymbolOperand(operator)) { + return booleanType; + } + case 28: + case 29: + case 30: + case 31: if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } @@ -13180,6 +13522,14 @@ var ts; case 23: return rightType; } + function checkForDisallowedESSymbolOperand(operator) { + var offendingSymbolOperand = someConstituentTypeHasKind(leftType, 1048576) ? node.left : someConstituentTypeHasKind(rightType, 1048576) ? node.right : undefined; + if (offendingSymbolOperand) { + error(offendingSymbolOperand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(operator)); + return false; + } + return true; + } function getSuggestedBooleanOperator(operator) { switch (operator) { case 44: @@ -13204,7 +13554,7 @@ var ts; } } function reportOperatorError() { - error(node, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(node.operator), typeToString(leftType), typeToString(rightType)); + error(node, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(node.operatorToken.kind), typeToString(leftType), typeToString(rightType)); } } function checkYieldExpression(node) { @@ -13242,14 +13592,14 @@ var ts; return links.resolvedType; } function checkPropertyAssignment(node, contextualMapper) { - if (ts.hasDynamicName(node)) { + if (node.name.kind === 124) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); - if (ts.hasDynamicName(node)) { + if (node.name.kind === 124) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -13275,7 +13625,7 @@ var ts; } function checkExpressionOrQualifiedName(node, contextualMapper) { var type; - if (node.kind == 121) { + if (node.kind == 123) { type = checkQualifiedName(node); } else { @@ -13283,7 +13633,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 149 && node.parent.expression === node) || (node.parent.kind === 150 && node.parent.expression === node) || ((node.kind === 64 || node.kind === 121) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 151 && node.parent.expression === node) || + (node.parent.kind === 152 && node.parent.expression === node) || + ((node.kind === 64 || node.kind === 123) && isInRightSideOfImportOrExportAssignment(node)); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment); } @@ -13309,52 +13661,52 @@ var ts; return booleanType; case 7: return checkNumericLiteral(node); - case 165: + case 167: return checkTemplateExpression(node); case 8: case 10: return stringType; case 9: return globalRegExpType; - case 147: - return checkArrayLiteral(node, contextualMapper); - case 148: - return checkObjectLiteral(node, contextualMapper); case 149: - return checkPropertyAccessExpression(node); + return checkArrayLiteral(node, contextualMapper); case 150: - return checkIndexedAccess(node); + return checkObjectLiteral(node, contextualMapper); case 151: + return checkPropertyAccessExpression(node); case 152: - return checkCallExpression(node); + return checkIndexedAccess(node); case 153: - return checkTaggedTemplateExpression(node); case 154: - return checkTypeAssertion(node); + return checkCallExpression(node); case 155: - return checkExpression(node.expression, contextualMapper); + return checkTaggedTemplateExpression(node); case 156: + return checkTypeAssertion(node); case 157: - return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 159: - return checkTypeOfExpression(node); + return checkExpression(node.expression, contextualMapper); case 158: - return checkDeleteExpression(node); - case 160: - return checkVoidExpression(node); + case 159: + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); case 161: - return checkPrefixUnaryExpression(node); + return checkTypeOfExpression(node); + case 160: + return checkDeleteExpression(node); case 162: - return checkPostfixUnaryExpression(node); + return checkVoidExpression(node); case 163: - return checkBinaryExpression(node, contextualMapper); + return checkPrefixUnaryExpression(node); case 164: - return checkConditionalExpression(node, contextualMapper); - case 167: - return checkSpreadElementExpression(node, contextualMapper); - case 168: - return undefinedType; + return checkPostfixUnaryExpression(node); + case 165: + return checkBinaryExpression(node, contextualMapper); case 166: + return checkConditionalExpression(node, contextualMapper); + case 169: + return checkSpreadElementExpression(node, contextualMapper); + case 170: + return undefinedType; + case 168: checkYieldExpression(node); return unknownType; } @@ -13376,7 +13728,7 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 112) { func = ts.getContainingFunction(node); - if (!(func.kind === 129 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 131 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -13390,10 +13742,12 @@ var ts; } } function checkSignatureDeclaration(node) { - if (node.kind === 134) { + if (node.kind === 136) { checkGrammarIndexSignature(node); } - else if (node.kind === 136 || node.kind === 190 || node.kind === 137 || node.kind === 132 || node.kind === 129 || node.kind === 133) { + else if (node.kind === 138 || node.kind === 193 || node.kind === 139 || + node.kind === 134 || node.kind === 131 || + node.kind === 135) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -13405,10 +13759,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 133: + case 135: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 132: + case 134: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -13417,7 +13771,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 192) { + if (node.kind === 195) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -13453,7 +13807,7 @@ var ts; } } function checkPropertyDeclaration(node) { - checkGrammarModifiers(node) || checkGrammarProperty(node); + checkGrammarModifiers(node) || checkGrammarProperty(node) || checkGrammarComputedPropertyName(node.name); checkVariableLikeDeclaration(node); } function checkMethodDeclaration(node) { @@ -13476,17 +13830,17 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 151 && n.expression.kind === 90; + return n.kind === 153 && n.expression.kind === 90; } function containsSuperCall(n) { if (isSuperCallExpression(n)) { return true; } switch (n.kind) { - case 156: - case 190: - case 157: - case 148: return false; + case 158: + case 193: + case 159: + case 150: return false; default: return ts.forEachChild(n, containsSuperCall); } } @@ -13494,19 +13848,22 @@ var ts; if (n.kind === 92) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 156 && n.kind !== 190) { + else if (n.kind !== 158 && n.kind !== 193) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 126 && !(n.flags & 128) && !!n.initializer; + return n.kind === 128 && + !(n.flags & 128) && + !!n.initializer; } if (ts.getClassBaseTypeNode(node.parent)) { if (containsSuperCall(node.body)) { - var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); + var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || + ts.forEach(node.parameters, function (p) { return p.flags & (16 | 32 | 64); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 173 || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 175 || !isSuperCallExpression(statements[0].expression)) { error(node, ts.Diagnostics.A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties); } else { @@ -13522,13 +13879,13 @@ var ts; function checkAccessorDeclaration(node) { if (produceDiagnostics) { checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 130) { + if (node.kind === 132) { if (!ts.isInAmbientContext(node) && ts.nodeIsPresent(node.body) && !(bodyContainsAReturnStatement(node.body) || bodyContainsSingleThrowStatement(node.body))) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value_or_consist_of_a_single_throw_statement); } } if (!ts.hasDynamicName(node)) { - var otherKind = node.kind === 130 ? 131 : 130; + var otherKind = node.kind === 132 ? 133 : 132; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 112) !== (otherAccessor.flags & 112))) { @@ -13602,9 +13959,9 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 192) { - ts.Debug.assert(signatureDeclarationNode.kind === 132 || signatureDeclarationNode.kind === 133); - var signatureKind = signatureDeclarationNode.kind === 132 ? 0 : 1; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 195) { + ts.Debug.assert(signatureDeclarationNode.kind === 134 || signatureDeclarationNode.kind === 135); + var signatureKind = signatureDeclarationNode.kind === 134 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -13622,7 +13979,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 192 && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 195 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; } @@ -13695,7 +14052,7 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 128 || node.kind === 127); + ts.Debug.assert(node.kind === 130 || node.kind === 129); ts.Debug.assert((node.flags & 128) !== (subsequentNode.flags & 128)); var diagnostic = node.flags & 128 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode, diagnostic); @@ -13721,11 +14078,11 @@ var ts; for (var i = 0; i < declarations.length; i++) { var node = declarations[i]; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 192 || node.parent.kind === 139 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 195 || node.parent.kind === 141 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 190 || node.kind === 128 || node.kind === 127 || node.kind === 129) { + if (node.kind === 193 || node.kind === 130 || node.kind === 129 || node.kind === 131) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -13822,19 +14179,17 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 192: - return 2097152; case 195: + return 2097152; + case 198: return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 191: case 194: - return 2097152 | 1048576; case 197: + return 2097152 | 1048576; + case 200: var result = 0; var target = resolveImport(getSymbolOfNode(d)); - ts.forEach(target.declarations, function (d) { - result |= getDeclarationSpaces(d); - }); + ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); return result; default: return 1048576; @@ -13843,7 +14198,10 @@ var ts; } function checkFunctionDeclaration(node) { if (produceDiagnostics) { - checkFunctionLikeDeclaration(node) || checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); + checkFunctionLikeDeclaration(node) || + checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionName(node.name) || + checkGrammarForGenerator(node); checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -13851,10 +14209,10 @@ var ts; } function checkFunctionLikeDeclaration(node) { checkSignatureDeclaration(node); - if (ts.hasDynamicName(node)) { + if (node.name.kind === 124) { checkComputedPropertyName(node.name); } - else { + if (!ts.hasDynamicName(node)) { var symbol = getSymbolOfNode(node); var localSymbol = node.localSymbol || symbol; var firstDeclaration = ts.getDeclarationOfKind(localSymbol, node.kind); @@ -13876,11 +14234,11 @@ var ts; } } function checkBlock(node) { - if (node.kind === 170) { - checkGrammarForStatementInAmbientContext(node); + if (node.kind === 172) { + checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 196) { + if (ts.isFunctionBlock(node) || node.kind === 199) { checkFunctionExpressionBodies(node); } } @@ -13898,14 +14256,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 126 || node.kind === 125 || node.kind === 128 || node.kind === 127 || node.kind === 130 || node.kind === 131) { + if (node.kind === 128 || + node.kind === 127 || + node.kind === 130 || + node.kind === 129 || + node.kind === 132 || + node.kind === 133) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = getRootDeclaration(node); - if (root.kind === 124 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 126 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -13935,7 +14298,7 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = ts.getAncestor(node, 191); + var enclosingClass = ts.getAncestor(node, 194); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } @@ -13953,35 +14316,47 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 195 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 198 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 207 && ts.isExternalModule(parent)) { + if (parent.kind === 210 && ts.isExternalModule(parent)) { error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } - function checkCollisionWithConstDeclarations(node) { + function checkVarDeclaredNamesNotShadowed(node) { if (node.initializer && (ts.getCombinedNodeFlags(node) & 6144) === 0) { var symbol = getSymbolOfNode(node); if (symbol.flags & 1) { var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined); - if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { - if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 4096) { - error(node, ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0, symbolToString(localDeclarationSymbol)); + if (localDeclarationSymbol && + localDeclarationSymbol !== symbol && + localDeclarationSymbol.flags & 2) { + if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 6144) { + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 192); + var container = varDeclList.parent.kind === 173 && + varDeclList.parent.parent; + var namesShareScope = container && + (container.kind === 172 && ts.isAnyFunction(container.parent) || + (container.kind === 199 && container.kind === 198) || + container.kind === 210); + if (!namesShareScope) { + var name = symbolToString(localDeclarationSymbol); + error(ts.getErrorSpanForNode(node), ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); + } } } } } } function isParameterDeclaration(node) { - while (node.kind === 146) { + while (node.kind === 148) { node = node.parent.parent; } - return node.kind === 124; + return node.kind === 126; } function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind === 124) { + if (getRootDeclaration(node).kind === 126) { var func = ts.getContainingFunction(node); visit(node.initializer); } @@ -13989,7 +14364,7 @@ var ts; if (n.kind === 64) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 124) { + if (referencedSymbol.valueDeclaration.kind === 126) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -14008,17 +14383,16 @@ var ts; } function checkVariableLikeDeclaration(node) { checkSourceElement(node.type); - if (ts.hasDynamicName(node)) { + if (node.name.kind === 124) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } - return; } if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && getRootDeclaration(node).kind === 124 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && getRootDeclaration(node).kind === 126 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -14046,9 +14420,11 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); } } - if (node.kind !== 126 && node.kind !== 125) { + if (node.kind !== 128 && node.kind !== 127) { checkExportsOnMergedDeclarations(node); - checkCollisionWithConstDeclarations(node); + if (node.kind === 191 || node.kind === 148) { + checkVarDeclaredNamesNotShadowed(node); + } checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); @@ -14075,40 +14451,40 @@ var ts; } function inBlockOrObjectLiteralExpression(node) { while (node) { - if (node.kind === 170 || node.kind === 148) { + if (node.kind === 172 || node.kind === 150) { return true; } node = node.parent; } } function checkExpressionStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); } function checkIfStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); checkSourceElement(node.elseStatement); } function checkDoStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkSourceElement(node.statement); checkExpression(node.expression); } function checkWhileStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.statement); } function checkForStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind == 189) { + if (!checkGrammarStatementInAmbientContext(node)) { + if (node.initializer && node.initializer.kind == 192) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 189) { + if (node.initializer.kind === 192) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -14121,31 +14497,22 @@ var ts; checkExpression(node.iterator); checkSourceElement(node.statement); } + function checkForOfStatement(node) { + checkGrammarForOfStatement(node); + } function checkForInStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { - if (node.initializer.kind === 189) { - var variableList = node.initializer; - if (!checkGrammarVariableDeclarationList(variableList)) { - if (variableList.declarations.length > 1) { - grammarErrorOnFirstToken(variableList.declarations[1], ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); - } - } - } - } - if (node.initializer.kind === 189) { + checkGrammarForInOrForOfStatement(node); + if (node.initializer.kind === 192) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; checkVariableDeclaration(decl); - if (decl.type) { - error(decl, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation); - } } } else { var varExpr = node.initializer; var exprType = checkExpression(varExpr); - if (exprType !== anyType && exprType !== stringType) { + if (!allConstituentTypesHaveKind(exprType, 1 | 258)) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { @@ -14153,19 +14520,19 @@ var ts; } } var exprType = checkExpression(node.expression); - if (!isTypeOfKind(exprType, 1 | 48128 | 512)) { + if (!allConstituentTypesHaveKind(exprType, 1 | 48128 | 512)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } checkSourceElement(node.statement); } function checkBreakOrContinueStatement(node) { - checkGrammarForStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); + checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 130 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 131))); + return !!(node.kind === 132 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 133))); } function checkReturnStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { var functionBlock = ts.getContainingFunction(node); if (!functionBlock) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); @@ -14176,11 +14543,11 @@ var ts; if (func) { var returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); var exprType = checkExpressionCached(node.expression); - if (func.kind === 131) { + if (func.kind === 133) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } else { - if (func.kind === 129) { + if (func.kind === 131) { if (!isTypeAssignableTo(exprType, returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -14193,7 +14560,7 @@ var ts; } } function checkWithStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { if (node.parserContextFlags & 1) { grammarErrorOnFirstToken(node, ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode); } @@ -14202,12 +14569,12 @@ var ts; error(node.expression, ts.Diagnostics.All_symbols_within_a_with_block_will_be_resolved_to_any); } function checkSwitchStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); var firstDefaultClause; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.clauses, function (clause) { - if (clause.kind === 201 && !hasDuplicateDefaultClause) { + if (clause.kind === 204 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -14219,7 +14586,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 200) { + if (produceDiagnostics && clause.kind === 203) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -14230,13 +14597,13 @@ var ts; }); } function checkLabeledStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { var current = node.parent; while (current) { if (ts.isAnyFunction(current)) { break; } - if (current.kind === 184 && current.label.text === node.label.text) { + if (current.kind === 187 && current.label.text === node.label.text) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); break; @@ -14247,7 +14614,7 @@ var ts; checkSourceElement(node.statement); } function checkThrowStatement(node) { - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { if (node.expression === undefined) { grammarErrorAfterFirstToken(node, ts.Diagnostics.Line_break_not_permitted_here); } @@ -14257,7 +14624,7 @@ var ts; } } function checkTryStatement(node) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkBlock(node.tryBlock); var catchClause = node.catchClause; if (catchClause) { @@ -14283,7 +14650,7 @@ var ts; checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0); checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1); }); - if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 191) { + if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 194) { var classDeclaration = type.symbol.valueDeclaration; for (var i = 0; i < classDeclaration.members.length; i++) { var member = classDeclaration.members[i]; @@ -14314,7 +14681,7 @@ var ts; return; } var errorNode; - if (prop.valueDeclaration.name.kind === 122 || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 124 || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -14336,6 +14703,7 @@ var ts; case "number": case "boolean": case "string": + case "symbol": case "void": error(name, message, name.text); } @@ -14454,7 +14822,7 @@ var ts; } } function isAccessor(kind) { - return kind === 130 || kind === 131; + return kind === 132 || kind === 133; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -14486,9 +14854,7 @@ var ts; return true; } var seen = {}; - ts.forEach(type.declaredProperties, function (p) { - seen[p.name] = { prop: p, containingType: type }; - }); + ts.forEach(type.declaredProperties, function (p) { seen[p.name] = { prop: p, containingType: type }; }); var ok = true; for (var i = 0, len = type.baseTypes.length; i < len; ++i) { var base = type.baseTypes[i]; @@ -14505,7 +14871,7 @@ var ts; ok = false; var typeName1 = typeToString(existing.containingType); var typeName2 = typeToString(base); - var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_properties_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2); + var errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(typeNode, errorInfo)); } @@ -14521,7 +14887,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 192); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 195); if (symbol.declarations.length > 1) { if (node !== firstInterfaceDecl && !areTypeParametersIdentical(firstInterfaceDecl.typeParameters, node.typeParameters)) { error(node.name, ts.Diagnostics.All_declarations_of_an_interface_must_have_identical_type_parameters); @@ -14557,7 +14923,7 @@ var ts; var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); ts.forEach(node.members, function (member) { - if (member.name.kind !== 122 && isNumericLiteralName(member.name.text)) { + if (member.name.kind !== 124 && isNumericLiteralName(member.name.text)) { error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); } var initializer = member.initializer; @@ -14593,7 +14959,7 @@ var ts; return evalConstant(initializer); function evalConstant(e) { switch (e.kind) { - case 161: + case 163: var value = evalConstant(e.operand); if (value === undefined) { return undefined; @@ -14604,7 +14970,7 @@ var ts; case 47: return enumIsConst ? ~value : undefined; } return undefined; - case 163: + case 165: if (!enumIsConst) { return undefined; } @@ -14616,7 +14982,7 @@ var ts; if (right === undefined) { return undefined; } - switch (e.operator) { + switch (e.operatorToken.kind) { case 44: return left | right; case 43: return left & right; case 41: return left >> right; @@ -14632,11 +14998,11 @@ var ts; return undefined; case 7: return +e.text; - case 155: + case 157: return enumIsConst ? evalConstant(e.expression) : undefined; case 64: - case 150: - case 149: + case 152: + case 151: if (!enumIsConst) { return undefined; } @@ -14649,8 +15015,9 @@ var ts; propertyName = e.text; } else { - if (e.kind === 150) { - if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8) { + if (e.kind === 152) { + if (e.argumentExpression === undefined || + e.argumentExpression.kind !== 8) { return undefined; } var enumType = getTypeOfNode(e.expression); @@ -14706,7 +15073,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 194) { + if (declaration.kind !== 197) { return false; } var enumDeclaration = declaration; @@ -14729,7 +15096,7 @@ var ts; var declarations = symbol.declarations; for (var i = 0; i < declarations.length; i++) { var declaration = declarations[i]; - if ((declaration.kind === 191 || (declaration.kind === 190 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { + if ((declaration.kind === 194 || (declaration.kind === 193 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } } @@ -14741,11 +15108,11 @@ var ts; if (!ts.isInAmbientContext(node) && node.name.kind === 8) { grammarErrorOnNode(node.name, ts.Diagnostics.Only_ambient_modules_can_use_quoted_names); } - else if (node.name.kind === 64 && node.body.kind === 196) { + else if (node.name.kind === 64 && node.body.kind === 199) { var statements = node.body.statements; for (var i = 0, n = statements.length; i < n; i++) { var statement = statements[i]; - if (statement.kind === 198) { + if (statement.kind === 201) { grammarErrorOnNode(statement, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); } else if (ts.isExternalModuleImportDeclaration(statement)) { @@ -14781,7 +15148,7 @@ var ts; checkSourceElement(node.body); } function getFirstIdentifier(node) { - while (node.kind === 121) { + while (node.kind === 123) { node = node.left; } return node; @@ -14810,10 +15177,10 @@ var ts; } } else { - if (node.parent.kind === 207) { + if (node.parent.kind === 210) { target = resolveImport(symbol); } - else if (node.parent.kind === 196 && node.parent.parent.name.kind === 8) { + else if (node.parent.kind === 199 && node.parent.parent.name.kind === 8) { if (ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { if (isExternalModuleNameRelative(ts.getExternalModuleImportDeclarationExpression(node).text)) { error(node, ts.Diagnostics.Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); @@ -14832,7 +15199,9 @@ var ts; } } if (target !== unknownSymbol) { - var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); + var excludedMeanings = (symbol.flags & 107455 ? 107455 : 0) | + (symbol.flags & 793056 ? 793056 : 0) | + (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { error(node, ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0, symbolToString(symbol)); } @@ -14843,7 +15212,7 @@ var ts; grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } var container = node.parent; - if (container.kind !== 207) { + if (container.kind !== 210) { container = container.parent; } checkTypeOfExportAssignmentSymbol(getSymbolOfNode(container)); @@ -14852,156 +15221,156 @@ var ts; if (!node) return; switch (node.kind) { - case 123: - return checkTypeParameter(node); - case 124: - return checkParameter(node); - case 126: case 125: - return checkPropertyDeclaration(node); - case 136: - case 137: - case 132: - case 133: - return checkSignatureDeclaration(node); - case 134: - return checkSignatureDeclaration(node); + return checkTypeParameter(node); + case 126: + return checkParameter(node); case 128: case 127: - return checkMethodDeclaration(node); - case 129: - return checkConstructorDeclaration(node); - case 130: - case 131: - return checkAccessorDeclaration(node); - case 135: - return checkTypeReference(node); + return checkPropertyDeclaration(node); case 138: - return checkTypeQuery(node); case 139: - return checkTypeLiteral(node); + case 134: + case 135: + return checkSignatureDeclaration(node); + case 136: + return checkSignatureDeclaration(node); + case 130: + case 129: + return checkMethodDeclaration(node); + case 131: + return checkConstructorDeclaration(node); + case 132: + case 133: + return checkAccessorDeclaration(node); + case 137: + return checkTypeReference(node); case 140: - return checkArrayType(node); + return checkTypeQuery(node); case 141: - return checkTupleType(node); + return checkTypeLiteral(node); case 142: - return checkUnionType(node); + return checkArrayType(node); case 143: + return checkTupleType(node); + case 144: + return checkUnionType(node); + case 145: return checkSourceElement(node.type); - case 190: - return checkFunctionDeclaration(node); - case 170: - case 196: - return checkBlock(node); - case 171: - return checkVariableStatement(node); - case 173: - return checkExpressionStatement(node); - case 174: - return checkIfStatement(node); - case 175: - return checkDoStatement(node); - case 176: - return checkWhileStatement(node); - case 177: - return checkForStatement(node); - case 178: - return checkForInStatement(node); - case 179: - case 180: - return checkBreakOrContinueStatement(node); - case 181: - return checkReturnStatement(node); - case 182: - return checkWithStatement(node); - case 183: - return checkSwitchStatement(node); - case 184: - return checkLabeledStatement(node); - case 185: - return checkThrowStatement(node); - case 186: - return checkTryStatement(node); - case 188: - return checkVariableDeclaration(node); - case 146: - return checkBindingElement(node); - case 191: - return checkClassDeclaration(node); - case 192: - return checkInterfaceDeclaration(node); case 193: - return checkTypeAliasDeclaration(node); - case 194: - return checkEnumDeclaration(node); - case 195: - return checkModuleDeclaration(node); - case 197: - return checkImportDeclaration(node); - case 198: - return checkExportAssignment(node); + return checkFunctionDeclaration(node); case 172: - checkGrammarForStatementInAmbientContext(node); - return; + case 199: + return checkBlock(node); + case 173: + return checkVariableStatement(node); + case 175: + return checkExpressionStatement(node); + case 176: + return checkIfStatement(node); + case 177: + return checkDoStatement(node); + case 178: + return checkWhileStatement(node); + case 179: + return checkForStatement(node); + case 180: + return checkForInStatement(node); + case 181: + return checkForOfStatement(node); + case 182: + case 183: + return checkBreakOrContinueStatement(node); + case 184: + return checkReturnStatement(node); + case 185: + return checkWithStatement(node); + case 186: + return checkSwitchStatement(node); case 187: - checkGrammarForStatementInAmbientContext(node); + return checkLabeledStatement(node); + case 188: + return checkThrowStatement(node); + case 189: + return checkTryStatement(node); + case 191: + return checkVariableDeclaration(node); + case 148: + return checkBindingElement(node); + case 194: + return checkClassDeclaration(node); + case 195: + return checkInterfaceDeclaration(node); + case 196: + return checkTypeAliasDeclaration(node); + case 197: + return checkEnumDeclaration(node); + case 198: + return checkModuleDeclaration(node); + case 200: + return checkImportDeclaration(node); + case 201: + return checkExportAssignment(node); + case 174: + checkGrammarStatementInAmbientContext(node); + return; + case 190: + checkGrammarStatementInAmbientContext(node); return; } } function checkFunctionExpressionBodies(node) { switch (node.kind) { - case 156: - case 157: + case 158: + case 159: ts.forEach(node.parameters, checkFunctionExpressionBodies); checkFunctionExpressionOrObjectLiteralMethodBody(node); break; - case 128: - case 127: + case 130: + case 129: ts.forEach(node.parameters, checkFunctionExpressionBodies); if (ts.isObjectLiteralMethod(node)) { checkFunctionExpressionOrObjectLiteralMethodBody(node); } break; - case 129: - case 130: case 131: - case 190: + case 132: + case 133: + case 193: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 182: + case 185: checkFunctionExpressionBodies(node.expression); break; - case 124: case 126: - case 125: - case 144: - case 145: + case 128: + case 127: case 146: case 147: case 148: - case 204: case 149: case 150: + case 207: case 151: case 152: case 153: - case 165: - case 169: case 154: case 155: - case 159: - case 160: - case 158: + case 167: + case 171: + case 156: + case 157: case 161: case 162: + case 160: case 163: case 164: - case 167: - case 170: - case 196: - case 171: + case 165: + case 166: + case 169: + case 172: + case 199: case 173: - case 174: case 175: case 176: case 177: @@ -15009,19 +15378,22 @@ var ts; case 179: case 180: case 181: + case 182: case 183: - case 200: - case 201: case 184: - case 185: case 186: case 203: + case 204: + case 187: case 188: case 189: - case 191: - case 194: case 206: - case 207: + case 191: + case 192: + case 194: + case 197: + case 209: + case 210: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -15043,7 +15415,7 @@ var ts; var symbol = getExportAssignmentSymbol(node.symbol); if (symbol && symbol.flags & 8388608) { getSymbolLinks(symbol).referenced = true; - markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 197)); + markLinkedImportsAsReferenced(ts.getDeclarationOfKind(symbol, 200)); } } if (potentialThisCollisions.length) { @@ -15077,7 +15449,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 182 && node.parent.statement === node) { + if (node.parent.kind === 185 && node.parent.statement === node) { return true; } node = node.parent; @@ -15113,27 +15485,27 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 207: + case 210: if (!ts.isExternalModule(location)) break; - case 195: + case 198: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 194: + case 197: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 191: - case 192: + case 194: + case 195: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; - case 156: + case 158: if (location.name) { copySymbol(location.symbol, meaning); } break; - case 203: + case 206: if (location.name.text) { copySymbol(location.symbol, meaning); } @@ -15146,26 +15518,28 @@ var ts; return ts.mapToArray(symbols); } function isTypeDeclarationName(name) { - return name.kind == 64 && isTypeDeclaration(name.parent) && name.parent.name === name; + return name.kind == 64 && + isTypeDeclaration(name.parent) && + name.parent.name === name; } function isTypeDeclaration(node) { switch (node.kind) { - case 123: - case 191: - case 192: - case 193: + case 125: case 194: + case 195: + case 196: + case 197: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 121) + while (node.parent && node.parent.kind === 123) node = node.parent; - return node.parent && node.parent.kind === 135; + return node.parent && node.parent.kind === 137; } function isTypeNode(node) { - if (135 <= node.kind && node.kind <= 143) { + if (137 <= node.kind && node.kind <= 145) { return true; } switch (node.kind) { @@ -15173,64 +15547,65 @@ var ts; case 117: case 119: case 111: + case 120: return true; case 98: - return node.parent.kind !== 160; + return node.parent.kind !== 162; case 8: - return node.parent.kind === 124; + return node.parent.kind === 126; case 64: - if (node.parent.kind === 121 && node.parent.right === node) { + if (node.parent.kind === 123 && node.parent.right === node) { node = node.parent; } - case 121: - ts.Debug.assert(node.kind === 64 || node.kind === 121, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); + case 123: + ts.Debug.assert(node.kind === 64 || node.kind === 123, "'node' was expected to be a qualified name or identifier in 'isTypeNode'."); var parent = node.parent; - if (parent.kind === 138) { + if (parent.kind === 140) { return false; } - if (135 <= parent.kind && parent.kind <= 143) { + if (137 <= parent.kind && parent.kind <= 145) { return true; } switch (parent.kind) { - case 123: - return node === parent.constraint; - case 126: case 125: - case 124: - case 188: - return node === parent.type; - case 190: - case 156: - case 157: - case 129: + return node === parent.constraint; case 128: case 127: - case 130: - case 131: + case 126: + case 191: return node === parent.type; + case 193: + case 158: + case 159: + case 131: + case 130: + case 129: case 132: case 133: + return node === parent.type; case 134: + case 135: + case 136: return node === parent.type; - case 154: + case 156: return node === parent.type; - case 151: - case 152: - return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; case 153: + case 154: + return parent.typeArguments && ts.indexOf(parent.typeArguments, node) >= 0; + case 155: return false; } } return false; } function getLeftSideOfImportOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 121) { + while (nodeOnRightSide.parent.kind === 123) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 197) { + if (nodeOnRightSide.parent.kind === 200) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 198) { + if (nodeOnRightSide.parent.kind === 201) { return nodeOnRightSide.parent.exportName === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -15239,16 +15614,17 @@ var ts; return getLeftSideOfImportOrExportAssignment(node) !== undefined; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 121 && node.parent.right === node) || (node.parent.kind === 149 && node.parent.name === node); + return (node.parent.kind === 123 && node.parent.right === node) || + (node.parent.kind === 151 && node.parent.name === node); } function getSymbolOfEntityNameOrPropertyAccessExpression(entityName) { if (ts.isDeclarationOrFunctionExpressionOrCatchVariableName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 198) { + if (entityName.parent.kind === 201) { return resolveEntityName(entityName.parent.parent, entityName, 107455 | 793056 | 1536 | 8388608); } - if (entityName.kind !== 149) { + if (entityName.kind !== 151) { if (isInRightSideOfImportOrExportAssignment(entityName)) { return getSymbolOfPartOfRightHandSideOfImport(entityName); } @@ -15264,14 +15640,14 @@ var ts; var meaning = 107455 | 8388608; return resolveEntityName(entityName, entityName, meaning); } - else if (entityName.kind === 149) { + else if (entityName.kind === 151) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 121) { + else if (entityName.kind === 123) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -15280,7 +15656,7 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 135 ? 793056 : 1536; + var meaning = entityName.parent.kind === 137 ? 793056 : 1536; meaning |= 8388608; return resolveEntityName(entityName, entityName, meaning); } @@ -15294,12 +15670,12 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 64 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 198 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImport(node); + return node.parent.kind === 201 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImport(node); } switch (node.kind) { case 64: - case 149: - case 121: + case 151: + case 123: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 92: case 90: @@ -15307,18 +15683,19 @@ var ts; return type.symbol; case 112: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 129) { + if (constructorDeclaration && constructorDeclaration.kind === 131) { return constructorDeclaration.parent.symbol; } return undefined; case 8: - if (ts.isExternalModuleImportDeclaration(node.parent.parent) && ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node) { + if (ts.isExternalModuleImportDeclaration(node.parent.parent) && + ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node) { var importSymbol = getSymbolOfNode(node.parent.parent); var moduleType = getTypeOfSymbol(importSymbol); return moduleType ? moduleType.symbol : undefined; } case 7: - if (node.parent.kind == 150 && node.parent.argumentExpression === node) { + if (node.parent.kind == 152 && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -15332,7 +15709,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 205) { + if (location && location.kind === 208) { return resolveEntityName(location, location.name, 107455); } return undefined; @@ -15406,7 +15783,7 @@ var ts; return [symbol]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 207; + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 210; } function isNodeDescendentOf(node, ancestor) { while (node) { @@ -15424,7 +15801,7 @@ var ts; return false; } if (symbolWithRelevantName.flags & 8388608) { - var importDeclarationWithRelevantName = ts.getDeclarationOfKind(symbolWithRelevantName, 197); + var importDeclarationWithRelevantName = ts.getDeclarationOfKind(symbolWithRelevantName, 200); if (isReferencedImportDeclaration(importDeclarationWithRelevantName)) { return false; } @@ -15448,7 +15825,7 @@ var ts; function getLocalNameForSymbol(symbol, location) { var node = location; while (node) { - if ((node.kind === 195 || node.kind === 194) && getSymbolOfNode(node) === symbol) { + if ((node.kind === 198 || node.kind === 197) && getSymbolOfNode(node) === symbol) { return getLocalNameOfContainer(node); } node = node.parent; @@ -15472,7 +15849,7 @@ var ts; return symbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol) ? symbolToString(symbol) : undefined; } function isTopLevelValueImportWithEntityName(node) { - if (node.parent.kind !== 207 || !ts.isInternalModuleImportDeclaration(node)) { + if (node.parent.kind !== 210 || !ts.isInternalModuleImportDeclaration(node)) { return false; } return isImportResolvedToValue(getSymbolOfNode(node)); @@ -15498,7 +15875,8 @@ var ts; if (ts.nodeIsPresent(node.body)) { var symbol = getSymbolOfNode(node); var signaturesOfSymbol = getSignaturesOfSymbol(symbol); - return signaturesOfSymbol.length > 1 || (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); + return signaturesOfSymbol.length > 1 || + (signaturesOfSymbol.length === 1 && signaturesOfSymbol[0].declaration !== node); } return false; } @@ -15510,14 +15888,14 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 206) { + if (node.kind === 209) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; if (symbol && (symbol.flags & 8)) { var declaration = symbol.valueDeclaration; var constantValue; - if (declaration.kind === 206) { + if (declaration.kind === 209) { return getEnumMemberValue(declaration); } } @@ -15566,7 +15944,7 @@ var ts; getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments"); getSymbolLinks(unknownSymbol).type = unknownType; globals[undefinedSymbol.name] = undefinedSymbol; - globalArraySymbol = getGlobalSymbol("Array"); + globalArraySymbol = getGlobalTypeSymbol("Array"); globalArrayType = getTypeOfGlobalSymbol(globalArraySymbol, 1); globalObjectType = getGlobalType("Object"); globalFunctionType = getGlobalType("Function"); @@ -15574,29 +15952,38 @@ var ts; globalNumberType = getGlobalType("Number"); globalBooleanType = getGlobalType("Boolean"); globalRegExpType = getGlobalType("RegExp"); - globalTemplateStringsArrayType = languageVersion >= 2 ? getGlobalType("TemplateStringsArray") : unknownType; + if (languageVersion >= 2) { + globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); + globalESSymbolType = getGlobalType("Symbol"); + globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); + } + else { + globalTemplateStringsArrayType = unknownType; + globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + globalESSymbolConstructorSymbol = undefined; + } anyArrayType = createArrayType(anyType); } function checkGrammarModifiers(node) { switch (node.kind) { - case 130: + case 132: + case 133: case 131: - case 129: - case 126: - case 125: case 128: case 127: - case 134: - case 191: - case 192: - case 195: + case 130: + case 129: + case 136: case 194: + case 195: case 198: - case 171: - case 190: - case 193: case 197: - case 124: + case 201: + case 173: + case 193: + case 196: + case 200: + case 126: break; default: return false; @@ -15630,7 +16017,7 @@ var ts; else if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (node.parent.kind === 196 || node.parent.kind === 207) { + else if (node.parent.kind === 199 || node.parent.kind === 210) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -15639,10 +16026,10 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 196 || node.parent.kind === 207) { + else if (node.parent.kind === 199 || node.parent.kind === 210) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } - else if (node.kind === 124) { + else if (node.kind === 126) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } flags |= 128; @@ -15655,10 +16042,10 @@ var ts; else if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (node.parent.kind === 191) { + else if (node.parent.kind === 194) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 124) { + else if (node.kind === 126) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; @@ -15667,13 +16054,13 @@ var ts; if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (node.parent.kind === 191) { + else if (node.parent.kind === 194) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 124) { + else if (node.kind === 126) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 196) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 199) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -15681,7 +16068,7 @@ var ts; break; } } - if (node.kind === 129) { + if (node.kind === 131) { if (flags & 128) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -15692,13 +16079,13 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if (node.kind === 197 && flags & 2) { + else if (node.kind === 200 && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 192 && flags & 2) { + else if (node.kind === 195 && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } - else if (node.kind === 124 && (flags & 112) && ts.isBindingPattern(node.name)) { + else if (node.kind === 126 && (flags & 112) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } } @@ -15766,25 +16153,25 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_exactly_one_parameter); } } - else if (parameter.dotDotDotToken) { + if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - else if (parameter.flags & 243) { + if (parameter.flags & 243) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } - else if (parameter.questionToken) { + if (parameter.questionToken) { return grammarErrorOnNode(parameter.questionToken, ts.Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark); } - else if (parameter.initializer) { + if (parameter.initializer) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_initializer); } - else if (!parameter.type) { + if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - else if (parameter.type.kind !== 119 && parameter.type.kind !== 117) { + if (parameter.type.kind !== 119 && parameter.type.kind !== 117) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } - else if (!node.type) { + if (!node.type) { return grammarErrorOnNode(node, ts.Diagnostics.An_index_signature_must_have_a_type_annotation); } } @@ -15805,21 +16192,23 @@ var ts; } } function checkGrammarTypeArguments(node, typeArguments) { - return checkGrammarForDisallowedTrailingComma(typeArguments) || checkGrammarForAtLeastOneTypeArgument(node, typeArguments); + return checkGrammarForDisallowedTrailingComma(typeArguments) || + checkGrammarForAtLeastOneTypeArgument(node, typeArguments); } function checkGrammarForOmittedArgument(node, arguments) { if (arguments) { var sourceFile = ts.getSourceFileOfNode(node); for (var i = 0, n = arguments.length; i < n; i++) { var arg = arguments[i]; - if (arg.kind === 168) { + if (arg.kind === 170) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } } } function checkGrammarArguments(node, arguments) { - return checkGrammarForDisallowedTrailingComma(arguments) || checkGrammarForOmittedArgument(node, arguments); + return checkGrammarForDisallowedTrailingComma(arguments) || + checkGrammarForOmittedArgument(node, arguments); } function checkGrammarHeritageClause(node) { var types = node.types; @@ -15884,14 +16273,11 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 122) { + if (node.kind !== 124) { return false; } var computedPropertyName = node; - if (languageVersion < 2) { - return grammarErrorOnNode(node, ts.Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); - } - else if (computedPropertyName.expression.kind === 163 && computedPropertyName.expression.operator === 23) { + if (computedPropertyName.expression.kind === 165 && computedPropertyName.expression.operatorToken.kind === 23) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } @@ -15918,25 +16304,26 @@ var ts; for (var i = 0, n = node.properties.length; i < n; i++) { var prop = node.properties[i]; var name = prop.name; - if (prop.kind === 168 || name.kind === 122) { + if (prop.kind === 170 || + name.kind === 124) { checkGrammarComputedPropertyName(name); continue; } var currentKind; - if (prop.kind === 204 || prop.kind === 205) { + if (prop.kind === 207 || prop.kind === 208) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 7) { checkGrammarNumbericLiteral(name); } currentKind = Property; } - else if (prop.kind === 128) { + else if (prop.kind === 130) { currentKind = Property; } - else if (prop.kind === 130) { + else if (prop.kind === 132) { currentKind = GetAccessor; } - else if (prop.kind === 131) { + else if (prop.kind === 133) { currentKind = SetAccesor; } else { @@ -15966,6 +16353,37 @@ var ts; } } } + function checkGrammarForInOrForOfStatement(forInOrOfStatement) { + if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { + return true; + } + if (forInOrOfStatement.initializer.kind === 192) { + var variableList = forInOrOfStatement.initializer; + if (!checkGrammarVariableDeclarationList(variableList)) { + if (variableList.declarations.length > 1) { + var diagnostic = forInOrOfStatement.kind === 180 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); + } + var firstDeclaration = variableList.declarations[0]; + if (firstDeclaration.initializer) { + var diagnostic = forInOrOfStatement.kind === 180 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + return grammarErrorOnNode(firstDeclaration.name, diagnostic); + } + if (firstDeclaration.type) { + var diagnostic = forInOrOfStatement.kind === 180 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + return grammarErrorOnNode(firstDeclaration, diagnostic); + } + } + } + return false; + } + function checkGrammarForOfStatement(forOfStatement) { + return grammarErrorOnFirstToken(forOfStatement, ts.Diagnostics.for_of_statements_are_not_currently_supported); + if (languageVersion < 2) { + return grammarErrorOnFirstToken(forOfStatement, ts.Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); + } + return checkGrammarForInOrForOfStatement(forOfStatement); + } function checkGrammarAccessor(accessor) { var kind = accessor.kind; if (languageVersion < 1) { @@ -15980,10 +16398,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 130 && accessor.parameters.length) { + else if (kind === 132 && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 131) { + else if (kind === 133) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -16007,16 +16425,18 @@ var ts; } } } - function checkGrammarForDisallowedComputedProperty(node, message) { - if (node.kind === 122) { + function checkGrammarForNonSymbolComputedProperty(node, message) { + if (node.kind === 124 && !ts.isWellKnownSymbolSyntactically(node.expression)) { return grammarErrorOnNode(node, message); } } function checkGrammarMethod(node) { - if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || checkGrammarFunctionLikeDeclaration(node) || checkGrammarForGenerator(node)) { + if (checkGrammarDisallowedModifiersInBlockOrObjectLiteralExpression(node) || + checkGrammarFunctionLikeDeclaration(node) || + checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 148) { + if (node.parent.kind === 150) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -16024,32 +16444,33 @@ var ts; return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } - if (node.parent.kind === 191) { + if (node.parent.kind === 194) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } if (ts.isInAmbientContext(node)) { - return checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_an_ambient_context); + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol); } else if (!node.body) { - return checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_method_overloads); + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } - else if (node.parent.kind === 192) { - return checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_interfaces); + else if (node.parent.kind === 195) { + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } - else if (node.parent.kind === 139) { - return checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_type_literals); + else if (node.parent.kind === 141) { + return checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { + case 179: + case 180: + case 181: case 177: case 178: - case 175: - case 176: return true; - case 184: + case 187: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -16061,17 +16482,17 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 184: + case 187: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 179 && !isIterationStatement(current.statement, true); + var isMisplacedContinueLabel = node.kind === 182 && !isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); } return false; } break; - case 183: - if (node.kind === 180 && !node.label) { + case 186: + if (node.kind === 183 && !node.label) { return false; } break; @@ -16084,11 +16505,11 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 180 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + var message = node.kind === 183 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 180 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + var message = node.kind === 183 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } } @@ -16124,7 +16545,8 @@ var ts; } } var checkLetConstNames = languageVersion >= 2 && (ts.isLet(node) || ts.isConst(node)); - return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || checkGrammarEvalOrArgumentsInStrictMode(node, node.name); + return (checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name)) || + checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarNameInLetOrConstDeclarations(name) { if (name.kind === 64) { @@ -16158,14 +16580,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 174: - case 175: case 176: - case 182: case 177: case 178: + case 185: + case 179: + case 180: + case 181: return false; - case 184: + case 187: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -16181,7 +16604,7 @@ var ts; } } function isIntegerLiteral(expression) { - if (expression.kind === 161) { + if (expression.kind === 163) { var unaryExpression = expression; if (unaryExpression.operator === 33 || unaryExpression.operator === 34) { expression = unaryExpression.operand; @@ -16200,7 +16623,7 @@ var ts; var inAmbientContext = ts.isInAmbientContext(enumDecl); for (var i = 0, n = enumDecl.members.length; i < n; i++) { var node = enumDecl.members[i]; - if (node.name.kind === 122) { + if (node.name.kind === 124) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } else if (inAmbientContext) { @@ -16268,18 +16691,19 @@ var ts; } } function checkGrammarProperty(node) { - if (node.parent.kind === 191) { - if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_class_property_declarations)) { + if (node.parent.kind === 194) { + if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional) || + checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 192) { - if (checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_interfaces)) { + else if (node.parent.kind === 195) { + if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } } - else if (node.parent.kind === 139) { - if (checkGrammarForDisallowedComputedProperty(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_type_literals)) { + else if (node.parent.kind === 141) { + if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } } @@ -16288,7 +16712,10 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 192 || node.kind === 197 || node.kind === 198 || (node.flags & 2)) { + if (node.kind === 195 || + node.kind === 200 || + node.kind === 201 || + (node.flags & 2)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -16296,7 +16723,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var i = 0, n = file.statements.length; i < n; i++) { var decl = file.statements[i]; - if (ts.isDeclaration(decl) || decl.kind === 171) { + if (ts.isDeclaration(decl) || decl.kind === 173) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -16306,7 +16733,7 @@ var ts; function checkGrammarSourceFile(node) { return ts.isInAmbientContext(node) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node); } - function checkGrammarForStatementInAmbientContext(node) { + function checkGrammarStatementInAmbientContext(node) { if (ts.isInAmbientContext(node)) { if (isAccessor(node.parent.kind)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = true; @@ -16315,7 +16742,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isAnyFunction(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 170 || node.parent.kind === 196 || node.parent.kind === 207) { + if (node.parent.kind === 172 || node.parent.kind === 199 || node.parent.kind === 210) { var links = getNodeLinks(node.parent); if (!links.hasReportedStatementInAmbientContext) { return links.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -16439,7 +16866,8 @@ var ts; return ts.getLineAndCharacterOfPosition(currentSourceFile, pos).line; } function emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments) { - if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && + getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { writer.writeLine(); } } @@ -16465,13 +16893,13 @@ var ts; function writeCommentRange(currentSourceFile, writer, comment, newLine) { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { var firstCommentLineAndCharacter = ts.getLineAndCharacterOfPosition(currentSourceFile, comment.pos); - var lastLine = ts.getLineStarts(currentSourceFile).length; + var lineCount = ts.getLineStarts(currentSourceFile).length; var firstCommentLineIndent; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = currentLine === lastLine ? (comment.end + 1) : ts.getPositionFromLineAndCharacter(currentSourceFile, currentLine + 1, 1); + var nextLineStart = (currentLine + 1) === lineCount ? currentSourceFile.text.length + 1 : ts.getStartPositionOfLine(currentLine + 1, currentSourceFile); if (pos !== comment.pos) { if (firstCommentLineIndent === undefined) { - firstCommentLineIndent = calculateIndent(ts.getPositionFromLineAndCharacter(currentSourceFile, firstCommentLineAndCharacter.line, 1), comment.pos); + firstCommentLineIndent = calculateIndent(ts.getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); } var currentWriterIndentSpacing = writer.getIndent() * getIndentSize(); var spacesToEmit = currentWriterIndentSpacing - firstCommentLineIndent + calculateIndent(pos, nextLineStart); @@ -16523,21 +16951,21 @@ var ts; } function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 129 && ts.nodeIsPresent(member.body)) { + if (member.kind === 131 && ts.nodeIsPresent(member.body)) { return member; } }); } - function getAllAccessorDeclarations(node, accessor) { + function getAllAccessorDeclarations(declarations, accessor) { var firstAccessor; var getAccessor; var setAccessor; - if (accessor.name.kind === 122) { + if (ts.hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 130) { + if (accessor.kind === 132) { getAccessor = accessor; } - else if (accessor.kind === 131) { + else if (accessor.kind === 133) { setAccessor = accessor; } else { @@ -16545,16 +16973,20 @@ var ts; } } else { - ts.forEach(node.members, function (member) { - if ((member.kind === 130 || member.kind === 131) && member.name.text === accessor.name.text && (member.flags & 128) === (accessor.flags & 128)) { - if (!firstAccessor) { - firstAccessor = member; - } - if (member.kind === 130 && !getAccessor) { - getAccessor = member; - } - if (member.kind === 131 && !setAccessor) { - setAccessor = member; + ts.forEach(declarations, function (member) { + if ((member.kind === 132 || member.kind === 133) && (member.flags & 128) === (accessor.flags & 128)) { + var memberName = ts.getPropertyNameForPropertyNameNode(member.name); + var accessorName = ts.getPropertyNameForPropertyNameNode(accessor.name); + if (memberName === accessorName) { + if (!firstAccessor) { + firstAccessor = member; + } + if (member.kind === 132 && !getAccessor) { + getAccessor = member; + } + if (member.kind === 133 && !setAccessor) { + setAccessor = member; + } } } }); @@ -16607,7 +17039,9 @@ var ts; var addedGlobalFileReference = false; ts.forEach(root.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, root, fileReference); - if (referencedFile && ((referencedFile.flags & 1024) || shouldEmitToOwnFile(referencedFile, compilerOptions) || !addedGlobalFileReference)) { + if (referencedFile && ((referencedFile.flags & 1024) || + shouldEmitToOwnFile(referencedFile, compilerOptions) || + !addedGlobalFileReference)) { writeReferencePath(referencedFile); if (!isExternalModuleOrDeclarationFile(referencedFile)) { addedGlobalFileReference = true; @@ -16624,7 +17058,8 @@ var ts; if (!compilerOptions.noResolve) { ts.forEach(sourceFile.referencedFiles, function (fileReference) { var referencedFile = ts.tryResolveScriptReference(host, sourceFile, fileReference); - if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && !ts.contains(emittedReferencedFiles, referencedFile))) { + if (referencedFile && (isExternalModuleOrDeclarationFile(referencedFile) && + !ts.contains(emittedReferencedFiles, referencedFile))) { writeReferencePath(referencedFile); emittedReferencedFiles.push(referencedFile); } @@ -16767,35 +17202,36 @@ var ts; case 119: case 117: case 111: + case 120: case 98: case 8: return writeTextOfNode(currentSourceFile, type); - case 135: - return emitTypeReference(type); - case 138: - return emitTypeQuery(type); - case 140: - return emitArrayType(type); - case 141: - return emitTupleType(type); - case 142: - return emitUnionType(type); - case 143: - return emitParenType(type); - case 136: case 137: - return emitSignatureDeclarationWithJsDocComments(type); + return emitTypeReference(type); + case 140: + return emitTypeQuery(type); + case 142: + return emitArrayType(type); + case 143: + return emitTupleType(type); + case 144: + return emitUnionType(type); + case 145: + return emitParenType(type); + case 138: case 139: + return emitSignatureDeclarationWithJsDocComments(type); + case 141: return emitTypeLiteral(type); case 64: return emitEntityName(type); - case 121: + case 123: return emitEntityName(type); default: ts.Debug.fail("Unknown type annotation: " + type.kind); } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 197 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 200 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -16866,7 +17302,7 @@ var ts; if (node.flags & 1) { write("export "); } - if (node.kind !== 192) { + if (node.kind !== 195) { write("declare "); } } @@ -16926,7 +17362,7 @@ var ts; emitModuleElementDeclarationFlags(node); write("module "); writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 196) { + while (node.body.kind !== 199) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -16992,7 +17428,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 128 && (node.parent.flags & 32); + return node.parent.kind === 130 && (node.parent.flags & 32); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -17002,8 +17438,15 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 136 || node.parent.kind === 137 || (node.parent.parent && node.parent.parent.kind === 139)) { - ts.Debug.assert(node.parent.kind === 128 || node.parent.kind === 127 || node.parent.kind === 136 || node.parent.kind === 137 || node.parent.kind === 132 || node.parent.kind === 133); + if (node.parent.kind === 138 || + node.parent.kind === 139 || + (node.parent.parent && node.parent.parent.kind === 141)) { + ts.Debug.assert(node.parent.kind === 130 || + node.parent.kind === 129 || + node.parent.kind === 138 || + node.parent.kind === 139 || + node.parent.kind === 134 || + node.parent.kind === 135); emitType(node.constraint); } else { @@ -17013,31 +17456,31 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 191: + case 194: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 192: + case 195: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 133: + case 135: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 132: + case 134: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 128: - case 127: + case 130: + case 129: if (node.parent.flags & 128) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 191) { + else if (node.parent.parent.kind === 194) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 190: + case 193: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -17065,7 +17508,7 @@ var ts; emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 191) { + if (node.parent.parent.kind === 194) { diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : ts.Diagnostics.Extends_clause_of_exported_class_0_has_or_is_using_private_name_1; } else { @@ -17144,12 +17587,12 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 188 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 191 || resolver.isDeclarationVisible(node)) { writeTextOfNode(currentSourceFile, node.name); - if ((node.kind === 126 || node.kind === 125) && ts.hasQuestionToken(node)) { + if ((node.kind === 128 || node.kind === 127) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 126 || node.kind === 125) && node.parent.kind === 139) { + if ((node.kind === 128 || node.kind === 127) && node.parent.kind === 141) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 32)) { @@ -17158,14 +17601,14 @@ var ts; } function getVariableDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.kind === 188) { + if (node.kind === 191) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 126 || node.kind === 125) { + else if (node.kind === 128 || node.kind === 127) { if (node.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 191) { + else if (node.parent.kind === 194) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { @@ -17208,7 +17651,7 @@ var ts; if (ts.hasDynamicName(node)) { return; } - var accessors = getAllAccessorDeclarations(node.parent, node); + var accessors = getAllAccessorDeclarations(node.parent.members, node); if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); @@ -17218,7 +17661,7 @@ var ts; var accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 130 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 132 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -17231,12 +17674,12 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 130 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; + return accessor.kind === 132 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : undefined; } } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 131) { + if (accessorWithTypeAnnotation.kind === 133) { if (accessorWithTypeAnnotation.parent.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1; } @@ -17268,19 +17711,20 @@ var ts; if (ts.hasDynamicName(node)) { return; } - if ((node.kind !== 190 || resolver.isDeclarationVisible(node)) && !resolver.isImplementationOfOverload(node)) { + if ((node.kind !== 193 || resolver.isDeclarationVisible(node)) && + !resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 190) { + if (node.kind === 193) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 128) { + else if (node.kind === 130) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 190) { + if (node.kind === 193) { write("function "); writeTextOfNode(currentSourceFile, node.name); } - else if (node.kind === 129) { + else if (node.kind === 131) { write("constructor"); } else { @@ -17297,11 +17741,11 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - if (node.kind === 133 || node.kind === 137) { + if (node.kind === 135 || node.kind === 139) { write("new "); } emitTypeParameters(node.typeParameters); - if (node.kind === 134) { + if (node.kind === 136) { write("["); } else { @@ -17310,20 +17754,20 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 134) { + if (node.kind === 136) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 136 || node.kind === 137; - if (isFunctionTypeOrConstructorType || node.parent.kind === 139) { + var isFunctionTypeOrConstructorType = node.kind === 138 || node.kind === 139; + if (isFunctionTypeOrConstructorType || node.parent.kind === 141) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 129 && !(node.flags & 32)) { + else if (node.kind !== 131 && !(node.flags & 32)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -17334,28 +17778,28 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 133: + case 135: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 132: + case 134: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 134: + case 136: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 128: - case 127: + case 130: + case 129: if (node.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 191) { + else if (node.parent.kind === 194) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 190: + case 193: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: @@ -17383,7 +17827,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 136 || node.parent.kind === 137 || node.parent.parent.kind === 139) { + if (node.parent.kind === 138 || + node.parent.kind === 139 || + node.parent.parent.kind === 141) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { @@ -17392,28 +17838,28 @@ var ts; function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 129: + case 131: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; break; - case 133: + case 135: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 132: + case 134: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 128: - case 127: + case 130: + case 129: if (node.parent.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 191) { + else if (node.parent.parent.kind === 194) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 190: + case 193: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -17428,40 +17874,40 @@ var ts; } function emitNode(node) { switch (node.kind) { + case 131: + case 193: + case 130: case 129: - case 190: + return emitFunctionDeclaration(node); + case 135: + case 134: + case 136: + return emitSignatureDeclarationWithJsDocComments(node); + case 132: + case 133: + return emitAccessorDeclaration(node); + case 173: + return emitVariableStatement(node); case 128: case 127: - return emitFunctionDeclaration(node); - case 133: - case 132: - case 134: - return emitSignatureDeclarationWithJsDocComments(node); - case 130: - case 131: - return emitAccessorDeclaration(node); - case 171: - return emitVariableStatement(node); - case 126: - case 125: return emitPropertyDeclaration(node); - case 192: - return emitInterfaceDeclaration(node); - case 191: - return emitClassDeclaration(node); - case 193: - return emitTypeAliasDeclaration(node); - case 206: - return emitEnumMemberDeclaration(node); - case 194: - return emitEnumDeclaration(node); case 195: - return emitModuleDeclaration(node); + return emitInterfaceDeclaration(node); + case 194: + return emitClassDeclaration(node); + case 196: + return emitTypeAliasDeclaration(node); + case 209: + return emitEnumMemberDeclaration(node); case 197: - return emitImportDeclaration(node); + return emitEnumDeclaration(node); case 198: + return emitModuleDeclaration(node); + case 200: + return emitImportDeclaration(node); + case 201: return emitExportAssignment(node); - case 207: + case 210: return emitSourceFile(node); } } @@ -17623,9 +18069,16 @@ var ts; } function recordSourceMapSpan(pos) { var sourceLinePos = ts.getLineAndCharacterOfPosition(currentSourceFile, pos); + sourceLinePos.line++; + sourceLinePos.character++; var emittedLine = writer.getLine(); var emittedColumn = writer.getColumn(); - if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan.emittedLine != emittedLine || lastRecordedSourceMapSpan.emittedColumn != emittedColumn || (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + if (!lastRecordedSourceMapSpan || + lastRecordedSourceMapSpan.emittedLine != emittedLine || + lastRecordedSourceMapSpan.emittedColumn != emittedColumn || + (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { encodeLastRecordedSourceMapSpan(); lastRecordedSourceMapSpan = { emittedLine: emittedLine, @@ -17671,7 +18124,7 @@ var ts; var parentIndex = getSourceMapNameIndex(); if (parentIndex !== -1) { var name = node.name; - if (!name || name.kind !== 122) { + if (!name || name.kind !== 124) { scopeName = "." + scopeName; } scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; @@ -17688,10 +18141,18 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 190 || node.kind === 156 || node.kind === 128 || node.kind === 127 || node.kind === 130 || node.kind === 131 || node.kind === 195 || node.kind === 191 || node.kind === 194) { + else if (node.kind === 193 || + node.kind === 158 || + node.kind === 130 || + node.kind === 129 || + node.kind === 132 || + node.kind === 133 || + node.kind === 198 || + node.kind === 194 || + node.kind === 197) { if (node.name) { var name = node.name; - scopeName = name.kind === 122 ? ts.getTextOfNode(name) : node.name.text; + scopeName = name.kind === 124 ? ts.getTextOfNode(name) : node.name.text; } recordScopeNameStart(scopeName); } @@ -17771,7 +18232,7 @@ var ts; } function emitNodeWithMap(node) { if (node) { - if (node.kind != 207) { + if (node.kind != 210) { recordEmitNodeStartSpan(node); emitNode(node); recordEmitNodeEndSpan(node); @@ -17813,6 +18274,11 @@ var ts; } tempVariables.push(name); } + function createAndRecordTempVariable(location) { + var temp = createTempVariable(location, false); + recordTempDeclaration(temp); + return temp; + } function emitTempDeclarations(newLine) { if (tempVariables) { if (newLine) { @@ -17856,10 +18322,44 @@ var ts; write(","); } } - function emitList(nodes, start, count, multiLine, trailingComma) { - if (multiLine) { - increaseIndent(); + function emitLinePreservingList(parent, nodes, allowTrailingComma, spacesBetweenBraces) { + ts.Debug.assert(nodes.length > 0); + increaseIndent(); + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (spacesBetweenBraces) { + write(" "); + } } + else { + writeLine(); + } + for (var i = 0, n = nodes.length; i < n; i++) { + if (i) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + write(", "); + } + else { + write(","); + writeLine(); + } + } + emit(nodes[i]); + } + var closeTokenIsOnSameLineAsLastElement = nodeEndPositionsAreOnSameLine(parent, ts.lastOrUndefined(nodes)); + if (nodes.hasTrailingComma && allowTrailingComma) { + write(","); + } + decreaseIndent(); + if (closeTokenIsOnSameLineAsLastElement) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + } + function emitList(nodes, start, count, multiLine, trailingComma) { for (var i = 0; i < count; i++) { if (multiLine) { if (i) { @@ -17878,7 +18378,6 @@ var ts; write(","); } if (multiLine) { - decreaseIndent(); writeLine(); } } @@ -17887,11 +18386,6 @@ var ts; emitList(nodes, 0, nodes.length, false, false); } } - function emitMultiLineList(nodes) { - if (nodes) { - emitList(nodes, 0, nodes.length, true, false); - } - } function emitLines(nodes) { emitLinesStartingAt(nodes, 0); } @@ -17905,7 +18399,8 @@ var ts; if (text.length <= 0) { return false; } - if (text.charCodeAt(1) === 66 || text.charCodeAt(1) === 98 || text.charCodeAt(1) === 79 || text.charCodeAt(1) === 111) { + if (text.charCodeAt(1) === 66 || text.charCodeAt(1) === 98 || + text.charCodeAt(1) === 79 || text.charCodeAt(1) === 111) { return true; } return false; @@ -17941,7 +18436,7 @@ var ts; } for (var i = 0; i < node.templateSpans.length; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 155 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; + var needsParens = templateSpan.expression.kind !== 157 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); } @@ -17960,11 +18455,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 151: - case 152: - return parent.expression === template; case 153: + case 154: + return parent.expression === template; case 155: + case 157: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1; @@ -17972,8 +18467,8 @@ var ts; } function comparePrecedenceToBinaryPlus(expression) { switch (expression.kind) { - case 163: - switch (expression.operator) { + case 165: + switch (expression.operatorToken.kind) { case 35: case 36: case 37: @@ -17984,7 +18479,7 @@ var ts; default: return -1; } - case 164: + case 166: return -1; default: return 1; @@ -17996,10 +18491,11 @@ var ts; emit(span.literal); } function emitExpressionForPropertyName(node) { + ts.Debug.assert(node.kind !== 148); if (node.kind === 8) { emitLiteral(node); } - else if (node.kind === 122) { + else if (node.kind === 124) { emit(node.expression); } else { @@ -18016,33 +18512,33 @@ var ts; function isNotExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 124: - case 188: - case 146: case 126: - case 125: - case 204: - case 205: - case 206: + case 191: + case 148: case 128: case 127: - case 190: + case 207: + case 208: + case 209: case 130: - case 131: - case 156: - case 191: - case 192: + case 129: + case 193: + case 132: + case 133: + case 158: case 194: case 195: case 197: - return parent.name === node; - case 180: - case 179: case 198: + case 200: + return parent.name === node; + case 183: + case 182: + case 201: return false; - case 184: + case 187: return node.parent.label === node; - case 203: + case 206: return node.parent.name === node; } } @@ -18120,11 +18616,11 @@ var ts; function needsParenthesisForPropertyAccess(node) { switch (node.kind) { case 64: - case 147: case 149: - case 150: case 151: - case 155: + case 152: + case 153: + case 157: return false; } return true; @@ -18141,18 +18637,24 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 167) { + if (e.kind === 169) { e = e.expression; emitParenthesized(e, group === 0 && needsParenthesisForPropertyAccess(e)); pos++; } else { var i = pos; - while (i < length && elements[i].kind !== 167) { + while (i < length && elements[i].kind !== 169) { i++; } write("["); + if (multiLine) { + increaseIndent(); + } emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + if (multiLine) { + decreaseIndent(); + } write("]"); pos = i; } @@ -18162,32 +18664,187 @@ var ts; write(")"); } } + function isSpreadElementExpression(node) { + return node.kind === 169; + } function emitArrayLiteral(node) { var elements = node.elements; if (elements.length === 0) { write("[]"); } - else if (languageVersion >= 2) { + else if (languageVersion >= 2 || !ts.forEach(elements, isSpreadElementExpression)) { write("["); - emitList(elements, 0, elements.length, (node.flags & 256) !== 0, elements.hasTrailingComma); + emitLinePreservingList(node, node.elements, elements.hasTrailingComma, false); write("]"); } else { emitListWithSpread(elements, (node.flags & 256) !== 0, elements.hasTrailingComma); } } + function createSynthesizedNode(kind) { + var node = ts.createNode(kind); + node.pos = -1; + node.end = -1; + return node; + } + function emitDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex) { + var parenthesizedObjectLiteral = createDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex); + return emit(parenthesizedObjectLiteral); + } + function createDownlevelObjectLiteralWithComputedProperties(originalObjectLiteral, firstComputedPropertyIndex) { + var tempVar = createAndRecordTempVariable(originalObjectLiteral); + var initialObjectLiteral = createSynthesizedNode(150); + initialObjectLiteral.properties = originalObjectLiteral.properties.slice(0, firstComputedPropertyIndex); + initialObjectLiteral.flags |= 256; + var propertyPatches = createBinaryExpression(tempVar, 52, initialObjectLiteral); + ts.forEach(originalObjectLiteral.properties, function (property) { + var patchedProperty = tryCreatePatchingPropertyAssignment(originalObjectLiteral, tempVar, property); + if (patchedProperty) { + propertyPatches = createBinaryExpression(propertyPatches, 23, patchedProperty); + } + }); + propertyPatches = createBinaryExpression(propertyPatches, 23, tempVar); + var result = createParenthesizedExpression(propertyPatches); + return result; + } + function addCommentsToSynthesizedNode(node, leadingCommentRanges, trailingCommentRanges) { + node.leadingCommentRanges = leadingCommentRanges; + node.trailingCommentRanges = trailingCommentRanges; + } + function tryCreatePatchingPropertyAssignment(objectLiteral, tempVar, property) { + var leftHandSide = createMemberAccessForPropertyName(tempVar, property.name); + var maybeRightHandSide = tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property); + return maybeRightHandSide && createBinaryExpression(leftHandSide, 52, maybeRightHandSide); + } + function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property) { + switch (property.kind) { + case 207: + return property.initializer; + case 208: + var prefix = createIdentifier(resolver.getExpressionNamePrefix(property.name)); + return createPropertyAccessExpression(prefix, property.name); + case 130: + return createFunctionExpression(property.parameters, property.body); + case 132: + case 133: + var _a = getAllAccessorDeclarations(objectLiteral.properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + if (firstAccessor !== property) { + return undefined; + } + var propertyDescriptor = createSynthesizedNode(150); + var descriptorProperties = []; + if (getAccessor) { + var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); + descriptorProperties.push(getProperty); + } + if (setAccessor) { + var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpression(setAccessor.parameters, setAccessor.body)); + descriptorProperties.push(setProperty); + } + var trueExpr = createSynthesizedNode(94); + var enumerableTrue = createPropertyAssignment(createIdentifier("enumerable"), trueExpr); + descriptorProperties.push(enumerableTrue); + var configurableTrue = createPropertyAssignment(createIdentifier("configurable"), trueExpr); + descriptorProperties.push(configurableTrue); + propertyDescriptor.properties = descriptorProperties; + var objectDotDefineProperty = createPropertyAccessExpression(createIdentifier("Object"), createIdentifier("defineProperty")); + return createCallExpression(objectDotDefineProperty, createNodeArray(propertyDescriptor)); + default: + ts.Debug.fail("ObjectLiteralElement kind " + property.kind + " not accounted for."); + } + } + function createParenthesizedExpression(expression) { + var result = createSynthesizedNode(157); + result.expression = expression; + return result; + } + function createNodeArray() { + var elements = []; + for (var _i = 0; _i < arguments.length; _i++) { + elements[_i - 0] = arguments[_i]; + } + var result = elements; + result.pos = -1; + result.end = -1; + return result; + } + function createBinaryExpression(left, operator, right) { + var result = createSynthesizedNode(165); + result.operatorToken = createSynthesizedNode(operator); + result.left = left; + result.right = right; + return result; + } + function createMemberAccessForPropertyName(expression, memberName) { + if (memberName.kind === 64) { + return createPropertyAccessExpression(expression, memberName); + } + else if (memberName.kind === 8 || memberName.kind === 7) { + return createElementAccessExpression(expression, memberName); + } + else if (memberName.kind === 124) { + return createElementAccessExpression(expression, memberName.expression); + } + else { + ts.Debug.fail("Kind '" + memberName.kind + "' not accounted for."); + } + } + function createPropertyAssignment(name, initializer) { + var result = createSynthesizedNode(207); + result.name = name; + result.initializer = initializer; + return result; + } + function createFunctionExpression(parameters, body) { + var result = createSynthesizedNode(158); + result.parameters = parameters; + result.body = body; + return result; + } + function createPropertyAccessExpression(expression, name) { + var result = createSynthesizedNode(151); + result.expression = expression; + result.name = name; + return result; + } + function createElementAccessExpression(expression, argumentExpression) { + var result = createSynthesizedNode(152); + result.expression = expression; + result.argumentExpression = argumentExpression; + return result; + } + function createIdentifier(name) { + var result = createSynthesizedNode(64); + result.text = name; + return result; + } + function createCallExpression(invokedExpression, arguments) { + var result = createSynthesizedNode(153); + result.expression = invokedExpression; + result.arguments = arguments; + return result; + } function emitObjectLiteral(node) { + var properties = node.properties; + if (languageVersion < 2) { + var numProperties = properties.length; + var numInitialNonComputedProperties = numProperties; + for (var i = 0, n = properties.length; i < n; i++) { + if (properties[i].name.kind === 124) { + numInitialNonComputedProperties = i; + break; + } + } + var hasComputedProperty = numInitialNonComputedProperties !== properties.length; + if (hasComputedProperty) { + emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); + return; + } + } write("{"); var properties = node.properties; if (properties.length) { - var multiLine = (node.flags & 256) !== 0; - if (!multiLine) { - write(" "); - } - emitList(properties, 0, properties.length, multiLine, properties.hasTrailingComma && languageVersion >= 1); - if (!multiLine) { - write(" "); - } + emitLinePreservingList(node, properties, languageVersion >= 1, true); } write("}"); } @@ -18210,7 +18867,7 @@ var ts; } function emitShorthandPropertyAssignment(node) { emit(node.name); - if (languageVersion < 2 || resolver.getExpressionNamePrefix(node.name)) { + if (languageVersion <= 1 || resolver.getExpressionNamePrefix(node.name)) { write(": "); emitExpressionIdentifier(node.name); } @@ -18220,7 +18877,7 @@ var ts; if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 149 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 151 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; @@ -18250,10 +18907,10 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 167; }); + return ts.forEach(elements, function (e) { return e.kind === 169; }); } function skipParentheses(node) { - while (node.kind === 155 || node.kind === 154) { + while (node.kind === 157 || node.kind === 156) { node = node.expression; } return node; @@ -18263,8 +18920,7 @@ var ts; emit(node); return node; } - var temp = createTempVariable(node); - recordTempDeclaration(temp); + var temp = createAndRecordTempVariable(node); write("("); emit(temp); write(" = "); @@ -18275,12 +18931,12 @@ var ts; function emitCallWithSpread(node) { var target; var expr = skipParentheses(node.expression); - if (expr.kind === 149) { + if (expr.kind === 151) { target = emitCallTarget(expr.expression); write("."); emit(expr.name); } - else if (expr.kind === 150) { + else if (expr.kind === 152) { target = emitCallTarget(expr.expression); write("["); emit(expr.argumentExpression); @@ -18321,7 +18977,7 @@ var ts; } else { emit(node.expression); - superCall = node.expression.kind === 149 && node.expression.expression.kind === 90; + superCall = node.expression.kind === 151 && node.expression.expression.kind === 90; } if (superCall) { write(".call("); @@ -18353,12 +19009,19 @@ var ts; emit(node.template); } function emitParenExpression(node) { - if (node.expression.kind === 154) { + if (node.expression.kind === 156) { var operand = node.expression.expression; - while (operand.kind == 154) { + while (operand.kind == 156) { operand = operand.expression; } - if (operand.kind !== 161 && operand.kind !== 160 && operand.kind !== 159 && operand.kind !== 158 && operand.kind !== 162 && operand.kind !== 152 && !(operand.kind === 151 && node.parent.kind === 152) && !(operand.kind === 156 && node.parent.kind === 151)) { + if (operand.kind !== 163 && + operand.kind !== 162 && + operand.kind !== 161 && + operand.kind !== 160 && + operand.kind !== 164 && + operand.kind !== 154 && + !(operand.kind === 153 && node.parent.kind === 154) && + !(operand.kind === 158 && node.parent.kind === 153)) { emit(operand); return; } @@ -18384,7 +19047,7 @@ var ts; } function emitPrefixUnaryExpression(node) { write(ts.tokenToString(node.operator)); - if (node.operand.kind === 161) { + if (node.operand.kind === 163) { var operand = node.operand; if (node.operator === 33 && (operand.operator === 33 || operand.operator === 38)) { write(" "); @@ -18400,18 +19063,48 @@ var ts; write(ts.tokenToString(node.operator)); } function emitBinaryExpression(node) { - if (languageVersion < 2 && node.operator === 52 && (node.left.kind === 148 || node.left.kind === 147)) { + if (languageVersion < 2 && node.operatorToken.kind === 52 && + (node.left.kind === 150 || node.left.kind === 149)) { emitDestructuring(node); } else { emit(node.left); - if (node.operator !== 23) + if (node.operatorToken.kind !== 23) { write(" "); - write(ts.tokenToString(node.operator)); - write(" "); + } + write(ts.tokenToString(node.operatorToken.kind)); + var operatorEnd = ts.getLineAndCharacterOfPosition(currentSourceFile, node.operatorToken.end); + var rightStart = ts.getLineAndCharacterOfPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.right.pos)); + var onDifferentLine = operatorEnd.line !== rightStart.line; + if (onDifferentLine) { + var exprStart = ts.getLineAndCharacterOfPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + var firstCharOfExpr = getFirstNonWhitespaceCharacterIndexOnLine(exprStart.line); + var shouldIndent = rightStart.character > firstCharOfExpr; + if (shouldIndent) { + increaseIndent(); + } + writeLine(); + } + else { + write(" "); + } emit(node.right); + if (shouldIndent) { + decreaseIndent(); + } } } + function getFirstNonWhitespaceCharacterIndexOnLine(line) { + var lineStart = ts.getLineStarts(currentSourceFile)[line]; + var text = currentSourceFile.text; + for (var i = lineStart; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (!ts.isWhiteSpace(text.charCodeAt(i)) || ts.isLineBreak(ch)) { + break; + } + } + return i - lineStart; + } function emitConditionalExpression(node) { emit(node.condition); write(" ? "); @@ -18419,14 +19112,14 @@ var ts; write(" : "); emit(node.whenFalse); } - function isSingleLineBlock(node) { - if (node && node.kind === 170) { + function isSingleLineEmptyBlock(node) { + if (node && node.kind === 172) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } } function emitBlock(node) { - if (isSingleLineBlock(node)) { + if (isSingleLineEmptyBlock(node)) { emitToken(14, node.pos); write(" "); emitToken(15, node.statements.end); @@ -18435,12 +19128,12 @@ var ts; emitToken(14, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 196) { - ts.Debug.assert(node.parent.kind === 195); + if (node.kind === 199) { + ts.Debug.assert(node.parent.kind === 198); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 196) { + if (node.kind === 199) { emitTempDeclarations(true); } decreaseIndent(); @@ -18449,7 +19142,7 @@ var ts; scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 170) { + if (node.kind === 172) { write(" "); emit(node); } @@ -18461,7 +19154,7 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesized(node.expression, node.expression.kind === 157); + emitParenthesized(node.expression, node.expression.kind === 159); write(";"); } function emitIfStatement(node) { @@ -18474,7 +19167,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(75, node.thenStatement.end); - if (node.elseStatement.kind === 174) { + if (node.elseStatement.kind === 176) { write(" "); emit(node.elseStatement); } @@ -18486,7 +19179,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 170) { + if (node.statement.kind === 172) { write(" "); } else { @@ -18506,7 +19199,7 @@ var ts; var endPos = emitToken(81, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer && node.initializer.kind === 189) { + if (node.initializer && node.initializer.kind === 192) { var variableDeclarationList = node.initializer; var declarations = variableDeclarationList.declarations; if (declarations[0] && ts.isLet(declarations[0])) { @@ -18531,11 +19224,11 @@ var ts; write(")"); emitEmbeddedStatement(node.statement); } - function emitForInStatement(node) { + function emitForInOrForOfStatement(node) { var endPos = emitToken(81, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer.kind === 189) { + if (node.initializer.kind === 192) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; @@ -18552,13 +19245,18 @@ var ts; else { emit(node.initializer); } - write(" in "); + if (node.kind === 180) { + write(" in "); + } + else { + write(" of "); + } emit(node.expression); emitToken(17, node.expression.end); emitEmbeddedStatement(node.statement); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 180 ? 65 : 70, node.pos); + emitToken(node.kind === 183 ? 65 : 70, node.pos); emitOptional(" ", node.label); write(";"); } @@ -18587,14 +19285,20 @@ var ts; writeLine(); emitToken(15, node.clauses.end); } - function isOnSameLine(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + function nodeStartPositionsAreOnSameLine(node1, node2) { + return getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node1.pos)) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + } + function nodeEndPositionsAreOnSameLine(node1, node2) { + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1, node2) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 200) { + if (node.kind === 203) { write("case "); emit(node.expression); write(":"); @@ -18602,7 +19306,7 @@ var ts; else { write("default:"); } - if (node.statements.length === 1 && isOnSameLine(node, node.statements[0])) { + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -18649,7 +19353,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 195); + } while (node && node.kind !== 198); return node; } function emitModuleMemberName(node) { @@ -18664,8 +19368,8 @@ var ts; } function emitDestructuring(root, value) { var emitCount = 0; - var isDeclaration = (root.kind === 188 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 124; - if (root.kind === 163) { + var isDeclaration = (root.kind === 191 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 126; + if (root.kind === 165) { emitAssignmentExpression(root); } else { @@ -18675,7 +19379,7 @@ var ts; if (emitCount++) { write(", "); } - if (name.parent && (name.parent.kind === 188 || name.parent.kind === 146)) { + if (name.parent && (name.parent.kind === 191 || name.parent.kind === 148)) { emitModuleMemberName(name.parent); } else { @@ -18698,17 +19402,17 @@ var ts; function createVoidZero() { var zero = ts.createNode(7); zero.text = "0"; - var result = ts.createNode(160); + var result = ts.createNode(162); result.expression = zero; return result; } function createDefaultValueCheck(value, defaultValue) { value = ensureIdentifier(value); - var equals = ts.createNode(163); + var equals = ts.createNode(165); equals.left = value; - equals.operator = 30; + equals.operatorToken = ts.createNode(30); equals.right = createVoidZero(); - var cond = ts.createNode(164); + var cond = ts.createNode(166); cond.condition = equals; cond.whenTrue = defaultValue; cond.whenFalse = value; @@ -18720,10 +19424,10 @@ var ts; return node; } function parenthesizeForAccess(expr) { - if (expr.kind === 64 || expr.kind === 149 || expr.kind === 150) { + if (expr.kind === 64 || expr.kind === 151 || expr.kind === 152) { return expr; } - var node = ts.createNode(155); + var node = ts.createNode(157); node.expression = expr; return node; } @@ -18731,13 +19435,13 @@ var ts; if (propName.kind !== 64) { return createElementAccess(object, propName); } - var node = ts.createNode(149); + var node = ts.createNode(151); node.expression = parenthesizeForAccess(object); node.name = propName; return node; } function createElementAccess(object, index) { - var node = ts.createNode(150); + var node = ts.createNode(152); node.expression = parenthesizeForAccess(object); node.argumentExpression = index; return node; @@ -18749,7 +19453,7 @@ var ts; } for (var i = 0; i < properties.length; i++) { var p = properties[i]; - if (p.kind === 204 || p.kind === 205) { + if (p.kind === 207 || p.kind === 208) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccess(value, propName)); } @@ -18762,8 +19466,8 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 168) { - if (e.kind !== 167) { + if (e.kind !== 170) { + if (e.kind !== 169) { emitDestructuringAssignment(e, createElementAccess(value, createNumericLiteral(i))); } else { @@ -18777,14 +19481,14 @@ var ts; } } function emitDestructuringAssignment(target, value) { - if (target.kind === 163 && target.operator === 52) { + if (target.kind === 165 && target.operatorToken.kind === 52) { value = createDefaultValueCheck(value, target.right); target = target.left; } - if (target.kind === 148) { + if (target.kind === 150) { emitObjectLiteralAssignment(target, value); } - else if (target.kind === 147) { + else if (target.kind === 149) { emitArrayLiteralAssignment(target, value); } else { @@ -18794,18 +19498,18 @@ var ts; function emitAssignmentExpression(root) { var target = root.left; var value = root.right; - if (root.parent.kind === 173) { + if (root.parent.kind === 175) { emitDestructuringAssignment(target, value); } else { - if (root.parent.kind !== 155) { + if (root.parent.kind !== 157) { write("("); } value = ensureIdentifier(value); emitDestructuringAssignment(target, value); write(", "); emit(value); - if (root.parent.kind !== 155) { + if (root.parent.kind !== 157) { write(")"); } } @@ -18825,11 +19529,11 @@ var ts; } for (var i = 0; i < elements.length; i++) { var element = elements[i]; - if (pattern.kind === 144) { + if (pattern.kind === 146) { var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccess(value, propName)); } - else if (element.kind !== 168) { + else if (element.kind !== 170) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccess(value, createNumericLiteral(i))); } @@ -18968,28 +19672,28 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 130 ? "get " : "set "); + write(node.kind === 132 ? "get " : "set "); emit(node.name); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 157 && languageVersion >= 2; + return node.kind === 159 && languageVersion >= 2; } function emitFunctionDeclaration(node) { if (ts.nodeIsMissing(node.body)) { return emitPinnedOrTripleSlashComments(node); } - if (node.kind !== 128 && node.kind !== 127) { + if (node.kind !== 130 && node.kind !== 129) { emitLeadingComments(node); } if (!shouldEmitAsArrowFunction(node)) { write("function "); } - if (node.kind === 190 || (node.kind === 156 && node.name)) { + if (node.kind === 193 || (node.kind === 158 && node.name)) { emit(node.name); } emitSignatureAndBody(node); - if (node.kind !== 128 && node.kind !== 127) { + if (node.kind !== 130 && node.kind !== 129) { emitTrailingComments(node); } } @@ -19033,69 +19737,14 @@ var ts; else { emitSignatureParameters(node); } - if (isSingleLineBlock(node.body)) { + if (isSingleLineEmptyBlock(node.body) || !node.body) { write(" { }"); } + else if (node.body.kind === 172) { + emitBlockFunctionBody(node, node.body); + } else { - write(" {"); - scopeEmitStart(node); - if (!node.body) { - writeLine(); - write("}"); - } - else { - increaseIndent(); - emitDetachedComments(node.body.kind === 170 ? node.body.statements : node.body); - var startIndex = 0; - if (node.body.kind === 170) { - startIndex = emitDirectivePrologues(node.body.statements, true); - } - var outPos = writer.getTextPos(); - emitCaptureThisForNodeIfNecessary(node); - emitDefaultValueAssignments(node); - emitRestParameter(node); - if (node.body.kind !== 170 && outPos === writer.getTextPos()) { - decreaseIndent(); - write(" "); - emitStart(node.body); - write("return "); - emitNode(node.body, true); - emitEnd(node.body); - write(";"); - emitTempDeclarations(false); - write(" "); - emitStart(node.body); - write("}"); - emitEnd(node.body); - } - else { - if (node.body.kind === 170) { - emitLinesStartingAt(node.body.statements, startIndex); - } - else { - writeLine(); - emitLeadingComments(node.body); - write("return "); - emit(node.body, true); - write(";"); - emitTrailingComments(node.body); - } - emitTempDeclarations(true); - writeLine(); - if (node.body.kind === 170) { - emitLeadingCommentsOfPosition(node.body.statements.end); - decreaseIndent(); - emitToken(15, node.body.statements.end); - } - else { - decreaseIndent(); - emitStart(node.body); - write("}"); - emitEnd(node.body); - } - } - } - scopeEmitEnd(); + emitExpressionFunctionBody(node, node.body); } if (node.flags & 1) { writeLine(); @@ -19110,12 +19759,83 @@ var ts; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } + function emitFunctionBodyPreamble(node) { + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + } + function emitExpressionFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + increaseIndent(); + var outPos = writer.getTextPos(); + emitDetachedComments(node.body); + emitFunctionBodyPreamble(node); + var preambleEmitted = writer.getTextPos() !== outPos; + decreaseIndent(); + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + write(" "); + emitStart(body); + write("return "); + emitNode(body, true); + emitEnd(body); + write(";"); + emitTempDeclarations(false); + write(" "); + } + else { + increaseIndent(); + writeLine(); + emitLeadingComments(node.body); + write("return "); + emit(node.body, true); + write(";"); + emitTrailingComments(node.body); + emitTempDeclarations(true); + decreaseIndent(); + writeLine(); + } + emitStart(node.body); + write("}"); + emitEnd(node.body); + scopeEmitEnd(); + } + function emitBlockFunctionBody(node, body) { + write(" {"); + scopeEmitStart(node); + var outPos = writer.getTextPos(); + increaseIndent(); + emitDetachedComments(body.statements); + var startIndex = emitDirectivePrologues(body.statements, true); + emitFunctionBodyPreamble(node); + decreaseIndent(); + var preambleEmitted = writer.getTextPos() !== outPos; + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var i = 0, n = body.statements.length; i < n; i++) { + write(" "); + emit(body.statements[i]); + } + emitTempDeclarations(false); + write(" "); + emitLeadingCommentsOfPosition(body.statements.end); + } + else { + increaseIndent(); + emitLinesStartingAt(body.statements, startIndex); + emitTempDeclarations(true); + writeLine(); + emitLeadingCommentsOfPosition(body.statements.end); + decreaseIndent(); + } + emitToken(15, body.statements.end); + scopeEmitEnd(); + } function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 173) { + if (statement && statement.kind === 175) { var expr = statement.expression; - if (expr && expr.kind === 151) { + if (expr && expr.kind === 153) { var func = expr.expression; if (func && func.kind === 90) { return statement; @@ -19146,7 +19866,7 @@ var ts; emitNode(memberName); write("]"); } - else if (memberName.kind === 122) { + else if (memberName.kind === 124) { emitComputedPropertyName(memberName); } else { @@ -19156,7 +19876,7 @@ var ts; } function emitMemberAssignments(node, staticFlag) { ts.forEach(node.members, function (member) { - if (member.kind === 126 && (member.flags & 128) === staticFlag && member.initializer) { + if (member.kind === 128 && (member.flags & 128) === staticFlag && member.initializer) { writeLine(); emitLeadingComments(member); emitStart(member); @@ -19179,7 +19899,7 @@ var ts; } function emitMemberFunctions(node) { ts.forEach(node.members, function (member) { - if (member.kind === 128 || node.kind === 127) { + if (member.kind === 130 || node.kind === 129) { if (!member.body) { return emitPinnedOrTripleSlashComments(member); } @@ -19201,8 +19921,8 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 130 || member.kind === 131) { - var accessors = getAllAccessorDeclarations(node, member); + else if (member.kind === 132 || member.kind === 133) { + var accessors = getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); emitStart(member); @@ -19309,7 +20029,7 @@ var ts; tempVariables = undefined; tempParameters = undefined; ts.forEach(node.members, function (member) { - if (member.kind === 129 && !member.body) { + if (member.kind === 131 && !member.body) { emitPinnedOrTripleSlashComments(member); } }); @@ -19452,7 +20172,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 195) { + if (moduleDeclaration.body.kind === 198) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -19477,7 +20197,7 @@ var ts; write(resolver.getLocalNameOfContainer(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 196) { + if (node.body.kind === 199) { var saveTempCount = tempCount; var saveTempVariables = tempVariables; tempCount = 0; @@ -19516,7 +20236,7 @@ var ts; emitImportDeclaration = !ts.isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportWithEntityName(node); } if (emitImportDeclaration) { - if (ts.isExternalModuleImportDeclaration(node) && node.parent.kind === 207 && compilerOptions.module === 2) { + if (ts.isExternalModuleImportDeclaration(node) && node.parent.kind === 210 && compilerOptions.module === 2) { if (node.flags & 1) { writeLine(); emitLeadingComments(node); @@ -19565,7 +20285,7 @@ var ts; } function getFirstExportAssignment(sourceFile) { return ts.forEach(sourceFile.statements, function (node) { - if (node.kind === 198) { + if (node.kind === 201) { return node; } }); @@ -19719,15 +20439,15 @@ var ts; } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 192: - case 190: - case 197: - case 193: - case 198: - return false; case 195: + case 193: + case 200: + case 196: + case 201: + return false; + case 198: return shouldEmitModuleDeclaration(node); - case 194: + case 197: return shouldEmitEnumDeclaration(node); } return true; @@ -19736,13 +20456,13 @@ var ts; switch (node.kind) { case 64: return emitIdentifier(node); - case 124: + case 126: return emitParameter(node); - case 128: - case 127: - return emitMethod(node); case 130: - case 131: + case 129: + return emitMethod(node); + case 132: + case 133: return emitAccessor(node); case 92: return emitThis(node); @@ -19762,120 +20482,121 @@ var ts; case 12: case 13: return emitLiteral(node); - case 165: - return emitTemplateExpression(node); - case 169: - return emitTemplateSpan(node); - case 121: - return emitQualifiedName(node); - case 144: - return emitObjectBindingPattern(node); - case 145: - return emitArrayBindingPattern(node); - case 146: - return emitBindingElement(node); - case 147: - return emitArrayLiteral(node); - case 148: - return emitObjectLiteral(node); - case 204: - return emitPropertyAssignment(node); - case 205: - return emitShorthandPropertyAssignment(node); - case 122: - return emitComputedPropertyName(node); - case 149: - return emitPropertyAccess(node); - case 150: - return emitIndexedAccess(node); - case 151: - return emitCallExpression(node); - case 152: - return emitNewExpression(node); - case 153: - return emitTaggedTemplateExpression(node); - case 154: - return emit(node.expression); - case 155: - return emitParenExpression(node); - case 190: - case 156: - case 157: - return emitFunctionDeclaration(node); - case 158: - return emitDeleteExpression(node); - case 159: - return emitTypeOfExpression(node); - case 160: - return emitVoidExpression(node); - case 161: - return emitPrefixUnaryExpression(node); - case 162: - return emitPostfixUnaryExpression(node); - case 163: - return emitBinaryExpression(node); - case 164: - return emitConditionalExpression(node); case 167: - return emitSpreadElementExpression(node); - case 168: - return; - case 170: - case 196: - return emitBlock(node); + return emitTemplateExpression(node); case 171: - return emitVariableStatement(node); - case 172: - return write(";"); - case 173: - return emitExpressionStatement(node); - case 174: - return emitIfStatement(node); - case 175: - return emitDoStatement(node); - case 176: - return emitWhileStatement(node); - case 177: - return emitForStatement(node); - case 178: - return emitForInStatement(node); - case 179: - case 180: - return emitBreakOrContinueStatement(node); - case 181: - return emitReturnStatement(node); - case 182: - return emitWithStatement(node); - case 183: - return emitSwitchStatement(node); - case 200: - case 201: - return emitCaseOrDefaultClause(node); - case 184: - return emitLabelledStatement(node); - case 185: - return emitThrowStatement(node); - case 186: - return emitTryStatement(node); - case 203: - return emitCatchClause(node); - case 187: - return emitDebuggerStatement(node); - case 188: - return emitVariableDeclaration(node); - case 191: - return emitClassDeclaration(node); - case 192: - return emitInterfaceDeclaration(node); - case 194: - return emitEnumDeclaration(node); - case 206: - return emitEnumMember(node); - case 195: - return emitModuleDeclaration(node); - case 197: - return emitImportDeclaration(node); + return emitTemplateSpan(node); + case 123: + return emitQualifiedName(node); + case 146: + return emitObjectBindingPattern(node); + case 147: + return emitArrayBindingPattern(node); + case 148: + return emitBindingElement(node); + case 149: + return emitArrayLiteral(node); + case 150: + return emitObjectLiteral(node); case 207: + return emitPropertyAssignment(node); + case 208: + return emitShorthandPropertyAssignment(node); + case 124: + return emitComputedPropertyName(node); + case 151: + return emitPropertyAccess(node); + case 152: + return emitIndexedAccess(node); + case 153: + return emitCallExpression(node); + case 154: + return emitNewExpression(node); + case 155: + return emitTaggedTemplateExpression(node); + case 156: + return emit(node.expression); + case 157: + return emitParenExpression(node); + case 193: + case 158: + case 159: + return emitFunctionDeclaration(node); + case 160: + return emitDeleteExpression(node); + case 161: + return emitTypeOfExpression(node); + case 162: + return emitVoidExpression(node); + case 163: + return emitPrefixUnaryExpression(node); + case 164: + return emitPostfixUnaryExpression(node); + case 165: + return emitBinaryExpression(node); + case 166: + return emitConditionalExpression(node); + case 169: + return emitSpreadElementExpression(node); + case 170: + return; + case 172: + case 199: + return emitBlock(node); + case 173: + return emitVariableStatement(node); + case 174: + return write(";"); + case 175: + return emitExpressionStatement(node); + case 176: + return emitIfStatement(node); + case 177: + return emitDoStatement(node); + case 178: + return emitWhileStatement(node); + case 179: + return emitForStatement(node); + case 181: + case 180: + return emitForInOrForOfStatement(node); + case 182: + case 183: + return emitBreakOrContinueStatement(node); + case 184: + return emitReturnStatement(node); + case 185: + return emitWithStatement(node); + case 186: + return emitSwitchStatement(node); + case 203: + case 204: + return emitCaseOrDefaultClause(node); + case 187: + return emitLabelledStatement(node); + case 188: + return emitThrowStatement(node); + case 189: + return emitTryStatement(node); + case 206: + return emitCatchClause(node); + case 190: + return emitDebuggerStatement(node); + case 191: + return emitVariableDeclaration(node); + case 194: + return emitClassDeclaration(node); + case 195: + return emitInterfaceDeclaration(node); + case 197: + return emitEnumDeclaration(node); + case 209: + return emitEnumMember(node); + case 198: + return emitModuleDeclaration(node); + case 200: + return emitImportDeclaration(node); + case 210: return emitSourceFile(node); } } @@ -19894,7 +20615,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 207 || node.pos !== node.parent.pos) { + if (node.parent.kind === 210 || node.pos !== node.parent.pos) { var leadingComments; if (hasDetachedComments(node.pos)) { leadingComments = getLeadingCommentsWithoutDetachedComments(); @@ -19913,7 +20634,7 @@ var ts; } function emitTrailingDeclarationComments(node) { if (node.parent) { - if (node.parent.kind === 207 || node.end !== node.parent.end) { + if (node.parent.kind === 210 || node.end !== node.parent.end) { var trailingComments = ts.getTrailingCommentRanges(currentSourceFile.text, node.end); emitComments(currentSourceFile, writer, trailingComments, false, newLine, writeComment); } @@ -19948,8 +20669,8 @@ var ts; }); if (detachedComments.length) { var lastCommentLine = getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); - var astLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); - if (astLine >= lastCommentLine + 2) { + var nodeLine = getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; @@ -19969,7 +20690,10 @@ var ts; if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 42) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === 33; } - else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && comment.pos + 2 < comment.end && currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { + else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === 47 && + comment.pos + 2 < comment.end && + currentSourceFile.text.charCodeAt(comment.pos + 2) === 47 && + currentSourceFile.text.substring(comment.pos, comment.end).match(ts.fullTripleSlashReferencePathRegEx)) { return true; } } @@ -20290,7 +21014,8 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (ts.isExternalModuleImportDeclaration(node) && ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { + if (ts.isExternalModuleImportDeclaration(node) && + ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { var nameLiteral = ts.getExternalModuleImportDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { @@ -20308,9 +21033,10 @@ var ts; } } } - else if (node.kind === 195 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { + else if (node.kind === 198 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { - if (ts.isExternalModuleImportDeclaration(node) && ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { + if (ts.isExternalModuleImportDeclaration(node) && + ts.getExternalModuleImportDeclarationExpression(node).kind === 8) { var nameLiteral = ts.getExternalModuleImportDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { @@ -20345,7 +21071,10 @@ var ts; var errorLength = externalModuleErrorSpan.end - errorStart; diagnostics.add(ts.createFileDiagnostic(firstExternalModule, errorStart, errorLength, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } - if (options.outDir || options.sourceRoot || (options.mapRoot && (!options.out || firstExternalModule !== undefined))) { + if (options.outDir || + options.sourceRoot || + (options.mapRoot && + (!options.out || firstExternalModule !== undefined))) { var commonPathComponents; ts.forEach(files, function (sourceFile) { if (!(sourceFile.flags & 1024) && !ts.fileExtensionIs(sourceFile.fileName, ".js")) { @@ -20746,10 +21475,10 @@ var ts; } function autoCollapse(node) { switch (node.kind) { - case 196: - case 191: - case 192: + case 199: case 194: + case 195: + case 197: return false; } return true; @@ -20761,16 +21490,23 @@ var ts; return; } switch (n.kind) { - case 170: + case 172: if (!ts.isFunctionBlock(n)) { var parent = n.parent; var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (parent.kind === 175 || parent.kind === 178 || parent.kind === 177 || parent.kind === 174 || parent.kind === 176 || parent.kind === 182 || parent.kind === 203) { + if (parent.kind === 177 || + parent.kind === 180 || + parent.kind === 181 || + parent.kind === 179 || + parent.kind === 176 || + parent.kind === 178 || + parent.kind === 185 || + parent.kind === 206) { addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent.kind === 186) { + if (parent.kind === 189) { var tryStatement = parent; if (tryStatement.tryBlock === n) { addOutliningSpan(parent, openBrace, closeBrace, autoCollapse(n)); @@ -20793,21 +21529,21 @@ var ts; }); break; } - case 196: + case 199: var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; - case 191: - case 192: case 194: - case 148: - case 183: + case 195: + case 197: + case 150: + case 186: var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; - case 147: + case 149: var openBracket = ts.findChildOfKind(n, 18, sourceFile); var closeBracket = ts.findChildOfKind(n, 19, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -20824,6 +21560,95 @@ var ts; })(OutliningElementsCollector = ts.OutliningElementsCollector || (ts.OutliningElementsCollector = {})); })(ts || (ts = {})); var ts; +(function (ts) { + var NavigateTo; + (function (NavigateTo) { + var MatchKind; + (function (MatchKind) { + MatchKind[MatchKind["none"] = 0] = "none"; + MatchKind[MatchKind["exact"] = 1] = "exact"; + MatchKind[MatchKind["substring"] = 2] = "substring"; + MatchKind[MatchKind["prefix"] = 3] = "prefix"; + })(MatchKind || (MatchKind = {})); + function getNavigateToItems(program, cancellationToken, searchValue, maxResultCount) { + var terms = searchValue.split(" "); + var searchTerms = ts.map(terms, function (t) { return ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t }); }); + var rawItems = []; + ts.forEach(program.getSourceFiles(), function (sourceFile) { + cancellationToken.throwIfCancellationRequested(); + var fileName = sourceFile.fileName; + var declarations = sourceFile.getNamedDeclarations(); + for (var i = 0, n = declarations.length; i < n; i++) { + var declaration = declarations[i]; + var name = declaration.name.text; + var matchKind = getMatchKind(searchTerms, name); + if (matchKind !== 0) { + rawItems.push({ name: name, fileName: fileName, matchKind: matchKind, declaration: declaration }); + } + } + }); + rawItems.sort(compareNavigateToItems); + if (maxResultCount !== undefined) { + rawItems = rawItems.slice(0, maxResultCount); + } + var items = ts.map(rawItems, createNavigateToItem); + return items; + var baseSensitivity = { sensitivity: "base" }; + function compareNavigateToItems(i1, i2) { + return i1.matchKind - i2.matchKind || + i1.name.localeCompare(i2.name, undefined, baseSensitivity) || + i1.name.localeCompare(i2.name); + } + function createNavigateToItem(rawItem) { + var declaration = rawItem.declaration; + var container = ts.getContainerNode(declaration); + return { + name: rawItem.name, + kind: ts.getNodeKind(declaration), + kindModifiers: ts.getNodeModifiers(declaration), + matchKind: MatchKind[rawItem.matchKind], + fileName: rawItem.fileName, + textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + containerName: container && container.name ? container.name.text : "", + containerKind: container && container.name ? ts.getNodeKind(container) : "" + }; + } + function hasAnyUpperCaseCharacter(s) { + for (var i = 0, n = s.length; i < n; i++) { + var c = s.charCodeAt(i); + if ((65 <= c && c <= 90) || + (c >= 127 && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) { + return true; + } + } + return false; + } + function getMatchKind(searchTerms, name) { + var matchKind = 0; + if (name) { + for (var j = 0, n = searchTerms.length; j < n; j++) { + var searchTerm = searchTerms[j]; + var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase(); + var index = nameToSearch.indexOf(searchTerm.term); + if (index < 0) { + return 0; + } + var termKind = 2; + if (index === 0) { + termKind = name.length === searchTerm.term.length ? 1 : 3; + } + if (matchKind === 0 || termKind < matchKind) { + matchKind = termKind; + } + } + } + return matchKind; + } + } + NavigateTo.getNavigateToItems = getNavigateToItems; + })(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {})); +})(ts || (ts = {})); +var ts; (function (ts) { var NavigationBar; (function (NavigationBar) { @@ -20835,14 +21660,14 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 195: + case 198: do { current = current.parent; - } while (current.kind === 195); - case 191: + } while (current.kind === 198); case 194: - case 192: - case 190: + case 197: + case 195: + case 193: indent++; } current = current.parent; @@ -20853,24 +21678,24 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 171: + case 173: ts.forEach(node.declarationList.declarations, visit); break; - case 144: - case 145: + case 146: + case 147: ts.forEach(node.elements, visit); break; - case 146: - case 188: + case 148: + case 191: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } - case 191: case 194: - case 192: + case 197: case 195: - case 190: + case 198: + case 193: childNodes.push(node); } } @@ -20886,7 +21711,7 @@ var ts; function sortNodes(nodes) { return nodes.slice(0).sort(function (n1, n2) { if (n1.name && n2.name) { - return n1.name.text.localeCompare(n2.name.text); + return ts.getPropertyNameForPropertyNameNode(n1.name).localeCompare(ts.getPropertyNameForPropertyNameNode(n2.name)); } else if (n1.name) { return 1; @@ -20904,17 +21729,17 @@ var ts; for (var i = 0, n = nodes.length; i < n; i++) { var node = nodes[i]; switch (node.kind) { - case 191: case 194: - case 192: + case 197: + case 195: topLevelNodes.push(node); break; - case 195: + case 198: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 190: + case 193: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -20925,9 +21750,9 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 190) { - if (functionDeclaration.body && functionDeclaration.body.kind === 170) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 190 && !isEmpty(s.name.text); })) { + if (functionDeclaration.kind === 193) { + if (functionDeclaration.body && functionDeclaration.body.kind === 172) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 193 && !isEmpty(s.name.text); })) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { @@ -20980,7 +21805,7 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 124: + case 126: if (ts.isBindingPattern(node.name)) { break; } @@ -20988,34 +21813,34 @@ var ts; return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 130: + case 129: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); + case 132: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); + case 133: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); + case 136: + return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); + case 209: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 134: + return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); + case 135: + return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); case 128: case 127: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 130: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); - case 131: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 134: - return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 206: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 132: - return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); - case 133: - return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); - case 126: - case 125: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 190: + case 193: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 188: - case 146: + case 191: + case 148: var variableDeclarationNode; var name; - if (node.kind === 146) { + if (node.kind === 148) { name = node.name; variableDeclarationNode = node; - while (variableDeclarationNode && variableDeclarationNode.kind !== 188) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 191) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -21034,7 +21859,7 @@ var ts; else { return createItem(node, getTextOfNode(name), ts.ScriptElementKind.variableElement); } - case 129: + case 131: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); } return undefined; @@ -21064,17 +21889,17 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 207: + case 210: return createSourceFileItem(node); - case 191: - return createClassItem(node); case 194: + return createClassItem(node); + case 197: return createEnumItem(node); - case 192: - return createIterfaceItem(node); case 195: + return createIterfaceItem(node); + case 198: return createModuleItem(node); - case 190: + case 193: return createFunctionItem(node); } return undefined; @@ -21084,7 +21909,7 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 195) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 198) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -21096,7 +21921,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.name && node.body && node.body.kind === 170) { + if (node.name && node.body && node.body.kind === 172) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -21115,9 +21940,9 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 129 && member; + return member.kind === 131 && member; }); - var nodes = removeComputedProperties(node); + var nodes = removeDynamicallyNamedProperties(node); if (constructor) { nodes.push.apply(nodes, constructor.parameters); } @@ -21130,21 +21955,24 @@ var ts; return getNavigationBarItem(node.name.text, ts.ScriptElementKind.enumElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createIterfaceItem(node) { - var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); + var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); return getNavigationBarItem(node.name.text, ts.ScriptElementKind.interfaceElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 122; }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 124; }); + } + function removeDynamicallyNamedProperties(node) { + return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 195) { + while (node.body.kind === 198) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 207 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); + return node.kind === 210 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } function getTextOfNode(node) { return ts.getTextOfNodeFromSourceText(sourceFile.text, node); @@ -21154,6 +21982,456 @@ var ts; })(NavigationBar = ts.NavigationBar || (ts.NavigationBar = {})); })(ts || (ts = {})); var ts; +(function (ts) { + (function (PatternMatchKind) { + PatternMatchKind[PatternMatchKind["Exact"] = 0] = "Exact"; + PatternMatchKind[PatternMatchKind["Prefix"] = 1] = "Prefix"; + PatternMatchKind[PatternMatchKind["Substring"] = 2] = "Substring"; + PatternMatchKind[PatternMatchKind["CamelCase"] = 3] = "CamelCase"; + })(ts.PatternMatchKind || (ts.PatternMatchKind = {})); + var PatternMatchKind = ts.PatternMatchKind; + function createPatternMatch(kind, punctuationStripped, isCaseSensitive, camelCaseWeight) { + return { + kind: kind, + punctuationStripped: punctuationStripped, + isCaseSensitive: isCaseSensitive, + camelCaseWeight: camelCaseWeight + }; + } + function createPatternMatcher(pattern) { + var stringToWordSpans = {}; + pattern = pattern.trim(); + var fullPatternSegment = createSegment(pattern); + var dotSeparatedSegments = pattern.split(".").map(function (p) { return createSegment(p.trim()); }); + var invalidPattern = dotSeparatedSegments.length === 0 || ts.forEach(dotSeparatedSegments, segmentIsInvalid); + return { + getMatches: getMatches, + getMatchesForLastSegmentOfPattern: getMatchesForLastSegmentOfPattern, + patternContainsDots: dotSeparatedSegments.length > 1 + }; + function skipMatch(candidate) { + return invalidPattern || !candidate; + } + function getMatchesForLastSegmentOfPattern(candidate) { + if (skipMatch(candidate)) { + return undefined; + } + return matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments)); + } + function getMatches(candidate, dottedContainer) { + if (skipMatch(candidate)) { + return undefined; + } + var candidateMatch = matchSegment(candidate, ts.lastOrUndefined(dotSeparatedSegments)); + if (!candidateMatch) { + return undefined; + } + dottedContainer = dottedContainer || ""; + var containerParts = dottedContainer.split("."); + if (dotSeparatedSegments.length - 1 > containerParts.length) { + return null; + } + var totalMatch = candidateMatch; + for (var i = dotSeparatedSegments.length - 2, j = containerParts.length - 1; i >= 0; i--, j--) { + var segment = dotSeparatedSegments[i]; + var containerName = containerParts[j]; + var containerMatch = matchSegment(containerName, segment); + if (!containerMatch) { + return undefined; + } + ts.addRange(totalMatch, containerMatch); + } + return totalMatch; + } + function getWordSpans(word) { + if (!ts.hasProperty(stringToWordSpans, word)) { + stringToWordSpans[word] = breakIntoWordSpans(word); + } + return stringToWordSpans[word]; + } + function matchTextChunk(candidate, chunk, punctuationStripped) { + var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); + if (index === 0) { + if (chunk.text.length === candidate.length) { + return createPatternMatch(0, punctuationStripped, candidate === chunk.text); + } + else { + return createPatternMatch(1, punctuationStripped, startsWith(candidate, chunk.text)); + } + } + var isLowercase = chunk.isLowerCase; + if (isLowercase) { + if (index > 0) { + var wordSpans = getWordSpans(candidate); + for (var i = 0, n = wordSpans.length; i < n; i++) { + var span = wordSpans[i]; + if (partStartsWith(candidate, span, chunk.text, true)) { + return createPatternMatch(2, punctuationStripped, partStartsWith(candidate, span, chunk.text, false)); + } + } + } + } + else { + if (candidate.indexOf(chunk.text) > 0) { + return createPatternMatch(2, punctuationStripped, true); + } + } + if (!isLowercase) { + if (chunk.characterSpans.length > 0) { + var candidateParts = getWordSpans(candidate); + var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, false); + if (camelCaseWeight !== undefined) { + return createPatternMatch(3, punctuationStripped, true, camelCaseWeight); + } + camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, true); + if (camelCaseWeight !== undefined) { + return createPatternMatch(3, punctuationStripped, false, camelCaseWeight); + } + } + } + if (isLowercase) { + if (chunk.text.length < candidate.length) { + if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) { + return createPatternMatch(2, punctuationStripped, false); + } + } + } + return undefined; + } + function containsSpaceOrAsterisk(text) { + for (var i = 0; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (ch === 32 || ch === 42) { + return true; + } + } + return false; + } + function matchSegment(candidate, segment) { + if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { + var match = matchTextChunk(candidate, segment.totalTextChunk, false); + if (match) { + return [match]; + } + } + var subWordTextChunks = segment.subWordTextChunks; + var matches = undefined; + for (var i = 0, n = subWordTextChunks.length; i < n; i++) { + var subWordTextChunk = subWordTextChunks[i]; + var result = matchTextChunk(candidate, subWordTextChunk, true); + if (!result) { + return undefined; + } + matches = matches || []; + matches.push(result); + } + return matches; + } + function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { + var patternPartStart = patternSpan ? patternSpan.start : 0; + var patternPartLength = patternSpan ? patternSpan.length : pattern.length; + if (patternPartLength > candidateSpan.length) { + return false; + } + if (ignoreCase) { + for (var i = 0; i < patternPartLength; i++) { + var ch1 = pattern.charCodeAt(patternPartStart + i); + var ch2 = candidate.charCodeAt(candidateSpan.start + i); + if (toLowerCase(ch1) !== toLowerCase(ch2)) { + return false; + } + } + } + else { + for (var i = 0; i < patternPartLength; i++) { + var ch1 = pattern.charCodeAt(patternPartStart + i); + var ch2 = candidate.charCodeAt(candidateSpan.start + i); + if (ch1 !== ch2) { + return false; + } + } + } + return true; + } + function tryCamelCaseMatch(candidate, candidateParts, chunk, ignoreCase) { + var chunkCharacterSpans = chunk.characterSpans; + var currentCandidate = 0; + var currentChunkSpan = 0; + var firstMatch = undefined; + var contiguous = undefined; + while (true) { + if (currentChunkSpan === chunkCharacterSpans.length) { + var weight = 0; + if (contiguous) { + weight += 1; + } + if (firstMatch === 0) { + weight += 2; + } + return weight; + } + else if (currentCandidate === candidateParts.length) { + return undefined; + } + var candidatePart = candidateParts[currentCandidate]; + var gotOneMatchThisCandidate = false; + for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { + var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; + if (gotOneMatchThisCandidate) { + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || + !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + break; + } + } + if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) { + break; + } + gotOneMatchThisCandidate = true; + firstMatch = firstMatch === undefined ? currentCandidate : firstMatch; + contiguous = contiguous === undefined ? true : contiguous; + candidatePart = ts.createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length); + } + if (!gotOneMatchThisCandidate && contiguous !== undefined) { + contiguous = false; + } + currentCandidate++; + } + } + } + ts.createPatternMatcher = createPatternMatcher; + function patternMatchCompareTo(match1, match2) { + return compareType(match1, match2) || + compareCamelCase(match1, match2) || + compareCase(match1, match2) || + comparePunctuation(match1, match2); + } + function comparePunctuation(result1, result2) { + if (result1.punctuationStripped !== result2.punctuationStripped) { + return result1.punctuationStripped ? 1 : -1; + } + return 0; + } + function compareCase(result1, result2) { + if (result1.isCaseSensitive !== result2.isCaseSensitive) { + return result1.isCaseSensitive ? -1 : 1; + } + return 0; + } + function compareType(result1, result2) { + return result1.kind - result2.kind; + } + function compareCamelCase(result1, result2) { + if (result1.kind === 3 && result2.kind === 3) { + return result2.camelCaseWeight - result1.camelCaseWeight; + } + return 0; + } + function createSegment(text) { + return { + totalTextChunk: createTextChunk(text), + subWordTextChunks: breakPatternIntoTextChunks(text) + }; + } + function segmentIsInvalid(segment) { + return segment.subWordTextChunks.length === 0; + } + function isUpperCaseLetter(ch) { + if (ch >= 65 && ch <= 90) { + return true; + } + if (ch < 127 || !ts.isUnicodeIdentifierStart(ch, 2)) { + return false; + } + var str = String.fromCharCode(ch); + return str === str.toUpperCase(); + } + function isLowerCaseLetter(ch) { + if (ch >= 97 && ch <= 122) { + return true; + } + if (ch < 127 || !ts.isUnicodeIdentifierStart(ch, 2)) { + return false; + } + var str = String.fromCharCode(ch); + return str === str.toLowerCase(); + } + function containsUpperCaseLetter(string) { + for (var i = 0, n = string.length; i < n; i++) { + if (isUpperCaseLetter(string.charCodeAt(i))) { + return true; + } + } + return false; + } + function startsWith(string, search) { + for (var i = 0, n = search.length; i < n; i++) { + if (string.charCodeAt(i) !== search.charCodeAt(i)) { + return false; + } + } + return true; + } + function indexOfIgnoringCase(string, value) { + for (var i = 0, n = string.length - value.length; i <= n; i++) { + if (startsWithIgnoringCase(string, value, i)) { + return i; + } + } + return -1; + } + function startsWithIgnoringCase(string, value, start) { + for (var i = 0, n = value.length; i < n; i++) { + var ch1 = toLowerCase(string.charCodeAt(i + start)); + var ch2 = value.charCodeAt(i); + if (ch1 !== ch2) { + return false; + } + } + return true; + } + function toLowerCase(ch) { + if (ch >= 65 && ch <= 90) { + return 97 + (ch - 65); + } + if (ch < 127) { + return ch; + } + return String.fromCharCode(ch).toLowerCase().charCodeAt(0); + } + function isDigit(ch) { + return ch >= 48 && ch <= 57; + } + function isWordChar(ch) { + return isUpperCaseLetter(ch) || isLowerCaseLetter(ch) || isDigit(ch) || ch === 95 || ch === 36; + } + function breakPatternIntoTextChunks(pattern) { + var result = []; + var wordStart = 0; + var wordLength = 0; + for (var i = 0; i < pattern.length; i++) { + var ch = pattern.charCodeAt(i); + if (isWordChar(ch)) { + if (wordLength++ === 0) { + wordStart = i; + } + } + else { + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + wordLength = 0; + } + } + } + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + } + return result; + } + function createTextChunk(text) { + var textLowerCase = text.toLowerCase(); + return { + text: text, + textLowerCase: textLowerCase, + isLowerCase: text === textLowerCase, + characterSpans: breakIntoCharacterSpans(text) + }; + } + function breakIntoCharacterSpans(identifier) { + return breakIntoSpans(identifier, false); + } + ts.breakIntoCharacterSpans = breakIntoCharacterSpans; + function breakIntoWordSpans(identifier) { + return breakIntoSpans(identifier, true); + } + ts.breakIntoWordSpans = breakIntoWordSpans; + function breakIntoSpans(identifier, word) { + var result = []; + var wordStart = 0; + for (var i = 1, n = identifier.length; i < n; i++) { + var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); + var currentIsDigit = isDigit(identifier.charCodeAt(i)); + var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); + var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); + if (charIsPunctuation(identifier.charCodeAt(i - 1)) || + charIsPunctuation(identifier.charCodeAt(i)) || + lastIsDigit != currentIsDigit || + hasTransitionFromLowerToUpper || + hasTransitionFromUpperToLower) { + if (!isAllPunctuation(identifier, wordStart, i)) { + result.push(ts.createTextSpan(wordStart, i - wordStart)); + } + wordStart = i; + } + } + if (!isAllPunctuation(identifier, wordStart, identifier.length)) { + result.push(ts.createTextSpan(wordStart, identifier.length - wordStart)); + } + return result; + } + function charIsPunctuation(ch) { + switch (ch) { + case 33: + case 34: + case 35: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 44: + case 45: + case 46: + case 47: + case 58: + case 59: + case 63: + case 64: + case 91: + case 92: + case 93: + case 95: + case 123: + case 125: + return true; + } + return false; + } + function isAllPunctuation(identifier, start, end) { + for (var i = start; i < end; i++) { + var ch = identifier.charCodeAt(i); + if (!charIsPunctuation(ch) || ch === 95 || ch === 36) { + return false; + } + } + return true; + } + function transitionFromUpperToLower(identifier, word, index, wordStart) { + if (word) { + if (index != wordStart && + index + 1 < identifier.length) { + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); + if (currentIsUpper && nextIsLower) { + for (var i = wordStart; i < index; i++) { + if (!isUpperCaseLetter(identifier.charCodeAt(i))) { + return false; + } + } + return true; + } + } + } + return false; + } + function transitionFromLowerToUpper(identifier, word, index) { + var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + var transition = word ? (currentIsUpper && !lastIsUpper) : currentIsUpper; + return transition; + } +})(ts || (ts = {})); +var ts; (function (ts) { var SignatureHelp; (function (SignatureHelp) { @@ -21183,9 +22461,10 @@ var ts; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind === 151 || node.parent.kind === 152) { + if (node.parent.kind === 153 || node.parent.kind === 154) { var callExpression = node.parent; - if (node.kind === 24 || node.kind === 16) { + if (node.kind === 24 || + node.kind === 16) { var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; ts.Debug.assert(list !== undefined); @@ -21211,24 +22490,24 @@ var ts; }; } } - else if (node.kind === 10 && node.parent.kind === 153) { + else if (node.kind === 10 && node.parent.kind === 155) { if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, 0); } } - else if (node.kind === 11 && node.parent.parent.kind === 153) { + else if (node.kind === 11 && node.parent.parent.kind === 155) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 165); + ts.Debug.assert(templateExpression.kind === 167); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 169 && node.parent.parent.parent.kind === 153) { + else if (node.parent.kind === 171 && node.parent.parent.parent.kind === 155) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 165); - if (node.kind === 13 && position >= node.getEnd() && !node.isUnterminated) { + ts.Debug.assert(templateExpression.kind === 167); + if (node.kind === 13 && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } var spanIndex = templateExpression.templateSpans.indexOf(templateSpan); @@ -21269,7 +22548,7 @@ var ts; var template = taggedTemplate.template; var applicableSpanStart = template.getStart(); var applicableSpanEnd = template.getEnd(); - if (template.kind === 165) { + if (template.kind === 167) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); @@ -21278,7 +22557,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 207; n = n.parent) { + for (var n = node; n.kind !== 210; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -21332,18 +22611,24 @@ var ts; var typeParameters = candidateSignature.typeParameters; signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; suffixDisplayParts.push(ts.punctuationPart(25)); - var parameterParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation); }); + var parameterParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.parameters, writer, invocation); + }); suffixDisplayParts.push.apply(suffixDisplayParts, parameterParts); } else { - var typeParameterParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation); }); + var typeParameterParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildDisplayForTypeParametersAndDelimiters(candidateSignature.typeParameters, writer, invocation); + }); prefixDisplayParts.push.apply(prefixDisplayParts, typeParameterParts); prefixDisplayParts.push(ts.punctuationPart(16)); var parameters = candidateSignature.parameters; signatureHelpParameters = parameters.length > 0 ? ts.map(parameters, createSignatureHelpParameterForParameter) : emptyArray; suffixDisplayParts.push(ts.punctuationPart(17)); } - var returnTypeParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation); }); + var returnTypeParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildReturnTypeDisplay(candidateSignature, writer, invocation); + }); suffixDisplayParts.push.apply(suffixDisplayParts, returnTypeParts); return { isVariadic: candidateSignature.hasRestParameter, @@ -21368,7 +22653,9 @@ var ts; argumentCount: argumentCount }; function createSignatureHelpParameterForParameter(parameter) { - var displayParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation); }); + var displayParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation); + }); var isOptional = ts.hasQuestionToken(parameter.valueDeclaration); return { name: parameter.name, @@ -21378,7 +22665,9 @@ var ts; }; } function createSignatureHelpParameterForTypeParameter(typeParameter) { - var displayParts = ts.mapToDisplayParts(function (writer) { return typeInfoResolver.getSymbolDisplayBuilder().buildTypeParameterDisplay(typeParameter, writer, invocation); }); + var displayParts = ts.mapToDisplayParts(function (writer) { + return typeInfoResolver.getSymbolDisplayBuilder().buildTypeParameterDisplay(typeParameter, writer, invocation); + }); return { name: typeParameter.symbol.name, documentation: emptyArray, @@ -21394,10 +22683,10 @@ var ts; var ts; (function (ts) { function getEndLinePosition(line, sourceFile) { - ts.Debug.assert(line >= 1); + ts.Debug.assert(line >= 0); var lineStarts = sourceFile.getLineStarts(); - var lineIndex = line - 1; - if (lineIndex === lineStarts.length - 1) { + var lineIndex = line; + if (lineIndex + 1 === lineStarts.length) { return sourceFile.text.length - 1; } else { @@ -21411,17 +22700,12 @@ var ts; } } ts.getEndLinePosition = getEndLinePosition; - function getStartPositionOfLine(line, sourceFile) { - ts.Debug.assert(line >= 1); - return sourceFile.getLineStarts()[line - 1]; - } - ts.getStartPositionOfLine = getStartPositionOfLine; - function getStartLinePositionForPosition(position, sourceFile) { + function getLineStartPositionForPosition(position, sourceFile) { var lineStarts = sourceFile.getLineStarts(); - var line = sourceFile.getLineAndCharacterFromPosition(position).line; - return lineStarts[line - 1]; + var line = sourceFile.getLineAndCharacterOfPosition(position).line; + return lineStarts[line]; } - ts.getStartLinePositionForPosition = getStartLinePositionForPosition; + ts.getLineStartPositionForPosition = getLineStartPositionForPosition; function rangeContainsRange(r1, r2) { return startEndContainsRange(r1.pos, r1.end, r2); } @@ -21463,7 +22747,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 208 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 211 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -21529,7 +22813,8 @@ var ts; var children = n.getChildren(); for (var i = 0, len = children.length; i < len; ++i) { var child = children[i]; - var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos === previousToken.end); + var shouldDiveInChildNode = (child.pos <= previousToken.pos && child.end > previousToken.end) || + (child.pos === previousToken.end); if (shouldDiveInChildNode && nodeHasTokens(child)) { return find(child); } @@ -21567,7 +22852,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 207); + ts.Debug.assert(startNode !== undefined || n.kind === 210); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -21604,17 +22889,17 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 135 || node.kind === 151) { + if (node.kind === 137 || node.kind === 153) { return node.typeArguments; } - if (ts.isAnyFunction(node) || node.kind === 191 || node.kind === 192) { + if (ts.isAnyFunction(node) || node.kind === 194 || node.kind === 195) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 && n.kind <= 120; + return n.kind >= 0 && n.kind <= 122; } ts.isToken = isToken; function isWord(kind) { @@ -21655,7 +22940,7 @@ var ts; var ts; (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 124; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 126; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -21674,12 +22959,8 @@ var ts; writeParameter: function (text) { return writeKind(text, 13); }, writeSymbol: writeSymbol, writeLine: writeLine, - increaseIndent: function () { - indent++; - }, - decreaseIndent: function () { - indent--; - }, + increaseIndent: function () { indent++; }, + decreaseIndent: function () { indent--; }, clear: resetWriter, trackSymbol: function () { } }; @@ -21886,17 +23167,16 @@ var ts; } savedPos = scanner.getStartPos(); } - function shouldRescanGreaterThanToken(container) { - if (container.kind !== 163) { - return false; - } - switch (container.operator) { - case 27: - case 59: - case 60: - case 42: - case 41: - return true; + function shouldRescanGreaterThanToken(node) { + if (node) { + switch (node.kind) { + case 27: + case 59: + case 60: + case 42: + case 41: + return true; + } } return false; } @@ -21904,7 +23184,8 @@ var ts; return container.kind === 9; } function shouldRescanTemplateToken(container) { - return container.kind === 12 || container.kind === 13; + return container.kind === 12 || + container.kind === 13; } function startsWithSlashToken(t) { return t === 36 || t === 56; @@ -21929,7 +23210,7 @@ var ts; var currentToken = scanner.getToken(); if (expectedScanAction === 1 && currentToken === 25) { currentToken = scanner.reScanGreaterToken(); - ts.Debug.assert(n.operator === currentToken); + ts.Debug.assert(n.kind === currentToken); lastScanAction = 1; } else if (expectedScanAction === 2 && startsWithSlashToken(currentToken)) { @@ -22033,8 +23314,8 @@ var ts; }; FormattingContext.prototype.TokensAreOnSameLine = function () { if (this.tokensAreOnSameLine === undefined) { - var startLine = this.sourceFile.getLineAndCharacterFromPosition(this.currentTokenSpan.pos).line; - var endLine = this.sourceFile.getLineAndCharacterFromPosition(this.nextTokenSpan.pos).line; + var startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line; this.tokensAreOnSameLine = (startLine == endLine); } return this.tokensAreOnSameLine; @@ -22052,16 +23333,16 @@ var ts; return this.nextNodeBlockIsOnOneLine; }; FormattingContext.prototype.NodeIsOnOneLine = function (node) { - var startLine = this.sourceFile.getLineAndCharacterFromPosition(node.getStart(this.sourceFile)).line; - var endLine = this.sourceFile.getLineAndCharacterFromPosition(node.getEnd()).line; + var startLine = this.sourceFile.getLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line; return startLine == endLine; }; FormattingContext.prototype.BlockIsOnOneLine = function (node) { var openBrace = ts.findChildOfKind(node, 14, this.sourceFile); var closeBrace = ts.findChildOfKind(node, 15, this.sourceFile); if (openBrace && closeBrace) { - var startLine = this.sourceFile.getLineAndCharacterFromPosition(openBrace.getEnd()).line; - var endLine = this.sourceFile.getLineAndCharacterFromPosition(closeBrace.getStart(this.sourceFile)).line; + var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; return startLine === endLine; } return false; @@ -22097,7 +23378,9 @@ var ts; this.Flag = Flag; } Rule.prototype.toString = function () { - return "[desc=" + this.Descriptor + "," + "operation=" + this.Operation + "," + "flag=" + this.Flag + "]"; + return "[desc=" + this.Descriptor + "," + + "operation=" + this.Operation + "," + + "flag=" + this.Flag + "]"; }; return Rule; })(); @@ -22127,7 +23410,8 @@ var ts; this.RightTokenRange = RightTokenRange; } RuleDescriptor.prototype.toString = function () { - return "[leftRange=" + this.LeftTokenRange + "," + "rightRange=" + this.RightTokenRange + "]"; + return "[leftRange=" + this.LeftTokenRange + "," + + "rightRange=" + this.RightTokenRange + "]"; }; RuleDescriptor.create1 = function (left, right) { return RuleDescriptor.create4(formatting.Shared.TokenRange.FromToken(left), formatting.Shared.TokenRange.FromToken(right)); @@ -22167,7 +23451,8 @@ var ts; this.Action = null; } RuleOperation.prototype.toString = function () { - return "[context=" + this.Context + "," + "action=" + this.Action + "]"; + return "[context=" + this.Context + "," + + "action=" + this.Action + "]"; }; RuleOperation.create1 = function (action) { return RuleOperation.create2(formatting.RuleOperationContext.Any, action); @@ -22287,47 +23572,29 @@ var ts; this.NoSpaceBeforeCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 25), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceAfterCloseAngularBracket = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.FromTokens([16, 18, 25, 23])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsTypeArgumentOrParameterContext), 8)); this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(14, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8)); - this.HighPriorityCommonRules = [ - this.IgnoreBeforeComment, - this.IgnoreAfterLineComment, - this.NoSpaceBeforeColon, - this.SpaceAfterColon, - this.NoSpaceBeforeQMark, - this.SpaceAfterQMark, - this.NoSpaceBeforeDot, - this.NoSpaceAfterDot, + this.HighPriorityCommonRules = + [ + this.IgnoreBeforeComment, this.IgnoreAfterLineComment, + this.NoSpaceBeforeColon, this.SpaceAfterColon, this.NoSpaceBeforeQMark, this.SpaceAfterQMark, + this.NoSpaceBeforeDot, this.NoSpaceAfterDot, this.NoSpaceAfterUnaryPrefixOperator, - this.NoSpaceAfterUnaryPreincrementOperator, - this.NoSpaceAfterUnaryPredecrementOperator, - this.NoSpaceBeforeUnaryPostincrementOperator, - this.NoSpaceBeforeUnaryPostdecrementOperator, + this.NoSpaceAfterUnaryPreincrementOperator, this.NoSpaceAfterUnaryPredecrementOperator, + this.NoSpaceBeforeUnaryPostincrementOperator, this.NoSpaceBeforeUnaryPostdecrementOperator, this.SpaceAfterPostincrementWhenFollowedByAdd, - this.SpaceAfterAddWhenFollowedByUnaryPlus, - this.SpaceAfterAddWhenFollowedByPreincrement, + this.SpaceAfterAddWhenFollowedByUnaryPlus, this.SpaceAfterAddWhenFollowedByPreincrement, this.SpaceAfterPostdecrementWhenFollowedBySubtract, - this.SpaceAfterSubtractWhenFollowedByUnaryMinus, - this.SpaceAfterSubtractWhenFollowedByPredecrement, + this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement, this.NoSpaceAfterCloseBrace, - this.SpaceAfterOpenBrace, - this.SpaceBeforeCloseBrace, - this.NewLineBeforeCloseBraceInBlockContext, - this.SpaceAfterCloseBrace, - this.SpaceBetweenCloseBraceAndElse, - this.SpaceBetweenCloseBraceAndWhile, - this.NoSpaceBetweenEmptyBraceBrackets, - this.SpaceAfterFunctionInFuncDecl, - this.NewLineAfterOpenBraceInBlockContext, - this.SpaceAfterGetSetInMember, + this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext, + this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets, + this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember, this.NoSpaceBetweenReturnAndSemicolon, this.SpaceAfterCertainKeywords, this.NoSpaceBeforeOpenParenInFuncCall, - this.SpaceBeforeBinaryKeywordOperator, - this.SpaceAfterBinaryKeywordOperator, + this.SpaceBeforeBinaryKeywordOperator, this.SpaceAfterBinaryKeywordOperator, this.SpaceAfterVoidOperator, - this.NoSpaceAfterConstructor, - this.NoSpaceAfterModuleImport, - this.SpaceAfterCertainTypeScriptKeywords, - this.SpaceBeforeCertainTypeScriptKeywords, + this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport, + this.SpaceAfterCertainTypeScriptKeywords, this.SpaceBeforeCertainTypeScriptKeywords, this.SpaceAfterModuleName, this.SpaceAfterArrow, this.NoSpaceAfterEllipsis, @@ -22339,20 +23606,16 @@ var ts; this.NoSpaceBeforeCloseAngularBracket, this.NoSpaceAfterCloseAngularBracket ]; - this.LowPriorityCommonRules = [ + this.LowPriorityCommonRules = + [ this.NoSpaceBeforeSemicolon, - this.SpaceBeforeOpenBraceInControl, - this.SpaceBeforeOpenBraceInFunction, - this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, + this.SpaceBeforeOpenBraceInControl, this.SpaceBeforeOpenBraceInFunction, this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock, this.NoSpaceBeforeComma, - this.NoSpaceBeforeOpenBracket, - this.NoSpaceAfterOpenBracket, - this.NoSpaceBeforeCloseBracket, - this.NoSpaceAfterCloseBracket, + this.NoSpaceBeforeOpenBracket, this.NoSpaceAfterOpenBracket, + this.NoSpaceBeforeCloseBracket, this.NoSpaceAfterCloseBracket, this.SpaceAfterSemicolon, this.NoSpaceBeforeOpenParenInFuncDecl, - this.SpaceBetweenStatements, - this.SpaceAfterTryFinally + this.SpaceBetweenStatements, this.SpaceAfterTryFinally ]; this.SpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.NoSpaceAfterComma = new formatting.Rule(formatting.RuleDescriptor.create3(23, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); @@ -22385,25 +23648,27 @@ var ts; throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 177; + return context.contextNode.kind === 179; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 163: - case 164: + case 165: + case 166: return true; - case 197: - case 188: - case 124: - case 206: + case 200: + case 191: case 126: - case 125: + case 209: + case 128: + case 127: return context.currentTokenSpan.kind === 52 || context.nextTokenSpan.kind === 52; - case 178: + case 180: return context.currentTokenSpan.kind === 85 || context.nextTokenSpan.kind === 85; + case 181: + return context.currentTokenSpan.kind === 122 || context.nextTokenSpan.kind === 122; } return false; }; @@ -22433,26 +23698,26 @@ var ts; return true; } switch (node.kind) { - case 170: - case 183: - case 148: - case 196: + case 172: + case 186: + case 150: + case 199: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 190: - case 128: - case 127: + case 193: case 130: - case 131: - case 132: - case 156: case 129: - case 157: - case 192: + case 132: + case 133: + case 134: + case 158: + case 131: + case 159: + case 195: return true; } return false; @@ -22462,52 +23727,53 @@ var ts; }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 191: - case 192: case 194: - case 139: case 195: + case 197: + case 141: + case 198: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 191: - case 195: case 194: - case 170: - case 203: - case 196: - case 183: + case 198: + case 197: + case 172: + case 206: + case 199: + case 186: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 174: - case 183: - case 177: - case 178: case 176: case 186: - case 175: - case 182: - case 203: + case 179: + case 180: + case 181: + case 178: + case 189: + case 177: + case 185: + case 206: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 148; + return context.contextNode.kind === 150; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 151; + return context.contextNode.kind === 153; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 152; + return context.contextNode.kind === 154; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -22522,38 +23788,39 @@ var ts; return context.formattingRequestKind != 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 195; + return context.contextNode.kind === 198; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 139; + return context.contextNode.kind === 141; }; Rules.IsTypeArgumentOrParameter = function (token, parent) { if (token.kind !== 24 && token.kind !== 25) { return false; } switch (parent.kind) { + case 137: + case 194: + case 195: + case 193: + case 158: + case 159: + case 130: + case 129: + case 134: case 135: - case 191: - case 192: - case 190: - case 156: - case 157: - case 128: - case 127: - case 132: - case 133: - case 151: - case 152: + case 153: + case 154: return true; default: return false; } }; Rules.IsTypeArgumentOrParameterContext = function (context) { - return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); + return Rules.IsTypeArgumentOrParameter(context.currentTokenSpan, context.currentTokenParent) || + Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 98 && context.currentTokenParent.kind === 160; + return context.currentTokenSpan.kind === 98 && context.currentTokenParent.kind === 162; }; return Rules; })(); @@ -22575,7 +23842,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 120 + 1; + this.mapRowLength = 122 + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); var rulesBucketConstructionStateList = new Array(this.map.length); this.FillRules(rules, rulesBucketConstructionStateList); @@ -22593,7 +23860,8 @@ var ts; }; RulesMap.prototype.FillRule = function (rule, rulesBucketConstructionStateList) { var _this = this; - var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; + var specificRule = rule.Descriptor.LeftTokenRange != formatting.Shared.TokenRange.Any && + rule.Descriptor.RightTokenRange != formatting.Shared.TokenRange.Any; rule.Descriptor.LeftTokenRange.GetTokens().forEach(function (left) { rule.Descriptor.RightTokenRange.GetTokens().forEach(function (right) { var rulesBucketIndex = _this.GetRuleBucketIndex(left, right); @@ -22743,7 +24011,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0; token <= 120; token++) { + for (var token = 0; token <= 122; token++) { result.push(token); } return result; @@ -22785,9 +24053,9 @@ var ts; }; TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); - TokenRange.Keywords = TokenRange.FromRange(65, 120); + TokenRange.Keywords = TokenRange.FromRange(65, 122); TokenRange.BinaryOperators = TokenRange.FromRange(24, 63); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([85, 86]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([85, 86, 122]); TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([38, 39, 47, 46]); TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([7, 64, 16, 18, 14, 92, 87]); TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); @@ -22795,7 +24063,7 @@ var ts; TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([64, 16, 92, 87]); TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([64, 17, 19, 87]); TokenRange.Comments = TokenRange.FromTokens([2, 3]); - TokenRange.TypeNames = TokenRange.FromTokens([64, 117, 119, 111, 98, 110]); + TokenRange.TypeNames = TokenRange.FromTokens([64, 117, 119, 111, 120, 98, 110]); return TokenRange; })(); Shared.TokenRange = TokenRange; @@ -22896,8 +24164,8 @@ var ts; Constants[Constants["Unknown"] = -1] = "Unknown"; })(Constants || (Constants = {})); function formatOnEnter(position, sourceFile, rulesProvider, options) { - var line = sourceFile.getLineAndCharacterFromPosition(position).line; - if (line === 1) { + var line = sourceFile.getLineAndCharacterOfPosition(position).line; + if (line === 0) { return []; } var span = { @@ -22925,7 +24193,7 @@ var ts; formatting.formatDocument = formatDocument; function formatSelection(start, end, sourceFile, rulesProvider, options) { var span = { - pos: ts.getStartLinePositionForPosition(start, sourceFile), + pos: ts.getLineStartPositionForPosition(start, sourceFile), end: end }; return formatSpan(span, sourceFile, options, rulesProvider, 1); @@ -22937,35 +24205,40 @@ var ts; return []; } var span = { - pos: ts.getStartLinePositionForPosition(parent.getStart(sourceFile), sourceFile), + pos: ts.getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile), end: parent.end }; return formatSpan(span, sourceFile, options, rulesProvider, requestKind); } function findOutermostParent(position, expectedTokenKind, sourceFile) { var precedingToken = ts.findPrecedingToken(position, sourceFile); - if (!precedingToken || precedingToken.kind !== expectedTokenKind || position !== precedingToken.getEnd()) { + if (!precedingToken || + precedingToken.kind !== expectedTokenKind || + position !== precedingToken.getEnd()) { return undefined; } var current = precedingToken; - while (current && current.parent && current.parent.end === precedingToken.end && !isListElement(current.parent, current)) { + while (current && + current.parent && + current.parent.end === precedingToken.end && + !isListElement(current.parent, current)) { current = current.parent; } return current; } function isListElement(parent, node) { switch (parent.kind) { - case 191: - case 192: - return ts.rangeContainsRange(parent.members, node); + case 194: case 195: + return ts.rangeContainsRange(parent.members, node); + case 198: var body = parent.body; - return body && body.kind === 170 && ts.rangeContainsRange(body.statements, node); - case 207: - case 170: - case 196: + return body && body.kind === 172 && ts.rangeContainsRange(body.statements, node); + case 210: + case 172: + case 199: return ts.rangeContainsRange(parent.statements, node); - case 203: + case 206: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -23029,7 +24302,7 @@ var ts; var previousLine = -1; var childKind = 0; while (n) { - var line = sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)).line; + var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; if (previousLine !== -1 && line !== previousLine) { break; } @@ -23055,7 +24328,7 @@ var ts; var edits = []; formattingScanner.advance(); if (formattingScanner.isOnToken()) { - var startLine = sourceFile.getLineAndCharacterFromPosition(enclosingNode.getStart(sourceFile)).line; + var startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line; var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); processNode(enclosingNode, enclosingNode, startLine, initialIndentation, delta); } @@ -23068,8 +24341,8 @@ var ts; } } else { - var startLine = sourceFile.getLineAndCharacterFromPosition(startPos).line; - var startLinePosition = ts.getStartLinePositionForPosition(startPos, sourceFile); + var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line; + var startLinePosition = ts.getLineStartPositionForPosition(startPos, sourceFile); var column = formatting.SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); if (startLine !== parentStartLine || startPos === column) { return column; @@ -23081,7 +24354,10 @@ var ts; var indentation = inheritedIndentation; if (indentation === -1) { if (isSomeBlock(node.kind)) { - if (isSomeBlock(parent.kind) || parent.kind === 207 || parent.kind === 200 || parent.kind === 201) { + if (isSomeBlock(parent.kind) || + parent.kind === 210 || + parent.kind === 203 || + parent.kind === 204) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -23170,7 +24446,7 @@ var ts; } function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, isListItem) { var childStartPos = child.getStart(sourceFile); - var childStart = sourceFile.getLineAndCharacterFromPosition(childStartPos); + var childStart = sourceFile.getLineAndCharacterOfPosition(childStartPos); var childIndentationAmount = -1; if (isListItem) { childIndentationAmount = tryComputeIndentationForListItem(childStartPos, child.end, parentStartLine, originalRange, inheritedIndentation); @@ -23217,7 +24493,7 @@ var ts; break; } else if (tokenInfo.token.kind === listStartToken) { - startLine = sourceFile.getLineAndCharacterFromPosition(tokenInfo.token.pos).line; + startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; var indentation = computeIndentation(tokenInfo.token, startLine, -1, parent, parentDynamicIndentation, startLine); listDynamicIndentation = getDynamicIndentation(parent, parentStartLine, indentation.indentation, indentation.delta); consumeTokenAndAdvanceScanner(tokenInfo, parent, listDynamicIndentation); @@ -23249,7 +24525,7 @@ var ts; } var lineAdded; var isTokenInRange = ts.rangeContainsRange(originalRange, currentTokenInfo.token); - var tokenStart = sourceFile.getLineAndCharacterFromPosition(currentTokenInfo.token.pos); + var tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos); if (isTokenInRange) { var rangeHasError = rangeContainsError(currentTokenInfo.token); var prevStartLine = previousRangeStartLine; @@ -23277,7 +24553,7 @@ var ts; if (!ts.rangeContainsRange(originalRange, triviaItem)) { continue; } - var triviaStartLine = sourceFile.getLineAndCharacterFromPosition(triviaItem.pos).line; + var triviaStartLine = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos).line; switch (triviaItem.kind) { case 3: var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); @@ -23310,7 +24586,7 @@ var ts; for (var i = 0, len = trivia.length; i < len; ++i) { var triviaItem = trivia[i]; if (ts.isComment(triviaItem.kind) && ts.rangeContainsRange(originalRange, triviaItem)) { - var triviaItemStart = sourceFile.getLineAndCharacterFromPosition(triviaItem.pos); + var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); } } @@ -23320,11 +24596,12 @@ var ts; var lineAdded; if (!rangeHasError && !previousRangeHasError) { if (!previousRange) { - var originalStart = sourceFile.getLineAndCharacterFromPosition(originalRange.pos); + var originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos); trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); } else { - lineAdded = processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); + lineAdded = + processPair(range, rangeStart.line, parent, previousRange, previousRangeStartLine, previousParent, contextNode, dynamicIndentation); } } previousRange = range; @@ -23352,7 +24629,9 @@ var ts; dynamicIndentation.recomputeIndentation(true); } } - trimTrailingWhitespaces = (rule.Operation.Action & (4 | 2)) && rule.Flag !== 1; + trimTrailingWhitespaces = + (rule.Operation.Action & (4 | 2)) && + rule.Flag !== 1; } else { trimTrailingWhitespaces = true; @@ -23368,16 +24647,16 @@ var ts; recordReplace(pos, 0, indentationString); } else { - var tokenStart = sourceFile.getLineAndCharacterFromPosition(pos); - if (indentation !== tokenStart.character - 1) { + var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); + if (indentation !== tokenStart.character) { var startLinePosition = ts.getStartPositionOfLine(tokenStart.line, sourceFile); - recordReplace(startLinePosition, tokenStart.character - 1, indentationString); + recordReplace(startLinePosition, tokenStart.character, indentationString); } } } function indentMultilineComment(commentRange, indentation, firstLineIsIndented) { - var startLine = sourceFile.getLineAndCharacterFromPosition(commentRange.pos).line; - var endLine = sourceFile.getLineAndCharacterFromPosition(commentRange.end).line; + var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; if (startLine === endLine) { if (!firstLineIsIndented) { insertIndentation(commentRange.pos, indentation, false); @@ -23481,20 +24760,20 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 170: - case 196: + case 172: + case 199: return true; } return false; } function getOpenTokenForList(node, list) { switch (node.kind) { + case 131: + case 193: + case 158: + case 130: case 129: - case 190: - case 156: - case 128: - case 127: - case 157: + case 159: if (node.typeParameters === list) { return 24; } @@ -23502,8 +24781,8 @@ var ts; return 16; } break; - case 151: - case 152: + case 153: + case 154: if (node.typeArguments === list) { return 24; } @@ -23511,7 +24790,7 @@ var ts; return 16; } break; - case 135: + case 137: if (node.typeArguments === list) { return 24; } @@ -23586,12 +24865,17 @@ var ts; if (!precedingToken) { return 0; } - var precedingTokenIsLiteral = precedingToken.kind === 8 || precedingToken.kind === 9 || precedingToken.kind === 10 || precedingToken.kind === 11 || precedingToken.kind === 12 || precedingToken.kind === 13; + var precedingTokenIsLiteral = precedingToken.kind === 8 || + precedingToken.kind === 9 || + precedingToken.kind === 10 || + precedingToken.kind === 11 || + precedingToken.kind === 12 || + precedingToken.kind === 13; if (precedingTokenIsLiteral && precedingToken.getStart(sourceFile) <= position && precedingToken.end > position) { return 0; } - var lineAtPosition = sourceFile.getLineAndCharacterFromPosition(position).line; - if (precedingToken.kind === 23 && precedingToken.parent.kind !== 163) { + var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; + if (precedingToken.kind === 23 && precedingToken.parent.kind !== 165) { var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1) { return actualIndentation; @@ -23626,7 +24910,7 @@ var ts; } SmartIndenter.getIndentation = getIndentation; function getIndentationForNode(n, ignoreActualIndentationRange, sourceFile, options) { - var start = sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)); + var start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, 0, sourceFile, options); } SmartIndenter.getIndentationForNode = getIndentationForNode; @@ -23646,7 +24930,8 @@ var ts; } } parentStart = getParentStart(parent, current, sourceFile); - var parentAndChildShareLine = parentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); + var parentAndChildShareLine = parentStart.line === currentStart.line || + childStartsOnTheSameLineWithElseInIfStatement(parent, current, currentStart.line, sourceFile); if (useActualIndentation) { var actualIndentation = getActualIndentationForNode(current, parent, currentStart, parentAndChildShareLine, sourceFile, options); if (actualIndentation !== -1) { @@ -23665,9 +24950,9 @@ var ts; function getParentStart(parent, child, sourceFile) { var containingList = getContainingList(child, sourceFile); if (containingList) { - return sourceFile.getLineAndCharacterFromPosition(containingList.pos); + return sourceFile.getLineAndCharacterOfPosition(containingList.pos); } - return sourceFile.getLineAndCharacterFromPosition(parent.getStart(sourceFile)); + return sourceFile.getLineAndCharacterOfPosition(parent.getStart(sourceFile)); } function getActualIndentationForListItemBeforeComma(commaToken, sourceFile, options) { var commaItemInfo = ts.findListItemInfo(commaToken); @@ -23675,7 +24960,8 @@ var ts; return deriveActualIndentationFromList(commaItemInfo.list.getChildren(), commaItemInfo.listItemIndex - 1, sourceFile, options); } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { - var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && (parent.kind === 207 || !parentAndChildShareLine); + var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && + (parent.kind === 210 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -23696,13 +24982,13 @@ var ts; return false; } function getStartLineAndCharacterForNode(n, sourceFile) { - return sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)); + return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function positionBelongsToNode(candidate, position, sourceFile) { return candidate.end > position || !isCompletedNode(candidate, sourceFile); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 174 && parent.elseStatement === child) { + if (parent.kind === 176 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 75, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -23714,37 +25000,41 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 135: - if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { + case 137: + if (node.parent.typeArguments && + ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 148: + case 150: return node.parent.properties; - case 147: + case 149: return node.parent.elements; - case 190: - case 156: - case 157: - case 128: - case 127: - case 132: - case 133: + case 193: + case 158: + case 159: + case 130: + case 129: + case 134: + case 135: var start = node.getStart(sourceFile); - if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { + if (node.parent.typeParameters && + ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { return node.parent.typeParameters; } if (ts.rangeContainsStartEnd(node.parent.parameters, start, node.getEnd())) { return node.parent.parameters; } break; - case 152: - case 151: + case 154: + case 153: var start = node.getStart(sourceFile); - if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { + if (node.parent.typeArguments && + ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { return node.parent.typeArguments; } - if (node.parent.arguments && ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { + if (node.parent.arguments && + ts.rangeContainsStartEnd(node.parent.arguments, start, node.getEnd())) { return node.parent.arguments; } break; @@ -23768,7 +25058,7 @@ var ts; if (list[i].kind === 23) { continue; } - var prevEndLine = sourceFile.getLineAndCharacterFromPosition(list[i].end).line; + var prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line; if (prevEndLine !== lineAndCharacter.line) { return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); } @@ -23777,7 +25067,7 @@ var ts; return -1; } function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options) { - var lineStart = sourceFile.getPositionFromLineAndCharacter(lineAndCharacter.line, 1); + var lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0); return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options); } function findFirstNonWhitespaceColumn(startPos, endPos, sourceFile, options) { @@ -23799,25 +25089,25 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 191: - case 192: case 194: - case 147: - case 170: - case 196: - case 148: - case 139: - case 183: + case 195: + case 197: + case 149: + case 172: + case 199: + case 150: + case 141: + case 186: + case 204: + case 203: + case 157: + case 153: + case 154: + case 173: + case 191: case 201: - case 200: - case 155: - case 151: - case 152: - case 171: - case 188: - case 198: - case 181: - case 164: + case 184: + case 166: return true; } return false; @@ -23827,20 +25117,21 @@ var ts; return true; } switch (parent) { - case 175: - case 176: - case 178: case 177: - case 174: - case 190: - case 156: - case 128: - case 127: - case 157: - case 129: + case 178: + case 180: + case 181: + case 179: + case 176: + case 193: + case 158: case 130: + case 129: + case 159: case 131: - return child !== 170; + case 132: + case 133: + return child !== 172; default: return false; } @@ -23864,44 +25155,44 @@ var ts; return false; } switch (n.kind) { - case 191: - case 192: case 194: - case 148: - case 170: - case 196: - case 183: - return nodeEndsWith(n, 15, sourceFile); - case 203: - return isCompletedNode(n.block, sourceFile); - case 155: - case 132: - case 151: - case 133: - return nodeEndsWith(n, 17, sourceFile); - case 190: - case 156: - case 128: - case 127: - case 157: - return !n.body || isCompletedNode(n.body, sourceFile); case 195: + case 197: + case 150: + case 172: + case 199: + case 186: + return nodeEndsWith(n, 15, sourceFile); + case 206: + return isCompletedNode(n.block, sourceFile); + case 157: + case 134: + case 153: + case 135: + return nodeEndsWith(n, 17, sourceFile); + case 193: + case 158: + case 130: + case 129: + case 159: + return !n.body || isCompletedNode(n.body, sourceFile); + case 198: return n.body && isCompletedNode(n.body, sourceFile); - case 174: + case 176: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 173: - return isCompletedNode(n.expression, sourceFile); - case 147: - return nodeEndsWith(n, 19, sourceFile); - case 200: - case 201: - return false; - case 176: - return isCompletedNode(n.statement, sourceFile); case 175: + return isCompletedNode(n.expression, sourceFile); + case 149: + return nodeEndsWith(n, 19, sourceFile); + case 203: + case 204: + return false; + case 178: + return isCompletedNode(n.statement, sourceFile); + case 177: var hasWhileKeyword = ts.findChildOfKind(n, 99, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 17, sourceFile); @@ -23997,7 +25288,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(208, nodes.pos, nodes.end, 512, this); + var list = createNode(211, nodes.pos, nodes.end, 512, this); list._children = []; var pos = nodes.pos; for (var i = 0, len = nodes.length; i < len; i++) { @@ -24015,7 +25306,7 @@ var ts; }; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; - if (this.kind >= 121) { + if (this.kind >= 123) { scanner.setText((sourceFile || this.getSourceFile()).text); var children = []; var pos = this.pos; @@ -24060,7 +25351,7 @@ var ts; var children = this.getChildren(); for (var i = 0; i < children.length; i++) { var child = children[i]; - if (child.kind < 121) { + if (child.kind < 123) { return child; } return child.getFirstToken(sourceFile); @@ -24070,7 +25361,7 @@ var ts; var children = this.getChildren(sourceFile); for (var i = children.length - 1; i >= 0; i--) { var child = children[i]; - if (child.kind < 121) { + if (child.kind < 123) { return child; } return child.getLastToken(sourceFile); @@ -24116,7 +25407,7 @@ var ts; ts.forEach(declarations, function (declaration, indexOfDeclaration) { if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); - if (canUseParsedParamTagComments && declaration.kind === 124) { + if (canUseParsedParamTagComments && declaration.kind === 126) { ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedParamJsDocComment) { @@ -24124,13 +25415,13 @@ var ts; } }); } - if (declaration.kind === 195 && declaration.body.kind === 195) { + if (declaration.kind === 198 && declaration.body.kind === 198) { return; } - while (declaration.kind === 195 && declaration.parent.kind === 195) { + while (declaration.kind === 198 && declaration.parent.kind === 198) { declaration = declaration.parent; } - ts.forEach(getJsDocCommentTextRange(declaration.kind === 188 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 191 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); @@ -24166,7 +25457,10 @@ var ts; return pos; } function isName(pos, end, sourceFile, name) { - return pos + name.length < end && sourceFile.text.substr(pos, name.length) === name && (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); + return pos + name.length < end && + sourceFile.text.substr(pos, name.length) === name && + (ts.isWhiteSpace(sourceFile.text.charCodeAt(pos + name.length)) || + ts.isLineBreak(sourceFile.text.charCodeAt(pos + name.length))); } function isParamTag(pos, end, sourceFile) { return isName(pos, end, sourceFile, paramTag); @@ -24312,7 +25606,7 @@ var ts; return; } if (paramHelpStringMargin === undefined) { - paramHelpStringMargin = sourceFile.getLineAndCharacterFromPosition(firstLineParamHelpStringPos).character - 1; + paramHelpStringMargin = sourceFile.getLineAndCharacterOfPosition(firstLineParamHelpStringPos).character; } var startOfLinePos = pos; pos = consumeWhiteSpacesOnTheLine(pos, end, sourceFile, paramHelpStringMargin); @@ -24396,14 +25690,14 @@ var ts; SourceFileObject.prototype.update = function (newText, textChangeRange) { return ts.updateSourceFile(this, newText, textChangeRange); }; - SourceFileObject.prototype.getLineAndCharacterFromPosition = function (position) { + SourceFileObject.prototype.getLineAndCharacterOfPosition = function (position) { return ts.getLineAndCharacterOfPosition(this, position); }; SourceFileObject.prototype.getLineStarts = function () { return ts.getLineStarts(this); }; - SourceFileObject.prototype.getPositionFromLineAndCharacter = function (line, character) { - return ts.getPositionFromLineAndCharacter(this, line, character); + SourceFileObject.prototype.getPositionOfLineAndCharacter = function (line, character) { + return ts.getPositionOfLineAndCharacter(this, line, character); }; SourceFileObject.prototype.getNamedDeclarations = function () { if (!this.namedDeclarations) { @@ -24411,9 +25705,9 @@ var ts; var namedDeclarations = []; ts.forEachChild(sourceFile, function visit(node) { switch (node.kind) { - case 190: - case 128: - case 127: + case 193: + case 130: + case 129: var functionDeclaration = node; if (functionDeclaration.name && functionDeclaration.name.getFullWidth() > 0) { var lastDeclaration = namedDeclarations.length > 0 ? namedDeclarations[namedDeclarations.length - 1] : undefined; @@ -24428,44 +25722,44 @@ var ts; ts.forEachChild(node, visit); } break; - case 191: - case 192: - case 193: case 194: case 195: + case 196: case 197: - case 130: - case 131: - case 139: + case 198: + case 200: + case 132: + case 133: + case 141: if (node.name) { namedDeclarations.push(node); } - case 129: - case 171: - case 189: - case 144: - case 145: - case 196: + case 131: + case 173: + case 192: + case 146: + case 147: + case 199: ts.forEachChild(node, visit); break; - case 170: + case 172: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } break; - case 124: + case 126: if (!(node.flags & 112)) { break; } - case 188: - case 146: + case 191: + case 148: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 206: - case 126: - case 125: + case 209: + case 128: + case 127: namedDeclarations.push(node); break; } @@ -24518,6 +25812,9 @@ var ts; EndOfLineState[EndOfLineState["InMultiLineCommentTrivia"] = 1] = "InMultiLineCommentTrivia"; EndOfLineState[EndOfLineState["InSingleQuoteStringLiteral"] = 2] = "InSingleQuoteStringLiteral"; EndOfLineState[EndOfLineState["InDoubleQuoteStringLiteral"] = 3] = "InDoubleQuoteStringLiteral"; + EndOfLineState[EndOfLineState["InTemplateHeadOrNoSubstitutionTemplate"] = 4] = "InTemplateHeadOrNoSubstitutionTemplate"; + EndOfLineState[EndOfLineState["InTemplateMiddleOrTail"] = 5] = "InTemplateMiddleOrTail"; + EndOfLineState[EndOfLineState["InTemplateSubstitutionPosition"] = 6] = "InTemplateSubstitutionPosition"; })(ts.EndOfLineState || (ts.EndOfLineState = {})); var EndOfLineState = ts.EndOfLineState; (function (TokenClass) { @@ -24599,13 +25896,6 @@ var ts; return ClassificationTypeNames; })(); ts.ClassificationTypeNames = ClassificationTypeNames; - var MatchKind; - (function (MatchKind) { - MatchKind[MatchKind["none"] = 0] = "none"; - MatchKind[MatchKind["exact"] = 1] = "exact"; - MatchKind[MatchKind["substring"] = 2] = "substring"; - MatchKind[MatchKind["prefix"] = 3] = "prefix"; - })(MatchKind || (MatchKind = {})); function displayPartsToString(displayParts) { if (displayParts) { return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join(""); @@ -24618,14 +25908,14 @@ var ts; return false; } return ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 156) { + if (declaration.kind === 158) { return true; } - if (declaration.kind !== 188 && declaration.kind !== 190) { + if (declaration.kind !== 191 && declaration.kind !== 193) { return false; } for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { - if (parent.kind === 207 || parent.kind === 196) { + if (parent.kind === 210 || parent.kind === 199) { return false; } } @@ -24930,7 +26220,7 @@ var ts; ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 184 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 187 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -24938,13 +26228,17 @@ var ts; return undefined; } function isJumpStatementTarget(node) { - return node.kind === 64 && (node.parent.kind === 180 || node.parent.kind === 179) && node.parent.label === node; + return node.kind === 64 && + (node.parent.kind === 183 || node.parent.kind === 182) && + node.parent.label === node; } function isLabelOfLabeledStatement(node) { - return node.kind === 64 && node.parent.kind === 184 && node.parent.label === node; + return node.kind === 64 && + node.parent.kind === 187 && + node.parent.label === node; } function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 184; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 187; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -24955,46 +26249,48 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 121 && node.parent.right === node; + return node.parent.kind === 123 && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 149 && node.parent.name === node; + return node && node.parent && node.parent.kind === 151 && node.parent.name === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 151 && node.parent.expression === node; + return node && node.parent && node.parent.kind === 153 && node.parent.expression === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 152 && node.parent.expression === node; + return node && node.parent && node.parent.kind === 154 && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 195 && node.parent.name === node; + return node.parent.kind === 198 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { - return node.kind === 64 && ts.isAnyFunction(node.parent) && node.parent.name === node; + return node.kind === 64 && + ts.isAnyFunction(node.parent) && node.parent.name === node; } function isNameOfPropertyAssignment(node) { - return (node.kind === 64 || node.kind === 8 || node.kind === 7) && (node.parent.kind === 204 || node.parent.kind === 205) && node.parent.name === node; + return (node.kind === 64 || node.kind === 8 || node.kind === 7) && + (node.parent.kind === 207 || node.parent.kind === 208) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 8 || node.kind === 7) { switch (node.parent.kind) { - case 126: - case 125: - case 204: - case 206: case 128: case 127: + case 207: + case 209: case 130: - case 131: - case 195: + case 129: + case 132: + case 133: + case 198: return node.parent.name === node; - case 150: + case 152: return node.parent.argumentExpression === node; } } @@ -25002,12 +26298,15 @@ var ts; } function isNameOfExternalModuleImportOrDeclaration(node) { if (node.kind === 8) { - return isNameOfModuleDeclaration(node) || (ts.isExternalModuleImportDeclaration(node.parent.parent) && ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node); + return isNameOfModuleDeclaration(node) || + (ts.isExternalModuleImportDeclaration(node.parent.parent) && ts.getExternalModuleImportDeclarationExpression(node.parent.parent) === node); } return false; } function isInsideComment(sourceFile, token, position) { - return position <= token.getStart(sourceFile) && (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); + return position <= token.getStart(sourceFile) && + (isInsideCommentRange(ts.getTrailingCommentRanges(sourceFile.text, token.getFullStart())) || + isInsideCommentRange(ts.getLeadingCommentRanges(sourceFile.text, token.getFullStart()))); function isInsideCommentRange(comments) { return ts.forEach(comments, function (comment) { if (comment.pos < position && position < comment.end) { @@ -25020,7 +26319,8 @@ var ts; return true; } else { - return !(text.charCodeAt(comment.end - 1) === 47 && text.charCodeAt(comment.end - 2) === 42); + return !(text.charCodeAt(comment.end - 1) === 47 && + text.charCodeAt(comment.end - 2) === 42); } } return false; @@ -25043,13 +26343,65 @@ var ts; BreakContinueSearchType[BreakContinueSearchType["All"] = 3] = "All"; })(BreakContinueSearchType || (BreakContinueSearchType = {})); var keywordCompletions = []; - for (var i = 65; i <= 120; i++) { + for (var i = 65; i <= 122; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ScriptElementKind.keyword, kindModifiers: ScriptElementKindModifier.none }); } + function getContainerNode(node) { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case 210: + case 130: + case 129: + case 193: + case 158: + case 132: + case 133: + case 194: + case 195: + case 197: + case 198: + return node; + } + } + } + ts.getContainerNode = getContainerNode; + function getNodeKind(node) { + switch (node.kind) { + case 198: return ScriptElementKind.moduleElement; + case 194: return ScriptElementKind.classElement; + case 195: return ScriptElementKind.interfaceElement; + case 196: return ScriptElementKind.typeElement; + case 197: return ScriptElementKind.enumElement; + case 191: + return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; + case 193: return ScriptElementKind.functionElement; + case 132: return ScriptElementKind.memberGetAccessorElement; + case 133: return ScriptElementKind.memberSetAccessorElement; + case 130: + case 129: + return ScriptElementKind.memberFunctionElement; + case 128: + case 127: + return ScriptElementKind.memberVariableElement; + case 136: return ScriptElementKind.indexSignatureElement; + case 135: return ScriptElementKind.constructSignatureElement; + case 134: return ScriptElementKind.callSignatureElement; + case 131: return ScriptElementKind.constructorImplementationElement; + case 125: return ScriptElementKind.typeParameterElement; + case 209: return ScriptElementKind.variableElement; + case 126: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + } + return ScriptElementKind.unknown; + } + ts.getNodeKind = getNodeKind; function createLanguageService(host, documentRegistry) { if (documentRegistry === void 0) { documentRegistry = createDocumentRegistry(); } var syntaxTreeCache = new SyntaxTreeCache(host); @@ -25161,9 +26513,7 @@ var ts; } function dispose() { if (program) { - ts.forEach(program.getSourceFiles(), function (f) { - documentRegistry.releaseDocument(f.fileName, program.getCompilerOptions()); - }); + ts.forEach(program.getSourceFiles(), function (f) { documentRegistry.releaseDocument(f.fileName, program.getCompilerOptions()); }); } } function getSyntacticDiagnostics(fileName) { @@ -25193,7 +26543,8 @@ var ts; if ((symbol.flags & 1536) && (firstCharCode === 39 || firstCharCode === 34)) { return undefined; } - if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && (firstCharCode === 39 || firstCharCode === 34)) { + if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) && + (firstCharCode === 39 || firstCharCode === 34)) { displayName = displayName.substring(1, displayName.length - 1); } var isValid = ts.isIdentifierStart(displayName.charCodeAt(0), target); @@ -25246,11 +26597,11 @@ var ts; } var node; var isRightOfDot; - if (previousToken && previousToken.kind === 20 && previousToken.parent.kind === 149) { + if (previousToken && previousToken.kind === 20 && previousToken.parent.kind === 151) { node = previousToken.parent.expression; isRightOfDot = true; } - else if (previousToken && previousToken.kind === 20 && previousToken.parent.kind === 121) { + else if (previousToken && previousToken.kind === 20 && previousToken.parent.kind === 123) { node = previousToken.parent.left; isRightOfDot = true; } @@ -25272,7 +26623,7 @@ var ts; var symbols = []; var isMemberCompletion = true; var isNewIdentifierLocation = false; - if (node.kind === 64 || node.kind === 121 || node.kind === 149) { + if (node.kind === 64 || node.kind === 123 || node.kind === 151) { var symbol = typeInfoResolver.getSymbolAtLocation(node); if (symbol && symbol.flags & 8388608) { symbol = typeInfoResolver.getAliasedSymbol(symbol); @@ -25344,7 +26695,9 @@ var ts; } function isCompletionListBlocker(previousToken) { var start = new Date().getTime(); - var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || isIdentifierDefinitionLocation(previousToken) || isRightOfIllegalDot(previousToken); + var result = isInStringOrRegularExpressionOrTemplateLiteral(previousToken) || + isIdentifierDefinitionLocation(previousToken) || + isRightOfIllegalDot(previousToken); log("getCompletionsAtPosition: isCompletionListBlocker: " + (new Date().getTime() - start)); return result; } @@ -25353,27 +26706,27 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 151 || containingNodeKind === 129 || containingNodeKind === 152 || containingNodeKind === 147 || containingNodeKind === 163; + return containingNodeKind === 153 || containingNodeKind === 131 || containingNodeKind === 154 || containingNodeKind === 149 || containingNodeKind === 165; case 16: - return containingNodeKind === 151 || containingNodeKind === 129 || containingNodeKind === 152 || containingNodeKind === 155; + return containingNodeKind === 153 || containingNodeKind === 131 || containingNodeKind === 154 || containingNodeKind === 157; case 18: - return containingNodeKind === 147; + return containingNodeKind === 149; case 115: return true; case 20: - return containingNodeKind === 195; + return containingNodeKind === 198; case 14: - return containingNodeKind === 191; + return containingNodeKind === 194; case 52: - return containingNodeKind === 188 || containingNodeKind === 163; + return containingNodeKind === 191 || containingNodeKind === 165; case 11: - return containingNodeKind === 165; + return containingNodeKind === 167; case 12: - return containingNodeKind === 169; + return containingNodeKind === 171; case 107: case 105: case 106: - return containingNodeKind === 126; + return containingNodeKind === 128; } switch (previousToken.getText()) { case "public": @@ -25403,7 +26756,7 @@ var ts; switch (previousToken.kind) { case 14: case 23: - if (parent && parent.kind === 148) { + if (parent && parent.kind === 150) { return parent; } break; @@ -25413,16 +26766,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 156: - case 157: - case 190: - case 128: - case 127: + case 158: + case 159: + case 193: case 130: - case 131: + case 129: case 132: case 133: case 134: + case 135: + case 136: return true; } return false; @@ -25432,27 +26785,47 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 188 || containingNodeKind === 189 || containingNodeKind === 171 || containingNodeKind === 194 || isFunction(containingNodeKind) || containingNodeKind === 191 || containingNodeKind === 190 || containingNodeKind === 192 || containingNodeKind === 145 || containingNodeKind === 144; + return containingNodeKind === 191 || + containingNodeKind === 192 || + containingNodeKind === 173 || + containingNodeKind === 197 || + isFunction(containingNodeKind) || + containingNodeKind === 194 || + containingNodeKind === 193 || + containingNodeKind === 195 || + containingNodeKind === 147 || + containingNodeKind === 146; case 20: - return containingNodeKind === 145; + return containingNodeKind === 147; case 18: - return containingNodeKind === 145; + return containingNodeKind === 147; case 16: - return containingNodeKind === 203 || isFunction(containingNodeKind); + return containingNodeKind === 206 || + isFunction(containingNodeKind); case 14: - return containingNodeKind === 194 || containingNodeKind === 192 || containingNodeKind === 139 || containingNodeKind === 144; + return containingNodeKind === 197 || + containingNodeKind === 195 || + containingNodeKind === 141 || + containingNodeKind === 146; case 22: - return containingNodeKind === 125 && (previousToken.parent.parent.kind === 192 || previousToken.parent.parent.kind === 139); + return containingNodeKind === 127 && + (previousToken.parent.parent.kind === 195 || + previousToken.parent.parent.kind === 141); case 24: - return containingNodeKind === 191 || containingNodeKind === 190 || containingNodeKind === 192 || isFunction(containingNodeKind); + return containingNodeKind === 194 || + containingNodeKind === 193 || + containingNodeKind === 195 || + isFunction(containingNodeKind); case 108: - return containingNodeKind === 126; + return containingNodeKind === 128; case 21: - return containingNodeKind === 124 || containingNodeKind === 129 || (previousToken.parent.parent.kind === 145); + return containingNodeKind === 126 || + containingNodeKind === 131 || + (previousToken.parent.parent.kind === 147); case 107: case 105: case 106: - return containingNodeKind === 124; + return containingNodeKind === 126; case 68: case 76: case 102: @@ -25494,7 +26867,7 @@ var ts; } var existingMemberNames = {}; ts.forEach(existingMembers, function (m) { - if (m.kind !== 204 && m.kind !== 205) { + if (m.kind !== 207 && m.kind !== 208) { return; } if (m.getStart() <= position && position <= m.getEnd()) { @@ -25542,28 +26915,6 @@ var ts; }; } } - function getContainerNode(node) { - while (true) { - node = node.parent; - if (!node) { - return undefined; - } - switch (node.kind) { - case 207: - case 128: - case 127: - case 190: - case 156: - case 130: - case 131: - case 191: - case 192: - case 194: - case 195: - return node; - } - } - } function getSymbolKind(symbol, typeResolver, location) { var flags = symbol.getFlags(); if (flags & 32) @@ -25650,40 +27001,12 @@ var ts; return ScriptElementKind.interfaceElement; if (flags & 512) return ScriptElementKind.typeParameterElement; - if (flags & 127) + if (flags & 1048703) return ScriptElementKind.primitiveType; if (flags & 256) return ScriptElementKind.primitiveType; return ScriptElementKind.unknown; } - function getNodeKind(node) { - switch (node.kind) { - case 195: return ScriptElementKind.moduleElement; - case 191: return ScriptElementKind.classElement; - case 192: return ScriptElementKind.interfaceElement; - case 193: return ScriptElementKind.typeElement; - case 194: return ScriptElementKind.enumElement; - case 188: - return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 190: return ScriptElementKind.functionElement; - case 130: return ScriptElementKind.memberGetAccessorElement; - case 131: return ScriptElementKind.memberSetAccessorElement; - case 128: - case 127: - return ScriptElementKind.memberFunctionElement; - case 126: - case 125: - return ScriptElementKind.memberVariableElement; - case 134: return ScriptElementKind.indexSignatureElement; - case 133: return ScriptElementKind.constructSignatureElement; - case 132: return ScriptElementKind.callSignatureElement; - case 129: return ScriptElementKind.constructorImplementationElement; - case 123: return ScriptElementKind.typeParameterElement; - case 206: return ScriptElementKind.variableElement; - case 124: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - } - return ScriptElementKind.unknown; - } function getSymbolModifiers(symbol) { return symbol && symbol.declarations && symbol.declarations.length > 0 ? ts.getNodeModifiers(symbol.declarations[0]) : ScriptElementKindModifier.none; } @@ -25700,14 +27023,14 @@ var ts; } var type = typeResolver.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 149) { + if (location.parent && location.parent.kind === 151) { var right = location.parent.name; if (right === location || (right && right.getFullWidth() === 0)) { location = location.parent; } } var callExpression; - if (location.kind === 151 || location.kind === 152) { + if (location.kind === 153 || location.kind === 154) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -25719,7 +27042,7 @@ var ts; if (!signature && candidateSignatures.length) { signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 152 || callExpression.expression.kind === 90; + var useConstructSignatures = callExpression.kind === 154 || callExpression.expression.kind === 90; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target || signature)) { signature = allSignatures.length ? allSignatures[0] : undefined; @@ -25768,22 +27091,24 @@ var ts; hasAddedSymbolInfo = true; } } - else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || (location.kind === 112 && location.parent.kind === 129)) { + else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || + (location.kind === 112 && location.parent.kind === 131)) { var signature; var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 129 ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 131 ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeResolver.isImplementationOfOverload(functionDeclaration)) { signature = typeResolver.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 129) { + if (functionDeclaration.kind === 131) { symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 132 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 134 && + !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); hasAddedSymbolInfo = true; @@ -25805,7 +27130,7 @@ var ts; } if (symbolFlags & 524288) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(120)); + displayParts.push(ts.keywordPart(121)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); displayParts.push(ts.spacePart()); @@ -25844,13 +27169,13 @@ var ts; writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); } else { - var signatureDeclaration = ts.getDeclarationOfKind(symbol, 123).parent; + var signatureDeclaration = ts.getDeclarationOfKind(symbol, 125).parent; var signature = typeResolver.getSignatureFromDeclaration(signatureDeclaration); - if (signatureDeclaration.kind === 133) { + if (signatureDeclaration.kind === 135) { displayParts.push(ts.keywordPart(87)); displayParts.push(ts.spacePart()); } - else if (signatureDeclaration.kind !== 132 && signatureDeclaration.name) { + else if (signatureDeclaration.kind !== 134 && signatureDeclaration.name) { addFullSymbolName(signatureDeclaration.symbol); } displayParts.push.apply(displayParts, ts.signatureToDisplayParts(typeResolver, signature, sourceFile, 32)); @@ -25859,7 +27184,7 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 206) { + if (declaration.kind === 209) { var constantValue = typeResolver.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -25875,7 +27200,7 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 197) { + if (declaration.kind === 200) { var importDeclaration = declaration; if (ts.isExternalModuleImportDeclaration(importDeclaration)) { displayParts.push(ts.spacePart()); @@ -25903,7 +27228,9 @@ var ts; if (symbolKind !== ScriptElementKind.unknown) { if (type) { addPrefixForAnyFunctionOrVar(symbol, symbolKind); - if (symbolKind === ScriptElementKind.memberVariableElement || symbolFlags & 3 || symbolKind === ScriptElementKind.localVariableElement) { + if (symbolKind === ScriptElementKind.memberVariableElement || + symbolFlags & 3 || + symbolKind === ScriptElementKind.localVariableElement) { displayParts.push(ts.punctuationPart(51)); displayParts.push(ts.spacePart()); if (type.symbol && type.symbol.flags & 262144) { @@ -25916,7 +27243,12 @@ var ts; displayParts.push.apply(displayParts, ts.typeToDisplayParts(typeResolver, type, enclosingDeclaration)); } } - else if (symbolFlags & 16 || symbolFlags & 8192 || symbolFlags & 16384 || symbolFlags & 131072 || symbolFlags & 98304 || symbolKind === ScriptElementKind.memberFunctionElement) { + else if (symbolFlags & 16 || + symbolFlags & 8192 || + symbolFlags & 16384 || + symbolFlags & 131072 || + symbolFlags & 98304 || + symbolKind === ScriptElementKind.memberFunctionElement) { var allSignatures = type.getCallSignatures(); addSignatureDisplayParts(allSignatures[0], allSignatures); } @@ -25981,8 +27313,8 @@ var ts; if (!symbol) { switch (node.kind) { case 64: - case 149: - case 121: + case 151: + case 123: case 92: case 90: var type = typeInfoResolver.getTypeAtLocation(node); @@ -26025,13 +27357,13 @@ var ts; var referenceFile = ts.tryResolveScriptReference(program, sourceFile, comment); if (referenceFile) { return [{ - fileName: referenceFile.fileName, - textSpan: ts.createTextSpanFromBounds(0, 0), - kind: ScriptElementKind.scriptElement, - name: comment.fileName, - containerName: undefined, - containerKind: undefined - }]; + fileName: referenceFile.fileName, + textSpan: ts.createTextSpanFromBounds(0, 0), + kind: ScriptElementKind.scriptElement, + name: comment.fileName, + containerName: undefined, + containerKind: undefined + }]; } return undefined; } @@ -26040,7 +27372,7 @@ var ts; return undefined; } var result = []; - if (node.parent.kind === 205) { + if (node.parent.kind === 208) { var shorthandSymbol = typeInfoResolver.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); var shorthandDeclarations = shorthandSymbol.getDeclarations(); var shorthandSymbolKind = getSymbolKind(shorthandSymbol, typeInfoResolver, node); @@ -26056,7 +27388,8 @@ var ts; var symbolKind = getSymbolKind(symbol, typeInfoResolver, node); var containerSymbol = symbol.parent; var containerName = containerSymbol ? typeInfoResolver.symbolToString(containerSymbol, node) : ""; - if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { + if (!tryAddConstructSignature(symbol, node, symbolKind, symbolName, containerName, result) && + !tryAddCallSignature(symbol, node, symbolKind, symbolName, containerName, result)) { ts.forEach(declarations, function (declaration) { result.push(getDefinitionInfo(declaration, symbolKind, symbolName, containerName)); }); @@ -26076,7 +27409,8 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 129) || (!selectConstructors && (d.kind === 190 || d.kind === 128 || d.kind === 127))) { + if ((selectConstructors && d.kind === 131) || + (!selectConstructors && (d.kind === 193 || d.kind === 130 || d.kind === 129))) { declarations.push(d); if (d.body) definition = d; @@ -26096,7 +27430,7 @@ var ts; if (isNewExpressionTarget(location) || location.kind === 112) { if (symbol.flags & 32) { var classDeclaration = symbol.getDeclarations()[0]; - ts.Debug.assert(classDeclaration && classDeclaration.kind === 191); + ts.Debug.assert(classDeclaration && classDeclaration.kind === 194); return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); } } @@ -26117,84 +27451,88 @@ var ts; if (!node) { return undefined; } - if (node.kind === 64 || node.kind === 92 || node.kind === 90 || isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + if (node.kind === 64 || node.kind === 92 || node.kind === 90 || + isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { return getReferencesForNode(node, [sourceFile], true, false, false); } switch (node.kind) { case 83: case 75: - if (hasKind(node.parent, 174)) { + if (hasKind(node.parent, 176)) { return getIfElseOccurrences(node.parent); } break; case 89: - if (hasKind(node.parent, 181)) { + if (hasKind(node.parent, 184)) { return getReturnOccurrences(node.parent); } break; case 93: - if (hasKind(node.parent, 185)) { + if (hasKind(node.parent, 188)) { return getThrowOccurrences(node.parent); } break; case 67: - if (hasKind(parent(parent(node)), 186)) { + if (hasKind(parent(parent(node)), 189)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 95: case 80: - if (hasKind(parent(node), 186)) { + if (hasKind(parent(node), 189)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 91: - if (hasKind(node.parent, 183)) { + if (hasKind(node.parent, 186)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 66: case 72: - if (hasKind(parent(parent(node)), 183)) { + if (hasKind(parent(parent(node)), 186)) { return getSwitchCaseDefaultOccurrences(node.parent.parent); } break; case 65: case 70: - if (hasKind(node.parent, 180) || hasKind(node.parent, 179)) { + if (hasKind(node.parent, 183) || hasKind(node.parent, 182)) { return getBreakOrContinueStatementOccurences(node.parent); } break; case 81: - if (hasKind(node.parent, 177) || hasKind(node.parent, 178)) { + if (hasKind(node.parent, 179) || + hasKind(node.parent, 180) || + hasKind(node.parent, 181)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 99: case 74: - if (hasKind(node.parent, 176) || hasKind(node.parent, 175)) { + if (hasKind(node.parent, 178) || hasKind(node.parent, 177)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 112: - if (hasKind(node.parent, 129)) { + if (hasKind(node.parent, 131)) { return getConstructorOccurrences(node.parent); } break; case 114: case 118: - if (hasKind(node.parent, 130) || hasKind(node.parent, 131)) { + if (hasKind(node.parent, 132) || hasKind(node.parent, 133)) { return getGetAndSetOccurrences(node.parent); } default: - if (ts.isModifier(node.kind) && node.parent && (ts.isDeclaration(node.parent) || node.parent.kind === 171)) { + if (ts.isModifier(node.kind) && node.parent && + (ts.isDeclaration(node.parent) || node.parent.kind === 173)) { return getModifierOccurrences(node.kind, node.parent); } } return undefined; function getIfElseOccurrences(ifStatement) { var keywords = []; - while (hasKind(ifStatement.parent, 174) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 176) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } while (ifStatement) { @@ -26205,7 +27543,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 174)) { + if (!hasKind(ifStatement.elseStatement, 176)) { break; } ifStatement = ifStatement.elseStatement; @@ -26238,7 +27576,7 @@ var ts; } function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 170))) { + if (!(func && hasKind(func.body, 172))) { return undefined; } var keywords = []; @@ -26271,10 +27609,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 185) { + if (node.kind === 188) { statementAccumulator.push(node); } - else if (node.kind === 186) { + else if (node.kind === 189) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -26296,10 +27634,10 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 207) { + if (ts.isFunctionBlock(parent) || parent.kind === 210) { return parent; } - if (parent.kind === 186) { + if (parent.kind === 189) { var tryStatement = parent; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; @@ -26324,7 +27662,7 @@ var ts; function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 81, 99, 74)) { - if (loopNode.kind === 175) { + if (loopNode.kind === 177) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 99)) { @@ -26359,12 +27697,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { + case 179: + case 180: + case 181: case 177: case 178: - case 175: - case 176: return getLoopBreakContinueOccurrences(owner); - case 183: + case 186: return getSwitchCaseDefaultOccurrences(owner); } } @@ -26375,7 +27714,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 180 || node.kind === 179) { + if (node.kind === 183 || node.kind === 182) { statementAccumulator.push(node); } else if (!ts.isAnyFunction(node)) { @@ -26391,14 +27730,15 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node = statement.parent; node; node = node.parent) { switch (node.kind) { - case 183: - if (statement.kind === 179) { + case 186: + if (statement.kind === 182) { continue; } - case 177: + case 179: + case 180: + case 181: case 178: - case 176: - case 175: + case 177: if (!statement.label || isLabeledBy(node, statement.label.text)) { return node; } @@ -26424,8 +27764,8 @@ var ts; } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 130); - tryPushAccessorKeyword(accessorDeclaration.symbol, 131); + tryPushAccessorKeyword(accessorDeclaration.symbol, 132); + tryPushAccessorKeyword(accessorDeclaration.symbol, 133); return ts.map(keywords, getReferenceEntryFromNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); @@ -26437,17 +27777,18 @@ var ts; function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (declaration.flags & 112) { - if (!(container.kind === 191 || (declaration.kind === 124 && hasKind(container, 129)))) { + if (!(container.kind === 194 || + (declaration.kind === 126 && hasKind(container, 131)))) { return undefined; } } else if (declaration.flags & 128) { - if (container.kind !== 191) { + if (container.kind !== 194) { return undefined; } } else if (declaration.flags & (1 | 2)) { - if (!(container.kind === 196 || container.kind === 207)) { + if (!(container.kind === 199 || container.kind === 210)) { return undefined; } } @@ -26458,18 +27799,18 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 196: - case 207: + case 199: + case 210: nodes = container.statements; break; - case 129: + case 131: nodes = container.parameters.concat(container.parent.members); break; - case 191: + case 194: nodes = container.members; if (modifierFlag & 112) { var constructor = ts.forEach(container.members, function (member) { - return member.kind === 129 && member; + return member.kind === 131 && member; }); if (constructor) { nodes = nodes.concat(constructor.parameters); @@ -26536,7 +27877,9 @@ var ts; if (!node) { return undefined; } - if (node.kind !== 64 && !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && !isNameOfExternalModuleImportOrDeclaration(node)) { + if (node.kind !== 64 && + !isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && + !isNameOfExternalModuleImportOrDeclaration(node)) { return undefined; } ts.Debug.assert(node.kind === 64 || node.kind === 7 || node.kind === 8); @@ -26619,7 +27962,7 @@ var ts; return stripQuotes(name); } function getInternedName(symbol, declarations) { - var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 156 ? d : undefined; }); + var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 158 ? d : undefined; }); if (functionExpression && functionExpression.name) { var name = functionExpression.name.text; } @@ -26640,7 +27983,7 @@ var ts; if (symbol.getFlags() && (4 | 8192)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 191); + return ts.getAncestor(privateDeclaration, 194); } } if (symbol.parent || (symbol.getFlags() & 268435456)) { @@ -26657,7 +28000,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 207 && !ts.isExternalModule(container)) { + if (container.kind === 210 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -26679,7 +28022,8 @@ var ts; if (position > end) break; var endPosition = position + symbolNameLength; - if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { + if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 2)) && + (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 2))) { positions.push(position); } position = text.indexOf(symbolName, position + symbolNameLength + 1); @@ -26697,7 +28041,8 @@ var ts; if (!node || node.getWidth() !== labelName.length) { return; } - if (node === targetLabel || (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { + if (node === targetLabel || + (isJumpStatementTarget(node) && getTargetLabel(node, labelName) === targetLabel)) { result.push(getReferenceEntryFromNode(node)); } }); @@ -26709,7 +28054,8 @@ var ts; case 64: return node.getWidth() === searchSymbolName.length; case 8: - if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) { + if (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || + isNameOfExternalModuleImportOrDeclaration(node)) { return node.getWidth() === searchSymbolName.length + 2; } break; @@ -26732,7 +28078,8 @@ var ts; cancellationToken.throwIfCancellationRequested(); var referenceLocation = ts.getTouchingPropertyName(sourceFile, position); if (!isValidReferencePosition(referenceLocation, searchText)) { - if ((findInStrings && isInString(position)) || (findInComments && isInComment(position))) { + if ((findInStrings && isInString(position)) || + (findInComments && isInComment(position))) { result.push({ fileName: sourceFile.fileName, textSpan: ts.createTextSpan(position, searchText.length), @@ -26784,13 +28131,13 @@ var ts; } var staticFlag = 128; switch (searchSpaceNode.kind) { - case 126: - case 125: case 128: case 127: - case 129: case 130: + case 129: case 131: + case 132: + case 133: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; @@ -26817,31 +28164,31 @@ var ts; var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); var staticFlag = 128; switch (searchSpaceNode.kind) { - case 128: - case 127: + case 130: + case 129: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } - case 126: - case 125: - case 129: - case 130: + case 128: + case 127: case 131: + case 132: + case 133: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 207: + case 210: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 190: - case 156: + case 193: + case 158: break; default: return undefined; } var result = []; - if (searchSpaceNode.kind === 207) { + if (searchSpaceNode.kind === 210) { ts.forEach(sourceFiles, function (sourceFile) { var possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, result); @@ -26862,25 +28209,25 @@ var ts; } var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { - case 156: - case 190: + case 158: + case 193: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 128: - case 127: + case 130: + case 129: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 191: + case 194: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 207: - if (container.kind === 207 && !ts.isExternalModule(container)) { + case 210: + if (container.kind === 210 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -26912,11 +28259,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 | 64)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 191) { + if (declaration.kind === 194) { getPropertySymbolFromTypeReference(ts.getClassBaseTypeNode(declaration)); ts.forEach(ts.getClassImplementedTypeNodes(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 192) { + else if (declaration.kind === 195) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -27022,75 +28369,19 @@ var ts; } var parent = node.parent; if (parent) { - if (parent.kind === 162 || parent.kind === 161) { + if (parent.kind === 164 || parent.kind === 163) { return true; } - else if (parent.kind === 163 && parent.left === node) { - var operator = parent.operator; + else if (parent.kind === 165 && parent.left === node) { + var operator = parent.operatorToken.kind; return 52 <= operator && operator <= 63; } } return false; } - function getNavigateToItems(searchValue) { + function getNavigateToItems(searchValue, maxResultCount) { synchronizeHostData(); - var terms = searchValue.split(" "); - var searchTerms = ts.map(terms, function (t) { return ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t }); }); - var items = []; - ts.forEach(program.getSourceFiles(), function (sourceFile) { - cancellationToken.throwIfCancellationRequested(); - var fileName = sourceFile.fileName; - var declarations = sourceFile.getNamedDeclarations(); - for (var i = 0, n = declarations.length; i < n; i++) { - var declaration = declarations[i]; - var name = declaration.name.text; - var matchKind = getMatchKind(searchTerms, name); - if (matchKind !== 0) { - var container = getContainerNode(declaration); - items.push({ - name: name, - kind: getNodeKind(declaration), - kindModifiers: ts.getNodeModifiers(declaration), - matchKind: MatchKind[matchKind], - fileName: fileName, - textSpan: ts.createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), - containerName: container && container.name ? container.name.text : "", - containerKind: container && container.name ? getNodeKind(container) : "" - }); - } - } - }); - return items; - function hasAnyUpperCaseCharacter(s) { - for (var i = 0, n = s.length; i < n; i++) { - var c = s.charCodeAt(i); - if ((65 <= c && c <= 90) || (c >= 127 && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) { - return true; - } - } - return false; - } - function getMatchKind(searchTerms, name) { - var matchKind = 0; - if (name) { - for (var j = 0, n = searchTerms.length; j < n; j++) { - var searchTerm = searchTerms[j]; - var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase(); - var index = nameToSearch.indexOf(searchTerm.term); - if (index < 0) { - return 0; - } - var termKind = 2; - if (index === 0) { - termKind = name.length === searchTerm.term.length ? 1 : 3; - } - if (matchKind === 0 || termKind < matchKind) { - matchKind = termKind; - } - } - } - return matchKind; - } + return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount); } function containErrors(diagnostics) { return ts.forEach(diagnostics, function (diagnostic) { return diagnostic.category === 1; }); @@ -27115,33 +28406,33 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 124: - case 188: - case 146: case 126: - case 125: - case 204: - case 205: - case 206: + case 191: + case 148: case 128: case 127: - case 129: + case 207: + case 208: + case 209: case 130: + case 129: case 131: - case 190: - case 156: - case 157: - case 203: - return 1; - case 123: - case 192: + case 132: + case 133: case 193: - case 139: - return 2; - case 191: - case 194: - return 1 | 2; + case 158: + case 159: + case 206: + return 1; + case 125: case 195: + case 196: + case 141: + return 2; + case 194: + case 197: + return 1 | 2; + case 198: if (node.name.kind === 8) { return 4 | 1; } @@ -27151,9 +28442,9 @@ var ts; else { return 4; } - case 197: + case 200: return 1 | 2 | 4; - case 207: + case 210: return 4 | 1; } ts.Debug.fail("Unknown declaration type"); @@ -27162,33 +28453,35 @@ var ts; if (isRightSideOfQualifiedName(node)) { node = node.parent; } - return node.parent.kind === 135; + return node.parent.kind === 137; } function isNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 121) { - while (root.parent && root.parent.kind === 121) + if (root.parent.kind === 123) { + while (root.parent && root.parent.kind === 123) root = root.parent; isLastClause = root.right === node; } - return root.parent.kind === 135 && !isLastClause; + return root.parent.kind === 137 && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 121) { + while (node.parent.kind === 123) { node = node.parent; } return ts.isInternalModuleImportDeclaration(node.parent) && node.parent.moduleReference === node; } function getMeaningFromRightHandSideOfImport(node) { ts.Debug.assert(node.kind === 64); - if (node.parent.kind === 121 && node.parent.right === node && node.parent.parent.kind === 197) { + if (node.parent.kind === 123 && + node.parent.right === node && + node.parent.parent.kind === 200) { return 1 | 2 | 4; } return 4; } function getMeaningFromLocation(node) { - if (node.parent.kind === 198) { + if (node.parent.kind === 201) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -27225,8 +28518,8 @@ var ts; return; } switch (node.kind) { - case 149: - case 121: + case 151: + case 123: case 8: case 79: case 94: @@ -27244,7 +28537,8 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 195 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { + if (nodeForStartPos.parent.parent.kind === 198 && + nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } else { @@ -27292,14 +28586,15 @@ var ts; } } else if (flags & 1536) { - if (meaningAtPosition & 4 || (meaningAtPosition & 1 && hasValueSideModule(symbol))) { + if (meaningAtPosition & 4 || + (meaningAtPosition & 1 && hasValueSideModule(symbol))) { return ClassificationTypeNames.moduleName; } } return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 195 && ts.getModuleInstanceState(declaration) == 1; + return declaration.kind === 198 && ts.getModuleInstanceState(declaration) == 1; }); } } @@ -27418,11 +28713,16 @@ var ts; if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 52) { - if (token.parent.kind === 188 || token.parent.kind === 126 || token.parent.kind === 124) { + if (token.parent.kind === 191 || + token.parent.kind === 128 || + token.parent.kind === 126) { return ClassificationTypeNames.operator; } } - if (token.parent.kind === 163 || token.parent.kind === 161 || token.parent.kind === 162 || token.parent.kind === 164) { + if (token.parent.kind === 165 || + token.parent.kind === 163 || + token.parent.kind === 164 || + token.parent.kind === 166) { return ClassificationTypeNames.operator; } } @@ -27443,27 +28743,27 @@ var ts; else if (tokenKind === 64) { if (token) { switch (token.parent.kind) { - case 191: + case 194: if (token.parent.name === token) { return ClassificationTypeNames.className; } return; - case 123: + case 125: if (token.parent.name === token) { return ClassificationTypeNames.typeParameterName; } return; - case 192: + case 195: if (token.parent.name === token) { return ClassificationTypeNames.interfaceName; } return; - case 194: + case 197: if (token.parent.name === token) { return ClassificationTypeNames.enumName; } return; - case 195: + case 198: if (token.parent.name === token) { return ClassificationTypeNames.moduleName; } @@ -27622,7 +28922,9 @@ var ts; return new RegExp(regExpString, "gim"); } function isLetterOrDigit(char) { - return (char >= 97 && char <= 122) || (char >= 65 && char <= 90) || (char >= 48 && char <= 57); + return (char >= 97 && char <= 122) || + (char >= 65 && char <= 90) || + (char >= 48 && char <= 57); } } function getRenameInfo(fileName, position) { @@ -27635,11 +28937,13 @@ var ts; if (symbol) { var declarations = symbol.getDeclarations(); if (declarations && declarations.length > 0) { - var defaultLibFile = ts.getDefaultLibFileName(host.getCompilationSettings()); - for (var i = 0; i < declarations.length; i++) { - var sourceFile = declarations[i].getSourceFile(); - if (sourceFile && endsWith(sourceFile.fileName, defaultLibFile)) { - return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); + var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); + if (defaultLibFileName) { + for (var i = 0; i < declarations.length; i++) { + var sourceFile = declarations[i].getSourceFile(); + if (sourceFile && getCanonicalFileName(ts.normalizePath(sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { + return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); + } } } var kind = getSymbolKind(symbol, typeInfoResolver, node); @@ -27658,9 +28962,6 @@ var ts; } } return getRenameInfoError(ts.getLocaleSpecificMessage(ts.Diagnostics.You_cannot_rename_this_element.key)); - function endsWith(string, value) { - return string.lastIndexOf(value) + value.length === string.length; - } function getRenameInfoError(localizedErrorMessage) { return { canRename: false, @@ -27722,6 +29023,7 @@ var ts; noRegexTable[15] = true; noRegexTable[94] = true; noRegexTable[79] = true; + var templateStack = []; function isAccessibilityModifier(kind) { switch (kind) { case 107: @@ -27733,17 +29035,23 @@ var ts; } function canFollow(keyword1, keyword2) { if (isAccessibilityModifier(keyword1)) { - if (keyword2 === 114 || keyword2 === 118 || keyword2 === 112 || keyword2 === 108) { + if (keyword2 === 114 || + keyword2 === 118 || + keyword2 === 112 || + keyword2 === 108) { return true; } return false; } return true; } - function getClassificationsForLine(text, lexState, classifyKeywordsInGenerics) { + function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) { var offset = 0; var token = 0; var lastNonTriviaToken = 0; + while (templateStack.length > 0) { + templateStack.pop(); + } switch (lexState) { case 3: text = '"\\\n' + text; @@ -27757,6 +29065,16 @@ var ts; text = "/*\n" + text; offset = 3; break; + case 4: + text = "`\n" + text; + offset = 2; + break; + case 5: + text = "}\n" + text; + offset = 2; + case 6: + templateStack.push(11); + break; } scanner.setText(text); var result = { @@ -27778,17 +29096,48 @@ var ts; else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { token = 64; } - else if (lastNonTriviaToken === 64 && token === 24) { + else if (lastNonTriviaToken === 64 && + token === 24) { angleBracketStack++; } else if (token === 25 && angleBracketStack > 0) { angleBracketStack--; } - else if (token === 110 || token === 119 || token === 117 || token === 111) { - if (angleBracketStack > 0 && !classifyKeywordsInGenerics) { + else if (token === 110 || + token === 119 || + token === 117 || + token === 111 || + token === 120) { + if (angleBracketStack > 0 && !syntacticClassifierAbsent) { token = 64; } } + else if (token === 11) { + templateStack.push(token); + } + else if (token === 14) { + if (templateStack.length > 0) { + templateStack.push(token); + } + } + else if (token === 15) { + if (templateStack.length > 0) { + var lastTemplateStackToken = ts.lastOrUndefined(templateStack); + if (lastTemplateStackToken === 11) { + token = scanner.reScanTemplateToken(); + if (token === 13) { + templateStack.pop(); + } + else { + ts.Debug.assert(token === 12, "Should have been a template middle. Was " + token); + } + } + else { + ts.Debug.assert(lastTemplateStackToken === 14, "Should have been an open brace. Was: " + token); + templateStack.pop(); + } + } + } lastNonTriviaToken = token; } processToken(); @@ -27818,6 +29167,22 @@ var ts; result.finalLexState = 1; } } + else if (ts.isTemplateLiteralKind(token)) { + if (scanner.isUnterminated()) { + if (token === 13) { + result.finalLexState = 5; + } + else if (token === 10) { + result.finalLexState = 4; + } + else { + ts.Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #" + token); + } + } + } + else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 11) { + result.finalLexState = 6; + } } } function addResult(length, classification) { @@ -27868,7 +29233,8 @@ var ts; case 52: case 23: return true; - default: return false; + default: + return false; } } function isPrefixUnaryExpressionOperatorToken(token) { @@ -27885,7 +29251,7 @@ var ts; } } function isKeyword(token) { - return token >= 65 && token <= 120; + return token >= 65 && token <= 122; } function classFromKind(token) { if (isKeyword(token)) { @@ -27909,9 +29275,13 @@ var ts; case 2: return 3; case 5: + case 4: return 4; case 64: default: + if (ts.isTemplateLiteralKind(token)) { + return 7; + } return 5; } } @@ -27930,7 +29300,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 207 ? new SourceFileObject() : new NodeObject(); + var proto = kind === 210 ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = 0; proto.end = 0; @@ -27955,10 +29325,10 @@ var ts; return undefined; } var tokenAtLocation = ts.getTokenAtPosition(sourceFile, position); - var lineOfPosition = sourceFile.getLineAndCharacterFromPosition(position).line; - if (sourceFile.getLineAndCharacterFromPosition(tokenAtLocation.getStart()).line > lineOfPosition) { + var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line; + if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart()).line > lineOfPosition) { tokenAtLocation = ts.findPrecedingToken(tokenAtLocation.pos, sourceFile); - if (!tokenAtLocation || sourceFile.getLineAndCharacterFromPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { + if (!tokenAtLocation || sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { return undefined; } } @@ -27970,7 +29340,7 @@ var ts; return ts.createTextSpanFromBounds(startNode.getStart(), (endNode || startNode).getEnd()); } function spanInNodeIfStartsOnSameLine(node, otherwiseOnNode) { - if (node && lineOfPosition === sourceFile.getLineAndCharacterFromPosition(node.getStart()).line) { + if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart()).line) { return spanInNode(node); } return spanInNode(otherwiseOnNode); @@ -27984,93 +29354,94 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 175) { + if (node.parent.kind === 177) { return spanInPreviousNode(node); } - if (node.parent.kind === 177) { + if (node.parent.kind === 179) { return textSpan(node); } - if (node.parent.kind === 163 && node.parent.operator === 23) { + if (node.parent.kind === 165 && node.parent.operatorToken.kind === 23) { return textSpan(node); } - if (node.parent.kind == 157 && node.parent.body == node) { + if (node.parent.kind == 159 && node.parent.body == node) { return textSpan(node); } } switch (node.kind) { - case 171: + case 173: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 188: - case 126: - case 125: - return spanInVariableDeclaration(node); - case 124: - return spanInParameterDeclaration(node); - case 190: + case 191: case 128: case 127: + return spanInVariableDeclaration(node); + case 126: + return spanInParameterDeclaration(node); + case 193: case 130: - case 131: case 129: - case 156: - case 157: + case 132: + case 133: + case 131: + case 158: + case 159: return spanInFunctionDeclaration(node); - case 170: + case 172: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 196: + case 199: return spanInBlock(node); - case 203: + case 206: return spanInBlock(node.block); - case 173: - return textSpan(node.expression); - case 181: - return textSpan(node.getChildAt(0), node.expression); - case 176: - return textSpan(node, ts.findNextToken(node.expression, node)); case 175: - return spanInNode(node.statement); - case 187: - return textSpan(node.getChildAt(0)); - case 174: - return textSpan(node, ts.findNextToken(node.expression, node)); + return textSpan(node.expression); case 184: - return spanInNode(node.statement); - case 180: - case 179: - return textSpan(node.getChildAt(0), node.label); - case 177: - return spanInForStatement(node); + return textSpan(node.getChildAt(0), node.expression); case 178: return textSpan(node, ts.findNextToken(node.expression, node)); + case 177: + return spanInNode(node.statement); + case 190: + return textSpan(node.getChildAt(0)); + case 176: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 187: + return spanInNode(node.statement); case 183: + case 182: + return textSpan(node.getChildAt(0), node.label); + case 179: + return spanInForStatement(node); + case 180: + case 181: return textSpan(node, ts.findNextToken(node.expression, node)); - case 200: - case 201: - return spanInNode(node.statements[0]); case 186: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 203: + case 204: + return spanInNode(node.statements[0]); + case 189: return spanInBlock(node.tryBlock); - case 185: + case 188: return textSpan(node, node.expression); - case 198: + case 201: return textSpan(node, node.exportName); - case 197: + case 200: return textSpan(node, node.moduleReference); - case 195: + case 198: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 191: case 194: - case 206: - case 151: - case 152: + case 197: + case 209: + case 153: + case 154: return textSpan(node); - case 182: + case 185: return spanInNode(node.statement); - case 192: - case 193: + case 195: + case 196: return undefined; case 22: case 1: @@ -28097,10 +29468,10 @@ var ts; case 80: return spanInNextNode(node); default: - if (node.parent.kind === 204 && node.parent.name === node) { + if (node.parent.kind === 207 && node.parent.name === node) { return spanInNode(node.parent.initializer); } - if (node.parent.kind === 154 && node.parent.type === node) { + if (node.parent.kind === 156 && node.parent.type === node) { return spanInNode(node.parent.expression); } if (ts.isAnyFunction(node.parent) && node.parent.type === node) { @@ -28110,11 +29481,12 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 178) { + if (variableDeclaration.parent.parent.kind === 180 || + variableDeclaration.parent.parent.kind === 181) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 171; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 177 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 173; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 179 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement ? variableDeclaration.parent.parent.initializer.declarations : undefined; if (variableDeclaration.initializer || (variableDeclaration.flags & 1)) { if (declarations && declarations[0] === variableDeclaration) { @@ -28136,7 +29508,8 @@ var ts; } } function canHaveSpanInParameterDeclaration(parameter) { - return !!parameter.initializer || parameter.dotDotDotToken !== undefined || !!(parameter.flags & 16) || !!(parameter.flags & 32); + return !!parameter.initializer || parameter.dotDotDotToken !== undefined || + !!(parameter.flags & 16) || !!(parameter.flags & 32); } function spanInParameterDeclaration(parameter) { if (canHaveSpanInParameterDeclaration(parameter)) { @@ -28154,7 +29527,8 @@ var ts; } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return !!(functionDeclaration.flags & 1) || (functionDeclaration.parent.kind === 191 && functionDeclaration.kind !== 129); + return !!(functionDeclaration.flags & 1) || + (functionDeclaration.parent.kind === 194 && functionDeclaration.kind !== 131); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -28174,22 +29548,23 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 195: + case 198: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 176: - case 174: case 178: + case 176: + case 180: + case 181: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); - case 177: + case 179: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } function spanInForStatement(forStatement) { if (forStatement.initializer) { - if (forStatement.initializer.kind === 189) { + if (forStatement.initializer.kind === 192) { var variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -28208,34 +29583,34 @@ var ts; } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 194: + case 197: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 191: + case 194: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 183: + case 186: return spanInNodeIfStartsOnSameLine(node.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 196: + case 199: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } + case 197: case 194: - case 191: return textSpan(node); - case 170: + case 172: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 203: + case 206: return spanInNode(node.parent.statements[node.parent.statements.length - 1]); ; - case 183: + case 186: var switchStatement = node.parent; var lastClause = switchStatement.clauses[switchStatement.clauses.length - 1]; if (lastClause) { @@ -28247,24 +29622,24 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 175) { + if (node.parent.kind === 177) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInCloseParenToken(node) { switch (node.parent.kind) { - case 156: - case 190: - case 157: - case 128: - case 127: + case 158: + case 193: + case 159: case 130: - case 131: case 129: - case 176: - case 175: + case 132: + case 133: + case 131: + case 178: case 177: + case 179: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -28272,19 +29647,19 @@ var ts; return spanInNode(node.parent); } function spanInColonToken(node) { - if (ts.isAnyFunction(node.parent) || node.parent.kind === 204) { + if (ts.isAnyFunction(node.parent) || node.parent.kind === 207) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 154) { + if (node.parent.kind === 156) { return spanInNode(node.parent.expression); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 175) { + if (node.parent.kind === 177) { return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } return spanInNode(node.parent); @@ -28377,7 +29752,7 @@ var ts; return this.shimHost.getCurrentDirectory(); }; LanguageServiceShimHostAdapter.prototype.getDefaultLibFileName = function (options) { - return ""; + return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); }; return LanguageServiceShimHostAdapter; })(); @@ -28617,10 +29992,10 @@ var ts; return edits; }); }; - LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue) { + LanguageServiceShimObject.prototype.getNavigateToItems = function (searchValue, maxResultCount) { var _this = this; - return this.forwardJSONCall("getNavigateToItems('" + searchValue + "')", function () { - var items = _this.languageService.getNavigateToItems(searchValue); + return this.forwardJSONCall("getNavigateToItems('" + searchValue + "', " + maxResultCount + ")", function () { + var items = _this.languageService.getNavigateToItems(searchValue, maxResultCount); return items; }); }; diff --git a/bin/typescriptServices_internal.d.ts b/bin/typescriptServices_internal.d.ts index c6ba4f561f0..12860e9edc8 100644 --- a/bin/typescriptServices_internal.d.ts +++ b/bin/typescriptServices_internal.d.ts @@ -159,6 +159,7 @@ declare module ts { function getFullWidth(node: Node): number; function containsParseError(node: Node): boolean; function getSourceFileOfNode(node: Node): SourceFile; + function getStartPositionOfLine(line: number, sourceFile: SourceFile): number; function nodePosToString(node: Node): string; function getStartPosOfNode(node: Node): number; function nodeIsMissing(node: Node): boolean; @@ -216,6 +217,26 @@ declare module ts { function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult; function isKeyword(token: SyntaxKind): boolean; function isTrivia(token: SyntaxKind): boolean; + /** + * A declaration has a dynamic name if both of the following are true: + * 1. The declaration has a computed property name + * 2. The computed name is *not* expressed as Symbol., where name + * is a property of the Symbol constructor that denotes a built in + * Symbol. + */ + function hasDynamicName(declaration: Declaration): boolean; + /** + * Checks if the expression is of the form: + * Symbol.name + * where Symbol is literally the word "Symbol", and name is any identifierName + */ + function isWellKnownSymbolSyntactically(node: Expression): boolean; + function getPropertyNameForPropertyNameNode(name: DeclarationName): string; + function getPropertyNameForKnownSymbolName(symbolName: string): string; + /** + * Includes the word "Symbol" with unicode escapes + */ + function isESSymbolIdentifier(node: Node): boolean; function isModifier(token: SyntaxKind): boolean; function textSpanEnd(span: TextSpan): number; function textSpanIsEmpty(span: TextSpan): boolean; @@ -255,8 +276,7 @@ declare module ts { list: Node; } function getEndLinePosition(line: number, sourceFile: SourceFile): number; - function getStartPositionOfLine(line: number, sourceFile: SourceFile): number; - function getStartLinePositionForPosition(position: number, sourceFile: SourceFile): number; + function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number; function rangeContainsRange(r1: TextRange, r2: TextRange): boolean; function startEndContainsRange(start: number, end: number, range: TextRange): boolean; function rangeContainsStartEnd(range: TextRange, start: number, end: number): boolean; diff --git a/bin/typescript_internal.d.ts b/bin/typescript_internal.d.ts index b7def7258d9..3a11b69cb91 100644 --- a/bin/typescript_internal.d.ts +++ b/bin/typescript_internal.d.ts @@ -159,6 +159,7 @@ declare module "typescript" { function getFullWidth(node: Node): number; function containsParseError(node: Node): boolean; function getSourceFileOfNode(node: Node): SourceFile; + function getStartPositionOfLine(line: number, sourceFile: SourceFile): number; function nodePosToString(node: Node): string; function getStartPosOfNode(node: Node): number; function nodeIsMissing(node: Node): boolean; @@ -216,6 +217,26 @@ declare module "typescript" { function getFileReferenceFromReferencePath(comment: string, commentRange: CommentRange): ReferencePathMatchResult; function isKeyword(token: SyntaxKind): boolean; function isTrivia(token: SyntaxKind): boolean; + /** + * A declaration has a dynamic name if both of the following are true: + * 1. The declaration has a computed property name + * 2. The computed name is *not* expressed as Symbol., where name + * is a property of the Symbol constructor that denotes a built in + * Symbol. + */ + function hasDynamicName(declaration: Declaration): boolean; + /** + * Checks if the expression is of the form: + * Symbol.name + * where Symbol is literally the word "Symbol", and name is any identifierName + */ + function isWellKnownSymbolSyntactically(node: Expression): boolean; + function getPropertyNameForPropertyNameNode(name: DeclarationName): string; + function getPropertyNameForKnownSymbolName(symbolName: string): string; + /** + * Includes the word "Symbol" with unicode escapes + */ + function isESSymbolIdentifier(node: Node): boolean; function isModifier(token: SyntaxKind): boolean; function textSpanEnd(span: TextSpan): number; function textSpanIsEmpty(span: TextSpan): boolean; @@ -255,8 +276,7 @@ declare module "typescript" { list: Node; } function getEndLinePosition(line: number, sourceFile: SourceFile): number; - function getStartPositionOfLine(line: number, sourceFile: SourceFile): number; - function getStartLinePositionForPosition(position: number, sourceFile: SourceFile): number; + function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number; function rangeContainsRange(r1: TextRange, r2: TextRange): boolean; function startEndContainsRange(start: number, end: number, range: TextRange): boolean; function rangeContainsStartEnd(range: TextRange, start: number, end: number): boolean; diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 57697d77216..c26d3369f3f 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -15,12 +15,12 @@ module ts { if (node.kind === SyntaxKind.InterfaceDeclaration || node.kind === SyntaxKind.TypeAliasDeclaration) { return ModuleInstanceState.NonInstantiated; } - // 2. const enum declarations don't make module instantiated + // 2. const enum declarations else if (isConstEnumDeclaration(node)) { return ModuleInstanceState.ConstEnumOnly; } - // 3. non - exported import declarations - else if (node.kind === SyntaxKind.ImportDeclaration && !(node.flags & NodeFlags.Export)) { + // 3. non-exported import declarations + else if ((node.kind === SyntaxKind.ImportDeclaration || node.kind === SyntaxKind.ImportEqualsDeclaration) && !(node.flags & NodeFlags.Export)) { return ModuleInstanceState.NonInstantiated; } // 4. other uninstantiated module declarations. @@ -179,41 +179,39 @@ module ts { } function declareModuleMember(node: Declaration, symbolKind: SymbolFlags, symbolExcludes: SymbolFlags) { - // Exported module members are given 2 symbols: A local symbol that is classified with an ExportValue, - // ExportType, or ExportContainer flag, and an associated export symbol with all the correct flags set - // on it. There are 2 main reasons: - // - // 1. We treat locals and exports of the same name as mutually exclusive within a container. - // That means the binder will issue a Duplicate Identifier error if you mix locals and exports - // with the same name in the same container. - // TODO: Make this a more specific error and decouple it from the exclusion logic. - // 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol, - // but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way - // when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope. - var exportKind = 0; - if (symbolKind & SymbolFlags.Value) { - exportKind |= SymbolFlags.ExportValue; + var hasExportModifier = getCombinedNodeFlags(node) & NodeFlags.Export; + if (symbolKind & SymbolFlags.Import) { + if (node.kind === SyntaxKind.ExportSpecifier || (node.kind === SyntaxKind.ImportEqualsDeclaration && hasExportModifier)) { + declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); + } + else { + declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); + } } - if (symbolKind & SymbolFlags.Type) { - exportKind |= SymbolFlags.ExportType; - } - if (symbolKind & SymbolFlags.Namespace) { - exportKind |= SymbolFlags.ExportNamespace; - } - - if (getCombinedNodeFlags(node) & NodeFlags.Export || (node.kind !== SyntaxKind.ImportDeclaration && isAmbientContext(container))) { - if (exportKind) { + else { + // Exported module members are given 2 symbols: A local symbol that is classified with an ExportValue, + // ExportType, or ExportContainer flag, and an associated export symbol with all the correct flags set + // on it. There are 2 main reasons: + // + // 1. We treat locals and exports of the same name as mutually exclusive within a container. + // That means the binder will issue a Duplicate Identifier error if you mix locals and exports + // with the same name in the same container. + // TODO: Make this a more specific error and decouple it from the exclusion logic. + // 2. When we checkIdentifier in the checker, we set its resolved symbol to the local symbol, + // but return the export symbol (by calling getExportSymbolOfValueSymbolIfExported). That way + // when the emitter comes back to it, it knows not to qualify the name if it was found in a containing scope. + if (hasExportModifier || isAmbientContext(container)) { + var exportKind = (symbolKind & SymbolFlags.Value ? SymbolFlags.ExportValue : 0) | + (symbolKind & SymbolFlags.Type ? SymbolFlags.ExportType : 0) | + (symbolKind & SymbolFlags.Namespace ? SymbolFlags.ExportNamespace : 0); var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); node.localSymbol = local; } else { - declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); + declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); } } - else { - declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); - } } // All container nodes are kept on a linked list in declaration order. This list is used by the getLocalNameOfContainer function @@ -312,6 +310,13 @@ module ts { } } + function bindExportDeclaration(node: ExportDeclaration) { + if (!node.exportClause) { + ((container).exportStars || ((container).exportStars = [])).push(node); + } + bindChildren(node, 0, /*isBlockScopeContainer*/ false); + } + function bindFunctionOrConstructorType(node: SignatureDeclaration) { // For a given function symbol "<...>(...) => T" we want to generate a symbol identical // to the one we would get for: { <...>(...): T } @@ -467,9 +472,23 @@ module ts { case SyntaxKind.ModuleDeclaration: bindModuleDeclaration(node); break; - case SyntaxKind.ImportDeclaration: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.NamespaceImport: + case SyntaxKind.ImportSpecifier: + case SyntaxKind.ExportSpecifier: bindDeclaration(node, SymbolFlags.Import, SymbolFlags.ImportExcludes, /*isBlockScopeContainer*/ false); break; + case SyntaxKind.ExportDeclaration: + bindExportDeclaration(node); + break; + case SyntaxKind.ImportClause: + if ((node).name) { + bindDeclaration(node, SymbolFlags.Import, SymbolFlags.ImportExcludes, /*isBlockScopeContainer*/ false); + } + else { + bindChildren(node, 0, /*isBlockScopeContainer*/ false); + } + break; case SyntaxKind.SourceFile: if (isExternalModule(node)) { bindAnonymousDeclaration(node, SymbolFlags.ValueModule, '"' + removeFileExtension((node).fileName) + '"', /*isBlockScopeContainer*/ true); diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5f93fe82786..acb90c4767b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -186,7 +186,7 @@ module ts { return result; } - function extendSymbol(target: Symbol, source: Symbol) { + function mergeSymbol(target: Symbol, source: Symbol) { if (!(target.flags & getExcludedSymbolFlags(source.flags))) { if (source.flags & SymbolFlags.ValueModule && target.flags & SymbolFlags.ValueModule && target.constEnumOnlyModule && !source.constEnumOnlyModule) { // reset flag when merging instantiated module into value module that has only const enums @@ -199,11 +199,11 @@ module ts { }); if (source.members) { if (!target.members) target.members = {}; - extendSymbolTable(target.members, source.members); + mergeSymbolTable(target.members, source.members); } if (source.exports) { if (!target.exports) target.exports = {}; - extendSymbolTable(target.exports, source.exports); + mergeSymbolTable(target.exports, source.exports); } recordMergedSymbol(target, source); } @@ -229,7 +229,7 @@ module ts { return result; } - function extendSymbolTable(target: SymbolTable, source: SymbolTable) { + function mergeSymbolTable(target: SymbolTable, source: SymbolTable) { for (var id in source) { if (hasProperty(source, id)) { if (!hasProperty(target, id)) { @@ -240,12 +240,20 @@ module ts { if (!(symbol.flags & SymbolFlags.Merged)) { target[id] = symbol = cloneSymbol(symbol); } - extendSymbol(symbol, source[id]); + mergeSymbol(symbol, source[id]); } } } } + function extendSymbolTable(target: SymbolTable, source: SymbolTable) { + for (var id in source) { + if (!hasProperty(target, id)) { + target[id] = source[id]; + } + } + } + function getSymbolLinks(symbol: Symbol): SymbolLinks { if (symbol.flags & SymbolFlags.Transient) return symbol; if (!symbol.id) symbol.id = nextSymbolId++; @@ -323,7 +331,10 @@ module ts { if (!isExternalModule(location)) break; case SyntaxKind.ModuleDeclaration: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & SymbolFlags.ModuleMember)) { - break loop; + if (!(result.flags & SymbolFlags.Import && getDeclarationOfImportSymbol(result).kind === SyntaxKind.ExportSpecifier)) { + break loop; + } + result = undefined; } break; case SyntaxKind.EnumDeclaration: @@ -449,22 +460,89 @@ module ts { return result; } + function isImportSymbolDeclaration(node: Node): boolean { + return node.kind === SyntaxKind.ImportEqualsDeclaration || + node.kind === SyntaxKind.ImportClause && !!(node).name || + node.kind === SyntaxKind.NamespaceImport || + node.kind === SyntaxKind.ImportSpecifier || + node.kind === SyntaxKind.ExportSpecifier; + } + + function getDeclarationOfImportSymbol(symbol: Symbol): Declaration { + return forEach(symbol.declarations, d => isImportSymbolDeclaration(d) ? d : undefined); + } + + function getTargetOfImportEqualsDeclaration(node: ImportEqualsDeclaration): Symbol { + if (node.moduleReference.kind === SyntaxKind.ExternalModuleReference) { + var moduleSymbol = resolveExternalModuleName(node, getExternalModuleImportEqualsDeclarationExpression(node)); + var exportAssignmentSymbol = moduleSymbol && getResolvedExportAssignmentSymbol(moduleSymbol); + return exportAssignmentSymbol || moduleSymbol; + } + return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); + } + + function getTargetOfImportClause(node: ImportClause): Symbol { + var moduleSymbol = resolveExternalModuleName(node, (node.parent).moduleSpecifier); + if (moduleSymbol) { + var exportAssignmentSymbol = getResolvedExportAssignmentSymbol(moduleSymbol); + if (!exportAssignmentSymbol) { + error(node.name, Diagnostics.External_module_0_has_no_default_export_or_export_assignment, symbolToString(moduleSymbol)); + } + return exportAssignmentSymbol; + } + } + + function getTargetOfNamespaceImport(node: NamespaceImport): Symbol { + return resolveExternalModuleName(node, (node.parent.parent).moduleSpecifier); + } + + function getExternalModuleMember(node: ImportDeclaration | ExportDeclaration, specifier: ImportOrExportSpecifier): Symbol { + var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); + if (moduleSymbol) { + var name = specifier.propertyName || specifier.name; + if (name.text) { + var symbol = getSymbol(getExportsOfSymbol(moduleSymbol), name.text, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace); + if (!symbol) { + error(name, Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(moduleSymbol), declarationNameToString(name)); + return; + } + return symbol.flags & (SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace) ? symbol : resolveImport(symbol); + } + } + } + + function getTargetOfImportSpecifier(node: ImportSpecifier): Symbol { + return getExternalModuleMember(node.parent.parent.parent, node); + } + + function getTargetOfExportSpecifier(node: ExportSpecifier): Symbol { + return (node.parent.parent).moduleSpecifier ? + getExternalModuleMember(node.parent.parent, node) : + resolveEntityName(node, node.propertyName || node.name, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace); + } + + function getTargetOfImportDeclaration(node: Declaration): Symbol { + switch (node.kind) { + case SyntaxKind.ImportEqualsDeclaration: + return getTargetOfImportEqualsDeclaration(node); + case SyntaxKind.ImportClause: + return getTargetOfImportClause(node); + case SyntaxKind.NamespaceImport: + return getTargetOfNamespaceImport(node); + case SyntaxKind.ImportSpecifier: + return getTargetOfImportSpecifier(node); + case SyntaxKind.ExportSpecifier: + return getTargetOfExportSpecifier(node); + } + } + function resolveImport(symbol: Symbol): Symbol { Debug.assert((symbol.flags & SymbolFlags.Import) !== 0, "Should only get Imports here."); var links = getSymbolLinks(symbol); if (!links.target) { links.target = resolvingSymbol; - var node = getDeclarationOfKind(symbol, SyntaxKind.ImportDeclaration); - // Grammar checking - if (node.moduleReference.kind === SyntaxKind.ExternalModuleReference) { - if ((node.moduleReference).expression.kind !== SyntaxKind.StringLiteral) { - grammarErrorOnNode((node.moduleReference).expression, Diagnostics.String_literal_expected); - } - } - - var target = node.moduleReference.kind === SyntaxKind.ExternalModuleReference - ? resolveExternalModuleName(node, getExternalModuleImportDeclarationExpression(node)) - : getSymbolOfPartOfRightHandSideOfImport(node.moduleReference, node); + var node = getDeclarationOfImportSymbol(symbol); + var target = getTargetOfImportDeclaration(node); if (links.target === resolvingSymbol) { links.target = target || unknownSymbol; } @@ -479,9 +557,9 @@ module ts { } // This function is only for imports with entity names - function getSymbolOfPartOfRightHandSideOfImport(entityName: EntityName, importDeclaration?: ImportDeclaration): Symbol { + function getSymbolOfPartOfRightHandSideOfImportEquals(entityName: EntityName, importDeclaration?: ImportEqualsDeclaration): Symbol { if (!importDeclaration) { - importDeclaration = getAncestor(entityName, SyntaxKind.ImportDeclaration); + importDeclaration = getAncestor(entityName, SyntaxKind.ImportEqualsDeclaration); Debug.assert(importDeclaration !== undefined); } // There are three things we might try to look for. In the following examples, @@ -500,7 +578,7 @@ module ts { else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - Debug.assert(entityName.parent.kind === SyntaxKind.ImportDeclaration); + Debug.assert(entityName.parent.kind === SyntaxKind.ImportEqualsDeclaration); return resolveEntityName(importDeclaration, entityName, SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace); } } @@ -524,7 +602,7 @@ module ts { else if (name.kind === SyntaxKind.QualifiedName) { var namespace = resolveEntityName(location,(name).left, SymbolFlags.Namespace); if (!namespace || namespace === unknownSymbol || getFullWidth((name).right) === 0) return; - var symbol = getSymbol(namespace.exports,(name).right.text, meaning); + var symbol = getSymbol(getExportsOfSymbol(namespace), (name).right.text, meaning); if (!symbol) { error(location, Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), declarationNameToString((name).right)); @@ -559,7 +637,7 @@ module ts { if (!isRelative) { var symbol = getSymbol(globals, '"' + moduleName + '"', SymbolFlags.ValueModule); if (symbol) { - return getResolvedExportSymbol(symbol); + return symbol; } } while (true) { @@ -572,7 +650,7 @@ module ts { } if (sourceFile) { if (sourceFile.symbol) { - return getResolvedExportSymbol(sourceFile.symbol); + return sourceFile.symbol; } error(moduleReferenceLiteral, Diagnostics.File_0_is_not_an_external_module, sourceFile.fileName); return; @@ -580,7 +658,7 @@ module ts { error(moduleReferenceLiteral, Diagnostics.Cannot_find_external_module_0, moduleName); } - function getResolvedExportSymbol(moduleSymbol: Symbol): Symbol { + function getResolvedExportAssignmentSymbol(moduleSymbol: Symbol): Symbol { var symbol = getExportAssignmentSymbol(moduleSymbol); if (symbol) { if (symbol.flags & (SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace)) { @@ -590,18 +668,16 @@ module ts { return resolveImport(symbol); } } - return moduleSymbol; } function getExportAssignmentSymbol(symbol: Symbol): Symbol { checkTypeOfExportAssignmentSymbol(symbol); - var symbolLinks = getSymbolLinks(symbol); - return symbolLinks.exportAssignSymbol === unknownSymbol ? undefined : symbolLinks.exportAssignSymbol; + return getSymbolLinks(symbol).exportAssignmentSymbol; } function checkTypeOfExportAssignmentSymbol(containerSymbol: Symbol): void { var symbolLinks = getSymbolLinks(containerSymbol); - if (!symbolLinks.exportAssignSymbol) { + if (!symbolLinks.exportAssignmentChecked) { var exportInformation = collectExportInformationForSourceFileOrModule(containerSymbol); if (exportInformation.exportAssignments.length) { if (exportInformation.exportAssignments.length > 1) { @@ -621,8 +697,9 @@ module ts { var meaning = SymbolFlags.Value | SymbolFlags.Type | SymbolFlags.Namespace; var exportSymbol = resolveName(node, node.exportName.text, meaning, Diagnostics.Cannot_find_name_0, node.exportName); } + symbolLinks.exportAssignmentSymbol = exportSymbol || unknownSymbol; } - symbolLinks.exportAssignSymbol = exportSymbol || unknownSymbol; + symbolLinks.exportAssignmentChecked = true; } } @@ -646,6 +723,41 @@ module ts { }; } + function getExportsOfSymbol(symbol: Symbol): SymbolTable { + return symbol.flags & SymbolFlags.Module ? getExportsOfModule(symbol) : symbol.exports; + } + + function getExportsOfModule(symbol: Symbol): SymbolTable { + var links = getSymbolLinks(symbol); + return links.resolvedExports || (links.resolvedExports = getExportsForModule(symbol)); + } + + function getExportsForModule(symbol: Symbol): SymbolTable { + var result: SymbolTable; + var visitedSymbols: Symbol[] = []; + visit(symbol); + return result; + + function visit(symbol: Symbol) { + if (!contains(visitedSymbols, symbol)) { + visitedSymbols.push(symbol); + if (!result) { + result = symbol.exports; + } + else { + extendSymbolTable(result, symbol.exports); + } + forEach(symbol.declarations, node => { + if (node.kind === SyntaxKind.SourceFile || node.kind === SyntaxKind.ModuleDeclaration) { + forEach((node).exportStars, exportStar => { + visit(resolveExternalModuleName(exportStar, exportStar.moduleSpecifier)); + }); + } + }); + } + } + } + function getMergedSymbol(symbol: Symbol): Symbol { var merged: Symbol; return symbol && symbol.mergeId && (merged = mergedSymbols[symbol.mergeId]) ? merged : symbol; @@ -824,7 +936,7 @@ module ts { if (symbolFromSymbolTable.flags & SymbolFlags.Import) { if (!useOnlyExternalAliasing || // We can use any type of alias to get the name // Is this external alias, then use it to name - ts.forEach(symbolFromSymbolTable.declarations, isExternalModuleImportDeclaration)) { + ts.forEach(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) { var resolvedImportedSymbol = resolveImport(symbolFromSymbolTable); if (isAccessible(symbolFromSymbolTable, resolveImport(symbolFromSymbolTable))) { @@ -950,7 +1062,7 @@ module ts { } function hasVisibleDeclarations(symbol: Symbol): SymbolVisibilityResult { - var aliasesToMakeVisible: ImportDeclaration[]; + var aliasesToMakeVisible: ImportEqualsDeclaration[]; if (forEach(symbol.declarations, declaration => !getIsDeclarationVisible(declaration))) { return undefined; } @@ -960,17 +1072,17 @@ module ts { if (!isDeclarationVisible(declaration)) { // Mark the unexported alias as visible if its parent is visible // because these kind of aliases can be used to name types in declaration file - if (declaration.kind === SyntaxKind.ImportDeclaration && + if (declaration.kind === SyntaxKind.ImportEqualsDeclaration && !(declaration.flags & NodeFlags.Export) && isDeclarationVisible(declaration.parent)) { getNodeLinks(declaration).isVisible = true; if (aliasesToMakeVisible) { if (!contains(aliasesToMakeVisible, declaration)) { - aliasesToMakeVisible.push(declaration); + aliasesToMakeVisible.push(declaration); } } else { - aliasesToMakeVisible = [declaration]; + aliasesToMakeVisible = [declaration]; } return true; } @@ -991,7 +1103,7 @@ module ts { meaning = SymbolFlags.Value | SymbolFlags.ExportValue; } else if (entityName.kind === SyntaxKind.QualifiedName || - entityName.parent.kind === SyntaxKind.ImportDeclaration) { + entityName.parent.kind === SyntaxKind.ImportEqualsDeclaration) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = SymbolFlags.Namespace; @@ -1602,11 +1714,11 @@ module ts { case SyntaxKind.TypeAliasDeclaration: case SyntaxKind.FunctionDeclaration: case SyntaxKind.EnumDeclaration: - case SyntaxKind.ImportDeclaration: + case SyntaxKind.ImportEqualsDeclaration: var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(getCombinedNodeFlags(node) & NodeFlags.Export) && - !(node.kind !== SyntaxKind.ImportDeclaration && parent.kind !== SyntaxKind.SourceFile && isInAmbientContext(parent))) { + !(node.kind !== SyntaxKind.ImportEqualsDeclaration && parent.kind !== SyntaxKind.SourceFile && isInAmbientContext(parent))) { return isGlobalSourceFile(parent) || isUsedInExportAssignment(node); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible @@ -1721,8 +1833,8 @@ module ts { } } else { - // For an array binding element the specified or inferred type of the parent must be assignable to any[] - if (!isTypeAssignableTo(parentType, anyArrayType)) { + // For an array binding element the specified or inferred type of the parent must be an array-like type + if (!isArrayLikeType(parentType)) { error(pattern, Diagnostics.Type_0_is_not_an_array_type, typeToString(parentType)); return unknownType; } @@ -2419,7 +2531,7 @@ module ts { var callSignatures: Signature[] = emptyArray; var constructSignatures: Signature[] = emptyArray; if (symbol.flags & SymbolFlags.HasExports) { - members = symbol.exports; + members = getExportsOfSymbol(symbol); } if (symbol.flags & (SymbolFlags.Function | SymbolFlags.Method)) { callSignatures = getSignaturesOfSymbol(symbol); @@ -3409,7 +3521,7 @@ module ts { return isContextSensitive((node).whenTrue) || isContextSensitive((node).whenFalse); case SyntaxKind.BinaryExpression: - return (node).operator === SyntaxKind.BarBarToken && + return (node).operatorToken.kind === SyntaxKind.BarBarToken && (isContextSensitive((node).left) || isContextSensitive((node).right)); case SyntaxKind.PropertyAssignment: return isContextSensitive((node).initializer); @@ -4190,6 +4302,11 @@ module ts { return type.flags & TypeFlags.Reference && (type).target === globalArrayType; } + function isArrayLikeType(type: Type): boolean { + // A type is array-like if it is not the undefined or null type and if it is assignable to any[] + return !(type.flags & (TypeFlags.Undefined | TypeFlags.Null)) && isTypeAssignableTo(type, anyArrayType); + } + function isTupleLikeType(type: Type): boolean { return !!getPropertyOfType(type, "0"); } @@ -4591,7 +4708,7 @@ module ts { return links.assignmentChecks[symbol.id] = isAssignedIn(node); function isAssignedInBinaryExpression(node: BinaryExpression) { - if (node.operator >= SyntaxKind.FirstAssignment && node.operator <= SyntaxKind.LastAssignment) { + if (node.operatorToken.kind >= SyntaxKind.FirstAssignment && node.operatorToken.kind <= SyntaxKind.LastAssignment) { var n = node.left; while (n.kind === SyntaxKind.ParenthesizedExpression) { n = (n).expression; @@ -4724,10 +4841,10 @@ module ts { case SyntaxKind.BinaryExpression: // In the right operand of an && or ||, narrow based on left operand if (child === (node).right) { - if ((node).operator === SyntaxKind.AmpersandAmpersandToken) { + if ((node).operatorToken.kind === SyntaxKind.AmpersandAmpersandToken) { narrowedType = narrowType(type, (node).left, /*assumeTrue*/ true); } - else if ((node).operator === SyntaxKind.BarBarToken) { + else if ((node).operatorToken.kind === SyntaxKind.BarBarToken) { narrowedType = narrowType(type, (node).left, /*assumeTrue*/ false); } } @@ -4765,7 +4882,7 @@ module ts { return type; } var typeInfo = primitiveTypeInfo[right.text]; - if (expr.operator === SyntaxKind.ExclamationEqualsEqualsToken) { + if (expr.operatorToken.kind === SyntaxKind.ExclamationEqualsEqualsToken) { assumeTrue = !assumeTrue; } if (assumeTrue) { @@ -4855,7 +4972,7 @@ module ts { case SyntaxKind.ParenthesizedExpression: return narrowType(type, (expr).expression, assumeTrue); case SyntaxKind.BinaryExpression: - var operator = (expr).operator; + var operator = (expr).operatorToken.kind; if (operator === SyntaxKind.EqualsEqualsEqualsToken || operator === SyntaxKind.ExclamationEqualsEqualsToken) { return narrowTypeByEquality(type, expr, assumeTrue); } @@ -4880,16 +4997,18 @@ module ts { } /*Transitively mark all linked imports as referenced*/ - function markLinkedImportsAsReferenced(node: ImportDeclaration): void { - var nodeLinks = getNodeLinks(node); - while (nodeLinks.importOnRightSide) { - var rightSide = nodeLinks.importOnRightSide; - nodeLinks.importOnRightSide = undefined; + function markLinkedImportsAsReferenced(node: ImportEqualsDeclaration): void { + if (node) { + var nodeLinks = getNodeLinks(node); + while (nodeLinks.importOnRightSide) { + var rightSide = nodeLinks.importOnRightSide; + nodeLinks.importOnRightSide = undefined; - getSymbolLinks(rightSide).referenced = true; - Debug.assert((rightSide.flags & SymbolFlags.Import) !== 0); + getSymbolLinks(rightSide).referenced = true; + Debug.assert((rightSide.flags & SymbolFlags.Import) !== 0); - nodeLinks = getNodeLinks(getDeclarationOfKind(rightSide, SyntaxKind.ImportDeclaration)) + nodeLinks = getNodeLinks(getDeclarationOfKind(rightSide, SyntaxKind.ImportEqualsDeclaration)) + } } } @@ -4903,13 +5022,25 @@ module ts { // To avoid that we will give an error to users if they use arguments objects in arrow function so that they // can explicitly bound arguments objects if (symbol === argumentsSymbol && getContainingFunction(node).kind === SyntaxKind.ArrowFunction) { - error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression); + error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression); } if (symbol.flags & SymbolFlags.Import) { + + //var symbolLinks = getSymbolLinks(symbol); + //if (!symbolLinks.referenced) { + // if (!isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveImport(symbol))) { + // symbolLinks.referenced = true; + // } + //} + + // TODO: AndersH: This needs to be simplified. In an import of the form "import x = a.b.c;" we only need + // to resolve "a" and mark it as referenced. If "b" and/or "c" are aliases, we would be able to access them + // unless they're exported, and in that case they're already implicitly referenced. + var symbolLinks = getSymbolLinks(symbol); if (!symbolLinks.referenced) { - var importOrExportAssignment = getLeftSideOfImportOrExportAssignment(node); + var importOrExportAssignment = getLeftSideOfImportEqualsOrExportAssignment(node); // decision about whether import is referenced can be made now if // - import that are used anywhere except right side of import declarations @@ -4930,7 +5061,7 @@ module ts { } if (symbolLinks.referenced) { - markLinkedImportsAsReferenced(getDeclarationOfKind(symbol, SyntaxKind.ImportDeclaration)); + markLinkedImportsAsReferenced(getDeclarationOfKind(symbol, SyntaxKind.ImportEqualsDeclaration)); } } @@ -5202,7 +5333,7 @@ module ts { function getContextualTypeForBinaryOperand(node: Expression): Type { var binaryExpression = node.parent; - var operator = binaryExpression.operator; + var operator = binaryExpression.operatorToken.kind; if (operator >= SyntaxKind.FirstAssignment && operator <= SyntaxKind.LastAssignment) { // In an assignment expression, the right operand is contextually typed by the type of the left operand. if (node === binaryExpression.right) { @@ -5452,7 +5583,7 @@ module ts { // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ p: a}] = xxx'. function isAssignmentTarget(node: Node): boolean { var parent = node.parent; - if (parent.kind === SyntaxKind.BinaryExpression && (parent).operator === SyntaxKind.EqualsToken && (parent).left === node) { + if (parent.kind === SyntaxKind.BinaryExpression && (parent).operatorToken.kind === SyntaxKind.EqualsToken && (parent).left === node) { return true; } if (parent.kind === SyntaxKind.PropertyAssignment) { @@ -5466,7 +5597,7 @@ module ts { function checkSpreadElementExpression(node: SpreadElementExpression, contextualMapper?: TypeMapper): Type { var type = checkExpressionCached(node.expression, contextualMapper); - if (!isTypeAssignableTo(type, anyArrayType)) { + if (!isArrayLikeType(type)) { error(node.expression, Diagnostics.Type_0_is_not_an_array_type, typeToString(type)); return unknownType; } @@ -7074,7 +7205,7 @@ module ts { function checkArrayLiteralAssignment(node: ArrayLiteralExpression, sourceType: Type, contextualMapper?: TypeMapper): Type { // TODOO(andersh): Allow iterable source type in ES6 - if (!isTypeAssignableTo(sourceType, anyArrayType)) { + if (!isArrayLikeType(sourceType)) { error(node, Diagnostics.Type_0_is_not_an_array_type, typeToString(sourceType)); return sourceType; } @@ -7108,7 +7239,7 @@ module ts { } function checkDestructuringAssignment(target: Expression, sourceType: Type, contextualMapper?: TypeMapper): Type { - if (target.kind === SyntaxKind.BinaryExpression && (target).operator === SyntaxKind.EqualsToken) { + if (target.kind === SyntaxKind.BinaryExpression && (target).operatorToken.kind === SyntaxKind.EqualsToken) { checkBinaryExpression(target, contextualMapper); target = (target).left; } @@ -7131,13 +7262,13 @@ module ts { function checkBinaryExpression(node: BinaryExpression, contextualMapper?: TypeMapper) { // Grammar checking - if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operator)) { + if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operatorToken.kind)) { // ECMA 262 (Annex C) The identifier eval or arguments may not appear as the LeftHandSideExpression of an // Assignment operator(11.13) or of a PostfixExpression(11.3) checkGrammarEvalOrArgumentsInStrictMode(node, node.left); } - var operator = node.operator; + var operator = node.operatorToken.kind; if (operator === SyntaxKind.EqualsToken && (node.left.kind === SyntaxKind.ObjectLiteralExpression || node.left.kind === SyntaxKind.ArrayLiteralExpression)) { return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); } @@ -7178,8 +7309,8 @@ module ts { // try and return them a helpful suggestion if ((leftType.flags & TypeFlags.Boolean) && (rightType.flags & TypeFlags.Boolean) && - (suggestedOperator = getSuggestedBooleanOperator(node.operator)) !== undefined) { - error(node, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(node.operator), tokenToString(suggestedOperator)); + (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { + error(node, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(node.operatorToken.kind), tokenToString(suggestedOperator)); } else { // otherwise just check each operand separately and report errors as normal @@ -7312,7 +7443,7 @@ module ts { } function reportOperatorError() { - error(node, Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, tokenToString(node.operator), typeToString(leftType), typeToString(rightType)); + error(node, Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, tokenToString(node.operatorToken.kind), typeToString(leftType), typeToString(rightType)); } } @@ -8165,7 +8296,7 @@ module ts { case SyntaxKind.ClassDeclaration: case SyntaxKind.EnumDeclaration: return SymbolFlags.ExportType | SymbolFlags.ExportValue; - case SyntaxKind.ImportDeclaration: + case SyntaxKind.ImportEqualsDeclaration: var result: SymbolFlags = 0; var target = resolveImport(getSymbolOfNode(d)); forEach(target.declarations, d => { result |= getDeclarationSpaces(d); }); @@ -9252,7 +9383,7 @@ module ts { if (right === undefined) { return undefined; } - switch ((e).operator) { + switch ((e).operatorToken.kind) { case SyntaxKind.BarToken: return left | right; case SyntaxKind.AmpersandToken: return left & right; case SyntaxKind.GreaterThanGreaterThanToken: return left >> right; @@ -9411,13 +9542,12 @@ module ts { for (var i = 0, n = statements.length; i < n; i++) { var statement = statements[i]; + // TODO: AndersH: No reason to do a separate pass over the statements for this check, we should + // just fold it into checkExportAssignment. if (statement.kind === SyntaxKind.ExportAssignment) { // Export assignments are not allowed in an internal module grammarErrorOnNode(statement, Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); } - else if (isExternalModuleImportDeclaration(statement)) { - grammarErrorOnNode(getExternalModuleImportDeclarationExpression(statement), Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); - } } } } @@ -9463,18 +9593,81 @@ module ts { return node; } - function checkImportDeclaration(node: ImportDeclaration) { - // Grammar checking - checkGrammarModifiers(node); + function checkExternalImportOrExportDeclaration(node: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration): boolean { + var moduleName = getExternalModuleName(node); + if (getFullWidth(moduleName) !== 0 && moduleName.kind !== SyntaxKind.StringLiteral) { + error(moduleName, Diagnostics.String_literal_expected); + return false; + } + var inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && (node.parent.parent).name.kind === SyntaxKind.StringLiteral; + if (node.parent.kind !== SyntaxKind.SourceFile && !inAmbientExternalModule) { + error(moduleName, node.kind === SyntaxKind.ExportDeclaration ? + Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : + Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + return false; + } + if (inAmbientExternalModule && isExternalModuleNameRelative((moduleName).text)) { + // TypeScript 1.0 spec (April 2013): 12.1.6 + // An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference + // other external modules only through top - level external module names. + // Relative external module names are not permitted. + error(node, Diagnostics.Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); + return false; + } + return true; + } + function checkImportSymbol(node: ImportEqualsDeclaration | ImportClause | NamespaceImport | ImportSpecifier | ExportSpecifier) { + var symbol = getSymbolOfNode(node); + var target = resolveImport(symbol); + if (target !== unknownSymbol) { + var excludedMeanings = + (symbol.flags & SymbolFlags.Value ? SymbolFlags.Value : 0) | + (symbol.flags & SymbolFlags.Type ? SymbolFlags.Type : 0) | + (symbol.flags & SymbolFlags.Namespace ? SymbolFlags.Namespace : 0); + if (target.flags & excludedMeanings) { + var message = node.kind === SyntaxKind.ExportSpecifier ? + Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : + Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; + error(node, message, symbolToString(symbol)); + } + } + } + + function checkImportBinding(node: ImportEqualsDeclaration | ImportClause | NamespaceImport | ImportSpecifier) { checkCollisionWithCapturedThisVariable(node, node.name); checkCollisionWithRequireExportsInGeneratedCode(node, node.name); - var symbol = getSymbolOfNode(node); - var target: Symbol; - - if (isInternalModuleImportDeclaration(node)) { - target = resolveImport(symbol); - // Import declaration for an internal module + checkImportSymbol(node); + } + + function checkImportDeclaration(node: ImportDeclaration) { + if (!checkGrammarModifiers(node) && (node.flags & NodeFlags.Modifier)) { + grammarErrorOnFirstToken(node, Diagnostics.An_import_declaration_cannot_have_modifiers); + } + if (checkExternalImportOrExportDeclaration(node)) { + var importClause = node.importClause; + if (importClause) { + if (importClause.name) { + checkImportBinding(importClause); + } + if (importClause.namedBindings) { + if (importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { + checkImportBinding(importClause.namedBindings); + } + else { + forEach((importClause.namedBindings).elements, checkImportBinding); + } + } + } + } + } + + function checkImportEqualsDeclaration(node: ImportEqualsDeclaration) { + checkGrammarModifiers(node); + if (isInternalModuleImportEqualsDeclaration(node)) { + checkImportBinding(node); + var symbol = getSymbolOfNode(node); + var target = resolveImport(symbol); if (target !== unknownSymbol) { if (target.flags & SymbolFlags.Value) { // Target is a value symbol, check that it is not hidden by a local declaration with the same name and @@ -9493,40 +9686,19 @@ module ts { } } else { - // Import declaration for an external module - if (node.parent.kind === SyntaxKind.SourceFile) { - target = resolveImport(symbol); - } - else if (node.parent.kind === SyntaxKind.ModuleBlock && (node.parent.parent).name.kind === SyntaxKind.StringLiteral) { - // TypeScript 1.0 spec (April 2013): 12.1.6 - // An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference - // other external modules only through top - level external module names. - // Relative external module names are not permitted. - if (getExternalModuleImportDeclarationExpression(node).kind === SyntaxKind.StringLiteral) { - if (isExternalModuleNameRelative((getExternalModuleImportDeclarationExpression(node)).text)) { - error(node, Diagnostics.Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); - target = unknownSymbol; - } - else { - target = resolveImport(symbol); - } - } - else { - target = unknownSymbol; - } - } - else { - // Parent is an internal module (syntax error is already reported) - target = unknownSymbol; + if (checkExternalImportOrExportDeclaration(node)) { + checkImportBinding(node); } } - if (target !== unknownSymbol) { - var excludedMeanings = - (symbol.flags & SymbolFlags.Value ? SymbolFlags.Value : 0) | - (symbol.flags & SymbolFlags.Type ? SymbolFlags.Type : 0) | - (symbol.flags & SymbolFlags.Namespace ? SymbolFlags.Namespace : 0); - if (target.flags & excludedMeanings) { - error(node, Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0, symbolToString(symbol)); + } + + function checkExportDeclaration(node: ExportDeclaration) { + if (!checkGrammarModifiers(node) && (node.flags & NodeFlags.Modifier)) { + grammarErrorOnFirstToken(node, Diagnostics.An_export_declaration_cannot_have_modifiers); + } + if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { + if (node.exportClause) { + forEach(node.exportClause.elements, checkImportSymbol); } } } @@ -9636,6 +9808,10 @@ module ts { return checkModuleDeclaration(node); case SyntaxKind.ImportDeclaration: return checkImportDeclaration(node); + case SyntaxKind.ImportEqualsDeclaration: + return checkImportEqualsDeclaration(node); + case SyntaxKind.ExportDeclaration: + return checkExportDeclaration(node); case SyntaxKind.ExportAssignment: return checkExportAssignment(node); case SyntaxKind.EmptyStatement: @@ -9761,7 +9937,7 @@ module ts { // Mark the import as referenced so that we emit it in the final .js file. getSymbolLinks(symbol).referenced = true; // mark any import declarations that depend upon this import as referenced - markLinkedImportsAsReferenced(getDeclarationOfKind(symbol, SyntaxKind.ImportDeclaration)) + markLinkedImportsAsReferenced(getDeclarationOfKind(symbol, SyntaxKind.ImportEqualsDeclaration)) } } @@ -9979,13 +10155,13 @@ module ts { return false; } - function getLeftSideOfImportOrExportAssignment(nodeOnRightSide: EntityName): ImportDeclaration | ExportAssignment { + function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide: EntityName): ImportEqualsDeclaration | ExportAssignment { while (nodeOnRightSide.parent.kind === SyntaxKind.QualifiedName) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === SyntaxKind.ImportDeclaration) { - return (nodeOnRightSide.parent).moduleReference === nodeOnRightSide && nodeOnRightSide.parent; + if (nodeOnRightSide.parent.kind === SyntaxKind.ImportEqualsDeclaration) { + return (nodeOnRightSide.parent).moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } if (nodeOnRightSide.parent.kind === SyntaxKind.ExportAssignment) { @@ -9996,7 +10172,7 @@ module ts { } function isInRightSideOfImportOrExportAssignment(node: EntityName) { - return getLeftSideOfImportOrExportAssignment(node) !== undefined; + return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined; } function isRightSideOfQualifiedNameOrPropertyAccess(node: Node) { @@ -10017,7 +10193,7 @@ module ts { if (entityName.kind !== SyntaxKind.PropertyAccessExpression) { if (isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import - return getSymbolOfPartOfRightHandSideOfImport(entityName); + return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } } @@ -10078,7 +10254,7 @@ module ts { if (node.kind === SyntaxKind.Identifier && isInRightSideOfImportOrExportAssignment(node)) { return node.parent.kind === SyntaxKind.ExportAssignment ? getSymbolOfEntityNameOrPropertyAccessExpression(node) - : getSymbolOfPartOfRightHandSideOfImport(node); + : getSymbolOfPartOfRightHandSideOfImportEquals(node); } switch (node.kind) { @@ -10102,8 +10278,8 @@ module ts { case SyntaxKind.StringLiteral: // External module name in an import declaration - if (isExternalModuleImportDeclaration(node.parent.parent) && - getExternalModuleImportDeclarationExpression(node.parent.parent) === node) { + if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && + getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) { var importSymbol = getSymbolOfNode(node.parent.parent); var moduleType = getTypeOfSymbol(importSymbol); return moduleType ? moduleType.symbol : undefined; @@ -10236,73 +10412,172 @@ module ts { function isUniqueLocalName(name: string, container: Node): boolean { for (var node = container; isNodeDescendentOf(node, container); node = node.nextContainer) { if (node.locals && hasProperty(node.locals, name)) { - var symbolWithRelevantName = node.locals[name]; - if (symbolWithRelevantName.flags & (SymbolFlags.Value | SymbolFlags.ExportValue)) { + // We conservatively include import symbols to cover cases where they're emitted as locals + if (node.locals[name].flags & (SymbolFlags.Value | SymbolFlags.ExportValue | SymbolFlags.Import)) { return false; } - - // An import can be emitted too, if it is referenced as a value. - // Make sure the name in question does not collide with an import. - if (symbolWithRelevantName.flags & SymbolFlags.Import) { - var importDeclarationWithRelevantName = getDeclarationOfKind(symbolWithRelevantName, SyntaxKind.ImportDeclaration); - if (isReferencedImportDeclaration(importDeclarationWithRelevantName)) { - return false; - } - } } } return true; } - function getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string { - var links = getNodeLinks(container); - if (!links.localModuleName) { - var prefix = ""; - var name = unescapeIdentifier(container.name.text); - while (!isUniqueLocalName(escapeIdentifier(prefix + name), container)) { - prefix += "_"; - } - links.localModuleName = prefix + getTextOfNode(container.name); + function getGeneratedNamesForSourceFile(sourceFile: SourceFile): Map { + var links = getNodeLinks(sourceFile); + var generatedNames = links.generatedNames; + if (!generatedNames) { + generatedNames = links.generatedNames = {}; + generateNames(sourceFile); + } + return generatedNames; + + function generateNames(node: Node) { + switch (node.kind) { + case SyntaxKind.ModuleDeclaration: + generateNameForModuleOrEnum(node); + generateNames((node).body); + break; + case SyntaxKind.EnumDeclaration: + generateNameForModuleOrEnum(node); + break; + case SyntaxKind.ImportDeclaration: + generateNameForImportDeclaration(node); + break; + case SyntaxKind.ExportDeclaration: + generateNameForExportDeclaration(node); + break; + case SyntaxKind.SourceFile: + case SyntaxKind.ModuleBlock: + forEach((node).statements, generateNames); + break; + } + } + + function isExistingName(name: string) { + return hasProperty(globals, name) || hasProperty(sourceFile.identifiers, name) || hasProperty(generatedNames, name); + } + + function makeUniqueName(baseName: string): string { + // First try '_name' + if (baseName.charCodeAt(0) !== CharacterCodes._) { + var baseName = "_" + baseName; + if (!isExistingName(baseName)) { + return generatedNames[baseName] = baseName; + } + } + // Find the first unique '_name_n', where n is a positive number + if (baseName.charCodeAt(baseName.length - 1) !== CharacterCodes._) { + baseName += "_"; + } + var i = 1; + while (true) { + name = baseName + i; + if (!isExistingName(name)) { + return generatedNames[name] = name; + } + i++; + } + } + + function assignGeneratedName(node: Node, name: string) { + getNodeLinks(node).generatedName = unescapeIdentifier(name); + } + + function generateNameForModuleOrEnum(node: ModuleDeclaration | EnumDeclaration) { + if (node.name.kind === SyntaxKind.Identifier) { + var name = node.name.text; + // Use module/enum name itself if it is unique, otherwise make a unique variation + assignGeneratedName(node, isUniqueLocalName(name, node) ? name : makeUniqueName(name)); + } + } + + function generateNameForImportOrExportDeclaration(node: ImportDeclaration | ExportDeclaration) { + var expr = getExternalModuleName(node); + var baseName = expr.kind === SyntaxKind.StringLiteral ? + escapeIdentifier(makeIdentifierFromModuleName((expr).text)) : "module"; + assignGeneratedName(node, makeUniqueName(baseName)); + } + + function generateNameForImportDeclaration(node: ImportDeclaration) { + if (node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === SyntaxKind.NamedImports) { + generateNameForImportOrExportDeclaration(node); + } + } + + function generateNameForExportDeclaration(node: ExportDeclaration) { + if (node.moduleSpecifier) { + generateNameForImportOrExportDeclaration(node); + } } - return links.localModuleName; } - function getLocalNameForSymbol(symbol: Symbol, location: Node): string { + function getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration) { + var links = getNodeLinks(node); + if (!links.generatedName) { + getGeneratedNamesForSourceFile(getSourceFile(node)); + } + return links.generatedName; + } + + function getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string { + return getGeneratedNameForNode(container); + } + + function getLocalNameForImportDeclaration(node: ImportDeclaration): string { + return getGeneratedNameForNode(node); + } + + function getImportNameSubstitution(symbol: Symbol): string { + var declaration = getDeclarationOfImportSymbol(symbol); + if (declaration && declaration.kind === SyntaxKind.ImportSpecifier) { + var moduleName = getGeneratedNameForNode(declaration.parent.parent.parent); + var propertyName = (declaration).propertyName || (declaration).name; + return moduleName + "." + unescapeIdentifier(propertyName.text); + } + } + + function getExportNameSubstitution(symbol: Symbol, location: Node): string { + if (isExternalModuleSymbol(symbol.parent)) { + return "exports." + unescapeIdentifier(symbol.name); + } var node = location; + var containerSymbol = getParentOfSymbol(symbol); while (node) { - if ((node.kind === SyntaxKind.ModuleDeclaration || node.kind === SyntaxKind.EnumDeclaration) && getSymbolOfNode(node) === symbol) { - return getLocalNameOfContainer(node); + if ((node.kind === SyntaxKind.ModuleDeclaration || node.kind === SyntaxKind.EnumDeclaration) && getSymbolOfNode(node) === containerSymbol) { + return getGeneratedNameForNode(node) + "." + unescapeIdentifier(symbol.name); } node = node.parent; } - Debug.fail("getLocalNameForSymbol failed"); } - function getExpressionNamePrefix(node: Identifier): string { + function getExpressionNameSubstitution(node: Identifier): string { var symbol = getNodeLinks(node).resolvedSymbol; if (symbol) { - // In general, we need to prefix an identifier with its parent name if it references - // an exported entity from another module declaration. If we reference an exported - // entity within the same module declaration, then whether we prefix depends on the - // kind of entity. SymbolFlags.ExportHasLocal encompasses all the kinds that we - // do NOT prefix. + // Whan an identifier resolves to a parented symbol, it references an exported entity from + // another declaration of the same internal module. + if (symbol.parent) { + return getExportNameSubstitution(symbol, node.parent); + } + // If we reference an exported entity within the same module declaration, then whether + // we prefix depends on the kind of entity. SymbolFlags.ExportHasLocal encompasses all the + // kinds that we do NOT prefix. var exportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); if (symbol !== exportSymbol && !(exportSymbol.flags & SymbolFlags.ExportHasLocal)) { - symbol = exportSymbol; + return getExportNameSubstitution(exportSymbol, node.parent); } - if (symbol.parent) { - return isExternalModuleSymbol(symbol.parent) ? "exports" : getLocalNameForSymbol(getParentOfSymbol(symbol), node.parent); + // Named imports from ES6 import declarations are rewritten + if (symbol.flags & SymbolFlags.Import) { + return getImportNameSubstitution(symbol); } } } function getExportAssignmentName(node: SourceFile): string { var symbol = getExportAssignmentSymbol(getSymbolOfNode(node)); - return symbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol) ? symbolToString(symbol): undefined; + return symbol && symbol !== unknownSymbol && symbolIsValue(symbol) && !isConstEnumSymbol(symbol) ? symbolToString(symbol): undefined; } - function isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean { - if (node.parent.kind !== SyntaxKind.SourceFile || !isInternalModuleImportDeclaration(node)) { + function isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean { + if (node.parent.kind !== SyntaxKind.SourceFile || !isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -10319,17 +10594,19 @@ module ts { return isConstEnumSymbol(s) || s.constEnumOnlyModule; } - function isReferencedImportDeclaration(node: ImportDeclaration): boolean { - var symbol = getSymbolOfNode(node); - if (getSymbolLinks(symbol).referenced) { - return true; + function isReferencedImportDeclaration(node: Node): boolean { + if (isImportSymbolDeclaration(node)) { + var symbol = getSymbolOfNode(node); + if (getSymbolLinks(symbol).referenced) { + return true; + } + // logic below will answer 'true' for exported import declaration in a nested module that itself is not exported. + // As a consequence this might cause emitting extra. + if (node.kind === SyntaxKind.ImportEqualsDeclaration && node.flags & NodeFlags.Export && isImportResolvedToValue(symbol)) { + return true; + } } - // logic below will answer 'true' for exported import declaration in a nested module that itself is not exported. - // As a consequence this might cause emitting extra. - if (node.flags & NodeFlags.Export) { - return isImportResolvedToValue(symbol); - } - return false; + return forEachChild(node, isReferencedImportDeclaration); } function isImplementationOfOverload(node: FunctionLikeDeclaration) { @@ -10395,17 +10672,18 @@ module ts { } function isUnknownIdentifier(location: Node, name: string): boolean { - return !resolveName(location, name, SymbolFlags.Value, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); + return !resolveName(location, name, SymbolFlags.Value, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined) && + !hasProperty(getGeneratedNamesForSourceFile(getSourceFile(location)), name); } function createResolver(): EmitResolver { return { - getLocalNameOfContainer, - getExpressionNamePrefix, + getGeneratedNameForNode, + getExpressionNameSubstitution, getExportAssignmentName, isReferencedImportDeclaration, getNodeCheckFlags, - isTopLevelValueImportWithEntityName, + isTopLevelValueImportEqualsWithEntityName, isDeclarationVisible, isImplementationOfOverload, writeTypeOfDeclaration, @@ -10426,7 +10704,7 @@ module ts { // Initialize global symbol table forEach(host.getSourceFiles(), file => { if (!isExternalModule(file)) { - extendSymbolTable(globals, file.locals); + mergeSymbolTable(globals, file.locals); } }); @@ -10481,11 +10759,13 @@ module ts { case SyntaxKind.InterfaceDeclaration: case SyntaxKind.ModuleDeclaration: case SyntaxKind.EnumDeclaration: - case SyntaxKind.ExportAssignment: case SyntaxKind.VariableStatement: case SyntaxKind.FunctionDeclaration: case SyntaxKind.TypeAliasDeclaration: case SyntaxKind.ImportDeclaration: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ExportDeclaration: + case SyntaxKind.ExportAssignment: case SyntaxKind.Parameter: break; default: @@ -10590,7 +10870,7 @@ module ts { return grammarErrorOnNode(lastPrivate, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if (node.kind === SyntaxKind.ImportDeclaration && flags & NodeFlags.Ambient) { + else if ((node.kind === SyntaxKind.ImportDeclaration || node.kind === SyntaxKind.ImportEqualsDeclaration) && flags & NodeFlags.Ambient) { return grammarErrorOnNode(lastDeclare, Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } else if (node.kind === SyntaxKind.InterfaceDeclaration && flags & NodeFlags.Ambient) { @@ -10827,10 +11107,7 @@ module ts { } var computedPropertyName = node; - if (languageVersion < ScriptTarget.ES6) { - return grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); - } - else if (computedPropertyName.expression.kind === SyntaxKind.BinaryExpression && (computedPropertyName.expression).operator === SyntaxKind.CommaToken) { + if (computedPropertyName.expression.kind === SyntaxKind.BinaryExpression && (computedPropertyName.expression).operatorToken.kind === SyntaxKind.CommaToken) { return grammarErrorOnNode(computedPropertyName.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } @@ -11384,6 +11661,8 @@ module ts { // if (node.kind === SyntaxKind.InterfaceDeclaration || node.kind === SyntaxKind.ImportDeclaration || + node.kind === SyntaxKind.ImportEqualsDeclaration || + node.kind === SyntaxKind.ExportDeclaration || node.kind === SyntaxKind.ExportAssignment || (node.flags & NodeFlags.Ambient)) { diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 48c4f597ad7..9169a7bf688 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -150,6 +150,10 @@ module ts { Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, + An_import_declaration_cannot_have_modifiers: { code: 1191, category: DiagnosticCategory.Error, key: "An import declaration cannot have modifiers." }, + External_module_0_has_no_default_export_or_export_assignment: { code: 1192, category: DiagnosticCategory.Error, key: "External module '{0}' has no default export or export assignment." }, + An_export_declaration_cannot_have_modifiers: { code: 1193, category: DiagnosticCategory.Error, key: "An export declaration cannot have modifiers." }, + Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: DiagnosticCategory.Error, key: "Export declarations are not permitted in an internal module." }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, 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." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -278,7 +282,7 @@ module ts { Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: DiagnosticCategory.Error, key: "Ambient external module declaration cannot specify relative module name." }, Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: DiagnosticCategory.Error, key: "Module '{0}' is hidden by a local declaration with the same name" }, Import_name_cannot_be_0: { code: 2438, category: DiagnosticCategory.Error, key: "Import name cannot be '{0}'" }, - Import_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: DiagnosticCategory.Error, key: "Import declaration in an ambient external module declaration cannot reference external module through relative external module name." }, + Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: DiagnosticCategory.Error, key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." }, Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: DiagnosticCategory.Error, key: "Import declaration conflicts with local declaration of '{0}'" }, Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: DiagnosticCategory.Error, key: "Types have separate declarations of a private property '{0}'." }, @@ -322,6 +326,7 @@ module ts { Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: DiagnosticCategory.Error, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." }, The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, + Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: DiagnosticCategory.Error, key: "Export declaration conflicts with exported declaration of '{0}'" }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index f124fa53717..38a67dc6ed4 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -591,6 +591,22 @@ "category": "Error", "code": 1190 }, + "An import declaration cannot have modifiers.": { + "category": "Error", + "code": 1191 + }, + "External module '{0}' has no default export or export assignment.": { + "category": "Error", + "code": 1192 + }, + "An export declaration cannot have modifiers.": { + "category": "Error", + "code": 1193 + }, + "Export declarations are not permitted in an internal module.": { + "category": "Error", + "code": 1194 + }, "Duplicate identifier '{0}'.": { "category": "Error", @@ -1104,7 +1120,7 @@ "category": "Error", "code": 2438 }, - "Import declaration in an ambient external module declaration cannot reference external module through relative external module name.": { + "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name.": { "category": "Error", "code": 2439 }, @@ -1280,6 +1296,10 @@ "category": "Error", "code": 2483 }, + "Export declaration conflicts with exported declaration of '{0}'": { + "category": "Error", + "code": 2484 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 62910c184aa..3330003f681 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -16,11 +16,23 @@ module ts { getIndent(): number; } + interface ExternalImportInfo { + rootNode: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration; + declarationNode?: ImportEqualsDeclaration | ImportClause | NamespaceImport; + namedImports?: NamedImports; + } + interface SymbolAccessibilityDiagnostic { errorNode: Node; diagnosticMessage: DiagnosticMessage; typeName?: DeclarationName; } + + interface SynthesizedNode extends Node { + leadingCommentRanges?: CommentRange[]; + trailingCommentRanges?: CommentRange[]; + } + type GetSymbolAccessibilityDiagnostic = (symbolAccesibilityResult: SymbolAccessiblityResult) => SymbolAccessibilityDiagnostic; interface EmitTextWriterWithSymbolWriter extends EmitTextWriter, SymbolWriter { @@ -28,7 +40,7 @@ module ts { } interface AliasDeclarationEmitInfo { - declaration: ImportDeclaration; + declaration: ImportEqualsDeclaration; outputPos: number; indent: number; asynchronousOutput?: string; // If the output for alias was written asynchronously, the corresponding output @@ -170,16 +182,17 @@ module ts { function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string){ if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { var firstCommentLineAndCharacter = getLineAndCharacterOfPosition(currentSourceFile, comment.pos); - var lastLine = getLineStarts(currentSourceFile).length; + var lineCount = getLineStarts(currentSourceFile).length; var firstCommentLineIndent: number; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = currentLine === lastLine ? (comment.end + 1) : getPositionFromLineAndCharacter(currentSourceFile, currentLine + 1, /*character*/1); + var nextLineStart = (currentLine + 1) === lineCount + ? currentSourceFile.text.length + 1 + : getStartPositionOfLine(currentLine + 1, currentSourceFile); if (pos !== comment.pos) { // If we are not emitting first line, we need to write the spaces to adjust the alignment if (firstCommentLineIndent === undefined) { - firstCommentLineIndent = calculateIndent(getPositionFromLineAndCharacter(currentSourceFile, firstCommentLineAndCharacter.line, /*character*/1), - comment.pos); + firstCommentLineIndent = calculateIndent(getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); } // These are number of spaces writer is going to write at current indent @@ -195,7 +208,7 @@ module ts { // } // module m { // /* this is line 1 -- Assume current writer indent 8 - // * line --3 = 8 - 4 + 5 + // * line --3 = 8 - 4 + 5 // More right indented comment */ --4 = 8 - 4 + 11 // class c { } // } @@ -271,7 +284,7 @@ module ts { }); } - function getAllAccessorDeclarations(node: ClassDeclaration, accessor: AccessorDeclaration) { + function getAllAccessorDeclarations(declarations: NodeArray, accessor: AccessorDeclaration) { var firstAccessor: AccessorDeclaration; var getAccessor: AccessorDeclaration; var setAccessor: AccessorDeclaration; @@ -288,7 +301,7 @@ module ts { } } else { - forEach(node.members,(member: Declaration) => { + forEach(declarations, (member: Declaration) => { if ((member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) && (member.flags & NodeFlags.Static) === (accessor.flags & NodeFlags.Static)) { var memberName = getPropertyNameForPropertyNameNode(member.name); @@ -362,8 +375,8 @@ module ts { var aliasDeclarationEmitInfo: AliasDeclarationEmitInfo[] = []; - // Contains the reference paths that needs to go in the declaration file. - // Collecting this separately because reference paths need to be first thing in the declaration file + // Contains the reference paths that needs to go in the declaration file. + // Collecting this separately because reference paths need to be first thing in the declaration file // and we could be collecting these paths from multiple files into single one with --out option var referencePathsOutput = ""; @@ -461,23 +474,23 @@ module ts { decreaseIndent = newWriter.decreaseIndent; } - function writeAsychronousImportDeclarations(importDeclarations: ImportDeclaration[]) { + function writeAsychronousImportEqualsDeclarations(importEqualsDeclarations: ImportEqualsDeclaration[]) { var oldWriter = writer; - forEach(importDeclarations, aliasToWrite => { + forEach(importEqualsDeclarations, aliasToWrite => { var aliasEmitInfo = forEach(aliasDeclarationEmitInfo, declEmitInfo => declEmitInfo.declaration === aliasToWrite ? declEmitInfo : undefined); // If the alias was marked as not visible when we saw its declaration, we would have saved the aliasEmitInfo, but if we haven't yet visited the alias declaration // then we don't need to write it at this point. We will write it when we actually see its declaration // Eg. // export function bar(a: foo.Foo) { } // import foo = require("foo"); - // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, + // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, // we would write alias foo declaration when we visit it since it would now be marked as visible if (aliasEmitInfo) { createAndSetNewTextWriterWithSymbolWriter(); for (var declarationIndent = aliasEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - writeImportDeclaration(aliasToWrite); + writeImportEqualsDeclaration(aliasToWrite); aliasEmitInfo.asynchronousOutput = writer.getText(); } }); @@ -488,7 +501,7 @@ module ts { if (symbolAccesibilityResult.accessibility === SymbolAccessibility.Accessible) { // write the aliases if (symbolAccesibilityResult && symbolAccesibilityResult.aliasesToMakeVisible) { - writeAsychronousImportDeclarations(symbolAccesibilityResult.aliasesToMakeVisible); + writeAsychronousImportEqualsDeclarations(symbolAccesibilityResult.aliasesToMakeVisible); } } else { @@ -612,9 +625,9 @@ module ts { } function emitEntityName(entityName: EntityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, + var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration - entityName.parent.kind === SyntaxKind.ImportDeclaration ? entityName.parent : enclosingDeclaration); + entityName.parent.kind === SyntaxKind.ImportEqualsDeclaration ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); @@ -696,7 +709,7 @@ module ts { function emitModuleElementDeclarationFlags(node: Node) { // If the node is parented in the current source file we need to emit export declare or just export if (node.parent === currentSourceFile) { - // If the node is exported + // If the node is exported if (node.flags & NodeFlags.Export) { write("export "); } @@ -720,7 +733,7 @@ module ts { } } - function emitImportDeclaration(node: ImportDeclaration) { + function emitImportEqualsDeclaration(node: ImportEqualsDeclaration) { var nodeEmitInfo = { declaration: node, outputPos: writer.getTextPos(), @@ -729,11 +742,11 @@ module ts { }; aliasDeclarationEmitInfo.push(nodeEmitInfo); if (nodeEmitInfo.hasWritten) { - writeImportDeclaration(node); + writeImportEqualsDeclaration(node); } } - function writeImportDeclaration(node: ImportDeclaration) { + function writeImportEqualsDeclaration(node: ImportEqualsDeclaration) { // note usage of writer. methods instead of aliases created, just to make sure we are using // correct writer especially to handle asynchronous alias writing emitJsDocComments(node); @@ -743,13 +756,13 @@ module ts { write("import "); writeTextOfNode(currentSourceFile, node.name); write(" = "); - if (isInternalModuleImportDeclaration(node)) { + if (isInternalModuleImportEqualsDeclaration(node)) { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node.moduleReference, getImportEntityNameVisibilityError); write(";"); } else { write("require("); - writeTextOfNode(currentSourceFile, getExternalModuleImportDeclarationExpression(node)); + writeTextOfNode(currentSourceFile, getExternalModuleImportEqualsDeclarationExpression(node)); write(");"); } writer.writeLine(); @@ -1087,7 +1100,7 @@ module ts { } function emitTypeOfVariableDeclarationFromTypeLiteral(node: VariableLikeDeclaration) { - // if this is property of type literal, + // if this is property of type literal, // or is parameter of method/call/construct/index signature of type literal // emit only if type is specified if (node.type) { @@ -1120,8 +1133,8 @@ module ts { if (hasDynamicName(node)) { return; } - - var accessors = getAllAccessorDeclarations(node.parent, node); + + var accessors = getAllAccessorDeclarations((node.parent).members, node); if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); @@ -1476,8 +1489,8 @@ module ts { return emitEnumDeclaration(node); case SyntaxKind.ModuleDeclaration: return emitModuleDeclaration(node); - case SyntaxKind.ImportDeclaration: - return emitImportDeclaration(node); + case SyntaxKind.ImportEqualsDeclaration: + return emitImportEqualsDeclaration(node); case SyntaxKind.ExportAssignment: return emitExportAssignment(node); case SyntaxKind.SourceFile: @@ -1502,7 +1515,7 @@ module ts { referencePathsOutput += "/// " + newLine; } } - + export function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, targetSourceFile: SourceFile): Diagnostic[] { var diagnostics: Diagnostic[] = []; var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, ".js"); @@ -1565,6 +1578,8 @@ module ts { var tempCount = 0; var tempVariables: Identifier[]; var tempParameters: Identifier[]; + var externalImports: ExternalImportInfo[]; + var exportSpecifiers: Map; /** write emitted output to disk*/ var writeEmittedFiles = writeJavaScriptFile; @@ -1596,7 +1611,7 @@ module ts { var emitEnd = function (node: Node) { }; /** Emit the text for the given token that comes after startPos - * This by default writes the text provided with the given tokenKind + * This by default writes the text provided with the given tokenKind * but if optional emitFn callback is provided the text is emitted using the callback instead of default text * @param tokenKind the kind of the token to search and emit * @param startPos the position in the source to start searching for the token @@ -1682,13 +1697,13 @@ module ts { // 1. Relative Column 0 based sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); - // 2. Relative sourceIndex + // 2. Relative sourceIndex sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); // 3. Relative sourceLine 0 based sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); - // 4. Relative sourceColumn 0 based + // 4. Relative sourceColumn 0 based sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); // 5. Relative namePosition 0 based @@ -1738,6 +1753,11 @@ module ts { function recordSourceMapSpan(pos: number) { var sourceLinePos = getLineAndCharacterOfPosition(currentSourceFile, pos); + + // Convert the location to be one-based. + sourceLinePos.line++; + sourceLinePos.character++; + var emittedLine = writer.getLine(); var emittedColumn = writer.getColumn(); @@ -1746,8 +1766,8 @@ module ts { lastRecordedSourceMapSpan.emittedLine != emittedLine || lastRecordedSourceMapSpan.emittedColumn != emittedColumn || (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { // Encode the last recordedSpan before assigning new encodeLastRecordedSourceMapSpan(); @@ -1788,7 +1808,7 @@ module ts { function recordNewSourceFileStart(node: SourceFile) { // Add the file to tsFilePaths - // If sourceroot option: Use the relative path corresponding to the common directory path + // If sourceroot option: Use the relative path corresponding to the common directory path // otherwise source locations relative to map file location var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; @@ -1928,7 +1948,7 @@ module ts { sourceMapDecodedMappings: [] }; - // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the + // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the // relative paths of the sources list in the sourcemap sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== CharacterCodes.slash) { @@ -2006,13 +2026,20 @@ module ts { return result; } - function recordTempDeclaration(name: Identifier) { + function recordTempDeclaration(name: Identifier): void { if (!tempVariables) { tempVariables = []; } tempVariables.push(name); } + function createAndRecordTempVariable(location: Node): Identifier { + var temp = createTempVariable(location, /*forLoopVariable*/ false); + recordTempDeclaration(temp); + + return temp; + } + function emitTempDeclarations(newLine: boolean) { if (tempVariables) { if (newLine) { @@ -2061,10 +2088,53 @@ module ts { } } - function emitList(nodes: Node[], start: number, count: number, multiLine: boolean, trailingComma: boolean) { - if (multiLine) { - increaseIndent(); + function emitLinePreservingList(parent: Node, nodes: NodeArray, allowTrailingComma: boolean, spacesBetweenBraces: boolean) { + Debug.assert(nodes.length > 0); + + increaseIndent(); + + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (spacesBetweenBraces) { + write(" "); + } } + else { + writeLine(); + } + + for (var i = 0, n = nodes.length; i < n; i++) { + if (i) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + write(", "); + } + else { + write(","); + writeLine(); + } + } + + emit(nodes[i]); + } + + var closeTokenIsOnSameLineAsLastElement = nodeEndPositionsAreOnSameLine(parent, lastOrUndefined(nodes)); + + if (nodes.hasTrailingComma && allowTrailingComma) { + write(","); + } + + decreaseIndent(); + + if (closeTokenIsOnSameLineAsLastElement) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + } + + function emitList(nodes: Node[], start: number, count: number, multiLine: boolean, trailingComma: boolean) { for (var i = 0; i < count; i++) { if (multiLine) { if (i) { @@ -2083,7 +2153,6 @@ module ts { write(","); } if (multiLine) { - decreaseIndent(); writeLine(); } } @@ -2094,12 +2163,6 @@ module ts { } } - function emitMultiLineList(nodes: Node[]) { - if (nodes) { - emitList(nodes, 0, nodes.length, /*multiline*/ true, /*trailingComma*/ false); - } - } - function emitLines(nodes: Node[]) { emitLinesStartingAt(nodes, /*startIndex*/ 0); } @@ -2126,7 +2189,7 @@ module ts { function emitLiteral(node: LiteralExpression) { var text = languageVersion < ScriptTarget.ES6 && isTemplateLiteralKind(node.kind) ? getTemplateLiteralAsStringLiteral(node) : node.parent ? getSourceTextOfNodeFromSourceFile(currentSourceFile, node) : - node.text; + node.text; if (compilerOptions.sourceMap && (node.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } @@ -2244,15 +2307,15 @@ module ts { // All binary expressions have lower precedence than '+' apart from '*', '/', and '%' // which have greater precedence and '-' which has equal precedence. // All unary operators have a higher precedence apart from yield. - // Arrow functions and conditionals have a lower precedence, + // Arrow functions and conditionals have a lower precedence, // although we convert the former into regular function expressions in ES5 mode, // and in ES6 mode this function won't get called anyway. - // + // // TODO (drosen): Note that we need to account for the upcoming 'yield' and // spread ('...') unary operators that are anticipated for ES6. switch (expression.kind) { case SyntaxKind.BinaryExpression: - switch ((expression).operator) { + switch ((expression).operatorToken.kind) { case SyntaxKind.AsteriskToken: case SyntaxKind.SlashToken: case SyntaxKind.PercentToken: @@ -2278,7 +2341,10 @@ module ts { // This function specifically handles numeric/string literals for enum and accessor 'identifiers'. // In a sense, it does not actually emit identifiers as much as it declares a name for a specific property. + // For example, this is utilized when feeding in a result to Object.defineProperty. function emitExpressionForPropertyName(node: DeclarationName) { + Debug.assert(node.kind !== SyntaxKind.BindingElement); + if (node.kind === SyntaxKind.StringLiteral) { emitLiteral(node); } @@ -2320,7 +2386,7 @@ module ts { case SyntaxKind.InterfaceDeclaration: case SyntaxKind.EnumDeclaration: case SyntaxKind.ModuleDeclaration: - case SyntaxKind.ImportDeclaration: + case SyntaxKind.ImportEqualsDeclaration: return (parent).name === node; case SyntaxKind.BreakStatement: case SyntaxKind.ContinueStatement: @@ -2334,12 +2400,13 @@ module ts { } function emitExpressionIdentifier(node: Identifier) { - var prefix = resolver.getExpressionNamePrefix(node); - if (prefix) { - write(prefix); - write("."); + var substitution = resolver.getExpressionNameSubstitution(node); + if (substitution) { + write(substitution); + } + else { + writeTextOfNode(currentSourceFile, node); } - writeTextOfNode(currentSourceFile, node); } function emitIdentifier(node: Identifier) { @@ -2451,7 +2518,13 @@ module ts { i++; } write("["); + if (multiLine) { + increaseIndent(); + } emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + if (multiLine) { + decreaseIndent(); + } write("]"); pos = i; } @@ -2462,15 +2535,18 @@ module ts { } } + function isSpreadElementExpression(node: Node) { + return node.kind === SyntaxKind.SpreadElementExpression; + } + function emitArrayLiteral(node: ArrayLiteralExpression) { var elements = node.elements; if (elements.length === 0) { write("[]"); } - else if (languageVersion >= ScriptTarget.ES6) { + else if (languageVersion >= ScriptTarget.ES6 || !forEach(elements, isSpreadElementExpression)) { write("["); - emitList(elements, 0, elements.length, /*multiLine*/ (node.flags & NodeFlags.MultiLine) !== 0, - /*trailingComma*/ elements.hasTrailingComma); + emitLinePreservingList(node, node.elements, elements.hasTrailingComma, /*spacesBetweenBraces:*/ false); write("]"); } else { @@ -2479,20 +2555,246 @@ module ts { } } - function emitObjectLiteral(node: ObjectLiteralExpression) { - write("{"); - var properties = node.properties; - if (properties.length) { - var multiLine = (node.flags & NodeFlags.MultiLine) !== 0; - if (!multiLine) { - write(" "); + function createSynthesizedNode(kind: SyntaxKind): Node { + var node = createNode(kind); + node.pos = -1; + node.end = -1; + + return node; + } + + function emitDownlevelObjectLiteralWithComputedProperties(node: ObjectLiteralExpression, firstComputedPropertyIndex: number): void { + var parenthesizedObjectLiteral = createDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex); + return emit(parenthesizedObjectLiteral); + } + + function createDownlevelObjectLiteralWithComputedProperties(originalObjectLiteral: ObjectLiteralExpression, firstComputedPropertyIndex: number): ParenthesizedExpression { + // For computed properties, we need to create a unique handle to the object + // literal so we can modify it without risking internal assignments tainting the object. + var tempVar = createAndRecordTempVariable(originalObjectLiteral); + + // Hold onto the initial non-computed properties in a new object literal, + // then create the rest through property accesses on the temp variable. + var initialObjectLiteral = createSynthesizedNode(SyntaxKind.ObjectLiteralExpression); + initialObjectLiteral.properties = >originalObjectLiteral.properties.slice(0, firstComputedPropertyIndex); + initialObjectLiteral.flags |= NodeFlags.MultiLine; + + // The comma expressions that will patch the object literal. + // This will end up being something like '_a = { ... }, _a.x = 10, _a.y = 20, _a'. + var propertyPatches = createBinaryExpression(tempVar, SyntaxKind.EqualsToken, initialObjectLiteral); + + ts.forEach(originalObjectLiteral.properties, property => { + var patchedProperty = tryCreatePatchingPropertyAssignment(originalObjectLiteral, tempVar, property); + if (patchedProperty) { + // TODO(drosen): Preserve comments + //var leadingComments = getLeadingCommentRanges(currentSourceFile.text, property.pos); + //var trailingComments = getTrailingCommentRanges(currentSourceFile.text, property.end); + //addCommentsToSynthesizedNode(patchedProperty, leadingComments, trailingComments); + + propertyPatches = createBinaryExpression(propertyPatches, SyntaxKind.CommaToken, patchedProperty); } - emitList(properties, 0, properties.length, /*multiLine*/ multiLine, - /*trailingComma*/ properties.hasTrailingComma && languageVersion >= ScriptTarget.ES5); - if (!multiLine) { - write(" "); + }); + + // Finally, return the temp variable. + propertyPatches = createBinaryExpression(propertyPatches, SyntaxKind.CommaToken, tempVar); + + var result = createParenthesizedExpression(propertyPatches); + + // TODO(drosen): Preserve comments + // var leadingComments = getLeadingCommentRanges(currentSourceFile.text, originalObjectLiteral.pos); + // var trailingComments = getTrailingCommentRanges(currentSourceFile.text, originalObjectLiteral.end); + //addCommentsToSynthesizedNode(result, leadingComments, trailingComments); + + return result; + } + + function addCommentsToSynthesizedNode(node: SynthesizedNode, leadingCommentRanges: CommentRange[], trailingCommentRanges: CommentRange[]): void { + node.leadingCommentRanges = leadingCommentRanges; + node.trailingCommentRanges = trailingCommentRanges; + } + + // Returns 'undefined' if a property has already been accounted for + // (e.g. a 'get' accessor which has already been emitted along with its 'set' accessor). + function tryCreatePatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, tempVar: Identifier, property: ObjectLiteralElement): Expression { + var leftHandSide = createMemberAccessForPropertyName(tempVar, property.name); + var maybeRightHandSide = tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property); + + return maybeRightHandSide && createBinaryExpression(leftHandSide, SyntaxKind.EqualsToken, maybeRightHandSide); + } + + function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, property: ObjectLiteralElement) { + switch (property.kind) { + case SyntaxKind.PropertyAssignment: + return (property).initializer; + + case SyntaxKind.ShorthandPropertyAssignment: + // TODO: (andersh) Technically it isn't correct to make an identifier here since getExpressionNamePrefix returns + // a string containing a dotted name. In general I'm not a fan of mini tree rewriters as this one, elsewhere we + // manage by just emitting strings (which is a lot more performant). + //var prefix = createIdentifier(resolver.getExpressionNamePrefix((property).name)); + //return createPropertyAccessExpression(prefix, (property).name); + return createIdentifier(resolver.getExpressionNameSubstitution((property).name)); + + case SyntaxKind.MethodDeclaration: + return createFunctionExpression((property).parameters, (property).body); + + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + var { firstAccessor, getAccessor, setAccessor } = getAllAccessorDeclarations(objectLiteral.properties, property); + + // Only emit the first accessor. + if (firstAccessor !== property) { + return undefined; + } + + var propertyDescriptor = createSynthesizedNode(SyntaxKind.ObjectLiteralExpression); + + var descriptorProperties = >[]; + if (getAccessor) { + var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); + descriptorProperties.push(getProperty); + } + if (setAccessor) { + var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpression(setAccessor.parameters, setAccessor.body)); + descriptorProperties.push(setProperty); + } + + var trueExpr = createSynthesizedNode(SyntaxKind.TrueKeyword); + + var enumerableTrue = createPropertyAssignment(createIdentifier("enumerable"), trueExpr); + descriptorProperties.push(enumerableTrue); + + var configurableTrue = createPropertyAssignment(createIdentifier("configurable"), trueExpr); + descriptorProperties.push(configurableTrue); + + propertyDescriptor.properties = descriptorProperties; + + var objectDotDefineProperty = createPropertyAccessExpression(createIdentifier("Object"), createIdentifier("defineProperty")); + return createCallExpression(objectDotDefineProperty, createNodeArray(propertyDescriptor)); + + default: + Debug.fail(`ObjectLiteralElement kind ${property.kind} not accounted for.`); + } + } + + function createParenthesizedExpression(expression: Expression) { + var result = createSynthesizedNode(SyntaxKind.ParenthesizedExpression); + result.expression = expression; + + return result; + } + + function createNodeArray(...elements: T[]): NodeArray { + var result = >elements; + result.pos = -1; + result.end = -1; + + return result; + } + + function createBinaryExpression(left: Expression, operator: SyntaxKind, right: Expression): BinaryExpression { + var result = createSynthesizedNode(SyntaxKind.BinaryExpression); + result.operatorToken = createSynthesizedNode(operator); + result.left = left; + result.right = right; + + return result; + } + + function createMemberAccessForPropertyName(expression: LeftHandSideExpression, memberName: DeclarationName): PropertyAccessExpression | ElementAccessExpression { + if (memberName.kind === SyntaxKind.Identifier) { + return createPropertyAccessExpression(expression, memberName); + } + else if (memberName.kind === SyntaxKind.StringLiteral || memberName.kind === SyntaxKind.NumericLiteral) { + return createElementAccessExpression(expression, memberName); + } + else if (memberName.kind === SyntaxKind.ComputedPropertyName) { + return createElementAccessExpression(expression, (memberName).expression); + } + else { + Debug.fail(`Kind '${memberName.kind}' not accounted for.`); + } + } + + function createPropertyAssignment(name: LiteralExpression | Identifier, initializer: Expression) { + var result = createSynthesizedNode(SyntaxKind.PropertyAssignment); + result.name = name; + result.initializer = initializer; + + return result; + } + + function createFunctionExpression(parameters: NodeArray, body: Block): FunctionExpression { + var result = createSynthesizedNode(SyntaxKind.FunctionExpression); + result.parameters = parameters; + result.body = body; + + return result; + } + + function createPropertyAccessExpression(expression: LeftHandSideExpression, name: Identifier): PropertyAccessExpression { + var result = createSynthesizedNode(SyntaxKind.PropertyAccessExpression); + result.expression = expression; + result.name = name; + + return result; + } + + function createElementAccessExpression(expression: LeftHandSideExpression, argumentExpression: Expression): ElementAccessExpression { + var result = createSynthesizedNode(SyntaxKind.ElementAccessExpression); + result.expression = expression; + result.argumentExpression = argumentExpression; + + return result; + } + + function createIdentifier(name: string) { + var result = createSynthesizedNode(SyntaxKind.Identifier); + result.text = name; + + return result; + } + + function createCallExpression(invokedExpression: MemberExpression, arguments: NodeArray) { + var result = createSynthesizedNode(SyntaxKind.CallExpression); + result.expression = invokedExpression; + result.arguments = arguments; + + return result; + } + + function emitObjectLiteral(node: ObjectLiteralExpression): void { + var properties = node.properties; + + if (languageVersion < ScriptTarget.ES6) { + var numProperties = properties.length; + + // Find the first computed property. + // Everything until that point can be emitted as part of the initial object literal. + var numInitialNonComputedProperties = numProperties; + for (var i = 0, n = properties.length; i < n; i++) { + if (properties[i].name.kind === SyntaxKind.ComputedPropertyName) { + numInitialNonComputedProperties = i; + break; + } + } + + var hasComputedProperty = numInitialNonComputedProperties !== properties.length; + if (hasComputedProperty) { + emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); + return; } } + + // Ordinary case: either the object has no computed properties + // or we're compiling with an ES6+ target. + write("{"); + + var properties = node.properties; + if (properties.length) { + emitLinePreservingList(node, properties, /*allowTrailingComma:*/ languageVersion >= ScriptTarget.ES5, /*spacesBetweenBraces:*/ true) + } + write("}"); } @@ -2526,7 +2828,7 @@ module ts { // export var obj = { y }; // } // The short-hand property in obj need to emit as such ... = { y : m.y } regardless of the TargetScript version - if (languageVersion < ScriptTarget.ES6 || resolver.getExpressionNamePrefix(node.name)) { + if (languageVersion < ScriptTarget.ES6 || resolver.getExpressionNameSubstitution(node.name)) { // Emit identifier as an identifier write(": "); // Even though this is stored as identifier treat it as an expression @@ -2589,8 +2891,8 @@ module ts { emit(node); return node; } - var temp = createTempVariable(node); - recordTempDeclaration(temp); + var temp = createAndRecordTempVariable(node); + write("("); emit(temp); write(" = "); @@ -2693,7 +2995,7 @@ module ts { var operand = (node.expression).expression; // Make sure we consider all nested cast expressions, e.g.: - // (-A).x; + // (-A).x; while (operand.kind == SyntaxKind.TypeAssertionExpression) { operand = (operand).expression; } @@ -2701,7 +3003,7 @@ module ts { // We have an expression of the form: (SubExpr) // Emitting this as (SubExpr) is really not desirable. We would like to emit the subexpr as is. // Omitting the parentheses, however, could cause change in the semantics of the generated - // code if the casted expression has a lower precedence than the rest of the expression, e.g.: + // code if the casted expression has a lower precedence than the rest of the expression, e.g.: // (new A).foo should be emitted as (new A).foo and not new A.foo // (typeof A).toString() should be emitted as (typeof A).toString() and not typeof A.toString() // new (A()) should be emitted as new (A()) and not new A() @@ -2773,19 +3075,84 @@ module ts { } function emitBinaryExpression(node: BinaryExpression) { - if (languageVersion < ScriptTarget.ES6 && node.operator === SyntaxKind.EqualsToken && + if (languageVersion < ScriptTarget.ES6 && node.operatorToken.kind === SyntaxKind.EqualsToken && (node.left.kind === SyntaxKind.ObjectLiteralExpression || node.left.kind === SyntaxKind.ArrayLiteralExpression)) { emitDestructuring(node); } else { emit(node.left); - if (node.operator !== SyntaxKind.CommaToken) write(" "); - write(tokenToString(node.operator)); - write(" "); + + if (node.operatorToken.kind !== SyntaxKind.CommaToken) { + write(" "); + } + + write(tokenToString(node.operatorToken.kind)); + + // We'd like to preserve newlines found in the original binary expression. i.e. if a user has: + // + // Foo() || + // Bar(); + // + // Then we'd like to emit it as such. It seems like we'd only need to check for a newline and + // then just indent and emit. However, that will lead to a problem with deeply nested code. + // i.e. if you have: + // + // Foo() || + // Bar() || + // Baz(); + // + // Then we don't want to emit it as: + // + // Foo() || + // Bar() || + // Baz(); + // + // So we only indent if the right side of the binary expression starts further in on the line + // versus the left. + var operatorEnd = getLineAndCharacterOfPosition(currentSourceFile, node.operatorToken.end); + var rightStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.right.pos)); + + // Check if the right expression is on a different line versus the operator itself. If so, + // we'll emit newline. + var onDifferentLine = operatorEnd.line !== rightStart.line; + if (onDifferentLine) { + // Also, if the right expression starts further in on the line than the left, then we'll indent. + var exprStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); + var firstCharOfExpr = getFirstNonWhitespaceCharacterIndexOnLine(exprStart.line); + var shouldIndent = rightStart.character > firstCharOfExpr; + + if (shouldIndent) { + increaseIndent(); + } + + writeLine(); + } + else { + write(" "); + } + emit(node.right); + + if (shouldIndent) { + decreaseIndent(); + } } } + function getFirstNonWhitespaceCharacterIndexOnLine(line: number): number { + var lineStart = getLineStarts(currentSourceFile)[line]; + var text = currentSourceFile.text; + + for (var i = lineStart; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (!isWhiteSpace(text.charCodeAt(i)) || isLineBreak(ch)) { + break; + } + } + + return i - lineStart; + } + function emitConditionalExpression(node: ConditionalExpression) { emit(node.condition); write(" ? "); @@ -2794,7 +3161,7 @@ module ts { emit(node.whenFalse); } - function isSingleLineBlock(node: Node) { + function isSingleLineEmptyBlock(node: Node) { if (node && node.kind === SyntaxKind.Block) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); @@ -2802,7 +3169,7 @@ module ts { } function emitBlock(node: Block) { - if (isSingleLineBlock(node)) { + if (isSingleLineEmptyBlock(node)) { emitToken(SyntaxKind.OpenBraceToken, node.pos); write(" "); emitToken(SyntaxKind.CloseBraceToken, node.statements.end); @@ -2982,9 +3349,14 @@ module ts { emitToken(SyntaxKind.CloseBraceToken, node.clauses.end); } - function isOnSameLine(node1: Node, node2: Node) { + function nodeStartPositionsAreOnSameLine(node1: Node, node2: Node) { return getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node1.pos)) === - getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); + getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); + } + + function nodeEndPositionsAreOnSameLine(node1: Node, node2: Node) { + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1: Node, node2: Node) { @@ -3001,7 +3373,7 @@ module ts { else { write("default:"); } - if (node.statements.length === 1 && isOnSameLine(node, node.statements[0])) { + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -3058,17 +3430,37 @@ module ts { return node; } + function emitContainingModuleName(node: Node) { + var container = getContainingModule(node); + write(container ? resolver.getGeneratedNameForNode(container) : "exports"); + } + function emitModuleMemberName(node: Declaration) { emitStart(node.name); if (getCombinedNodeFlags(node) & NodeFlags.Export) { - var container = getContainingModule(node); - write(container ? resolver.getLocalNameOfContainer(container) : "exports"); + emitContainingModuleName(node); write("."); } emitNode(node.name); emitEnd(node.name); } + function emitExportMemberAssignments(name: Identifier) { + if (exportSpecifiers && hasProperty(exportSpecifiers, name.text)) { + forEach(exportSpecifiers[name.text], specifier => { + writeLine(); + emitStart(specifier.name); + emitContainingModuleName(specifier); + write("."); + emitNode(specifier.name); + emitEnd(specifier.name); + write(" = "); + emitNode(name); + write(";"); + }); + } + } + function emitDestructuring(root: BinaryExpression | VariableDeclaration | ParameterDeclaration, value?: Expression) { var emitCount = 0; // An exported declaration is actually emitted as an assignment (to a property on the module object), so @@ -3122,7 +3514,7 @@ module ts { // Return the expression 'value === void 0 ? defaultValue : value' var equals = createNode(SyntaxKind.BinaryExpression); equals.left = value; - equals.operator = SyntaxKind.EqualsEqualsEqualsToken; + equals.operatorToken = createNode(SyntaxKind.EqualsEqualsEqualsToken); equals.right = createVoidZero(); var cond = createNode(SyntaxKind.ConditionalExpression); cond.condition = equals; @@ -3205,7 +3597,7 @@ module ts { } function emitDestructuringAssignment(target: Expression, value: Expression) { - if (target.kind === SyntaxKind.BinaryExpression && (target).operator === SyntaxKind.EqualsToken) { + if (target.kind === SyntaxKind.BinaryExpression && (target).operatorToken.kind === SyntaxKind.EqualsToken) { value = createDefaultValueCheck(value,(target).right); target = (target).left; } @@ -3301,6 +3693,16 @@ module ts { } } + function emitExportVariableAssignments(node: VariableDeclaration | BindingElement) { + var name = (node).name; + if (name.kind === SyntaxKind.Identifier) { + emitExportMemberAssignments(name); + } + else if (isBindingPattern(name)) { + forEach((name).elements, emitExportVariableAssignments); + } + } + function emitVariableStatement(node: VariableStatement) { if (!(node.flags & NodeFlags.Export)) { if (isLet(node.declarationList)) { @@ -3315,6 +3717,9 @@ module ts { } emitCommaList(node.declarationList.declarations); write(";"); + if (languageVersion < ScriptTarget.ES6 && node.parent === currentSourceFile) { + forEach(node.declarationList.declarations, emitExportVariableAssignments); + } } function emitParameter(node: ParameterDeclaration) { @@ -3439,6 +3844,9 @@ module ts { emit(node.name); } emitSignatureAndBody(node); + if (languageVersion < ScriptTarget.ES6 && node.kind === SyntaxKind.FunctionDeclaration && node.parent === currentSourceFile) { + emitExportMemberAssignments((node).name); + } if (node.kind !== SyntaxKind.MethodDeclaration && node.kind !== SyntaxKind.MethodSignature) { emitTrailingComments(node); } @@ -3491,77 +3899,14 @@ module ts { emitSignatureParameters(node); } - if (isSingleLineBlock(node.body)) { + if (isSingleLineEmptyBlock(node.body) || !node.body) { write(" { }"); } + else if (node.body.kind === SyntaxKind.Block) { + emitBlockFunctionBody(node, node.body); + } else { - write(" {"); - scopeEmitStart(node); - - if (!node.body) { - writeLine(); - write("}"); - } - else { - increaseIndent(); - - emitDetachedComments(node.body.kind === SyntaxKind.Block ? (node.body).statements : node.body); - - var startIndex = 0; - if (node.body.kind === SyntaxKind.Block) { - startIndex = emitDirectivePrologues((node.body).statements, /*startWithNewLine*/ true); - } - var outPos = writer.getTextPos(); - - emitCaptureThisForNodeIfNecessary(node); - emitDefaultValueAssignments(node); - emitRestParameter(node); - if (node.body.kind !== SyntaxKind.Block && outPos === writer.getTextPos()) { - decreaseIndent(); - write(" "); - emitStart(node.body); - write("return "); - - // Don't emit comments on this body. We'll have already taken care of it above - // when we called emitDetachedComments. - emitNode(node.body, /*disableComments:*/ true); - emitEnd(node.body); - write(";"); - emitTempDeclarations(/*newLine*/ false); - write(" "); - emitStart(node.body); - write("}"); - emitEnd(node.body); - } - else { - if (node.body.kind === SyntaxKind.Block) { - emitLinesStartingAt((node.body).statements, startIndex); - } - else { - writeLine(); - emitLeadingComments(node.body); - write("return "); - emit(node.body, /*disableComments:*/ true); - write(";"); - emitTrailingComments(node.body); - } - emitTempDeclarations(/*newLine*/ true); - writeLine(); - if (node.body.kind === SyntaxKind.Block) { - emitLeadingCommentsOfPosition((node.body).statements.end); - decreaseIndent(); - emitToken(SyntaxKind.CloseBraceToken, (node.body).statements.end); - } - else { - decreaseIndent(); - emitStart(node.body); - write("}"); - emitEnd(node.body); - } - } - } - - scopeEmitEnd(); + emitExpressionFunctionBody(node, node.body); } if (node.flags & NodeFlags.Export) { @@ -3573,11 +3918,101 @@ module ts { emitEnd(node); write(";"); } + tempCount = saveTempCount; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } + // Returns true if any preamble code was emitted. + function emitFunctionBodyPreamble(node: FunctionLikeDeclaration): void { + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + } + + function emitExpressionFunctionBody(node: FunctionLikeDeclaration, body: Expression) { + write(" {"); + scopeEmitStart(node); + + increaseIndent(); + var outPos = writer.getTextPos(); + emitDetachedComments(node.body); + emitFunctionBodyPreamble(node); + var preambleEmitted = writer.getTextPos() !== outPos; + decreaseIndent(); + + // If we didn't have to emit any preamble code, then attempt to keep the arrow + // function on one line. + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { + write(" "); + emitStart(body); + write("return "); + + // Don't emit comments on this body. We'll have already taken care of it above + // when we called emitDetachedComments. + emitNode(body, /*disableComments:*/ true); + emitEnd(body); + write(";"); + emitTempDeclarations(/*newLine*/ false); + write(" "); + } + else { + increaseIndent(); + writeLine(); + emitLeadingComments(node.body); + write("return "); + emit(node.body, /*disableComments:*/ true); + write(";"); + emitTrailingComments(node.body); + + emitTempDeclarations(/*newLine*/ true); + decreaseIndent(); + writeLine(); + } + + emitStart(node.body); + write("}"); + emitEnd(node.body); + + scopeEmitEnd(); + } + + function emitBlockFunctionBody(node: FunctionLikeDeclaration, body: Block) { + write(" {"); + scopeEmitStart(node); + + var outPos = writer.getTextPos(); + increaseIndent(); + emitDetachedComments(body.statements); + var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); + emitFunctionBodyPreamble(node); + decreaseIndent(); + var preambleEmitted = writer.getTextPos() !== outPos; + + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var i = 0, n = body.statements.length; i < n; i++) { + write(" "); + emit(body.statements[i]); + } + emitTempDeclarations(/*newLine*/ false); + write(" "); + emitLeadingCommentsOfPosition(body.statements.end); + } + else { + increaseIndent(); + emitLinesStartingAt(body.statements, startIndex); + emitTempDeclarations(/*newLine*/ true); + + writeLine(); + emitLeadingCommentsOfPosition(body.statements.end); + decreaseIndent(); + } + + emitToken(SyntaxKind.CloseBraceToken, body.statements.end); + scopeEmitEnd(); + } + function findInitialSuperCall(ctor: ConstructorDeclaration): ExpressionStatement { if (ctor.body) { var statement = (ctor.body).statements[0]; @@ -3611,6 +4046,7 @@ module ts { } function emitMemberAccessForPropertyName(memberName: DeclarationName) { + // TODO: (jfreeman,drosen): comment on why this is emitNode instead of emit here. if (memberName.kind === SyntaxKind.StringLiteral || memberName.kind === SyntaxKind.NumericLiteral) { write("["); emitNode(memberName); @@ -3660,13 +4096,14 @@ module ts { emitLeadingComments(member); emitStart(member); emitStart((member).name); - emitNode(node.name); + emitNode(node.name); // TODO (shkamat,drosen): comment for why emitNode instead of emit. if (!(member.flags & NodeFlags.Static)) { write(".prototype"); } emitMemberAccessForPropertyName((member).name); emitEnd((member).name); write(" = "); + // TODO (drosen): Should we performing emitStart twice on emitStart(member)? emitStart(member); emitFunctionDeclaration(member); emitEnd(member); @@ -3675,7 +4112,7 @@ module ts { emitTrailingComments(member); } else if (member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) { - var accessors = getAllAccessorDeclarations(node, member); + var accessors = getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); emitStart(member); @@ -3686,6 +4123,7 @@ module ts { write(".prototype"); } write(", "); + // TODO: Shouldn't emitStart on name occur *here*? emitExpressionForPropertyName((member).name); emitEnd((member).name); write(", {"); @@ -3775,6 +4213,9 @@ module ts { emitEnd(node); write(";"); } + if (languageVersion < ScriptTarget.ES6 && node.parent === currentSourceFile) { + emitExportMemberAssignments(node.name); + } function emitConstructorOfClass() { var saveTempCount = tempCount; @@ -3875,7 +4316,7 @@ module ts { emitStart(node); write("(function ("); emitStart(node.name); - write(resolver.getLocalNameOfContainer(node)); + write(resolver.getGeneratedNameForNode(node)); emitEnd(node.name); write(") {"); increaseIndent(); @@ -3901,14 +4342,17 @@ module ts { emitEnd(node); write(";"); } + if (languageVersion < ScriptTarget.ES6 && node.parent === currentSourceFile) { + emitExportMemberAssignments(node.name); + } } function emitEnumMember(node: EnumMember) { var enumParent = node.parent; emitStart(node); - write(resolver.getLocalNameOfContainer(enumParent)); + write(resolver.getGeneratedNameForNode(enumParent)); write("["); - write(resolver.getLocalNameOfContainer(enumParent)); + write(resolver.getGeneratedNameForNode(enumParent)); write("["); emitExpressionForPropertyName(node.name); write("] = "); @@ -3964,7 +4408,7 @@ module ts { emitStart(node); write("(function ("); emitStart(node.name); - write(resolver.getLocalNameOfContainer(node)); + write(resolver.getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); if (node.body.kind === SyntaxKind.ModuleBlock) { @@ -3999,65 +4443,200 @@ module ts { emitModuleMemberName(node); write(" = {}));"); emitEnd(node); + if (languageVersion < ScriptTarget.ES6 && node.name.kind === SyntaxKind.Identifier && node.parent === currentSourceFile) { + emitExportMemberAssignments(node.name); + } } - function emitImportDeclaration(node: ImportDeclaration) { - var emitImportDeclaration = resolver.isReferencedImportDeclaration(node); - - if (!emitImportDeclaration) { - // preserve old compiler's behavior: emit 'var' for import declaration (even if we do not consider them referenced) when - // - current file is not external module - // - import declaration is top level and target is value imported by entity name - emitImportDeclaration = !isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportWithEntityName(node); + function emitRequire(moduleName: Expression) { + if (moduleName.kind === SyntaxKind.StringLiteral) { + write("require("); + emitStart(moduleName); + emitLiteral(moduleName); + emitEnd(moduleName); + emitToken(SyntaxKind.CloseParenToken, moduleName.end); + write(";"); } + else { + write("require();"); + } + } - if (emitImportDeclaration) { - if (isExternalModuleImportDeclaration(node) && node.parent.kind === SyntaxKind.SourceFile && compilerOptions.module === ModuleKind.AMD) { - if (node.flags & NodeFlags.Export) { - writeLine(); - emitLeadingComments(node); - emitStart(node); - emitModuleMemberName(node); - write(" = "); - emit(node.name); - write(";"); - emitEnd(node); - emitTrailingComments(node); - } - } - else { - writeLine(); + function emitImportDeclaration(node: ImportDeclaration | ImportEqualsDeclaration) { + var info = getExternalImportInfo(node); + if (info) { + var declarationNode = info.declarationNode; + var namedImports = info.namedImports; + if (compilerOptions.module !== ModuleKind.AMD) { emitLeadingComments(node); emitStart(node); - if (!(node.flags & NodeFlags.Export)) write("var "); - emitModuleMemberName(node); - write(" = "); - if (isInternalModuleImportDeclaration(node)) { - emit(node.moduleReference); + var moduleName = getExternalModuleName(node); + if (declarationNode) { + if (!(declarationNode.flags & NodeFlags.Export)) write("var "); + emitModuleMemberName(declarationNode); + write(" = "); + emitRequire(moduleName); + } + else if (namedImports) { + write("var "); + write(resolver.getGeneratedNameForNode(node)); + write(" = "); + emitRequire(moduleName); } else { - var literal = getExternalModuleImportDeclarationExpression(node); - write("require("); - emitStart(literal); - emitLiteral(literal); - emitEnd(literal); - emitToken(SyntaxKind.CloseParenToken, literal.end); + emitRequire(moduleName); } - write(";"); emitEnd(node); emitTrailingComments(node); } + else { + if (declarationNode) { + if (declarationNode.flags & NodeFlags.Export) { + emitModuleMemberName(declarationNode); + write(" = "); + emit(declarationNode.name); + write(";"); + } + } + } } } - function getExternalImportDeclarations(node: SourceFile): ImportDeclaration[] { - var result: ImportDeclaration[] = []; - forEach(node.statements, statement => { - if (isExternalModuleImportDeclaration(statement) && resolver.isReferencedImportDeclaration(statement)) { - result.push(statement); + function emitImportEqualsDeclaration(node: ImportEqualsDeclaration) { + if (isExternalModuleImportEqualsDeclaration(node)) { + emitImportDeclaration(node); + return; + } + // preserve old compiler's behavior: emit 'var' for import declaration (even if we do not consider them referenced) when + // - current file is not external module + // - import declaration is top level and target is value imported by entity name + if (resolver.isReferencedImportDeclaration(node) || + (!isExternalModule(currentSourceFile) && resolver.isTopLevelValueImportEqualsWithEntityName(node))) { + emitLeadingComments(node); + emitStart(node); + if (!(node.flags & NodeFlags.Export)) write("var "); + emitModuleMemberName(node); + write(" = "); + emit(node.moduleReference); + write(";"); + emitEnd(node); + emitTrailingComments(node); + } + } + + function emitExportDeclaration(node: ExportDeclaration) { + if (node.moduleSpecifier) { + emitStart(node); + var generatedName = resolver.getGeneratedNameForNode(node); + if (compilerOptions.module !== ModuleKind.AMD) { + write("var "); + write(generatedName); + write(" = "); + emitRequire(getExternalModuleName(node)); + } + if (node.exportClause) { + // export { x, y, ... } + forEach(node.exportClause.elements, specifier => { + writeLine(); + emitStart(specifier); + emitContainingModuleName(specifier); + write("."); + emitNode(specifier.name); + write(" = "); + write(generatedName); + write("."); + emitNode(specifier.propertyName || specifier.name); + write(";"); + emitEnd(specifier); + }); + } + else { + // export * + var tempName = createTempVariable(node).text; + writeLine(); + write("for (var " + tempName + " in " + generatedName + ") if (!"); + emitContainingModuleName(node); + write(".hasOwnProperty(" + tempName + ")) "); + emitContainingModuleName(node); + write("[" + tempName + "] = " + generatedName + "[" + tempName + "];"); + } + emitEnd(node); + } + } + + function createExternalImportInfo(node: Node): ExternalImportInfo { + if (node.kind === SyntaxKind.ImportEqualsDeclaration) { + if ((node).moduleReference.kind === SyntaxKind.ExternalModuleReference) { + return { + rootNode: node, + declarationNode: node + }; + } + } + else if (node.kind === SyntaxKind.ImportDeclaration) { + var importClause = (node).importClause; + if (importClause) { + if (importClause.name) { + return { + rootNode: node, + declarationNode: importClause + }; + } + if (importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { + return { + rootNode: node, + declarationNode: importClause.namedBindings + }; + } + return { + rootNode: node, + namedImports: importClause.namedBindings, + localName: resolver.getGeneratedNameForNode(node) + }; + } + return { + rootNode: node + } + } + else if (node.kind === SyntaxKind.ExportDeclaration) { + if ((node).moduleSpecifier) { + return { + rootNode: node, + }; + } + } + } + + function createExternalModuleInfo(sourceFile: SourceFile) { + externalImports = []; + exportSpecifiers = {}; + forEach(sourceFile.statements, node => { + if (node.kind === SyntaxKind.ExportDeclaration && !(node).moduleSpecifier) { + forEach((node).exportClause.elements, specifier => { + var name = (specifier.propertyName || specifier.name).text; + (exportSpecifiers[name] || (exportSpecifiers[name] = [])).push(specifier); + }); + } + else { + var info = createExternalImportInfo(node); + if (info) { + if ((!info.declarationNode && !info.namedImports) || resolver.isReferencedImportDeclaration(node)) { + externalImports.push(info); + } + } } }); - return result; + } + + function getExternalImportInfo(node: ImportDeclaration | ImportEqualsDeclaration): ExternalImportInfo { + if (externalImports) { + for (var i = 0; i < externalImports.length; i++) { + var info = externalImports[i]; + if (info.rootNode === node) { + return info; + } + } + } } function getFirstExportAssignment(sourceFile: SourceFile) { @@ -4082,7 +4661,6 @@ module ts { } function emitAMDModule(node: SourceFile, startIndex: number) { - var imports = getExternalImportDeclarations(node); writeLine(); write("define("); sortAMDModules(node.amdDependencies); @@ -4090,9 +4668,15 @@ module ts { write("\"" + node.amdModuleName + "\", "); } write("[\"require\", \"exports\""); - forEach(imports, imp => { + forEach(externalImports, info => { write(", "); - emitLiteral(getExternalModuleImportDeclarationExpression(imp)); + var moduleName = getExternalModuleName(info.rootNode); + if (moduleName.kind === SyntaxKind.StringLiteral) { + emitLiteral(moduleName); + } + else { + write("\"\""); + } }); forEach(node.amdDependencies, amdDependency => { var text = "\"" + amdDependency.path + "\""; @@ -4100,9 +4684,14 @@ module ts { write(text); }); write("], function (require, exports"); - forEach(imports, imp => { + forEach(externalImports, info => { write(", "); - emit(imp.name); + if (info.declarationNode) { + emit(info.declarationNode.name); + } + else { + write(resolver.getGeneratedNameForNode(info.rootNode)); + } }); forEach(node.amdDependencies, amdDependency => { if (amdDependency.name) { @@ -4192,6 +4781,7 @@ module ts { extendsEmitted = true; } if (isExternalModule(node)) { + createExternalModuleInfo(node); if (compilerOptions.module === ModuleKind.AMD) { emitAMDModule(node, startIndex); } @@ -4200,6 +4790,8 @@ module ts { } } else { + externalImports = undefined; + exportSpecifiers = undefined; emitCaptureThisForNodeIfNecessary(node); emitLinesStartingAt(node.statements, startIndex); emitTempDeclarations(/*newLine*/ true); @@ -4236,17 +4828,18 @@ module ts { case SyntaxKind.InterfaceDeclaration: case SyntaxKind.FunctionDeclaration: case SyntaxKind.ImportDeclaration: + case SyntaxKind.ImportEqualsDeclaration: case SyntaxKind.TypeAliasDeclaration: case SyntaxKind.ExportAssignment: return false; case SyntaxKind.ModuleDeclaration: - // Only emit the leading/trailing comments for a module if we're actually + // Only emit the leading/trailing comments for a module if we're actually // emitting the module as well. return shouldEmitModuleDeclaration(node); case SyntaxKind.EnumDeclaration: - // Only emit the leading/trailing comments for an enum if we're actually + // Only emit the leading/trailing comments for an enum if we're actually // emitting the module as well. return shouldEmitEnumDeclaration(node); } @@ -4400,6 +4993,10 @@ module ts { return emitModuleDeclaration(node); case SyntaxKind.ImportDeclaration: return emitImportDeclaration(node); + case SyntaxKind.ImportEqualsDeclaration: + return emitImportEqualsDeclaration(node); + case SyntaxKind.ExportDeclaration: + return emitExportDeclaration(node); case SyntaxKind.SourceFile: return emitSourceFile(node); } @@ -4470,7 +5067,7 @@ module ts { } emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); + emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitDetachedCommentsAtPosition(node: TextRange) { @@ -4486,7 +5083,7 @@ module ts { if (commentLine >= lastCommentLine + 2) { // There was a blank line between the last comment and this comment. This - // comment is not part of the copyright comments. Return what we have so + // comment is not part of the copyright comments. Return what we have so // far. return detachedComments; } @@ -4501,8 +5098,8 @@ module ts { // sure there is at least one blank line between it and the node. If not, it's not // a copyright header. var lastCommentLine = getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); - var astLine = getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); - if (astLine >= lastCommentLine + 2) { + var nodeLine = getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { // Valid detachedComments emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); @@ -4525,7 +5122,7 @@ module ts { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.exclamation; } - // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text + // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text // so that we don't end up computing comment string and doing match for all // comments else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.slash && comment.pos + 2 < comment.end && @@ -4543,7 +5140,7 @@ module ts { function writeDeclarationFile(jsFilePath: string, sourceFile: SourceFile) { var emitDeclarationResult = emitDeclarations(host, resolver, diagnostics, jsFilePath, sourceFile); - // TODO(shkamat): Should we not write any declaration file if any of them can produce error, + // TODO(shkamat): Should we not write any declaration file if any of them can produce error, // or should we just not write this file like we are doing now if (!emitDeclarationResult.reportedDeclarationError) { var declarationOutput = emitDeclarationResult.referencePathsOutput; @@ -4560,7 +5157,7 @@ module ts { writeFile(host, diagnostics, removeFileExtension(jsFilePath) + ".d.ts", declarationOutput, compilerOptions.emitBOM); } } - + function emitFile(jsFilePath: string, sourceFile?: SourceFile) { emitJavaScript(jsFilePath, sourceFile); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 95e1ea5de00..309eac2b504 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -152,6 +152,7 @@ module ts { return visitNode(cbNode, (node).operand); case SyntaxKind.BinaryExpression: return visitNode(cbNode, (node).left) || + visitNode(cbNode, (node).operatorToken) || visitNode(cbNode, (node).right); case SyntaxKind.ConditionalExpression: return visitNode(cbNode, (node).condition) || @@ -251,10 +252,30 @@ module ts { return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, (node).name) || visitNode(cbNode, (node).body); + case SyntaxKind.ImportEqualsDeclaration: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, (node).name) || + visitNode(cbNode, (node).moduleReference); case SyntaxKind.ImportDeclaration: return visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, (node).name) || - visitNode(cbNode, (node).moduleReference); + visitNode(cbNode, (node).importClause) || + visitNode(cbNode, (node).moduleSpecifier); + case SyntaxKind.ImportClause: + return visitNode(cbNode, (node).name) || + visitNode(cbNode, (node).namedBindings); + case SyntaxKind.NamespaceImport: + return visitNode(cbNode, (node).name); + case SyntaxKind.NamedImports: + case SyntaxKind.NamedExports: + return visitNodes(cbNodes, (node).elements); + case SyntaxKind.ExportDeclaration: + return visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, (node).exportClause) || + visitNode(cbNode, (node).moduleSpecifier); + case SyntaxKind.ImportSpecifier: + case SyntaxKind.ExportSpecifier: + return visitNode(cbNode, (node).propertyName) || + visitNode(cbNode, (node).name); case SyntaxKind.ExportAssignment: return visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, (node).exportName); @@ -272,27 +293,28 @@ module ts { } const enum ParsingContext { - SourceElements, // Elements in source file - ModuleElements, // Elements in module declaration - BlockStatements, // Statements in block - SwitchClauses, // Clauses in switch statement - SwitchClauseStatements, // Statements in switch clause - TypeMembers, // Members in interface or type literal - ClassMembers, // Members in class declaration - EnumMembers, // Members in enum declaration - TypeReferences, // Type references in extends or implements clause - VariableDeclarations, // Variable declarations in variable statement - ObjectBindingElements, // Binding elements in object binding list - ArrayBindingElements, // Binding elements in array binding list - ArgumentExpressions, // Expressions in argument list - ObjectLiteralMembers, // Members in object literal - ArrayLiteralMembers, // Members in array literal - Parameters, // Parameters in parameter list - TypeParameters, // Type parameters in type parameter list - TypeArguments, // Type arguments in type argument list - TupleElementTypes, // Element types in tuple element type list - HeritageClauses, // Heritage clauses for a class or interface declaration. - Count // Number of parsing contexts + SourceElements, // Elements in source file + ModuleElements, // Elements in module declaration + BlockStatements, // Statements in block + SwitchClauses, // Clauses in switch statement + SwitchClauseStatements, // Statements in switch clause + TypeMembers, // Members in interface or type literal + ClassMembers, // Members in class declaration + EnumMembers, // Members in enum declaration + TypeReferences, // Type references in extends or implements clause + VariableDeclarations, // Variable declarations in variable statement + ObjectBindingElements, // Binding elements in object binding list + ArrayBindingElements, // Binding elements in array binding list + ArgumentExpressions, // Expressions in argument list + ObjectLiteralMembers, // Members in object literal + ArrayLiteralMembers, // Members in array literal + Parameters, // Parameters in parameter list + TypeParameters, // Type parameters in type parameter list + TypeArguments, // Type arguments in type argument list + TupleElementTypes, // Element types in tuple element type list + HeritageClauses, // Heritage clauses for a class or interface declaration. + ImportOrExportSpecifiers, // Named import clause's import specifier list + Count // Number of parsing contexts } const enum Tristate { @@ -303,26 +325,27 @@ module ts { function parsingContextErrors(context: ParsingContext): DiagnosticMessage { switch (context) { - case ParsingContext.SourceElements: return Diagnostics.Declaration_or_statement_expected; - case ParsingContext.ModuleElements: return Diagnostics.Declaration_or_statement_expected; - case ParsingContext.BlockStatements: return Diagnostics.Statement_expected; - case ParsingContext.SwitchClauses: return Diagnostics.case_or_default_expected; - case ParsingContext.SwitchClauseStatements: return Diagnostics.Statement_expected; - case ParsingContext.TypeMembers: return Diagnostics.Property_or_signature_expected; - case ParsingContext.ClassMembers: return Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; - case ParsingContext.EnumMembers: return Diagnostics.Enum_member_expected; - case ParsingContext.TypeReferences: return Diagnostics.Type_reference_expected; - case ParsingContext.VariableDeclarations: return Diagnostics.Variable_declaration_expected; - case ParsingContext.ObjectBindingElements: return Diagnostics.Property_destructuring_pattern_expected; - case ParsingContext.ArrayBindingElements: return Diagnostics.Array_element_destructuring_pattern_expected; - case ParsingContext.ArgumentExpressions: return Diagnostics.Argument_expression_expected; - case ParsingContext.ObjectLiteralMembers: return Diagnostics.Property_assignment_expected; - case ParsingContext.ArrayLiteralMembers: return Diagnostics.Expression_or_comma_expected; - case ParsingContext.Parameters: return Diagnostics.Parameter_declaration_expected; - case ParsingContext.TypeParameters: return Diagnostics.Type_parameter_declaration_expected; - case ParsingContext.TypeArguments: return Diagnostics.Type_argument_expected; - case ParsingContext.TupleElementTypes: return Diagnostics.Type_expected; - case ParsingContext.HeritageClauses: return Diagnostics.Unexpected_token_expected; + case ParsingContext.SourceElements: return Diagnostics.Declaration_or_statement_expected; + case ParsingContext.ModuleElements: return Diagnostics.Declaration_or_statement_expected; + case ParsingContext.BlockStatements: return Diagnostics.Statement_expected; + case ParsingContext.SwitchClauses: return Diagnostics.case_or_default_expected; + case ParsingContext.SwitchClauseStatements: return Diagnostics.Statement_expected; + case ParsingContext.TypeMembers: return Diagnostics.Property_or_signature_expected; + case ParsingContext.ClassMembers: return Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected; + case ParsingContext.EnumMembers: return Diagnostics.Enum_member_expected; + case ParsingContext.TypeReferences: return Diagnostics.Type_reference_expected; + case ParsingContext.VariableDeclarations: return Diagnostics.Variable_declaration_expected; + case ParsingContext.ObjectBindingElements: return Diagnostics.Property_destructuring_pattern_expected; + case ParsingContext.ArrayBindingElements: return Diagnostics.Array_element_destructuring_pattern_expected; + case ParsingContext.ArgumentExpressions: return Diagnostics.Argument_expression_expected; + case ParsingContext.ObjectLiteralMembers: return Diagnostics.Property_assignment_expected; + case ParsingContext.ArrayLiteralMembers: return Diagnostics.Expression_or_comma_expected; + case ParsingContext.Parameters: return Diagnostics.Parameter_declaration_expected; + case ParsingContext.TypeParameters: return Diagnostics.Type_parameter_declaration_expected; + case ParsingContext.TypeArguments: return Diagnostics.Type_argument_expected; + case ParsingContext.TupleElementTypes: return Diagnostics.Type_expected; + case ParsingContext.HeritageClauses: return Diagnostics.Unexpected_token_expected; + case ParsingContext.ImportOrExportSpecifiers: return Diagnostics.Identifier_expected; } }; @@ -1311,6 +1334,12 @@ module ts { return undefined; } + function parseTokenNode(): T { + var node = createNode(token); + nextToken(); + return finishNode(node); + } + function canParseSemicolon() { // If there's a real semicolon, then we can always parse it out. if (token === SyntaxKind.SemicolonToken) { @@ -1469,7 +1498,10 @@ module ts { // 'const' is only a modifier if followed by 'enum'. return nextToken() === SyntaxKind.EnumKeyword; } - + if (token === SyntaxKind.ExportKeyword) { + nextToken(); + return token !== SyntaxKind.AsteriskToken && token !== SyntaxKind.OpenBraceToken && canFollowModifier(); + } nextToken(); return canFollowModifier(); } @@ -1529,6 +1561,8 @@ module ts { return token === SyntaxKind.CommaToken || isStartOfType(); case ParsingContext.HeritageClauses: return isHeritageClause(); + case ParsingContext.ImportOrExportSpecifiers: + return isIdentifierOrKeyword(); } Debug.fail("Non-exhaustive case in 'isListElement'."); @@ -1565,6 +1599,7 @@ module ts { case ParsingContext.EnumMembers: case ParsingContext.ObjectLiteralMembers: case ParsingContext.ObjectBindingElements: + case ParsingContext.ImportOrExportSpecifiers: return token === SyntaxKind.CloseBraceToken; case ParsingContext.SwitchClauseStatements: return token === SyntaxKind.CloseBraceToken || token === SyntaxKind.CaseKeyword || token === SyntaxKind.DefaultKeyword; @@ -1590,7 +1625,6 @@ module ts { return token === SyntaxKind.GreaterThanToken || token === SyntaxKind.OpenParenToken; case ParsingContext.HeritageClauses: return token === SyntaxKind.OpenBraceToken || token === SyntaxKind.CloseBraceToken; - } } @@ -1825,6 +1859,8 @@ module ts { if (node) { switch (node.kind) { case SyntaxKind.ImportDeclaration: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ExportDeclaration: case SyntaxKind.ExportAssignment: case SyntaxKind.ClassDeclaration: case SyntaxKind.InterfaceDeclaration: @@ -2084,14 +2120,6 @@ module ts { return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } - - - function parseTokenNode(): T { - var node = createNode(token); - nextToken(); - return finishNode(node); - } - function parseTemplateExpression(): TemplateExpression { var template = createNode(SyntaxKind.TemplateExpression); @@ -2801,8 +2829,9 @@ module ts { // Expression[in] , AssignmentExpression[in] var expr = parseAssignmentExpressionOrHigher(); - while (parseOptional(SyntaxKind.CommaToken)) { - expr = makeBinaryExpression(expr, SyntaxKind.CommaToken, parseAssignmentExpressionOrHigher()); + var operatorToken: Node; + while ((operatorToken = parseOptionalToken(SyntaxKind.CommaToken))) { + expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); } return expr; } @@ -2881,9 +2910,7 @@ module ts { // Note: we call reScanGreaterToken so that we get an appropriately merged token // for cases like > > = becoming >>= if (isLeftHandSideExpression(expr) && isAssignmentOperator(reScanGreaterToken())) { - var operator = token; - nextToken(); - return makeBinaryExpression(expr, operator, parseAssignmentExpressionOrHigher()); + return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher()); } // It wasn't an assignment or a lambda. This is a conditional expression: @@ -3187,9 +3214,7 @@ module ts { break; } - var operator = token; - nextToken(); - leftOperand = makeBinaryExpression(leftOperand, operator, parseBinaryExpressionOrHigher(newPrecedence)); + leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence)); } return leftOperand; @@ -3245,10 +3270,10 @@ module ts { return -1; } - function makeBinaryExpression(left: Expression, operator: SyntaxKind, right: Expression): BinaryExpression { + function makeBinaryExpression(left: Expression, operatorToken: Node, right: Expression): BinaryExpression { var node = createNode(SyntaxKind.BinaryExpression, left.pos); node.left = left; - node.operator = operator; + node.operatorToken = operatorToken; node.right = right; return finishNode(node); } @@ -4626,15 +4651,75 @@ module ts { return nextToken() === SyntaxKind.OpenParenToken; } - function parseImportDeclaration(fullStart: number, modifiers: ModifiersArray): ImportDeclaration { - var node = createNode(SyntaxKind.ImportDeclaration, fullStart); - setModifiers(node, modifiers); + function nextTokenIsCommaOrFromKeyword() { + nextToken(); + return token === SyntaxKind.CommaToken || + token === SyntaxKind.FromKeyword; + } + + function parseImportDeclarationOrImportEqualsDeclaration(fullStart: number, modifiers: ModifiersArray): ImportEqualsDeclaration | ImportDeclaration { parseExpected(SyntaxKind.ImportKeyword); - node.name = parseIdentifier(); - parseExpected(SyntaxKind.EqualsToken); - node.moduleReference = parseModuleReference(); + var afterImportPos = scanner.getStartPos(); + + var identifier: Identifier; + if (isIdentifier()) { + identifier = parseIdentifier(); + if (token !== SyntaxKind.CommaToken && token !== SyntaxKind.FromKeyword) { + // ImportEquals declaration of type: + // import x = require("mod"); or + // import x = M.x; + var importEqualsDeclaration = createNode(SyntaxKind.ImportEqualsDeclaration, fullStart); + setModifiers(importEqualsDeclaration, modifiers); + importEqualsDeclaration.name = identifier; + parseExpected(SyntaxKind.EqualsToken); + importEqualsDeclaration.moduleReference = parseModuleReference(); + parseSemicolon(); + return finishNode(importEqualsDeclaration); + } + } + + // Import statement + var importDeclaration = createNode(SyntaxKind.ImportDeclaration, fullStart); + setModifiers(importDeclaration, modifiers); + + // ImportDeclaration: + // import ImportClause from ModuleSpecifier ; + // import ModuleSpecifier; + if (identifier || // import id + token === SyntaxKind.AsteriskToken || // import * + token === SyntaxKind.OpenBraceToken) { // import { + importDeclaration.importClause = parseImportClause(identifier, afterImportPos); + parseExpected(SyntaxKind.FromKeyword); + } + + importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); - return finishNode(node); + return finishNode(importDeclaration); + } + + function parseImportClause(identifier: Identifier, fullStart: number) { + //ImportClause: + // ImportedDefaultBinding + // NameSpaceImport + // NamedImports + // ImportedDefaultBinding, NameSpaceImport + // ImportedDefaultBinding, NamedImports + + var importClause = createNode(SyntaxKind.ImportClause, fullStart); + if (identifier) { + // ImportedDefaultBinding: + // ImportedBinding + importClause.name = identifier; + } + + // If there was no default import or if there is comma token after default import + // parse namespace or named imports + if (!importClause.name || + parseOptional(SyntaxKind.CommaToken)) { + importClause.namedBindings = token === SyntaxKind.AsteriskToken ? parseNamespaceImport() : parseNamedImportsOrExports(SyntaxKind.NamedImports); + } + + return finishNode(importClause); } function parseModuleReference() { @@ -4647,19 +4732,102 @@ module ts { var node = createNode(SyntaxKind.ExternalModuleReference); parseExpected(SyntaxKind.RequireKeyword); parseExpected(SyntaxKind.OpenParenToken); + node.expression = parseModuleSpecifier(); + parseExpected(SyntaxKind.CloseParenToken); + return finishNode(node); + } + function parseModuleSpecifier(): Expression { // We allow arbitrary expressions here, even though the grammar only allows string // literals. We check to ensure that it is only a string literal later in the grammar // walker. - node.expression = parseExpression(); - + var result = parseExpression(); // Ensure the string being required is in our 'identifier' table. This will ensure // that features like 'find refs' will look inside this file when search for its name. - if (node.expression.kind === SyntaxKind.StringLiteral) { - internIdentifier((node.expression).text); + if (result.kind === SyntaxKind.StringLiteral) { + internIdentifier((result).text); + } + return result; + } + + function parseNamespaceImport(): NamespaceImport { + // NameSpaceImport: + // * as ImportedBinding + var namespaceImport = createNode(SyntaxKind.NamespaceImport); + parseExpected(SyntaxKind.AsteriskToken); + parseExpected(SyntaxKind.AsKeyword); + namespaceImport.name = parseIdentifier(); + return finishNode(namespaceImport); + } + + function parseNamedImportsOrExports(kind: SyntaxKind): NamedImportsOrExports { + var node = createNode(kind); + + // NamedImports: + // { } + // { ImportsList } + // { ImportsList, } + + // ImportsList: + // ImportSpecifier + // ImportsList, ImportSpecifier + node.elements = parseBracketedList(ParsingContext.ImportOrExportSpecifiers, + kind === SyntaxKind.NamedImports ? parseImportSpecifier : parseExportSpecifier, + SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken); + return finishNode(node); + } + + function parseExportSpecifier() { + return parseImportOrExportSpecifier(SyntaxKind.ExportSpecifier); + } + + function parseImportSpecifier() { + return parseImportOrExportSpecifier(SyntaxKind.ImportSpecifier); + } + + function parseImportOrExportSpecifier(kind: SyntaxKind): ImportOrExportSpecifier { + var node = createNode(kind); + // ImportSpecifier: + // ImportedBinding + // IdentifierName as ImportedBinding + var isFirstIdentifierNameNotAnIdentifier = isKeyword(token) && !isIdentifier(); + var start = scanner.getTokenPos(); + var identifierName = parseIdentifierName(); + if (token === SyntaxKind.AsKeyword) { + node.propertyName = identifierName; + parseExpected(SyntaxKind.AsKeyword); + if (isIdentifier()) { + node.name = parseIdentifierName(); + } + else { + parseErrorAtCurrentToken(Diagnostics.Identifier_expected); + } + } + else { + node.name = identifierName; + if (isFirstIdentifierNameNotAnIdentifier) { + // Report error identifier expected + parseErrorAtPosition(start, identifierName.end - start, Diagnostics.Identifier_expected); + } } - parseExpected(SyntaxKind.CloseParenToken); + return finishNode(node); + } + + function parseExportDeclaration(fullStart: number, modifiers: ModifiersArray): ExportDeclaration { + var node = createNode(SyntaxKind.ExportDeclaration, fullStart); + setModifiers(node, modifiers); + if (parseOptional(SyntaxKind.AsteriskToken)) { + parseExpected(SyntaxKind.FromKeyword); + node.moduleSpecifier = parseModuleSpecifier(); + } + else { + node.exportClause = parseNamedImportsOrExports(SyntaxKind.NamedExports); + if (parseOptional(SyntaxKind.FromKeyword)) { + node.moduleSpecifier = parseModuleSpecifier(); + } + } + parseSemicolon(); return finishNode(node); } @@ -4688,16 +4856,18 @@ module ts { case SyntaxKind.ClassKeyword: case SyntaxKind.InterfaceKeyword: case SyntaxKind.EnumKeyword: - case SyntaxKind.ImportKeyword: case SyntaxKind.TypeKeyword: // Not true keywords so ensure an identifier follows return lookAhead(nextTokenIsIdentifierOrKeyword); + case SyntaxKind.ImportKeyword: + // Not true keywords so ensure an identifier follows or is string literal or asterisk or open brace + return lookAhead(nextTokenCanFollowImportKeyword); case SyntaxKind.ModuleKeyword: // Not a true keyword so ensure an identifier or string literal follows return lookAhead(nextTokenIsIdentifierOrKeywordOrStringLiteral); case SyntaxKind.ExportKeyword: // Check for export assignment or modifier on source element - return lookAhead(nextTokenIsEqualsTokenOrDeclarationStart); + return lookAhead(nextTokenCanFollowExportKeyword); case SyntaxKind.DeclareKeyword: case SyntaxKind.PublicKeyword: case SyntaxKind.PrivateKeyword: @@ -4722,9 +4892,16 @@ module ts { return isIdentifierOrKeyword() || token === SyntaxKind.StringLiteral; } - function nextTokenIsEqualsTokenOrDeclarationStart() { + function nextTokenCanFollowImportKeyword() { nextToken(); - return token === SyntaxKind.EqualsToken || isDeclarationStart(); + return isIdentifierOrKeyword() || token === SyntaxKind.StringLiteral || + token === SyntaxKind.AsteriskToken || token === SyntaxKind.OpenBraceToken; + } + + function nextTokenCanFollowExportKeyword() { + nextToken(); + return token === SyntaxKind.EqualsToken || token === SyntaxKind.AsteriskToken || + token === SyntaxKind.OpenBraceToken || isDeclarationStart(); } function nextTokenIsDeclarationStart() { @@ -4732,6 +4909,10 @@ module ts { return isDeclarationStart(); } + function nextTokenIsAsKeyword() { + return nextToken() === SyntaxKind.AsKeyword; + } + function parseDeclaration(): ModuleElement { var fullStart = getNodePos(); var modifiers = parseModifiers(); @@ -4740,6 +4921,9 @@ module ts { if (parseOptional(SyntaxKind.EqualsToken)) { return parseExportAssignmentTail(fullStart, modifiers); } + if (token === SyntaxKind.AsteriskToken || token === SyntaxKind.OpenBraceToken) { + return parseExportDeclaration(fullStart, modifiers); + } } switch (token) { @@ -4760,7 +4944,7 @@ module ts { case SyntaxKind.ModuleKeyword: return parseModuleDeclaration(fullStart, modifiers); case SyntaxKind.ImportKeyword: - return parseImportDeclaration(fullStart, modifiers); + return parseImportDeclarationOrImportEqualsDeclaration(fullStart, modifiers); default: Debug.fail("Mismatch between isDeclarationStart and parseDeclaration"); } @@ -4850,8 +5034,10 @@ module ts { function setExternalModuleIndicator(sourceFile: SourceFile) { sourceFile.externalModuleIndicator = forEach(sourceFile.statements, node => node.flags & NodeFlags.Export - || node.kind === SyntaxKind.ImportDeclaration && (node).moduleReference.kind === SyntaxKind.ExternalModuleReference + || node.kind === SyntaxKind.ImportEqualsDeclaration && (node).moduleReference.kind === SyntaxKind.ExternalModuleReference + || node.kind === SyntaxKind.ImportDeclaration || node.kind === SyntaxKind.ExportAssignment + || node.kind === SyntaxKind.ExportDeclaration ? node : undefined); } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 954c443a77c..b74ef039fd6 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -351,24 +351,23 @@ module ts { function processImportedModules(file: SourceFile, basePath: string) { forEach(file.statements, node => { - if (isExternalModuleImportDeclaration(node) && - getExternalModuleImportDeclarationExpression(node).kind === SyntaxKind.StringLiteral) { - - var nameLiteral = getExternalModuleImportDeclarationExpression(node); - var moduleName = nameLiteral.text; - if (moduleName) { - var searchPath = basePath; - while (true) { - var searchName = normalizePath(combinePaths(searchPath, moduleName)); - if (findModuleSourceFile(searchName + ".ts", nameLiteral) || findModuleSourceFile(searchName + ".d.ts", nameLiteral)) { - break; + if (node.kind === SyntaxKind.ImportDeclaration || node.kind === SyntaxKind.ImportEqualsDeclaration || node.kind === SyntaxKind.ExportDeclaration) { + var moduleNameExpr = getExternalModuleName(node); + if (moduleNameExpr && moduleNameExpr.kind === SyntaxKind.StringLiteral) { + var moduleNameText = (moduleNameExpr).text; + if (moduleNameText) { + var searchPath = basePath; + while (true) { + var searchName = normalizePath(combinePaths(searchPath, moduleNameText)); + if (findModuleSourceFile(searchName + ".ts", moduleNameExpr) || findModuleSourceFile(searchName + ".d.ts", moduleNameExpr)) { + break; + } + var parentPath = getDirectoryPath(searchPath); + if (parentPath === searchPath) { + break; + } + searchPath = parentPath; } - - var parentPath = getDirectoryPath(searchPath); - if (parentPath === searchPath) { - break; - } - searchPath = parentPath; } } } @@ -379,10 +378,10 @@ module ts { // The StringLiteral must specify a top - level external module name. // Relative external module names are not permitted forEachChild((node).body, node => { - if (isExternalModuleImportDeclaration(node) && - getExternalModuleImportDeclarationExpression(node).kind === SyntaxKind.StringLiteral) { + if (isExternalModuleImportEqualsDeclaration(node) && + getExternalModuleImportEqualsDeclarationExpression(node).kind === SyntaxKind.StringLiteral) { - var nameLiteral = getExternalModuleImportDeclarationExpression(node); + var nameLiteral = getExternalModuleImportEqualsDeclarationExpression(node); var moduleName = nameLiteral.text; if (moduleName) { // TypeScript 1.0 spec (April 2014): 12.1.6 @@ -399,7 +398,7 @@ module ts { } }); - function findModuleSourceFile(fileName: string, nameLiteral: LiteralExpression) { + function findModuleSourceFile(fileName: string, nameLiteral: Expression) { return findSourceFile(fileName, /* isDefaultLib */ false, file, nameLiteral.pos, nameLiteral.end - nameLiteral.pos); } } diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 029158b989a..9536e2bf1f1 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -38,6 +38,7 @@ module ts { var textToToken: Map = { "any": SyntaxKind.AnyKeyword, + "as": SyntaxKind.AsKeyword, "boolean": SyntaxKind.BooleanKeyword, "break": SyntaxKind.BreakKeyword, "case": SyntaxKind.CaseKeyword, @@ -58,6 +59,7 @@ module ts { "false": SyntaxKind.FalseKeyword, "finally": SyntaxKind.FinallyKeyword, "for": SyntaxKind.ForKeyword, + "from": SyntaxKind.FromKeyword, "function": SyntaxKind.FunctionKeyword, "get": SyntaxKind.GetKeyword, "if": SyntaxKind.IfKeyword, @@ -225,7 +227,7 @@ module ts { return false; } - function isUnicodeIdentifierStart(code: number, languageVersion: ScriptTarget) { + /* @internal */ export function isUnicodeIdentifierStart(code: number, languageVersion: ScriptTarget) { return languageVersion >= ScriptTarget.ES5 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); @@ -280,13 +282,13 @@ module ts { return result; } - export function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { - return computePositionFromLineAndCharacter(getLineStarts(sourceFile), line, character); + export function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { + return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character); } - export function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number { - Debug.assert(line > 0 && line <= lineStarts.length); - return lineStarts[line - 1] + character - 1; + export function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number { + Debug.assert(line >= 0 && line < lineStarts.length); + return lineStarts[line] + character; } export function getLineStarts(sourceFile: SourceFile): number[] { @@ -300,11 +302,11 @@ module ts { // the binary search returns the negative value of the next line start // e.g. if the line starts at [5, 10, 23, 80] and the position requested was 20 // then the search will return -2 - lineNumber = (~lineNumber) - 1; + lineNumber = ~lineNumber - 1; } return { - line: lineNumber + 1, - character: position - lineStarts[lineNumber] + 1 + line: lineNumber, + character: position - lineStarts[lineNumber] }; } diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 3f7e6362e19..a3755650aed 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -72,7 +72,7 @@ module ts { function countLines(program: Program): number { var count = 0; forEach(program.getSourceFiles(), file => { - count += getLineAndCharacterOfPosition(file, file.end).line; + count += getLineStarts(file).length; }); return count; } @@ -88,11 +88,11 @@ module ts { if (diagnostic.file) { var loc = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); - output += diagnostic.file.fileName + "(" + loc.line + "," + loc.character + "): "; + output += `${ diagnostic.file.fileName }(${ loc.line + 1 },${ loc.character + 1 }): `; } var category = DiagnosticCategory[diagnostic.category].toLowerCase(); - output += category + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) + sys.newLine; + output += `${ category } TS${ diagnostic.code }: ${ flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) }${ sys.newLine }`; sys.write(output); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 0133c83c422..5e5993fe4a2 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -120,6 +120,8 @@ module ts { WhileKeyword, WithKeyword, // Strict mode reserved words + AsKeyword, + FromKeyword, ImplementsKeyword, InterfaceKeyword, LetKeyword, @@ -230,8 +232,16 @@ module ts { EnumDeclaration, ModuleDeclaration, ModuleBlock, + ImportEqualsDeclaration, ImportDeclaration, + ImportClause, + NamespaceImport, + NamedImports, + ImportSpecifier, ExportAssignment, + ExportDeclaration, + NamedExports, + ExportSpecifier, // Module references ExternalModuleReference, @@ -344,13 +354,13 @@ module ts { // Specific context the parser was in when this node was created. Normally undefined. // Only set when the parser was in some interesting context (like async/yield). parserContextFlags?: ParserContextFlags; + modifiers?: ModifiersArray; // Array of modifiers id?: number; // Unique id (used to look up NodeLinks) parent?: Node; // Parent node (initialized by binding) symbol?: Symbol; // Symbol declared by node (initialized by binding) locals?: SymbolTable; // Locals associated with node (initialized by binding) nextContainer?: Node; // Next container in declaration order (initialized by binding) localSymbol?: Symbol; // Local symbol declared by node (initialized by binding only for exported nodes) - modifiers?: ModifiersArray; // Array of modifiers } export interface NodeArray extends Array, TextRange { @@ -623,7 +633,7 @@ module ts { export interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } @@ -853,7 +863,11 @@ module ts { members: NodeArray; } - export interface ModuleDeclaration extends Declaration, ModuleElement { + export interface ExportContainer { + exportStars?: ExportDeclaration[]; // List of 'export *' statements (initialized by binding) + } + + export interface ModuleDeclaration extends Declaration, ModuleElement, ExportContainer { name: Identifier | LiteralExpression; body: ModuleBlock | ModuleDeclaration; } @@ -862,7 +876,7 @@ module ts { statements: NodeArray } - export interface ImportDeclaration extends Declaration, ModuleElement { + export interface ImportEqualsDeclaration extends Declaration, ModuleElement { name: Identifier; // 'EntityName' for an internal module reference, 'ExternalModuleReference' for an external @@ -874,6 +888,50 @@ module ts { expression?: Expression; } + // In case of: + // import "mod" => importClause = undefined, moduleSpecifier = "mod" + // In rest of the cases, module specifier is string literal corresponding to module + // ImportClause information is shown at its declaration below. + export interface ImportDeclaration extends Statement, ModuleElement { + importClause?: ImportClause; + moduleSpecifier: Expression; + } + + // In case of: + // import d from "mod" => name = d, namedBinding = undefined + // import * as ns from "mod" => name = undefined, namedBinding: NamespaceImport = { name: ns } + // import d, * as ns from "mod" => name = d, namedBinding: NamespaceImport = { name: ns } + // import { a, b as x } from "mod" => name = undefined, namedBinding: NamedImports = { elements: [{ name: a }, { name: x, propertyName: b}]} + // import d, { a, b as x } from "mod" => name = d, namedBinding: NamedImports = { elements: [{ name: a }, { name: x, propertyName: b}]} + export interface ImportClause extends Declaration { + name?: Identifier; // Default binding + namedBindings?: NamespaceImport | NamedImports; + } + + export interface NamespaceImport extends Declaration { + name: Identifier; + } + + export interface ExportDeclaration extends Statement, ModuleElement { + exportClause?: NamedExports; + moduleSpecifier?: Expression; + } + + export interface NamedImportsOrExports extends Node { + elements: NodeArray; + } + + export type NamedImports = NamedImportsOrExports; + export type NamedExports = NamedImportsOrExports; + + export interface ImportOrExportSpecifier extends Declaration { + propertyName?: Identifier; // Name preceding "as" keyword (or undefined when "as" is absent) + name: Identifier; // Declared name + } + + export type ImportSpecifier = ImportOrExportSpecifier; + export type ExportSpecifier = ImportOrExportSpecifier; + export interface ExportAssignment extends Statement, ModuleElement { exportName: Identifier; } @@ -887,7 +945,7 @@ module ts { } // Source files are declarations when they are external modules. - export interface SourceFile extends Declaration { + export interface SourceFile extends Declaration, ExportContainer { statements: NodeArray; endOfFileToken: Node; @@ -1120,7 +1178,7 @@ module ts { export interface SymbolVisibilityResult { accessibility: SymbolAccessibility; - aliasesToMakeVisible?: ImportDeclaration[]; // aliases that need to have this symbol visible + aliasesToMakeVisible?: ImportEqualsDeclaration[]; // aliases that need to have this symbol visible errorSymbolName?: string; // Optional symbol name that results in error errorNode?: Node; // optional node that results in error } @@ -1130,11 +1188,11 @@ module ts { } export interface EmitResolver { - getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string; - getExpressionNamePrefix(node: Identifier): string; + getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration): string; + getExpressionNameSubstitution(node: Identifier): string; getExportAssignmentName(node: SourceFile): string; - isReferencedImportDeclaration(node: ImportDeclaration): boolean; - isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean; + isReferencedImportDeclaration(node: Node): boolean; + isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; getNodeCheckFlags(node: Node): NodeCheckFlags; isDeclarationVisible(node: Declaration): boolean; isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; @@ -1237,18 +1295,20 @@ module ts { members?: SymbolTable; // Class, interface or literal instance members exports?: SymbolTable; // Module exports exportSymbol?: Symbol; // Exported symbol associated with this symbol - valueDeclaration?: Declaration // First value declaration of the symbol, - constEnumOnlyModule?: boolean // For modules - if true - module contains only const enums or other modules with only const enums. + valueDeclaration?: Declaration // First value declaration of the symbol + constEnumOnlyModule?: boolean // True if module contains only const enums or other modules with only const enums } export interface SymbolLinks { - target?: Symbol; // Resolved (non-alias) target of an alias - type?: Type; // Type of value symbol - declaredType?: Type; // Type of class, interface, enum, or type parameter - mapper?: TypeMapper; // Type mapper for instantiation alias - referenced?: boolean; // True if alias symbol has been referenced as a value - exportAssignSymbol?: Symbol; // Symbol exported from external module - unionType?: UnionType; // Containing union type for union property + target?: Symbol; // Resolved (non-alias) target of an alias + type?: Type; // Type of value symbol + declaredType?: Type; // Type of class, interface, enum, or type parameter + mapper?: TypeMapper; // Type mapper for instantiation alias + referenced?: boolean; // True if alias symbol has been referenced as a value + exportAssignmentChecked?: boolean; // True if export assignment was checked + exportAssignmentSymbol?: Symbol; // Symbol exported from external module + unionType?: UnionType; // Containing union type for union property + resolvedExports?: SymbolTable; // Resolved exports of module } export interface TransientSymbol extends Symbol, SymbolLinks { } @@ -1278,7 +1338,8 @@ module ts { enumMemberValue?: number; // Constant value of enum member isIllegalTypeReferenceInConstraint?: boolean; // Is type reference in constraint refers to the type parameter from the same list isVisible?: boolean; // Is this node visible - localModuleName?: string; // Local name for module instance + generatedName?: string; // Generated name for module, enum, or import declaration + generatedNames?: Map; // Generated names table for source file assignmentChecks?: Map; // Cache of assignment checks hasReportedStatementInAmbientContext?: boolean; // Cache boolean if we report statements in ambient context importOnRightSide?: Symbol; // for import declarations - import that appear on the right side @@ -1646,6 +1707,7 @@ module ts { equals = 0x3D, // = exclamation = 0x21, // ! greaterThan = 0x3E, // > + hash = 0x23, // # lessThan = 0x3C, // < minus = 0x2D, // - openBrace = 0x7B, // { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 0aadd16ebdd..c5bb46aa962 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -105,11 +105,16 @@ module ts { return node; } + export function getStartPositionOfLine(line: number, sourceFile: SourceFile): number { + Debug.assert(line >= 0); + return getLineStarts(sourceFile)[line]; + } + // This is a useful function for debugging purposes. export function nodePosToString(node: Node): string { var file = getSourceFileOfNode(node); var loc = getLineAndCharacterOfPosition(file, node.pos); - return file.fileName + "(" + loc.line + "," + loc.character + ")"; + return `${ file.fileName }(${ loc.line + 1 },${ loc.character + 1 })`; } export function getStartPosOfNode(node: Node): number { @@ -181,6 +186,12 @@ module ts { return identifier.length >= 3 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._ && identifier.charCodeAt(2) === CharacterCodes._ ? identifier.substr(1) : identifier; } + // Make an identifier from an external module name by extracting the string after the last "/" and replacing + // all non-alphanumeric characters with underscores + export function makeIdentifierFromModuleName(moduleName: string): string { + return getBaseFileName(moduleName).replace(/\W/g, "_"); + } + // Return display name of an identifier // Computed property names will just be emitted as "[]", where is the source // text of the expression in the computed property. @@ -586,17 +597,32 @@ module ts { (preserveConstEnums && moduleState === ModuleInstanceState.ConstEnumOnly); } - export function isExternalModuleImportDeclaration(node: Node) { - return node.kind === SyntaxKind.ImportDeclaration && (node).moduleReference.kind === SyntaxKind.ExternalModuleReference; + export function isExternalModuleImportEqualsDeclaration(node: Node) { + return node.kind === SyntaxKind.ImportEqualsDeclaration && (node).moduleReference.kind === SyntaxKind.ExternalModuleReference; } - export function getExternalModuleImportDeclarationExpression(node: Node) { - Debug.assert(isExternalModuleImportDeclaration(node)); - return ((node).moduleReference).expression; + export function getExternalModuleImportEqualsDeclarationExpression(node: Node) { + Debug.assert(isExternalModuleImportEqualsDeclaration(node)); + return ((node).moduleReference).expression; } - export function isInternalModuleImportDeclaration(node: Node) { - return node.kind === SyntaxKind.ImportDeclaration && (node).moduleReference.kind !== SyntaxKind.ExternalModuleReference; + export function isInternalModuleImportEqualsDeclaration(node: Node) { + return node.kind === SyntaxKind.ImportEqualsDeclaration && (node).moduleReference.kind !== SyntaxKind.ExternalModuleReference; + } + + export function getExternalModuleName(node: Node): Expression { + if (node.kind === SyntaxKind.ImportDeclaration) { + return (node).moduleSpecifier; + } + if (node.kind === SyntaxKind.ImportEqualsDeclaration) { + var reference = (node).moduleReference; + if (reference.kind === SyntaxKind.ExternalModuleReference) { + return (reference).expression; + } + } + if (node.kind === SyntaxKind.ExportDeclaration) { + return (node).moduleSpecifier; + } } export function hasDotDotDotToken(node: Node) { @@ -675,7 +701,11 @@ module ts { case SyntaxKind.TypeAliasDeclaration: case SyntaxKind.EnumDeclaration: case SyntaxKind.ModuleDeclaration: - case SyntaxKind.ImportDeclaration: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ImportClause: + case SyntaxKind.ImportSpecifier: + case SyntaxKind.NamespaceImport: + case SyntaxKind.ExportSpecifier: return true; } return false; @@ -762,36 +792,12 @@ module ts { } export function getAncestor(node: Node, kind: SyntaxKind): Node { - switch (kind) { - // special-cases that can be come first - case SyntaxKind.ClassDeclaration: - while (node) { - switch (node.kind) { - case SyntaxKind.ClassDeclaration: - return node; - case SyntaxKind.EnumDeclaration: - case SyntaxKind.InterfaceDeclaration: - case SyntaxKind.TypeAliasDeclaration: - case SyntaxKind.ModuleDeclaration: - case SyntaxKind.ImportDeclaration: - // early exit cases - declarations cannot be nested in classes - return undefined; - default: - node = node.parent; - continue; - } - } - break; - default: - while (node) { - if (node.kind === kind) { - return node; - } - node = node.parent; - } - break; + while (node) { + if (node.kind === kind) { + return node; + } + node = node.parent; } - return undefined; } diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index bb144742f45..59fc2c23f5c 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -398,7 +398,7 @@ module FourSlash { var lineStarts = ts.computeLineStarts(this.getFileContent(this.activeFile.fileName)); var lineCharPos = ts.computeLineAndCharacterOfPosition(lineStarts, pos); - this.scenarioActions.push(''); + this.scenarioActions.push(``); } public moveCaretRight(count = 1) { @@ -2015,39 +2015,31 @@ module FourSlash { // Get the text of the entire line the caret is currently at private getCurrentLineContent() { - // The current caret position (in line/col terms) - var line = this.getCurrentCaretFilePosition().line; - // The line/col of the start of this line - var pos = this.languageServiceAdapterHost.lineColToPosition(this.activeFile.fileName, line, 1); - // The index of the current file + var text = this.getFileContent(this.activeFile.fileName) - // The text from the start of the line to the end of the file - var text = this.getFileContent(this.activeFile.fileName).substring(pos); + var pos = this.currentCaretPosition; + var startPos = pos, endPos = pos; - // Truncate to the first newline - var newlinePos = text.indexOf('\n'); - if (newlinePos === -1) { - return text; - } - else { - if (text.charAt(newlinePos - 1) === '\r') { - newlinePos--; + while (startPos > 0) { + var ch = text.charCodeAt(startPos - 1); + if (ch === ts.CharacterCodes.carriageReturn || ch === ts.CharacterCodes.lineFeed) { + break; } - return text.substr(0, newlinePos); - } - } - private getCurrentCaretFilePosition() { - var result = this.languageServiceAdapterHost.positionToZeroBasedLineCol(this.activeFile.fileName, this.currentCaretPosition); - if (result.line >= 0) { - result.line++; + startPos--; } - if (result.character >= 0) { - result.character++; + while (endPos < text.length) { + var ch = text.charCodeAt(endPos); + + if (ch === ts.CharacterCodes.carriageReturn || ch === ts.CharacterCodes.lineFeed) { + break; + } + + endPos++; } - return result; + return text.substring(startPos, endPos); } private assertItemInCompletionList(items: ts.CompletionEntry[], name: string, text?: string, documentation?: string, kind?: string) { @@ -2125,7 +2117,7 @@ module FourSlash { } private getLineColStringAtPosition(position: number) { - var pos = this.languageServiceAdapterHost.positionToZeroBasedLineCol(this.activeFile.fileName, position); + var pos = this.languageServiceAdapterHost.positionToLineAndCharacter(this.activeFile.fileName, position); return 'line ' + (pos.line + 1) + ', col ' + pos.character; } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 80d741ca53e..26c06c7950c 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -1185,13 +1185,13 @@ module Harness { } export function getMinimalDiagnostic(err: ts.Diagnostic): HarnessDiagnostic { - var errorLineInfo = err.file ? err.file.getLineAndCharacterFromPosition(err.start) : { line: 0, character: 0 }; + var errorLineInfo = err.file ? err.file.getLineAndCharacterOfPosition(err.start) : { line: -1, character: -1 }; return { fileName: err.file && err.file.fileName, start: err.start, end: err.start + err.length, - line: errorLineInfo.line, - character: errorLineInfo.character, + line: errorLineInfo.line + 1, + character: errorLineInfo.character + 1, message: ts.flattenDiagnosticMessageText(err.messageText, ts.sys.newLine), category: ts.DiagnosticCategory[err.category].toLowerCase(), code: err.code diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 712f0afe0aa..a9c28fb70bd 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -159,32 +159,15 @@ module Harness.LanguageService { public openFile(fileName: string): void { } - /** - * @param line 1 based index - * @param col 1 based index - */ - public lineColToPosition(fileName: string, line: number, col: number): number { - var script: ScriptInfo = this.fileNameToScript[fileName]; - assert.isNotNull(script); - assert.isTrue(line >= 1); - assert.isTrue(col >= 1); - - return ts.computePositionFromLineAndCharacter(script.lineMap, line, col); - } - /** * @param line 0 based index * @param col 0 based index */ - public positionToZeroBasedLineCol(fileName: string, position: number): ts.LineAndCharacter { + public positionToLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { var script: ScriptInfo = this.fileNameToScript[fileName]; assert.isNotNull(script); - var result = ts.computeLineAndCharacterOfPosition(script.lineMap, position); - - assert.isTrue(result.line >= 1); - assert.isTrue(result.character >= 1); - return { line: result.line - 1, character: result.character - 1 }; + return ts.computeLineAndCharacterOfPosition(script.lineMap, position); } } @@ -231,8 +214,7 @@ module Harness.LanguageService { getScriptInfo(fileName: string): ScriptInfo { return this.nativeHost.getScriptInfo(fileName); } addScript(fileName: string, content: string): void { this.nativeHost.addScript(fileName, content); } editScript(fileName: string, start: number, end: number, newText: string): void { this.nativeHost.editScript(fileName, start, end, newText); } - lineColToPosition(fileName: string, line: number, col: number): number { return this.nativeHost.lineColToPosition(fileName, line, col); } - positionToZeroBasedLineCol(fileName: string, position: number): ts.LineAndCharacter { return this.nativeHost.positionToZeroBasedLineCol(fileName, position); } + positionToLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { return this.nativeHost.positionToLineAndCharacter(fileName, position); } getCompilationSettings(): string { return JSON.stringify(this.nativeHost.getCompilationSettings()); } getCancellationToken(): ts.CancellationToken { return this.nativeHost.getCancellationToken(); } @@ -471,10 +453,10 @@ module Harness.LanguageService { args: string[] = []; newLine: string; useCaseSensitiveFileNames: boolean = false; - - constructor(private host: NativeLanguageServiceHost) { - this.newLine = this.host.getNewLine(); - } + + constructor(private host: NativeLanguageServiceHost) { + this.newLine = this.host.getNewLine(); + } onMessage(message: string): void { @@ -515,9 +497,9 @@ module Harness.LanguageService { return ""; } - exit(exitCode: number): void { - } - + exit(exitCode: number): void { + } + createDirectory(directoryName: string): void { throw new Error("Not Implemented Yet."); } @@ -529,30 +511,30 @@ module Harness.LanguageService { readDirectory(path: string, extension?: string): string[] { throw new Error("Not implemented Yet."); } - - watchFile(fileName: string, callback: (fileName: string) => void): ts.FileWatcher { - return { close() { } }; - } - - close(): void { - } - + + watchFile(fileName: string, callback: (fileName: string) => void): ts.FileWatcher { + return { close() { } }; + } + + close(): void { + } + info(message: string): void { - return this.host.log(message); - } - - msg(message: string) { - return this.host.log(message); - } - - endGroup(): void { - } - + return this.host.log(message); + } + + msg(message: string) { + return this.host.log(message); + } + + endGroup(): void { + } + perftrc(message: string): void { - return this.host.log(message); - } - - startGroup(): void { + return this.host.log(message); + } + + startGroup(): void { } } diff --git a/src/harness/typeWriter.ts b/src/harness/typeWriter.ts index 1d8b3efef68..54cdc27e3b3 100644 --- a/src/harness/typeWriter.ts +++ b/src/harness/typeWriter.ts @@ -85,15 +85,17 @@ class TypeWriterWalker { private log(node: ts.Node, type: ts.Type): void { var actualPos = ts.skipTrivia(this.currentSourceFile.text, node.pos); - var lineAndCharacter = this.currentSourceFile.getLineAndCharacterFromPosition(actualPos); + var lineAndCharacter = this.currentSourceFile.getLineAndCharacterOfPosition(actualPos); var sourceText = ts.getTextOfNodeFromSourceText(this.currentSourceFile.text, node); // If we got an unknown type, we temporarily want to fall back to just pretending the name // (source text) of the node is the type. This is to align with the old typeWriter to make // baseline comparisons easier. In the long term, we will want to just call typeToString this.results.push({ - line: lineAndCharacter.line - 1, - column: lineAndCharacter.character, + line: lineAndCharacter.line, + // todo(cyrusn): Not sure why column is one-based for type-writer. But I'm preserving + // that behavior to prevent having a lot of baselines to fix up. + column: lineAndCharacter.character + 1, syntaxKind: node.kind, sourceText: sourceText, type: this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.WriteOwnNameForAnyLike) diff --git a/src/server/client.ts b/src/server/client.ts index 6185834a022..4cee592fb6c 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -47,14 +47,14 @@ module ts.server { } private lineColToPosition(fileName: string, lineCol: protocol.Location): number { - return ts.computePositionFromLineAndCharacter(this.getLineMap(fileName), lineCol.line, lineCol.col); + return ts.computePositionOfLineAndCharacter(this.getLineMap(fileName), lineCol.line - 1, lineCol.col - 1); } private positionToOneBasedLineCol(fileName: string, position: number): protocol.Location { var lineCol = ts.computeLineAndCharacterOfPosition(this.getLineMap(fileName), position); return { - line: lineCol.line, - col: lineCol.character + line: lineCol.line + 1, + col: lineCol.character + 1 }; } @@ -208,9 +208,9 @@ module ts.server { return response.body[0]; } - getNavigateToItems(searchTerm: string): NavigateToItem[] { + getNavigateToItems(searchValue: string): NavigateToItem[] { var args: protocol.NavtoRequestArgs = { - searchTerm, + searchValue, file: this.host.getScriptFileNames()[0] }; diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 5b5ee27d707..d7eda52ce38 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -65,6 +65,7 @@ module ts.server { ls: ts.LanguageService = null; compilationSettings: ts.CompilerOptions; filenameToScript: ts.Map = {}; + roots: ScriptInfo[] = []; constructor(public host: ServerHost, public project: Project) { } @@ -144,7 +145,7 @@ module ts.server { var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName); if (!scriptInfo) { this.filenameToScript[info.fileName] = info; - return info; + this.roots.push(info); } } @@ -286,10 +287,12 @@ module ts.server { return this.filenameToSourceFile[info.fileName]; } - getSourceFileFromName(filename: string) { + getSourceFileFromName(filename: string, requireOpen?: boolean) { var info = this.projectService.getScriptInfo(filename); if (info) { - return this.getSourceFile(info); + if ((!requireOpen) || info.isOpen) { + return this.getSourceFile(info); + } } } @@ -324,7 +327,7 @@ module ts.server { // add a root file to project addRoot(info: ScriptInfo) { info.defaultProject = this; - return this.compilerService.host.addRoot(info); + this.compilerService.host.addRoot(info); } filesToString() { @@ -360,7 +363,7 @@ module ts.server { } interface ProjectServiceEventHandler { - (eventName: string, project: Project): void; + (eventName: string, project: Project, fileName: string): void; } export class ProjectService { @@ -392,7 +395,6 @@ module ts.server { } } - log(msg: string, type = "Err") { this.psLogger.msg(msg, type); } @@ -423,7 +425,20 @@ module ts.server { for (var i = 0, len = referencingProjects.length; i < len; i++) { referencingProjects[i].removeReferencedFile(info); } + for (var j = 0, flen = this.openFileRoots.length; j < flen; j++) { + var openFile = this.openFileRoots[j]; + if (this.eventHandler) { + this.eventHandler("context", openFile.defaultProject, openFile.fileName); + } + } + for (var j = 0, flen = this.openFilesReferenced.length; j < flen; j++) { + var openFile = this.openFilesReferenced[j]; + if (this.eventHandler) { + this.eventHandler("context", openFile.defaultProject, openFile.fileName); + } + } } + this.printProjects(); } @@ -503,19 +518,52 @@ module ts.server { info.close(); } - findReferencingProjects(info: ScriptInfo) { + findReferencingProjects(info: ScriptInfo, excludedProject?: Project) { var referencingProjects: Project[] = []; info.defaultProject = undefined; for (var i = 0, len = this.inferredProjects.length; i < len; i++) { this.inferredProjects[i].updateGraph(); - if (this.inferredProjects[i].getSourceFile(info)) { - info.defaultProject = this.inferredProjects[i]; - referencingProjects.push(this.inferredProjects[i]); + if (this.inferredProjects[i] != excludedProject) { + if (this.inferredProjects[i].getSourceFile(info)) { + info.defaultProject = this.inferredProjects[i]; + referencingProjects.push(this.inferredProjects[i]); + } } } return referencingProjects; } + updateProjectStructure() { + this.log("updating project structure from ...", "Info"); + this.printProjects(); + for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) { + var refdFile = this.openFilesReferenced[i]; + refdFile.defaultProject.updateGraph(); + var sourceFile = refdFile.defaultProject.getSourceFile(refdFile); + if (!sourceFile) { + this.openFilesReferenced = copyListRemovingItem(refdFile, this.openFilesReferenced); + this.addOpenFile(refdFile); + } + } + var openFileRoots: ScriptInfo[] = []; + for (var i = 0, len = this.openFileRoots.length; i < len; i++) { + var rootFile = this.openFileRoots[i]; + var rootedProject = rootFile.defaultProject; + var referencingProjects = this.findReferencingProjects(rootFile, rootedProject); + if (referencingProjects.length == 0) { + rootFile.defaultProject = rootedProject; + openFileRoots.push(rootFile); + } + else { + // remove project from inferred projects list + this.inferredProjects = copyListRemovingItem(rootedProject, this.inferredProjects); + this.openFilesReferenced.push(rootFile); + } + } + this.openFileRoots = openFileRoots; + this.printProjects(); + } + getScriptInfo(filename: string) { filename = ts.normalizePath(filename); return ts.lookUp(this.filenameToScriptInfo, filename); @@ -621,6 +669,7 @@ module ts.server { this.psLogger.startGroup(); for (var i = 0, len = this.inferredProjects.length; i < len; i++) { var project = this.inferredProjects[i]; + project.updateGraph(); this.psLogger.info("Project " + i.toString()); this.psLogger.info(project.filesToString()); this.psLogger.info("-----------------------------------------------"); diff --git a/src/server/protocol.d.ts b/src/server/protocol.d.ts index b07fb20d48d..a4541d2666d 100644 --- a/src/server/protocol.d.ts +++ b/src/server/protocol.d.ts @@ -676,7 +676,11 @@ declare module ts.server.protocol { * Search term to navigate to from current location; term can * be '.*' or an identifier prefix. */ - searchTerm: string; + searchValue: string; + /** + * Optional limit on the number of items to return. + */ + maxResultCount?: number; } /** diff --git a/src/server/server.ts b/src/server/server.ts index 8921a4b4768..2b9040b4df3 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -82,7 +82,6 @@ module ts.server { private watchedFiles: WatchedFile[] = []; private nextFileToCheck = 0; private watchTimer: NodeJS.Timer; - private static fileDeleted = 34; // average async stat takes about 30 microseconds // set chunk size to do 30 files in < 1 millisecond @@ -111,13 +110,7 @@ module ts.server { fs.stat(watchedFile.fileName,(err, stats) => { if (err) { - var msg = err.message; - if (err.errno) { - msg += " errno: " + err.errno.toString(); - } - if (err.errno == WatchedFileSet.fileDeleted) { - watchedFile.callback(watchedFile.fileName); - } + watchedFile.callback(watchedFile.fileName); } else if (watchedFile.mtime.getTime() != stats.mtime.getTime()) { watchedFile.mtime = WatchedFileSet.getModifiedTime(watchedFile.fileName); diff --git a/src/server/session.ts b/src/server/session.ts index 19f6cd3645e..21238e88992 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -52,30 +52,6 @@ module ts.server { return 1; } } - - function sortNavItems(items: ts.NavigateToItem[]) { - return items.sort((a, b) => { - if (a.matchKind < b.matchKind) { - return -1; - } - else if (a.matchKind == b.matchKind) { - var lowa = a.name.toLowerCase(); - var lowb = b.name.toLowerCase(); - if (lowa < lowb) { - return -1; - } - else if (lowa == lowb) { - return 0; - } - else { - return 1; - } - } - else { - return 1; - } - }) - } function formatDiag(fileName: string, project: Project, diag: ts.Diagnostic) { return { @@ -122,7 +98,6 @@ module ts.server { module Errors { export var NoProject = new Error("No Project."); - export var NoContent = new Error("No Content."); } export interface ServerHost extends ts.System { @@ -138,7 +113,18 @@ module ts.server { changeSeq = 0; constructor(private host: ServerHost, private logger: Logger) { - this.projectService = new ProjectService(host, logger); + this.projectService = + new ProjectService(host, logger, (eventName,project,fileName) => { + this.handleEvent(eventName, project, fileName); + }); + } + + handleEvent(eventName: string, project: Project, fileName: string) { + if (eventName == "context") { + this.projectService.log("got context event, updating diagnostics for" + fileName, "Info"); + this.updateErrorCheck([{ fileName, project }], this.changeSeq, + (n) => n == this.changeSeq, 100); + } } logError(err: Error, cmd: string) { @@ -215,6 +201,14 @@ module ts.server { this.semanticCheck(file, project); } + updateProjectStructure(seq: number, matchSeq: (seq: number) => boolean, ms = 1500) { + setTimeout(() => { + if (matchSeq(seq)) { + this.projectService.updateProjectStructure(); + } + }, ms); + } + updateErrorCheck(checkList: PendingErrorCheck[], seq: number, matchSeq: (seq: number) => boolean, ms = 1500, followMs = 200) { if (followMs > ms) { @@ -231,7 +225,7 @@ module ts.server { var checkOne = () => { if (matchSeq(seq)) { var checkSpec = checkList[index++]; - if (checkSpec.project.getSourceFileFromName(checkSpec.fileName)) { + if (checkSpec.project.getSourceFileFromName(checkSpec.fileName, true)) { this.syntacticCheck(checkSpec.fileName, checkSpec.project); this.immediateId = setImmediate(() => { this.semanticCheck(checkSpec.fileName, checkSpec.project); @@ -263,7 +257,7 @@ module ts.server { var definitions = compilerService.languageService.getDefinitionAtPosition(file, position); if (!definitions) { - throw Errors.NoContent; + return undefined; } return definitions.map(def => ({ @@ -284,7 +278,7 @@ module ts.server { var position = compilerService.host.lineColToPosition(file, line, col); var renameInfo = compilerService.languageService.getRenameInfo(file, position); if (!renameInfo) { - throw Errors.NoContent; + return undefined; } if (!renameInfo.canRename) { @@ -296,7 +290,7 @@ module ts.server { var renameLocations = compilerService.languageService.findRenameLocations(file, position, findInStrings, findInComments); if (!renameLocations) { - throw Errors.NoContent; + return undefined; } var bakedRenameLocs = renameLocations.map(location => ({ @@ -355,12 +349,12 @@ module ts.server { var references = compilerService.languageService.getReferencesAtPosition(file, position); if (!references) { - throw Errors.NoContent; + return undefined; } var nameInfo = compilerService.languageService.getQuickInfoAtPosition(file, position); if (!nameInfo) { - throw Errors.NoContent; + return undefined; } var displayString = ts.displayPartsToString(nameInfo.displayParts); @@ -404,7 +398,7 @@ module ts.server { var position = compilerService.host.lineColToPosition(file, line, col); var quickInfo = compilerService.languageService.getQuickInfoAtPosition(file, position); if (!quickInfo) { - throw Errors.NoContent; + return undefined; } var displayString = ts.displayPartsToString(quickInfo.displayParts); @@ -433,7 +427,7 @@ module ts.server { // TODO: avoid duplicate code (with formatonkey) var edits = compilerService.languageService.getFormattingEditsForRange(file, startPosition, endPosition, compilerService.formatCodeOptions); if (!edits) { - throw Errors.NoContent; + return undefined; } return edits.map((edit) => { @@ -473,7 +467,7 @@ module ts.server { } if (!edits) { - throw Errors.NoContent; + return undefined; } return edits.map((edit) => { @@ -502,7 +496,7 @@ module ts.server { var completions = compilerService.languageService.getCompletionsAtPosition(file, position); if (!completions) { - throw Errors.NoContent; + return undefined; } return completions.entries.reduce((result: protocol.CompletionEntry[], entry: ts.CompletionEntry) => { @@ -559,6 +553,10 @@ module ts.server { compilerService.host.editScript(file, start, end, insertString); this.changeSeq++; } + // update project structure on idle commented out + // until we can have the host return only the root files + // from getScriptFileNames() + //this.updateProjectStructure(this.changeSeq, (n) => n == this.changeSeq); } } @@ -619,13 +617,13 @@ module ts.server { var compilerService = project.compilerService; var items = compilerService.languageService.getNavigationBarItems(file); if (!items) { - throw Errors.NoContent; + return undefined; } return this.decorateNavigationBarItem(project, fileName, items); } - getNavigateToItems(searchTerm: string, fileName: string): protocol.NavtoItem[] { + getNavigateToItems(searchValue: string, fileName: string, maxResultCount?: number): protocol.NavtoItem[] { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -633,9 +631,9 @@ module ts.server { } var compilerService = project.compilerService; - var navItems = sortNavItems(compilerService.languageService.getNavigateToItems(searchTerm)); + var navItems = compilerService.languageService.getNavigateToItems(searchValue, maxResultCount); if (!navItems) { - throw Errors.NoContent; + return undefined; } return navItems.map((navItem) => { @@ -677,7 +675,7 @@ module ts.server { var spans = compilerService.languageService.getBraceMatchingAtPosition(file, position); if (!spans) { - throw Errors.NoContent; + return undefined; } return spans.map(span => ({ @@ -690,6 +688,8 @@ module ts.server { try { var request = JSON.parse(message); var response: any; + var errorMessage: string; + var responseRequired = true; switch (request.command) { case CommandNames.Definition: { var defArgs = request.arguments; @@ -709,6 +709,7 @@ module ts.server { case CommandNames.Open: { var openArgs = request.arguments; this.openClientFile(openArgs.file); + responseRequired = false; break; } case CommandNames.Quickinfo: { @@ -740,12 +741,14 @@ module ts.server { case CommandNames.Geterr: { var geterrArgs = request.arguments; response = this.getDiagnostics(geterrArgs.delay, geterrArgs.files); + responseRequired = false; break; } case CommandNames.Change: { var changeArgs = request.arguments; this.change(changeArgs.line, changeArgs.col, changeArgs.endLine, changeArgs.endCol, changeArgs.insertString, changeArgs.file); + responseRequired = false; break; } case CommandNames.Reload: { @@ -756,16 +759,18 @@ module ts.server { case CommandNames.Saveto: { var savetoArgs = request.arguments; this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile); + responseRequired = false; break; } case CommandNames.Close: { var closeArgs = request.arguments; this.closeClientFile(closeArgs.file); + responseRequired = false; break; } case CommandNames.Navto: { var navtoArgs = request.arguments; - response = this.getNavigateToItems(navtoArgs.searchTerm, navtoArgs.file); + response = this.getNavigateToItems(navtoArgs.searchValue, navtoArgs.file, navtoArgs.maxResultCount); break; } case CommandNames.Brace: { @@ -788,6 +793,9 @@ module ts.server { if (response) { this.output(response, request.command, request.seq); } + else if (responseRequired) { + this.output(undefined, request.command, request.seq, "No content available."); + } } catch (err) { if (err instanceof OperationCanceledException) { diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 86b72b711c1..a4943705e72 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -14,17 +14,17 @@ module ts.BreakpointResolver { } var tokenAtLocation = getTokenAtPosition(sourceFile, position); - var lineOfPosition = sourceFile.getLineAndCharacterFromPosition(position).line; - if (sourceFile.getLineAndCharacterFromPosition(tokenAtLocation.getStart()).line > lineOfPosition) { + var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line; + if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart()).line > lineOfPosition) { // Get previous token if the token is returned starts on new line - // eg: var x =10; |--- curser is here + // eg: var x =10; |--- cursor is here // var y = 10; // token at position will return var keyword on second line as the token but we would like to use // token on same line if trailing trivia (comments or white spaces on same line) part of the last token on that line tokenAtLocation = findPrecedingToken(tokenAtLocation.pos, sourceFile); // Its a blank line - if (!tokenAtLocation || sourceFile.getLineAndCharacterFromPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { + if (!tokenAtLocation || sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { return undefined; } } @@ -42,7 +42,7 @@ module ts.BreakpointResolver { } function spanInNodeIfStartsOnSameLine(node: Node, otherwiseOnNode?: Node): TextSpan { - if (node && lineOfPosition === sourceFile.getLineAndCharacterFromPosition(node.getStart()).line) { + if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart()).line) { return spanInNode(node); } return spanInNode(otherwiseOnNode); @@ -69,7 +69,7 @@ module ts.BreakpointResolver { return textSpan(node); } - if (node.parent.kind === SyntaxKind.BinaryExpression && (node.parent).operator === SyntaxKind.CommaToken) { + if (node.parent.kind === SyntaxKind.BinaryExpression && (node.parent).operatorToken.kind === SyntaxKind.CommaToken) { // if this is comma expression, the breakpoint is possible in this expression return textSpan(node); } @@ -176,9 +176,9 @@ module ts.BreakpointResolver { // span on export = id return textSpan(node, (node).exportName); - case SyntaxKind.ImportDeclaration: + case SyntaxKind.ImportEqualsDeclaration: // import statement without including semicolon - return textSpan(node,(node).moduleReference); + return textSpan(node,(node).moduleReference); case SyntaxKind.ModuleDeclaration: // span on complete module if it is instantiated diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 969f7260744..180ff0c9e95 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -67,8 +67,8 @@ module ts.formatting { } export function formatOnEnter(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[] { - var line = sourceFile.getLineAndCharacterFromPosition(position).line; - if (line === 1) { + var line = sourceFile.getLineAndCharacterOfPosition(position).line; + if (line === 0) { return []; } // get the span for the previous\current line @@ -100,7 +100,7 @@ module ts.formatting { export function formatSelection(start: number, end: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[] { // format from the beginning of the line var span = { - pos: getStartLinePositionForPosition(start, sourceFile), + pos: getLineStartPositionForPosition(start, sourceFile), end: end }; return formatSpan(span, sourceFile, options, rulesProvider, FormattingRequestKind.FormatSelection); @@ -112,7 +112,7 @@ module ts.formatting { return []; } var span = { - pos: getStartLinePositionForPosition(parent.getStart(sourceFile), sourceFile), + pos: getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile), end: parent.end }; return formatSpan(span, sourceFile, options, rulesProvider, requestKind); @@ -283,7 +283,7 @@ module ts.formatting { var previousLine = Constants.Unknown; var childKind = SyntaxKind.Unknown; while (n) { - var line = sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)).line; + var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; if (previousLine !== Constants.Unknown && line !== previousLine) { break; } @@ -327,7 +327,7 @@ module ts.formatting { formattingScanner.advance(); if (formattingScanner.isOnToken()) { - var startLine = sourceFile.getLineAndCharacterFromPosition(enclosingNode.getStart(sourceFile)).line; + var startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line; var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); processNode(enclosingNode, enclosingNode, startLine, initialIndentation, delta); } @@ -357,8 +357,8 @@ module ts.formatting { } } else { - var startLine = sourceFile.getLineAndCharacterFromPosition(startPos).line; - var startLinePosition = getStartLinePositionForPosition(startPos, sourceFile); + var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line; + var startLinePosition = getLineStartPositionForPosition(startPos, sourceFile); var column = SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); if (startLine !== parentStartLine || startPos === column) { return column @@ -521,7 +521,7 @@ module ts.formatting { var childStartPos = child.getStart(sourceFile); - var childStart = sourceFile.getLineAndCharacterFromPosition(childStartPos); + var childStart = sourceFile.getLineAndCharacterOfPosition(childStartPos); // if child is a list item - try to get its indentation var childIndentationAmount = Constants.Unknown; @@ -594,7 +594,7 @@ module ts.formatting { } else if (tokenInfo.token.kind === listStartToken) { // consume list start token - startLine = sourceFile.getLineAndCharacterFromPosition(tokenInfo.token.pos).line; + startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; var indentation = computeIndentation(tokenInfo.token, startLine, Constants.Unknown, parent, parentDynamicIndentation, startLine); @@ -641,7 +641,7 @@ module ts.formatting { var lineAdded: boolean; var isTokenInRange = rangeContainsRange(originalRange, currentTokenInfo.token); - var tokenStart = sourceFile.getLineAndCharacterFromPosition(currentTokenInfo.token.pos); + var tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos); if (isTokenInRange) { var rangeHasError = rangeContainsError(currentTokenInfo.token); // save prevStartLine since processRange will overwrite this value with current ones @@ -674,7 +674,7 @@ module ts.formatting { continue; } - var triviaStartLine = sourceFile.getLineAndCharacterFromPosition(triviaItem.pos).line; + var triviaStartLine = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos).line; switch (triviaItem.kind) { case SyntaxKind.MultiLineCommentTrivia: var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); @@ -712,7 +712,7 @@ module ts.formatting { for (var i = 0, len = trivia.length; i < len; ++i) { var triviaItem = trivia[i]; if (isComment(triviaItem.kind) && rangeContainsRange(originalRange, triviaItem)) { - var triviaItemStart = sourceFile.getLineAndCharacterFromPosition(triviaItem.pos); + var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); } } @@ -729,7 +729,7 @@ module ts.formatting { if (!rangeHasError && !previousRangeHasError) { if (!previousRange) { // trim whitespaces starting from the beginning of the span up to the current line - var originalStart = sourceFile.getLineAndCharacterFromPosition(originalRange.pos); + var originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos); trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); } else { @@ -807,18 +807,18 @@ module ts.formatting { recordReplace(pos, 0, indentationString); } else { - var tokenStart = sourceFile.getLineAndCharacterFromPosition(pos); - if (indentation !== tokenStart.character - 1) { + var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); + if (indentation !== tokenStart.character) { var startLinePosition = getStartPositionOfLine(tokenStart.line, sourceFile); - recordReplace(startLinePosition, tokenStart.character - 1, indentationString); + recordReplace(startLinePosition, tokenStart.character, indentationString); } } } function indentMultilineComment(commentRange: TextRange, indentation: number, firstLineIsIndented: boolean) { // split comment in lines - var startLine = sourceFile.getLineAndCharacterFromPosition(commentRange.pos).line; - var endLine = sourceFile.getLineAndCharacterFromPosition(commentRange.end).line; + var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; if (startLine === endLine) { if (!firstLineIsIndented) { diff --git a/src/services/formatting/formattingContext.ts b/src/services/formatting/formattingContext.ts index 2bfb155921e..b7573526f78 100644 --- a/src/services/formatting/formattingContext.ts +++ b/src/services/formatting/formattingContext.ts @@ -71,8 +71,8 @@ module ts.formatting { public TokensAreOnSameLine(): boolean { if (this.tokensAreOnSameLine === undefined) { - var startLine = this.sourceFile.getLineAndCharacterFromPosition(this.currentTokenSpan.pos).line; - var endLine = this.sourceFile.getLineAndCharacterFromPosition(this.nextTokenSpan.pos).line; + var startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line; this.tokensAreOnSameLine = (startLine == endLine); } @@ -96,8 +96,8 @@ module ts.formatting { } private NodeIsOnOneLine(node: Node): boolean { - var startLine = this.sourceFile.getLineAndCharacterFromPosition(node.getStart(this.sourceFile)).line; - var endLine = this.sourceFile.getLineAndCharacterFromPosition(node.getEnd()).line; + var startLine = this.sourceFile.getLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line; return startLine == endLine; } @@ -105,8 +105,8 @@ module ts.formatting { var openBrace = findChildOfKind(node, SyntaxKind.OpenBraceToken, this.sourceFile); var closeBrace = findChildOfKind(node, SyntaxKind.CloseBraceToken, this.sourceFile); if (openBrace && closeBrace) { - var startLine = this.sourceFile.getLineAndCharacterFromPosition(openBrace.getEnd()).line; - var endLine = this.sourceFile.getLineAndCharacterFromPosition(closeBrace.getStart(this.sourceFile)).line; + var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; return startLine === endLine; } return false; diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts index e9485158aba..962f142f609 100644 --- a/src/services/formatting/formattingScanner.ts +++ b/src/services/formatting/formattingScanner.ts @@ -93,17 +93,16 @@ module ts.formatting { savedPos = scanner.getStartPos(); } - function shouldRescanGreaterThanToken(container: Node): boolean { - if (container.kind !== SyntaxKind.BinaryExpression) { - return false; - } - switch ((container).operator) { - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - return true; + function shouldRescanGreaterThanToken(node: Node): boolean { + if (node) { + switch (node.kind) { + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + return true; + } } return false; @@ -164,7 +163,7 @@ module ts.formatting { if (expectedScanAction === ScanAction.RescanGreaterThanToken && currentToken === SyntaxKind.GreaterThanToken) { currentToken = scanner.reScanGreaterToken(); - Debug.assert((n).operator === currentToken); + Debug.assert(n.kind === currentToken); lastScanAction = ScanAction.RescanGreaterThanToken; } else if (expectedScanAction === ScanAction.RescanSlashToken && startsWithSlashToken(currentToken)) { diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index b5470579787..e64e29d2808 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -452,7 +452,7 @@ module ts.formatting { return true; // equal in import a = module('a'); - case SyntaxKind.ImportDeclaration: + case SyntaxKind.ImportEqualsDeclaration: // equal in var a = 0; case SyntaxKind.VariableDeclaration: // equal in p = 0; diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 8d7d96e5887..04849420e70 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -24,7 +24,7 @@ module ts.formatting { return 0; } - var lineAtPosition = sourceFile.getLineAndCharacterFromPosition(position).line; + var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; if (precedingToken.kind === SyntaxKind.CommaToken && precedingToken.parent.kind !== SyntaxKind.BinaryExpression) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it @@ -74,7 +74,7 @@ module ts.formatting { } export function getIndentationForNode(n: Node, ignoreActualIndentationRange: TextRange, sourceFile: SourceFile, options: FormatCodeOptions): number { - var start = sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)); + var start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, /*indentationDelta*/ 0, sourceFile, options); } @@ -135,10 +135,10 @@ module ts.formatting { function getParentStart(parent: Node, child: Node, sourceFile: SourceFile): LineAndCharacter { var containingList = getContainingList(child, sourceFile); if (containingList) { - return sourceFile.getLineAndCharacterFromPosition(containingList.pos); + return sourceFile.getLineAndCharacterOfPosition(containingList.pos); } - return sourceFile.getLineAndCharacterFromPosition(parent.getStart(sourceFile)); + return sourceFile.getLineAndCharacterOfPosition(parent.getStart(sourceFile)); } /* @@ -204,7 +204,7 @@ module ts.formatting { } function getStartLineAndCharacterForNode(n: Node, sourceFile: SourceFile): LineAndCharacter { - return sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)); + return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean { @@ -279,7 +279,6 @@ module ts.formatting { } } - function deriveActualIndentationFromList(list: Node[], index: number, sourceFile: SourceFile, options: EditorOptions): number { Debug.assert(index >= 0 && index < list.length); var node = list[index]; @@ -292,7 +291,7 @@ module ts.formatting { continue; } // skip list items that ends on the same line with the current list element - var prevEndLine = sourceFile.getLineAndCharacterFromPosition(list[i].end).line; + var prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line; if (prevEndLine !== lineAndCharacter.line) { return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); } @@ -303,7 +302,7 @@ module ts.formatting { } function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter: LineAndCharacter, sourceFile: SourceFile, options: EditorOptions): number { - var lineStart = sourceFile.getPositionFromLineAndCharacter(lineAndCharacter.line, 1); + var lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0); return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options); } diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts new file mode 100644 index 00000000000..d008cac80f7 --- /dev/null +++ b/src/services/navigateTo.ts @@ -0,0 +1,117 @@ +module ts.NavigateTo { + type RawNavigateToItem = { name: string; fileName: string; matchKind: MatchKind; declaration: Declaration }; + + enum MatchKind { + none = 0, + exact = 1, + substring = 2, + prefix = 3 + } + + export function getNavigateToItems(program: Program, cancellationToken: CancellationTokenObject, searchValue: string, maxResultCount: number): NavigateToItem[]{ + // Split search value in terms array + var terms = searchValue.split(" "); + + // default NavigateTo approach: if search term contains only lower-case chars - use case-insensitive search, otherwise switch to case-sensitive version + var searchTerms = map(terms, t => ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t })); + + var rawItems: RawNavigateToItem[] = []; + + // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] + forEach(program.getSourceFiles(), sourceFile => { + cancellationToken.throwIfCancellationRequested(); + + var fileName = sourceFile.fileName; + var declarations = sourceFile.getNamedDeclarations(); + for (var i = 0, n = declarations.length; i < n; i++) { + var declaration = declarations[i]; + // TODO(jfreeman): Skip this declaration if it has a computed name + var name = (declaration.name).text; + var matchKind = getMatchKind(searchTerms, name); + if (matchKind !== MatchKind.none) { + rawItems.push({ name, fileName, matchKind, declaration }); + } + } + }); + + rawItems.sort(compareNavigateToItems); + if (maxResultCount !== undefined) { + rawItems = rawItems.slice(0, maxResultCount); + } + + var items = map(rawItems, createNavigateToItem); + + return items; + + // This means "compare in a case insensitive manner." + var baseSensitivity: Intl.CollatorOptions = { sensitivity: "base" }; + function compareNavigateToItems(i1: RawNavigateToItem, i2: RawNavigateToItem) { + // TODO(cyrusn): get the gamut of comparisons that VS already uses here. + // Right now we just sort by kind first, and then by name of the item. + // We first sort case insensitively. So "Aaa" will come before "bar". + // Then we sort case sensitively, so "aaa" will come before "Aaa". + return i1.matchKind - i2.matchKind || + i1.name.localeCompare(i2.name, undefined, baseSensitivity) || + i1.name.localeCompare(i2.name); + } + + function createNavigateToItem(rawItem: RawNavigateToItem): NavigateToItem { + var declaration = rawItem.declaration; + var container = getContainerNode(declaration); + return { + name: rawItem.name, + kind: getNodeKind(declaration), + kindModifiers: getNodeModifiers(declaration), + matchKind: MatchKind[rawItem.matchKind], + fileName: rawItem.fileName, + textSpan: createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + // TODO(jfreeman): What should be the containerName when the container has a computed name? + containerName: container && container.name ? (container.name).text : "", + containerKind: container && container.name ? getNodeKind(container) : "" + }; + } + + function hasAnyUpperCaseCharacter(s: string): boolean { + for (var i = 0, n = s.length; i < n; i++) { + var c = s.charCodeAt(i); + if ((CharacterCodes.A <= c && c <= CharacterCodes.Z) || + (c >= CharacterCodes.maxAsciiCharacter && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) { + return true; + } + } + + return false; + } + + function getMatchKind(searchTerms: { caseSensitive: boolean; term: string }[], name: string): MatchKind { + var matchKind = MatchKind.none; + + if (name) { + for (var j = 0, n = searchTerms.length; j < n; j++) { + var searchTerm = searchTerms[j]; + var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase(); + // in case of case-insensitive search searchTerm.term will already be lower-cased + var index = nameToSearch.indexOf(searchTerm.term); + if (index < 0) { + // Didn't match. + return MatchKind.none; + } + + var termKind = MatchKind.substring; + if (index === 0) { + // here we know that match occur at the beginning of the string. + // if search term and declName has the same length - we have an exact match, otherwise declName have longer length and this will be prefix match + termKind = name.length === searchTerm.term.length ? MatchKind.exact : MatchKind.prefix; + } + + // Update our match kind if we don't have one, or if this match is better. + if (matchKind === MatchKind.none || termKind < matchKind) { + matchKind = termKind; + } + } + } + + return matchKind; + } + } +} \ No newline at end of file diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts new file mode 100644 index 00000000000..da07c4400bc --- /dev/null +++ b/src/services/patternMatcher.ts @@ -0,0 +1,813 @@ +module ts { + // Note(cyrusn): this enum is ordered from strongest match type to weakest match type. + export enum PatternMatchKind { + Exact, + Prefix, + Substring, + CamelCase + } + + // Information about a match made by the pattern matcher between a candidate and the + // search pattern. + export interface PatternMatch { + // What kind of match this was. Exact matches are better than prefix matches which are + // better than substring matches which are better than CamelCase matches. + kind: PatternMatchKind; + + // If this was a camel case match, how strong the match is. Higher number means + // it was a better match. + camelCaseWeight?: number; + + // If this was a match where all constituent parts of the candidate and search pattern + // matched case sensitively or case insensitively. Case sensitive matches of the kind + // are better matches than insensitive matches. + isCaseSensitive: boolean; + + // Whether or not this match occurred with the punctuation from the search pattern stripped + // out or not. Matches without the punctuation stripped are better than ones with punctuation + // stripped. + punctuationStripped: boolean; + } + + // The pattern matcher maintains an internal cache of information as it is used. Therefore, + // you should not keep it around forever and should get and release the matcher appropriately + // once you no longer need it. + export interface PatternMatcher { + // Used to match a candidate against the last segment of a possibly dotted pattern. This + // is useful as a quick check to prevent having to compute a container before calling + // "getMatches". + // + // For example, if the search pattern is "ts.c.SK" and the candidate is "SyntaxKind", then + // this will return a successful match, having only tested "SK" against "SyntaxKind". At + // that point a call can be made to 'getMatches("SyntaxKind", "ts.compiler")', with the + // work to create 'ts.compiler' only being done once the first match succeeded. + getMatchesForLastSegmentOfPattern(candidate: string): PatternMatch[]; + + // Fully checks a candidate, with an dotted container, against the search pattern. + // The candidate must match the last part of the search pattern, and the dotted container + // must match the preceding segments of the pattern. + getMatches(candidate: string, dottedContainer: string): PatternMatch[]; + + // Whether or not the pattern contained dots or not. Clients can use this to determine + // If they should call getMatches, or if getMatchesForLastSegmentOfPattern is sufficient. + patternContainsDots: boolean; + } + + // First we break up the pattern given by dots. Each portion of the pattern between the + // dots is a 'Segment'. The 'Segment' contains information about the entire section of + // text between the dots, as well as information about any individual 'Words' that we + // can break the segment into. A 'Word' is simply a contiguous sequence of characters + // that can appear in a typescript identifier. So "GetKeyword" would be one word, while + // "Get Keyword" would be two words. Once we have the individual 'words', we break those + // into constituent 'character spans' of interest. For example, while 'UIElement' is one + // word, it make character spans corresponding to "U", "I" and "Element". These spans + // are then used when doing camel cased matches against candidate patterns. + interface Segment { + // Information about the entire piece of text between the dots. For example, if the + // text between the dots is 'GetKeyword', then TotalTextChunk.Text will be 'GetKeyword' and + // TotalTextChunk.CharacterSpans will correspond to 'Get', 'Keyword'. + totalTextChunk: TextChunk; + + // Information about the subwords compromising the total word. For example, if the + // text between the dots is 'GetFoo KeywordBar', then the subwords will be 'GetFoo' + // and 'KeywordBar'. Those individual words will have CharacterSpans of ('Get' and + // 'Foo') and('Keyword' and 'Bar') respectively. + subWordTextChunks: TextChunk[]; + } + + // Information about a chunk of text from the pattern. The chunk is a piece of text, with + // cached information about the character spans within in. Character spans are used for + // camel case matching. + interface TextChunk { + // The text of the chunk. This should be a contiguous sequence of character that could + // occur in a symbol name. + text: string; + + // The text of a chunk in lower case. Cached because it is needed often to check for + // case insensitive matches. + textLowerCase: string; + + // Whether or not this chunk is entirely lowercase. We have different rules when searching + // for something entirely lowercase or not. + isLowerCase: boolean; + + // The spans in this text chunk that we think are of interest and should be matched + // independently. For example, if the chunk is for "UIElement" the the spans of interest + // correspond to "U", "I" and "Element". If "UIElement" isn't found as an exaxt, prefix. + // or substring match, then the character spans will be used to attempt a camel case match. + characterSpans: TextSpan[]; + } + + function createPatternMatch(kind: PatternMatchKind, punctuationStripped: boolean, isCaseSensitive: boolean, camelCaseWeight?: number): PatternMatch { + return { + kind, + punctuationStripped, + isCaseSensitive, + camelCaseWeight + }; + } + + export function createPatternMatcher(pattern: string): PatternMatcher { + // We'll often see the same candidate string many times when searching (For example, when + // we see the name of a module that is used everywhere, or the name of an overload). As + // such, we cache the information we compute about the candidate for the life of this + // pattern matcher so we don't have to compute it multiple times. + var stringToWordSpans: Map = {}; + + pattern = pattern.trim(); + + var fullPatternSegment = createSegment(pattern); + var dotSeparatedSegments = pattern.split(".").map(p => createSegment(p.trim())); + var invalidPattern = dotSeparatedSegments.length === 0 || forEach(dotSeparatedSegments, segmentIsInvalid); + + return { + getMatches, + getMatchesForLastSegmentOfPattern, + patternContainsDots: dotSeparatedSegments.length > 1 + }; + + // Quick checks so we can bail out when asked to match a candidate. + function skipMatch(candidate: string) { + return invalidPattern || !candidate; + } + + function getMatchesForLastSegmentOfPattern(candidate: string): PatternMatch[] { + if (skipMatch(candidate)) { + return undefined; + } + + return matchSegment(candidate, lastOrUndefined(dotSeparatedSegments)); + } + + function getMatches(candidate: string, dottedContainer: string): PatternMatch[] { + if (skipMatch(candidate)) { + return undefined; + } + + // First, check that the last part of the dot separated pattern matches the name of the + // candidate. If not, then there's no point in proceeding and doing the more + // expensive work. + var candidateMatch = matchSegment(candidate, lastOrUndefined(dotSeparatedSegments)); + if (!candidateMatch) { + return undefined; + } + + dottedContainer = dottedContainer || ""; + var containerParts = dottedContainer.split("."); + + // -1 because the last part was checked against the name, and only the rest + // of the parts are checked against the container. + if (dotSeparatedSegments.length - 1 > containerParts.length) { + // There weren't enough container parts to match against the pattern parts. + // So this definitely doesn't match. + return null; + } + + // So far so good. Now break up the container for the candidate and check if all + // the dotted parts match up correctly. + var totalMatch = candidateMatch; + + for (var i = dotSeparatedSegments.length - 2, j = containerParts.length - 1; + i >= 0; + i--, j--) { + + var segment = dotSeparatedSegments[i]; + var containerName = containerParts[j]; + + var containerMatch = matchSegment(containerName, segment); + if (!containerMatch) { + // This container didn't match the pattern piece. So there's no match at all. + return undefined; + } + + addRange(totalMatch, containerMatch); + } + + // Success, this symbol's full name matched against the dotted name the user was asking + // about. + return totalMatch; + } + + function getWordSpans(word: string): TextSpan[] { + if (!hasProperty(stringToWordSpans, word)) { + stringToWordSpans[word] = breakIntoWordSpans(word); + } + + return stringToWordSpans[word]; + } + + function matchTextChunk(candidate: string, chunk: TextChunk, punctuationStripped: boolean): PatternMatch { + var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); + if (index === 0) { + if (chunk.text.length === candidate.length) { + // a) Check if the part matches the candidate entirely, in an case insensitive or + // sensitive manner. If it does, return that there was an exact match. + return createPatternMatch(PatternMatchKind.Exact, punctuationStripped, /*isCaseSensitive:*/ candidate === chunk.text); + } + else { + // b) Check if the part is a prefix of the candidate, in a case insensitive or sensitive + // manner. If it does, return that there was a prefix match. + return createPatternMatch(PatternMatchKind.Prefix, punctuationStripped, /*isCaseSensitive:*/ startsWith(candidate, chunk.text)); + } + } + + var isLowercase = chunk.isLowerCase; + if (isLowercase) { + if (index > 0) { + // c) If the part is entirely lowercase, then check if it is contained anywhere in the + // candidate in a case insensitive manner. If so, return that there was a substring + // match. + // + // Note: We only have a substring match if the lowercase part is prefix match of some + // word part. That way we don't match something like 'Class' when the user types 'a'. + // But we would match 'FooAttribute' (since 'Attribute' starts with 'a'). + var wordSpans = getWordSpans(candidate); + for (var i = 0, n = wordSpans.length; i < n; i++) { + var span = wordSpans[i] + if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { + return createPatternMatch(PatternMatchKind.Substring, punctuationStripped, + /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false)); + } + } + } + } + else { + // d) If the part was not entirely lowercase, then check if it is contained in the + // candidate in a case *sensitive* manner. If so, return that there was a substring + // match. + if (candidate.indexOf(chunk.text) > 0) { + return createPatternMatch(PatternMatchKind.Substring, punctuationStripped, /*isCaseSensitive:*/ true); + } + } + + if (!isLowercase) { + // e) If the part was not entirely lowercase, then attempt a camel cased match as well. + if (chunk.characterSpans.length > 0) { + var candidateParts = getWordSpans(candidate); + var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ false); + if (camelCaseWeight !== undefined) { + return createPatternMatch(PatternMatchKind.CamelCase, punctuationStripped, /*isCaseSensitive:*/ true, /*camelCaseWeight:*/ camelCaseWeight); + } + + camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ true); + if (camelCaseWeight !== undefined) { + return createPatternMatch(PatternMatchKind.CamelCase, punctuationStripped, /*isCaseSensitive:*/ false, /*camelCaseWeight:*/ camelCaseWeight); + } + } + } + + if (isLowercase) { + // f) Is the pattern a substring of the candidate starting on one of the candidate's word boundaries? + + // We could check every character boundary start of the candidate for the pattern. However, that's + // an m * n operation in the wost case. Instead, find the first instance of the pattern + // substring, and see if it starts on a capital letter. It seems unlikely that the user will try to + // filter the list based on a substring that starts on a capital letter and also with a lowercase one. + // (Pattern: fogbar, Candidate: quuxfogbarFogBar). + if (chunk.text.length < candidate.length) { + if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) { + return createPatternMatch(PatternMatchKind.Substring, punctuationStripped, /*isCaseSensitive:*/ false); + } + } + } + + return undefined; + } + + function containsSpaceOrAsterisk(text: string): boolean { + for (var i = 0; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (ch === CharacterCodes.space || ch === CharacterCodes.asterisk) { + return true; + } + } + + return false; + } + + function matchSegment(candidate: string, segment: Segment): PatternMatch[] { + // First check if the segment matches as is. This is also useful if the segment contains + // characters we would normally strip when splitting into parts that we also may want to + // match in the candidate. For example if the segment is "@int" and the candidate is + // "@int", then that will show up as an exact match here. + // + // Note: if the segment contains a space or an asterisk then we must assume that it's a + // multi-word segment. + if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { + var match = matchTextChunk(candidate, segment.totalTextChunk, /*punctuationStripped:*/ false); + if (match) { + return [match]; + } + } + + // The logic for pattern matching is now as follows: + // + // 1) Break the segment passed in into words. Breaking is rather simple and a + // good way to think about it that if gives you all the individual alphanumeric words + // of the pattern. + // + // 2) For each word try to match the word against the candidate value. + // + // 3) Matching is as follows: + // + // a) Check if the word matches the candidate entirely, in an case insensitive or + // sensitive manner. If it does, return that there was an exact match. + // + // b) Check if the word is a prefix of the candidate, in a case insensitive or + // sensitive manner. If it does, return that there was a prefix match. + // + // c) If the word is entirely lowercase, then check if it is contained anywhere in the + // candidate in a case insensitive manner. If so, return that there was a substring + // match. + // + // Note: We only have a substring match if the lowercase part is prefix match of + // some word part. That way we don't match something like 'Class' when the user + // types 'a'. But we would match 'FooAttribute' (since 'Attribute' starts with + // 'a'). + // + // d) If the word was not entirely lowercase, then check if it is contained in the + // candidate in a case *sensitive* manner. If so, return that there was a substring + // match. + // + // e) If the word was not entirely lowercase, then attempt a camel cased match as + // well. + // + // f) The word is all lower case. Is it a case insensitive substring of the candidate starting + // on a part boundary of the candidate? + // + // Only if all words have some sort of match is the pattern considered matched. + + var subWordTextChunks = segment.subWordTextChunks; + var matches: PatternMatch[] = undefined; + + for (var i = 0, n = subWordTextChunks.length; i < n; i++) { + var subWordTextChunk = subWordTextChunks[i]; + + // Try to match the candidate with this word + var result = matchTextChunk(candidate, subWordTextChunk, /*punctuationStripped:*/ true); + if (!result) { + return undefined; + } + + matches = matches || []; + matches.push(result); + } + + return matches; + } + + function partStartsWith(candidate: string, candidateSpan: TextSpan, pattern: string, ignoreCase: boolean, patternSpan?: TextSpan): boolean { + var patternPartStart = patternSpan ? patternSpan.start : 0; + var patternPartLength = patternSpan ? patternSpan.length : pattern.length; + + if (patternPartLength > candidateSpan.length) { + // Pattern part is longer than the candidate part. There can never be a match. + return false; + } + + if (ignoreCase) { + for (var i = 0; i < patternPartLength; i++) { + var ch1 = pattern.charCodeAt(patternPartStart + i); + var ch2 = candidate.charCodeAt(candidateSpan.start + i); + if (toLowerCase(ch1) !== toLowerCase(ch2)) { + return false; + } + } + } + else { + for (var i = 0; i < patternPartLength; i++) { + var ch1 = pattern.charCodeAt(patternPartStart + i); + var ch2 = candidate.charCodeAt(candidateSpan.start + i); + if (ch1 !== ch2) { + return false; + } + } + } + + return true; + } + + function tryCamelCaseMatch(candidate: string, candidateParts: TextSpan[], chunk: TextChunk, ignoreCase: boolean): number { + var chunkCharacterSpans = chunk.characterSpans; + + // Note: we may have more pattern parts than candidate parts. This is because multiple + // pattern parts may match a candidate part. For example "SiUI" against "SimpleUI". + // We'll have 3 pattern parts Si/U/I against two candidate parts Simple/UI. However, U + // and I will both match in UI. + + var currentCandidate = 0; + var currentChunkSpan = 0; + var firstMatch: number = undefined; + var contiguous: boolean = undefined; + + while (true) { + // Let's consider our termination cases + if (currentChunkSpan === chunkCharacterSpans.length) { + // We did match! We shall assign a weight to this + var weight = 0; + + // Was this contiguous? + if (contiguous) { + weight += 1; + } + + // Did we start at the beginning of the candidate? + if (firstMatch === 0) { + weight += 2; + } + + return weight; + } + else if (currentCandidate === candidateParts.length) { + // No match, since we still have more of the pattern to hit + return undefined; + } + + var candidatePart = candidateParts[currentCandidate]; + var gotOneMatchThisCandidate = false; + + // Consider the case of matching SiUI against SimpleUIElement. The candidate parts + // will be Simple/UI/Element, and the pattern parts will be Si/U/I. We'll match 'Si' + // against 'Simple' first. Then we'll match 'U' against 'UI'. However, we want to + // still keep matching pattern parts against that candidate part. + for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { + var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; + + if (gotOneMatchThisCandidate) { + // We've already gotten one pattern part match in this candidate. We will + // only continue trying to consumer pattern parts if the last part and this + // part are both upper case. + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || + !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + break; + } + } + + if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) { + break; + } + + gotOneMatchThisCandidate = true; + + firstMatch = firstMatch === undefined ? currentCandidate : firstMatch; + + // If we were contiguous, then keep that value. If we weren't, then keep that + // value. If we don't know, then set the value to 'true' as an initial match is + // obviously contiguous. + contiguous = contiguous === undefined ? true : contiguous; + + candidatePart = createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length); + } + + // Check if we matched anything at all. If we didn't, then we need to unset the + // contiguous bit if we currently had it set. + // If we haven't set the bit yet, then that means we haven't matched anything so + // far, and we don't want to change that. + if (!gotOneMatchThisCandidate && contiguous !== undefined) { + contiguous = false; + } + + // Move onto the next candidate. + currentCandidate++; + } + } + } + + // Helper function to compare two matches to determine which is better. Matches are first + // ordered by kind (so all prefix matches always beat all substring matches). Then, if the + // match is a camel case match, the relative weights of hte match are used to determine + // which is better (with a greater weight being better). Then if the match is of the same + // type, then a case sensitive match is considered better than an insensitive one. + function patternMatchCompareTo(match1: PatternMatch, match2: PatternMatch): number { + return compareType(match1, match2) || + compareCamelCase(match1, match2) || + compareCase(match1, match2) || + comparePunctuation(match1, match2); + } + + function comparePunctuation(result1: PatternMatch, result2: PatternMatch) { + // Consider a match to be better if it was successful without stripping punctuation + // versus a match that had to strip punctuation to succeed. + if (result1.punctuationStripped !== result2.punctuationStripped) { + return result1.punctuationStripped ? 1 : -1; + } + + return 0; + } + + function compareCase(result1: PatternMatch, result2: PatternMatch) { + if (result1.isCaseSensitive !== result2.isCaseSensitive) { + return result1.isCaseSensitive ? -1 : 1; + } + + return 0; + } + + function compareType(result1: PatternMatch, result2: PatternMatch) { + return result1.kind - result2.kind; + } + + function compareCamelCase(result1: PatternMatch, result2: PatternMatch) { + if (result1.kind === PatternMatchKind.CamelCase && result2.kind === PatternMatchKind.CamelCase) { + // Swap the values here. If result1 has a higher weight, then we want it to come + // first. + return result2.camelCaseWeight - result1.camelCaseWeight; + } + + return 0; + } + + function createSegment(text: string): Segment { + return { + totalTextChunk: createTextChunk(text), + subWordTextChunks: breakPatternIntoTextChunks(text) + } + } + + // A segment is considered invalid if we couldn't find any words in it. + function segmentIsInvalid(segment: Segment) { + return segment.subWordTextChunks.length === 0; + } + + function isUpperCaseLetter(ch: number) { + // Fast check for the ascii range. + if (ch >= CharacterCodes.A && ch <= CharacterCodes.Z) { + return true; + } + + if (ch < CharacterCodes.maxAsciiCharacter || !isUnicodeIdentifierStart(ch, ScriptTarget.Latest)) { + return false; + } + + // TODO: find a way to determine this for any unicode characters in a + // non-allocating manner. + var str = String.fromCharCode(ch); + return str === str.toUpperCase(); + } + + function isLowerCaseLetter(ch: number) { + // Fast check for the ascii range. + if (ch >= CharacterCodes.a && ch <= CharacterCodes.z) { + return true; + } + + if (ch < CharacterCodes.maxAsciiCharacter || !isUnicodeIdentifierStart(ch, ScriptTarget.Latest)) { + return false; + } + + + // TODO: find a way to determine this for any unicode characters in a + // non-allocating manner. + var str = String.fromCharCode(ch); + return str === str.toLowerCase(); + } + + function containsUpperCaseLetter(string: string): boolean { + for (var i = 0, n = string.length; i < n; i++) { + if (isUpperCaseLetter(string.charCodeAt(i))) { + return true; + } + } + + return false; + } + + function startsWith(string: string, search: string) { + for (var i = 0, n = search.length; i < n; i++) { + if (string.charCodeAt(i) !== search.charCodeAt(i)) { + return false; + } + } + + return true; + } + + // Assumes 'value' is already lowercase. + function indexOfIgnoringCase(string: string, value: string): number { + for (var i = 0, n = string.length - value.length; i <= n; i++) { + if (startsWithIgnoringCase(string, value, i)) { + return i; + } + } + + return -1; + } + + // Assumes 'value' is already lowercase. + function startsWithIgnoringCase(string: string, value: string, start: number): boolean { + for (var i = 0, n = value.length; i < n; i++) { + var ch1 = toLowerCase(string.charCodeAt(i + start)); + var ch2 = value.charCodeAt(i); + + if (ch1 !== ch2) { + return false; + } + } + + return true; + } + + function toLowerCase(ch: number): number { + // Fast convert for the ascii range. + if (ch >= CharacterCodes.A && ch <= CharacterCodes.Z) { + return CharacterCodes.a + (ch - CharacterCodes.A); + } + + if (ch < CharacterCodes.maxAsciiCharacter) { + return ch; + } + + // TODO: find a way to compute this for any unicode characters in a + // non-allocating manner. + return String.fromCharCode(ch).toLowerCase().charCodeAt(0); + } + + function isDigit(ch: number) { + // TODO(cyrusn): Find a way to support this for unicode digits. + return ch >= CharacterCodes._0 && ch <= CharacterCodes._9; + } + + function isWordChar(ch: number) { + return isUpperCaseLetter(ch) || isLowerCaseLetter(ch) || isDigit(ch) || ch === CharacterCodes._ || ch === CharacterCodes.$; + } + + function breakPatternIntoTextChunks(pattern: string): TextChunk[] { + var result: TextChunk[] = []; + var wordStart = 0; + var wordLength = 0; + + for (var i = 0; i < pattern.length; i++) { + var ch = pattern.charCodeAt(i); + if (isWordChar(ch)) { + if (wordLength++ === 0) { + wordStart = i; + } + } + else { + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + wordLength = 0; + } + } + } + + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + } + + return result; + } + + function createTextChunk(text: string): TextChunk { + var textLowerCase = text.toLowerCase(); + return { + text, + textLowerCase, + isLowerCase: text === textLowerCase, + characterSpans: breakIntoCharacterSpans(text) + } + } + + /* @internal */ export function breakIntoCharacterSpans(identifier: string): TextSpan[] { + return breakIntoSpans(identifier, /*word:*/ false); + } + + /* @internal */ export function breakIntoWordSpans(identifier: string): TextSpan[] { + return breakIntoSpans(identifier, /*word:*/ true); + } + + function breakIntoSpans(identifier: string, word: boolean): TextSpan[] { + var result: TextSpan[] = []; + + var wordStart = 0; + for (var i = 1, n = identifier.length; i < n; i++) { + var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); + var currentIsDigit = isDigit(identifier.charCodeAt(i)); + + var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); + var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); + + if (charIsPunctuation(identifier.charCodeAt(i - 1)) || + charIsPunctuation(identifier.charCodeAt(i)) || + lastIsDigit != currentIsDigit || + hasTransitionFromLowerToUpper || + hasTransitionFromUpperToLower) { + + if (!isAllPunctuation(identifier, wordStart, i)) { + result.push(createTextSpan(wordStart, i - wordStart)); + } + + wordStart = i; + } + } + + if (!isAllPunctuation(identifier, wordStart, identifier.length)) { + result.push(createTextSpan(wordStart, identifier.length - wordStart)); + } + + return result; + } + + function charIsPunctuation(ch: number) { + switch (ch) { + case CharacterCodes.exclamation: + case CharacterCodes.doubleQuote: + case CharacterCodes.hash: + case CharacterCodes.percent: + case CharacterCodes.ampersand: + case CharacterCodes.singleQuote: + case CharacterCodes.openParen: + case CharacterCodes.closeParen: + case CharacterCodes.asterisk: + case CharacterCodes.comma: + case CharacterCodes.minus: + case CharacterCodes.dot: + case CharacterCodes.slash: + case CharacterCodes.colon: + case CharacterCodes.semicolon: + case CharacterCodes.question: + case CharacterCodes.at: + case CharacterCodes.openBracket: + case CharacterCodes.backslash: + case CharacterCodes.closeBracket: + case CharacterCodes._: + case CharacterCodes.openBrace: + case CharacterCodes.closeBrace: + return true; + } + + return false; + } + + function isAllPunctuation(identifier: string, start: number, end: number): boolean { + for (var i = start; i < end; i++) { + var ch = identifier.charCodeAt(i); + + // We don't consider _ or $ as punctuation as there may be things with that name. + if (!charIsPunctuation(ch) || ch === CharacterCodes._ || ch === CharacterCodes.$) { + return false; + } + } + + return true; + } + + function transitionFromUpperToLower(identifier: string, word: boolean, index: number, wordStart: number): boolean { + if (word) { + // Cases this supports: + // 1) IDisposable -> I, Disposable + // 2) UIElement -> UI, Element + // 3) HTMLDocument -> HTML, Document + // + // etc. + if (index != wordStart && + index + 1 < identifier.length) { + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); + + if (currentIsUpper && nextIsLower) { + // We have a transition from an upper to a lower letter here. But we only + // want to break if all the letters that preceded are uppercase. i.e. if we + // have "Foo" we don't want to break that into "F, oo". But if we have + // "IFoo" or "UIFoo", then we want to break that into "I, Foo" and "UI, + // Foo". i.e. the last uppercase letter belongs to the lowercase letters + // that follows. Note: this will make the following not split properly: + // "HELLOthere". However, these sorts of names do not show up in .Net + // programs. + for (var i = wordStart; i < index; i++) { + if (!isUpperCaseLetter(identifier.charCodeAt(i))) { + return false; + } + } + + return true; + } + } + } + + return false; + } + + function transitionFromLowerToUpper(identifier: string, word: boolean, index: number): boolean { + var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + + // See if the casing indicates we're starting a new word. Note: if we're breaking on + // words, then just seeing an upper case character isn't enough. Instead, it has to + // be uppercase and the previous character can't be uppercase. + // + // For example, breaking "AddMetadata" on words would make: Add Metadata + // + // on characters would be: A dd M etadata + // + // Break "AM" on words would be: AM + // + // on characters would be: A M + // + // We break the search string on characters. But we break the symbol name on words. + var transition = word + ? (currentIsUpper && !lastIsUpper) + : currentIsUpper; + return transition; + } +} \ No newline at end of file diff --git a/src/services/services.ts b/src/services/services.ts index 6f7eefc49eb..e3d8923890b 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2,14 +2,15 @@ /// /// +/// /// +/// /// /// /// /// module ts { - export var servicesVersion = "0.4" export interface Node { @@ -61,9 +62,9 @@ module ts { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } @@ -612,7 +613,7 @@ module ts { } if (paramHelpStringMargin === undefined) { - paramHelpStringMargin = sourceFile.getLineAndCharacterFromPosition(firstLineParamHelpStringPos).character - 1; + paramHelpStringMargin = sourceFile.getLineAndCharacterOfPosition(firstLineParamHelpStringPos).character; } // Now consume white spaces max @@ -750,16 +751,16 @@ module ts { return updateSourceFile(this, newText, textChangeRange); } - public getLineAndCharacterFromPosition(position: number): LineAndCharacter { - return getLineAndCharacterOfPosition(this, position); + public getLineAndCharacterOfPosition(position: number): LineAndCharacter { + return ts.getLineAndCharacterOfPosition(this, position); } public getLineStarts(): number[] { return getLineStarts(this); } - public getPositionFromLineAndCharacter(line: number, character: number): number { - return getPositionFromLineAndCharacter(this, line, character); + public getPositionOfLineAndCharacter(line: number, character: number): number { + return ts.getPositionOfLineAndCharacter(this, line, character); } public getNamedDeclarations() { @@ -800,7 +801,7 @@ module ts { case SyntaxKind.TypeAliasDeclaration: case SyntaxKind.EnumDeclaration: case SyntaxKind.ModuleDeclaration: - case SyntaxKind.ImportDeclaration: + case SyntaxKind.ImportEqualsDeclaration: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: case SyntaxKind.TypeLiteral: @@ -900,7 +901,7 @@ module ts { getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; @@ -1378,13 +1379,6 @@ module ts { public static typeAlias = "type alias name"; } - enum MatchKind { - none = 0, - exact = 1, - substring = 2, - prefix = 3 - } - /// Language Service interface CompletionSession { @@ -1558,78 +1552,49 @@ module ts { var file = this.getEntry(fileName); return file && file.scriptSnapshot; } - - public getChangeRange(fileName: string, lastKnownVersion: string, oldScriptSnapshot: IScriptSnapshot): TextChangeRange { - var currentVersion = this.getVersion(fileName); - if (lastKnownVersion === currentVersion) { - return unchangedTextChangeRange; // "No changes" - } - - var scriptSnapshot = this.getScriptSnapshot(fileName); - return scriptSnapshot.getChangeRange(oldScriptSnapshot); - } } class SyntaxTreeCache { - private hostCache: HostCache; - // For our syntactic only features, we also keep a cache of the syntax tree for the // currently edited file. - private currentFileName: string = ""; - private currentFileVersion: string = null; - private currentSourceFile: SourceFile = null; + private currentFileName: string; + private currentFileVersion: string; + private currentFileScriptSnapshot: IScriptSnapshot; + private currentSourceFile: SourceFile; constructor(private host: LanguageServiceHost) { } - private log(message: string) { - if (this.host.log) { - this.host.log(message); + public getCurrentSourceFile(fileName: string): SourceFile { + var scriptSnapshot = this.host.getScriptSnapshot(fileName); + if (!scriptSnapshot) { + // The host does not know about this file. + throw new Error("Could not find file: '" + fileName + "'."); } - } - private initialize(fileName: string) { - // ensure that both source file and syntax tree are either initialized or not initialized - var start = new Date().getTime(); - this.hostCache = new HostCache(this.host); - this.log("SyntaxTreeCache.Initialize: new HostCache: " + (new Date().getTime() - start)); - - var version = this.hostCache.getVersion(fileName); + var version = this.host.getScriptVersion(fileName); var sourceFile: SourceFile; if (this.currentFileName !== fileName) { - var scriptSnapshot = this.hostCache.getScriptSnapshot(fileName); - - var start = new Date().getTime(); + // This is a new file, just parse it sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, ScriptTarget.Latest, version, /*setNodeParents:*/ true); - this.log("SyntaxTreeCache.Initialize: createSourceFile: " + (new Date().getTime() - start)); } else if (this.currentFileVersion !== version) { - var scriptSnapshot = this.hostCache.getScriptSnapshot(fileName); - - var editRange = this.hostCache.getChangeRange(fileName, this.currentFileVersion, this.currentSourceFile.scriptSnapshot); - - var start = new Date().getTime(); + // This is the same file, just a newer version. Incrementally parse the file. + var editRange = scriptSnapshot.getChangeRange(this.currentFileScriptSnapshot); sourceFile = updateLanguageServiceSourceFile(this.currentSourceFile, scriptSnapshot, version, editRange); - this.log("SyntaxTreeCache.Initialize: updateSourceFile: " + (new Date().getTime() - start)); } if (sourceFile) { // All done, ensure state is up to date this.currentFileVersion = version; this.currentFileName = fileName; + this.currentFileScriptSnapshot = scriptSnapshot; this.currentSourceFile = sourceFile; } - } - public getCurrentSourceFile(fileName: string): SourceFile { - this.initialize(fileName); return this.currentSourceFile; } - - public getCurrentScriptSnapshot(fileName: string): IScriptSnapshot { - return this.getCurrentSourceFile(fileName).scriptSnapshot; - } } function setSourceFileFields(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string) { @@ -1930,7 +1895,7 @@ module ts { function isNameOfExternalModuleImportOrDeclaration(node: Node): boolean { if (node.kind === SyntaxKind.StringLiteral) { return isNameOfModuleDeclaration(node) || - (isExternalModuleImportDeclaration(node.parent.parent) && getExternalModuleImportDeclarationExpression(node.parent.parent) === node); + (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node); } return false; @@ -1992,6 +1957,62 @@ module ts { }); } + /* @internal */ export function getContainerNode(node: Node): Node { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case SyntaxKind.SourceFile: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.ClassDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.ModuleDeclaration: + return node; + } + } + } + + /* @internal */ export function getNodeKind(node: Node): string { + switch (node.kind) { + case SyntaxKind.ModuleDeclaration: return ScriptElementKind.moduleElement; + case SyntaxKind.ClassDeclaration: return ScriptElementKind.classElement; + case SyntaxKind.InterfaceDeclaration: return ScriptElementKind.interfaceElement; + case SyntaxKind.TypeAliasDeclaration: return ScriptElementKind.typeElement; + case SyntaxKind.EnumDeclaration: return ScriptElementKind.enumElement; + case SyntaxKind.VariableDeclaration: + return isConst(node) + ? ScriptElementKind.constElement + : isLet(node) + ? ScriptElementKind.letElement + : ScriptElementKind.variableElement; + case SyntaxKind.FunctionDeclaration: return ScriptElementKind.functionElement; + case SyntaxKind.GetAccessor: return ScriptElementKind.memberGetAccessorElement; + case SyntaxKind.SetAccessor: return ScriptElementKind.memberSetAccessorElement; + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + return ScriptElementKind.memberFunctionElement; + case SyntaxKind.PropertyDeclaration: + case SyntaxKind.PropertySignature: + return ScriptElementKind.memberVariableElement; + case SyntaxKind.IndexSignature: return ScriptElementKind.indexSignatureElement; + case SyntaxKind.ConstructSignature: return ScriptElementKind.constructSignatureElement; + case SyntaxKind.CallSignature: return ScriptElementKind.callSignatureElement; + case SyntaxKind.Constructor: return ScriptElementKind.constructorImplementationElement; + case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement; + case SyntaxKind.EnumMember: return ScriptElementKind.variableElement; + case SyntaxKind.Parameter: return (node.flags & NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + } + return ScriptElementKind.unknown; + } + export function createLanguageService(host: LanguageServiceHost, documentRegistry: DocumentRegistry = createDocumentRegistry()): LanguageService { var syntaxTreeCache: SyntaxTreeCache = new SyntaxTreeCache(host); var ruleProvider: formatting.RulesProvider; @@ -2019,6 +2040,7 @@ module ts { } function getValidSourceFile(fileName: string): SourceFile { + fileName = normalizeSlashes(fileName); var sourceFile = program.getSourceFile(getCanonicalFileName(fileName)); if (!sourceFile) { throw new Error("Could not find file: '" + fileName + "'."); @@ -2107,7 +2129,7 @@ module ts { } // We have an older version of the sourceFile, incrementally parse the changes - var textChangeRange = hostCache.getChangeRange(fileName, oldSourceFile.version, oldSourceFile.scriptSnapshot); + var textChangeRange = hostFileInformation.scriptSnapshot.getChangeRange(oldSourceFile.scriptSnapshot); return documentRegistry.updateDocument(oldSourceFile, fileName, newSettings, hostFileInformation.scriptSnapshot, hostFileInformation.version, textChangeRange); } } @@ -2172,8 +2194,6 @@ module ts { function getSyntacticDiagnostics(fileName: string) { synchronizeHostData(); - fileName = normalizeSlashes(fileName); - return program.getSyntacticDiagnostics(getValidSourceFile(fileName)); } @@ -2184,7 +2204,6 @@ module ts { function getSemanticDiagnostics(fileName: string) { synchronizeHostData(); - fileName = normalizeSlashes(fileName) var targetSourceFile = getValidSourceFile(fileName); // Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file. @@ -2261,8 +2280,6 @@ module ts { function getCompletionsAtPosition(fileName: string, position: number) { synchronizeHostData(); - fileName = normalizeSlashes(fileName); - var syntacticStart = new Date().getTime(); var sourceFile = getValidSourceFile(fileName); @@ -2681,8 +2698,6 @@ module ts { function getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails { // Note: No need to call synchronizeHostData, as we have captured all the data we need // in the getCompletionsAtPosition earlier - fileName = normalizeSlashes(fileName); - var sourceFile = getValidSourceFile(fileName); var session = activeCompletionSession; @@ -2722,29 +2737,6 @@ module ts { } } - function getContainerNode(node: Node): Node { - while (true) { - node = node.parent; - if (!node) { - return undefined; - } - switch (node.kind) { - case SyntaxKind.SourceFile: - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.FunctionExpression: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.ClassDeclaration: - case SyntaxKind.InterfaceDeclaration: - case SyntaxKind.EnumDeclaration: - case SyntaxKind.ModuleDeclaration: - return node; - } - } - } - // TODO(drosen): use contextual SemanticMeaning. function getSymbolKind(symbol: Symbol, typeResolver: TypeChecker, location: Node): string { var flags = symbol.getFlags(); @@ -2831,39 +2823,6 @@ module ts { return ScriptElementKind.unknown; } - function getNodeKind(node: Node): string { - switch (node.kind) { - case SyntaxKind.ModuleDeclaration: return ScriptElementKind.moduleElement; - case SyntaxKind.ClassDeclaration: return ScriptElementKind.classElement; - case SyntaxKind.InterfaceDeclaration: return ScriptElementKind.interfaceElement; - case SyntaxKind.TypeAliasDeclaration: return ScriptElementKind.typeElement; - case SyntaxKind.EnumDeclaration: return ScriptElementKind.enumElement; - case SyntaxKind.VariableDeclaration: - return isConst(node) - ? ScriptElementKind.constElement - : isLet(node) - ? ScriptElementKind.letElement - : ScriptElementKind.variableElement; - case SyntaxKind.FunctionDeclaration: return ScriptElementKind.functionElement; - case SyntaxKind.GetAccessor: return ScriptElementKind.memberGetAccessorElement; - case SyntaxKind.SetAccessor: return ScriptElementKind.memberSetAccessorElement; - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: - return ScriptElementKind.memberFunctionElement; - case SyntaxKind.PropertyDeclaration: - case SyntaxKind.PropertySignature: - return ScriptElementKind.memberVariableElement; - case SyntaxKind.IndexSignature: return ScriptElementKind.indexSignatureElement; - case SyntaxKind.ConstructSignature: return ScriptElementKind.constructSignatureElement; - case SyntaxKind.CallSignature: return ScriptElementKind.callSignatureElement; - case SyntaxKind.Constructor: return ScriptElementKind.constructorImplementationElement; - case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement; - case SyntaxKind.EnumMember: return ScriptElementKind.variableElement; - case SyntaxKind.Parameter: return (node.flags & NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - } - return ScriptElementKind.unknown; - } - function getSymbolModifiers(symbol: Symbol): string { return symbol && symbol.declarations && symbol.declarations.length > 0 ? getNodeModifiers(symbol.declarations[0]) @@ -3086,19 +3045,19 @@ module ts { displayParts.push(spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, declaration => { - if (declaration.kind === SyntaxKind.ImportDeclaration) { - var importDeclaration = declaration; - if (isExternalModuleImportDeclaration(importDeclaration)) { + if (declaration.kind === SyntaxKind.ImportEqualsDeclaration) { + var importEqualsDeclaration = declaration; + if (isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(spacePart()); displayParts.push(operatorPart(SyntaxKind.EqualsToken)); displayParts.push(spacePart()); displayParts.push(keywordPart(SyntaxKind.RequireKeyword)); displayParts.push(punctuationPart(SyntaxKind.OpenParenToken)); - displayParts.push(displayPart(getTextOfNode(getExternalModuleImportDeclarationExpression(importDeclaration)), SymbolDisplayPartKind.stringLiteral)); + displayParts.push(displayPart(getTextOfNode(getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), SymbolDisplayPartKind.stringLiteral)); displayParts.push(punctuationPart(SyntaxKind.CloseParenToken)); } else { - var internalAliasSymbol = typeResolver.getSymbolAtLocation(importDeclaration.moduleReference); + var internalAliasSymbol = typeResolver.getSymbolAtLocation(importEqualsDeclaration.moduleReference); if (internalAliasSymbol) { displayParts.push(spacePart()); displayParts.push(operatorPart(SyntaxKind.EqualsToken)); @@ -3201,7 +3160,6 @@ module ts { function getQuickInfoAtPosition(fileName: string, position: number): QuickInfo { synchronizeHostData(); - fileName = normalizeSlashes(fileName); var sourceFile = getValidSourceFile(fileName); var node = getTouchingPropertyName(sourceFile, position); if (!node) { @@ -3247,7 +3205,6 @@ module ts { function getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] { synchronizeHostData(); - fileName = normalizeSlashes(fileName); var sourceFile = getValidSourceFile(fileName); var node = getTouchingPropertyName(sourceFile, position); @@ -3383,7 +3340,6 @@ module ts { function getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] { synchronizeHostData(); - fileName = normalizeSlashes(fileName); var sourceFile = getValidSourceFile(fileName); var node = getTouchingWord(sourceFile, position); @@ -3932,7 +3888,6 @@ module ts { function findReferences(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): ReferenceEntry[] { synchronizeHostData(); - fileName = normalizeSlashes(fileName); var sourceFile = getValidSourceFile(fileName); var node = getTouchingPropertyName(sourceFile, position); @@ -4654,7 +4609,7 @@ module ts { return true; } else if (parent.kind === SyntaxKind.BinaryExpression && (parent).left === node) { - var operator = (parent).operator; + var operator = (parent).operatorToken.kind; return SyntaxKind.FirstAssignment <= operator && operator <= SyntaxKind.LastAssignment; } } @@ -4663,89 +4618,10 @@ module ts { } /// NavigateTo - function getNavigateToItems(searchValue: string): NavigateToItem[] { + function getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[] { synchronizeHostData(); - // Split search value in terms array - var terms = searchValue.split(" "); - - // default NavigateTo approach: if search term contains only lower-case chars - use case-insensitive search, otherwise switch to case-sensitive version - var searchTerms = map(terms, t => ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t })); - - var items: NavigateToItem[] = []; - - // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] - forEach(program.getSourceFiles(), sourceFile => { - cancellationToken.throwIfCancellationRequested(); - - var fileName = sourceFile.fileName; - var declarations = sourceFile.getNamedDeclarations(); - for (var i = 0, n = declarations.length; i < n; i++) { - var declaration = declarations[i]; - // TODO(jfreeman): Skip this declaration if it has a computed name - var name = (declaration.name).text; - var matchKind = getMatchKind(searchTerms, name); - if (matchKind !== MatchKind.none) { - var container = getContainerNode(declaration); - items.push({ - name: name, - kind: getNodeKind(declaration), - kindModifiers: getNodeModifiers(declaration), - matchKind: MatchKind[matchKind], - fileName: fileName, - textSpan: createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), - // TODO(jfreeman): What should be the containerName when the container has a computed name? - containerName: container && container.name ? (container.name).text : "", - containerKind: container && container.name ? getNodeKind(container) : "" - }); - } - } - }); - - return items; - - function hasAnyUpperCaseCharacter(s: string): boolean { - for (var i = 0, n = s.length; i < n; i++) { - var c = s.charCodeAt(i); - if ((CharacterCodes.A <= c && c <= CharacterCodes.Z) || - (c >= CharacterCodes.maxAsciiCharacter && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) { - return true; - } - } - - return false; - } - - function getMatchKind(searchTerms: { caseSensitive: boolean; term: string }[], name: string): MatchKind { - var matchKind = MatchKind.none; - - if (name) { - for (var j = 0, n = searchTerms.length; j < n; j++) { - var searchTerm = searchTerms[j]; - var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase(); - // in case of case-insensitive search searchTerm.term will already be lower-cased - var index = nameToSearch.indexOf(searchTerm.term); - if (index < 0) { - // Didn't match. - return MatchKind.none; - } - - var termKind = MatchKind.substring; - if (index === 0) { - // here we know that match occur at the beginning of the string. - // if search term and declName has the same length - we have an exact match, otherwise declName have longer length and this will be prefix match - termKind = name.length === searchTerm.term.length ? MatchKind.exact : MatchKind.prefix; - } - - // Update our match kind if we don't have one, or if this match is better. - if (matchKind === MatchKind.none || termKind < matchKind) { - matchKind = termKind; - } - } - } - - return matchKind; - } + return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount); } function containErrors(diagnostics: Diagnostic[]): boolean { @@ -4755,7 +4631,6 @@ module ts { function getEmitOutput(fileName: string): EmitOutput { synchronizeHostData(); - fileName = normalizeSlashes(fileName); var sourceFile = getValidSourceFile(fileName); var outputFiles: OutputFile[] = []; @@ -4818,7 +4693,7 @@ module ts { return SemanticMeaning.Namespace; } - case SyntaxKind.ImportDeclaration: + case SyntaxKind.ImportEqualsDeclaration: return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace; // An external module can be a Value @@ -4853,10 +4728,10 @@ module ts { while (node.parent.kind === SyntaxKind.QualifiedName) { node = node.parent; } - return isInternalModuleImportDeclaration(node.parent) && (node.parent).moduleReference === node; + return isInternalModuleImportEqualsDeclaration(node.parent) && (node.parent).moduleReference === node; } - function getMeaningFromRightHandSideOfImport(node: Node) { + function getMeaningFromRightHandSideOfImportEquals(node: Node) { Debug.assert(node.kind === SyntaxKind.Identifier); // import a = |b|; // Namespace @@ -4865,7 +4740,7 @@ module ts { if (node.parent.kind === SyntaxKind.QualifiedName && (node.parent).right === node && - node.parent.parent.kind === SyntaxKind.ImportDeclaration) { + node.parent.parent.kind === SyntaxKind.ImportEqualsDeclaration) { return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace; } return SemanticMeaning.Namespace; @@ -4876,7 +4751,7 @@ module ts { return SemanticMeaning.Value | SemanticMeaning.Type | SemanticMeaning.Namespace; } else if (isInRightSideOfImport(node)) { - return getMeaningFromRightHandSideOfImport(node); + return getMeaningFromRightHandSideOfImportEquals(node); } else if (isDeclarationOrFunctionExpressionOrCatchVariableName(node)) { return getMeaningFromDeclaration(node.parent); @@ -4899,23 +4774,21 @@ module ts { function getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems { synchronizeHostData(); - fileName = normalizeSlashes(fileName); var sourceFile = getValidSourceFile(fileName); return SignatureHelp.getSignatureHelpItems(sourceFile, position, typeInfoResolver, cancellationToken); } /// Syntactic features - function getCurrentSourceFile(fileName: string): SourceFile { - fileName = normalizeSlashes(fileName); - var currentSourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - return currentSourceFile; + function getSourceFile(fileName: string): SourceFile { + return syntaxTreeCache.getCurrentSourceFile(fileName); } function getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan { - fileName = ts.normalizeSlashes(fileName); + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + // Get node at the location - var node = getTouchingPropertyName(getCurrentSourceFile(fileName), startPos); + var node = getTouchingPropertyName(sourceFile, startPos); if (!node) { return; @@ -4969,19 +4842,19 @@ module ts { function getBreakpointStatementAtPosition(fileName: string, position: number) { // doesn't use compiler - no need to synchronize with host - fileName = ts.normalizeSlashes(fileName); - return BreakpointResolver.spanInSourceFileAtLocation(getCurrentSourceFile(fileName), position); + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + + return BreakpointResolver.spanInSourceFileAtLocation(sourceFile, position); } - function getNavigationBarItems(fileName: string): NavigationBarItem[] { - fileName = normalizeSlashes(fileName); + function getNavigationBarItems(fileName: string): NavigationBarItem[]{ + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); - return NavigationBar.getNavigationBarItems(getCurrentSourceFile(fileName)); + return NavigationBar.getNavigationBarItems(sourceFile); } function getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] { synchronizeHostData(); - fileName = normalizeSlashes(fileName); var sourceFile = getValidSourceFile(fileName); @@ -5055,8 +4928,7 @@ module ts { function getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] { // doesn't use compiler - no need to synchronize with host - fileName = normalizeSlashes(fileName); - var sourceFile = getCurrentSourceFile(fileName); + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); // Make a scanner we can get trivia from. var triviaScanner = createScanner(ScriptTarget.Latest, /*skipTrivia:*/ false, sourceFile.text); @@ -5274,13 +5146,12 @@ module ts { function getOutliningSpans(fileName: string): OutliningSpan[] { // doesn't use compiler - no need to synchronize with host - fileName = normalizeSlashes(fileName); - var sourceFile = getCurrentSourceFile(fileName); + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); return OutliningElementsCollector.collectElements(sourceFile); } function getBraceMatchingAtPosition(fileName: string, position: number) { - var sourceFile = getCurrentSourceFile(fileName); + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); var result: TextSpan[] = []; var token = getTouchingToken(sourceFile, position); @@ -5333,10 +5204,8 @@ module ts { } function getIndentationAtPosition(fileName: string, position: number, editorOptions: EditorOptions) { - fileName = normalizeSlashes(fileName); - var start = new Date().getTime(); - var sourceFile = getCurrentSourceFile(fileName); + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); log("getIndentationAtPosition: getCurrentSourceFile: " + (new Date().getTime() - start)); var start = new Date().getTime(); @@ -5348,22 +5217,17 @@ module ts { } function getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions): TextChange[] { - fileName = normalizeSlashes(fileName); - var sourceFile = getCurrentSourceFile(fileName); + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); return formatting.formatSelection(start, end, sourceFile, getRuleProvider(options), options); } function getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions): TextChange[] { - fileName = normalizeSlashes(fileName); - - var sourceFile = getCurrentSourceFile(fileName); + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); return formatting.formatDocument(sourceFile, getRuleProvider(options), options); } function getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): TextChange[] { - fileName = normalizeSlashes(fileName); - - var sourceFile = getCurrentSourceFile(fileName); + var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); if (key === "}") { return formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(options), options); @@ -5387,8 +5251,6 @@ module ts { // anything away. synchronizeHostData(); - fileName = normalizeSlashes(fileName); - var sourceFile = getValidSourceFile(fileName); cancellationToken.throwIfCancellationRequested(); @@ -5531,7 +5393,6 @@ module ts { function getRenameInfo(fileName: string, position: number): RenameInfo { synchronizeHostData(); - fileName = normalizeSlashes(fileName); var sourceFile = getValidSourceFile(fileName); var node = getTouchingWord(sourceFile, position); @@ -5615,7 +5476,7 @@ module ts { getFormattingEditsForDocument, getFormattingEditsAfterKeystroke, getEmitOutput, - getSourceFile: getCurrentSourceFile, + getSourceFile, getProgram }; } @@ -5779,25 +5640,25 @@ module ts { } } else if (lastNonTriviaToken === SyntaxKind.DotToken && isKeyword(token)) { - token = SyntaxKind.Identifier; + token = SyntaxKind.Identifier; } else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { - // We have two keywords in a row. Only treat the second as a keyword if - // it's a sequence that could legally occur in the language. Otherwise - // treat it as an identifier. This way, if someone writes "private var" - // we recognize that 'var' is actually an identifier here. - token = SyntaxKind.Identifier; + // We have two keywords in a row. Only treat the second as a keyword if + // it's a sequence that could legally occur in the language. Otherwise + // treat it as an identifier. This way, if someone writes "private var" + // we recognize that 'var' is actually an identifier here. + token = SyntaxKind.Identifier; } else if (lastNonTriviaToken === SyntaxKind.Identifier && token === SyntaxKind.LessThanToken) { - // Could be the start of something generic. Keep track of that by bumping - // up the current count of generic contexts we may be in. - angleBracketStack++; + // Could be the start of something generic. Keep track of that by bumping + // up the current count of generic contexts we may be in. + angleBracketStack++; } else if (token === SyntaxKind.GreaterThanToken && angleBracketStack > 0) { - // If we think we're currently in something generic, then mark that that - // generic entity is complete. - angleBracketStack--; + // If we think we're currently in something generic, then mark that that + // generic entity is complete. + angleBracketStack--; } else if (token === SyntaxKind.AnyKeyword || token === SyntaxKind.StringKeyword || @@ -5958,7 +5819,8 @@ module ts { case SyntaxKind.EqualsToken: case SyntaxKind.CommaToken: return true; - default: return false; + default: + return false; } } @@ -6003,6 +5865,7 @@ module ts { case SyntaxKind.SingleLineCommentTrivia: return TokenClass.Comment; case SyntaxKind.WhitespaceTrivia: + case SyntaxKind.NewLineTrivia: return TokenClass.Whitespace; case SyntaxKind.Identifier: default: diff --git a/src/services/shims.ts b/src/services/shims.ts index 7b5b6d08cf4..01950772903 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -138,7 +138,7 @@ module ts { * Returns a JSON-encoded value of the type: * { name: string; kind: string; kindModifiers: string; containerName: string; containerKind: string; matchKind: string; fileName: string; textSpan: { start: number; length: number}; } [] = []; */ - getNavigateToItems(searchValue: string): string; + getNavigateToItems(searchValue: string, maxResultCount?: number): string; /** * Returns a JSON-encoded value of the type: @@ -628,11 +628,11 @@ module ts { /// NAVIGATE TO /** Return a list of symbols that are interesting to navigate to */ - public getNavigateToItems(searchValue: string): string { + public getNavigateToItems(searchValue: string, maxResultCount?: number): string { return this.forwardJSONCall( - "getNavigateToItems('" + searchValue + "')", + "getNavigateToItems('" + searchValue + "', " + maxResultCount+ ")", () => { - var items = this.languageService.getNavigateToItems(searchValue); + var items = this.languageService.getNavigateToItems(searchValue, maxResultCount); return items; }); } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 10d00398160..13156523045 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -6,12 +6,11 @@ module ts { } export function getEndLinePosition(line: number, sourceFile: SourceFile): number { - Debug.assert(line >= 1); + Debug.assert(line >= 0); var lineStarts = sourceFile.getLineStarts(); - // lines returned by SourceFile.getLineAndCharacterForPosition are 1-based - var lineIndex = line - 1; - if (lineIndex === lineStarts.length - 1) { + var lineIndex = line; + if (lineIndex + 1 === lineStarts.length) { // last line - return EOF return sourceFile.text.length - 1; } @@ -32,15 +31,10 @@ module ts { } } - export function getStartPositionOfLine(line: number, sourceFile: SourceFile): number { - Debug.assert(line >= 1); - return sourceFile.getLineStarts()[line - 1]; - } - - export function getStartLinePositionForPosition(position: number, sourceFile: SourceFile): number { + export function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number { var lineStarts = sourceFile.getLineStarts(); - var line = sourceFile.getLineAndCharacterFromPosition(position).line; - return lineStarts[line - 1]; + var line = sourceFile.getLineAndCharacterOfPosition(position).line; + return lineStarts[line]; } export function rangeContainsRange(r1: TextRange, r2: TextRange): boolean { diff --git a/tests/baselines/reference/2dArrays.js b/tests/baselines/reference/2dArrays.js index 7840f3d8c54..fe8ab380ba7 100644 --- a/tests/baselines/reference/2dArrays.js +++ b/tests/baselines/reference/2dArrays.js @@ -30,9 +30,7 @@ var Board = (function () { function Board() { } Board.prototype.allShipsSunk = function () { - return this.ships.every(function (val) { - return val.isSunk; - }); + return this.ships.every(function (val) { return val.isSunk; }); }; return Board; })(); diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index f951a955b29..ae9a91e9e4e 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -21,8 +21,8 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); allDiagnostics.forEach(diagnostic => { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }); var exitCode = emitResult.emitSkipped ? 1 : 0; @@ -160,132 +160,142 @@ declare module "typescript" { VoidKeyword = 98, WhileKeyword = 99, WithKeyword = 100, - ImplementsKeyword = 101, - InterfaceKeyword = 102, - LetKeyword = 103, - PackageKeyword = 104, - PrivateKeyword = 105, - ProtectedKeyword = 106, - PublicKeyword = 107, - StaticKeyword = 108, - YieldKeyword = 109, - AnyKeyword = 110, - BooleanKeyword = 111, - ConstructorKeyword = 112, - DeclareKeyword = 113, - GetKeyword = 114, - ModuleKeyword = 115, - RequireKeyword = 116, - NumberKeyword = 117, - SetKeyword = 118, - StringKeyword = 119, - SymbolKeyword = 120, - TypeKeyword = 121, - OfKeyword = 122, - QualifiedName = 123, - ComputedPropertyName = 124, - TypeParameter = 125, - Parameter = 126, - PropertySignature = 127, - PropertyDeclaration = 128, - MethodSignature = 129, - MethodDeclaration = 130, - Constructor = 131, - GetAccessor = 132, - SetAccessor = 133, - CallSignature = 134, - ConstructSignature = 135, - IndexSignature = 136, - TypeReference = 137, - FunctionType = 138, - ConstructorType = 139, - TypeQuery = 140, - TypeLiteral = 141, - ArrayType = 142, - TupleType = 143, - UnionType = 144, - ParenthesizedType = 145, - ObjectBindingPattern = 146, - ArrayBindingPattern = 147, - BindingElement = 148, - ArrayLiteralExpression = 149, - ObjectLiteralExpression = 150, - PropertyAccessExpression = 151, - ElementAccessExpression = 152, - CallExpression = 153, - NewExpression = 154, - TaggedTemplateExpression = 155, - TypeAssertionExpression = 156, - ParenthesizedExpression = 157, - FunctionExpression = 158, - ArrowFunction = 159, - DeleteExpression = 160, - TypeOfExpression = 161, - VoidExpression = 162, - PrefixUnaryExpression = 163, - PostfixUnaryExpression = 164, - BinaryExpression = 165, - ConditionalExpression = 166, - TemplateExpression = 167, - YieldExpression = 168, - SpreadElementExpression = 169, - OmittedExpression = 170, - TemplateSpan = 171, - Block = 172, - VariableStatement = 173, - EmptyStatement = 174, - ExpressionStatement = 175, - IfStatement = 176, - DoStatement = 177, - WhileStatement = 178, - ForStatement = 179, - ForInStatement = 180, - ForOfStatement = 181, - ContinueStatement = 182, - BreakStatement = 183, - ReturnStatement = 184, - WithStatement = 185, - SwitchStatement = 186, - LabeledStatement = 187, - ThrowStatement = 188, - TryStatement = 189, - DebuggerStatement = 190, - VariableDeclaration = 191, - VariableDeclarationList = 192, - FunctionDeclaration = 193, - ClassDeclaration = 194, - InterfaceDeclaration = 195, - TypeAliasDeclaration = 196, - EnumDeclaration = 197, - ModuleDeclaration = 198, - ModuleBlock = 199, - ImportDeclaration = 200, - ExportAssignment = 201, - ExternalModuleReference = 202, - CaseClause = 203, - DefaultClause = 204, - HeritageClause = 205, - CatchClause = 206, - PropertyAssignment = 207, - ShorthandPropertyAssignment = 208, - EnumMember = 209, - SourceFile = 210, - SyntaxList = 211, - Count = 212, + AsKeyword = 101, + FromKeyword = 102, + ImplementsKeyword = 103, + InterfaceKeyword = 104, + LetKeyword = 105, + PackageKeyword = 106, + PrivateKeyword = 107, + ProtectedKeyword = 108, + PublicKeyword = 109, + StaticKeyword = 110, + YieldKeyword = 111, + AnyKeyword = 112, + BooleanKeyword = 113, + ConstructorKeyword = 114, + DeclareKeyword = 115, + GetKeyword = 116, + ModuleKeyword = 117, + RequireKeyword = 118, + NumberKeyword = 119, + SetKeyword = 120, + StringKeyword = 121, + SymbolKeyword = 122, + TypeKeyword = 123, + OfKeyword = 124, + QualifiedName = 125, + ComputedPropertyName = 126, + TypeParameter = 127, + Parameter = 128, + PropertySignature = 129, + PropertyDeclaration = 130, + MethodSignature = 131, + MethodDeclaration = 132, + Constructor = 133, + GetAccessor = 134, + SetAccessor = 135, + CallSignature = 136, + ConstructSignature = 137, + IndexSignature = 138, + TypeReference = 139, + FunctionType = 140, + ConstructorType = 141, + TypeQuery = 142, + TypeLiteral = 143, + ArrayType = 144, + TupleType = 145, + UnionType = 146, + ParenthesizedType = 147, + ObjectBindingPattern = 148, + ArrayBindingPattern = 149, + BindingElement = 150, + ArrayLiteralExpression = 151, + ObjectLiteralExpression = 152, + PropertyAccessExpression = 153, + ElementAccessExpression = 154, + CallExpression = 155, + NewExpression = 156, + TaggedTemplateExpression = 157, + TypeAssertionExpression = 158, + ParenthesizedExpression = 159, + FunctionExpression = 160, + ArrowFunction = 161, + DeleteExpression = 162, + TypeOfExpression = 163, + VoidExpression = 164, + PrefixUnaryExpression = 165, + PostfixUnaryExpression = 166, + BinaryExpression = 167, + ConditionalExpression = 168, + TemplateExpression = 169, + YieldExpression = 170, + SpreadElementExpression = 171, + OmittedExpression = 172, + TemplateSpan = 173, + Block = 174, + VariableStatement = 175, + EmptyStatement = 176, + ExpressionStatement = 177, + IfStatement = 178, + DoStatement = 179, + WhileStatement = 180, + ForStatement = 181, + ForInStatement = 182, + ForOfStatement = 183, + ContinueStatement = 184, + BreakStatement = 185, + ReturnStatement = 186, + WithStatement = 187, + SwitchStatement = 188, + LabeledStatement = 189, + ThrowStatement = 190, + TryStatement = 191, + DebuggerStatement = 192, + VariableDeclaration = 193, + VariableDeclarationList = 194, + FunctionDeclaration = 195, + ClassDeclaration = 196, + InterfaceDeclaration = 197, + TypeAliasDeclaration = 198, + EnumDeclaration = 199, + ModuleDeclaration = 200, + ModuleBlock = 201, + ImportEqualsDeclaration = 202, + ImportDeclaration = 203, + ImportClause = 204, + NamespaceImport = 205, + NamedImports = 206, + ImportSpecifier = 207, + ExportAssignment = 208, + ExportDeclaration = 209, + NamedExports = 210, + ExportSpecifier = 211, + ExternalModuleReference = 212, + CaseClause = 213, + DefaultClause = 214, + HeritageClause = 215, + CatchClause = 216, + PropertyAssignment = 217, + ShorthandPropertyAssignment = 218, + EnumMember = 219, + SourceFile = 220, + SyntaxList = 221, + Count = 222, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 122, - FirstFutureReservedWord = 101, - LastFutureReservedWord = 109, - FirstTypeNode = 137, - LastTypeNode = 145, + LastKeyword = 124, + FirstFutureReservedWord = 103, + LastFutureReservedWord = 111, + FirstTypeNode = 139, + LastTypeNode = 147, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 122, + LastToken = 124, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -294,7 +304,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 123, + FirstNode = 125, } const enum NodeFlags { Export = 1, @@ -332,13 +342,13 @@ declare module "typescript" { kind: SyntaxKind; flags: NodeFlags; parserContextFlags?: ParserContextFlags; + modifiers?: ModifiersArray; id?: number; parent?: Node; symbol?: Symbol; locals?: SymbolTable; nextContainer?: Node; localSymbol?: Symbol; - modifiers?: ModifiersArray; } interface NodeArray extends Array, TextRange { hasTrailingComma?: boolean; @@ -527,7 +537,7 @@ declare module "typescript" { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { @@ -702,20 +712,49 @@ declare module "typescript" { name: Identifier; members: NodeArray; } - interface ModuleDeclaration extends Declaration, ModuleElement { + interface ExportContainer { + exportStars?: ExportDeclaration[]; + } + interface ModuleDeclaration extends Declaration, ModuleElement, ExportContainer { name: Identifier | LiteralExpression; body: ModuleBlock | ModuleDeclaration; } interface ModuleBlock extends Node, ModuleElement { statements: NodeArray; } - interface ImportDeclaration extends Declaration, ModuleElement { + interface ImportEqualsDeclaration extends Declaration, ModuleElement { name: Identifier; moduleReference: EntityName | ExternalModuleReference; } interface ExternalModuleReference extends Node { expression?: Expression; } + interface ImportDeclaration extends Statement, ModuleElement { + importClause?: ImportClause; + moduleSpecifier: Expression; + } + interface ImportClause extends Declaration { + name?: Identifier; + namedBindings?: NamespaceImport | NamedImports; + } + interface NamespaceImport extends Declaration { + name: Identifier; + } + interface ExportDeclaration extends Statement, ModuleElement { + exportClause?: NamedExports; + moduleSpecifier?: Expression; + } + interface NamedImportsOrExports extends Node { + elements: NodeArray; + } + type NamedImports = NamedImportsOrExports; + type NamedExports = NamedImportsOrExports; + interface ImportOrExportSpecifier extends Declaration { + propertyName?: Identifier; + name: Identifier; + } + type ImportSpecifier = ImportOrExportSpecifier; + type ExportSpecifier = ImportOrExportSpecifier; interface ExportAssignment extends Statement, ModuleElement { exportName: Identifier; } @@ -725,7 +764,7 @@ declare module "typescript" { interface CommentRange extends TextRange { hasTrailingNewLine?: boolean; } - interface SourceFile extends Declaration { + interface SourceFile extends Declaration, ExportContainer { statements: NodeArray; endOfFileToken: Node; fileName: string; @@ -879,7 +918,7 @@ declare module "typescript" { } interface SymbolVisibilityResult { accessibility: SymbolAccessibility; - aliasesToMakeVisible?: ImportDeclaration[]; + aliasesToMakeVisible?: ImportEqualsDeclaration[]; errorSymbolName?: string; errorNode?: Node; } @@ -887,11 +926,11 @@ declare module "typescript" { errorModuleName?: string; } interface EmitResolver { - getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string; - getExpressionNamePrefix(node: Identifier): string; + getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration): string; + getExpressionNameSubstitution(node: Identifier): string; getExportAssignmentName(node: SourceFile): string; - isReferencedImportDeclaration(node: ImportDeclaration): boolean; - isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean; + isReferencedImportDeclaration(node: Node): boolean; + isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; getNodeCheckFlags(node: Node): NodeCheckFlags; isDeclarationVisible(node: Declaration): boolean; isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; @@ -986,8 +1025,10 @@ declare module "typescript" { declaredType?: Type; mapper?: TypeMapper; referenced?: boolean; - exportAssignSymbol?: Symbol; + exportAssignmentChecked?: boolean; + exportAssignmentSymbol?: Symbol; unionType?: UnionType; + resolvedExports?: SymbolTable; } interface TransientSymbol extends Symbol, SymbolLinks { } @@ -1012,7 +1053,8 @@ declare module "typescript" { enumMemberValue?: number; isIllegalTypeReferenceInConstraint?: boolean; isVisible?: boolean; - localModuleName?: string; + generatedName?: string; + generatedNames?: Map; assignmentChecks?: Map; hasReportedStatementInAmbientContext?: boolean; importOnRightSide?: Symbol; @@ -1326,6 +1368,7 @@ declare module "typescript" { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, @@ -1392,8 +1435,8 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; @@ -1477,9 +1520,9 @@ declare module "typescript" { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -1541,7 +1584,7 @@ declare module "typescript" { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; @@ -1955,8 +1998,8 @@ function compile(fileNames, options) { var emitResult = program.emit(); var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); allDiagnostics.forEach(function (diagnostic) { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(diagnostic.file.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(diagnostic.file.fileName + " (" + (lineChar.line + 1) + "," + (lineChar.character + 1) + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)); }); var exitCode = emitResult.emitSkipped ? 1 : 0; console.log("Process exiting with code '" + exitCode + "'."); @@ -1964,8 +2007,6 @@ function compile(fileNames, options) { } exports.compile = compile; compile(process.argv.slice(2), { - noEmitOnError: true, - noImplicitAny: true, - target: 1 /* ES5 */, - module: 1 /* CommonJS */ + noEmitOnError: true, noImplicitAny: true, + target: 1 /* ES5 */, module: 1 /* CommonJS */ }); diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 7a1a306b989..a2f2a706eaa 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -56,27 +56,27 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void >diagnostics : ts.Diagnostic[] allDiagnostics.forEach(diagnostic => { ->allDiagnostics.forEach(diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }) : void +>allDiagnostics.forEach(diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }) : void >allDiagnostics.forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void >allDiagnostics : ts.Diagnostic[] >forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void ->diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); } : (diagnostic: ts.Diagnostic) => void +>diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); } : (diagnostic: ts.Diagnostic) => void >diagnostic : ts.Diagnostic - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); >lineChar : ts.LineAndCharacter ->diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start) : ts.LineAndCharacter ->diagnostic.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >diagnostic.file : ts.SourceFile >diagnostic : ts.Diagnostic >file : ts.SourceFile ->getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >diagnostic.start : number >diagnostic : ts.Diagnostic >start : number - console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); ->console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`) : any + console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); +>console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`) : any >console.log : any >console : any >log : any @@ -85,9 +85,11 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void >diagnostic : ts.Diagnostic >file : ts.SourceFile >fileName : string +>lineChar.line + 1 : number >lineChar.line : number >lineChar : ts.LineAndCharacter >line : number +>lineChar.character + 1 : number >lineChar.character : number >lineChar : ts.LineAndCharacter >character : number @@ -496,340 +498,370 @@ declare module "typescript" { WithKeyword = 100, >WithKeyword : SyntaxKind - ImplementsKeyword = 101, + AsKeyword = 101, +>AsKeyword : SyntaxKind + + FromKeyword = 102, +>FromKeyword : SyntaxKind + + ImplementsKeyword = 103, >ImplementsKeyword : SyntaxKind - InterfaceKeyword = 102, + InterfaceKeyword = 104, >InterfaceKeyword : SyntaxKind - LetKeyword = 103, + LetKeyword = 105, >LetKeyword : SyntaxKind - PackageKeyword = 104, + PackageKeyword = 106, >PackageKeyword : SyntaxKind - PrivateKeyword = 105, + PrivateKeyword = 107, >PrivateKeyword : SyntaxKind - ProtectedKeyword = 106, + ProtectedKeyword = 108, >ProtectedKeyword : SyntaxKind - PublicKeyword = 107, + PublicKeyword = 109, >PublicKeyword : SyntaxKind - StaticKeyword = 108, + StaticKeyword = 110, >StaticKeyword : SyntaxKind - YieldKeyword = 109, + YieldKeyword = 111, >YieldKeyword : SyntaxKind - AnyKeyword = 110, + AnyKeyword = 112, >AnyKeyword : SyntaxKind - BooleanKeyword = 111, + BooleanKeyword = 113, >BooleanKeyword : SyntaxKind - ConstructorKeyword = 112, + ConstructorKeyword = 114, >ConstructorKeyword : SyntaxKind - DeclareKeyword = 113, + DeclareKeyword = 115, >DeclareKeyword : SyntaxKind - GetKeyword = 114, + GetKeyword = 116, >GetKeyword : SyntaxKind - ModuleKeyword = 115, + ModuleKeyword = 117, >ModuleKeyword : SyntaxKind - RequireKeyword = 116, + RequireKeyword = 118, >RequireKeyword : SyntaxKind - NumberKeyword = 117, + NumberKeyword = 119, >NumberKeyword : SyntaxKind - SetKeyword = 118, + SetKeyword = 120, >SetKeyword : SyntaxKind - StringKeyword = 119, + StringKeyword = 121, >StringKeyword : SyntaxKind - SymbolKeyword = 120, + SymbolKeyword = 122, >SymbolKeyword : SyntaxKind - TypeKeyword = 121, + TypeKeyword = 123, >TypeKeyword : SyntaxKind - OfKeyword = 122, + OfKeyword = 124, >OfKeyword : SyntaxKind - QualifiedName = 123, + QualifiedName = 125, >QualifiedName : SyntaxKind - ComputedPropertyName = 124, + ComputedPropertyName = 126, >ComputedPropertyName : SyntaxKind - TypeParameter = 125, + TypeParameter = 127, >TypeParameter : SyntaxKind - Parameter = 126, + Parameter = 128, >Parameter : SyntaxKind - PropertySignature = 127, + PropertySignature = 129, >PropertySignature : SyntaxKind - PropertyDeclaration = 128, + PropertyDeclaration = 130, >PropertyDeclaration : SyntaxKind - MethodSignature = 129, + MethodSignature = 131, >MethodSignature : SyntaxKind - MethodDeclaration = 130, + MethodDeclaration = 132, >MethodDeclaration : SyntaxKind - Constructor = 131, + Constructor = 133, >Constructor : SyntaxKind - GetAccessor = 132, + GetAccessor = 134, >GetAccessor : SyntaxKind - SetAccessor = 133, + SetAccessor = 135, >SetAccessor : SyntaxKind - CallSignature = 134, + CallSignature = 136, >CallSignature : SyntaxKind - ConstructSignature = 135, + ConstructSignature = 137, >ConstructSignature : SyntaxKind - IndexSignature = 136, + IndexSignature = 138, >IndexSignature : SyntaxKind - TypeReference = 137, + TypeReference = 139, >TypeReference : SyntaxKind - FunctionType = 138, + FunctionType = 140, >FunctionType : SyntaxKind - ConstructorType = 139, + ConstructorType = 141, >ConstructorType : SyntaxKind - TypeQuery = 140, + TypeQuery = 142, >TypeQuery : SyntaxKind - TypeLiteral = 141, + TypeLiteral = 143, >TypeLiteral : SyntaxKind - ArrayType = 142, + ArrayType = 144, >ArrayType : SyntaxKind - TupleType = 143, + TupleType = 145, >TupleType : SyntaxKind - UnionType = 144, + UnionType = 146, >UnionType : SyntaxKind - ParenthesizedType = 145, + ParenthesizedType = 147, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 146, + ObjectBindingPattern = 148, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 147, + ArrayBindingPattern = 149, >ArrayBindingPattern : SyntaxKind - BindingElement = 148, + BindingElement = 150, >BindingElement : SyntaxKind - ArrayLiteralExpression = 149, + ArrayLiteralExpression = 151, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 150, + ObjectLiteralExpression = 152, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 151, + PropertyAccessExpression = 153, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 152, + ElementAccessExpression = 154, >ElementAccessExpression : SyntaxKind - CallExpression = 153, + CallExpression = 155, >CallExpression : SyntaxKind - NewExpression = 154, + NewExpression = 156, >NewExpression : SyntaxKind - TaggedTemplateExpression = 155, + TaggedTemplateExpression = 157, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 156, + TypeAssertionExpression = 158, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 157, + ParenthesizedExpression = 159, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 158, + FunctionExpression = 160, >FunctionExpression : SyntaxKind - ArrowFunction = 159, + ArrowFunction = 161, >ArrowFunction : SyntaxKind - DeleteExpression = 160, + DeleteExpression = 162, >DeleteExpression : SyntaxKind - TypeOfExpression = 161, + TypeOfExpression = 163, >TypeOfExpression : SyntaxKind - VoidExpression = 162, + VoidExpression = 164, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 163, + PrefixUnaryExpression = 165, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 164, + PostfixUnaryExpression = 166, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 165, + BinaryExpression = 167, >BinaryExpression : SyntaxKind - ConditionalExpression = 166, + ConditionalExpression = 168, >ConditionalExpression : SyntaxKind - TemplateExpression = 167, + TemplateExpression = 169, >TemplateExpression : SyntaxKind - YieldExpression = 168, + YieldExpression = 170, >YieldExpression : SyntaxKind - SpreadElementExpression = 169, + SpreadElementExpression = 171, >SpreadElementExpression : SyntaxKind - OmittedExpression = 170, + OmittedExpression = 172, >OmittedExpression : SyntaxKind - TemplateSpan = 171, + TemplateSpan = 173, >TemplateSpan : SyntaxKind - Block = 172, + Block = 174, >Block : SyntaxKind - VariableStatement = 173, + VariableStatement = 175, >VariableStatement : SyntaxKind - EmptyStatement = 174, + EmptyStatement = 176, >EmptyStatement : SyntaxKind - ExpressionStatement = 175, + ExpressionStatement = 177, >ExpressionStatement : SyntaxKind - IfStatement = 176, + IfStatement = 178, >IfStatement : SyntaxKind - DoStatement = 177, + DoStatement = 179, >DoStatement : SyntaxKind - WhileStatement = 178, + WhileStatement = 180, >WhileStatement : SyntaxKind - ForStatement = 179, + ForStatement = 181, >ForStatement : SyntaxKind - ForInStatement = 180, + ForInStatement = 182, >ForInStatement : SyntaxKind - ForOfStatement = 181, + ForOfStatement = 183, >ForOfStatement : SyntaxKind - ContinueStatement = 182, + ContinueStatement = 184, >ContinueStatement : SyntaxKind - BreakStatement = 183, + BreakStatement = 185, >BreakStatement : SyntaxKind - ReturnStatement = 184, + ReturnStatement = 186, >ReturnStatement : SyntaxKind - WithStatement = 185, + WithStatement = 187, >WithStatement : SyntaxKind - SwitchStatement = 186, + SwitchStatement = 188, >SwitchStatement : SyntaxKind - LabeledStatement = 187, + LabeledStatement = 189, >LabeledStatement : SyntaxKind - ThrowStatement = 188, + ThrowStatement = 190, >ThrowStatement : SyntaxKind - TryStatement = 189, + TryStatement = 191, >TryStatement : SyntaxKind - DebuggerStatement = 190, + DebuggerStatement = 192, >DebuggerStatement : SyntaxKind - VariableDeclaration = 191, + VariableDeclaration = 193, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 192, + VariableDeclarationList = 194, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 193, + FunctionDeclaration = 195, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 194, + ClassDeclaration = 196, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 195, + InterfaceDeclaration = 197, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 196, + TypeAliasDeclaration = 198, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 197, + EnumDeclaration = 199, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 198, + ModuleDeclaration = 200, >ModuleDeclaration : SyntaxKind - ModuleBlock = 199, + ModuleBlock = 201, >ModuleBlock : SyntaxKind - ImportDeclaration = 200, + ImportEqualsDeclaration = 202, +>ImportEqualsDeclaration : SyntaxKind + + ImportDeclaration = 203, >ImportDeclaration : SyntaxKind - ExportAssignment = 201, + ImportClause = 204, +>ImportClause : SyntaxKind + + NamespaceImport = 205, +>NamespaceImport : SyntaxKind + + NamedImports = 206, +>NamedImports : SyntaxKind + + ImportSpecifier = 207, +>ImportSpecifier : SyntaxKind + + ExportAssignment = 208, >ExportAssignment : SyntaxKind - ExternalModuleReference = 202, + ExportDeclaration = 209, +>ExportDeclaration : SyntaxKind + + NamedExports = 210, +>NamedExports : SyntaxKind + + ExportSpecifier = 211, +>ExportSpecifier : SyntaxKind + + ExternalModuleReference = 212, >ExternalModuleReference : SyntaxKind - CaseClause = 203, + CaseClause = 213, >CaseClause : SyntaxKind - DefaultClause = 204, + DefaultClause = 214, >DefaultClause : SyntaxKind - HeritageClause = 205, + HeritageClause = 215, >HeritageClause : SyntaxKind - CatchClause = 206, + CatchClause = 216, >CatchClause : SyntaxKind - PropertyAssignment = 207, + PropertyAssignment = 217, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 208, + ShorthandPropertyAssignment = 218, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 209, + EnumMember = 219, >EnumMember : SyntaxKind - SourceFile = 210, + SourceFile = 220, >SourceFile : SyntaxKind - SyntaxList = 211, + SyntaxList = 221, >SyntaxList : SyntaxKind - Count = 212, + Count = 222, >Count : SyntaxKind FirstAssignment = 52, @@ -847,19 +879,19 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 122, + LastKeyword = 124, >LastKeyword : SyntaxKind - FirstFutureReservedWord = 101, + FirstFutureReservedWord = 103, >FirstFutureReservedWord : SyntaxKind - LastFutureReservedWord = 109, + LastFutureReservedWord = 111, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 137, + FirstTypeNode = 139, >FirstTypeNode : SyntaxKind - LastTypeNode = 145, + LastTypeNode = 147, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -871,7 +903,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 122, + LastToken = 124, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -898,7 +930,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 123, + FirstNode = 125, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -1004,6 +1036,10 @@ declare module "typescript" { >parserContextFlags : ParserContextFlags >ParserContextFlags : ParserContextFlags + modifiers?: ModifiersArray; +>modifiers : ModifiersArray +>ModifiersArray : ModifiersArray + id?: number; >id : number @@ -1026,10 +1062,6 @@ declare module "typescript" { localSymbol?: Symbol; >localSymbol : Symbol >Symbol : Symbol - - modifiers?: ModifiersArray; ->modifiers : ModifiersArray ->ModifiersArray : ModifiersArray } interface NodeArray extends Array, TextRange { >NodeArray : NodeArray @@ -1585,9 +1617,9 @@ declare module "typescript" { >left : Expression >Expression : Expression - operator: SyntaxKind; ->operator : SyntaxKind ->SyntaxKind : SyntaxKind + operatorToken: Node; +>operatorToken : Node +>Node : Node right: Expression; >right : Expression @@ -2128,10 +2160,18 @@ declare module "typescript" { >NodeArray : NodeArray >EnumMember : EnumMember } - interface ModuleDeclaration extends Declaration, ModuleElement { + interface ExportContainer { +>ExportContainer : ExportContainer + + exportStars?: ExportDeclaration[]; +>exportStars : ExportDeclaration[] +>ExportDeclaration : ExportDeclaration + } + interface ModuleDeclaration extends Declaration, ModuleElement, ExportContainer { >ModuleDeclaration : ModuleDeclaration >Declaration : Declaration >ModuleElement : ModuleElement +>ExportContainer : ExportContainer name: Identifier | LiteralExpression; >name : Identifier | LiteralExpression @@ -2153,8 +2193,8 @@ declare module "typescript" { >NodeArray : NodeArray >ModuleElement : ModuleElement } - interface ImportDeclaration extends Declaration, ModuleElement { ->ImportDeclaration : ImportDeclaration + interface ImportEqualsDeclaration extends Declaration, ModuleElement { +>ImportEqualsDeclaration : ImportEqualsDeclaration >Declaration : Declaration >ModuleElement : ModuleElement @@ -2175,6 +2215,90 @@ declare module "typescript" { >expression : Expression >Expression : Expression } + interface ImportDeclaration extends Statement, ModuleElement { +>ImportDeclaration : ImportDeclaration +>Statement : Statement +>ModuleElement : ModuleElement + + importClause?: ImportClause; +>importClause : ImportClause +>ImportClause : ImportClause + + moduleSpecifier: Expression; +>moduleSpecifier : Expression +>Expression : Expression + } + interface ImportClause extends Declaration { +>ImportClause : ImportClause +>Declaration : Declaration + + name?: Identifier; +>name : Identifier +>Identifier : Identifier + + namedBindings?: NamespaceImport | NamedImports; +>namedBindings : NamespaceImport | NamedImportsOrExports +>NamespaceImport : NamespaceImport +>NamedImports : NamedImportsOrExports + } + interface NamespaceImport extends Declaration { +>NamespaceImport : NamespaceImport +>Declaration : Declaration + + name: Identifier; +>name : Identifier +>Identifier : Identifier + } + interface ExportDeclaration extends Statement, ModuleElement { +>ExportDeclaration : ExportDeclaration +>Statement : Statement +>ModuleElement : ModuleElement + + exportClause?: NamedExports; +>exportClause : NamedImportsOrExports +>NamedExports : NamedImportsOrExports + + moduleSpecifier?: Expression; +>moduleSpecifier : Expression +>Expression : Expression + } + interface NamedImportsOrExports extends Node { +>NamedImportsOrExports : NamedImportsOrExports +>Node : Node + + elements: NodeArray; +>elements : NodeArray +>NodeArray : NodeArray +>ImportOrExportSpecifier : ImportOrExportSpecifier + } + type NamedImports = NamedImportsOrExports; +>NamedImports : NamedImportsOrExports +>NamedImportsOrExports : NamedImportsOrExports + + type NamedExports = NamedImportsOrExports; +>NamedExports : NamedImportsOrExports +>NamedImportsOrExports : NamedImportsOrExports + + interface ImportOrExportSpecifier extends Declaration { +>ImportOrExportSpecifier : ImportOrExportSpecifier +>Declaration : Declaration + + propertyName?: Identifier; +>propertyName : Identifier +>Identifier : Identifier + + name: Identifier; +>name : Identifier +>Identifier : Identifier + } + type ImportSpecifier = ImportOrExportSpecifier; +>ImportSpecifier : ImportOrExportSpecifier +>ImportOrExportSpecifier : ImportOrExportSpecifier + + type ExportSpecifier = ImportOrExportSpecifier; +>ExportSpecifier : ImportOrExportSpecifier +>ImportOrExportSpecifier : ImportOrExportSpecifier + interface ExportAssignment extends Statement, ModuleElement { >ExportAssignment : ExportAssignment >Statement : Statement @@ -2198,9 +2322,10 @@ declare module "typescript" { hasTrailingNewLine?: boolean; >hasTrailingNewLine : boolean } - interface SourceFile extends Declaration { + interface SourceFile extends Declaration, ExportContainer { >SourceFile : SourceFile >Declaration : Declaration +>ExportContainer : ExportContainer statements: NodeArray; >statements : NodeArray @@ -2814,9 +2939,9 @@ declare module "typescript" { >accessibility : SymbolAccessibility >SymbolAccessibility : SymbolAccessibility - aliasesToMakeVisible?: ImportDeclaration[]; ->aliasesToMakeVisible : ImportDeclaration[] ->ImportDeclaration : ImportDeclaration + aliasesToMakeVisible?: ImportEqualsDeclaration[]; +>aliasesToMakeVisible : ImportEqualsDeclaration[] +>ImportEqualsDeclaration : ImportEqualsDeclaration errorSymbolName?: string; >errorSymbolName : string @@ -2835,14 +2960,16 @@ declare module "typescript" { interface EmitResolver { >EmitResolver : EmitResolver - getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string; ->getLocalNameOfContainer : (container: EnumDeclaration | ModuleDeclaration) => string ->container : EnumDeclaration | ModuleDeclaration + getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration): string; +>getGeneratedNameForNode : (node: EnumDeclaration | ExportDeclaration | ModuleDeclaration | ImportDeclaration) => string +>node : EnumDeclaration | ExportDeclaration | ModuleDeclaration | ImportDeclaration >ModuleDeclaration : ModuleDeclaration >EnumDeclaration : EnumDeclaration +>ImportDeclaration : ImportDeclaration +>ExportDeclaration : ExportDeclaration - getExpressionNamePrefix(node: Identifier): string; ->getExpressionNamePrefix : (node: Identifier) => string + getExpressionNameSubstitution(node: Identifier): string; +>getExpressionNameSubstitution : (node: Identifier) => string >node : Identifier >Identifier : Identifier @@ -2851,15 +2978,15 @@ declare module "typescript" { >node : SourceFile >SourceFile : SourceFile - isReferencedImportDeclaration(node: ImportDeclaration): boolean; ->isReferencedImportDeclaration : (node: ImportDeclaration) => boolean ->node : ImportDeclaration ->ImportDeclaration : ImportDeclaration + isReferencedImportDeclaration(node: Node): boolean; +>isReferencedImportDeclaration : (node: Node) => boolean +>node : Node +>Node : Node - isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean; ->isTopLevelValueImportWithEntityName : (node: ImportDeclaration) => boolean ->node : ImportDeclaration ->ImportDeclaration : ImportDeclaration + isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; +>isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean +>node : ImportEqualsDeclaration +>ImportEqualsDeclaration : ImportEqualsDeclaration getNodeCheckFlags(node: Node): NodeCheckFlags; >getNodeCheckFlags : (node: Node) => NodeCheckFlags @@ -3188,13 +3315,20 @@ declare module "typescript" { referenced?: boolean; >referenced : boolean - exportAssignSymbol?: Symbol; ->exportAssignSymbol : Symbol + exportAssignmentChecked?: boolean; +>exportAssignmentChecked : boolean + + exportAssignmentSymbol?: Symbol; +>exportAssignmentSymbol : Symbol >Symbol : Symbol unionType?: UnionType; >unionType : UnionType >UnionType : UnionType + + resolvedExports?: SymbolTable; +>resolvedExports : SymbolTable +>SymbolTable : SymbolTable } interface TransientSymbol extends Symbol, SymbolLinks { >TransientSymbol : TransientSymbol @@ -3263,8 +3397,12 @@ declare module "typescript" { isVisible?: boolean; >isVisible : boolean - localModuleName?: string; ->localModuleName : string + generatedName?: string; +>generatedName : string + + generatedNames?: Map; +>generatedNames : Map +>Map : Map assignmentChecks?: Map; >assignmentChecks : Map @@ -4188,6 +4326,9 @@ declare module "typescript" { greaterThan = 62, >greaterThan : CharacterCodes + hash = 35, +>hash : CharacterCodes + lessThan = 60, >lessThan : CharacterCodes @@ -4393,15 +4534,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -4760,16 +4901,16 @@ declare module "typescript" { >getNamedDeclarations : () => Declaration[] >Declaration : Declaration - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; ->getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter >pos : number >LineAndCharacter : LineAndCharacter getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromLineAndCharacter(line: number, character: number): number; ->getPositionFromLineAndCharacter : (line: number, character: number) => number + getPositionOfLineAndCharacter(line: number, character: number): number; +>getPositionOfLineAndCharacter : (line: number, character: number) => number >line : number >character : number @@ -4986,9 +5127,10 @@ declare module "typescript" { >position : number >ReferenceEntry : ReferenceEntry - getNavigateToItems(searchValue: string): NavigateToItem[]; ->getNavigateToItems : (searchValue: string) => NavigateToItem[] + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; +>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] >searchValue : string +>maxResultCount : number >NavigateToItem : NavigateToItem getNavigationBarItems(fileName: string): NavigationBarItem[]; diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 9631a755165..13b3e4f068a 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -39,7 +39,7 @@ export function delint(sourceFile: ts.SourceFile) { break; case ts.SyntaxKind.BinaryExpression: - var op = (node).operator; + var op = (node).operatorToken.kind; if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) { report(node, "Use '===' and '!=='.") @@ -51,8 +51,8 @@ export function delint(sourceFile: ts.SourceFile) { } function report(node: ts.Node, message: string) { - var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); - console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) + var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); + console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) } } @@ -191,132 +191,142 @@ declare module "typescript" { VoidKeyword = 98, WhileKeyword = 99, WithKeyword = 100, - ImplementsKeyword = 101, - InterfaceKeyword = 102, - LetKeyword = 103, - PackageKeyword = 104, - PrivateKeyword = 105, - ProtectedKeyword = 106, - PublicKeyword = 107, - StaticKeyword = 108, - YieldKeyword = 109, - AnyKeyword = 110, - BooleanKeyword = 111, - ConstructorKeyword = 112, - DeclareKeyword = 113, - GetKeyword = 114, - ModuleKeyword = 115, - RequireKeyword = 116, - NumberKeyword = 117, - SetKeyword = 118, - StringKeyword = 119, - SymbolKeyword = 120, - TypeKeyword = 121, - OfKeyword = 122, - QualifiedName = 123, - ComputedPropertyName = 124, - TypeParameter = 125, - Parameter = 126, - PropertySignature = 127, - PropertyDeclaration = 128, - MethodSignature = 129, - MethodDeclaration = 130, - Constructor = 131, - GetAccessor = 132, - SetAccessor = 133, - CallSignature = 134, - ConstructSignature = 135, - IndexSignature = 136, - TypeReference = 137, - FunctionType = 138, - ConstructorType = 139, - TypeQuery = 140, - TypeLiteral = 141, - ArrayType = 142, - TupleType = 143, - UnionType = 144, - ParenthesizedType = 145, - ObjectBindingPattern = 146, - ArrayBindingPattern = 147, - BindingElement = 148, - ArrayLiteralExpression = 149, - ObjectLiteralExpression = 150, - PropertyAccessExpression = 151, - ElementAccessExpression = 152, - CallExpression = 153, - NewExpression = 154, - TaggedTemplateExpression = 155, - TypeAssertionExpression = 156, - ParenthesizedExpression = 157, - FunctionExpression = 158, - ArrowFunction = 159, - DeleteExpression = 160, - TypeOfExpression = 161, - VoidExpression = 162, - PrefixUnaryExpression = 163, - PostfixUnaryExpression = 164, - BinaryExpression = 165, - ConditionalExpression = 166, - TemplateExpression = 167, - YieldExpression = 168, - SpreadElementExpression = 169, - OmittedExpression = 170, - TemplateSpan = 171, - Block = 172, - VariableStatement = 173, - EmptyStatement = 174, - ExpressionStatement = 175, - IfStatement = 176, - DoStatement = 177, - WhileStatement = 178, - ForStatement = 179, - ForInStatement = 180, - ForOfStatement = 181, - ContinueStatement = 182, - BreakStatement = 183, - ReturnStatement = 184, - WithStatement = 185, - SwitchStatement = 186, - LabeledStatement = 187, - ThrowStatement = 188, - TryStatement = 189, - DebuggerStatement = 190, - VariableDeclaration = 191, - VariableDeclarationList = 192, - FunctionDeclaration = 193, - ClassDeclaration = 194, - InterfaceDeclaration = 195, - TypeAliasDeclaration = 196, - EnumDeclaration = 197, - ModuleDeclaration = 198, - ModuleBlock = 199, - ImportDeclaration = 200, - ExportAssignment = 201, - ExternalModuleReference = 202, - CaseClause = 203, - DefaultClause = 204, - HeritageClause = 205, - CatchClause = 206, - PropertyAssignment = 207, - ShorthandPropertyAssignment = 208, - EnumMember = 209, - SourceFile = 210, - SyntaxList = 211, - Count = 212, + AsKeyword = 101, + FromKeyword = 102, + ImplementsKeyword = 103, + InterfaceKeyword = 104, + LetKeyword = 105, + PackageKeyword = 106, + PrivateKeyword = 107, + ProtectedKeyword = 108, + PublicKeyword = 109, + StaticKeyword = 110, + YieldKeyword = 111, + AnyKeyword = 112, + BooleanKeyword = 113, + ConstructorKeyword = 114, + DeclareKeyword = 115, + GetKeyword = 116, + ModuleKeyword = 117, + RequireKeyword = 118, + NumberKeyword = 119, + SetKeyword = 120, + StringKeyword = 121, + SymbolKeyword = 122, + TypeKeyword = 123, + OfKeyword = 124, + QualifiedName = 125, + ComputedPropertyName = 126, + TypeParameter = 127, + Parameter = 128, + PropertySignature = 129, + PropertyDeclaration = 130, + MethodSignature = 131, + MethodDeclaration = 132, + Constructor = 133, + GetAccessor = 134, + SetAccessor = 135, + CallSignature = 136, + ConstructSignature = 137, + IndexSignature = 138, + TypeReference = 139, + FunctionType = 140, + ConstructorType = 141, + TypeQuery = 142, + TypeLiteral = 143, + ArrayType = 144, + TupleType = 145, + UnionType = 146, + ParenthesizedType = 147, + ObjectBindingPattern = 148, + ArrayBindingPattern = 149, + BindingElement = 150, + ArrayLiteralExpression = 151, + ObjectLiteralExpression = 152, + PropertyAccessExpression = 153, + ElementAccessExpression = 154, + CallExpression = 155, + NewExpression = 156, + TaggedTemplateExpression = 157, + TypeAssertionExpression = 158, + ParenthesizedExpression = 159, + FunctionExpression = 160, + ArrowFunction = 161, + DeleteExpression = 162, + TypeOfExpression = 163, + VoidExpression = 164, + PrefixUnaryExpression = 165, + PostfixUnaryExpression = 166, + BinaryExpression = 167, + ConditionalExpression = 168, + TemplateExpression = 169, + YieldExpression = 170, + SpreadElementExpression = 171, + OmittedExpression = 172, + TemplateSpan = 173, + Block = 174, + VariableStatement = 175, + EmptyStatement = 176, + ExpressionStatement = 177, + IfStatement = 178, + DoStatement = 179, + WhileStatement = 180, + ForStatement = 181, + ForInStatement = 182, + ForOfStatement = 183, + ContinueStatement = 184, + BreakStatement = 185, + ReturnStatement = 186, + WithStatement = 187, + SwitchStatement = 188, + LabeledStatement = 189, + ThrowStatement = 190, + TryStatement = 191, + DebuggerStatement = 192, + VariableDeclaration = 193, + VariableDeclarationList = 194, + FunctionDeclaration = 195, + ClassDeclaration = 196, + InterfaceDeclaration = 197, + TypeAliasDeclaration = 198, + EnumDeclaration = 199, + ModuleDeclaration = 200, + ModuleBlock = 201, + ImportEqualsDeclaration = 202, + ImportDeclaration = 203, + ImportClause = 204, + NamespaceImport = 205, + NamedImports = 206, + ImportSpecifier = 207, + ExportAssignment = 208, + ExportDeclaration = 209, + NamedExports = 210, + ExportSpecifier = 211, + ExternalModuleReference = 212, + CaseClause = 213, + DefaultClause = 214, + HeritageClause = 215, + CatchClause = 216, + PropertyAssignment = 217, + ShorthandPropertyAssignment = 218, + EnumMember = 219, + SourceFile = 220, + SyntaxList = 221, + Count = 222, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 122, - FirstFutureReservedWord = 101, - LastFutureReservedWord = 109, - FirstTypeNode = 137, - LastTypeNode = 145, + LastKeyword = 124, + FirstFutureReservedWord = 103, + LastFutureReservedWord = 111, + FirstTypeNode = 139, + LastTypeNode = 147, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 122, + LastToken = 124, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -325,7 +335,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 123, + FirstNode = 125, } const enum NodeFlags { Export = 1, @@ -363,13 +373,13 @@ declare module "typescript" { kind: SyntaxKind; flags: NodeFlags; parserContextFlags?: ParserContextFlags; + modifiers?: ModifiersArray; id?: number; parent?: Node; symbol?: Symbol; locals?: SymbolTable; nextContainer?: Node; localSymbol?: Symbol; - modifiers?: ModifiersArray; } interface NodeArray extends Array, TextRange { hasTrailingComma?: boolean; @@ -558,7 +568,7 @@ declare module "typescript" { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { @@ -733,20 +743,49 @@ declare module "typescript" { name: Identifier; members: NodeArray; } - interface ModuleDeclaration extends Declaration, ModuleElement { + interface ExportContainer { + exportStars?: ExportDeclaration[]; + } + interface ModuleDeclaration extends Declaration, ModuleElement, ExportContainer { name: Identifier | LiteralExpression; body: ModuleBlock | ModuleDeclaration; } interface ModuleBlock extends Node, ModuleElement { statements: NodeArray; } - interface ImportDeclaration extends Declaration, ModuleElement { + interface ImportEqualsDeclaration extends Declaration, ModuleElement { name: Identifier; moduleReference: EntityName | ExternalModuleReference; } interface ExternalModuleReference extends Node { expression?: Expression; } + interface ImportDeclaration extends Statement, ModuleElement { + importClause?: ImportClause; + moduleSpecifier: Expression; + } + interface ImportClause extends Declaration { + name?: Identifier; + namedBindings?: NamespaceImport | NamedImports; + } + interface NamespaceImport extends Declaration { + name: Identifier; + } + interface ExportDeclaration extends Statement, ModuleElement { + exportClause?: NamedExports; + moduleSpecifier?: Expression; + } + interface NamedImportsOrExports extends Node { + elements: NodeArray; + } + type NamedImports = NamedImportsOrExports; + type NamedExports = NamedImportsOrExports; + interface ImportOrExportSpecifier extends Declaration { + propertyName?: Identifier; + name: Identifier; + } + type ImportSpecifier = ImportOrExportSpecifier; + type ExportSpecifier = ImportOrExportSpecifier; interface ExportAssignment extends Statement, ModuleElement { exportName: Identifier; } @@ -756,7 +795,7 @@ declare module "typescript" { interface CommentRange extends TextRange { hasTrailingNewLine?: boolean; } - interface SourceFile extends Declaration { + interface SourceFile extends Declaration, ExportContainer { statements: NodeArray; endOfFileToken: Node; fileName: string; @@ -910,7 +949,7 @@ declare module "typescript" { } interface SymbolVisibilityResult { accessibility: SymbolAccessibility; - aliasesToMakeVisible?: ImportDeclaration[]; + aliasesToMakeVisible?: ImportEqualsDeclaration[]; errorSymbolName?: string; errorNode?: Node; } @@ -918,11 +957,11 @@ declare module "typescript" { errorModuleName?: string; } interface EmitResolver { - getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string; - getExpressionNamePrefix(node: Identifier): string; + getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration): string; + getExpressionNameSubstitution(node: Identifier): string; getExportAssignmentName(node: SourceFile): string; - isReferencedImportDeclaration(node: ImportDeclaration): boolean; - isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean; + isReferencedImportDeclaration(node: Node): boolean; + isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; getNodeCheckFlags(node: Node): NodeCheckFlags; isDeclarationVisible(node: Declaration): boolean; isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; @@ -1017,8 +1056,10 @@ declare module "typescript" { declaredType?: Type; mapper?: TypeMapper; referenced?: boolean; - exportAssignSymbol?: Symbol; + exportAssignmentChecked?: boolean; + exportAssignmentSymbol?: Symbol; unionType?: UnionType; + resolvedExports?: SymbolTable; } interface TransientSymbol extends Symbol, SymbolLinks { } @@ -1043,7 +1084,8 @@ declare module "typescript" { enumMemberValue?: number; isIllegalTypeReferenceInConstraint?: boolean; isVisible?: boolean; - localModuleName?: string; + generatedName?: string; + generatedNames?: Map; assignmentChecks?: Map; hasReportedStatementInAmbientContext?: boolean; importOnRightSide?: Symbol; @@ -1357,6 +1399,7 @@ declare module "typescript" { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, @@ -1423,8 +1466,8 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; @@ -1508,9 +1551,9 @@ declare module "typescript" { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -1572,7 +1615,7 @@ declare module "typescript" { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; @@ -1985,25 +2028,26 @@ function delint(sourceFile) { delintNode(sourceFile); function delintNode(node) { switch (node.kind) { - case 179 /* ForStatement */: - case 180 /* ForInStatement */: - case 178 /* WhileStatement */: - case 177 /* DoStatement */: - if (node.statement.kind !== 172 /* Block */) { + case 181 /* ForStatement */: + case 182 /* ForInStatement */: + case 180 /* WhileStatement */: + case 179 /* DoStatement */: + if (node.statement.kind !== 174 /* Block */) { report(node, "A looping statement's contents should be wrapped in a block body."); } break; - case 176 /* IfStatement */: + case 178 /* IfStatement */: var ifStatement = node; - if (ifStatement.thenStatement.kind !== 172 /* Block */) { + if (ifStatement.thenStatement.kind !== 174 /* Block */) { report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body."); } - if (ifStatement.elseStatement && ifStatement.elseStatement.kind !== 172 /* Block */ && ifStatement.elseStatement.kind !== 176 /* IfStatement */) { + if (ifStatement.elseStatement && + ifStatement.elseStatement.kind !== 174 /* Block */ && ifStatement.elseStatement.kind !== 178 /* IfStatement */) { report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body."); } break; - case 165 /* BinaryExpression */: - var op = node.operator; + case 167 /* BinaryExpression */: + var op = node.operatorToken.kind; if (op === 28 /* EqualsEqualsToken */ || op === 29 /* ExclamationEqualsToken */) { report(node, "Use '===' and '!=='."); } @@ -2012,8 +2056,8 @@ function delint(sourceFile) { ts.forEachChild(node, delintNode); } function report(node, message) { - var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); - console.log(sourceFile.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + message); + var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); + console.log(sourceFile.fileName + " (" + (lineChar.line + 1) + "," + (lineChar.character + 1) + "): " + message); } } exports.delint = delint; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 8caa6855e84..0adce16104c 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -173,15 +173,17 @@ export function delint(sourceFile: ts.SourceFile) { >SyntaxKind : typeof ts.SyntaxKind >BinaryExpression : ts.SyntaxKind - var op = (node).operator; + var op = (node).operatorToken.kind; >op : ts.SyntaxKind ->(node).operator : ts.SyntaxKind +>(node).operatorToken.kind : ts.SyntaxKind +>(node).operatorToken : ts.Node >(node) : ts.BinaryExpression >node : ts.BinaryExpression >ts : unknown >BinaryExpression : ts.BinaryExpression >node : ts.Node ->operator : ts.SyntaxKind +>operatorToken : ts.Node +>kind : ts.SyntaxKind if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) { >op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken : boolean @@ -224,28 +226,30 @@ export function delint(sourceFile: ts.SourceFile) { >Node : ts.Node >message : string - var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); + var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); >lineChar : ts.LineAndCharacter ->sourceFile.getLineAndCharacterFromPosition(node.getStart()) : ts.LineAndCharacter ->sourceFile.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>sourceFile.getLineAndCharacterOfPosition(node.getStart()) : ts.LineAndCharacter +>sourceFile.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >sourceFile : ts.SourceFile ->getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >node.getStart() : number >node.getStart : (sourceFile?: ts.SourceFile) => number >node : ts.Node >getStart : (sourceFile?: ts.SourceFile) => number - console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) ->console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) : any + console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) +>console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) : any >console.log : any >console : any >log : any >sourceFile.fileName : string >sourceFile : ts.SourceFile >fileName : string +>lineChar.line + 1 : number >lineChar.line : number >lineChar : ts.LineAndCharacter >line : number +>lineChar.character + 1 : number >lineChar.character : number >lineChar : ts.LineAndCharacter >character : number @@ -640,340 +644,370 @@ declare module "typescript" { WithKeyword = 100, >WithKeyword : SyntaxKind - ImplementsKeyword = 101, + AsKeyword = 101, +>AsKeyword : SyntaxKind + + FromKeyword = 102, +>FromKeyword : SyntaxKind + + ImplementsKeyword = 103, >ImplementsKeyword : SyntaxKind - InterfaceKeyword = 102, + InterfaceKeyword = 104, >InterfaceKeyword : SyntaxKind - LetKeyword = 103, + LetKeyword = 105, >LetKeyword : SyntaxKind - PackageKeyword = 104, + PackageKeyword = 106, >PackageKeyword : SyntaxKind - PrivateKeyword = 105, + PrivateKeyword = 107, >PrivateKeyword : SyntaxKind - ProtectedKeyword = 106, + ProtectedKeyword = 108, >ProtectedKeyword : SyntaxKind - PublicKeyword = 107, + PublicKeyword = 109, >PublicKeyword : SyntaxKind - StaticKeyword = 108, + StaticKeyword = 110, >StaticKeyword : SyntaxKind - YieldKeyword = 109, + YieldKeyword = 111, >YieldKeyword : SyntaxKind - AnyKeyword = 110, + AnyKeyword = 112, >AnyKeyword : SyntaxKind - BooleanKeyword = 111, + BooleanKeyword = 113, >BooleanKeyword : SyntaxKind - ConstructorKeyword = 112, + ConstructorKeyword = 114, >ConstructorKeyword : SyntaxKind - DeclareKeyword = 113, + DeclareKeyword = 115, >DeclareKeyword : SyntaxKind - GetKeyword = 114, + GetKeyword = 116, >GetKeyword : SyntaxKind - ModuleKeyword = 115, + ModuleKeyword = 117, >ModuleKeyword : SyntaxKind - RequireKeyword = 116, + RequireKeyword = 118, >RequireKeyword : SyntaxKind - NumberKeyword = 117, + NumberKeyword = 119, >NumberKeyword : SyntaxKind - SetKeyword = 118, + SetKeyword = 120, >SetKeyword : SyntaxKind - StringKeyword = 119, + StringKeyword = 121, >StringKeyword : SyntaxKind - SymbolKeyword = 120, + SymbolKeyword = 122, >SymbolKeyword : SyntaxKind - TypeKeyword = 121, + TypeKeyword = 123, >TypeKeyword : SyntaxKind - OfKeyword = 122, + OfKeyword = 124, >OfKeyword : SyntaxKind - QualifiedName = 123, + QualifiedName = 125, >QualifiedName : SyntaxKind - ComputedPropertyName = 124, + ComputedPropertyName = 126, >ComputedPropertyName : SyntaxKind - TypeParameter = 125, + TypeParameter = 127, >TypeParameter : SyntaxKind - Parameter = 126, + Parameter = 128, >Parameter : SyntaxKind - PropertySignature = 127, + PropertySignature = 129, >PropertySignature : SyntaxKind - PropertyDeclaration = 128, + PropertyDeclaration = 130, >PropertyDeclaration : SyntaxKind - MethodSignature = 129, + MethodSignature = 131, >MethodSignature : SyntaxKind - MethodDeclaration = 130, + MethodDeclaration = 132, >MethodDeclaration : SyntaxKind - Constructor = 131, + Constructor = 133, >Constructor : SyntaxKind - GetAccessor = 132, + GetAccessor = 134, >GetAccessor : SyntaxKind - SetAccessor = 133, + SetAccessor = 135, >SetAccessor : SyntaxKind - CallSignature = 134, + CallSignature = 136, >CallSignature : SyntaxKind - ConstructSignature = 135, + ConstructSignature = 137, >ConstructSignature : SyntaxKind - IndexSignature = 136, + IndexSignature = 138, >IndexSignature : SyntaxKind - TypeReference = 137, + TypeReference = 139, >TypeReference : SyntaxKind - FunctionType = 138, + FunctionType = 140, >FunctionType : SyntaxKind - ConstructorType = 139, + ConstructorType = 141, >ConstructorType : SyntaxKind - TypeQuery = 140, + TypeQuery = 142, >TypeQuery : SyntaxKind - TypeLiteral = 141, + TypeLiteral = 143, >TypeLiteral : SyntaxKind - ArrayType = 142, + ArrayType = 144, >ArrayType : SyntaxKind - TupleType = 143, + TupleType = 145, >TupleType : SyntaxKind - UnionType = 144, + UnionType = 146, >UnionType : SyntaxKind - ParenthesizedType = 145, + ParenthesizedType = 147, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 146, + ObjectBindingPattern = 148, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 147, + ArrayBindingPattern = 149, >ArrayBindingPattern : SyntaxKind - BindingElement = 148, + BindingElement = 150, >BindingElement : SyntaxKind - ArrayLiteralExpression = 149, + ArrayLiteralExpression = 151, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 150, + ObjectLiteralExpression = 152, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 151, + PropertyAccessExpression = 153, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 152, + ElementAccessExpression = 154, >ElementAccessExpression : SyntaxKind - CallExpression = 153, + CallExpression = 155, >CallExpression : SyntaxKind - NewExpression = 154, + NewExpression = 156, >NewExpression : SyntaxKind - TaggedTemplateExpression = 155, + TaggedTemplateExpression = 157, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 156, + TypeAssertionExpression = 158, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 157, + ParenthesizedExpression = 159, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 158, + FunctionExpression = 160, >FunctionExpression : SyntaxKind - ArrowFunction = 159, + ArrowFunction = 161, >ArrowFunction : SyntaxKind - DeleteExpression = 160, + DeleteExpression = 162, >DeleteExpression : SyntaxKind - TypeOfExpression = 161, + TypeOfExpression = 163, >TypeOfExpression : SyntaxKind - VoidExpression = 162, + VoidExpression = 164, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 163, + PrefixUnaryExpression = 165, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 164, + PostfixUnaryExpression = 166, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 165, + BinaryExpression = 167, >BinaryExpression : SyntaxKind - ConditionalExpression = 166, + ConditionalExpression = 168, >ConditionalExpression : SyntaxKind - TemplateExpression = 167, + TemplateExpression = 169, >TemplateExpression : SyntaxKind - YieldExpression = 168, + YieldExpression = 170, >YieldExpression : SyntaxKind - SpreadElementExpression = 169, + SpreadElementExpression = 171, >SpreadElementExpression : SyntaxKind - OmittedExpression = 170, + OmittedExpression = 172, >OmittedExpression : SyntaxKind - TemplateSpan = 171, + TemplateSpan = 173, >TemplateSpan : SyntaxKind - Block = 172, + Block = 174, >Block : SyntaxKind - VariableStatement = 173, + VariableStatement = 175, >VariableStatement : SyntaxKind - EmptyStatement = 174, + EmptyStatement = 176, >EmptyStatement : SyntaxKind - ExpressionStatement = 175, + ExpressionStatement = 177, >ExpressionStatement : SyntaxKind - IfStatement = 176, + IfStatement = 178, >IfStatement : SyntaxKind - DoStatement = 177, + DoStatement = 179, >DoStatement : SyntaxKind - WhileStatement = 178, + WhileStatement = 180, >WhileStatement : SyntaxKind - ForStatement = 179, + ForStatement = 181, >ForStatement : SyntaxKind - ForInStatement = 180, + ForInStatement = 182, >ForInStatement : SyntaxKind - ForOfStatement = 181, + ForOfStatement = 183, >ForOfStatement : SyntaxKind - ContinueStatement = 182, + ContinueStatement = 184, >ContinueStatement : SyntaxKind - BreakStatement = 183, + BreakStatement = 185, >BreakStatement : SyntaxKind - ReturnStatement = 184, + ReturnStatement = 186, >ReturnStatement : SyntaxKind - WithStatement = 185, + WithStatement = 187, >WithStatement : SyntaxKind - SwitchStatement = 186, + SwitchStatement = 188, >SwitchStatement : SyntaxKind - LabeledStatement = 187, + LabeledStatement = 189, >LabeledStatement : SyntaxKind - ThrowStatement = 188, + ThrowStatement = 190, >ThrowStatement : SyntaxKind - TryStatement = 189, + TryStatement = 191, >TryStatement : SyntaxKind - DebuggerStatement = 190, + DebuggerStatement = 192, >DebuggerStatement : SyntaxKind - VariableDeclaration = 191, + VariableDeclaration = 193, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 192, + VariableDeclarationList = 194, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 193, + FunctionDeclaration = 195, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 194, + ClassDeclaration = 196, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 195, + InterfaceDeclaration = 197, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 196, + TypeAliasDeclaration = 198, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 197, + EnumDeclaration = 199, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 198, + ModuleDeclaration = 200, >ModuleDeclaration : SyntaxKind - ModuleBlock = 199, + ModuleBlock = 201, >ModuleBlock : SyntaxKind - ImportDeclaration = 200, + ImportEqualsDeclaration = 202, +>ImportEqualsDeclaration : SyntaxKind + + ImportDeclaration = 203, >ImportDeclaration : SyntaxKind - ExportAssignment = 201, + ImportClause = 204, +>ImportClause : SyntaxKind + + NamespaceImport = 205, +>NamespaceImport : SyntaxKind + + NamedImports = 206, +>NamedImports : SyntaxKind + + ImportSpecifier = 207, +>ImportSpecifier : SyntaxKind + + ExportAssignment = 208, >ExportAssignment : SyntaxKind - ExternalModuleReference = 202, + ExportDeclaration = 209, +>ExportDeclaration : SyntaxKind + + NamedExports = 210, +>NamedExports : SyntaxKind + + ExportSpecifier = 211, +>ExportSpecifier : SyntaxKind + + ExternalModuleReference = 212, >ExternalModuleReference : SyntaxKind - CaseClause = 203, + CaseClause = 213, >CaseClause : SyntaxKind - DefaultClause = 204, + DefaultClause = 214, >DefaultClause : SyntaxKind - HeritageClause = 205, + HeritageClause = 215, >HeritageClause : SyntaxKind - CatchClause = 206, + CatchClause = 216, >CatchClause : SyntaxKind - PropertyAssignment = 207, + PropertyAssignment = 217, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 208, + ShorthandPropertyAssignment = 218, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 209, + EnumMember = 219, >EnumMember : SyntaxKind - SourceFile = 210, + SourceFile = 220, >SourceFile : SyntaxKind - SyntaxList = 211, + SyntaxList = 221, >SyntaxList : SyntaxKind - Count = 212, + Count = 222, >Count : SyntaxKind FirstAssignment = 52, @@ -991,19 +1025,19 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 122, + LastKeyword = 124, >LastKeyword : SyntaxKind - FirstFutureReservedWord = 101, + FirstFutureReservedWord = 103, >FirstFutureReservedWord : SyntaxKind - LastFutureReservedWord = 109, + LastFutureReservedWord = 111, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 137, + FirstTypeNode = 139, >FirstTypeNode : SyntaxKind - LastTypeNode = 145, + LastTypeNode = 147, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -1015,7 +1049,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 122, + LastToken = 124, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -1042,7 +1076,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 123, + FirstNode = 125, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -1148,6 +1182,10 @@ declare module "typescript" { >parserContextFlags : ParserContextFlags >ParserContextFlags : ParserContextFlags + modifiers?: ModifiersArray; +>modifiers : ModifiersArray +>ModifiersArray : ModifiersArray + id?: number; >id : number @@ -1170,10 +1208,6 @@ declare module "typescript" { localSymbol?: Symbol; >localSymbol : Symbol >Symbol : Symbol - - modifiers?: ModifiersArray; ->modifiers : ModifiersArray ->ModifiersArray : ModifiersArray } interface NodeArray extends Array, TextRange { >NodeArray : NodeArray @@ -1729,9 +1763,9 @@ declare module "typescript" { >left : Expression >Expression : Expression - operator: SyntaxKind; ->operator : SyntaxKind ->SyntaxKind : SyntaxKind + operatorToken: Node; +>operatorToken : Node +>Node : Node right: Expression; >right : Expression @@ -2272,10 +2306,18 @@ declare module "typescript" { >NodeArray : NodeArray >EnumMember : EnumMember } - interface ModuleDeclaration extends Declaration, ModuleElement { + interface ExportContainer { +>ExportContainer : ExportContainer + + exportStars?: ExportDeclaration[]; +>exportStars : ExportDeclaration[] +>ExportDeclaration : ExportDeclaration + } + interface ModuleDeclaration extends Declaration, ModuleElement, ExportContainer { >ModuleDeclaration : ModuleDeclaration >Declaration : Declaration >ModuleElement : ModuleElement +>ExportContainer : ExportContainer name: Identifier | LiteralExpression; >name : Identifier | LiteralExpression @@ -2297,8 +2339,8 @@ declare module "typescript" { >NodeArray : NodeArray >ModuleElement : ModuleElement } - interface ImportDeclaration extends Declaration, ModuleElement { ->ImportDeclaration : ImportDeclaration + interface ImportEqualsDeclaration extends Declaration, ModuleElement { +>ImportEqualsDeclaration : ImportEqualsDeclaration >Declaration : Declaration >ModuleElement : ModuleElement @@ -2319,6 +2361,90 @@ declare module "typescript" { >expression : Expression >Expression : Expression } + interface ImportDeclaration extends Statement, ModuleElement { +>ImportDeclaration : ImportDeclaration +>Statement : Statement +>ModuleElement : ModuleElement + + importClause?: ImportClause; +>importClause : ImportClause +>ImportClause : ImportClause + + moduleSpecifier: Expression; +>moduleSpecifier : Expression +>Expression : Expression + } + interface ImportClause extends Declaration { +>ImportClause : ImportClause +>Declaration : Declaration + + name?: Identifier; +>name : Identifier +>Identifier : Identifier + + namedBindings?: NamespaceImport | NamedImports; +>namedBindings : NamespaceImport | NamedImportsOrExports +>NamespaceImport : NamespaceImport +>NamedImports : NamedImportsOrExports + } + interface NamespaceImport extends Declaration { +>NamespaceImport : NamespaceImport +>Declaration : Declaration + + name: Identifier; +>name : Identifier +>Identifier : Identifier + } + interface ExportDeclaration extends Statement, ModuleElement { +>ExportDeclaration : ExportDeclaration +>Statement : Statement +>ModuleElement : ModuleElement + + exportClause?: NamedExports; +>exportClause : NamedImportsOrExports +>NamedExports : NamedImportsOrExports + + moduleSpecifier?: Expression; +>moduleSpecifier : Expression +>Expression : Expression + } + interface NamedImportsOrExports extends Node { +>NamedImportsOrExports : NamedImportsOrExports +>Node : Node + + elements: NodeArray; +>elements : NodeArray +>NodeArray : NodeArray +>ImportOrExportSpecifier : ImportOrExportSpecifier + } + type NamedImports = NamedImportsOrExports; +>NamedImports : NamedImportsOrExports +>NamedImportsOrExports : NamedImportsOrExports + + type NamedExports = NamedImportsOrExports; +>NamedExports : NamedImportsOrExports +>NamedImportsOrExports : NamedImportsOrExports + + interface ImportOrExportSpecifier extends Declaration { +>ImportOrExportSpecifier : ImportOrExportSpecifier +>Declaration : Declaration + + propertyName?: Identifier; +>propertyName : Identifier +>Identifier : Identifier + + name: Identifier; +>name : Identifier +>Identifier : Identifier + } + type ImportSpecifier = ImportOrExportSpecifier; +>ImportSpecifier : ImportOrExportSpecifier +>ImportOrExportSpecifier : ImportOrExportSpecifier + + type ExportSpecifier = ImportOrExportSpecifier; +>ExportSpecifier : ImportOrExportSpecifier +>ImportOrExportSpecifier : ImportOrExportSpecifier + interface ExportAssignment extends Statement, ModuleElement { >ExportAssignment : ExportAssignment >Statement : Statement @@ -2342,9 +2468,10 @@ declare module "typescript" { hasTrailingNewLine?: boolean; >hasTrailingNewLine : boolean } - interface SourceFile extends Declaration { + interface SourceFile extends Declaration, ExportContainer { >SourceFile : SourceFile >Declaration : Declaration +>ExportContainer : ExportContainer statements: NodeArray; >statements : NodeArray @@ -2958,9 +3085,9 @@ declare module "typescript" { >accessibility : SymbolAccessibility >SymbolAccessibility : SymbolAccessibility - aliasesToMakeVisible?: ImportDeclaration[]; ->aliasesToMakeVisible : ImportDeclaration[] ->ImportDeclaration : ImportDeclaration + aliasesToMakeVisible?: ImportEqualsDeclaration[]; +>aliasesToMakeVisible : ImportEqualsDeclaration[] +>ImportEqualsDeclaration : ImportEqualsDeclaration errorSymbolName?: string; >errorSymbolName : string @@ -2979,14 +3106,16 @@ declare module "typescript" { interface EmitResolver { >EmitResolver : EmitResolver - getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string; ->getLocalNameOfContainer : (container: EnumDeclaration | ModuleDeclaration) => string ->container : EnumDeclaration | ModuleDeclaration + getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration): string; +>getGeneratedNameForNode : (node: EnumDeclaration | ExportDeclaration | ModuleDeclaration | ImportDeclaration) => string +>node : EnumDeclaration | ExportDeclaration | ModuleDeclaration | ImportDeclaration >ModuleDeclaration : ModuleDeclaration >EnumDeclaration : EnumDeclaration +>ImportDeclaration : ImportDeclaration +>ExportDeclaration : ExportDeclaration - getExpressionNamePrefix(node: Identifier): string; ->getExpressionNamePrefix : (node: Identifier) => string + getExpressionNameSubstitution(node: Identifier): string; +>getExpressionNameSubstitution : (node: Identifier) => string >node : Identifier >Identifier : Identifier @@ -2995,15 +3124,15 @@ declare module "typescript" { >node : SourceFile >SourceFile : SourceFile - isReferencedImportDeclaration(node: ImportDeclaration): boolean; ->isReferencedImportDeclaration : (node: ImportDeclaration) => boolean ->node : ImportDeclaration ->ImportDeclaration : ImportDeclaration + isReferencedImportDeclaration(node: Node): boolean; +>isReferencedImportDeclaration : (node: Node) => boolean +>node : Node +>Node : Node - isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean; ->isTopLevelValueImportWithEntityName : (node: ImportDeclaration) => boolean ->node : ImportDeclaration ->ImportDeclaration : ImportDeclaration + isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; +>isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean +>node : ImportEqualsDeclaration +>ImportEqualsDeclaration : ImportEqualsDeclaration getNodeCheckFlags(node: Node): NodeCheckFlags; >getNodeCheckFlags : (node: Node) => NodeCheckFlags @@ -3332,13 +3461,20 @@ declare module "typescript" { referenced?: boolean; >referenced : boolean - exportAssignSymbol?: Symbol; ->exportAssignSymbol : Symbol + exportAssignmentChecked?: boolean; +>exportAssignmentChecked : boolean + + exportAssignmentSymbol?: Symbol; +>exportAssignmentSymbol : Symbol >Symbol : Symbol unionType?: UnionType; >unionType : UnionType >UnionType : UnionType + + resolvedExports?: SymbolTable; +>resolvedExports : SymbolTable +>SymbolTable : SymbolTable } interface TransientSymbol extends Symbol, SymbolLinks { >TransientSymbol : TransientSymbol @@ -3407,8 +3543,12 @@ declare module "typescript" { isVisible?: boolean; >isVisible : boolean - localModuleName?: string; ->localModuleName : string + generatedName?: string; +>generatedName : string + + generatedNames?: Map; +>generatedNames : Map +>Map : Map assignmentChecks?: Map; >assignmentChecks : Map @@ -4332,6 +4472,9 @@ declare module "typescript" { greaterThan = 62, >greaterThan : CharacterCodes + hash = 35, +>hash : CharacterCodes + lessThan = 60, >lessThan : CharacterCodes @@ -4537,15 +4680,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -4904,16 +5047,16 @@ declare module "typescript" { >getNamedDeclarations : () => Declaration[] >Declaration : Declaration - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; ->getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter >pos : number >LineAndCharacter : LineAndCharacter getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromLineAndCharacter(line: number, character: number): number; ->getPositionFromLineAndCharacter : (line: number, character: number) => number + getPositionOfLineAndCharacter(line: number, character: number): number; +>getPositionOfLineAndCharacter : (line: number, character: number) => number >line : number >character : number @@ -5130,9 +5273,10 @@ declare module "typescript" { >position : number >ReferenceEntry : ReferenceEntry - getNavigateToItems(searchValue: string): NavigateToItem[]; ->getNavigateToItems : (searchValue: string) => NavigateToItem[] + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; +>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] >searchValue : string +>maxResultCount : number >NavigateToItem : NavigateToItem getNavigationBarItems(fileName: string): NavigationBarItem[]; diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 2ccf48a5e6c..4d9d0def9d9 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -54,7 +54,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { return { outputs: outputs, errors: errors.map(function (e) { - return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) }; @@ -192,132 +192,142 @@ declare module "typescript" { VoidKeyword = 98, WhileKeyword = 99, WithKeyword = 100, - ImplementsKeyword = 101, - InterfaceKeyword = 102, - LetKeyword = 103, - PackageKeyword = 104, - PrivateKeyword = 105, - ProtectedKeyword = 106, - PublicKeyword = 107, - StaticKeyword = 108, - YieldKeyword = 109, - AnyKeyword = 110, - BooleanKeyword = 111, - ConstructorKeyword = 112, - DeclareKeyword = 113, - GetKeyword = 114, - ModuleKeyword = 115, - RequireKeyword = 116, - NumberKeyword = 117, - SetKeyword = 118, - StringKeyword = 119, - SymbolKeyword = 120, - TypeKeyword = 121, - OfKeyword = 122, - QualifiedName = 123, - ComputedPropertyName = 124, - TypeParameter = 125, - Parameter = 126, - PropertySignature = 127, - PropertyDeclaration = 128, - MethodSignature = 129, - MethodDeclaration = 130, - Constructor = 131, - GetAccessor = 132, - SetAccessor = 133, - CallSignature = 134, - ConstructSignature = 135, - IndexSignature = 136, - TypeReference = 137, - FunctionType = 138, - ConstructorType = 139, - TypeQuery = 140, - TypeLiteral = 141, - ArrayType = 142, - TupleType = 143, - UnionType = 144, - ParenthesizedType = 145, - ObjectBindingPattern = 146, - ArrayBindingPattern = 147, - BindingElement = 148, - ArrayLiteralExpression = 149, - ObjectLiteralExpression = 150, - PropertyAccessExpression = 151, - ElementAccessExpression = 152, - CallExpression = 153, - NewExpression = 154, - TaggedTemplateExpression = 155, - TypeAssertionExpression = 156, - ParenthesizedExpression = 157, - FunctionExpression = 158, - ArrowFunction = 159, - DeleteExpression = 160, - TypeOfExpression = 161, - VoidExpression = 162, - PrefixUnaryExpression = 163, - PostfixUnaryExpression = 164, - BinaryExpression = 165, - ConditionalExpression = 166, - TemplateExpression = 167, - YieldExpression = 168, - SpreadElementExpression = 169, - OmittedExpression = 170, - TemplateSpan = 171, - Block = 172, - VariableStatement = 173, - EmptyStatement = 174, - ExpressionStatement = 175, - IfStatement = 176, - DoStatement = 177, - WhileStatement = 178, - ForStatement = 179, - ForInStatement = 180, - ForOfStatement = 181, - ContinueStatement = 182, - BreakStatement = 183, - ReturnStatement = 184, - WithStatement = 185, - SwitchStatement = 186, - LabeledStatement = 187, - ThrowStatement = 188, - TryStatement = 189, - DebuggerStatement = 190, - VariableDeclaration = 191, - VariableDeclarationList = 192, - FunctionDeclaration = 193, - ClassDeclaration = 194, - InterfaceDeclaration = 195, - TypeAliasDeclaration = 196, - EnumDeclaration = 197, - ModuleDeclaration = 198, - ModuleBlock = 199, - ImportDeclaration = 200, - ExportAssignment = 201, - ExternalModuleReference = 202, - CaseClause = 203, - DefaultClause = 204, - HeritageClause = 205, - CatchClause = 206, - PropertyAssignment = 207, - ShorthandPropertyAssignment = 208, - EnumMember = 209, - SourceFile = 210, - SyntaxList = 211, - Count = 212, + AsKeyword = 101, + FromKeyword = 102, + ImplementsKeyword = 103, + InterfaceKeyword = 104, + LetKeyword = 105, + PackageKeyword = 106, + PrivateKeyword = 107, + ProtectedKeyword = 108, + PublicKeyword = 109, + StaticKeyword = 110, + YieldKeyword = 111, + AnyKeyword = 112, + BooleanKeyword = 113, + ConstructorKeyword = 114, + DeclareKeyword = 115, + GetKeyword = 116, + ModuleKeyword = 117, + RequireKeyword = 118, + NumberKeyword = 119, + SetKeyword = 120, + StringKeyword = 121, + SymbolKeyword = 122, + TypeKeyword = 123, + OfKeyword = 124, + QualifiedName = 125, + ComputedPropertyName = 126, + TypeParameter = 127, + Parameter = 128, + PropertySignature = 129, + PropertyDeclaration = 130, + MethodSignature = 131, + MethodDeclaration = 132, + Constructor = 133, + GetAccessor = 134, + SetAccessor = 135, + CallSignature = 136, + ConstructSignature = 137, + IndexSignature = 138, + TypeReference = 139, + FunctionType = 140, + ConstructorType = 141, + TypeQuery = 142, + TypeLiteral = 143, + ArrayType = 144, + TupleType = 145, + UnionType = 146, + ParenthesizedType = 147, + ObjectBindingPattern = 148, + ArrayBindingPattern = 149, + BindingElement = 150, + ArrayLiteralExpression = 151, + ObjectLiteralExpression = 152, + PropertyAccessExpression = 153, + ElementAccessExpression = 154, + CallExpression = 155, + NewExpression = 156, + TaggedTemplateExpression = 157, + TypeAssertionExpression = 158, + ParenthesizedExpression = 159, + FunctionExpression = 160, + ArrowFunction = 161, + DeleteExpression = 162, + TypeOfExpression = 163, + VoidExpression = 164, + PrefixUnaryExpression = 165, + PostfixUnaryExpression = 166, + BinaryExpression = 167, + ConditionalExpression = 168, + TemplateExpression = 169, + YieldExpression = 170, + SpreadElementExpression = 171, + OmittedExpression = 172, + TemplateSpan = 173, + Block = 174, + VariableStatement = 175, + EmptyStatement = 176, + ExpressionStatement = 177, + IfStatement = 178, + DoStatement = 179, + WhileStatement = 180, + ForStatement = 181, + ForInStatement = 182, + ForOfStatement = 183, + ContinueStatement = 184, + BreakStatement = 185, + ReturnStatement = 186, + WithStatement = 187, + SwitchStatement = 188, + LabeledStatement = 189, + ThrowStatement = 190, + TryStatement = 191, + DebuggerStatement = 192, + VariableDeclaration = 193, + VariableDeclarationList = 194, + FunctionDeclaration = 195, + ClassDeclaration = 196, + InterfaceDeclaration = 197, + TypeAliasDeclaration = 198, + EnumDeclaration = 199, + ModuleDeclaration = 200, + ModuleBlock = 201, + ImportEqualsDeclaration = 202, + ImportDeclaration = 203, + ImportClause = 204, + NamespaceImport = 205, + NamedImports = 206, + ImportSpecifier = 207, + ExportAssignment = 208, + ExportDeclaration = 209, + NamedExports = 210, + ExportSpecifier = 211, + ExternalModuleReference = 212, + CaseClause = 213, + DefaultClause = 214, + HeritageClause = 215, + CatchClause = 216, + PropertyAssignment = 217, + ShorthandPropertyAssignment = 218, + EnumMember = 219, + SourceFile = 220, + SyntaxList = 221, + Count = 222, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 122, - FirstFutureReservedWord = 101, - LastFutureReservedWord = 109, - FirstTypeNode = 137, - LastTypeNode = 145, + LastKeyword = 124, + FirstFutureReservedWord = 103, + LastFutureReservedWord = 111, + FirstTypeNode = 139, + LastTypeNode = 147, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 122, + LastToken = 124, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -326,7 +336,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 123, + FirstNode = 125, } const enum NodeFlags { Export = 1, @@ -364,13 +374,13 @@ declare module "typescript" { kind: SyntaxKind; flags: NodeFlags; parserContextFlags?: ParserContextFlags; + modifiers?: ModifiersArray; id?: number; parent?: Node; symbol?: Symbol; locals?: SymbolTable; nextContainer?: Node; localSymbol?: Symbol; - modifiers?: ModifiersArray; } interface NodeArray extends Array, TextRange { hasTrailingComma?: boolean; @@ -559,7 +569,7 @@ declare module "typescript" { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { @@ -734,20 +744,49 @@ declare module "typescript" { name: Identifier; members: NodeArray; } - interface ModuleDeclaration extends Declaration, ModuleElement { + interface ExportContainer { + exportStars?: ExportDeclaration[]; + } + interface ModuleDeclaration extends Declaration, ModuleElement, ExportContainer { name: Identifier | LiteralExpression; body: ModuleBlock | ModuleDeclaration; } interface ModuleBlock extends Node, ModuleElement { statements: NodeArray; } - interface ImportDeclaration extends Declaration, ModuleElement { + interface ImportEqualsDeclaration extends Declaration, ModuleElement { name: Identifier; moduleReference: EntityName | ExternalModuleReference; } interface ExternalModuleReference extends Node { expression?: Expression; } + interface ImportDeclaration extends Statement, ModuleElement { + importClause?: ImportClause; + moduleSpecifier: Expression; + } + interface ImportClause extends Declaration { + name?: Identifier; + namedBindings?: NamespaceImport | NamedImports; + } + interface NamespaceImport extends Declaration { + name: Identifier; + } + interface ExportDeclaration extends Statement, ModuleElement { + exportClause?: NamedExports; + moduleSpecifier?: Expression; + } + interface NamedImportsOrExports extends Node { + elements: NodeArray; + } + type NamedImports = NamedImportsOrExports; + type NamedExports = NamedImportsOrExports; + interface ImportOrExportSpecifier extends Declaration { + propertyName?: Identifier; + name: Identifier; + } + type ImportSpecifier = ImportOrExportSpecifier; + type ExportSpecifier = ImportOrExportSpecifier; interface ExportAssignment extends Statement, ModuleElement { exportName: Identifier; } @@ -757,7 +796,7 @@ declare module "typescript" { interface CommentRange extends TextRange { hasTrailingNewLine?: boolean; } - interface SourceFile extends Declaration { + interface SourceFile extends Declaration, ExportContainer { statements: NodeArray; endOfFileToken: Node; fileName: string; @@ -911,7 +950,7 @@ declare module "typescript" { } interface SymbolVisibilityResult { accessibility: SymbolAccessibility; - aliasesToMakeVisible?: ImportDeclaration[]; + aliasesToMakeVisible?: ImportEqualsDeclaration[]; errorSymbolName?: string; errorNode?: Node; } @@ -919,11 +958,11 @@ declare module "typescript" { errorModuleName?: string; } interface EmitResolver { - getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string; - getExpressionNamePrefix(node: Identifier): string; + getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration): string; + getExpressionNameSubstitution(node: Identifier): string; getExportAssignmentName(node: SourceFile): string; - isReferencedImportDeclaration(node: ImportDeclaration): boolean; - isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean; + isReferencedImportDeclaration(node: Node): boolean; + isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; getNodeCheckFlags(node: Node): NodeCheckFlags; isDeclarationVisible(node: Declaration): boolean; isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; @@ -1018,8 +1057,10 @@ declare module "typescript" { declaredType?: Type; mapper?: TypeMapper; referenced?: boolean; - exportAssignSymbol?: Symbol; + exportAssignmentChecked?: boolean; + exportAssignmentSymbol?: Symbol; unionType?: UnionType; + resolvedExports?: SymbolTable; } interface TransientSymbol extends Symbol, SymbolLinks { } @@ -1044,7 +1085,8 @@ declare module "typescript" { enumMemberValue?: number; isIllegalTypeReferenceInConstraint?: boolean; isVisible?: boolean; - localModuleName?: string; + generatedName?: string; + generatedNames?: Map; assignmentChecks?: Map; hasReportedStatementInAmbientContext?: boolean; importOnRightSide?: Symbol; @@ -1358,6 +1400,7 @@ declare module "typescript" { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, @@ -1424,8 +1467,8 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; @@ -1509,9 +1552,9 @@ declare module "typescript" { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -1573,7 +1616,7 @@ declare module "typescript" { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; @@ -2014,7 +2057,7 @@ function transform(contents, compilerOptions) { return { outputs: outputs, errors: errors.map(function (e) { - return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); + return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) }; } diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 60ebae5472d..ad758be0ab1 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -177,7 +177,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { >diagnostics : ts.Diagnostic[] return { ->{ outputs: outputs, errors: errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) } : { outputs: any[]; errors: string[]; } +>{ outputs: outputs, errors: errors.map(function (e) { return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) } : { outputs: any[]; errors: string[]; } outputs: outputs, >outputs : any[] @@ -185,30 +185,32 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { errors: errors.map(function (e) { >errors : string[] ->errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) : string[] +>errors.map(function (e) { return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) : string[] >errors.map : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => U, thisArg?: any) => U[] >errors : ts.Diagnostic[] >map : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => U, thisArg?: any) => U[] ->function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); } : (e: ts.Diagnostic) => string +>function (e) { return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); } : (e: ts.Diagnostic) => string >e : ts.Diagnostic - return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " ->e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL) : string ->e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " : string ->e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line : string + return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " +>e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL) : string +>e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " : string +>e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) : string >e.file.fileName + "(" : string >e.file.fileName : string >e.file : ts.SourceFile >e : ts.Diagnostic >file : ts.SourceFile >fileName : string ->e.file.getLineAndCharacterFromPosition(e.start).line : number ->e.file.getLineAndCharacterFromPosition(e.start) : ts.LineAndCharacter ->e.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>(e.file.getLineAndCharacterOfPosition(e.start).line + 1) : number +>e.file.getLineAndCharacterOfPosition(e.start).line + 1 : number +>e.file.getLineAndCharacterOfPosition(e.start).line : number +>e.file.getLineAndCharacterOfPosition(e.start) : ts.LineAndCharacter +>e.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >e.file : ts.SourceFile >e : ts.Diagnostic >file : ts.SourceFile ->getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >e.start : number >e : ts.Diagnostic >start : number @@ -592,340 +594,370 @@ declare module "typescript" { WithKeyword = 100, >WithKeyword : SyntaxKind - ImplementsKeyword = 101, + AsKeyword = 101, +>AsKeyword : SyntaxKind + + FromKeyword = 102, +>FromKeyword : SyntaxKind + + ImplementsKeyword = 103, >ImplementsKeyword : SyntaxKind - InterfaceKeyword = 102, + InterfaceKeyword = 104, >InterfaceKeyword : SyntaxKind - LetKeyword = 103, + LetKeyword = 105, >LetKeyword : SyntaxKind - PackageKeyword = 104, + PackageKeyword = 106, >PackageKeyword : SyntaxKind - PrivateKeyword = 105, + PrivateKeyword = 107, >PrivateKeyword : SyntaxKind - ProtectedKeyword = 106, + ProtectedKeyword = 108, >ProtectedKeyword : SyntaxKind - PublicKeyword = 107, + PublicKeyword = 109, >PublicKeyword : SyntaxKind - StaticKeyword = 108, + StaticKeyword = 110, >StaticKeyword : SyntaxKind - YieldKeyword = 109, + YieldKeyword = 111, >YieldKeyword : SyntaxKind - AnyKeyword = 110, + AnyKeyword = 112, >AnyKeyword : SyntaxKind - BooleanKeyword = 111, + BooleanKeyword = 113, >BooleanKeyword : SyntaxKind - ConstructorKeyword = 112, + ConstructorKeyword = 114, >ConstructorKeyword : SyntaxKind - DeclareKeyword = 113, + DeclareKeyword = 115, >DeclareKeyword : SyntaxKind - GetKeyword = 114, + GetKeyword = 116, >GetKeyword : SyntaxKind - ModuleKeyword = 115, + ModuleKeyword = 117, >ModuleKeyword : SyntaxKind - RequireKeyword = 116, + RequireKeyword = 118, >RequireKeyword : SyntaxKind - NumberKeyword = 117, + NumberKeyword = 119, >NumberKeyword : SyntaxKind - SetKeyword = 118, + SetKeyword = 120, >SetKeyword : SyntaxKind - StringKeyword = 119, + StringKeyword = 121, >StringKeyword : SyntaxKind - SymbolKeyword = 120, + SymbolKeyword = 122, >SymbolKeyword : SyntaxKind - TypeKeyword = 121, + TypeKeyword = 123, >TypeKeyword : SyntaxKind - OfKeyword = 122, + OfKeyword = 124, >OfKeyword : SyntaxKind - QualifiedName = 123, + QualifiedName = 125, >QualifiedName : SyntaxKind - ComputedPropertyName = 124, + ComputedPropertyName = 126, >ComputedPropertyName : SyntaxKind - TypeParameter = 125, + TypeParameter = 127, >TypeParameter : SyntaxKind - Parameter = 126, + Parameter = 128, >Parameter : SyntaxKind - PropertySignature = 127, + PropertySignature = 129, >PropertySignature : SyntaxKind - PropertyDeclaration = 128, + PropertyDeclaration = 130, >PropertyDeclaration : SyntaxKind - MethodSignature = 129, + MethodSignature = 131, >MethodSignature : SyntaxKind - MethodDeclaration = 130, + MethodDeclaration = 132, >MethodDeclaration : SyntaxKind - Constructor = 131, + Constructor = 133, >Constructor : SyntaxKind - GetAccessor = 132, + GetAccessor = 134, >GetAccessor : SyntaxKind - SetAccessor = 133, + SetAccessor = 135, >SetAccessor : SyntaxKind - CallSignature = 134, + CallSignature = 136, >CallSignature : SyntaxKind - ConstructSignature = 135, + ConstructSignature = 137, >ConstructSignature : SyntaxKind - IndexSignature = 136, + IndexSignature = 138, >IndexSignature : SyntaxKind - TypeReference = 137, + TypeReference = 139, >TypeReference : SyntaxKind - FunctionType = 138, + FunctionType = 140, >FunctionType : SyntaxKind - ConstructorType = 139, + ConstructorType = 141, >ConstructorType : SyntaxKind - TypeQuery = 140, + TypeQuery = 142, >TypeQuery : SyntaxKind - TypeLiteral = 141, + TypeLiteral = 143, >TypeLiteral : SyntaxKind - ArrayType = 142, + ArrayType = 144, >ArrayType : SyntaxKind - TupleType = 143, + TupleType = 145, >TupleType : SyntaxKind - UnionType = 144, + UnionType = 146, >UnionType : SyntaxKind - ParenthesizedType = 145, + ParenthesizedType = 147, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 146, + ObjectBindingPattern = 148, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 147, + ArrayBindingPattern = 149, >ArrayBindingPattern : SyntaxKind - BindingElement = 148, + BindingElement = 150, >BindingElement : SyntaxKind - ArrayLiteralExpression = 149, + ArrayLiteralExpression = 151, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 150, + ObjectLiteralExpression = 152, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 151, + PropertyAccessExpression = 153, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 152, + ElementAccessExpression = 154, >ElementAccessExpression : SyntaxKind - CallExpression = 153, + CallExpression = 155, >CallExpression : SyntaxKind - NewExpression = 154, + NewExpression = 156, >NewExpression : SyntaxKind - TaggedTemplateExpression = 155, + TaggedTemplateExpression = 157, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 156, + TypeAssertionExpression = 158, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 157, + ParenthesizedExpression = 159, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 158, + FunctionExpression = 160, >FunctionExpression : SyntaxKind - ArrowFunction = 159, + ArrowFunction = 161, >ArrowFunction : SyntaxKind - DeleteExpression = 160, + DeleteExpression = 162, >DeleteExpression : SyntaxKind - TypeOfExpression = 161, + TypeOfExpression = 163, >TypeOfExpression : SyntaxKind - VoidExpression = 162, + VoidExpression = 164, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 163, + PrefixUnaryExpression = 165, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 164, + PostfixUnaryExpression = 166, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 165, + BinaryExpression = 167, >BinaryExpression : SyntaxKind - ConditionalExpression = 166, + ConditionalExpression = 168, >ConditionalExpression : SyntaxKind - TemplateExpression = 167, + TemplateExpression = 169, >TemplateExpression : SyntaxKind - YieldExpression = 168, + YieldExpression = 170, >YieldExpression : SyntaxKind - SpreadElementExpression = 169, + SpreadElementExpression = 171, >SpreadElementExpression : SyntaxKind - OmittedExpression = 170, + OmittedExpression = 172, >OmittedExpression : SyntaxKind - TemplateSpan = 171, + TemplateSpan = 173, >TemplateSpan : SyntaxKind - Block = 172, + Block = 174, >Block : SyntaxKind - VariableStatement = 173, + VariableStatement = 175, >VariableStatement : SyntaxKind - EmptyStatement = 174, + EmptyStatement = 176, >EmptyStatement : SyntaxKind - ExpressionStatement = 175, + ExpressionStatement = 177, >ExpressionStatement : SyntaxKind - IfStatement = 176, + IfStatement = 178, >IfStatement : SyntaxKind - DoStatement = 177, + DoStatement = 179, >DoStatement : SyntaxKind - WhileStatement = 178, + WhileStatement = 180, >WhileStatement : SyntaxKind - ForStatement = 179, + ForStatement = 181, >ForStatement : SyntaxKind - ForInStatement = 180, + ForInStatement = 182, >ForInStatement : SyntaxKind - ForOfStatement = 181, + ForOfStatement = 183, >ForOfStatement : SyntaxKind - ContinueStatement = 182, + ContinueStatement = 184, >ContinueStatement : SyntaxKind - BreakStatement = 183, + BreakStatement = 185, >BreakStatement : SyntaxKind - ReturnStatement = 184, + ReturnStatement = 186, >ReturnStatement : SyntaxKind - WithStatement = 185, + WithStatement = 187, >WithStatement : SyntaxKind - SwitchStatement = 186, + SwitchStatement = 188, >SwitchStatement : SyntaxKind - LabeledStatement = 187, + LabeledStatement = 189, >LabeledStatement : SyntaxKind - ThrowStatement = 188, + ThrowStatement = 190, >ThrowStatement : SyntaxKind - TryStatement = 189, + TryStatement = 191, >TryStatement : SyntaxKind - DebuggerStatement = 190, + DebuggerStatement = 192, >DebuggerStatement : SyntaxKind - VariableDeclaration = 191, + VariableDeclaration = 193, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 192, + VariableDeclarationList = 194, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 193, + FunctionDeclaration = 195, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 194, + ClassDeclaration = 196, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 195, + InterfaceDeclaration = 197, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 196, + TypeAliasDeclaration = 198, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 197, + EnumDeclaration = 199, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 198, + ModuleDeclaration = 200, >ModuleDeclaration : SyntaxKind - ModuleBlock = 199, + ModuleBlock = 201, >ModuleBlock : SyntaxKind - ImportDeclaration = 200, + ImportEqualsDeclaration = 202, +>ImportEqualsDeclaration : SyntaxKind + + ImportDeclaration = 203, >ImportDeclaration : SyntaxKind - ExportAssignment = 201, + ImportClause = 204, +>ImportClause : SyntaxKind + + NamespaceImport = 205, +>NamespaceImport : SyntaxKind + + NamedImports = 206, +>NamedImports : SyntaxKind + + ImportSpecifier = 207, +>ImportSpecifier : SyntaxKind + + ExportAssignment = 208, >ExportAssignment : SyntaxKind - ExternalModuleReference = 202, + ExportDeclaration = 209, +>ExportDeclaration : SyntaxKind + + NamedExports = 210, +>NamedExports : SyntaxKind + + ExportSpecifier = 211, +>ExportSpecifier : SyntaxKind + + ExternalModuleReference = 212, >ExternalModuleReference : SyntaxKind - CaseClause = 203, + CaseClause = 213, >CaseClause : SyntaxKind - DefaultClause = 204, + DefaultClause = 214, >DefaultClause : SyntaxKind - HeritageClause = 205, + HeritageClause = 215, >HeritageClause : SyntaxKind - CatchClause = 206, + CatchClause = 216, >CatchClause : SyntaxKind - PropertyAssignment = 207, + PropertyAssignment = 217, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 208, + ShorthandPropertyAssignment = 218, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 209, + EnumMember = 219, >EnumMember : SyntaxKind - SourceFile = 210, + SourceFile = 220, >SourceFile : SyntaxKind - SyntaxList = 211, + SyntaxList = 221, >SyntaxList : SyntaxKind - Count = 212, + Count = 222, >Count : SyntaxKind FirstAssignment = 52, @@ -943,19 +975,19 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 122, + LastKeyword = 124, >LastKeyword : SyntaxKind - FirstFutureReservedWord = 101, + FirstFutureReservedWord = 103, >FirstFutureReservedWord : SyntaxKind - LastFutureReservedWord = 109, + LastFutureReservedWord = 111, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 137, + FirstTypeNode = 139, >FirstTypeNode : SyntaxKind - LastTypeNode = 145, + LastTypeNode = 147, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -967,7 +999,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 122, + LastToken = 124, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -994,7 +1026,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 123, + FirstNode = 125, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -1100,6 +1132,10 @@ declare module "typescript" { >parserContextFlags : ParserContextFlags >ParserContextFlags : ParserContextFlags + modifiers?: ModifiersArray; +>modifiers : ModifiersArray +>ModifiersArray : ModifiersArray + id?: number; >id : number @@ -1122,10 +1158,6 @@ declare module "typescript" { localSymbol?: Symbol; >localSymbol : Symbol >Symbol : Symbol - - modifiers?: ModifiersArray; ->modifiers : ModifiersArray ->ModifiersArray : ModifiersArray } interface NodeArray extends Array, TextRange { >NodeArray : NodeArray @@ -1681,9 +1713,9 @@ declare module "typescript" { >left : Expression >Expression : Expression - operator: SyntaxKind; ->operator : SyntaxKind ->SyntaxKind : SyntaxKind + operatorToken: Node; +>operatorToken : Node +>Node : Node right: Expression; >right : Expression @@ -2224,10 +2256,18 @@ declare module "typescript" { >NodeArray : NodeArray >EnumMember : EnumMember } - interface ModuleDeclaration extends Declaration, ModuleElement { + interface ExportContainer { +>ExportContainer : ExportContainer + + exportStars?: ExportDeclaration[]; +>exportStars : ExportDeclaration[] +>ExportDeclaration : ExportDeclaration + } + interface ModuleDeclaration extends Declaration, ModuleElement, ExportContainer { >ModuleDeclaration : ModuleDeclaration >Declaration : Declaration >ModuleElement : ModuleElement +>ExportContainer : ExportContainer name: Identifier | LiteralExpression; >name : Identifier | LiteralExpression @@ -2249,8 +2289,8 @@ declare module "typescript" { >NodeArray : NodeArray >ModuleElement : ModuleElement } - interface ImportDeclaration extends Declaration, ModuleElement { ->ImportDeclaration : ImportDeclaration + interface ImportEqualsDeclaration extends Declaration, ModuleElement { +>ImportEqualsDeclaration : ImportEqualsDeclaration >Declaration : Declaration >ModuleElement : ModuleElement @@ -2271,6 +2311,90 @@ declare module "typescript" { >expression : Expression >Expression : Expression } + interface ImportDeclaration extends Statement, ModuleElement { +>ImportDeclaration : ImportDeclaration +>Statement : Statement +>ModuleElement : ModuleElement + + importClause?: ImportClause; +>importClause : ImportClause +>ImportClause : ImportClause + + moduleSpecifier: Expression; +>moduleSpecifier : Expression +>Expression : Expression + } + interface ImportClause extends Declaration { +>ImportClause : ImportClause +>Declaration : Declaration + + name?: Identifier; +>name : Identifier +>Identifier : Identifier + + namedBindings?: NamespaceImport | NamedImports; +>namedBindings : NamespaceImport | NamedImportsOrExports +>NamespaceImport : NamespaceImport +>NamedImports : NamedImportsOrExports + } + interface NamespaceImport extends Declaration { +>NamespaceImport : NamespaceImport +>Declaration : Declaration + + name: Identifier; +>name : Identifier +>Identifier : Identifier + } + interface ExportDeclaration extends Statement, ModuleElement { +>ExportDeclaration : ExportDeclaration +>Statement : Statement +>ModuleElement : ModuleElement + + exportClause?: NamedExports; +>exportClause : NamedImportsOrExports +>NamedExports : NamedImportsOrExports + + moduleSpecifier?: Expression; +>moduleSpecifier : Expression +>Expression : Expression + } + interface NamedImportsOrExports extends Node { +>NamedImportsOrExports : NamedImportsOrExports +>Node : Node + + elements: NodeArray; +>elements : NodeArray +>NodeArray : NodeArray +>ImportOrExportSpecifier : ImportOrExportSpecifier + } + type NamedImports = NamedImportsOrExports; +>NamedImports : NamedImportsOrExports +>NamedImportsOrExports : NamedImportsOrExports + + type NamedExports = NamedImportsOrExports; +>NamedExports : NamedImportsOrExports +>NamedImportsOrExports : NamedImportsOrExports + + interface ImportOrExportSpecifier extends Declaration { +>ImportOrExportSpecifier : ImportOrExportSpecifier +>Declaration : Declaration + + propertyName?: Identifier; +>propertyName : Identifier +>Identifier : Identifier + + name: Identifier; +>name : Identifier +>Identifier : Identifier + } + type ImportSpecifier = ImportOrExportSpecifier; +>ImportSpecifier : ImportOrExportSpecifier +>ImportOrExportSpecifier : ImportOrExportSpecifier + + type ExportSpecifier = ImportOrExportSpecifier; +>ExportSpecifier : ImportOrExportSpecifier +>ImportOrExportSpecifier : ImportOrExportSpecifier + interface ExportAssignment extends Statement, ModuleElement { >ExportAssignment : ExportAssignment >Statement : Statement @@ -2294,9 +2418,10 @@ declare module "typescript" { hasTrailingNewLine?: boolean; >hasTrailingNewLine : boolean } - interface SourceFile extends Declaration { + interface SourceFile extends Declaration, ExportContainer { >SourceFile : SourceFile >Declaration : Declaration +>ExportContainer : ExportContainer statements: NodeArray; >statements : NodeArray @@ -2910,9 +3035,9 @@ declare module "typescript" { >accessibility : SymbolAccessibility >SymbolAccessibility : SymbolAccessibility - aliasesToMakeVisible?: ImportDeclaration[]; ->aliasesToMakeVisible : ImportDeclaration[] ->ImportDeclaration : ImportDeclaration + aliasesToMakeVisible?: ImportEqualsDeclaration[]; +>aliasesToMakeVisible : ImportEqualsDeclaration[] +>ImportEqualsDeclaration : ImportEqualsDeclaration errorSymbolName?: string; >errorSymbolName : string @@ -2931,14 +3056,16 @@ declare module "typescript" { interface EmitResolver { >EmitResolver : EmitResolver - getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string; ->getLocalNameOfContainer : (container: EnumDeclaration | ModuleDeclaration) => string ->container : EnumDeclaration | ModuleDeclaration + getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration): string; +>getGeneratedNameForNode : (node: EnumDeclaration | ExportDeclaration | ModuleDeclaration | ImportDeclaration) => string +>node : EnumDeclaration | ExportDeclaration | ModuleDeclaration | ImportDeclaration >ModuleDeclaration : ModuleDeclaration >EnumDeclaration : EnumDeclaration +>ImportDeclaration : ImportDeclaration +>ExportDeclaration : ExportDeclaration - getExpressionNamePrefix(node: Identifier): string; ->getExpressionNamePrefix : (node: Identifier) => string + getExpressionNameSubstitution(node: Identifier): string; +>getExpressionNameSubstitution : (node: Identifier) => string >node : Identifier >Identifier : Identifier @@ -2947,15 +3074,15 @@ declare module "typescript" { >node : SourceFile >SourceFile : SourceFile - isReferencedImportDeclaration(node: ImportDeclaration): boolean; ->isReferencedImportDeclaration : (node: ImportDeclaration) => boolean ->node : ImportDeclaration ->ImportDeclaration : ImportDeclaration + isReferencedImportDeclaration(node: Node): boolean; +>isReferencedImportDeclaration : (node: Node) => boolean +>node : Node +>Node : Node - isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean; ->isTopLevelValueImportWithEntityName : (node: ImportDeclaration) => boolean ->node : ImportDeclaration ->ImportDeclaration : ImportDeclaration + isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; +>isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean +>node : ImportEqualsDeclaration +>ImportEqualsDeclaration : ImportEqualsDeclaration getNodeCheckFlags(node: Node): NodeCheckFlags; >getNodeCheckFlags : (node: Node) => NodeCheckFlags @@ -3284,13 +3411,20 @@ declare module "typescript" { referenced?: boolean; >referenced : boolean - exportAssignSymbol?: Symbol; ->exportAssignSymbol : Symbol + exportAssignmentChecked?: boolean; +>exportAssignmentChecked : boolean + + exportAssignmentSymbol?: Symbol; +>exportAssignmentSymbol : Symbol >Symbol : Symbol unionType?: UnionType; >unionType : UnionType >UnionType : UnionType + + resolvedExports?: SymbolTable; +>resolvedExports : SymbolTable +>SymbolTable : SymbolTable } interface TransientSymbol extends Symbol, SymbolLinks { >TransientSymbol : TransientSymbol @@ -3359,8 +3493,12 @@ declare module "typescript" { isVisible?: boolean; >isVisible : boolean - localModuleName?: string; ->localModuleName : string + generatedName?: string; +>generatedName : string + + generatedNames?: Map; +>generatedNames : Map +>Map : Map assignmentChecks?: Map; >assignmentChecks : Map @@ -4284,6 +4422,9 @@ declare module "typescript" { greaterThan = 62, >greaterThan : CharacterCodes + hash = 35, +>hash : CharacterCodes + lessThan = 60, >lessThan : CharacterCodes @@ -4489,15 +4630,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -4856,16 +4997,16 @@ declare module "typescript" { >getNamedDeclarations : () => Declaration[] >Declaration : Declaration - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; ->getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter >pos : number >LineAndCharacter : LineAndCharacter getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromLineAndCharacter(line: number, character: number): number; ->getPositionFromLineAndCharacter : (line: number, character: number) => number + getPositionOfLineAndCharacter(line: number, character: number): number; +>getPositionOfLineAndCharacter : (line: number, character: number) => number >line : number >character : number @@ -5082,9 +5223,10 @@ declare module "typescript" { >position : number >ReferenceEntry : ReferenceEntry - getNavigateToItems(searchValue: string): NavigateToItem[]; ->getNavigateToItems : (searchValue: string) => NavigateToItem[] + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; +>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] >searchValue : string +>maxResultCount : number >NavigateToItem : NavigateToItem getNavigationBarItems(fileName: string): NavigationBarItem[]; diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 530f081c77a..25cb4af9e42 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -87,8 +87,8 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); @@ -229,132 +229,142 @@ declare module "typescript" { VoidKeyword = 98, WhileKeyword = 99, WithKeyword = 100, - ImplementsKeyword = 101, - InterfaceKeyword = 102, - LetKeyword = 103, - PackageKeyword = 104, - PrivateKeyword = 105, - ProtectedKeyword = 106, - PublicKeyword = 107, - StaticKeyword = 108, - YieldKeyword = 109, - AnyKeyword = 110, - BooleanKeyword = 111, - ConstructorKeyword = 112, - DeclareKeyword = 113, - GetKeyword = 114, - ModuleKeyword = 115, - RequireKeyword = 116, - NumberKeyword = 117, - SetKeyword = 118, - StringKeyword = 119, - SymbolKeyword = 120, - TypeKeyword = 121, - OfKeyword = 122, - QualifiedName = 123, - ComputedPropertyName = 124, - TypeParameter = 125, - Parameter = 126, - PropertySignature = 127, - PropertyDeclaration = 128, - MethodSignature = 129, - MethodDeclaration = 130, - Constructor = 131, - GetAccessor = 132, - SetAccessor = 133, - CallSignature = 134, - ConstructSignature = 135, - IndexSignature = 136, - TypeReference = 137, - FunctionType = 138, - ConstructorType = 139, - TypeQuery = 140, - TypeLiteral = 141, - ArrayType = 142, - TupleType = 143, - UnionType = 144, - ParenthesizedType = 145, - ObjectBindingPattern = 146, - ArrayBindingPattern = 147, - BindingElement = 148, - ArrayLiteralExpression = 149, - ObjectLiteralExpression = 150, - PropertyAccessExpression = 151, - ElementAccessExpression = 152, - CallExpression = 153, - NewExpression = 154, - TaggedTemplateExpression = 155, - TypeAssertionExpression = 156, - ParenthesizedExpression = 157, - FunctionExpression = 158, - ArrowFunction = 159, - DeleteExpression = 160, - TypeOfExpression = 161, - VoidExpression = 162, - PrefixUnaryExpression = 163, - PostfixUnaryExpression = 164, - BinaryExpression = 165, - ConditionalExpression = 166, - TemplateExpression = 167, - YieldExpression = 168, - SpreadElementExpression = 169, - OmittedExpression = 170, - TemplateSpan = 171, - Block = 172, - VariableStatement = 173, - EmptyStatement = 174, - ExpressionStatement = 175, - IfStatement = 176, - DoStatement = 177, - WhileStatement = 178, - ForStatement = 179, - ForInStatement = 180, - ForOfStatement = 181, - ContinueStatement = 182, - BreakStatement = 183, - ReturnStatement = 184, - WithStatement = 185, - SwitchStatement = 186, - LabeledStatement = 187, - ThrowStatement = 188, - TryStatement = 189, - DebuggerStatement = 190, - VariableDeclaration = 191, - VariableDeclarationList = 192, - FunctionDeclaration = 193, - ClassDeclaration = 194, - InterfaceDeclaration = 195, - TypeAliasDeclaration = 196, - EnumDeclaration = 197, - ModuleDeclaration = 198, - ModuleBlock = 199, - ImportDeclaration = 200, - ExportAssignment = 201, - ExternalModuleReference = 202, - CaseClause = 203, - DefaultClause = 204, - HeritageClause = 205, - CatchClause = 206, - PropertyAssignment = 207, - ShorthandPropertyAssignment = 208, - EnumMember = 209, - SourceFile = 210, - SyntaxList = 211, - Count = 212, + AsKeyword = 101, + FromKeyword = 102, + ImplementsKeyword = 103, + InterfaceKeyword = 104, + LetKeyword = 105, + PackageKeyword = 106, + PrivateKeyword = 107, + ProtectedKeyword = 108, + PublicKeyword = 109, + StaticKeyword = 110, + YieldKeyword = 111, + AnyKeyword = 112, + BooleanKeyword = 113, + ConstructorKeyword = 114, + DeclareKeyword = 115, + GetKeyword = 116, + ModuleKeyword = 117, + RequireKeyword = 118, + NumberKeyword = 119, + SetKeyword = 120, + StringKeyword = 121, + SymbolKeyword = 122, + TypeKeyword = 123, + OfKeyword = 124, + QualifiedName = 125, + ComputedPropertyName = 126, + TypeParameter = 127, + Parameter = 128, + PropertySignature = 129, + PropertyDeclaration = 130, + MethodSignature = 131, + MethodDeclaration = 132, + Constructor = 133, + GetAccessor = 134, + SetAccessor = 135, + CallSignature = 136, + ConstructSignature = 137, + IndexSignature = 138, + TypeReference = 139, + FunctionType = 140, + ConstructorType = 141, + TypeQuery = 142, + TypeLiteral = 143, + ArrayType = 144, + TupleType = 145, + UnionType = 146, + ParenthesizedType = 147, + ObjectBindingPattern = 148, + ArrayBindingPattern = 149, + BindingElement = 150, + ArrayLiteralExpression = 151, + ObjectLiteralExpression = 152, + PropertyAccessExpression = 153, + ElementAccessExpression = 154, + CallExpression = 155, + NewExpression = 156, + TaggedTemplateExpression = 157, + TypeAssertionExpression = 158, + ParenthesizedExpression = 159, + FunctionExpression = 160, + ArrowFunction = 161, + DeleteExpression = 162, + TypeOfExpression = 163, + VoidExpression = 164, + PrefixUnaryExpression = 165, + PostfixUnaryExpression = 166, + BinaryExpression = 167, + ConditionalExpression = 168, + TemplateExpression = 169, + YieldExpression = 170, + SpreadElementExpression = 171, + OmittedExpression = 172, + TemplateSpan = 173, + Block = 174, + VariableStatement = 175, + EmptyStatement = 176, + ExpressionStatement = 177, + IfStatement = 178, + DoStatement = 179, + WhileStatement = 180, + ForStatement = 181, + ForInStatement = 182, + ForOfStatement = 183, + ContinueStatement = 184, + BreakStatement = 185, + ReturnStatement = 186, + WithStatement = 187, + SwitchStatement = 188, + LabeledStatement = 189, + ThrowStatement = 190, + TryStatement = 191, + DebuggerStatement = 192, + VariableDeclaration = 193, + VariableDeclarationList = 194, + FunctionDeclaration = 195, + ClassDeclaration = 196, + InterfaceDeclaration = 197, + TypeAliasDeclaration = 198, + EnumDeclaration = 199, + ModuleDeclaration = 200, + ModuleBlock = 201, + ImportEqualsDeclaration = 202, + ImportDeclaration = 203, + ImportClause = 204, + NamespaceImport = 205, + NamedImports = 206, + ImportSpecifier = 207, + ExportAssignment = 208, + ExportDeclaration = 209, + NamedExports = 210, + ExportSpecifier = 211, + ExternalModuleReference = 212, + CaseClause = 213, + DefaultClause = 214, + HeritageClause = 215, + CatchClause = 216, + PropertyAssignment = 217, + ShorthandPropertyAssignment = 218, + EnumMember = 219, + SourceFile = 220, + SyntaxList = 221, + Count = 222, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 122, - FirstFutureReservedWord = 101, - LastFutureReservedWord = 109, - FirstTypeNode = 137, - LastTypeNode = 145, + LastKeyword = 124, + FirstFutureReservedWord = 103, + LastFutureReservedWord = 111, + FirstTypeNode = 139, + LastTypeNode = 147, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 122, + LastToken = 124, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -363,7 +373,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 123, + FirstNode = 125, } const enum NodeFlags { Export = 1, @@ -401,13 +411,13 @@ declare module "typescript" { kind: SyntaxKind; flags: NodeFlags; parserContextFlags?: ParserContextFlags; + modifiers?: ModifiersArray; id?: number; parent?: Node; symbol?: Symbol; locals?: SymbolTable; nextContainer?: Node; localSymbol?: Symbol; - modifiers?: ModifiersArray; } interface NodeArray extends Array, TextRange { hasTrailingComma?: boolean; @@ -596,7 +606,7 @@ declare module "typescript" { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { @@ -771,20 +781,49 @@ declare module "typescript" { name: Identifier; members: NodeArray; } - interface ModuleDeclaration extends Declaration, ModuleElement { + interface ExportContainer { + exportStars?: ExportDeclaration[]; + } + interface ModuleDeclaration extends Declaration, ModuleElement, ExportContainer { name: Identifier | LiteralExpression; body: ModuleBlock | ModuleDeclaration; } interface ModuleBlock extends Node, ModuleElement { statements: NodeArray; } - interface ImportDeclaration extends Declaration, ModuleElement { + interface ImportEqualsDeclaration extends Declaration, ModuleElement { name: Identifier; moduleReference: EntityName | ExternalModuleReference; } interface ExternalModuleReference extends Node { expression?: Expression; } + interface ImportDeclaration extends Statement, ModuleElement { + importClause?: ImportClause; + moduleSpecifier: Expression; + } + interface ImportClause extends Declaration { + name?: Identifier; + namedBindings?: NamespaceImport | NamedImports; + } + interface NamespaceImport extends Declaration { + name: Identifier; + } + interface ExportDeclaration extends Statement, ModuleElement { + exportClause?: NamedExports; + moduleSpecifier?: Expression; + } + interface NamedImportsOrExports extends Node { + elements: NodeArray; + } + type NamedImports = NamedImportsOrExports; + type NamedExports = NamedImportsOrExports; + interface ImportOrExportSpecifier extends Declaration { + propertyName?: Identifier; + name: Identifier; + } + type ImportSpecifier = ImportOrExportSpecifier; + type ExportSpecifier = ImportOrExportSpecifier; interface ExportAssignment extends Statement, ModuleElement { exportName: Identifier; } @@ -794,7 +833,7 @@ declare module "typescript" { interface CommentRange extends TextRange { hasTrailingNewLine?: boolean; } - interface SourceFile extends Declaration { + interface SourceFile extends Declaration, ExportContainer { statements: NodeArray; endOfFileToken: Node; fileName: string; @@ -948,7 +987,7 @@ declare module "typescript" { } interface SymbolVisibilityResult { accessibility: SymbolAccessibility; - aliasesToMakeVisible?: ImportDeclaration[]; + aliasesToMakeVisible?: ImportEqualsDeclaration[]; errorSymbolName?: string; errorNode?: Node; } @@ -956,11 +995,11 @@ declare module "typescript" { errorModuleName?: string; } interface EmitResolver { - getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string; - getExpressionNamePrefix(node: Identifier): string; + getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration): string; + getExpressionNameSubstitution(node: Identifier): string; getExportAssignmentName(node: SourceFile): string; - isReferencedImportDeclaration(node: ImportDeclaration): boolean; - isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean; + isReferencedImportDeclaration(node: Node): boolean; + isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; getNodeCheckFlags(node: Node): NodeCheckFlags; isDeclarationVisible(node: Declaration): boolean; isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; @@ -1055,8 +1094,10 @@ declare module "typescript" { declaredType?: Type; mapper?: TypeMapper; referenced?: boolean; - exportAssignSymbol?: Symbol; + exportAssignmentChecked?: boolean; + exportAssignmentSymbol?: Symbol; unionType?: UnionType; + resolvedExports?: SymbolTable; } interface TransientSymbol extends Symbol, SymbolLinks { } @@ -1081,7 +1122,8 @@ declare module "typescript" { enumMemberValue?: number; isIllegalTypeReferenceInConstraint?: boolean; isVisible?: boolean; - localModuleName?: string; + generatedName?: string; + generatedNames?: Map; assignmentChecks?: Map; hasReportedStatementInAmbientContext?: boolean; importOnRightSide?: Symbol; @@ -1395,6 +1437,7 @@ declare module "typescript" { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, @@ -1461,8 +1504,8 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; @@ -1546,9 +1589,9 @@ declare module "typescript" { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -1610,7 +1653,7 @@ declare module "typescript" { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; @@ -2074,8 +2117,8 @@ function watch(rootFileNames, options) { var allDiagnostics = services.getCompilerOptionsDiagnostics().concat(services.getSyntacticDiagnostics(fileName)).concat(services.getSemanticDiagnostics(fileName)); allDiagnostics.forEach(function (diagnostic) { if (diagnostic.file) { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(" Error " + diagnostic.file.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(" Error " + diagnostic.file.fileName + " (" + (lineChar.line + 1) + "," + (lineChar.character + 1) + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")); } else { console.log(" Error: " + diagnostic.messageText); diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index ec48d879968..1283ed80958 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -317,11 +317,11 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { >fileName : string allDiagnostics.forEach(diagnostic => { ->allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } }) : void +>allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } }) : void >allDiagnostics.forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void >allDiagnostics : ts.Diagnostic[] >forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void ->diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } } : (diagnostic: ts.Diagnostic) => void +>diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } } : (diagnostic: ts.Diagnostic) => void >diagnostic : ts.Diagnostic if (diagnostic.file) { @@ -329,20 +329,20 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { >diagnostic : ts.Diagnostic >file : ts.SourceFile - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); >lineChar : ts.LineAndCharacter ->diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start) : ts.LineAndCharacter ->diagnostic.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >diagnostic.file : ts.SourceFile >diagnostic : ts.Diagnostic >file : ts.SourceFile ->getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >diagnostic.start : number >diagnostic : ts.Diagnostic >start : number - console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); ->console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`) : any + console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); +>console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`) : any >console.log : any >console : any >log : any @@ -351,9 +351,11 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { >diagnostic : ts.Diagnostic >file : ts.SourceFile >fileName : string +>lineChar.line + 1 : number >lineChar.line : number >lineChar : ts.LineAndCharacter >line : number +>lineChar.character + 1 : number >lineChar.character : number >lineChar : ts.LineAndCharacter >character : number @@ -765,340 +767,370 @@ declare module "typescript" { WithKeyword = 100, >WithKeyword : SyntaxKind - ImplementsKeyword = 101, + AsKeyword = 101, +>AsKeyword : SyntaxKind + + FromKeyword = 102, +>FromKeyword : SyntaxKind + + ImplementsKeyword = 103, >ImplementsKeyword : SyntaxKind - InterfaceKeyword = 102, + InterfaceKeyword = 104, >InterfaceKeyword : SyntaxKind - LetKeyword = 103, + LetKeyword = 105, >LetKeyword : SyntaxKind - PackageKeyword = 104, + PackageKeyword = 106, >PackageKeyword : SyntaxKind - PrivateKeyword = 105, + PrivateKeyword = 107, >PrivateKeyword : SyntaxKind - ProtectedKeyword = 106, + ProtectedKeyword = 108, >ProtectedKeyword : SyntaxKind - PublicKeyword = 107, + PublicKeyword = 109, >PublicKeyword : SyntaxKind - StaticKeyword = 108, + StaticKeyword = 110, >StaticKeyword : SyntaxKind - YieldKeyword = 109, + YieldKeyword = 111, >YieldKeyword : SyntaxKind - AnyKeyword = 110, + AnyKeyword = 112, >AnyKeyword : SyntaxKind - BooleanKeyword = 111, + BooleanKeyword = 113, >BooleanKeyword : SyntaxKind - ConstructorKeyword = 112, + ConstructorKeyword = 114, >ConstructorKeyword : SyntaxKind - DeclareKeyword = 113, + DeclareKeyword = 115, >DeclareKeyword : SyntaxKind - GetKeyword = 114, + GetKeyword = 116, >GetKeyword : SyntaxKind - ModuleKeyword = 115, + ModuleKeyword = 117, >ModuleKeyword : SyntaxKind - RequireKeyword = 116, + RequireKeyword = 118, >RequireKeyword : SyntaxKind - NumberKeyword = 117, + NumberKeyword = 119, >NumberKeyword : SyntaxKind - SetKeyword = 118, + SetKeyword = 120, >SetKeyword : SyntaxKind - StringKeyword = 119, + StringKeyword = 121, >StringKeyword : SyntaxKind - SymbolKeyword = 120, + SymbolKeyword = 122, >SymbolKeyword : SyntaxKind - TypeKeyword = 121, + TypeKeyword = 123, >TypeKeyword : SyntaxKind - OfKeyword = 122, + OfKeyword = 124, >OfKeyword : SyntaxKind - QualifiedName = 123, + QualifiedName = 125, >QualifiedName : SyntaxKind - ComputedPropertyName = 124, + ComputedPropertyName = 126, >ComputedPropertyName : SyntaxKind - TypeParameter = 125, + TypeParameter = 127, >TypeParameter : SyntaxKind - Parameter = 126, + Parameter = 128, >Parameter : SyntaxKind - PropertySignature = 127, + PropertySignature = 129, >PropertySignature : SyntaxKind - PropertyDeclaration = 128, + PropertyDeclaration = 130, >PropertyDeclaration : SyntaxKind - MethodSignature = 129, + MethodSignature = 131, >MethodSignature : SyntaxKind - MethodDeclaration = 130, + MethodDeclaration = 132, >MethodDeclaration : SyntaxKind - Constructor = 131, + Constructor = 133, >Constructor : SyntaxKind - GetAccessor = 132, + GetAccessor = 134, >GetAccessor : SyntaxKind - SetAccessor = 133, + SetAccessor = 135, >SetAccessor : SyntaxKind - CallSignature = 134, + CallSignature = 136, >CallSignature : SyntaxKind - ConstructSignature = 135, + ConstructSignature = 137, >ConstructSignature : SyntaxKind - IndexSignature = 136, + IndexSignature = 138, >IndexSignature : SyntaxKind - TypeReference = 137, + TypeReference = 139, >TypeReference : SyntaxKind - FunctionType = 138, + FunctionType = 140, >FunctionType : SyntaxKind - ConstructorType = 139, + ConstructorType = 141, >ConstructorType : SyntaxKind - TypeQuery = 140, + TypeQuery = 142, >TypeQuery : SyntaxKind - TypeLiteral = 141, + TypeLiteral = 143, >TypeLiteral : SyntaxKind - ArrayType = 142, + ArrayType = 144, >ArrayType : SyntaxKind - TupleType = 143, + TupleType = 145, >TupleType : SyntaxKind - UnionType = 144, + UnionType = 146, >UnionType : SyntaxKind - ParenthesizedType = 145, + ParenthesizedType = 147, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 146, + ObjectBindingPattern = 148, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 147, + ArrayBindingPattern = 149, >ArrayBindingPattern : SyntaxKind - BindingElement = 148, + BindingElement = 150, >BindingElement : SyntaxKind - ArrayLiteralExpression = 149, + ArrayLiteralExpression = 151, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 150, + ObjectLiteralExpression = 152, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 151, + PropertyAccessExpression = 153, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 152, + ElementAccessExpression = 154, >ElementAccessExpression : SyntaxKind - CallExpression = 153, + CallExpression = 155, >CallExpression : SyntaxKind - NewExpression = 154, + NewExpression = 156, >NewExpression : SyntaxKind - TaggedTemplateExpression = 155, + TaggedTemplateExpression = 157, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 156, + TypeAssertionExpression = 158, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 157, + ParenthesizedExpression = 159, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 158, + FunctionExpression = 160, >FunctionExpression : SyntaxKind - ArrowFunction = 159, + ArrowFunction = 161, >ArrowFunction : SyntaxKind - DeleteExpression = 160, + DeleteExpression = 162, >DeleteExpression : SyntaxKind - TypeOfExpression = 161, + TypeOfExpression = 163, >TypeOfExpression : SyntaxKind - VoidExpression = 162, + VoidExpression = 164, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 163, + PrefixUnaryExpression = 165, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 164, + PostfixUnaryExpression = 166, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 165, + BinaryExpression = 167, >BinaryExpression : SyntaxKind - ConditionalExpression = 166, + ConditionalExpression = 168, >ConditionalExpression : SyntaxKind - TemplateExpression = 167, + TemplateExpression = 169, >TemplateExpression : SyntaxKind - YieldExpression = 168, + YieldExpression = 170, >YieldExpression : SyntaxKind - SpreadElementExpression = 169, + SpreadElementExpression = 171, >SpreadElementExpression : SyntaxKind - OmittedExpression = 170, + OmittedExpression = 172, >OmittedExpression : SyntaxKind - TemplateSpan = 171, + TemplateSpan = 173, >TemplateSpan : SyntaxKind - Block = 172, + Block = 174, >Block : SyntaxKind - VariableStatement = 173, + VariableStatement = 175, >VariableStatement : SyntaxKind - EmptyStatement = 174, + EmptyStatement = 176, >EmptyStatement : SyntaxKind - ExpressionStatement = 175, + ExpressionStatement = 177, >ExpressionStatement : SyntaxKind - IfStatement = 176, + IfStatement = 178, >IfStatement : SyntaxKind - DoStatement = 177, + DoStatement = 179, >DoStatement : SyntaxKind - WhileStatement = 178, + WhileStatement = 180, >WhileStatement : SyntaxKind - ForStatement = 179, + ForStatement = 181, >ForStatement : SyntaxKind - ForInStatement = 180, + ForInStatement = 182, >ForInStatement : SyntaxKind - ForOfStatement = 181, + ForOfStatement = 183, >ForOfStatement : SyntaxKind - ContinueStatement = 182, + ContinueStatement = 184, >ContinueStatement : SyntaxKind - BreakStatement = 183, + BreakStatement = 185, >BreakStatement : SyntaxKind - ReturnStatement = 184, + ReturnStatement = 186, >ReturnStatement : SyntaxKind - WithStatement = 185, + WithStatement = 187, >WithStatement : SyntaxKind - SwitchStatement = 186, + SwitchStatement = 188, >SwitchStatement : SyntaxKind - LabeledStatement = 187, + LabeledStatement = 189, >LabeledStatement : SyntaxKind - ThrowStatement = 188, + ThrowStatement = 190, >ThrowStatement : SyntaxKind - TryStatement = 189, + TryStatement = 191, >TryStatement : SyntaxKind - DebuggerStatement = 190, + DebuggerStatement = 192, >DebuggerStatement : SyntaxKind - VariableDeclaration = 191, + VariableDeclaration = 193, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 192, + VariableDeclarationList = 194, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 193, + FunctionDeclaration = 195, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 194, + ClassDeclaration = 196, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 195, + InterfaceDeclaration = 197, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 196, + TypeAliasDeclaration = 198, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 197, + EnumDeclaration = 199, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 198, + ModuleDeclaration = 200, >ModuleDeclaration : SyntaxKind - ModuleBlock = 199, + ModuleBlock = 201, >ModuleBlock : SyntaxKind - ImportDeclaration = 200, + ImportEqualsDeclaration = 202, +>ImportEqualsDeclaration : SyntaxKind + + ImportDeclaration = 203, >ImportDeclaration : SyntaxKind - ExportAssignment = 201, + ImportClause = 204, +>ImportClause : SyntaxKind + + NamespaceImport = 205, +>NamespaceImport : SyntaxKind + + NamedImports = 206, +>NamedImports : SyntaxKind + + ImportSpecifier = 207, +>ImportSpecifier : SyntaxKind + + ExportAssignment = 208, >ExportAssignment : SyntaxKind - ExternalModuleReference = 202, + ExportDeclaration = 209, +>ExportDeclaration : SyntaxKind + + NamedExports = 210, +>NamedExports : SyntaxKind + + ExportSpecifier = 211, +>ExportSpecifier : SyntaxKind + + ExternalModuleReference = 212, >ExternalModuleReference : SyntaxKind - CaseClause = 203, + CaseClause = 213, >CaseClause : SyntaxKind - DefaultClause = 204, + DefaultClause = 214, >DefaultClause : SyntaxKind - HeritageClause = 205, + HeritageClause = 215, >HeritageClause : SyntaxKind - CatchClause = 206, + CatchClause = 216, >CatchClause : SyntaxKind - PropertyAssignment = 207, + PropertyAssignment = 217, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 208, + ShorthandPropertyAssignment = 218, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 209, + EnumMember = 219, >EnumMember : SyntaxKind - SourceFile = 210, + SourceFile = 220, >SourceFile : SyntaxKind - SyntaxList = 211, + SyntaxList = 221, >SyntaxList : SyntaxKind - Count = 212, + Count = 222, >Count : SyntaxKind FirstAssignment = 52, @@ -1116,19 +1148,19 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 122, + LastKeyword = 124, >LastKeyword : SyntaxKind - FirstFutureReservedWord = 101, + FirstFutureReservedWord = 103, >FirstFutureReservedWord : SyntaxKind - LastFutureReservedWord = 109, + LastFutureReservedWord = 111, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 137, + FirstTypeNode = 139, >FirstTypeNode : SyntaxKind - LastTypeNode = 145, + LastTypeNode = 147, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -1140,7 +1172,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 122, + LastToken = 124, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -1167,7 +1199,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 123, + FirstNode = 125, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -1273,6 +1305,10 @@ declare module "typescript" { >parserContextFlags : ParserContextFlags >ParserContextFlags : ParserContextFlags + modifiers?: ModifiersArray; +>modifiers : ModifiersArray +>ModifiersArray : ModifiersArray + id?: number; >id : number @@ -1295,10 +1331,6 @@ declare module "typescript" { localSymbol?: Symbol; >localSymbol : Symbol >Symbol : Symbol - - modifiers?: ModifiersArray; ->modifiers : ModifiersArray ->ModifiersArray : ModifiersArray } interface NodeArray extends Array, TextRange { >NodeArray : NodeArray @@ -1854,9 +1886,9 @@ declare module "typescript" { >left : Expression >Expression : Expression - operator: SyntaxKind; ->operator : SyntaxKind ->SyntaxKind : SyntaxKind + operatorToken: Node; +>operatorToken : Node +>Node : Node right: Expression; >right : Expression @@ -2397,10 +2429,18 @@ declare module "typescript" { >NodeArray : NodeArray >EnumMember : EnumMember } - interface ModuleDeclaration extends Declaration, ModuleElement { + interface ExportContainer { +>ExportContainer : ExportContainer + + exportStars?: ExportDeclaration[]; +>exportStars : ExportDeclaration[] +>ExportDeclaration : ExportDeclaration + } + interface ModuleDeclaration extends Declaration, ModuleElement, ExportContainer { >ModuleDeclaration : ModuleDeclaration >Declaration : Declaration >ModuleElement : ModuleElement +>ExportContainer : ExportContainer name: Identifier | LiteralExpression; >name : Identifier | LiteralExpression @@ -2422,8 +2462,8 @@ declare module "typescript" { >NodeArray : NodeArray >ModuleElement : ModuleElement } - interface ImportDeclaration extends Declaration, ModuleElement { ->ImportDeclaration : ImportDeclaration + interface ImportEqualsDeclaration extends Declaration, ModuleElement { +>ImportEqualsDeclaration : ImportEqualsDeclaration >Declaration : Declaration >ModuleElement : ModuleElement @@ -2444,6 +2484,90 @@ declare module "typescript" { >expression : Expression >Expression : Expression } + interface ImportDeclaration extends Statement, ModuleElement { +>ImportDeclaration : ImportDeclaration +>Statement : Statement +>ModuleElement : ModuleElement + + importClause?: ImportClause; +>importClause : ImportClause +>ImportClause : ImportClause + + moduleSpecifier: Expression; +>moduleSpecifier : Expression +>Expression : Expression + } + interface ImportClause extends Declaration { +>ImportClause : ImportClause +>Declaration : Declaration + + name?: Identifier; +>name : Identifier +>Identifier : Identifier + + namedBindings?: NamespaceImport | NamedImports; +>namedBindings : NamespaceImport | NamedImportsOrExports +>NamespaceImport : NamespaceImport +>NamedImports : NamedImportsOrExports + } + interface NamespaceImport extends Declaration { +>NamespaceImport : NamespaceImport +>Declaration : Declaration + + name: Identifier; +>name : Identifier +>Identifier : Identifier + } + interface ExportDeclaration extends Statement, ModuleElement { +>ExportDeclaration : ExportDeclaration +>Statement : Statement +>ModuleElement : ModuleElement + + exportClause?: NamedExports; +>exportClause : NamedImportsOrExports +>NamedExports : NamedImportsOrExports + + moduleSpecifier?: Expression; +>moduleSpecifier : Expression +>Expression : Expression + } + interface NamedImportsOrExports extends Node { +>NamedImportsOrExports : NamedImportsOrExports +>Node : Node + + elements: NodeArray; +>elements : NodeArray +>NodeArray : NodeArray +>ImportOrExportSpecifier : ImportOrExportSpecifier + } + type NamedImports = NamedImportsOrExports; +>NamedImports : NamedImportsOrExports +>NamedImportsOrExports : NamedImportsOrExports + + type NamedExports = NamedImportsOrExports; +>NamedExports : NamedImportsOrExports +>NamedImportsOrExports : NamedImportsOrExports + + interface ImportOrExportSpecifier extends Declaration { +>ImportOrExportSpecifier : ImportOrExportSpecifier +>Declaration : Declaration + + propertyName?: Identifier; +>propertyName : Identifier +>Identifier : Identifier + + name: Identifier; +>name : Identifier +>Identifier : Identifier + } + type ImportSpecifier = ImportOrExportSpecifier; +>ImportSpecifier : ImportOrExportSpecifier +>ImportOrExportSpecifier : ImportOrExportSpecifier + + type ExportSpecifier = ImportOrExportSpecifier; +>ExportSpecifier : ImportOrExportSpecifier +>ImportOrExportSpecifier : ImportOrExportSpecifier + interface ExportAssignment extends Statement, ModuleElement { >ExportAssignment : ExportAssignment >Statement : Statement @@ -2467,9 +2591,10 @@ declare module "typescript" { hasTrailingNewLine?: boolean; >hasTrailingNewLine : boolean } - interface SourceFile extends Declaration { + interface SourceFile extends Declaration, ExportContainer { >SourceFile : SourceFile >Declaration : Declaration +>ExportContainer : ExportContainer statements: NodeArray; >statements : NodeArray @@ -3083,9 +3208,9 @@ declare module "typescript" { >accessibility : SymbolAccessibility >SymbolAccessibility : SymbolAccessibility - aliasesToMakeVisible?: ImportDeclaration[]; ->aliasesToMakeVisible : ImportDeclaration[] ->ImportDeclaration : ImportDeclaration + aliasesToMakeVisible?: ImportEqualsDeclaration[]; +>aliasesToMakeVisible : ImportEqualsDeclaration[] +>ImportEqualsDeclaration : ImportEqualsDeclaration errorSymbolName?: string; >errorSymbolName : string @@ -3104,14 +3229,16 @@ declare module "typescript" { interface EmitResolver { >EmitResolver : EmitResolver - getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string; ->getLocalNameOfContainer : (container: EnumDeclaration | ModuleDeclaration) => string ->container : EnumDeclaration | ModuleDeclaration + getGeneratedNameForNode(node: ModuleDeclaration | EnumDeclaration | ImportDeclaration | ExportDeclaration): string; +>getGeneratedNameForNode : (node: EnumDeclaration | ExportDeclaration | ModuleDeclaration | ImportDeclaration) => string +>node : EnumDeclaration | ExportDeclaration | ModuleDeclaration | ImportDeclaration >ModuleDeclaration : ModuleDeclaration >EnumDeclaration : EnumDeclaration +>ImportDeclaration : ImportDeclaration +>ExportDeclaration : ExportDeclaration - getExpressionNamePrefix(node: Identifier): string; ->getExpressionNamePrefix : (node: Identifier) => string + getExpressionNameSubstitution(node: Identifier): string; +>getExpressionNameSubstitution : (node: Identifier) => string >node : Identifier >Identifier : Identifier @@ -3120,15 +3247,15 @@ declare module "typescript" { >node : SourceFile >SourceFile : SourceFile - isReferencedImportDeclaration(node: ImportDeclaration): boolean; ->isReferencedImportDeclaration : (node: ImportDeclaration) => boolean ->node : ImportDeclaration ->ImportDeclaration : ImportDeclaration + isReferencedImportDeclaration(node: Node): boolean; +>isReferencedImportDeclaration : (node: Node) => boolean +>node : Node +>Node : Node - isTopLevelValueImportWithEntityName(node: ImportDeclaration): boolean; ->isTopLevelValueImportWithEntityName : (node: ImportDeclaration) => boolean ->node : ImportDeclaration ->ImportDeclaration : ImportDeclaration + isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean; +>isTopLevelValueImportEqualsWithEntityName : (node: ImportEqualsDeclaration) => boolean +>node : ImportEqualsDeclaration +>ImportEqualsDeclaration : ImportEqualsDeclaration getNodeCheckFlags(node: Node): NodeCheckFlags; >getNodeCheckFlags : (node: Node) => NodeCheckFlags @@ -3457,13 +3584,20 @@ declare module "typescript" { referenced?: boolean; >referenced : boolean - exportAssignSymbol?: Symbol; ->exportAssignSymbol : Symbol + exportAssignmentChecked?: boolean; +>exportAssignmentChecked : boolean + + exportAssignmentSymbol?: Symbol; +>exportAssignmentSymbol : Symbol >Symbol : Symbol unionType?: UnionType; >unionType : UnionType >UnionType : UnionType + + resolvedExports?: SymbolTable; +>resolvedExports : SymbolTable +>SymbolTable : SymbolTable } interface TransientSymbol extends Symbol, SymbolLinks { >TransientSymbol : TransientSymbol @@ -3532,8 +3666,12 @@ declare module "typescript" { isVisible?: boolean; >isVisible : boolean - localModuleName?: string; ->localModuleName : string + generatedName?: string; +>generatedName : string + + generatedNames?: Map; +>generatedNames : Map +>Map : Map assignmentChecks?: Map; >assignmentChecks : Map @@ -4457,6 +4595,9 @@ declare module "typescript" { greaterThan = 62, >greaterThan : CharacterCodes + hash = 35, +>hash : CharacterCodes + lessThan = 60, >lessThan : CharacterCodes @@ -4662,15 +4803,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -5029,16 +5170,16 @@ declare module "typescript" { >getNamedDeclarations : () => Declaration[] >Declaration : Declaration - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; ->getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter >pos : number >LineAndCharacter : LineAndCharacter getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromLineAndCharacter(line: number, character: number): number; ->getPositionFromLineAndCharacter : (line: number, character: number) => number + getPositionOfLineAndCharacter(line: number, character: number): number; +>getPositionOfLineAndCharacter : (line: number, character: number) => number >line : number >character : number @@ -5255,9 +5396,10 @@ declare module "typescript" { >position : number >ReferenceEntry : ReferenceEntry - getNavigateToItems(searchValue: string): NavigateToItem[]; ->getNavigateToItems : (searchValue: string) => NavigateToItem[] + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; +>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] >searchValue : string +>maxResultCount : number >NavigateToItem : NavigateToItem getNavigationBarItems(fileName: string): NavigationBarItem[]; diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js index 827557bdbad..5f01b6acff1 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js @@ -19,9 +19,7 @@ module clodule { var clodule = (function () { function clodule() { } - clodule.sfn = function (id) { - return 42; - }; + clodule.sfn = function (id) { return 42; }; return clodule; })(); var clodule; diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js index ae8d594c2f8..a86bc7d2e90 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js @@ -28,16 +28,12 @@ var Point = (function () { this.x = x; this.y = y; } - Point.Origin = function () { - return { x: 0, y: 0 }; - }; // unexpected error here bug 840246 + Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246 return Point; })(); var Point; (function (Point) { - function Origin() { - return null; - } + function Origin() { return null; } Point.Origin = Origin; //expected duplicate identifier error })(Point || (Point = {})); var A; @@ -47,17 +43,13 @@ var A; this.x = x; this.y = y; } - Point.Origin = function () { - return { x: 0, y: 0 }; - }; // unexpected error here bug 840246 + Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246 return Point; })(); A.Point = Point; var Point; (function (Point) { - function Origin() { - return ""; - } + function Origin() { return ""; } Point.Origin = Origin; //expected duplicate identifier error })(Point = A.Point || (A.Point = {})); })(A || (A = {})); diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js index 5bbe60297cc..f462ea9eaa9 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js @@ -28,16 +28,12 @@ var Point = (function () { this.x = x; this.y = y; } - Point.Origin = function () { - return { x: 0, y: 0 }; - }; + Point.Origin = function () { return { x: 0, y: 0 }; }; return Point; })(); var Point; (function (Point) { - function Origin() { - return ""; - } // not an error, since not exported + function Origin() { return ""; } // not an error, since not exported })(Point || (Point = {})); var A; (function (A) { @@ -46,16 +42,12 @@ var A; this.x = x; this.y = y; } - Point.Origin = function () { - return { x: 0, y: 0 }; - }; + Point.Origin = function () { return { x: 0, y: 0 }; }; return Point; })(); A.Point = Point; var Point; (function (Point) { - function Origin() { - return ""; - } // not an error since not exported + function Origin() { return ""; } // not an error since not exported })(Point = A.Point || (A.Point = {})); })(A || (A = {})); diff --git a/tests/baselines/reference/ES5SymbolProperty1.errors.txt b/tests/baselines/reference/ES5SymbolProperty1.errors.txt index 1c0c5a55ad2..1b135dcc916 100644 --- a/tests/baselines/reference/ES5SymbolProperty1.errors.txt +++ b/tests/baselines/reference/ES5SymbolProperty1.errors.txt @@ -1,8 +1,7 @@ -tests/cases/conformance/Symbols/ES5SymbolProperty1.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/Symbols/ES5SymbolProperty1.ts(7,6): error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'. -==== tests/cases/conformance/Symbols/ES5SymbolProperty1.ts (2 errors) ==== +==== tests/cases/conformance/Symbols/ES5SymbolProperty1.ts (1 errors) ==== interface SymbolConstructor { foo: string; } @@ -10,8 +9,6 @@ tests/cases/conformance/Symbols/ES5SymbolProperty1.ts(7,6): error TS2471: A comp var obj = { [Symbol.foo]: 0 - ~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~~~~~~ !!! error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'. } diff --git a/tests/baselines/reference/ES5SymbolProperty1.js b/tests/baselines/reference/ES5SymbolProperty1.js index 3f761d3073f..e977df7dc6b 100644 --- a/tests/baselines/reference/ES5SymbolProperty1.js +++ b/tests/baselines/reference/ES5SymbolProperty1.js @@ -12,7 +12,8 @@ obj[Symbol.foo]; //// [ES5SymbolProperty1.js] var Symbol; -var obj = { - [Symbol.foo]: 0 -}; +var obj = (_a = {}, _a[Symbol.foo] = +0, +_a); obj[Symbol.foo]; +var _a; diff --git a/tests/baselines/reference/ES5SymbolProperty2.errors.txt b/tests/baselines/reference/ES5SymbolProperty2.errors.txt index 397e8f51511..9a6526a2f86 100644 --- a/tests/baselines/reference/ES5SymbolProperty2.errors.txt +++ b/tests/baselines/reference/ES5SymbolProperty2.errors.txt @@ -1,16 +1,13 @@ -tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(5,10): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(10,11): error TS2304: Cannot find name 'Symbol'. -==== tests/cases/conformance/Symbols/ES5SymbolProperty2.ts (3 errors) ==== +==== tests/cases/conformance/Symbols/ES5SymbolProperty2.ts (2 errors) ==== module M { var Symbol; export class C { [Symbol.iterator]() { } - ~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~~~~~~~~~~~ !!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. } diff --git a/tests/baselines/reference/ES5SymbolProperty3.errors.txt b/tests/baselines/reference/ES5SymbolProperty3.errors.txt index 3ec09f889f5..7c6cc5a9cd7 100644 --- a/tests/baselines/reference/ES5SymbolProperty3.errors.txt +++ b/tests/baselines/reference/ES5SymbolProperty3.errors.txt @@ -1,14 +1,11 @@ -tests/cases/conformance/Symbols/ES5SymbolProperty3.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/Symbols/ES5SymbolProperty3.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. -==== tests/cases/conformance/Symbols/ES5SymbolProperty3.ts (2 errors) ==== +==== tests/cases/conformance/Symbols/ES5SymbolProperty3.ts (1 errors) ==== var Symbol; class C { [Symbol.iterator]() { } - ~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~~~~~~~~~~~ !!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. } diff --git a/tests/baselines/reference/ES5SymbolProperty4.errors.txt b/tests/baselines/reference/ES5SymbolProperty4.errors.txt index 045647e0313..18f065c6bd5 100644 --- a/tests/baselines/reference/ES5SymbolProperty4.errors.txt +++ b/tests/baselines/reference/ES5SymbolProperty4.errors.txt @@ -1,14 +1,11 @@ -tests/cases/conformance/Symbols/ES5SymbolProperty4.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/Symbols/ES5SymbolProperty4.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. -==== tests/cases/conformance/Symbols/ES5SymbolProperty4.ts (2 errors) ==== +==== tests/cases/conformance/Symbols/ES5SymbolProperty4.ts (1 errors) ==== var Symbol: { iterator: string }; class C { [Symbol.iterator]() { } - ~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~~~~~~~~~~~ !!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. } diff --git a/tests/baselines/reference/ES5SymbolProperty5.errors.txt b/tests/baselines/reference/ES5SymbolProperty5.errors.txt index 7a94d1c4cda..bbfb64b6459 100644 --- a/tests/baselines/reference/ES5SymbolProperty5.errors.txt +++ b/tests/baselines/reference/ES5SymbolProperty5.errors.txt @@ -1,14 +1,11 @@ -tests/cases/conformance/Symbols/ES5SymbolProperty5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/Symbols/ES5SymbolProperty5.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target. -==== tests/cases/conformance/Symbols/ES5SymbolProperty5.ts (2 errors) ==== +==== tests/cases/conformance/Symbols/ES5SymbolProperty5.ts (1 errors) ==== var Symbol: { iterator: symbol }; class C { [Symbol.iterator]() { } - ~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. } (new C)[Symbol.iterator](0) // Should error diff --git a/tests/baselines/reference/ES5SymbolProperty6.errors.txt b/tests/baselines/reference/ES5SymbolProperty6.errors.txt index c86c13da05b..7e7cb32995a 100644 --- a/tests/baselines/reference/ES5SymbolProperty6.errors.txt +++ b/tests/baselines/reference/ES5SymbolProperty6.errors.txt @@ -1,13 +1,10 @@ -tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(2,6): error TS2304: Cannot find name 'Symbol'. tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(5,9): error TS2304: Cannot find name 'Symbol'. -==== tests/cases/conformance/Symbols/ES5SymbolProperty6.ts (3 errors) ==== +==== tests/cases/conformance/Symbols/ES5SymbolProperty6.ts (2 errors) ==== class C { [Symbol.iterator]() { } - ~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~~ !!! error TS2304: Cannot find name 'Symbol'. } diff --git a/tests/baselines/reference/ES5SymbolProperty7.errors.txt b/tests/baselines/reference/ES5SymbolProperty7.errors.txt index 4b35618ad52..21f6f005b3c 100644 --- a/tests/baselines/reference/ES5SymbolProperty7.errors.txt +++ b/tests/baselines/reference/ES5SymbolProperty7.errors.txt @@ -1,14 +1,11 @@ -tests/cases/conformance/Symbols/ES5SymbolProperty7.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/Symbols/ES5SymbolProperty7.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. -==== tests/cases/conformance/Symbols/ES5SymbolProperty7.ts (2 errors) ==== +==== tests/cases/conformance/Symbols/ES5SymbolProperty7.ts (1 errors) ==== var Symbol: { iterator: any }; class C { [Symbol.iterator]() { } - ~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~~~~~~~~~~~ !!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. } diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt index 2c8d034649e..c35015af7cf 100644 --- a/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,12): error TS2304: Cannot find name 'yield'. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,20): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (3 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (2 errors) ==== var v = { [yield]: foo } - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~ !!! error TS2304: Cannot find name 'yield'. ~~~ diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.js b/tests/baselines/reference/FunctionDeclaration8_es6.js index 5f9f0a2a49e..3f6d2499cef 100644 --- a/tests/baselines/reference/FunctionDeclaration8_es6.js +++ b/tests/baselines/reference/FunctionDeclaration8_es6.js @@ -2,4 +2,7 @@ var v = { [yield]: foo } //// [FunctionDeclaration8_es6.js] -var v = { [yield]: foo }; +var v = (_a = {}, _a[yield] = +foo, +_a); +var _a; diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt index ef744681fa1..152b1ffc7cc 100644 --- a/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt @@ -1,15 +1,12 @@ tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS9001: Generators are not currently supported. -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,14): error TS9000: 'yield' expressions are not currently supported. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (3 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (2 errors) ==== function * foo() { ~ !!! error TS9001: Generators are not currently supported. var v = { [yield]: foo } - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~ !!! error TS9000: 'yield' expressions are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.js b/tests/baselines/reference/FunctionDeclaration9_es6.js index 388275ed4fa..04c946a96eb 100644 --- a/tests/baselines/reference/FunctionDeclaration9_es6.js +++ b/tests/baselines/reference/FunctionDeclaration9_es6.js @@ -5,5 +5,8 @@ function * foo() { //// [FunctionDeclaration9_es6.js] function foo() { - var v = { []: foo }; + var v = (_a = {}, _a[] = + foo, + _a); + var _a; } diff --git a/tests/baselines/reference/FunctionPropertyAssignments4_es6.js b/tests/baselines/reference/FunctionPropertyAssignments4_es6.js index 595f7fc9124..71076523414 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments4_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments4_es6.js @@ -2,5 +2,4 @@ var v = { * } //// [FunctionPropertyAssignments4_es6.js] -var v = { : function () { -} }; +var v = { : function () { } }; diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt index c8c356a57ad..596764e58ea 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt @@ -1,13 +1,10 @@ tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS9001: Generators are not currently supported. -tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,13): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (3 errors) ==== +==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (2 errors) ==== var v = { *[foo()]() { } } ~ !!! error TS9001: Generators are not currently supported. - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~ !!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js index fbde587036d..0b786632bdf 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js @@ -2,4 +2,6 @@ var v = { *[foo()]() { } } //// [FunctionPropertyAssignments5_es6.js] -var v = { [foo()]: function () { } }; +var v = (_a = {}, _a[foo()] = function () { }, +_a); +var _a; diff --git a/tests/baselines/reference/YieldExpression10_es6.js b/tests/baselines/reference/YieldExpression10_es6.js index f111e6e1bdf..3bae1b645fe 100644 --- a/tests/baselines/reference/YieldExpression10_es6.js +++ b/tests/baselines/reference/YieldExpression10_es6.js @@ -7,5 +7,6 @@ var v = { * foo() { //// [YieldExpression10_es6.js] var v = { foo: function () { - ; -} }; + ; + } +}; diff --git a/tests/baselines/reference/YieldExpression13_es6.js b/tests/baselines/reference/YieldExpression13_es6.js index 328fc80dbdd..093759e6bd9 100644 --- a/tests/baselines/reference/YieldExpression13_es6.js +++ b/tests/baselines/reference/YieldExpression13_es6.js @@ -2,6 +2,4 @@ function* foo() { yield } //// [YieldExpression13_es6.js] -function foo() { - ; -} +function foo() { ; } diff --git a/tests/baselines/reference/YieldExpression17_es6.js b/tests/baselines/reference/YieldExpression17_es6.js index 6fd39844d80..cefe4ca28df 100644 --- a/tests/baselines/reference/YieldExpression17_es6.js +++ b/tests/baselines/reference/YieldExpression17_es6.js @@ -2,6 +2,4 @@ var v = { get foo() { yield foo; } } //// [YieldExpression17_es6.js] -var v = { get foo() { - ; -} }; +var v = { get foo() { ; } }; diff --git a/tests/baselines/reference/accessibilityModifiers.js b/tests/baselines/reference/accessibilityModifiers.js index af1832d9340..ebc801ac136 100644 --- a/tests/baselines/reference/accessibilityModifiers.js +++ b/tests/baselines/reference/accessibilityModifiers.js @@ -52,9 +52,7 @@ var C = (function () { } C.privateMethod = function () { }; Object.defineProperty(C, "privateGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -65,9 +63,7 @@ var C = (function () { }); C.protectedMethod = function () { }; Object.defineProperty(C, "protectedGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -78,9 +74,7 @@ var C = (function () { }); C.publicMethod = function () { }; Object.defineProperty(C, "publicGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -97,9 +91,7 @@ var D = (function () { } D.privateMethod = function () { }; Object.defineProperty(D, "privateGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -110,9 +102,7 @@ var D = (function () { }); D.protectedMethod = function () { }; Object.defineProperty(D, "protectedGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -123,9 +113,7 @@ var D = (function () { }); D.publicMethod = function () { }; Object.defineProperty(D, "publicGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -142,9 +130,7 @@ var E = (function () { } E.prototype.method = function () { }; Object.defineProperty(E.prototype, "getter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/accessorWithES3.js b/tests/baselines/reference/accessorWithES3.js index 8c0d353b310..1eecaa68d64 100644 --- a/tests/baselines/reference/accessorWithES3.js +++ b/tests/baselines/reference/accessorWithES3.js @@ -47,9 +47,7 @@ var D = (function () { return D; })(); var x = { - get a() { - return 1; - } + get a() { return 1; } }; var y = { set b(v) { } diff --git a/tests/baselines/reference/accessorWithES5.js b/tests/baselines/reference/accessorWithES5.js index d51f5e7713b..746703bce52 100644 --- a/tests/baselines/reference/accessorWithES5.js +++ b/tests/baselines/reference/accessorWithES5.js @@ -44,9 +44,7 @@ var D = (function () { return D; })(); var x = { - get a() { - return 1; - } + get a() { return 1; } }; var y = { set b(v) { } diff --git a/tests/baselines/reference/accessorWithoutBody1.js b/tests/baselines/reference/accessorWithoutBody1.js index 37f0ecbcfee..e06e305e161 100644 --- a/tests/baselines/reference/accessorWithoutBody1.js +++ b/tests/baselines/reference/accessorWithoutBody1.js @@ -2,5 +2,4 @@ var v = { get foo() } //// [accessorWithoutBody1.js] -var v = { get foo() { -} }; +var v = { get foo() { } }; diff --git a/tests/baselines/reference/accessorWithoutBody2.js b/tests/baselines/reference/accessorWithoutBody2.js index 9dc34c1e744..3b5a821d580 100644 --- a/tests/baselines/reference/accessorWithoutBody2.js +++ b/tests/baselines/reference/accessorWithoutBody2.js @@ -2,5 +2,4 @@ var v = { set foo(a) } //// [accessorWithoutBody2.js] -var v = { set foo(a) { -} }; +var v = { set foo(a) { } }; diff --git a/tests/baselines/reference/accessorsNotAllowedInES3.js b/tests/baselines/reference/accessorsNotAllowedInES3.js index 5cb5a5dc47a..0843a39191c 100644 --- a/tests/baselines/reference/accessorsNotAllowedInES3.js +++ b/tests/baselines/reference/accessorsNotAllowedInES3.js @@ -11,14 +11,10 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); return C; })(); -var y = { get foo() { - return 3; -} }; +var y = { get foo() { return 3; } }; diff --git a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js index 11590f6d068..5e527aef3e9 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js @@ -18,38 +18,26 @@ var LanguageSpec_section_4_5_error_cases = (function () { function LanguageSpec_section_4_5_error_cases() { } Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedSetter_SetterFirst", { - get: function () { - return ""; - }, + get: function () { return ""; }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedSetter_SetterLast", { - get: function () { - return ""; - }, + get: function () { return ""; }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedGetter_GetterFirst", { - get: function () { - return ""; - }, - set: function (aStr) { - aStr = 0; - }, + get: function () { return ""; }, + set: function (aStr) { aStr = 0; }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedGetter_GetterLast", { - get: function () { - return ""; - }, - set: function (aStr) { - aStr = 0; - }, + get: function () { return ""; }, + set: function (aStr) { aStr = 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/accessors_spec_section-4.5_inference.js b/tests/baselines/reference/accessors_spec_section-4.5_inference.js index 6ad452f2a5a..9aa7ce2f408 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_inference.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_inference.js @@ -47,49 +47,37 @@ var LanguageSpec_section_4_5_inference = (function () { function LanguageSpec_section_4_5_inference() { } Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredGetterFromSetterAnnotation", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredGetterFromSetterAnnotation_GetterFirst", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredFromGetter", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredFromGetter_SetterFirst", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredSetterFromGetterAnnotation", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredSetterFromGetterAnnotation_GetterFirst", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js index 49d4ea66ba8..26a77e917d9 100644 --- a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js +++ b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js @@ -84,6 +84,4 @@ var r16 = a + M; var r17 = a + ''; var r18 = a + 123; var r19 = a + { a: '' }; -var r20 = a + (function (a) { - return a; -}); +var r20 = a + (function (a) { return a; }); diff --git a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js index 20ac1350ef3..79d3c0b9b8d 100644 --- a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js +++ b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js @@ -25,9 +25,7 @@ var r11 = null + (() => { }); //// [additionOperatorWithNullValueAndInvalidOperator.js] // If one operand is the null or undefined value, it is treated as having the type of the other operand. -function foo() { - return undefined; -} +function foo() { return undefined; } var a; var b; var c; diff --git a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js index 2cf0ce22259..98935db2b86 100644 --- a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js +++ b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js @@ -25,9 +25,7 @@ var r11 = undefined + (() => { }); //// [additionOperatorWithUndefinedValueAndInvalidOperands.js] // If one operand is the null or undefined value, it is treated as having the type of the other operand. -function foo() { - return undefined; -} +function foo() { return undefined; } var a; var b; var c; diff --git a/tests/baselines/reference/aliasUsedAsNameValue.js b/tests/baselines/reference/aliasUsedAsNameValue.js index 4b6debf4c98..fb909181529 100644 --- a/tests/baselines/reference/aliasUsedAsNameValue.js +++ b/tests/baselines/reference/aliasUsedAsNameValue.js @@ -21,9 +21,7 @@ export var a = function () { //// [aliasUsedAsNameValue_0.js] exports.id; //// [aliasUsedAsNameValue_1.js] -function b(a) { - return null; -} +function b(a) { return null; } exports.b = b; //// [aliasUsedAsNameValue_2.js] /// diff --git a/tests/baselines/reference/ambientClassOverloadForFunction.js b/tests/baselines/reference/ambientClassOverloadForFunction.js index cf3a59a465d..402eca63381 100644 --- a/tests/baselines/reference/ambientClassOverloadForFunction.js +++ b/tests/baselines/reference/ambientClassOverloadForFunction.js @@ -5,6 +5,4 @@ function foo() { return null; } //// [ambientClassOverloadForFunction.js] ; -function foo() { - return null; -} +function foo() { return null; } diff --git a/tests/baselines/reference/ambientExternalModuleWithRelativeExternalImportDeclaration.errors.txt b/tests/baselines/reference/ambientExternalModuleWithRelativeExternalImportDeclaration.errors.txt index 4ebae64b0b8..72d7145969f 100644 --- a/tests/baselines/reference/ambientExternalModuleWithRelativeExternalImportDeclaration.errors.txt +++ b/tests/baselines/reference/ambientExternalModuleWithRelativeExternalImportDeclaration.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts(2,5): error TS2439: Import declaration in an ambient external module declaration cannot reference external module through relative external module name. +tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts(2,5): error TS2439: Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name. tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts(2,25): error TS2307: Cannot find external module './SubModule'. @@ -6,7 +6,7 @@ tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration. declare module "OuterModule" { import m2 = require("./SubModule"); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2439: Import declaration in an ambient external module declaration cannot reference external module through relative external module name. +!!! error TS2439: Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name. ~~~~~~~~~~~~~ !!! error TS2307: Cannot find external module './SubModule'. class SubModule { diff --git a/tests/baselines/reference/ambiguousGenericAssertion1.js b/tests/baselines/reference/ambiguousGenericAssertion1.js index 40bbbee6dd2..8d40873036c 100644 --- a/tests/baselines/reference/ambiguousGenericAssertion1.js +++ b/tests/baselines/reference/ambiguousGenericAssertion1.js @@ -6,9 +6,7 @@ var r3 = <(x: T) => T>f; // ambiguous, appears to the parser as a << operatio //// [ambiguousGenericAssertion1.js] -function f(x) { - return null; -} +function f(x) { return null; } var r = function (x) { return x; }; var r2 = f; // valid var r3 = << T > (x), T; diff --git a/tests/baselines/reference/ambiguousOverload.js b/tests/baselines/reference/ambiguousOverload.js index fd373c075a2..642f09dca16 100644 --- a/tests/baselines/reference/ambiguousOverload.js +++ b/tests/baselines/reference/ambiguousOverload.js @@ -12,15 +12,11 @@ var x2: string = foof2("s", null); var y2: number = foof2("s", null); //// [ambiguousOverload.js] -function foof(bar) { - return bar; -} +function foof(bar) { return bar; } ; var x = foof("s", null); var y = foof("s", null); -function foof2(bar) { - return bar; -} +function foof2(bar) { return bar; } ; var x2 = foof2("s", null); var y2 = foof2("s", null); diff --git a/tests/baselines/reference/anonterface.js b/tests/baselines/reference/anonterface.js index 59d055b29d7..12bfbc4ec9d 100644 --- a/tests/baselines/reference/anonterface.js +++ b/tests/baselines/reference/anonterface.js @@ -28,6 +28,4 @@ var M; M.C = C; })(M || (M = {})); var c = new M.C(); -c.m(function (n) { - return "hello: " + n; -}, 18); +c.m(function (n) { return "hello: " + n; }, 18); diff --git a/tests/baselines/reference/anyInferenceAnonymousFunctions.js b/tests/baselines/reference/anyInferenceAnonymousFunctions.js index e232ec29593..df921965994 100644 --- a/tests/baselines/reference/anyInferenceAnonymousFunctions.js +++ b/tests/baselines/reference/anyInferenceAnonymousFunctions.js @@ -27,6 +27,4 @@ paired.reduce(function (b1, b2) { }, []); paired.reduce(function (b3, b4) { return b3.concat({}); }, []); paired.map(function (c1) { return c1.count; }); -paired.map(function (c2) { - return c2.count; -}); +paired.map(function (c2) { return c2.count; }); diff --git a/tests/baselines/reference/arrayAssignmentTest1.js b/tests/baselines/reference/arrayAssignmentTest1.js index 2a82d436596..0abfa889bed 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.js +++ b/tests/baselines/reference/arrayAssignmentTest1.js @@ -95,12 +95,8 @@ var __extends = this.__extends || function (d, b) { var C1 = (function () { function C1() { } - C1.prototype.IM1 = function () { - return null; - }; - C1.prototype.C1M1 = function () { - return null; - }; + C1.prototype.IM1 = function () { return null; }; + C1.prototype.C1M1 = function () { return null; }; return C1; })(); var C2 = (function (_super) { @@ -108,17 +104,13 @@ var C2 = (function (_super) { function C2() { _super.apply(this, arguments); } - C2.prototype.C2M1 = function () { - return null; - }; + C2.prototype.C2M1 = function () { return null; }; return C2; })(C1); var C3 = (function () { function C3() { } - C3.prototype.CM3M1 = function () { - return 3; - }; + C3.prototype.CM3M1 = function () { return 3; }; return C3; })(); /* @@ -138,9 +130,7 @@ var i1 = c1; var c2 = new C2(); var c3 = new C3(); var o1 = { one: 1 }; -var f1 = function () { - return new C1(); -}; +var f1 = function () { return new C1(); }; var arr_any = []; var arr_i1 = []; var arr_c1 = []; diff --git a/tests/baselines/reference/arrayAssignmentTest2.js b/tests/baselines/reference/arrayAssignmentTest2.js index a62e0eec9ac..977862866ed 100644 --- a/tests/baselines/reference/arrayAssignmentTest2.js +++ b/tests/baselines/reference/arrayAssignmentTest2.js @@ -69,12 +69,8 @@ var __extends = this.__extends || function (d, b) { var C1 = (function () { function C1() { } - C1.prototype.IM1 = function () { - return null; - }; - C1.prototype.C1M1 = function () { - return null; - }; + C1.prototype.IM1 = function () { return null; }; + C1.prototype.C1M1 = function () { return null; }; return C1; })(); var C2 = (function (_super) { @@ -82,17 +78,13 @@ var C2 = (function (_super) { function C2() { _super.apply(this, arguments); } - C2.prototype.C2M1 = function () { - return null; - }; + C2.prototype.C2M1 = function () { return null; }; return C2; })(C1); var C3 = (function () { function C3() { } - C3.prototype.CM3M1 = function () { - return 3; - }; + C3.prototype.CM3M1 = function () { return 3; }; return C3; })(); /* @@ -112,9 +104,7 @@ var i1 = c1; var c2 = new C2(); var c3 = new C3(); var o1 = { one: 1 }; -var f1 = function () { - return new C1(); -}; +var f1 = function () { return new C1(); }; var arr_any = []; var arr_i1 = []; var arr_c1 = []; @@ -128,9 +118,7 @@ arr_c3 = arr_c2_2; // should be an error - is arr_c3 = arr_c1_2; // should be an error - is arr_c3 = arr_i1_2; // should be an error - is arr_any = f1; // should be an error - is -arr_any = function () { - return null; -}; // should be an error - is +arr_any = function () { return null; }; // should be an error - is arr_any = o1; // should be an error - is arr_any = a1; // should be ok - is arr_any = c1; // should be an error - is diff --git a/tests/baselines/reference/arrayAssignmentTest4.js b/tests/baselines/reference/arrayAssignmentTest4.js index 7ac0ccde77f..c38cdebc06c 100644 --- a/tests/baselines/reference/arrayAssignmentTest4.js +++ b/tests/baselines/reference/arrayAssignmentTest4.js @@ -30,9 +30,7 @@ arr_any = c3; // should be an error - is var C3 = (function () { function C3() { } - C3.prototype.CM3M1 = function () { - return 3; - }; + C3.prototype.CM3M1 = function () { return 3; }; return C3; })(); /* @@ -49,7 +47,5 @@ Type 1 of any[]: var c3 = new C3(); var o1 = { one: 1 }; var arr_any = []; -arr_any = function () { - return null; -}; // should be an error - is +arr_any = function () { return null; }; // should be an error - is arr_any = c3; // should be an error - is diff --git a/tests/baselines/reference/arrowFunctionContexts.js b/tests/baselines/reference/arrowFunctionContexts.js index cdf902a6c37..a10e3955ae0 100644 --- a/tests/baselines/reference/arrowFunctionContexts.js +++ b/tests/baselines/reference/arrowFunctionContexts.js @@ -184,14 +184,10 @@ var M2; // (ParamList) => { ... } is a generic arrow function var generic1 = function (n) { return [n]; }; var generic1; // Incorrect error, Bug 829597 -var generic2 = function (n) { - return [n]; -}; +var generic2 = function (n) { return [n]; }; var generic2; // ((ParamList) => { ... } ) is a type assertion to an arrow function var asserted1 = (function (n) { return [n]; }); var asserted1; -var asserted2 = (function (n) { - return n; -}); +var asserted2 = (function (n) { return n; }); var asserted2; diff --git a/tests/baselines/reference/arrowFunctionExpressions.js b/tests/baselines/reference/arrowFunctionExpressions.js index a828da6cffc..68516b52cb2 100644 --- a/tests/baselines/reference/arrowFunctionExpressions.js +++ b/tests/baselines/reference/arrowFunctionExpressions.js @@ -91,16 +91,10 @@ function tryCatchFn() { //// [arrowFunctionExpressions.js] // ArrowFormalParameters => AssignmentExpression is equivalent to ArrowFormalParameters => { return AssignmentExpression; } var a = function (p) { return p.length; }; -var a = function (p) { - return p.length; -}; +var a = function (p) { return p.length; }; // Identifier => Block is equivalent to(Identifier) => Block -var b = function (j) { - return 0; -}; -var b = function (j) { - return 0; -}; +var b = function (j) { return 0; }; +var b = function (j) { return 0; }; // Identifier => AssignmentExpression is equivalent to(Identifier) => AssignmentExpression var c; var d = function (n) { return c = n; }; diff --git a/tests/baselines/reference/arrowFunctionInConstructorArgument1.js b/tests/baselines/reference/arrowFunctionInConstructorArgument1.js index 3cfc18d2cf7..0f9c3f81b3b 100644 --- a/tests/baselines/reference/arrowFunctionInConstructorArgument1.js +++ b/tests/baselines/reference/arrowFunctionInConstructorArgument1.js @@ -11,6 +11,4 @@ var C = (function () { } return C; })(); -var c = new C(function () { - return asdf; -}); // should error +var c = new C(function () { return asdf; }); // should error diff --git a/tests/baselines/reference/arrowFunctionsMissingTokens.js b/tests/baselines/reference/arrowFunctionsMissingTokens.js index 3ea21232ac4..e0e22578ac6 100644 --- a/tests/baselines/reference/arrowFunctionsMissingTokens.js +++ b/tests/baselines/reference/arrowFunctionsMissingTokens.js @@ -79,24 +79,12 @@ var missingCurliesWithArrow; (function (missingCurliesWithArrow) { var withStatement; (function (withStatement) { - var a = function () { - var k = 10; - }; - var b = function () { - var k = 10; - }; - var c = function (x) { - var k = 10; - }; - var d = function (x, y) { - var k = 10; - }; - var e = function (x, y) { - var k = 10; - }; - var f = function () { - var k = 10; - }; + var a = function () { var k = 10; }; + var b = function () { var k = 10; }; + var c = function (x) { var k = 10; }; + var d = function (x, y) { var k = 10; }; + var e = function (x, y) { var k = 10; }; + var f = function () { var k = 10; }; })(withStatement || (withStatement = {})); var withoutStatement; (function (withoutStatement) { diff --git a/tests/baselines/reference/asiArith.js b/tests/baselines/reference/asiArith.js index 6d7b964c8d0..ac739bbd767 100644 --- a/tests/baselines/reference/asiArith.js +++ b/tests/baselines/reference/asiArith.js @@ -37,7 +37,9 @@ y //// [asiArith.js] var x = 1; var y = 1; -var z = x + + +y; +var z = x + ++ +y; var a = 1; var b = 1; -var c = x - - -y; +var c = x - +- -y; diff --git a/tests/baselines/reference/assignEveryTypeToAny.js b/tests/baselines/reference/assignEveryTypeToAny.js index c88fc2edc17..15aa6bcdd91 100644 --- a/tests/baselines/reference/assignEveryTypeToAny.js +++ b/tests/baselines/reference/assignEveryTypeToAny.js @@ -91,12 +91,8 @@ var h; x = h; var i; x = i; -x = { f: function () { - return 1; -} }; -x = { f: function (x) { - return x; -} }; +x = { f: function () { return 1; } }; +x = { f: function (x) { return x; } }; function j(a) { x = a; } diff --git a/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js b/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js index 513a2080dd4..fe6142cafe0 100644 --- a/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js +++ b/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js @@ -12,6 +12,4 @@ fn(function (a, b) { return true; }) //// [assignLambdaToNominalSubtypeOfFunction.js] function fn(cb) { } fn(function (a, b) { return true; }); -fn(function (a, b) { - return true; -}); +fn(function (a, b) { return true; }); diff --git a/tests/baselines/reference/assignToFn.js b/tests/baselines/reference/assignToFn.js index 620753e4941..2ff8ceedfa6 100644 --- a/tests/baselines/reference/assignToFn.js +++ b/tests/baselines/reference/assignToFn.js @@ -13,8 +13,6 @@ module M { //// [assignToFn.js] var M; (function (M) { - var x = { f: function (n) { - return true; - } }; + var x = { f: function (n) { return true; } }; x.f = "hello"; })(M || (M = {})); diff --git a/tests/baselines/reference/assignmentCompatBug2.js b/tests/baselines/reference/assignmentCompatBug2.js index 77d1e1b7d16..5545cc7d19c 100644 --- a/tests/baselines/reference/assignmentCompatBug2.js +++ b/tests/baselines/reference/assignmentCompatBug2.js @@ -44,50 +44,28 @@ b2 = { a: 0 }; // error b2 = { b: 0, a: 0 }; var b3; b3 = { - f: function (n) { - return 0; - }, - g: function (s) { - return 0; - }, + f: function (n) { return 0; }, + g: function (s) { return 0; }, m: 0 }; // ok b3 = { - f: function (n) { - return 0; - }, - g: function (s) { - return 0; - } + f: function (n) { return 0; }, + g: function (s) { return 0; } }; // error b3 = { - f: function (n) { - return 0; - }, + f: function (n) { return 0; }, m: 0 }; // error b3 = { - f: function (n) { - return 0; - }, - g: function (s) { - return 0; - }, + f: function (n) { return 0; }, + g: function (s) { return 0; }, m: 0, n: 0, - k: function (a) { - return null; - } + k: function (a) { return null; } }; // ok b3 = { - f: function (n) { - return 0; - }, - g: function (s) { - return 0; - }, + f: function (n) { return 0; }, + g: function (s) { return 0; }, n: 0, - k: function (a) { - return null; - } + k: function (a) { return null; } }; // error diff --git a/tests/baselines/reference/assignmentCompatBug3.js b/tests/baselines/reference/assignmentCompatBug3.js index da21ac17c9d..049e7090335 100644 --- a/tests/baselines/reference/assignmentCompatBug3.js +++ b/tests/baselines/reference/assignmentCompatBug3.js @@ -28,12 +28,8 @@ foo(x + y); //// [assignmentCompatBug3.js] function makePoint(x, y) { return { - get x() { - return x; - }, - get y() { - return y; - }, + get x() { return x; }, + get y() { return y; }, //x: "yo", //y: "boo", dist: function () { diff --git a/tests/baselines/reference/assignmentCompatBug5.js b/tests/baselines/reference/assignmentCompatBug5.js index d4f82584bec..ae444c3dad6 100644 --- a/tests/baselines/reference/assignmentCompatBug5.js +++ b/tests/baselines/reference/assignmentCompatBug5.js @@ -19,6 +19,4 @@ foo2(["s", "t"]); function foo3(x) { } ; foo3(function (s) { }); -foo3(function (n) { - return; -}); +foo3(function (n) { return; }); diff --git a/tests/baselines/reference/assignmentCompatForEnums.js b/tests/baselines/reference/assignmentCompatForEnums.js index 4bca6a514d2..8db85399fa8 100644 --- a/tests/baselines/reference/assignmentCompatForEnums.js +++ b/tests/baselines/reference/assignmentCompatForEnums.js @@ -22,9 +22,7 @@ var TokenType; })(TokenType || (TokenType = {})); ; var list = {}; -function returnType() { - return null; -} +function returnType() { return null; } function foo() { var x = returnType(); var x = list['one']; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures.js b/tests/baselines/reference/assignmentCompatWithCallSignatures.js index 0539463ddb1..12fc6159fac 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures.js @@ -57,26 +57,18 @@ a = s; a = a2; t = function (x) { return 1; }; t = function () { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = function (x) { return 1; }; a = function () { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; var s2; var a3; // these are errors t = s2; t = a3; t = function (x) { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = s2; a = a3; a = function (x) { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures2.js b/tests/baselines/reference/assignmentCompatWithCallSignatures2.js index 6fabe9b6af7..6bfc1b6c0d6 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures2.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures2.js @@ -64,38 +64,24 @@ a = s; a = a2; t = { f: function () { return 1; } }; t = { f: function (x) { return 1; } }; -t = { f: function f() { - return 1; -} }; -t = { f: function (x) { - return ''; -} }; +t = { f: function f() { return 1; } }; +t = { f: function (x) { return ''; } }; a = { f: function () { return 1; } }; a = { f: function (x) { return 1; } }; -a = { f: function (x) { - return ''; -} }; +a = { f: function (x) { return ''; } }; // errors t = function () { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = function () { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; var s2; var a3; // these are errors t = s2; t = a3; t = function (x) { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = s2; a = a3; a = function (x) { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures.js index 3dc7511fec0..c00aa121712 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures.js @@ -54,12 +54,8 @@ var a3; t = s2; t = a3; t = function (x) { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = s2; a = a3; a = function (x) { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js index 7f173224bc9..d00762aa1c5 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js @@ -56,25 +56,17 @@ a = s; a = a2; // errors t = function () { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = function () { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; var s2; var a3; // these are errors t = s2; t = a3; t = function (x) { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = s2; a = a3; a = function (x) { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithOverloads.js b/tests/baselines/reference/assignmentCompatWithOverloads.js index 472ebec2967..ca3dc0e2294 100644 --- a/tests/baselines/reference/assignmentCompatWithOverloads.js +++ b/tests/baselines/reference/assignmentCompatWithOverloads.js @@ -31,18 +31,10 @@ var d: new(x: number) => void; d = C; // Error //// [assignmentCompatWithOverloads.js] -function f1(x) { - return null; -} -function f2(x) { - return null; -} -function f3(x) { - return null; -} -function f4(x) { - return undefined; -} +function f1(x) { return null; } +function f2(x) { return null; } +function f3(x) { return null; } +function f4(x) { return undefined; } var g; g = f1; // OK g = f2; // Error diff --git a/tests/baselines/reference/assignmentCompatability24.js b/tests/baselines/reference/assignmentCompatability24.js index 7eda1e61266..e6961264de8 100644 --- a/tests/baselines/reference/assignmentCompatability24.js +++ b/tests/baselines/reference/assignmentCompatability24.js @@ -19,9 +19,7 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.obj = function f(a) { - return a; - }; + __test2__.obj = function f(a) { return a; }; ; __test2__.__val__obj = __test2__.obj; })(__test2__ || (__test2__ = {})); diff --git a/tests/baselines/reference/assignmentLHSIsValue.js b/tests/baselines/reference/assignmentLHSIsValue.js index 15bc7b9acfd..4b17f855171 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.js +++ b/tests/baselines/reference/assignmentLHSIsValue.js @@ -84,17 +84,11 @@ var C = (function () { function C() { this = value; } - C.prototype.foo = function () { - this = value; - }; - C.sfoo = function () { - this = value; - }; + C.prototype.foo = function () { this = value; }; + C.sfoo = function () { this = value; }; return C; })(); -function foo() { - this = value; -} +function foo() { this = value; } this = value; // identifiers: module, class, enum, function var M; @@ -129,12 +123,8 @@ var Derived = (function (_super) { _super.call(this); _super.prototype. = value; } - Derived.prototype.foo = function () { - _super.prototype. = value; - }; - Derived.sfoo = function () { - _super. = value; - }; + Derived.prototype.foo = function () { _super.prototype. = value; }; + Derived.sfoo = function () { _super. = value; }; return Derived; })(C); // function expression diff --git a/tests/baselines/reference/bestCommonTypeOfTuple.js b/tests/baselines/reference/bestCommonTypeOfTuple.js index 752523317b5..f78f8990db0 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple.js +++ b/tests/baselines/reference/bestCommonTypeOfTuple.js @@ -26,15 +26,9 @@ var e3 = t3[2]; // any var e4 = t4[3]; // number //// [bestCommonTypeOfTuple.js] -function f1(x) { - return "foo"; -} -function f2(x) { - return 10; -} -function f3(x) { - return true; -} +function f1(x) { return "foo"; } +function f2(x) { return 10; } +function f3(x) { return true; } var E1; (function (E1) { E1[E1["one"] = 0] = "one"; diff --git a/tests/baselines/reference/bestCommonTypeReturnStatement.js b/tests/baselines/reference/bestCommonTypeReturnStatement.js index 232ffc07c54..f4ab98ed1c6 100644 --- a/tests/baselines/reference/bestCommonTypeReturnStatement.js +++ b/tests/baselines/reference/bestCommonTypeReturnStatement.js @@ -18,9 +18,5 @@ function f() { return b(); return d(); } -function b() { - return null; -} -function d() { - return null; -} +function b() { return null; } +function d() { return null; } diff --git a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js index 9416e7b1a06..fb573a7523f 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js @@ -41,15 +41,11 @@ var ResultIsNumber8 = ~~BOOLEAN; //// [bitwiseNotOperatorWithBooleanType.js] // ~ operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js index 2f9703ae669..ac439f02903 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js @@ -48,15 +48,11 @@ var ResultIsNumber13 = ~~~(NUMBER + NUMBER); // ~ operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -70,9 +66,7 @@ var ResultIsNumber2 = ~NUMBER1; // number type literal var ResultIsNumber3 = ~1; var ResultIsNumber4 = ~{ x: 1, y: 2 }; -var ResultIsNumber5 = ~{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = ~{ x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsNumber6 = ~objA.a; var ResultIsNumber7 = ~M.n; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithStringType.js b/tests/baselines/reference/bitwiseNotOperatorWithStringType.js index fbd77c6119a..a553712e16b 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithStringType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithStringType.js @@ -47,15 +47,11 @@ var ResultIsNumber14 = ~~~(STRING + STRING); // ~ operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -69,9 +65,7 @@ var ResultIsNumber2 = ~STRING1; // string type literal var ResultIsNumber3 = ~""; var ResultIsNumber4 = ~{ x: "", y: "" }; -var ResultIsNumber5 = ~{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber5 = ~{ x: "", y: function (s) { return s; } }; // string type expressions var ResultIsNumber6 = ~objA.a; var ResultIsNumber7 = ~M.n; diff --git a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js index 59bfabd21d6..f1028956e16 100644 --- a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js +++ b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js @@ -47,14 +47,10 @@ var r7b = i2.f(1, ''); //// [callGenericFunctionWithIncorrectNumberOfTypeArguments.js] // type parameter lists must exactly match type argument lists // all of these invocations are errors -function f(x, y) { - return null; -} +function f(x, y) { return null; } var r1 = f(1, ''); var r1b = f(1, ''); -var f2 = function (x, y) { - return null; -}; +var f2 = function (x, y) { return null; }; var r2 = f2(1, ''); var r2b = f2(1, ''); var f3; diff --git a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js index 04edc93f5d9..26b9d33a55d 100644 --- a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js +++ b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js @@ -38,13 +38,9 @@ var r7 = i2.f(1); //// [callGenericFunctionWithZeroTypeArguments.js] // valid invocations of generic functions with no explicit type arguments provided -function f(x) { - return null; -} +function f(x) { return null; } var r = f(1); -var f2 = function (x) { - return null; -}; +var f2 = function (x) { return null; }; var r2 = f2(1); var f3; var r3 = f3(1); diff --git a/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js b/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js index 306b4c70362..7b0355533e3 100644 --- a/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js +++ b/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js @@ -46,13 +46,9 @@ var r8 = a2(); //// [callNonGenericFunctionWithTypeArguments.js] // it is always illegal to provide type arguments to a non-generic function // all invocations here are illegal -function f(x) { - return null; -} +function f(x) { return null; } var r = f(1); -var f2 = function (x) { - return null; -}; +var f2 = function (x) { return null; }; var r2 = f2(1); var f3; var r3 = f3(1); diff --git a/tests/baselines/reference/callOverloads1.js b/tests/baselines/reference/callOverloads1.js index 94397c4ef8e..b1148c12420 100644 --- a/tests/baselines/reference/callOverloads1.js +++ b/tests/baselines/reference/callOverloads1.js @@ -25,9 +25,7 @@ var Foo = (function () { Foo.prototype.bar1 = function () { }; return Foo; })(); -function F1(a) { - return a; -} +function F1(a) { return a; } var f1 = new Foo("hey"); f1.bar1(); Foo(); diff --git a/tests/baselines/reference/callOverloads2.js b/tests/baselines/reference/callOverloads2.js index ed1b9cfcac3..b336911eeb0 100644 --- a/tests/baselines/reference/callOverloads2.js +++ b/tests/baselines/reference/callOverloads2.js @@ -33,12 +33,8 @@ var Foo = (function () { Foo.prototype.bar1 = function () { }; return Foo; })(); -function F1(s) { - return s; -} // error -function F1(a) { - return a; -} // error +function F1(s) { return s; } // error +function F1(a) { return a; } // error var f1 = new Foo("hey"); f1.bar1(); Foo(); diff --git a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js index c048c5c56de..0e78aac2b1b 100644 --- a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js +++ b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js @@ -202,9 +202,7 @@ function foo12() { return i2; } var r12 = foo12(); -function m1() { - return 1; -} +function m1() { return 1; } var m1; (function (m1) { m1.y = 2; diff --git a/tests/baselines/reference/callbacksDontShareTypes.js b/tests/baselines/reference/callbacksDontShareTypes.js index 649ed1cb6ca..e6483638058 100644 --- a/tests/baselines/reference/callbacksDontShareTypes.js +++ b/tests/baselines/reference/callbacksDontShareTypes.js @@ -21,14 +21,8 @@ var r5b = _.map(c2, rf1); //// [callbacksDontShareTypes.js] var _; var c2; -var rf1 = function (x) { - return x.toFixed(); -}; -var r1a = _.map(c2, function (x) { - return x.toFixed(); -}); +var rf1 = function (x) { return x.toFixed(); }; +var r1a = _.map(c2, function (x) { return x.toFixed(); }); var r1b = _.map(c2, rf1); // this line should not cause the following 2 to have errors -var r5a = _.map(c2, function (x) { - return x.toFixed(); -}); +var r5a = _.map(c2, function (x) { return x.toFixed(); }); var r5b = _.map(c2, rf1); diff --git a/tests/baselines/reference/castTest.js b/tests/baselines/reference/castTest.js index 5afa67026b9..ef9ef084d98 100644 --- a/tests/baselines/reference/castTest.js +++ b/tests/baselines/reference/castTest.js @@ -47,7 +47,5 @@ var p_cast = ({ add: function (dx, dy) { return new Point(this.x + dx, this.y + dy); }, - mult: function (p) { - return p; - } + mult: function (p) { return p; } }); diff --git a/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js b/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js index e6995a04aca..1884967aa9e 100644 --- a/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js +++ b/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js @@ -14,6 +14,4 @@ var s3 = s2.each(x => { x.key /* Type is K, should be number */ }); //// [chainedSpecializationToObjectTypeLiteral.js] var s; var s2 = s.groupBy(function (s) { return s.length; }); -var s3 = s2.each(function (x) { - x.key; /* Type is K, should be number */ -}); +var s3 = s2.each(function (x) { x.key; /* Type is K, should be number */ }); diff --git a/tests/baselines/reference/classExpression.js b/tests/baselines/reference/classExpression.js index 9d902abbf52..6bcf0f46f74 100644 --- a/tests/baselines/reference/classExpression.js +++ b/tests/baselines/reference/classExpression.js @@ -20,9 +20,7 @@ var C = (function () { return C; })(); var y = { - foo: , - class: C2 -}, _a = void 0; + foo: , class: C2 }, _a = void 0; var M; (function (M) { var z = ; diff --git a/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.js b/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.js index ed6e3138b07..907b6bd6fd2 100644 --- a/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.js +++ b/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.js @@ -19,20 +19,14 @@ var C = (function () { function C() { this.x = 1; } - C.prototype.foo = function (x) { - return x; - }; + C.prototype.foo = function (x) { return x; }; return C; })(); var D2 = (function () { function D2() { this.x = 3; } - D2.prototype.foo = function (x) { - return x; - }; - D2.prototype.other = function (x) { - return x; - }; + D2.prototype.foo = function (x) { return x; }; + D2.prototype.other = function (x) { return x; }; return D2; })(); diff --git a/tests/baselines/reference/classImplementsClass2.js b/tests/baselines/reference/classImplementsClass2.js index 98554944bc9..bc4f6b6748c 100644 --- a/tests/baselines/reference/classImplementsClass2.js +++ b/tests/baselines/reference/classImplementsClass2.js @@ -23,9 +23,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classImplementsClass3.js b/tests/baselines/reference/classImplementsClass3.js index 9dbfc4388e9..450263d00c9 100644 --- a/tests/baselines/reference/classImplementsClass3.js +++ b/tests/baselines/reference/classImplementsClass3.js @@ -24,9 +24,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classImplementsClass4.js b/tests/baselines/reference/classImplementsClass4.js index 0e08e508fb5..ac5c899bbbf 100644 --- a/tests/baselines/reference/classImplementsClass4.js +++ b/tests/baselines/reference/classImplementsClass4.js @@ -27,9 +27,7 @@ var A = (function () { function A() { this.x = 1; } - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classImplementsClass5.js b/tests/baselines/reference/classImplementsClass5.js index 46e826683e7..a0971904cc3 100644 --- a/tests/baselines/reference/classImplementsClass5.js +++ b/tests/baselines/reference/classImplementsClass5.js @@ -28,9 +28,7 @@ var A = (function () { function A() { this.x = 1; } - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classImplementsClass6.js b/tests/baselines/reference/classImplementsClass6.js index 386cd6685ae..931218e2bea 100644 --- a/tests/baselines/reference/classImplementsClass6.js +++ b/tests/baselines/reference/classImplementsClass6.js @@ -34,9 +34,7 @@ var A = (function () { A.bar = function () { return ""; }; - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classOrder2.js b/tests/baselines/reference/classOrder2.js index 0ba1e016bc8..4bc1c3f790c 100644 --- a/tests/baselines/reference/classOrder2.js +++ b/tests/baselines/reference/classOrder2.js @@ -31,9 +31,7 @@ var A = (function (_super) { function A() { _super.apply(this, arguments); } - A.prototype.foo = function () { - this.bar(); - }; + A.prototype.foo = function () { this.bar(); }; return A; })(B); var B = (function () { diff --git a/tests/baselines/reference/classPropertyAsPrivate.js b/tests/baselines/reference/classPropertyAsPrivate.js index fdb16620fac..51d08b48ec5 100644 --- a/tests/baselines/reference/classPropertyAsPrivate.js +++ b/tests/baselines/reference/classPropertyAsPrivate.js @@ -28,18 +28,14 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true }); C.prototype.foo = function () { }; Object.defineProperty(C, "b", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classPropertyAsProtected.js b/tests/baselines/reference/classPropertyAsProtected.js index d036319fe8f..1cd74089816 100644 --- a/tests/baselines/reference/classPropertyAsProtected.js +++ b/tests/baselines/reference/classPropertyAsProtected.js @@ -28,18 +28,14 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true }); C.prototype.foo = function () { }; Object.defineProperty(C, "b", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classPropertyIsPublicByDefault.js b/tests/baselines/reference/classPropertyIsPublicByDefault.js index fefa48be10a..a0b61a08922 100644 --- a/tests/baselines/reference/classPropertyIsPublicByDefault.js +++ b/tests/baselines/reference/classPropertyIsPublicByDefault.js @@ -27,18 +27,14 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true }); C.prototype.foo = function () { }; Object.defineProperty(C, "b", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classSideInheritance1.js b/tests/baselines/reference/classSideInheritance1.js index 38b84b77bd3..74df624a78c 100644 --- a/tests/baselines/reference/classSideInheritance1.js +++ b/tests/baselines/reference/classSideInheritance1.js @@ -28,9 +28,7 @@ var A = (function () { A.bar = function () { return ""; }; - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C2 = (function (_super) { diff --git a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.js b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.js index e39391be68d..1c07449c994 100644 --- a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.js +++ b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.js @@ -30,13 +30,9 @@ i = c; var C = (function () { function C() { } - C.prototype.y = function (a) { - return null; - }; + C.prototype.y = function (a) { return null; }; Object.defineProperty(C.prototype, "z", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.js b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.js index b7aa9d52332..78e5cb05861 100644 --- a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.js +++ b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.js @@ -32,13 +32,9 @@ i = c; var C = (function () { function C() { } - C.prototype.y = function (a) { - return null; - }; + C.prototype.y = function (a) { return null; }; Object.defineProperty(C.prototype, "z", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classWithPrivateProperty.js b/tests/baselines/reference/classWithPrivateProperty.js index 224fc432b64..0529fd8d694 100644 --- a/tests/baselines/reference/classWithPrivateProperty.js +++ b/tests/baselines/reference/classWithPrivateProperty.js @@ -30,12 +30,8 @@ var C = (function () { this.b = ''; this.d = function () { return ''; }; } - C.prototype.c = function () { - return ''; - }; - C.f = function () { - return ''; - }; + C.prototype.c = function () { return ''; }; + C.f = function () { return ''; }; C.g = function () { return ''; }; return C; })(); diff --git a/tests/baselines/reference/classWithProtectedProperty.js b/tests/baselines/reference/classWithProtectedProperty.js index c0dde0d3237..4de87229ad0 100644 --- a/tests/baselines/reference/classWithProtectedProperty.js +++ b/tests/baselines/reference/classWithProtectedProperty.js @@ -41,12 +41,8 @@ var C = (function () { this.b = ''; this.d = function () { return ''; }; } - C.prototype.c = function () { - return ''; - }; - C.f = function () { - return ''; - }; + C.prototype.c = function () { return ''; }; + C.f = function () { return ''; }; C.g = function () { return ''; }; return C; })(); diff --git a/tests/baselines/reference/classWithPublicProperty.js b/tests/baselines/reference/classWithPublicProperty.js index 97b3f46ab49..cc1b0aad64f 100644 --- a/tests/baselines/reference/classWithPublicProperty.js +++ b/tests/baselines/reference/classWithPublicProperty.js @@ -28,12 +28,8 @@ var C = (function () { this.b = ''; this.d = function () { return ''; }; } - C.prototype.c = function () { - return ''; - }; - C.f = function () { - return ''; - }; + C.prototype.c = function () { return ''; }; + C.f = function () { return ''; }; C.g = function () { return ''; }; return C; })(); diff --git a/tests/baselines/reference/classWithStaticMembers.js b/tests/baselines/reference/classWithStaticMembers.js index 0d3747dc313..36b8bd0af64 100644 --- a/tests/baselines/reference/classWithStaticMembers.js +++ b/tests/baselines/reference/classWithStaticMembers.js @@ -31,13 +31,9 @@ var C = (function () { this.a = a; this.b = b; } - C.fn = function () { - return this; - }; + C.fn = function () { return this; }; Object.defineProperty(C, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/cloduleWithDuplicateMember1.js b/tests/baselines/reference/cloduleWithDuplicateMember1.js index d64da830598..e3cb8f83fed 100644 --- a/tests/baselines/reference/cloduleWithDuplicateMember1.js +++ b/tests/baselines/reference/cloduleWithDuplicateMember1.js @@ -20,9 +20,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/clodulesDerivedClasses.js b/tests/baselines/reference/clodulesDerivedClasses.js index f249a7d5589..b4b31e59d3e 100644 --- a/tests/baselines/reference/clodulesDerivedClasses.js +++ b/tests/baselines/reference/clodulesDerivedClasses.js @@ -38,9 +38,7 @@ var Shape; (function (Shape) { var Utils; (function (Utils) { - function convert() { - return null; - } + function convert() { return null; } Utils.convert = convert; })(Utils = Shape.Utils || (Shape.Utils = {})); })(Shape || (Shape = {})); diff --git a/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.js b/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.js index 9db005de9b9..141ef285f03 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.js +++ b/tests/baselines/reference/collisionCodeGenModuleWithAccessorChildren.js @@ -63,14 +63,14 @@ var M; })(); })(M || (M = {})); var M; -(function (_M) { +(function (_M_1) { var d = (function () { function d() { } Object.defineProperty(d.prototype, "Z", { set: function (p) { var M = 10; - this.y = _M.x; + this.y = _M_1.x; }, enumerable: true, configurable: true @@ -94,14 +94,14 @@ var M; })(); })(M || (M = {})); var M; -(function (_M) { +(function (_M_2) { var f = (function () { function f() { } Object.defineProperty(f.prototype, "Z", { get: function () { var M = 10; - return _M.x; + return _M_2.x; }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.js b/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.js index 33a9f97f6d1..2158a0562ea 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.js +++ b/tests/baselines/reference/collisionCodeGenModuleWithConstructorChildren.js @@ -35,21 +35,21 @@ var M; })(); })(M || (M = {})); var M; -(function (_M) { +(function (_M_1) { var d = (function () { function d(M, p) { - if (p === void 0) { p = _M.x; } + if (p === void 0) { p = _M_1.x; } this.M = M; } return d; })(); })(M || (M = {})); var M; -(function (_M) { +(function (_M_2) { var d2 = (function () { function d2() { var M = 10; - var p = _M.x; + var p = _M_2.x; } return d2; })(); diff --git a/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.js b/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.js index 81e1ce4421b..2def4c49c25 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.js +++ b/tests/baselines/reference/collisionCodeGenModuleWithFunctionChildren.js @@ -26,17 +26,17 @@ var M; function fn(M, p) { } })(M || (M = {})); var M; -(function (_M) { +(function (_M_1) { function fn2() { var M; - var p = _M.x; + var p = _M_1.x; } })(M || (M = {})); var M; -(function (_M) { +(function (_M_2) { function fn3() { function M() { - var p = _M.x; + var p = _M_2.x; } } })(M || (M = {})); diff --git a/tests/baselines/reference/collisionCodeGenModuleWithMemberClassConflict.js b/tests/baselines/reference/collisionCodeGenModuleWithMemberClassConflict.js index 3c75d2e5738..59c2ebf295d 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithMemberClassConflict.js +++ b/tests/baselines/reference/collisionCodeGenModuleWithMemberClassConflict.js @@ -27,19 +27,19 @@ var m1; })(m1 || (m1 = {})); var foo = new m1.m1(); var m2; -(function (__m2) { +(function (_m2_1) { var m2 = (function () { function m2() { } return m2; })(); - __m2.m2 = m2; + _m2_1.m2 = m2; var _m2 = (function () { function _m2() { } return _m2; })(); - __m2._m2 = _m2; + _m2_1._m2 = _m2; })(m2 || (m2 = {})); var foo = new m2.m2(); var foo = new m2._m2(); diff --git a/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.js b/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.js index 5bdd555b0ca..83d9330dbcf 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.js +++ b/tests/baselines/reference/collisionCodeGenModuleWithMethodChildren.js @@ -44,25 +44,25 @@ var M; })(); })(M || (M = {})); var M; -(function (_M) { +(function (_M_1) { var d = (function () { function d() { } d.prototype.fn2 = function () { var M; - var p = _M.x; + var p = _M_1.x; }; return d; })(); })(M || (M = {})); var M; -(function (_M) { +(function (_M_2) { var e = (function () { function e() { } e.prototype.fn3 = function () { function M() { - var p = _M.x; + var p = _M_2.x; } }; return e; diff --git a/tests/baselines/reference/collisionCodeGenModuleWithModuleChildren.js b/tests/baselines/reference/collisionCodeGenModuleWithModuleChildren.js index ecc5fca2e9f..3c8b17deadd 100644 --- a/tests/baselines/reference/collisionCodeGenModuleWithModuleChildren.js +++ b/tests/baselines/reference/collisionCodeGenModuleWithModuleChildren.js @@ -53,7 +53,7 @@ var M; })(m1 || (m1 = {})); })(M || (M = {})); var M; -(function (_M) { +(function (_M_1) { var m2; (function (m2) { var M = (function () { @@ -61,17 +61,17 @@ var M; } return M; })(); - var p = _M.x; + var p = _M_1.x; var p2 = new M(); })(m2 || (m2 = {})); })(M || (M = {})); var M; -(function (_M) { +(function (_M_2) { var m3; (function (m3) { function M() { } - var p = _M.x; + var p = _M_2.x; var p2 = M(); })(m3 || (m3 = {})); })(M || (M = {})); @@ -84,12 +84,12 @@ var M; })(m3 || (m3 = {})); })(M || (M = {})); var M; -(function (_M) { +(function (_M_3) { var m4; (function (m4) { var M; (function (M) { - var p = _M.x; + var p = _M_3.x; })(M || (M = {})); })(m4 || (m4 = {})); })(M || (M = {})); diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.js b/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.js index 967d01819ec..879dd83d778 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.js +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.js @@ -12,7 +12,5 @@ var console; function x() { var _this = this; var _this = 5; - (function (x) { - console.log(_this.x); - }); + (function (x) { console.log(_this.x); }); } diff --git a/tests/baselines/reference/collisionThisExpressionAndParameter.js b/tests/baselines/reference/collisionThisExpressionAndParameter.js index 7c11cab769f..3a19cf20d5a 100644 --- a/tests/baselines/reference/collisionThisExpressionAndParameter.js +++ b/tests/baselines/reference/collisionThisExpressionAndParameter.js @@ -144,9 +144,7 @@ var Foo1 = (function () { })(); function f1(_this) { var _this = this; - (function (x) { - console.log(_this.x); - }); + (function (x) { console.log(_this.x); }); } var Foo3 = (function () { function Foo3(_this) { @@ -167,7 +165,5 @@ var Foo3 = (function () { })(); function f3(_this) { var _this = this; - (function (x) { - console.log(_this.x); - }); + (function (x) { console.log(_this.x); }); } diff --git a/tests/baselines/reference/commentOnClassAccessor1.js b/tests/baselines/reference/commentOnClassAccessor1.js index cdd14a829fc..428e500da55 100644 --- a/tests/baselines/reference/commentOnClassAccessor1.js +++ b/tests/baselines/reference/commentOnClassAccessor1.js @@ -14,9 +14,7 @@ var C = (function () { /** * @type {number} */ - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/commentOnClassAccessor2.js b/tests/baselines/reference/commentOnClassAccessor2.js index e75431a7280..22a6b69f6c3 100644 --- a/tests/baselines/reference/commentOnClassAccessor2.js +++ b/tests/baselines/reference/commentOnClassAccessor2.js @@ -19,9 +19,7 @@ var C = (function () { /** * Getter. */ - get: function () { - return 1; - }, + get: function () { return 1; }, /** * Setter. */ diff --git a/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.js b/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.js index dc9bac84fa5..39f967555bf 100644 --- a/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.js +++ b/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.js @@ -11,4 +11,7 @@ Foo(() => //// [commentOnSimpleArrowFunctionBody1.js] function Foo(x) { } -Foo(function () { return 127; }); +Foo(function () { + // do something + return 127; +}); diff --git a/tests/baselines/reference/complexClassRelationships.js b/tests/baselines/reference/complexClassRelationships.js index a2a863cf54b..e8dc954e14c 100644 --- a/tests/baselines/reference/complexClassRelationships.js +++ b/tests/baselines/reference/complexClassRelationships.js @@ -68,9 +68,7 @@ var Derived = (function (_super) { })(Base); var BaseCollection = (function () { function BaseCollection(f) { - (function (item) { - return [item.Components]; - }); + (function (item) { return [item.Components]; }); } return BaseCollection; })(); @@ -83,9 +81,7 @@ var Thing = (function () { function Thing() { } Object.defineProperty(Thing.prototype, "Components", { - get: function () { - return null; - }, + get: function () { return null; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/compositeGenericFunction.js b/tests/baselines/reference/compositeGenericFunction.js index 0fe2e7d6f41..106c724ea24 100644 --- a/tests/baselines/reference/compositeGenericFunction.js +++ b/tests/baselines/reference/compositeGenericFunction.js @@ -7,12 +7,8 @@ var z: number = h(f); var z: number = h(f); //// [compositeGenericFunction.js] -function f(value) { - return value; -} +function f(value) { return value; } ; -function h(func) { - return null; -} +function h(func) { return null; } var z = h(f); var z = h(f); diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.js b/tests/baselines/reference/computedPropertyNames10_ES5.js new file mode 100644 index 00000000000..ececb28b8cc --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames10_ES5.js @@ -0,0 +1,25 @@ +//// [computedPropertyNames10_ES5.ts] +var s: string; +var n: number; +var a: any; +var v = { + [s]() { }, + [n]() { }, + [s + s]() { }, + [s + n]() { }, + [+s]() { }, + [""]() { }, + [0]() { }, + [a]() { }, + [true]() { }, + [`hello bye`]() { }, + [`hello ${a} bye`]() { } +} + +//// [computedPropertyNames10_ES5.js] +var s; +var n; +var a; +var v = (_a = {}, _a[s] = function () { }, _a[n] = function () { }, _a[s + s] = function () { }, _a[s + n] = function () { }, _a[+s] = function () { }, _a[""] = function () { }, _a[0] = function () { }, _a[a] = function () { }, _a[true] = function () { }, _a["hello bye"] = function () { }, _a["hello " + a + " bye"] = function () { }, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames10.types b/tests/baselines/reference/computedPropertyNames10_ES5.types similarity index 91% rename from tests/baselines/reference/computedPropertyNames10.types rename to tests/baselines/reference/computedPropertyNames10_ES5.types index 29bf6c43bef..cb49d5c3384 100644 --- a/tests/baselines/reference/computedPropertyNames10.types +++ b/tests/baselines/reference/computedPropertyNames10_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames10.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames10.js b/tests/baselines/reference/computedPropertyNames10_ES6.js similarity index 83% rename from tests/baselines/reference/computedPropertyNames10.js rename to tests/baselines/reference/computedPropertyNames10_ES6.js index eb8db65dba5..0a55fabecd8 100644 --- a/tests/baselines/reference/computedPropertyNames10.js +++ b/tests/baselines/reference/computedPropertyNames10_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames10.ts] +//// [computedPropertyNames10_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ var v = { [`hello ${a} bye`]() { } } -//// [computedPropertyNames10.js] +//// [computedPropertyNames10_ES6.js] var s; var n; var a; diff --git a/tests/baselines/reference/computedPropertyNames10_ES6.types b/tests/baselines/reference/computedPropertyNames10_ES6.types new file mode 100644 index 00000000000..5dcc4783b5e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames10_ES6.types @@ -0,0 +1,46 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES6.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +var v = { +>v : {} +>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : {} + + [s]() { }, +>s : string + + [n]() { }, +>n : number + + [s + s]() { }, +>s + s : string +>s : string +>s : string + + [s + n]() { }, +>s + n : string +>s : string +>n : number + + [+s]() { }, +>+s : number +>s : string + + [""]() { }, + [0]() { }, + [a]() { }, +>a : any + + [true]() { }, +>true : any + + [`hello bye`]() { }, + [`hello ${a} bye`]() { } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.js b/tests/baselines/reference/computedPropertyNames11_ES5.js new file mode 100644 index 00000000000..d8450deb765 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames11_ES5.js @@ -0,0 +1,25 @@ +//// [computedPropertyNames11_ES5.ts] +var s: string; +var n: number; +var a: any; +var v = { + get [s]() { return 0; }, + set [n](v) { }, + get [s + s]() { return 0; }, + set [s + n](v) { }, + get [+s]() { return 0; }, + set [""](v) { }, + get [0]() { return 0; }, + set [a](v) { }, + get [true]() { return 0; }, + set [`hello bye`](v) { }, + get [`hello ${a} bye`]() { return 0; } +} + +//// [computedPropertyNames11_ES5.js] +var s; +var n; +var a; +var v = (_a = {}, _a[s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[s + s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[s + n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[+s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[""] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[0] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[a] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[true] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["hello bye"] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a["hello " + a + " bye"] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames11.types b/tests/baselines/reference/computedPropertyNames11_ES5.types similarity index 93% rename from tests/baselines/reference/computedPropertyNames11.types rename to tests/baselines/reference/computedPropertyNames11_ES5.types index ee0796320d6..ed3c51302b7 100644 --- a/tests/baselines/reference/computedPropertyNames11.types +++ b/tests/baselines/reference/computedPropertyNames11_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames11.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames11.js b/tests/baselines/reference/computedPropertyNames11_ES6.js similarity index 58% rename from tests/baselines/reference/computedPropertyNames11.js rename to tests/baselines/reference/computedPropertyNames11_ES6.js index 206fce0d76f..f1a774b88fe 100644 --- a/tests/baselines/reference/computedPropertyNames11.js +++ b/tests/baselines/reference/computedPropertyNames11_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames11.ts] +//// [computedPropertyNames11_ES6.ts] var s: string; var n: number; var a: any; @@ -16,32 +16,20 @@ var v = { get [`hello ${a} bye`]() { return 0; } } -//// [computedPropertyNames11.js] +//// [computedPropertyNames11_ES6.js] var s; var n; var a; var v = { - get [s]() { - return 0; - }, + get [s]() { return 0; }, set [n](v) { }, - get [s + s]() { - return 0; - }, + get [s + s]() { return 0; }, set [s + n](v) { }, - get [+s]() { - return 0; - }, + get [+s]() { return 0; }, set [""](v) { }, - get [0]() { - return 0; - }, + get [0]() { return 0; }, set [a](v) { }, - get [true]() { - return 0; - }, + get [true]() { return 0; }, set [`hello bye`](v) { }, - get [`hello ${a} bye`]() { - return 0; - } + get [`hello ${a} bye`]() { return 0; } }; diff --git a/tests/baselines/reference/computedPropertyNames11_ES6.types b/tests/baselines/reference/computedPropertyNames11_ES6.types new file mode 100644 index 00000000000..a0b9e6eb99e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames11_ES6.types @@ -0,0 +1,53 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES6.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +var v = { +>v : {} +>{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : {} + + get [s]() { return 0; }, +>s : string + + set [n](v) { }, +>n : number +>v : any + + get [s + s]() { return 0; }, +>s + s : string +>s : string +>s : string + + set [s + n](v) { }, +>s + n : string +>s : string +>n : number +>v : any + + get [+s]() { return 0; }, +>+s : number +>s : string + + set [""](v) { }, +>v : any + + get [0]() { return 0; }, + set [a](v) { }, +>a : any +>v : any + + get [true]() { return 0; }, +>true : any + + set [`hello bye`](v) { }, +>v : any + + get [`hello ${a} bye`]() { return 0; } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames12.errors.txt b/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt similarity index 62% rename from tests/baselines/reference/computedPropertyNames12.errors.txt rename to tests/baselines/reference/computedPropertyNames12_ES5.errors.txt index 1fdf741f893..9d07f34f3c4 100644 --- a/tests/baselines/reference/computedPropertyNames12.errors.txt +++ b/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt @@ -1,17 +1,17 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(5,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(6,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(7,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(10,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(11,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(12,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(13,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(14,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(15,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(5,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(6,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(7,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(10,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(11,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(12,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(13,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(14,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(15,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts (11 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts (11 errors) ==== var s: string; var n: number; var a: any; diff --git a/tests/baselines/reference/computedPropertyNames12_ES5.js b/tests/baselines/reference/computedPropertyNames12_ES5.js new file mode 100644 index 00000000000..c73ea11286f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames12_ES5.js @@ -0,0 +1,31 @@ +//// [computedPropertyNames12_ES5.ts] +var s: string; +var n: number; +var a: any; +class C { + [s]: number; + [n] = n; + static [s + s]: string; + [s + n] = 2; + [+s]: typeof s; + static [""]: number; + [0]: number; + [a]: number; + static [true]: number; + [`hello bye`] = 0; + static [`hello ${a} bye`] = 0 +} + +//// [computedPropertyNames12_ES5.js] +var s; +var n; +var a; +var C = (function () { + function C() { + this[n] = n; + this[s + n] = 2; + this["hello bye"] = 0; + } + C["hello " + a + " bye"] = 0; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt new file mode 100644 index 00000000000..f0a2267f8b3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(5,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(6,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(7,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(10,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(11,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(12,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(13,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(14,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(15,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts (11 errors) ==== + var s: string; + var n: number; + var a: any; + class C { + [s]: number; + ~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [n] = n; + ~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + static [s + s]: string; + ~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [s + n] = 2; + ~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [+s]: typeof s; + ~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + static [""]: number; + ~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [0]: number; + ~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [a]: number; + ~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + static [true]: number; + ~~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + [`hello bye`] = 0; + ~~~~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + static [`hello ${a} bye`] = 0 + ~~~~~~~~~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames12.js b/tests/baselines/reference/computedPropertyNames12_ES6.js similarity index 84% rename from tests/baselines/reference/computedPropertyNames12.js rename to tests/baselines/reference/computedPropertyNames12_ES6.js index 5e5dec0c549..5ab6e4c09b3 100644 --- a/tests/baselines/reference/computedPropertyNames12.js +++ b/tests/baselines/reference/computedPropertyNames12_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames12.ts] +//// [computedPropertyNames12_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ class C { static [`hello ${a} bye`] = 0 } -//// [computedPropertyNames12.js] +//// [computedPropertyNames12_ES6.js] var s; var n; var a; diff --git a/tests/baselines/reference/computedPropertyNames13_ES5.js b/tests/baselines/reference/computedPropertyNames13_ES5.js new file mode 100644 index 00000000000..89562162911 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames13_ES5.js @@ -0,0 +1,38 @@ +//// [computedPropertyNames13_ES5.ts] +var s: string; +var n: number; +var a: any; +class C { + [s]() {} + [n]() { } + static [s + s]() { } + [s + n]() { } + [+s]() { } + static [""]() { } + [0]() { } + [a]() { } + static [true]() { } + [`hello bye`]() { } + static [`hello ${a} bye`]() { } +} + +//// [computedPropertyNames13_ES5.js] +var s; +var n; +var a; +var C = (function () { + function C() { + } + C.prototype[s] = function () { }; + C.prototype[n] = function () { }; + C[s + s] = function () { }; + C.prototype[s + n] = function () { }; + C.prototype[+s] = function () { }; + C[""] = function () { }; + C.prototype[0] = function () { }; + C.prototype[a] = function () { }; + C[true] = function () { }; + C.prototype["hello bye"] = function () { }; + C["hello " + a + " bye"] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames13.types b/tests/baselines/reference/computedPropertyNames13_ES5.types similarity index 89% rename from tests/baselines/reference/computedPropertyNames13.types rename to tests/baselines/reference/computedPropertyNames13_ES5.types index 4f267f2e893..ff98a3189a7 100644 --- a/tests/baselines/reference/computedPropertyNames13.types +++ b/tests/baselines/reference/computedPropertyNames13_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames13.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames13.js b/tests/baselines/reference/computedPropertyNames13_ES6.js similarity index 88% rename from tests/baselines/reference/computedPropertyNames13.js rename to tests/baselines/reference/computedPropertyNames13_ES6.js index 0456e32602f..b18ef3fb3e2 100644 --- a/tests/baselines/reference/computedPropertyNames13.js +++ b/tests/baselines/reference/computedPropertyNames13_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames13.ts] +//// [computedPropertyNames13_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ class C { static [`hello ${a} bye`]() { } } -//// [computedPropertyNames13.js] +//// [computedPropertyNames13_ES6.js] var s; var n; var a; diff --git a/tests/baselines/reference/computedPropertyNames13_ES6.types b/tests/baselines/reference/computedPropertyNames13_ES6.types new file mode 100644 index 00000000000..78b2f3afc4a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames13_ES6.types @@ -0,0 +1,45 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES6.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +class C { +>C : C + + [s]() {} +>s : string + + [n]() { } +>n : number + + static [s + s]() { } +>s + s : string +>s : string +>s : string + + [s + n]() { } +>s + n : string +>s : string +>n : number + + [+s]() { } +>+s : number +>s : string + + static [""]() { } + [0]() { } + [a]() { } +>a : any + + static [true]() { } +>true : any + + [`hello bye`]() { } + static [`hello ${a} bye`]() { } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames14.errors.txt b/tests/baselines/reference/computedPropertyNames14_ES5.errors.txt similarity index 63% rename from tests/baselines/reference/computedPropertyNames14.errors.txt rename to tests/baselines/reference/computedPropertyNames14_ES5.errors.txt index 9ab0cf6a4e9..0ca77380e41 100644 --- a/tests/baselines/reference/computedPropertyNames14.errors.txt +++ b/tests/baselines/reference/computedPropertyNames14_ES5.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts (6 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts (6 errors) ==== var b: boolean; class C { [b]() {} diff --git a/tests/baselines/reference/computedPropertyNames14.js b/tests/baselines/reference/computedPropertyNames14_ES5.js similarity index 82% rename from tests/baselines/reference/computedPropertyNames14.js rename to tests/baselines/reference/computedPropertyNames14_ES5.js index a0b39a5e143..5db5e842a2a 100644 --- a/tests/baselines/reference/computedPropertyNames14.js +++ b/tests/baselines/reference/computedPropertyNames14_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames14.ts] +//// [computedPropertyNames14_ES5.ts] var b: boolean; class C { [b]() {} @@ -9,7 +9,7 @@ class C { static [null]() { } } -//// [computedPropertyNames14.js] +//// [computedPropertyNames14_ES5.js] var b; var C = (function () { function C() { diff --git a/tests/baselines/reference/computedPropertyNames14_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames14_ES6.errors.txt new file mode 100644 index 00000000000..97525a783aa --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames14_ES6.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts (6 errors) ==== + var b: boolean; + class C { + [b]() {} + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static [true]() { } + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [[]]() { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static [{}]() { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [undefined]() { } + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static [null]() { } + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames14_ES6.js b/tests/baselines/reference/computedPropertyNames14_ES6.js new file mode 100644 index 00000000000..94b4196a606 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames14_ES6.js @@ -0,0 +1,24 @@ +//// [computedPropertyNames14_ES6.ts] +var b: boolean; +class C { + [b]() {} + static [true]() { } + [[]]() { } + static [{}]() { } + [undefined]() { } + static [null]() { } +} + +//// [computedPropertyNames14_ES6.js] +var b; +var C = (function () { + function C() { + } + C.prototype[b] = function () { }; + C[true] = function () { }; + C.prototype[[]] = function () { }; + C[{}] = function () { }; + C.prototype[undefined] = function () { }; + C[null] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames15.errors.txt b/tests/baselines/reference/computedPropertyNames15_ES5.errors.txt similarity index 67% rename from tests/baselines/reference/computedPropertyNames15.errors.txt rename to tests/baselines/reference/computedPropertyNames15_ES5.errors.txt index 64b08df3221..649c438e47e 100644 --- a/tests/baselines/reference/computedPropertyNames15.errors.txt +++ b/tests/baselines/reference/computedPropertyNames15_ES5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts (2 errors) ==== var p1: number | string; var p2: number | number[]; var p3: string | boolean; diff --git a/tests/baselines/reference/computedPropertyNames15.js b/tests/baselines/reference/computedPropertyNames15_ES5.js similarity index 79% rename from tests/baselines/reference/computedPropertyNames15.js rename to tests/baselines/reference/computedPropertyNames15_ES5.js index 429b23614ab..93258b64c75 100644 --- a/tests/baselines/reference/computedPropertyNames15.js +++ b/tests/baselines/reference/computedPropertyNames15_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames15.ts] +//// [computedPropertyNames15_ES5.ts] var p1: number | string; var p2: number | number[]; var p3: string | boolean; @@ -8,7 +8,7 @@ class C { [p3]() { } } -//// [computedPropertyNames15.js] +//// [computedPropertyNames15_ES5.js] var p1; var p2; var p3; diff --git a/tests/baselines/reference/computedPropertyNames15_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames15_ES6.errors.txt new file mode 100644 index 00000000000..e35e8f645c8 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames15_ES6.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts (2 errors) ==== + var p1: number | string; + var p2: number | number[]; + var p3: string | boolean; + class C { + [p1]() { } + [p2]() { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [p3]() { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames15_ES6.js b/tests/baselines/reference/computedPropertyNames15_ES6.js new file mode 100644 index 00000000000..ab7bf4552d6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames15_ES6.js @@ -0,0 +1,22 @@ +//// [computedPropertyNames15_ES6.ts] +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +class C { + [p1]() { } + [p2]() { } + [p3]() { } +} + +//// [computedPropertyNames15_ES6.js] +var p1; +var p2; +var p3; +var C = (function () { + function C() { + } + C.prototype[p1] = function () { }; + C.prototype[p2] = function () { }; + C.prototype[p3] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames16_ES5.js b/tests/baselines/reference/computedPropertyNames16_ES5.js new file mode 100644 index 00000000000..2c7316e1398 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames16_ES5.js @@ -0,0 +1,82 @@ +//// [computedPropertyNames16_ES5.ts] +var s: string; +var n: number; +var a: any; +class C { + get [s]() { return 0;} + set [n](v) { } + static get [s + s]() { return 0; } + set [s + n](v) { } + get [+s]() { return 0; } + static set [""](v) { } + get [0]() { return 0; } + set [a](v) { } + static get [true]() { return 0; } + set [`hello bye`](v) { } + get [`hello ${a} bye`]() { return 0; } +} + +//// [computedPropertyNames16_ES5.js] +var s; +var n; +var a; +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, s, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, n, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, s + s, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, s + n, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, +s, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "", { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, 0, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, a, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, true, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "hello bye", { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "hello " + a + " bye", { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames16.types b/tests/baselines/reference/computedPropertyNames16_ES5.types similarity index 90% rename from tests/baselines/reference/computedPropertyNames16.types rename to tests/baselines/reference/computedPropertyNames16_ES5.types index ccfa7996066..3914093c766 100644 --- a/tests/baselines/reference/computedPropertyNames16.types +++ b/tests/baselines/reference/computedPropertyNames16_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames16.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames16.js b/tests/baselines/reference/computedPropertyNames16_ES6.js similarity index 77% rename from tests/baselines/reference/computedPropertyNames16.js rename to tests/baselines/reference/computedPropertyNames16_ES6.js index 9a55c3f9ed5..369040e7e22 100644 --- a/tests/baselines/reference/computedPropertyNames16.js +++ b/tests/baselines/reference/computedPropertyNames16_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames16.ts] +//// [computedPropertyNames16_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ class C { get [`hello ${a} bye`]() { return 0; } } -//// [computedPropertyNames16.js] +//// [computedPropertyNames16_ES6.js] var s; var n; var a; @@ -24,9 +24,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, s, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -36,9 +34,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C, s + s, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -48,9 +44,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, +s, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -60,9 +54,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, 0, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -72,9 +64,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C, true, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -84,9 +74,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, `hello ${a} bye`, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames16_ES6.types b/tests/baselines/reference/computedPropertyNames16_ES6.types new file mode 100644 index 00000000000..6503c75037d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames16_ES6.types @@ -0,0 +1,52 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES6.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +class C { +>C : C + + get [s]() { return 0;} +>s : string + + set [n](v) { } +>n : number +>v : any + + static get [s + s]() { return 0; } +>s + s : string +>s : string +>s : string + + set [s + n](v) { } +>s + n : string +>s : string +>n : number +>v : any + + get [+s]() { return 0; } +>+s : number +>s : string + + static set [""](v) { } +>v : any + + get [0]() { return 0; } + set [a](v) { } +>a : any +>v : any + + static get [true]() { return 0; } +>true : any + + set [`hello bye`](v) { } +>v : any + + get [`hello ${a} bye`]() { return 0; } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames17.errors.txt b/tests/baselines/reference/computedPropertyNames17_ES5.errors.txt similarity index 64% rename from tests/baselines/reference/computedPropertyNames17.errors.txt rename to tests/baselines/reference/computedPropertyNames17_ES5.errors.txt index df9fe01528a..31a9d341dc4 100644 --- a/tests/baselines/reference/computedPropertyNames17.errors.txt +++ b/tests/baselines/reference/computedPropertyNames17_ES5.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts (6 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts (6 errors) ==== var b: boolean; class C { get [b]() { return 0;} diff --git a/tests/baselines/reference/computedPropertyNames17.js b/tests/baselines/reference/computedPropertyNames17_ES5.js similarity index 77% rename from tests/baselines/reference/computedPropertyNames17.js rename to tests/baselines/reference/computedPropertyNames17_ES5.js index 026671ed8a6..3b5c100694d 100644 --- a/tests/baselines/reference/computedPropertyNames17.js +++ b/tests/baselines/reference/computedPropertyNames17_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames17.ts] +//// [computedPropertyNames17_ES5.ts] var b: boolean; class C { get [b]() { return 0;} @@ -9,15 +9,13 @@ class C { set [null](v) { } } -//// [computedPropertyNames17.js] +//// [computedPropertyNames17_ES5.js] var b; var C = (function () { function C() { } Object.defineProperty(C.prototype, b, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -27,9 +25,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, [], { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -39,9 +35,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C, undefined, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames17_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames17_ES6.errors.txt new file mode 100644 index 00000000000..4c1566f032b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames17_ES6.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts (6 errors) ==== + var b: boolean; + class C { + get [b]() { return 0;} + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static set [true](v) { } + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + get [[]]() { return 0; } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + set [{}](v) { } + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static get [undefined]() { return 0; } + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + set [null](v) { } + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames17_ES6.js b/tests/baselines/reference/computedPropertyNames17_ES6.js new file mode 100644 index 00000000000..38012efbb14 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames17_ES6.js @@ -0,0 +1,48 @@ +//// [computedPropertyNames17_ES6.ts] +var b: boolean; +class C { + get [b]() { return 0;} + static set [true](v) { } + get [[]]() { return 0; } + set [{}](v) { } + static get [undefined]() { return 0; } + set [null](v) { } +} + +//// [computedPropertyNames17_ES6.js] +var b; +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, b, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, true, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, [], { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, {}, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, undefined, { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, null, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames18_ES5.js b/tests/baselines/reference/computedPropertyNames18_ES5.js new file mode 100644 index 00000000000..0ccc0fb4e00 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames18_ES5.js @@ -0,0 +1,14 @@ +//// [computedPropertyNames18_ES5.ts] +function foo() { + var obj = { + [this.bar]: 0 + } +} + +//// [computedPropertyNames18_ES5.js] +function foo() { + var obj = (_a = {}, _a[this.bar] = + 0, + _a); + var _a; +} diff --git a/tests/baselines/reference/computedPropertyNames18.types b/tests/baselines/reference/computedPropertyNames18_ES5.types similarity index 86% rename from tests/baselines/reference/computedPropertyNames18.types rename to tests/baselines/reference/computedPropertyNames18_ES5.types index 0976e5fc3ca..732de08e2d6 100644 --- a/tests/baselines/reference/computedPropertyNames18.types +++ b/tests/baselines/reference/computedPropertyNames18_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames18.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts === function foo() { >foo : () => void diff --git a/tests/baselines/reference/computedPropertyNames18.js b/tests/baselines/reference/computedPropertyNames18_ES6.js similarity index 60% rename from tests/baselines/reference/computedPropertyNames18.js rename to tests/baselines/reference/computedPropertyNames18_ES6.js index af2d68b3095..fbf840feb31 100644 --- a/tests/baselines/reference/computedPropertyNames18.js +++ b/tests/baselines/reference/computedPropertyNames18_ES6.js @@ -1,11 +1,11 @@ -//// [computedPropertyNames18.ts] +//// [computedPropertyNames18_ES6.ts] function foo() { var obj = { [this.bar]: 0 } } -//// [computedPropertyNames18.js] +//// [computedPropertyNames18_ES6.js] function foo() { var obj = { [this.bar]: 0 diff --git a/tests/baselines/reference/computedPropertyNames18_ES6.types b/tests/baselines/reference/computedPropertyNames18_ES6.types new file mode 100644 index 00000000000..af7081fa2ad --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames18_ES6.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES6.ts === +function foo() { +>foo : () => void + + var obj = { +>obj : {} +>{ [this.bar]: 0 } : {} + + [this.bar]: 0 +>this.bar : any +>this : any +>bar : any + } +} diff --git a/tests/baselines/reference/computedPropertyNames19.errors.txt b/tests/baselines/reference/computedPropertyNames19_ES5.errors.txt similarity index 69% rename from tests/baselines/reference/computedPropertyNames19.errors.txt rename to tests/baselines/reference/computedPropertyNames19_ES5.errors.txt index 2037008992f..49a1f008a05 100644 --- a/tests/baselines/reference/computedPropertyNames19.errors.txt +++ b/tests/baselines/reference/computedPropertyNames19_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts(3,10): error TS2331: 'this' cannot be referenced in a module body. +tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts(3,10): error TS2331: 'this' cannot be referenced in a module body. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts (1 errors) ==== module M { var obj = { [this.bar]: 0 diff --git a/tests/baselines/reference/computedPropertyNames19_ES5.js b/tests/baselines/reference/computedPropertyNames19_ES5.js new file mode 100644 index 00000000000..a18cb7b95c3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames19_ES5.js @@ -0,0 +1,15 @@ +//// [computedPropertyNames19_ES5.ts] +module M { + var obj = { + [this.bar]: 0 + } +} + +//// [computedPropertyNames19_ES5.js] +var M; +(function (M) { + var obj = (_a = {}, _a[this.bar] = + 0, + _a); + var _a; +})(M || (M = {})); diff --git a/tests/baselines/reference/computedPropertyNames19_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames19_ES6.errors.txt new file mode 100644 index 00000000000..9e2d1afbe74 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames19_ES6.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts(3,10): error TS2331: 'this' cannot be referenced in a module body. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts (1 errors) ==== + module M { + var obj = { + [this.bar]: 0 + ~~~~ +!!! error TS2331: 'this' cannot be referenced in a module body. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames19.js b/tests/baselines/reference/computedPropertyNames19_ES6.js similarity index 62% rename from tests/baselines/reference/computedPropertyNames19.js rename to tests/baselines/reference/computedPropertyNames19_ES6.js index 3fd2f99eea6..99ebde491ec 100644 --- a/tests/baselines/reference/computedPropertyNames19.js +++ b/tests/baselines/reference/computedPropertyNames19_ES6.js @@ -1,11 +1,11 @@ -//// [computedPropertyNames19.ts] +//// [computedPropertyNames19_ES6.ts] module M { var obj = { [this.bar]: 0 } } -//// [computedPropertyNames19.js] +//// [computedPropertyNames19_ES6.js] var M; (function (M) { var obj = { diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.js b/tests/baselines/reference/computedPropertyNames1_ES5.js new file mode 100644 index 00000000000..36a7fd6052d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames1_ES5.js @@ -0,0 +1,10 @@ +//// [computedPropertyNames1_ES5.ts] +var v = { + get [0 + 1]() { return 0 }, + set [0 + 1](v: string) { } //No error +} + +//// [computedPropertyNames1_ES5.js] +var v = (_a = {}, _a[0 + 1] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[0 + 1] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames1.types b/tests/baselines/reference/computedPropertyNames1_ES5.types similarity index 89% rename from tests/baselines/reference/computedPropertyNames1.types rename to tests/baselines/reference/computedPropertyNames1_ES5.types index b44aa3c69d0..6627d53d1da 100644 --- a/tests/baselines/reference/computedPropertyNames1.types +++ b/tests/baselines/reference/computedPropertyNames1_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts === var v = { >v : {} >{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : {} diff --git a/tests/baselines/reference/computedPropertyNames1.js b/tests/baselines/reference/computedPropertyNames1_ES6.js similarity index 52% rename from tests/baselines/reference/computedPropertyNames1.js rename to tests/baselines/reference/computedPropertyNames1_ES6.js index 4f0bcb3a8f4..80a7d2ecdd2 100644 --- a/tests/baselines/reference/computedPropertyNames1.js +++ b/tests/baselines/reference/computedPropertyNames1_ES6.js @@ -1,13 +1,11 @@ -//// [computedPropertyNames1.ts] +//// [computedPropertyNames1_ES6.ts] var v = { get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error } -//// [computedPropertyNames1.js] +//// [computedPropertyNames1_ES6.js] var v = { - get [0 + 1]() { - return 0; - }, + get [0 + 1]() { return 0; }, set [0 + 1](v) { } //No error }; diff --git a/tests/baselines/reference/computedPropertyNames1_ES6.types b/tests/baselines/reference/computedPropertyNames1_ES6.types new file mode 100644 index 00000000000..966cfef579d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames1_ES6.types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES6.ts === +var v = { +>v : {} +>{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : {} + + get [0 + 1]() { return 0 }, +>0 + 1 : number + + set [0 + 1](v: string) { } //No error +>0 + 1 : number +>v : string +} diff --git a/tests/baselines/reference/computedPropertyNames20.js b/tests/baselines/reference/computedPropertyNames20.js deleted file mode 100644 index 2a1edf06142..00000000000 --- a/tests/baselines/reference/computedPropertyNames20.js +++ /dev/null @@ -1,9 +0,0 @@ -//// [computedPropertyNames20.ts] -var obj = { - [this.bar]: 0 -} - -//// [computedPropertyNames20.js] -var obj = { - [this.bar]: 0 -}; diff --git a/tests/baselines/reference/computedPropertyNames20_ES5.js b/tests/baselines/reference/computedPropertyNames20_ES5.js new file mode 100644 index 00000000000..21af64d7e41 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames20_ES5.js @@ -0,0 +1,10 @@ +//// [computedPropertyNames20_ES5.ts] +var obj = { + [this.bar]: 0 +} + +//// [computedPropertyNames20_ES5.js] +var obj = (_a = {}, _a[this.bar] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames20.types b/tests/baselines/reference/computedPropertyNames20_ES5.types similarity index 84% rename from tests/baselines/reference/computedPropertyNames20.types rename to tests/baselines/reference/computedPropertyNames20_ES5.types index abd1b203e87..eb2bbf34b7e 100644 --- a/tests/baselines/reference/computedPropertyNames20.types +++ b/tests/baselines/reference/computedPropertyNames20_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames20.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts === var obj = { >obj : {} >{ [this.bar]: 0} : {} diff --git a/tests/baselines/reference/computedPropertyNames20_ES6.js b/tests/baselines/reference/computedPropertyNames20_ES6.js new file mode 100644 index 00000000000..c128d8c0f85 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames20_ES6.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames20_ES6.ts] +var obj = { + [this.bar]: 0 +} + +//// [computedPropertyNames20_ES6.js] +var obj = { + [this.bar]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames20_ES6.types b/tests/baselines/reference/computedPropertyNames20_ES6.types new file mode 100644 index 00000000000..2280c7c4820 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames20_ES6.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES6.ts === +var obj = { +>obj : {} +>{ [this.bar]: 0} : {} + + [this.bar]: 0 +>this.bar : any +>this : any +>bar : any +} diff --git a/tests/baselines/reference/computedPropertyNames21.errors.txt b/tests/baselines/reference/computedPropertyNames21_ES5.errors.txt similarity index 69% rename from tests/baselines/reference/computedPropertyNames21.errors.txt rename to tests/baselines/reference/computedPropertyNames21_ES5.errors.txt index a44c8d60ee8..cb794d3865a 100644 --- a/tests/baselines/reference/computedPropertyNames21.errors.txt +++ b/tests/baselines/reference/computedPropertyNames21_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts(5,6): error TS2465: 'this' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts(5,6): error TS2465: 'this' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts (1 errors) ==== class C { bar() { return 0; diff --git a/tests/baselines/reference/computedPropertyNames21.js b/tests/baselines/reference/computedPropertyNames21_ES5.js similarity index 73% rename from tests/baselines/reference/computedPropertyNames21.js rename to tests/baselines/reference/computedPropertyNames21_ES5.js index d5ca1422a5e..81f95cd824d 100644 --- a/tests/baselines/reference/computedPropertyNames21.js +++ b/tests/baselines/reference/computedPropertyNames21_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames21.ts] +//// [computedPropertyNames21_ES5.ts] class C { bar() { return 0; @@ -6,7 +6,7 @@ class C { [this.bar()]() { } } -//// [computedPropertyNames21.js] +//// [computedPropertyNames21_ES5.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames21_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames21_ES6.errors.txt new file mode 100644 index 00000000000..064e086cd5c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames21_ES6.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES6.ts(5,6): error TS2465: 'this' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES6.ts (1 errors) ==== + class C { + bar() { + return 0; + } + [this.bar()]() { } + ~~~~ +!!! error TS2465: 'this' cannot be referenced in a computed property name. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames21_ES6.js b/tests/baselines/reference/computedPropertyNames21_ES6.js new file mode 100644 index 00000000000..34a1878f689 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames21_ES6.js @@ -0,0 +1,18 @@ +//// [computedPropertyNames21_ES6.ts] +class C { + bar() { + return 0; + } + [this.bar()]() { } +} + +//// [computedPropertyNames21_ES6.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + return 0; + }; + C.prototype[this.bar()] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.js b/tests/baselines/reference/computedPropertyNames22_ES5.js new file mode 100644 index 00000000000..e3e685aa54b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames22_ES5.js @@ -0,0 +1,22 @@ +//// [computedPropertyNames22_ES5.ts] +class C { + bar() { + var obj = { + [this.bar()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames22_ES5.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + var obj = (_a = {}, _a[this.bar()] = function () { }, + _a); + return 0; + var _a; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames22.types b/tests/baselines/reference/computedPropertyNames22_ES5.types similarity index 88% rename from tests/baselines/reference/computedPropertyNames22.types rename to tests/baselines/reference/computedPropertyNames22_ES5.types index d23546192c0..7afeeb75fa3 100644 --- a/tests/baselines/reference/computedPropertyNames22.types +++ b/tests/baselines/reference/computedPropertyNames22_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames22.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNames22.js b/tests/baselines/reference/computedPropertyNames22_ES6.js similarity index 76% rename from tests/baselines/reference/computedPropertyNames22.js rename to tests/baselines/reference/computedPropertyNames22_ES6.js index dc6a53ff91a..c5d58939fc8 100644 --- a/tests/baselines/reference/computedPropertyNames22.js +++ b/tests/baselines/reference/computedPropertyNames22_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames22.ts] +//// [computedPropertyNames22_ES6.ts] class C { bar() { var obj = { @@ -8,7 +8,7 @@ class C { } } -//// [computedPropertyNames22.js] +//// [computedPropertyNames22_ES6.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames22_ES6.types b/tests/baselines/reference/computedPropertyNames22_ES6.types new file mode 100644 index 00000000000..b65f276881f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames22_ES6.types @@ -0,0 +1,21 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES6.ts === +class C { +>C : C + + bar() { +>bar : () => number + + var obj = { +>obj : {} +>{ [this.bar()]() { } } : {} + + [this.bar()]() { } +>this.bar() : number +>this.bar : () => number +>this : C +>bar : () => number + + }; + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames23.errors.txt b/tests/baselines/reference/computedPropertyNames23_ES5.errors.txt similarity index 71% rename from tests/baselines/reference/computedPropertyNames23.errors.txt rename to tests/baselines/reference/computedPropertyNames23_ES5.errors.txt index 0846ba4d6c6..ba827b91375 100644 --- a/tests/baselines/reference/computedPropertyNames23.errors.txt +++ b/tests/baselines/reference/computedPropertyNames23_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts(6,12): error TS2465: 'this' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts(6,12): error TS2465: 'this' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts (1 errors) ==== class C { bar() { return 0; diff --git a/tests/baselines/reference/computedPropertyNames23_ES5.js b/tests/baselines/reference/computedPropertyNames23_ES5.js new file mode 100644 index 00000000000..7b5a5a101a5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames23_ES5.js @@ -0,0 +1,23 @@ +//// [computedPropertyNames23_ES5.ts] +class C { + bar() { + return 0; + } + [ + { [this.bar()]: 1 }[0] + ]() { } +} + +//// [computedPropertyNames23_ES5.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + return 0; + }; + C.prototype[(_a = {}, _a[this.bar()] = + 1, + _a)[0]] = function () { }; + return C; +})(); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames23_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames23_ES6.errors.txt new file mode 100644 index 00000000000..0af5504f22a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames23_ES6.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES6.ts(6,12): error TS2465: 'this' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES6.ts (1 errors) ==== + class C { + bar() { + return 0; + } + [ + { [this.bar()]: 1 }[0] + ~~~~ +!!! error TS2465: 'this' cannot be referenced in a computed property name. + ]() { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames23.js b/tests/baselines/reference/computedPropertyNames23_ES6.js similarity index 76% rename from tests/baselines/reference/computedPropertyNames23.js rename to tests/baselines/reference/computedPropertyNames23_ES6.js index bd94501b577..ad3e35dbb25 100644 --- a/tests/baselines/reference/computedPropertyNames23.js +++ b/tests/baselines/reference/computedPropertyNames23_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames23.ts] +//// [computedPropertyNames23_ES6.ts] class C { bar() { return 0; @@ -8,7 +8,7 @@ class C { ]() { } } -//// [computedPropertyNames23.js] +//// [computedPropertyNames23_ES6.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames24.errors.txt b/tests/baselines/reference/computedPropertyNames24_ES5.errors.txt similarity index 77% rename from tests/baselines/reference/computedPropertyNames24.errors.txt rename to tests/baselines/reference/computedPropertyNames24_ES5.errors.txt index 938fb64b82e..a1290e06956 100644 --- a/tests/baselines/reference/computedPropertyNames24.errors.txt +++ b/tests/baselines/reference/computedPropertyNames24_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts(9,6): error TS2466: 'super' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts(9,6): error TS2466: 'super' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts (1 errors) ==== class Base { bar() { return 0; diff --git a/tests/baselines/reference/computedPropertyNames24.js b/tests/baselines/reference/computedPropertyNames24_ES5.js similarity index 89% rename from tests/baselines/reference/computedPropertyNames24.js rename to tests/baselines/reference/computedPropertyNames24_ES5.js index 389743497a9..5b9fcbca992 100644 --- a/tests/baselines/reference/computedPropertyNames24.js +++ b/tests/baselines/reference/computedPropertyNames24_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames24.ts] +//// [computedPropertyNames24_ES5.ts] class Base { bar() { return 0; @@ -10,7 +10,7 @@ class C extends Base { [super.bar()]() { } } -//// [computedPropertyNames24.js] +//// [computedPropertyNames24_ES5.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames24_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames24_ES6.errors.txt new file mode 100644 index 00000000000..cab0ba6a85c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames24_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES6.ts(9,6): error TS2466: 'super' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES6.ts (1 errors) ==== + class Base { + bar() { + return 0; + } + } + class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [super.bar()]() { } + ~~~~~ +!!! error TS2466: 'super' cannot be referenced in a computed property name. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames24_ES6.js b/tests/baselines/reference/computedPropertyNames24_ES6.js new file mode 100644 index 00000000000..58eb07cfb8d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames24_ES6.js @@ -0,0 +1,37 @@ +//// [computedPropertyNames24_ES6.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [super.bar()]() { } +} + +//// [computedPropertyNames24_ES6.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + C.prototype[super.bar.call(this)] = function () { }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js new file mode 100644 index 00000000000..bd2212b72b3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -0,0 +1,43 @@ +//// [computedPropertyNames25_ES5.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + var obj = { + [super.bar()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames25_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype.foo = function () { + var obj = (_a = {}, _a[_super.prototype.bar.call(this)] = function () { }, + _a); + return 0; + var _a; + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames25.types b/tests/baselines/reference/computedPropertyNames25_ES5.types similarity index 89% rename from tests/baselines/reference/computedPropertyNames25.types rename to tests/baselines/reference/computedPropertyNames25_ES5.types index d8567dc86ad..6f34ce35b44 100644 --- a/tests/baselines/reference/computedPropertyNames25.types +++ b/tests/baselines/reference/computedPropertyNames25_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames25.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts === class Base { >Base : Base diff --git a/tests/baselines/reference/computedPropertyNames25.js b/tests/baselines/reference/computedPropertyNames25_ES6.js similarity index 88% rename from tests/baselines/reference/computedPropertyNames25.js rename to tests/baselines/reference/computedPropertyNames25_ES6.js index 8252fdce7f2..020582c9497 100644 --- a/tests/baselines/reference/computedPropertyNames25.js +++ b/tests/baselines/reference/computedPropertyNames25_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames25.ts] +//// [computedPropertyNames25_ES6.ts] class Base { bar() { return 0; @@ -13,7 +13,7 @@ class C extends Base { } } -//// [computedPropertyNames25.js] +//// [computedPropertyNames25_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames25_ES6.types b/tests/baselines/reference/computedPropertyNames25_ES6.types new file mode 100644 index 00000000000..c008a6173cf --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames25_ES6.types @@ -0,0 +1,31 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES6.ts === +class Base { +>Base : Base + + bar() { +>bar : () => number + + return 0; + } +} +class C extends Base { +>C : C +>Base : Base + + foo() { +>foo : () => number + + var obj = { +>obj : {} +>{ [super.bar()]() { } } : {} + + [super.bar()]() { } +>super.bar() : number +>super.bar : () => number +>super : Base +>bar : () => number + + }; + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames26.errors.txt b/tests/baselines/reference/computedPropertyNames26_ES5.errors.txt similarity index 78% rename from tests/baselines/reference/computedPropertyNames26.errors.txt rename to tests/baselines/reference/computedPropertyNames26_ES5.errors.txt index bbe51c6a0c8..77408f0a9f8 100644 --- a/tests/baselines/reference/computedPropertyNames26.errors.txt +++ b/tests/baselines/reference/computedPropertyNames26_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts(10,12): error TS2466: 'super' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(10,12): error TS2466: 'super' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts (1 errors) ==== class Base { bar() { return 0; diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.js b/tests/baselines/reference/computedPropertyNames26_ES5.js new file mode 100644 index 00000000000..5df2f6dc1b6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -0,0 +1,42 @@ +//// [computedPropertyNames26_ES5.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [ + { [super.bar()]: 1 }[0] + ]() { } +} + +//// [computedPropertyNames26_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + C.prototype[(_a = {}, _a[super.bar.call(this)] = + 1, + _a)[0]] = function () { }; + return C; +})(Base); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames26_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames26_ES6.errors.txt new file mode 100644 index 00000000000..d7e2b5ce7c5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames26_ES6.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES6.ts(10,12): error TS2466: 'super' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES6.ts (1 errors) ==== + class Base { + bar() { + return 0; + } + } + class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [ + { [super.bar()]: 1 }[0] + ~~~~~ +!!! error TS2466: 'super' cannot be referenced in a computed property name. + ]() { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames26.js b/tests/baselines/reference/computedPropertyNames26_ES6.js similarity index 90% rename from tests/baselines/reference/computedPropertyNames26.js rename to tests/baselines/reference/computedPropertyNames26_ES6.js index c19137ce32b..dadc6a29e80 100644 --- a/tests/baselines/reference/computedPropertyNames26.js +++ b/tests/baselines/reference/computedPropertyNames26_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames26.ts] +//// [computedPropertyNames26_ES6.ts] class Base { bar() { return 0; @@ -12,7 +12,7 @@ class C extends Base { ]() { } } -//// [computedPropertyNames26.js] +//// [computedPropertyNames26_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames27.errors.txt b/tests/baselines/reference/computedPropertyNames27_ES5.errors.txt similarity index 69% rename from tests/baselines/reference/computedPropertyNames27.errors.txt rename to tests/baselines/reference/computedPropertyNames27_ES5.errors.txt index c2872197363..1fbc7b37543 100644 --- a/tests/baselines/reference/computedPropertyNames27.errors.txt +++ b/tests/baselines/reference/computedPropertyNames27_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts(4,7): error TS2466: 'super' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts(4,7): error TS2466: 'super' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts (1 errors) ==== class Base { } class C extends Base { diff --git a/tests/baselines/reference/computedPropertyNames27.js b/tests/baselines/reference/computedPropertyNames27_ES5.js similarity index 85% rename from tests/baselines/reference/computedPropertyNames27.js rename to tests/baselines/reference/computedPropertyNames27_ES5.js index 1cae552689b..df1fed09724 100644 --- a/tests/baselines/reference/computedPropertyNames27.js +++ b/tests/baselines/reference/computedPropertyNames27_ES5.js @@ -1,11 +1,11 @@ -//// [computedPropertyNames27.ts] +//// [computedPropertyNames27_ES5.ts] class Base { } class C extends Base { [(super(), "prop")]() { } } -//// [computedPropertyNames27.js] +//// [computedPropertyNames27_ES5.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames27_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames27_ES6.errors.txt new file mode 100644 index 00000000000..edf84201647 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames27_ES6.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES6.ts(4,7): error TS2466: 'super' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES6.ts (1 errors) ==== + class Base { + } + class C extends Base { + [(super(), "prop")]() { } + ~~~~~ +!!! error TS2466: 'super' cannot be referenced in a computed property name. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames27_ES6.js b/tests/baselines/reference/computedPropertyNames27_ES6.js new file mode 100644 index 00000000000..a78f13cda20 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames27_ES6.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames27_ES6.ts] +class Base { +} +class C extends Base { + [(super(), "prop")]() { } +} + +//// [computedPropertyNames27_ES6.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype[(_super.call(this), "prop")] = function () { }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js new file mode 100644 index 00000000000..7e548d4d6d3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -0,0 +1,34 @@ +//// [computedPropertyNames28_ES5.ts] +class Base { +} +class C extends Base { + constructor() { + super(); + var obj = { + [(super(), "prop")]() { } + }; + } +} + +//// [computedPropertyNames28_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.call(this); + var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, + _a); + var _a; + } + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames28.types b/tests/baselines/reference/computedPropertyNames28_ES5.types similarity index 90% rename from tests/baselines/reference/computedPropertyNames28.types rename to tests/baselines/reference/computedPropertyNames28_ES5.types index 2adf52f8c5f..278576ab1ca 100644 --- a/tests/baselines/reference/computedPropertyNames28.types +++ b/tests/baselines/reference/computedPropertyNames28_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames28.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts === class Base { >Base : Base } diff --git a/tests/baselines/reference/computedPropertyNames28.js b/tests/baselines/reference/computedPropertyNames28_ES6.js similarity index 86% rename from tests/baselines/reference/computedPropertyNames28.js rename to tests/baselines/reference/computedPropertyNames28_ES6.js index 0a3985a640c..5656d96de87 100644 --- a/tests/baselines/reference/computedPropertyNames28.js +++ b/tests/baselines/reference/computedPropertyNames28_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames28.ts] +//// [computedPropertyNames28_ES6.ts] class Base { } class C extends Base { @@ -10,7 +10,7 @@ class C extends Base { } } -//// [computedPropertyNames28.js] +//// [computedPropertyNames28_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames28_ES6.types b/tests/baselines/reference/computedPropertyNames28_ES6.types new file mode 100644 index 00000000000..842cdbd32e0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames28_ES6.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES6.ts === +class Base { +>Base : Base +} +class C extends Base { +>C : C +>Base : Base + + constructor() { + super(); +>super() : void +>super : typeof Base + + var obj = { +>obj : {} +>{ [(super(), "prop")]() { } } : {} + + [(super(), "prop")]() { } +>(super(), "prop") : string +>super(), "prop" : string +>super() : void +>super : typeof Base + + }; + } +} diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.js b/tests/baselines/reference/computedPropertyNames29_ES5.js new file mode 100644 index 00000000000..27c7cd97988 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames29_ES5.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames29_ES5.ts] +class C { + bar() { + () => { + var obj = { + [this.bar()]() { } // needs capture + }; + } + return 0; + } +} + +//// [computedPropertyNames29_ES5.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + var _this = this; + (function () { + var obj = (_a = {}, _a[_this.bar()] = function () { }, + _a); + var _a; + }); + return 0; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames29.types b/tests/baselines/reference/computedPropertyNames29_ES5.types similarity index 91% rename from tests/baselines/reference/computedPropertyNames29.types rename to tests/baselines/reference/computedPropertyNames29_ES5.types index ed4db5862e9..e0da4b10da8 100644 --- a/tests/baselines/reference/computedPropertyNames29.types +++ b/tests/baselines/reference/computedPropertyNames29_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames29.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNames29.js b/tests/baselines/reference/computedPropertyNames29_ES6.js similarity index 81% rename from tests/baselines/reference/computedPropertyNames29.js rename to tests/baselines/reference/computedPropertyNames29_ES6.js index 50d050d888e..d01b6fd3b7f 100644 --- a/tests/baselines/reference/computedPropertyNames29.js +++ b/tests/baselines/reference/computedPropertyNames29_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames29.ts] +//// [computedPropertyNames29_ES6.ts] class C { bar() { () => { @@ -10,7 +10,7 @@ class C { } } -//// [computedPropertyNames29.js] +//// [computedPropertyNames29_ES6.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames29_ES6.types b/tests/baselines/reference/computedPropertyNames29_ES6.types new file mode 100644 index 00000000000..d520418749e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames29_ES6.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES6.ts === +class C { +>C : C + + bar() { +>bar : () => number + + () => { +>() => { var obj = { [this.bar()]() { } // needs capture }; } : () => void + + var obj = { +>obj : {} +>{ [this.bar()]() { } // needs capture } : {} + + [this.bar()]() { } // needs capture +>this.bar() : number +>this.bar : () => number +>this : C +>bar : () => number + + }; + } + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames2.errors.txt b/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt similarity index 72% rename from tests/baselines/reference/computedPropertyNames2.errors.txt rename to tests/baselines/reference/computedPropertyNames2_ES5.errors.txt index d0fd1de4576..2fbf68b4437 100644 --- a/tests/baselines/reference/computedPropertyNames2.errors.txt +++ b/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts (2 errors) ==== var methodName = "method"; var accessorName = "accessor"; class C { diff --git a/tests/baselines/reference/computedPropertyNames2.js b/tests/baselines/reference/computedPropertyNames2_ES5.js similarity index 90% rename from tests/baselines/reference/computedPropertyNames2.js rename to tests/baselines/reference/computedPropertyNames2_ES5.js index 737ec08c207..581b581d87b 100644 --- a/tests/baselines/reference/computedPropertyNames2.js +++ b/tests/baselines/reference/computedPropertyNames2_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames2.ts] +//// [computedPropertyNames2_ES5.ts] var methodName = "method"; var accessorName = "accessor"; class C { @@ -10,7 +10,7 @@ class C { static set [accessorName](v) { } } -//// [computedPropertyNames2.js] +//// [computedPropertyNames2_ES5.js] var methodName = "method"; var accessorName = "accessor"; var C = (function () { diff --git a/tests/baselines/reference/computedPropertyNames2_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames2_ES6.errors.txt new file mode 100644 index 00000000000..3f18a8764b4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames2_ES6.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts (2 errors) ==== + var methodName = "method"; + var accessorName = "accessor"; + class C { + [methodName]() { } + static [methodName]() { } + get [accessorName]() { } + ~~~~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + set [accessorName](v) { } + static get [accessorName]() { } + ~~~~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + static set [accessorName](v) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames2_ES6.js b/tests/baselines/reference/computedPropertyNames2_ES6.js new file mode 100644 index 00000000000..b58b1a6f077 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames2_ES6.js @@ -0,0 +1,42 @@ +//// [computedPropertyNames2_ES6.ts] +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName]() { } + static [methodName]() { } + get [accessorName]() { } + set [accessorName](v) { } + static get [accessorName]() { } + static set [accessorName](v) { } +} + +//// [computedPropertyNames2_ES6.js] +var methodName = "method"; +var accessorName = "accessor"; +var C = (function () { + function C() { + } + C.prototype[methodName] = function () { }; + C[methodName] = function () { }; + Object.defineProperty(C.prototype, accessorName, { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, accessorName, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, accessorName, { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, accessorName, { + set: function (v) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames30.errors.txt b/tests/baselines/reference/computedPropertyNames30_ES5.errors.txt similarity index 79% rename from tests/baselines/reference/computedPropertyNames30.errors.txt rename to tests/baselines/reference/computedPropertyNames30_ES5.errors.txt index f7b6411f867..1dfb605db33 100644 --- a/tests/baselines/reference/computedPropertyNames30.errors.txt +++ b/tests/baselines/reference/computedPropertyNames30_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts (1 errors) ==== class Base { } class C extends Base { diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js new file mode 100644 index 00000000000..505b149f62d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -0,0 +1,41 @@ +//// [computedPropertyNames30_ES5.ts] +class Base { +} +class C extends Base { + constructor() { + super(); + () => { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(super(), "prop")]() { } + }; + } + } +} + +//// [computedPropertyNames30_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.call(this); + (function () { + var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, + _a); + var _a; + }); + } + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames30_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames30_ES6.errors.txt new file mode 100644 index 00000000000..dc8892fd326 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames30_ES6.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts (1 errors) ==== + class Base { + } + class C extends Base { + constructor() { + super(); + () => { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(super(), "prop")]() { } + ~~~~~ +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors + }; + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames30.js b/tests/baselines/reference/computedPropertyNames30_ES6.js similarity index 91% rename from tests/baselines/reference/computedPropertyNames30.js rename to tests/baselines/reference/computedPropertyNames30_ES6.js index ae2b24385f4..0c4f259fe48 100644 --- a/tests/baselines/reference/computedPropertyNames30.js +++ b/tests/baselines/reference/computedPropertyNames30_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames30.ts] +//// [computedPropertyNames30_ES6.ts] class Base { } class C extends Base { @@ -15,7 +15,7 @@ class C extends Base { } } -//// [computedPropertyNames30.js] +//// [computedPropertyNames30_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js new file mode 100644 index 00000000000..0c8cbac455f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -0,0 +1,48 @@ +//// [computedPropertyNames31_ES5.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + () => { + var obj = { + [super.bar()]() { } // needs capture + }; + } + return 0; + } +} + +//// [computedPropertyNames31_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype.foo = function () { + var _this = this; + (function () { + var obj = (_a = {}, _a[_super.prototype.bar.call(_this)] = function () { }, + _a); + var _a; + }); + return 0; + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames31.types b/tests/baselines/reference/computedPropertyNames31_ES5.types similarity index 92% rename from tests/baselines/reference/computedPropertyNames31.types rename to tests/baselines/reference/computedPropertyNames31_ES5.types index 90e73bc3dcb..eb14b223ed3 100644 --- a/tests/baselines/reference/computedPropertyNames31.types +++ b/tests/baselines/reference/computedPropertyNames31_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames31.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts === class Base { >Base : Base diff --git a/tests/baselines/reference/computedPropertyNames31.js b/tests/baselines/reference/computedPropertyNames31_ES6.js similarity index 89% rename from tests/baselines/reference/computedPropertyNames31.js rename to tests/baselines/reference/computedPropertyNames31_ES6.js index 227f10e3bd4..0f7d72818fe 100644 --- a/tests/baselines/reference/computedPropertyNames31.js +++ b/tests/baselines/reference/computedPropertyNames31_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames31.ts] +//// [computedPropertyNames31_ES6.ts] class Base { bar() { return 0; @@ -15,7 +15,7 @@ class C extends Base { } } -//// [computedPropertyNames31.js] +//// [computedPropertyNames31_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames31_ES6.types b/tests/baselines/reference/computedPropertyNames31_ES6.types new file mode 100644 index 00000000000..9d835a1fac1 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames31_ES6.types @@ -0,0 +1,35 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES6.ts === +class Base { +>Base : Base + + bar() { +>bar : () => number + + return 0; + } +} +class C extends Base { +>C : C +>Base : Base + + foo() { +>foo : () => number + + () => { +>() => { var obj = { [super.bar()]() { } // needs capture }; } : () => void + + var obj = { +>obj : {} +>{ [super.bar()]() { } // needs capture } : {} + + [super.bar()]() { } // needs capture +>super.bar() : number +>super.bar : () => number +>super : Base +>bar : () => number + + }; + } + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames32.errors.txt b/tests/baselines/reference/computedPropertyNames32_ES5.errors.txt similarity index 69% rename from tests/baselines/reference/computedPropertyNames32.errors.txt rename to tests/baselines/reference/computedPropertyNames32_ES5.errors.txt index 63b13d40ab4..8305a2c0758 100644 --- a/tests/baselines/reference/computedPropertyNames32.errors.txt +++ b/tests/baselines/reference/computedPropertyNames32_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts(6,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts(6,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts (1 errors) ==== function foo() { return '' } class C { bar() { diff --git a/tests/baselines/reference/computedPropertyNames32.js b/tests/baselines/reference/computedPropertyNames32_ES5.js similarity index 69% rename from tests/baselines/reference/computedPropertyNames32.js rename to tests/baselines/reference/computedPropertyNames32_ES5.js index 9bc723581ef..a0d8b066b5c 100644 --- a/tests/baselines/reference/computedPropertyNames32.js +++ b/tests/baselines/reference/computedPropertyNames32_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames32.ts] +//// [computedPropertyNames32_ES5.ts] function foo() { return '' } class C { bar() { @@ -7,10 +7,8 @@ class C { [foo()]() { } } -//// [computedPropertyNames32.js] -function foo() { - return ''; -} +//// [computedPropertyNames32_ES5.js] +function foo() { return ''; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames32_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames32_ES6.errors.txt new file mode 100644 index 00000000000..36763fa6405 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames32_ES6.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES6.ts(6,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES6.ts (1 errors) ==== + function foo() { return '' } + class C { + bar() { + return 0; + } + [foo()]() { } + ~ +!!! error TS2467: A computed property name cannot reference a type parameter from its containing type. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames32_ES6.js b/tests/baselines/reference/computedPropertyNames32_ES6.js new file mode 100644 index 00000000000..69d2a40edce --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames32_ES6.js @@ -0,0 +1,20 @@ +//// [computedPropertyNames32_ES6.ts] +function foo() { return '' } +class C { + bar() { + return 0; + } + [foo()]() { } +} + +//// [computedPropertyNames32_ES6.js] +function foo() { return ''; } +var C = (function () { + function C() { + } + C.prototype.bar = function () { + return 0; + }; + C.prototype[foo()] = function () { }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.js b/tests/baselines/reference/computedPropertyNames33_ES5.js new file mode 100644 index 00000000000..84df68fcc10 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames33_ES5.js @@ -0,0 +1,24 @@ +//// [computedPropertyNames33_ES5.ts] +function foo() { return '' } +class C { + bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames33_ES5.js] +function foo() { return ''; } +var C = (function () { + function C() { + } + C.prototype.bar = function () { + var obj = (_a = {}, _a[foo()] = function () { }, + _a); + return 0; + var _a; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames33.types b/tests/baselines/reference/computedPropertyNames33_ES5.types similarity index 89% rename from tests/baselines/reference/computedPropertyNames33.types rename to tests/baselines/reference/computedPropertyNames33_ES5.types index 8cbe8e93ef2..a0d99ec8615 100644 --- a/tests/baselines/reference/computedPropertyNames33.types +++ b/tests/baselines/reference/computedPropertyNames33_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames33.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts === function foo() { return '' } >foo : () => string >T : T diff --git a/tests/baselines/reference/computedPropertyNames33.js b/tests/baselines/reference/computedPropertyNames33_ES6.js similarity index 73% rename from tests/baselines/reference/computedPropertyNames33.js rename to tests/baselines/reference/computedPropertyNames33_ES6.js index 43ceeb2b2fb..768af6fd403 100644 --- a/tests/baselines/reference/computedPropertyNames33.js +++ b/tests/baselines/reference/computedPropertyNames33_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames33.ts] +//// [computedPropertyNames33_ES6.ts] function foo() { return '' } class C { bar() { @@ -9,10 +9,8 @@ class C { } } -//// [computedPropertyNames33.js] -function foo() { - return ''; -} +//// [computedPropertyNames33_ES6.js] +function foo() { return ''; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames33_ES6.types b/tests/baselines/reference/computedPropertyNames33_ES6.types new file mode 100644 index 00000000000..331bd2b3e09 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames33_ES6.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES6.ts === +function foo() { return '' } +>foo : () => string +>T : T + +class C { +>C : C +>T : T + + bar() { +>bar : () => number + + var obj = { +>obj : {} +>{ [foo()]() { } } : {} + + [foo()]() { } +>foo() : string +>foo : () => string +>T : T + + }; + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames34.errors.txt b/tests/baselines/reference/computedPropertyNames34_ES5.errors.txt similarity index 74% rename from tests/baselines/reference/computedPropertyNames34.errors.txt rename to tests/baselines/reference/computedPropertyNames34_ES5.errors.txt index c6d4a9aa4eb..30fa6642cbc 100644 --- a/tests/baselines/reference/computedPropertyNames34.errors.txt +++ b/tests/baselines/reference/computedPropertyNames34_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts(5,18): error TS2302: Static members cannot reference class type parameters. +tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts(5,18): error TS2302: Static members cannot reference class type parameters. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts (1 errors) ==== function foo() { return '' } class C { static bar() { diff --git a/tests/baselines/reference/computedPropertyNames34_ES5.js b/tests/baselines/reference/computedPropertyNames34_ES5.js new file mode 100644 index 00000000000..9e1de33be7c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames34_ES5.js @@ -0,0 +1,24 @@ +//// [computedPropertyNames34_ES5.ts] +function foo() { return '' } +class C { + static bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames34_ES5.js] +function foo() { return ''; } +var C = (function () { + function C() { + } + C.bar = function () { + var obj = (_a = {}, _a[foo()] = function () { }, + _a); + return 0; + var _a; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames34_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames34_ES6.errors.txt new file mode 100644 index 00000000000..b7f3e37b124 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames34_ES6.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES6.ts(5,18): error TS2302: Static members cannot reference class type parameters. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES6.ts (1 errors) ==== + function foo() { return '' } + class C { + static bar() { + var obj = { + [foo()]() { } + ~ +!!! error TS2302: Static members cannot reference class type parameters. + }; + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames34.js b/tests/baselines/reference/computedPropertyNames34_ES6.js similarity index 72% rename from tests/baselines/reference/computedPropertyNames34.js rename to tests/baselines/reference/computedPropertyNames34_ES6.js index 12892eefe4f..09cccb0e7f4 100644 --- a/tests/baselines/reference/computedPropertyNames34.js +++ b/tests/baselines/reference/computedPropertyNames34_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames34.ts] +//// [computedPropertyNames34_ES6.ts] function foo() { return '' } class C { static bar() { @@ -9,10 +9,8 @@ class C { } } -//// [computedPropertyNames34.js] -function foo() { - return ''; -} +//// [computedPropertyNames34_ES6.js] +function foo() { return ''; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames35.js b/tests/baselines/reference/computedPropertyNames35.js deleted file mode 100644 index 5a731fd8bda..00000000000 --- a/tests/baselines/reference/computedPropertyNames35.js +++ /dev/null @@ -1,11 +0,0 @@ -//// [computedPropertyNames35.ts] -function foo() { return '' } -interface I { - bar(): string; - [foo()](): void; -} - -//// [computedPropertyNames35.js] -function foo() { - return ''; -} diff --git a/tests/baselines/reference/computedPropertyNames35.errors.txt b/tests/baselines/reference/computedPropertyNames35_ES5.errors.txt similarity index 65% rename from tests/baselines/reference/computedPropertyNames35.errors.txt rename to tests/baselines/reference/computedPropertyNames35_ES5.errors.txt index aa9279fe9c3..aaf56487028 100644 --- a/tests/baselines/reference/computedPropertyNames35.errors.txt +++ b/tests/baselines/reference/computedPropertyNames35_ES5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts(4,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts(4,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts (2 errors) ==== function foo() { return '' } interface I { bar(): string; diff --git a/tests/baselines/reference/computedPropertyNames35_ES5.js b/tests/baselines/reference/computedPropertyNames35_ES5.js new file mode 100644 index 00000000000..0804c946f1f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames35_ES5.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames35_ES5.ts] +function foo() { return '' } +interface I { + bar(): string; + [foo()](): void; +} + +//// [computedPropertyNames35_ES5.js] +function foo() { return ''; } diff --git a/tests/baselines/reference/computedPropertyNames35_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames35_ES6.errors.txt new file mode 100644 index 00000000000..c8ef5efac31 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames35_ES6.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts(4,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts(4,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts (2 errors) ==== + function foo() { return '' } + interface I { + bar(): string; + [foo()](): void; + ~~~~~~~~~~ +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. + ~ +!!! error TS2467: A computed property name cannot reference a type parameter from its containing type. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames35_ES6.js b/tests/baselines/reference/computedPropertyNames35_ES6.js new file mode 100644 index 00000000000..2d3f4088315 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames35_ES6.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames35_ES6.ts] +function foo() { return '' } +interface I { + bar(): string; + [foo()](): void; +} + +//// [computedPropertyNames35_ES6.js] +function foo() { return ''; } diff --git a/tests/baselines/reference/computedPropertyNames36.errors.txt b/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt similarity index 74% rename from tests/baselines/reference/computedPropertyNames36.errors.txt rename to tests/baselines/reference/computedPropertyNames36_ES5.errors.txt index a473ebfba8e..6c38043c8e0 100644 --- a/tests/baselines/reference/computedPropertyNames36.errors.txt +++ b/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames36.js b/tests/baselines/reference/computedPropertyNames36_ES5.js similarity index 80% rename from tests/baselines/reference/computedPropertyNames36.js rename to tests/baselines/reference/computedPropertyNames36_ES5.js index 5df5c503911..5519a6d284c 100644 --- a/tests/baselines/reference/computedPropertyNames36.js +++ b/tests/baselines/reference/computedPropertyNames36_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames36.ts] +//// [computedPropertyNames36_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { set ["set1"](p: Foo2) { } } -//// [computedPropertyNames36.js] +//// [computedPropertyNames36_ES5.js] var Foo = (function () { function Foo() { } @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, "get1", { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames36_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames36_ES6.errors.txt new file mode 100644 index 00000000000..8127898fde4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames36_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + set ["set1"](p: Foo2) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames36_ES6.js b/tests/baselines/reference/computedPropertyNames36_ES6.js new file mode 100644 index 00000000000..09bab9a2630 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames36_ES6.js @@ -0,0 +1,39 @@ +//// [computedPropertyNames36_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} + +//// [computedPropertyNames36_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + // Computed properties + get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "set1", { + set: function (p) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames37.js b/tests/baselines/reference/computedPropertyNames37_ES5.js similarity index 80% rename from tests/baselines/reference/computedPropertyNames37.js rename to tests/baselines/reference/computedPropertyNames37_ES5.js index 540dfa27e1e..54a7243f3fa 100644 --- a/tests/baselines/reference/computedPropertyNames37.js +++ b/tests/baselines/reference/computedPropertyNames37_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames37.ts] +//// [computedPropertyNames37_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { set ["set1"](p: Foo2) { } } -//// [computedPropertyNames37.js] +//// [computedPropertyNames37_ES5.js] var Foo = (function () { function Foo() { } @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, "get1", { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames37.types b/tests/baselines/reference/computedPropertyNames37_ES5.types similarity index 88% rename from tests/baselines/reference/computedPropertyNames37.types rename to tests/baselines/reference/computedPropertyNames37_ES5.types index b50e0590b79..a12324003bf 100644 --- a/tests/baselines/reference/computedPropertyNames37.types +++ b/tests/baselines/reference/computedPropertyNames37_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames37.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts === class Foo { x } >Foo : Foo >x : any diff --git a/tests/baselines/reference/computedPropertyNames37_ES6.js b/tests/baselines/reference/computedPropertyNames37_ES6.js new file mode 100644 index 00000000000..c824f15ef54 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames37_ES6.js @@ -0,0 +1,39 @@ +//// [computedPropertyNames37_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} + +//// [computedPropertyNames37_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + // Computed properties + get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "set1", { + set: function (p) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames37_ES6.types b/tests/baselines/reference/computedPropertyNames37_ES6.types new file mode 100644 index 00000000000..288685f0e02 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames37_ES6.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES6.ts === +class Foo { x } +>Foo : Foo +>x : any + +class Foo2 { x; y } +>Foo2 : Foo2 +>x : any +>y : any + +class C { +>C : C + + [s: number]: Foo2; +>s : number +>Foo2 : Foo2 + + // Computed properties + get ["get1"]() { return new Foo } +>new Foo : Foo +>Foo : typeof Foo + + set ["set1"](p: Foo2) { } +>p : Foo2 +>Foo2 : Foo2 +} diff --git a/tests/baselines/reference/computedPropertyNames38.errors.txt b/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt similarity index 74% rename from tests/baselines/reference/computedPropertyNames38.errors.txt rename to tests/baselines/reference/computedPropertyNames38_ES5.errors.txt index fc5f31f1329..acc08ee5527 100644 --- a/tests/baselines/reference/computedPropertyNames38.errors.txt +++ b/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames38.js b/tests/baselines/reference/computedPropertyNames38_ES5.js similarity index 80% rename from tests/baselines/reference/computedPropertyNames38.js rename to tests/baselines/reference/computedPropertyNames38_ES5.js index fbbbe83ddc6..49af4d00d51 100644 --- a/tests/baselines/reference/computedPropertyNames38.js +++ b/tests/baselines/reference/computedPropertyNames38_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames38.ts] +//// [computedPropertyNames38_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { set [1 << 6](p: Foo2) { } } -//// [computedPropertyNames38.js] +//// [computedPropertyNames38_ES5.js] var Foo = (function () { function Foo() { } @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, 1 << 6, { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames38_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames38_ES6.errors.txt new file mode 100644 index 00000000000..0a95b37f9a9 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames38_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. + set [1 << 6](p: Foo2) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames38_ES6.js b/tests/baselines/reference/computedPropertyNames38_ES6.js new file mode 100644 index 00000000000..9dde7da09de --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames38_ES6.js @@ -0,0 +1,39 @@ +//// [computedPropertyNames38_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} + +//// [computedPropertyNames38_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, 1 << 6, { + // Computed properties + get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, 1 << 6, { + set: function (p) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames39.errors.txt b/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt similarity index 74% rename from tests/baselines/reference/computedPropertyNames39.errors.txt rename to tests/baselines/reference/computedPropertyNames39_ES5.errors.txt index 573ef726241..669314676f9 100644 --- a/tests/baselines/reference/computedPropertyNames39.errors.txt +++ b/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames39.js b/tests/baselines/reference/computedPropertyNames39_ES5.js similarity index 80% rename from tests/baselines/reference/computedPropertyNames39.js rename to tests/baselines/reference/computedPropertyNames39_ES5.js index 1d367c8d856..1b8d3aab2ff 100644 --- a/tests/baselines/reference/computedPropertyNames39.js +++ b/tests/baselines/reference/computedPropertyNames39_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames39.ts] +//// [computedPropertyNames39_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { set [1 << 6](p: Foo2) { } } -//// [computedPropertyNames39.js] +//// [computedPropertyNames39_ES5.js] var Foo = (function () { function Foo() { } @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, 1 << 6, { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames39_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames39_ES6.errors.txt new file mode 100644 index 00000000000..38f432162d5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames39_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: number]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. + set [1 << 6](p: Foo2) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames39_ES6.js b/tests/baselines/reference/computedPropertyNames39_ES6.js new file mode 100644 index 00000000000..d0d21f201bb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames39_ES6.js @@ -0,0 +1,39 @@ +//// [computedPropertyNames39_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} + +//// [computedPropertyNames39_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, 1 << 6, { + // Computed properties + get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, 1 << 6, { + set: function (p) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames3.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt similarity index 65% rename from tests/baselines/reference/computedPropertyNames3.errors.txt rename to tests/baselines/reference/computedPropertyNames3_ES5.errors.txt index 7136e441e72..82e4b71b33b 100644 --- a/tests/baselines/reference/computedPropertyNames3.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (6 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts (6 errors) ==== var id; class C { [0 + 1]() { } diff --git a/tests/baselines/reference/computedPropertyNames3_ES5.js b/tests/baselines/reference/computedPropertyNames3_ES5.js new file mode 100644 index 00000000000..f5a063f91e6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames3_ES5.js @@ -0,0 +1,40 @@ +//// [computedPropertyNames3_ES5.ts] +var id; +class C { + [0 + 1]() { } + static [() => { }]() { } + get [delete id]() { } + set [[0, 1]](v) { } + static get [""]() { } + static set [id.toString()](v) { } +} + +//// [computedPropertyNames3_ES5.js] +var id; +var C = (function () { + function C() { + } + C.prototype[0 + 1] = function () { }; + C[function () { }] = function () { }; + Object.defineProperty(C.prototype, delete id, { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, [0, 1], { + set: function (v) { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "", { + get: function () { }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, id.toString(), { + set: function (v) { }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt new file mode 100644 index 00000000000..3df6d6d9744 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts (6 errors) ==== + var id; + class C { + [0 + 1]() { } + static [() => { }]() { } + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + get [delete id]() { } + ~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + set [[0, 1]](v) { } + ~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static get [""]() { } + ~~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + static set [id.toString()](v) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames3.js b/tests/baselines/reference/computedPropertyNames3_ES6.js similarity index 89% rename from tests/baselines/reference/computedPropertyNames3.js rename to tests/baselines/reference/computedPropertyNames3_ES6.js index 19f938e32ad..672d90d7b45 100644 --- a/tests/baselines/reference/computedPropertyNames3.js +++ b/tests/baselines/reference/computedPropertyNames3_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames3.ts] +//// [computedPropertyNames3_ES6.ts] var id; class C { [0 + 1]() { } @@ -9,7 +9,7 @@ class C { static set [id.toString()](v) { } } -//// [computedPropertyNames3.js] +//// [computedPropertyNames3_ES6.js] var id; var C = (function () { function C() { diff --git a/tests/baselines/reference/computedPropertyNames40.errors.txt b/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt similarity index 73% rename from tests/baselines/reference/computedPropertyNames40.errors.txt rename to tests/baselines/reference/computedPropertyNames40_ES5.errors.txt index c5bda4ed999..e8ceef0d581 100644 --- a/tests/baselines/reference/computedPropertyNames40.errors.txt +++ b/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts(8,5): error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(8,5): error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames40.js b/tests/baselines/reference/computedPropertyNames40_ES5.js similarity index 64% rename from tests/baselines/reference/computedPropertyNames40.js rename to tests/baselines/reference/computedPropertyNames40_ES5.js index 1c9b5d3bfa8..e8063762026 100644 --- a/tests/baselines/reference/computedPropertyNames40.js +++ b/tests/baselines/reference/computedPropertyNames40_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames40.ts] +//// [computedPropertyNames40_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { [""]() { return new Foo2 } } -//// [computedPropertyNames40.js] +//// [computedPropertyNames40_ES5.js] var Foo = (function () { function Foo() { } @@ -25,11 +25,7 @@ var C = (function () { function C() { } // Computed properties - C.prototype[""] = function () { - return new Foo; - }; - C.prototype[""] = function () { - return new Foo2; - }; + C.prototype[""] = function () { return new Foo; }; + C.prototype[""] = function () { return new Foo2; }; return C; })(); diff --git a/tests/baselines/reference/computedPropertyNames40_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames40_ES6.errors.txt new file mode 100644 index 00000000000..1a032a87b2b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames40_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts(8,5): error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: () => Foo2; + + // Computed properties + [""]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. + [""]() { return new Foo2 } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames40_ES6.js b/tests/baselines/reference/computedPropertyNames40_ES6.js new file mode 100644 index 00000000000..208be7760a9 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames40_ES6.js @@ -0,0 +1,31 @@ +//// [computedPropertyNames40_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + [""]() { return new Foo } + [""]() { return new Foo2 } +} + +//// [computedPropertyNames40_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + // Computed properties + C.prototype[""] = function () { return new Foo; }; + C.prototype[""] = function () { return new Foo2; }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames41.js b/tests/baselines/reference/computedPropertyNames41_ES5.js similarity index 72% rename from tests/baselines/reference/computedPropertyNames41.js rename to tests/baselines/reference/computedPropertyNames41_ES5.js index 34fe2d33df7..7d7c390bf3e 100644 --- a/tests/baselines/reference/computedPropertyNames41.js +++ b/tests/baselines/reference/computedPropertyNames41_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames41.ts] +//// [computedPropertyNames41_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -9,7 +9,7 @@ class C { static [""]() { return new Foo } } -//// [computedPropertyNames41.js] +//// [computedPropertyNames41_ES5.js] var Foo = (function () { function Foo() { } @@ -24,8 +24,6 @@ var C = (function () { function C() { } // Computed properties - C[""] = function () { - return new Foo; - }; + C[""] = function () { return new Foo; }; return C; })(); diff --git a/tests/baselines/reference/computedPropertyNames41.types b/tests/baselines/reference/computedPropertyNames41_ES5.types similarity index 88% rename from tests/baselines/reference/computedPropertyNames41.types rename to tests/baselines/reference/computedPropertyNames41_ES5.types index 1fb0af282ca..aac087ee958 100644 --- a/tests/baselines/reference/computedPropertyNames41.types +++ b/tests/baselines/reference/computedPropertyNames41_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames41.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts === class Foo { x } >Foo : Foo >x : any diff --git a/tests/baselines/reference/computedPropertyNames41_ES6.js b/tests/baselines/reference/computedPropertyNames41_ES6.js new file mode 100644 index 00000000000..050079017c0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames41_ES6.js @@ -0,0 +1,29 @@ +//// [computedPropertyNames41_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + static [""]() { return new Foo } +} + +//// [computedPropertyNames41_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + // Computed properties + C[""] = function () { return new Foo; }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames41_ES6.types b/tests/baselines/reference/computedPropertyNames41_ES6.types new file mode 100644 index 00000000000..ffb3387d161 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames41_ES6.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES6.ts === +class Foo { x } +>Foo : Foo +>x : any + +class Foo2 { x; y } +>Foo2 : Foo2 +>x : any +>y : any + +class C { +>C : C + + [s: string]: () => Foo2; +>s : string +>Foo2 : Foo2 + + // Computed properties + static [""]() { return new Foo } +>new Foo : Foo +>Foo : typeof Foo +} diff --git a/tests/baselines/reference/computedPropertyNames42.errors.txt b/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt similarity index 66% rename from tests/baselines/reference/computedPropertyNames42.errors.txt rename to tests/baselines/reference/computedPropertyNames42_ES5.errors.txt index 417931c535f..94153c47aa5 100644 --- a/tests/baselines/reference/computedPropertyNames42.errors.txt +++ b/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts (2 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames42.js b/tests/baselines/reference/computedPropertyNames42_ES5.js similarity index 77% rename from tests/baselines/reference/computedPropertyNames42.js rename to tests/baselines/reference/computedPropertyNames42_ES5.js index c9f24a1c708..f4fda8fc829 100644 --- a/tests/baselines/reference/computedPropertyNames42.js +++ b/tests/baselines/reference/computedPropertyNames42_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames42.ts] +//// [computedPropertyNames42_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -9,7 +9,7 @@ class C { [""]: Foo; } -//// [computedPropertyNames42.js] +//// [computedPropertyNames42_ES5.js] var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt new file mode 100644 index 00000000000..1f4e27d6e81 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts (2 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + + // Computed properties + [""]: Foo; + ~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. + ~~~~~~~~~~ +!!! error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames42_ES6.js b/tests/baselines/reference/computedPropertyNames42_ES6.js new file mode 100644 index 00000000000..8538088f450 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames42_ES6.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames42_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + [""]: Foo; +} + +//// [computedPropertyNames42_ES6.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames43.errors.txt b/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt similarity index 75% rename from tests/baselines/reference/computedPropertyNames43.errors.txt rename to tests/baselines/reference/computedPropertyNames43_ES5.errors.txt index d38dcca9216..62c239a5a54 100644 --- a/tests/baselines/reference/computedPropertyNames43.errors.txt +++ b/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames43.js b/tests/baselines/reference/computedPropertyNames43_ES5.js similarity index 85% rename from tests/baselines/reference/computedPropertyNames43.js rename to tests/baselines/reference/computedPropertyNames43_ES5.js index 0e7c3b5dac1..b689f02ee98 100644 --- a/tests/baselines/reference/computedPropertyNames43.js +++ b/tests/baselines/reference/computedPropertyNames43_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames43.ts] +//// [computedPropertyNames43_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -12,7 +12,7 @@ class D extends C { set ["set1"](p: Foo2) { } } -//// [computedPropertyNames43.js] +//// [computedPropertyNames43_ES5.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -41,9 +41,7 @@ var D = (function (_super) { } Object.defineProperty(D.prototype, "get1", { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames43_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames43_ES6.errors.txt new file mode 100644 index 00000000000..0efe0ba39ec --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames43_ES6.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + } + + class D extends C { + // Computed properties + get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + set ["set1"](p: Foo2) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames43_ES6.js b/tests/baselines/reference/computedPropertyNames43_ES6.js new file mode 100644 index 00000000000..4b64a4c803b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames43_ES6.js @@ -0,0 +1,54 @@ +//// [computedPropertyNames43_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; +} + +class D extends C { + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} + +//// [computedPropertyNames43_ES6.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "get1", { + // Computed properties + get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(D.prototype, "set1", { + set: function (p) { }, + enumerable: true, + configurable: true + }); + return D; +})(C); diff --git a/tests/baselines/reference/computedPropertyNames44.errors.txt b/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt similarity index 70% rename from tests/baselines/reference/computedPropertyNames44.errors.txt rename to tests/baselines/reference/computedPropertyNames44_ES5.errors.txt index bf1de6687e1..35ab422e093 100644 --- a/tests/baselines/reference/computedPropertyNames44.errors.txt +++ b/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts (2 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames44.js b/tests/baselines/reference/computedPropertyNames44_ES5.js similarity index 84% rename from tests/baselines/reference/computedPropertyNames44.js rename to tests/baselines/reference/computedPropertyNames44_ES5.js index 37466dad602..32d3505e252 100644 --- a/tests/baselines/reference/computedPropertyNames44.js +++ b/tests/baselines/reference/computedPropertyNames44_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames44.ts] +//// [computedPropertyNames44_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -11,7 +11,7 @@ class D extends C { set ["set1"](p: Foo) { } } -//// [computedPropertyNames44.js] +//// [computedPropertyNames44_ES5.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -32,9 +32,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "get1", { - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames44_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames44_ES6.errors.txt new file mode 100644 index 00000000000..5170746395c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames44_ES6.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts (2 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + } + + class D extends C { + set ["set1"](p: Foo) { } + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames44_ES6.js b/tests/baselines/reference/computedPropertyNames44_ES6.js new file mode 100644 index 00000000000..9cf11f3b337 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames44_ES6.js @@ -0,0 +1,52 @@ +//// [computedPropertyNames44_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + get ["get1"]() { return new Foo } +} + +class D extends C { + set ["set1"](p: Foo) { } +} + +//// [computedPropertyNames44_ES6.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "set1", { + set: function (p) { }, + enumerable: true, + configurable: true + }); + return D; +})(C); diff --git a/tests/baselines/reference/computedPropertyNames45.errors.txt b/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt similarity index 76% rename from tests/baselines/reference/computedPropertyNames45.errors.txt rename to tests/baselines/reference/computedPropertyNames45_ES5.errors.txt index 7ad29340b25..83855c5f0b7 100644 --- a/tests/baselines/reference/computedPropertyNames45.errors.txt +++ b/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames45.js b/tests/baselines/reference/computedPropertyNames45_ES5.js similarity index 85% rename from tests/baselines/reference/computedPropertyNames45.js rename to tests/baselines/reference/computedPropertyNames45_ES5.js index 69e0df349ca..3d924b00b73 100644 --- a/tests/baselines/reference/computedPropertyNames45.js +++ b/tests/baselines/reference/computedPropertyNames45_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames45.ts] +//// [computedPropertyNames45_ES5.ts] class Foo { x } class Foo2 { x; y } @@ -12,7 +12,7 @@ class D extends C { set ["set1"](p: Foo) { } } -//// [computedPropertyNames45.js] +//// [computedPropertyNames45_ES5.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } @@ -33,9 +33,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "get1", { - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt new file mode 100644 index 00000000000..963e01ed86b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + get ["get1"]() { return new Foo } + } + + class D extends C { + // No error when the indexer is in a class more derived than the computed property + [s: string]: Foo2; + set ["set1"](p: Foo) { } + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames45_ES6.js b/tests/baselines/reference/computedPropertyNames45_ES6.js new file mode 100644 index 00000000000..2e7992fe260 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames45_ES6.js @@ -0,0 +1,53 @@ +//// [computedPropertyNames45_ES6.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + get ["get1"]() { return new Foo } +} + +class D extends C { + // No error when the indexer is in a class more derived than the computed property + [s: string]: Foo2; + set ["set1"](p: Foo) { } +} + +//// [computedPropertyNames45_ES6.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + get: function () { return new Foo; }, + enumerable: true, + configurable: true + }); + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "set1", { + set: function (p) { }, + enumerable: true, + configurable: true + }); + return D; +})(C); diff --git a/tests/baselines/reference/computedPropertyNames46.js b/tests/baselines/reference/computedPropertyNames46.js deleted file mode 100644 index e2ef2b2e729..00000000000 --- a/tests/baselines/reference/computedPropertyNames46.js +++ /dev/null @@ -1,9 +0,0 @@ -//// [computedPropertyNames46.ts] -var o = { - ["" || 0]: 0 -}; - -//// [computedPropertyNames46.js] -var o = { - ["" || 0]: 0 -}; diff --git a/tests/baselines/reference/computedPropertyNames46_ES5.js b/tests/baselines/reference/computedPropertyNames46_ES5.js new file mode 100644 index 00000000000..3e4329b8a20 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames46_ES5.js @@ -0,0 +1,10 @@ +//// [computedPropertyNames46_ES5.ts] +var o = { + ["" || 0]: 0 +}; + +//// [computedPropertyNames46_ES5.js] +var o = (_a = {}, _a["" || 0] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames46.types b/tests/baselines/reference/computedPropertyNames46_ES5.types similarity index 83% rename from tests/baselines/reference/computedPropertyNames46.types rename to tests/baselines/reference/computedPropertyNames46_ES5.types index cf8585828f4..bdc2f2cf644 100644 --- a/tests/baselines/reference/computedPropertyNames46.types +++ b/tests/baselines/reference/computedPropertyNames46_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames46.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts === var o = { >o : {} >{ ["" || 0]: 0} : {} diff --git a/tests/baselines/reference/computedPropertyNames46_ES6.js b/tests/baselines/reference/computedPropertyNames46_ES6.js new file mode 100644 index 00000000000..421c301d67a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames46_ES6.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames46_ES6.ts] +var o = { + ["" || 0]: 0 +}; + +//// [computedPropertyNames46_ES6.js] +var o = { + ["" || 0]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames46_ES6.types b/tests/baselines/reference/computedPropertyNames46_ES6.types new file mode 100644 index 00000000000..7abb10f1ba5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames46_ES6.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES6.ts === +var o = { +>o : {} +>{ ["" || 0]: 0} : {} + + ["" || 0]: 0 +>"" || 0 : string | number + +}; diff --git a/tests/baselines/reference/computedPropertyNames47_ES5.js b/tests/baselines/reference/computedPropertyNames47_ES5.js new file mode 100644 index 00000000000..7874a25976f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames47_ES5.js @@ -0,0 +1,20 @@ +//// [computedPropertyNames47_ES5.ts] +enum E1 { x } +enum E2 { x } +var o = { + [E1.x || E2.x]: 0 +}; + +//// [computedPropertyNames47_ES5.js] +var E1; +(function (E1) { + E1[E1["x"] = 0] = "x"; +})(E1 || (E1 = {})); +var E2; +(function (E2) { + E2[E2["x"] = 0] = "x"; +})(E2 || (E2 = {})); +var o = (_a = {}, _a[0 /* x */ || 0 /* x */] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames47.types b/tests/baselines/reference/computedPropertyNames47_ES5.types similarity index 86% rename from tests/baselines/reference/computedPropertyNames47.types rename to tests/baselines/reference/computedPropertyNames47_ES5.types index 20d7ab1d31e..c79f2b20946 100644 --- a/tests/baselines/reference/computedPropertyNames47.types +++ b/tests/baselines/reference/computedPropertyNames47_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames47.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts === enum E1 { x } >E1 : E1 >x : E1 diff --git a/tests/baselines/reference/computedPropertyNames47.js b/tests/baselines/reference/computedPropertyNames47_ES6.js similarity index 73% rename from tests/baselines/reference/computedPropertyNames47.js rename to tests/baselines/reference/computedPropertyNames47_ES6.js index 88e28e54239..e104d33e7d3 100644 --- a/tests/baselines/reference/computedPropertyNames47.js +++ b/tests/baselines/reference/computedPropertyNames47_ES6.js @@ -1,11 +1,11 @@ -//// [computedPropertyNames47.ts] +//// [computedPropertyNames47_ES6.ts] enum E1 { x } enum E2 { x } var o = { [E1.x || E2.x]: 0 }; -//// [computedPropertyNames47.js] +//// [computedPropertyNames47_ES6.js] var E1; (function (E1) { E1[E1["x"] = 0] = "x"; diff --git a/tests/baselines/reference/computedPropertyNames47_ES6.types b/tests/baselines/reference/computedPropertyNames47_ES6.types new file mode 100644 index 00000000000..840d77754cf --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames47_ES6.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES6.ts === +enum E1 { x } +>E1 : E1 +>x : E1 + +enum E2 { x } +>E2 : E2 +>x : E2 + +var o = { +>o : {} +>{ [E1.x || E2.x]: 0} : {} + + [E1.x || E2.x]: 0 +>E1.x || E2.x : E1 | E2 +>E1.x : E1 +>E1 : typeof E1 +>x : E1 +>E2.x : E2 +>E2 : typeof E2 +>x : E2 + +}; diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.js b/tests/baselines/reference/computedPropertyNames48_ES5.js new file mode 100644 index 00000000000..f3f9941aeae --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames48_ES5.js @@ -0,0 +1,35 @@ +//// [computedPropertyNames48_ES5.ts] +declare function extractIndexer(p: { [n: number]: T }): T; + +enum E { x } + +var a: any; + +extractIndexer({ + [a]: "" +}); // Should return string + +extractIndexer({ + [E.x]: "" +}); // Should return string + +extractIndexer({ + ["" || 0]: "" +}); // Should return any (widened form of undefined) + +//// [computedPropertyNames48_ES5.js] +var E; +(function (E) { + E[E["x"] = 0] = "x"; +})(E || (E = {})); +var a; +extractIndexer((_a = {}, _a[a] = +"", +_a)); // Should return string +extractIndexer((_b = {}, _b[0 /* x */] = +"", +_b)); // Should return string +extractIndexer((_c = {}, _c["" || 0] = +"", +_c)); // Should return any (widened form of undefined) +var _a, _b, _c; diff --git a/tests/baselines/reference/computedPropertyNames48.types b/tests/baselines/reference/computedPropertyNames48_ES5.types similarity index 93% rename from tests/baselines/reference/computedPropertyNames48.types rename to tests/baselines/reference/computedPropertyNames48_ES5.types index 78755d5d5d7..3ff4c966e89 100644 --- a/tests/baselines/reference/computedPropertyNames48.types +++ b/tests/baselines/reference/computedPropertyNames48_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames48.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts === declare function extractIndexer(p: { [n: number]: T }): T; >extractIndexer : (p: { [n: number]: T; }) => T >T : T diff --git a/tests/baselines/reference/computedPropertyNames48.js b/tests/baselines/reference/computedPropertyNames48_ES6.js similarity index 86% rename from tests/baselines/reference/computedPropertyNames48.js rename to tests/baselines/reference/computedPropertyNames48_ES6.js index 9f8e0442ebe..27821647565 100644 --- a/tests/baselines/reference/computedPropertyNames48.js +++ b/tests/baselines/reference/computedPropertyNames48_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames48.ts] +//// [computedPropertyNames48_ES6.ts] declare function extractIndexer(p: { [n: number]: T }): T; enum E { x } @@ -17,7 +17,7 @@ extractIndexer({ ["" || 0]: "" }); // Should return any (widened form of undefined) -//// [computedPropertyNames48.js] +//// [computedPropertyNames48_ES6.js] var E; (function (E) { E[E["x"] = 0] = "x"; diff --git a/tests/baselines/reference/computedPropertyNames48_ES6.types b/tests/baselines/reference/computedPropertyNames48_ES6.types new file mode 100644 index 00000000000..e10f078d11f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames48_ES6.types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES6.ts === +declare function extractIndexer(p: { [n: number]: T }): T; +>extractIndexer : (p: { [n: number]: T; }) => T +>T : T +>p : { [n: number]: T; } +>n : number +>T : T +>T : T + +enum E { x } +>E : E +>x : E + +var a: any; +>a : any + +extractIndexer({ +>extractIndexer({ [a]: ""}) : string +>extractIndexer : (p: { [n: number]: T; }) => T +>{ [a]: ""} : { [x: number]: string; } + + [a]: "" +>a : any + +}); // Should return string + +extractIndexer({ +>extractIndexer({ [E.x]: ""}) : string +>extractIndexer : (p: { [n: number]: T; }) => T +>{ [E.x]: ""} : { [x: number]: string; } + + [E.x]: "" +>E.x : E +>E : typeof E +>x : E + +}); // Should return string + +extractIndexer({ +>extractIndexer({ ["" || 0]: ""}) : any +>extractIndexer : (p: { [n: number]: T; }) => T +>{ ["" || 0]: ""} : { [x: number]: undefined; } + + ["" || 0]: "" +>"" || 0 : string | number + +}); // Should return any (widened form of undefined) diff --git a/tests/baselines/reference/computedPropertyNames49_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames49_ES5.errors.txt new file mode 100644 index 00000000000..cb4034d3bad --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(7,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(10,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(14,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(14,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(19,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts (8 errors) ==== + + var x = { + p1: 10, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + throw 10; + }, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + return 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + // just throw + throw 10; + }, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames49_ES5.js b/tests/baselines/reference/computedPropertyNames49_ES5.js new file mode 100644 index 00000000000..a64d9431a9a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES5.js @@ -0,0 +1,46 @@ +//// [computedPropertyNames49_ES5.ts] + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames49_ES5.js] +var x = (_a = { + p1: 10 +}, _a.p1 = +10, _a[1 + 1] = Object.defineProperty({ get: function () { + throw 10; + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { + return 10; + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ set: function () { + // just throw + throw 10; + }, enumerable: true, configurable: true }), _a.foo = Object.defineProperty({ get: function () { + if (1 == 1) { + return 10; + } + }, enumerable: true, configurable: true }), _a.p2 = +20, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames49_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames49_ES6.errors.txt new file mode 100644 index 00000000000..276f7fb17be --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES6.errors.txt @@ -0,0 +1,40 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(10,9): error TS1049: A 'set' accessor must have exactly one parameter. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(14,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts (4 errors) ==== + + var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1049: A 'set' accessor must have exactly one parameter. + // just throw + throw 10; + }, + get foo() { + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get foo() { + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames49_ES6.js b/tests/baselines/reference/computedPropertyNames49_ES6.js new file mode 100644 index 00000000000..d1b5fe26e9d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES6.js @@ -0,0 +1,52 @@ +//// [computedPropertyNames49_ES6.ts] + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames49_ES6.js] +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +}; diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.js b/tests/baselines/reference/computedPropertyNames4_ES5.js new file mode 100644 index 00000000000..255b14eb970 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames4_ES5.js @@ -0,0 +1,36 @@ +//// [computedPropertyNames4_ES5.ts] +var s: string; +var n: number; +var a: any; +var v = { + [s]: 0, + [n]: n, + [s + s]: 1, + [s + n]: 2, + [+s]: s, + [""]: 0, + [0]: 0, + [a]: 1, + [true]: 0, + [`hello bye`]: 0, + [`hello ${a} bye`]: 0 +} + +//// [computedPropertyNames4_ES5.js] +var s; +var n; +var a; +var v = (_a = {}, _a[s] = +0, _a[n] = +n, _a[s + s] = +1, _a[s + n] = +2, _a[+s] = +s, _a[""] = +0, _a[0] = +0, _a[a] = +1, _a[true] = +0, _a["hello bye"] = +0, _a["hello " + a + " bye"] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames4.types b/tests/baselines/reference/computedPropertyNames4_ES5.types similarity index 91% rename from tests/baselines/reference/computedPropertyNames4.types rename to tests/baselines/reference/computedPropertyNames4_ES5.types index 968cc86b598..7c26cae6444 100644 --- a/tests/baselines/reference/computedPropertyNames4.types +++ b/tests/baselines/reference/computedPropertyNames4_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames4.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames4.js b/tests/baselines/reference/computedPropertyNames4_ES6.js similarity index 82% rename from tests/baselines/reference/computedPropertyNames4.js rename to tests/baselines/reference/computedPropertyNames4_ES6.js index 5acb6d957da..55143ca9e10 100644 --- a/tests/baselines/reference/computedPropertyNames4.js +++ b/tests/baselines/reference/computedPropertyNames4_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames4.ts] +//// [computedPropertyNames4_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ var v = { [`hello ${a} bye`]: 0 } -//// [computedPropertyNames4.js] +//// [computedPropertyNames4_ES6.js] var s; var n; var a; diff --git a/tests/baselines/reference/computedPropertyNames4_ES6.types b/tests/baselines/reference/computedPropertyNames4_ES6.types new file mode 100644 index 00000000000..973dfbec3a5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames4_ES6.types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES6.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +var v = { +>v : {} +>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : {} + + [s]: 0, +>s : string + + [n]: n, +>n : number +>n : number + + [s + s]: 1, +>s + s : string +>s : string +>s : string + + [s + n]: 2, +>s + n : string +>s : string +>n : number + + [+s]: s, +>+s : number +>s : string +>s : string + + [""]: 0, + [0]: 0, + [a]: 1, +>a : any + + [true]: 0, +>true : any + + [`hello bye`]: 0, + [`hello ${a} bye`]: 0 +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames50_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames50_ES5.errors.txt new file mode 100644 index 00000000000..63832dbed0c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(4,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(9,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(16,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(19,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts (8 errors) ==== + + var x = { + p1: 10, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + throw 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + // just throw + throw 10; + }, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + return 10; + }, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames50_ES5.js b/tests/baselines/reference/computedPropertyNames50_ES5.js new file mode 100644 index 00000000000..a0703eeac05 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES5.js @@ -0,0 +1,51 @@ +//// [computedPropertyNames50_ES5.ts] + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames50_ES5.js] +var x = (_a = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + } +}, _a.p1 = +10, _a.foo = Object.defineProperty({ get: function () { + if (1 == 1) { + return 10; + } + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { + throw 10; + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ set: function () { + // just throw + throw 10; + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { + return 10; + }, enumerable: true, configurable: true }), _a.p2 = +20, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames50_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames50_ES6.errors.txt new file mode 100644 index 00000000000..db61444a697 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES6.errors.txt @@ -0,0 +1,40 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(4,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(12,9): error TS1049: A 'set' accessor must have exactly one parameter. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts (4 errors) ==== + + var x = { + p1: 10, + get foo() { + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1049: A 'set' accessor must have exactly one parameter. + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames50_ES6.js b/tests/baselines/reference/computedPropertyNames50_ES6.js new file mode 100644 index 00000000000..24b0c8af1f5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES6.js @@ -0,0 +1,52 @@ +//// [computedPropertyNames50_ES6.ts] + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames50_ES6.js] +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +}; diff --git a/tests/baselines/reference/computedPropertyNames5.errors.txt b/tests/baselines/reference/computedPropertyNames5_ES5.errors.txt similarity index 63% rename from tests/baselines/reference/computedPropertyNames5.errors.txt rename to tests/baselines/reference/computedPropertyNames5_ES5.errors.txt index 2b59a816e16..f6d06758f23 100644 --- a/tests/baselines/reference/computedPropertyNames5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames5_ES5.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts (6 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts (6 errors) ==== var b: boolean; var v = { [b]: 0, diff --git a/tests/baselines/reference/computedPropertyNames5_ES5.js b/tests/baselines/reference/computedPropertyNames5_ES5.js new file mode 100644 index 00000000000..722c0f3a74d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames5_ES5.js @@ -0,0 +1,22 @@ +//// [computedPropertyNames5_ES5.ts] +var b: boolean; +var v = { + [b]: 0, + [true]: 1, + [[]]: 0, + [{}]: 0, + [undefined]: undefined, + [null]: null +} + +//// [computedPropertyNames5_ES5.js] +var b; +var v = (_a = {}, _a[b] = +0, _a[true] = +1, _a[[]] = +0, _a[{}] = +0, _a[undefined] = +undefined, _a[null] = +null, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames5_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames5_ES6.errors.txt new file mode 100644 index 00000000000..04675431c5c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames5_ES6.errors.txt @@ -0,0 +1,30 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts (6 errors) ==== + var b: boolean; + var v = { + [b]: 0, + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [true]: 1, + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [[]]: 0, + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [{}]: 0, + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [undefined]: undefined, + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [null]: null + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames5.js b/tests/baselines/reference/computedPropertyNames5_ES6.js similarity index 73% rename from tests/baselines/reference/computedPropertyNames5.js rename to tests/baselines/reference/computedPropertyNames5_ES6.js index d0158da6400..0ac309b8ed0 100644 --- a/tests/baselines/reference/computedPropertyNames5.js +++ b/tests/baselines/reference/computedPropertyNames5_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames5.ts] +//// [computedPropertyNames5_ES6.ts] var b: boolean; var v = { [b]: 0, @@ -9,7 +9,7 @@ var v = { [null]: null } -//// [computedPropertyNames5.js] +//// [computedPropertyNames5_ES6.js] var b; var v = { [b]: 0, diff --git a/tests/baselines/reference/computedPropertyNames6.errors.txt b/tests/baselines/reference/computedPropertyNames6_ES5.errors.txt similarity index 67% rename from tests/baselines/reference/computedPropertyNames6.errors.txt rename to tests/baselines/reference/computedPropertyNames6_ES5.errors.txt index 1a651b581c3..1780af80d87 100644 --- a/tests/baselines/reference/computedPropertyNames6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames6_ES5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts (2 errors) ==== var p1: number | string; var p2: number | number[]; var p3: string | boolean; diff --git a/tests/baselines/reference/computedPropertyNames6_ES5.js b/tests/baselines/reference/computedPropertyNames6_ES5.js new file mode 100644 index 00000000000..4e3ed1b2e9f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames6_ES5.js @@ -0,0 +1,20 @@ +//// [computedPropertyNames6_ES5.ts] +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +var v = { + [p1]: 0, + [p2]: 1, + [p3]: 2 +} + +//// [computedPropertyNames6_ES5.js] +var p1; +var p2; +var p3; +var v = (_a = {}, _a[p1] = +0, _a[p2] = +1, _a[p3] = +2, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames6_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames6_ES6.errors.txt new file mode 100644 index 00000000000..7f73ea97fa7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames6_ES6.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts (2 errors) ==== + var p1: number | string; + var p2: number | number[]; + var p3: string | boolean; + var v = { + [p1]: 0, + [p2]: 1, + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [p3]: 2 + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames6.js b/tests/baselines/reference/computedPropertyNames6_ES6.js similarity index 70% rename from tests/baselines/reference/computedPropertyNames6.js rename to tests/baselines/reference/computedPropertyNames6_ES6.js index e131ef4417f..1efc6fe004c 100644 --- a/tests/baselines/reference/computedPropertyNames6.js +++ b/tests/baselines/reference/computedPropertyNames6_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames6.ts] +//// [computedPropertyNames6_ES6.ts] var p1: number | string; var p2: number | number[]; var p3: string | boolean; @@ -8,7 +8,7 @@ var v = { [p3]: 2 } -//// [computedPropertyNames6.js] +//// [computedPropertyNames6_ES6.js] var p1; var p2; var p3; diff --git a/tests/baselines/reference/computedPropertyNames7_ES5.js b/tests/baselines/reference/computedPropertyNames7_ES5.js new file mode 100644 index 00000000000..3e1bcc1151c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames7_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNames7_ES5.ts] +enum E { + member +} +var v = { + [E.member]: 0 +} + +//// [computedPropertyNames7_ES5.js] +var E; +(function (E) { + E[E["member"] = 0] = "member"; +})(E || (E = {})); +var v = (_a = {}, _a[0 /* member */] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames7.types b/tests/baselines/reference/computedPropertyNames7_ES5.types similarity index 85% rename from tests/baselines/reference/computedPropertyNames7.types rename to tests/baselines/reference/computedPropertyNames7_ES5.types index 0b5f26614fc..209e07769c0 100644 --- a/tests/baselines/reference/computedPropertyNames7.types +++ b/tests/baselines/reference/computedPropertyNames7_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames7.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts === enum E { >E : E diff --git a/tests/baselines/reference/computedPropertyNames7.js b/tests/baselines/reference/computedPropertyNames7_ES6.js similarity index 66% rename from tests/baselines/reference/computedPropertyNames7.js rename to tests/baselines/reference/computedPropertyNames7_ES6.js index 075b149522b..5714fb747a6 100644 --- a/tests/baselines/reference/computedPropertyNames7.js +++ b/tests/baselines/reference/computedPropertyNames7_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames7.ts] +//// [computedPropertyNames7_ES6.ts] enum E { member } @@ -6,7 +6,7 @@ var v = { [E.member]: 0 } -//// [computedPropertyNames7.js] +//// [computedPropertyNames7_ES6.js] var E; (function (E) { E[E["member"] = 0] = "member"; diff --git a/tests/baselines/reference/computedPropertyNames7_ES6.types b/tests/baselines/reference/computedPropertyNames7_ES6.types new file mode 100644 index 00000000000..371176acc16 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames7_ES6.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES6.ts === +enum E { +>E : E + + member +>member : E +} +var v = { +>v : {} +>{ [E.member]: 0} : {} + + [E.member]: 0 +>E.member : E +>E : typeof E +>member : E +} diff --git a/tests/baselines/reference/computedPropertyNames8.errors.txt b/tests/baselines/reference/computedPropertyNames8_ES5.errors.txt similarity index 67% rename from tests/baselines/reference/computedPropertyNames8.errors.txt rename to tests/baselines/reference/computedPropertyNames8_ES5.errors.txt index 44e32e0a771..9fbd14a92fb 100644 --- a/tests/baselines/reference/computedPropertyNames8.errors.txt +++ b/tests/baselines/reference/computedPropertyNames8_ES5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts (2 errors) ==== function f() { var t: T; var u: U; diff --git a/tests/baselines/reference/computedPropertyNames8_ES5.js b/tests/baselines/reference/computedPropertyNames8_ES5.js new file mode 100644 index 00000000000..4db9ed2ec13 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames8_ES5.js @@ -0,0 +1,20 @@ +//// [computedPropertyNames8_ES5.ts] +function f() { + var t: T; + var u: U; + var v = { + [t]: 0, + [u]: 1 + }; +} + +//// [computedPropertyNames8_ES5.js] +function f() { + var t; + var u; + var v = (_a = {}, _a[t] = + 0, _a[u] = + 1, + _a); + var _a; +} diff --git a/tests/baselines/reference/computedPropertyNames8_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames8_ES6.errors.txt new file mode 100644 index 00000000000..22674a3992c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames8_ES6.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts (2 errors) ==== + function f() { + var t: T; + var u: U; + var v = { + [t]: 0, + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + [u]: 1 + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + }; + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames8.js b/tests/baselines/reference/computedPropertyNames8_ES6.js similarity index 70% rename from tests/baselines/reference/computedPropertyNames8.js rename to tests/baselines/reference/computedPropertyNames8_ES6.js index 44a21d79a1c..2290de66c71 100644 --- a/tests/baselines/reference/computedPropertyNames8.js +++ b/tests/baselines/reference/computedPropertyNames8_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames8.ts] +//// [computedPropertyNames8_ES6.ts] function f() { var t: T; var u: U; @@ -8,7 +8,7 @@ function f() { }; } -//// [computedPropertyNames8.js] +//// [computedPropertyNames8_ES6.js] function f() { var t; var u; diff --git a/tests/baselines/reference/computedPropertyNames9.errors.txt b/tests/baselines/reference/computedPropertyNames9_ES5.errors.txt similarity index 73% rename from tests/baselines/reference/computedPropertyNames9.errors.txt rename to tests/baselines/reference/computedPropertyNames9_ES5.errors.txt index a71e0f5e8eb..f58dfbc3166 100644 --- a/tests/baselines/reference/computedPropertyNames9.errors.txt +++ b/tests/baselines/reference/computedPropertyNames9_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts (1 errors) ==== function f(s: string): string; function f(n: number): number; function f(x: T): T; diff --git a/tests/baselines/reference/computedPropertyNames9_ES5.js b/tests/baselines/reference/computedPropertyNames9_ES5.js new file mode 100644 index 00000000000..a7c4a74d5ec --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames9_ES5.js @@ -0,0 +1,20 @@ +//// [computedPropertyNames9_ES5.ts] +function f(s: string): string; +function f(n: number): number; +function f(x: T): T; +function f(x): any { } + +var v = { + [f("")]: 0, + [f(0)]: 0, + [f(true)]: 0 +} + +//// [computedPropertyNames9_ES5.js] +function f(x) { } +var v = (_a = {}, _a[f("")] = +0, _a[f(0)] = +0, _a[f(true)] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames9_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames9_ES6.errors.txt new file mode 100644 index 00000000000..70dd526b85a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames9_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES6.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES6.ts (1 errors) ==== + function f(s: string): string; + function f(n: number): number; + function f(x: T): T; + function f(x): any { } + + var v = { + [f("")]: 0, + [f(0)]: 0, + [f(true)]: 0 + ~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames9.js b/tests/baselines/reference/computedPropertyNames9_ES6.js similarity index 74% rename from tests/baselines/reference/computedPropertyNames9.js rename to tests/baselines/reference/computedPropertyNames9_ES6.js index c2e89cd3133..b0e66c81cbd 100644 --- a/tests/baselines/reference/computedPropertyNames9.js +++ b/tests/baselines/reference/computedPropertyNames9_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames9.ts] +//// [computedPropertyNames9_ES6.ts] function f(s: string): string; function f(n: number): number; function f(x: T): T; @@ -10,7 +10,7 @@ var v = { [f(true)]: 0 } -//// [computedPropertyNames9.js] +//// [computedPropertyNames9_ES6.js] function f(x) { } var v = { [f("")]: 0, diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt similarity index 79% rename from tests/baselines/reference/computedPropertyNamesContextualType10.errors.txt rename to tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt index 5e9fbe7b45b..7fa95fe9426 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType10.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts(5,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts(5,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts (1 errors) ==== interface I { [s: number]: boolean; } diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js new file mode 100644 index 00000000000..5ea05124674 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType10_ES5.ts] +interface I { + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType10_ES5.js] +var o = (_a = {}, _a[+"foo"] = +"", _a[+"bar"] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.errors.txt new file mode 100644 index 00000000000..116cd1a2531 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES6.ts(5,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. + Index signatures are incompatible. + Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES6.ts (1 errors) ==== + interface I { + [s: number]: boolean; + } + + var o: I = { + ~ +!!! error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + [+"foo"]: "", + [+"bar"]: 0 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10.js b/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.js similarity index 55% rename from tests/baselines/reference/computedPropertyNamesContextualType10.js rename to tests/baselines/reference/computedPropertyNamesContextualType10_ES6.js index 125a014852e..fa08b5db3d2 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType10.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType10.ts] +//// [computedPropertyNamesContextualType10_ES6.ts] interface I { [s: number]: boolean; } @@ -8,7 +8,7 @@ var o: I = { [+"bar"]: 0 } -//// [computedPropertyNamesContextualType10.js] +//// [computedPropertyNamesContextualType10_ES6.js] var o = { [+"foo"]: "", [+"bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js new file mode 100644 index 00000000000..a7994495411 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType1_ES5.ts] +interface I { + [s: string]: (x: string) => number; + [s: number]: (x: any) => number; // Doesn't get hit +} + +var o: I = { + ["" + 0](y) { return y.length; }, + ["" + 1]: y => y.length +} + +//// [computedPropertyNamesContextualType1_ES5.js] +var o = (_a = {}, _a["" + 0] = function (y) { return y.length; }, _a["" + 1] = +function (y) { return y.length; }, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1.types b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.types similarity index 90% rename from tests/baselines/reference/computedPropertyNamesContextualType1.types rename to tests/baselines/reference/computedPropertyNamesContextualType1_ES5.types index 1697542fba6..ad7ddc30567 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.js similarity index 61% rename from tests/baselines/reference/computedPropertyNamesContextualType1.js rename to tests/baselines/reference/computedPropertyNamesContextualType1_ES6.js index 82429be9c40..f23a1a19e60 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType1.ts] +//// [computedPropertyNamesContextualType1_ES6.ts] interface I { [s: string]: (x: string) => number; [s: number]: (x: any) => number; // Doesn't get hit @@ -9,10 +9,8 @@ var o: I = { ["" + 1]: y => y.length } -//// [computedPropertyNamesContextualType1.js] +//// [computedPropertyNamesContextualType1_ES6.js] var o = { - ["" + 0](y) { - return y.length; - }, + ["" + 0](y) { return y.length; }, ["" + 1]: y => { return y.length; } }; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.types new file mode 100644 index 00000000000..44bc8a51113 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES6.ts === +interface I { +>I : I + + [s: string]: (x: string) => number; +>s : string +>x : string + + [s: number]: (x: any) => number; // Doesn't get hit +>s : number +>x : any +} + +var o: I = { +>o : I +>I : I +>{ ["" + 0](y) { return y.length; }, ["" + 1]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: undefined; } + + ["" + 0](y) { return y.length; }, +>"" + 0 : string +>y : string +>y.length : number +>y : string +>length : number + + ["" + 1]: y => y.length +>"" + 1 : string +>y => y.length : (y: string) => number +>y : string +>y.length : number +>y : string +>length : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js new file mode 100644 index 00000000000..0c6b80bbabb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType2_ES5.ts] +interface I { + [s: string]: (x: any) => number; // Doesn't get hit + [s: number]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} + +//// [computedPropertyNamesContextualType2_ES5.js] +var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] = +function (y) { return y.length; }, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2.types b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.types similarity index 90% rename from tests/baselines/reference/computedPropertyNamesContextualType2.types rename to tests/baselines/reference/computedPropertyNamesContextualType2_ES5.types index 408fd6a5062..0c1b9490abe 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.js similarity index 61% rename from tests/baselines/reference/computedPropertyNamesContextualType2.js rename to tests/baselines/reference/computedPropertyNamesContextualType2_ES6.js index 028e797be18..6a3fb653138 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType2.ts] +//// [computedPropertyNamesContextualType2_ES6.ts] interface I { [s: string]: (x: any) => number; // Doesn't get hit [s: number]: (x: string) => number; @@ -9,10 +9,8 @@ var o: I = { [+"bar"]: y => y.length } -//// [computedPropertyNamesContextualType2.js] +//// [computedPropertyNamesContextualType2_ES6.js] var o = { - [+"foo"](y) { - return y.length; - }, + [+"foo"](y) { return y.length; }, [+"bar"]: y => { return y.length; } }; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.types new file mode 100644 index 00000000000..222004cf8e3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES6.ts === +interface I { +>I : I + + [s: string]: (x: any) => number; // Doesn't get hit +>s : string +>x : any + + [s: number]: (x: string) => number; +>s : number +>x : string +} + +var o: I = { +>o : I +>I : I +>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: (y: string) => number; } + + [+"foo"](y) { return y.length; }, +>+"foo" : number +>y : string +>y.length : number +>y : string +>length : number + + [+"bar"]: y => y.length +>+"bar" : number +>y => y.length : (y: string) => number +>y : string +>y.length : number +>y : string +>length : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js new file mode 100644 index 00000000000..4336808c558 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js @@ -0,0 +1,15 @@ +//// [computedPropertyNamesContextualType3_ES5.ts] +interface I { + [s: string]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} + +//// [computedPropertyNamesContextualType3_ES5.js] +var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] = +function (y) { return y.length; }, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3.types b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.types similarity index 89% rename from tests/baselines/reference/computedPropertyNamesContextualType3.types rename to tests/baselines/reference/computedPropertyNamesContextualType3_ES5.types index a1a36c1b7e9..482d58c3ee0 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.js similarity index 55% rename from tests/baselines/reference/computedPropertyNamesContextualType3.js rename to tests/baselines/reference/computedPropertyNamesContextualType3_ES6.js index 944bb3595d4..9bf7dec1dd0 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType3.ts] +//// [computedPropertyNamesContextualType3_ES6.ts] interface I { [s: string]: (x: string) => number; } @@ -8,10 +8,8 @@ var o: I = { [+"bar"]: y => y.length } -//// [computedPropertyNamesContextualType3.js] +//// [computedPropertyNamesContextualType3_ES6.js] var o = { - [+"foo"](y) { - return y.length; - }, + [+"foo"](y) { return y.length; }, [+"bar"]: y => { return y.length; } }; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.types new file mode 100644 index 00000000000..bc36ad8ae2c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES6.ts === +interface I { +>I : I + + [s: string]: (x: string) => number; +>s : string +>x : string +} + +var o: I = { +>o : I +>I : I +>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; } + + [+"foo"](y) { return y.length; }, +>+"foo" : number +>y : string +>y.length : number +>y : string +>length : number + + [+"bar"]: y => y.length +>+"bar" : number +>y => y.length : (y: string) => number +>y : string +>y.length : number +>y : string +>length : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js new file mode 100644 index 00000000000..b813da30496 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesContextualType4_ES5.ts] +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType4_ES5.js] +var o = (_a = {}, _a["" + "foo"] = +"", _a["" + "bar"] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4.types b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.types similarity index 86% rename from tests/baselines/reference/computedPropertyNamesContextualType4.types rename to tests/baselines/reference/computedPropertyNamesContextualType4_ES5.types index d22f56f24fe..c1662397527 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType4.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4.js b/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.js similarity index 60% rename from tests/baselines/reference/computedPropertyNamesContextualType4.js rename to tests/baselines/reference/computedPropertyNamesContextualType4_ES6.js index 6ddd22baf6e..87cc54b4a59 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType4.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType4.ts] +//// [computedPropertyNamesContextualType4_ES6.ts] interface I { [s: string]: any; [s: number]: any; @@ -9,7 +9,7 @@ var o: I = { [""+"bar"]: 0 } -//// [computedPropertyNamesContextualType4.js] +//// [computedPropertyNamesContextualType4_ES6.js] var o = { ["" + "foo"]: "", ["" + "bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.types new file mode 100644 index 00000000000..82424f9410c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES6.ts === +interface I { +>I : I + + [s: string]: any; +>s : string + + [s: number]: any; +>s : number +} + +var o: I = { +>o : I +>I : I +>{ [""+"foo"]: "", [""+"bar"]: 0} : { [x: string]: string | number; [x: number]: undefined; } + + [""+"foo"]: "", +>""+"foo" : string + + [""+"bar"]: 0 +>""+"bar" : string +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js new file mode 100644 index 00000000000..f75389de3e9 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesContextualType5_ES5.ts] +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType5_ES5.js] +var o = (_a = {}, _a[+"foo"] = +"", _a[+"bar"] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5.types b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.types similarity index 86% rename from tests/baselines/reference/computedPropertyNamesContextualType5.types rename to tests/baselines/reference/computedPropertyNamesContextualType5_ES5.types index 12c3332acfa..bb382ca136e 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType5.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5.js b/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.js similarity index 58% rename from tests/baselines/reference/computedPropertyNamesContextualType5.js rename to tests/baselines/reference/computedPropertyNamesContextualType5_ES6.js index f2bd79644a0..775e8931efe 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType5.ts] +//// [computedPropertyNamesContextualType5_ES6.ts] interface I { [s: string]: any; [s: number]: any; @@ -9,7 +9,7 @@ var o: I = { [+"bar"]: 0 } -//// [computedPropertyNamesContextualType5.js] +//// [computedPropertyNamesContextualType5_ES6.js] var o = { [+"foo"]: "", [+"bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.types new file mode 100644 index 00000000000..6ab28f9583d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES6.ts === +interface I { +>I : I + + [s: string]: any; +>s : string + + [s: number]: any; +>s : number +} + +var o: I = { +>o : I +>I : I +>{ [+"foo"]: "", [+"bar"]: 0} : { [x: string]: string | number; [x: number]: string | number; } + + [+"foo"]: "", +>+"foo" : number + + [+"bar"]: 0 +>+"bar" : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js new file mode 100644 index 00000000000..bc724320d14 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js @@ -0,0 +1,27 @@ +//// [computedPropertyNamesContextualType6_ES5.ts] +interface I { + [s: string]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); + +//// [computedPropertyNamesContextualType6_ES5.js] +foo((_a = { + p: "", + 0: function () { } +}, _a.p = +"", _a[0] = +function () { }, _a["hi" + "bye"] = +true, _a[0 + 1] = +0, _a[+"hi"] = +[0], +_a)); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6.types b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types similarity index 91% rename from tests/baselines/reference/computedPropertyNamesContextualType6.types rename to tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types index acbae75ad4c..2e16c7cb140 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts === interface I { >I : I >T : T diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6.types.pull b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types.pull similarity index 91% rename from tests/baselines/reference/computedPropertyNamesContextualType6.types.pull rename to tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types.pull index a7a65d6618d..ce7a4c0d026 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6.types.pull +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types.pull @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts === interface I { >I : I >T : T diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.js similarity index 70% rename from tests/baselines/reference/computedPropertyNamesContextualType6.js rename to tests/baselines/reference/computedPropertyNamesContextualType6_ES6.js index 20678a60658..1360cc20028 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType6.ts] +//// [computedPropertyNamesContextualType6_ES6.ts] interface I { [s: string]: T; } @@ -13,7 +13,7 @@ foo({ [+"hi"]: [0] }); -//// [computedPropertyNamesContextualType6.js] +//// [computedPropertyNamesContextualType6_ES6.js] foo({ p: "", 0: () => { }, diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types new file mode 100644 index 00000000000..1684bfc573f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES6.ts === +interface I { +>I : I +>T : T + + [s: string]: T; +>s : string +>T : T +} + +declare function foo(obj: I): T +>foo : (obj: I) => T +>T : T +>obj : I +>I : I +>T : T +>T : T + +foo({ +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | number[] | (() => void) +>foo : (obj: I) => T +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | number[] | (() => void); 0: () => void; p: string; } + + p: "", +>p : string + + 0: () => { }, +>() => { } : () => void + + ["hi" + "bye"]: true, +>"hi" + "bye" : string + + [0 + 1]: 0, +>0 + 1 : number + + [+"hi"]: [0] +>+"hi" : number +>[0] : number[] + +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types.pull b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types.pull new file mode 100644 index 00000000000..6722edacd64 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types.pull @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES6.ts === +interface I { +>I : I +>T : T + + [s: string]: T; +>s : string +>T : T +} + +declare function foo(obj: I): T +>foo : (obj: I) => T +>T : T +>obj : I +>I : I +>T : T +>T : T + +foo({ +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | (() => void) | number[] +>foo : (obj: I) => T +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | (() => void) | number[]; 0: () => void; p: string; } + + p: "", +>p : string + + 0: () => { }, +>() => { } : () => void + + ["hi" + "bye"]: true, +>"hi" + "bye" : string + + [0 + 1]: 0, +>0 + 1 : number + + [+"hi"]: [0] +>+"hi" : number +>[0] : number[] + +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js new file mode 100644 index 00000000000..8d2386a1d14 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js @@ -0,0 +1,27 @@ +//// [computedPropertyNamesContextualType7_ES5.ts] +interface I { + [s: number]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); + +//// [computedPropertyNamesContextualType7_ES5.js] +foo((_a = { + p: "", + 0: function () { } +}, _a.p = +"", _a[0] = +function () { }, _a["hi" + "bye"] = +true, _a[0 + 1] = +0, _a[+"hi"] = +[0], +_a)); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7.types b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types similarity index 91% rename from tests/baselines/reference/computedPropertyNamesContextualType7.types rename to tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types index da059d490b0..80ba2b9224f 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts === interface I { >I : I >T : T diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7.types.pull b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types.pull similarity index 91% rename from tests/baselines/reference/computedPropertyNamesContextualType7.types.pull rename to tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types.pull index ff68ec8d0b0..3511e913585 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7.types.pull +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types.pull @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts === interface I { >I : I >T : T diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.js similarity index 70% rename from tests/baselines/reference/computedPropertyNamesContextualType7.js rename to tests/baselines/reference/computedPropertyNamesContextualType7_ES6.js index a948c31d750..185ccd72ead 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType7.ts] +//// [computedPropertyNamesContextualType7_ES6.ts] interface I { [s: number]: T; } @@ -13,7 +13,7 @@ foo({ [+"hi"]: [0] }); -//// [computedPropertyNamesContextualType7.js] +//// [computedPropertyNamesContextualType7_ES6.js] foo({ p: "", 0: () => { }, diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types new file mode 100644 index 00000000000..c9ed4437760 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES6.ts === +interface I { +>I : I +>T : T + + [s: number]: T; +>s : number +>T : T +} + +declare function foo(obj: I): T +>foo : (obj: I) => T +>T : T +>obj : I +>I : I +>T : T +>T : T + +foo({ +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : number | number[] | (() => void) +>foo : (obj: I) => T +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: number | number[] | (() => void); 0: () => void; p: string; } + + p: "", +>p : string + + 0: () => { }, +>() => { } : () => void + + ["hi" + "bye"]: true, +>"hi" + "bye" : string + + [0 + 1]: 0, +>0 + 1 : number + + [+"hi"]: [0] +>+"hi" : number +>[0] : number[] + +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types.pull b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types.pull new file mode 100644 index 00000000000..c548aed2bae --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types.pull @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES6.ts === +interface I { +>I : I +>T : T + + [s: number]: T; +>s : number +>T : T +} + +declare function foo(obj: I): T +>foo : (obj: I) => T +>T : T +>obj : I +>I : I +>T : T +>T : T + +foo({ +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : number | (() => void) | number[] +>foo : (obj: I) => T +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: number | (() => void) | number[]; 0: () => void; p: string; } + + p: "", +>p : string + + 0: () => { }, +>() => { } : () => void + + ["hi" + "bye"]: true, +>"hi" + "bye" : string + + [0 + 1]: 0, +>0 + 1 : number + + [+"hi"]: [0] +>+"hi" : number +>[0] : number[] + +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt similarity index 78% rename from tests/baselines/reference/computedPropertyNamesContextualType8.errors.txt rename to tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt index 07b55b799e4..3376243e370 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts (1 errors) ==== interface I { [s: string]: boolean; [s: number]: boolean; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js new file mode 100644 index 00000000000..626f3d1a8e2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesContextualType8_ES5.ts] +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType8_ES5.js] +var o = (_a = {}, _a["" + "foo"] = +"", _a["" + "bar"] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt new file mode 100644 index 00000000000..e4540337ed4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. + Index signatures are incompatible. + Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts (1 errors) ==== + interface I { + [s: string]: boolean; + [s: number]: boolean; + } + + var o: I = { + ~ +!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + [""+"foo"]: "", + [""+"bar"]: 0 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8.js b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.js similarity index 61% rename from tests/baselines/reference/computedPropertyNamesContextualType8.js rename to tests/baselines/reference/computedPropertyNamesContextualType8_ES6.js index d98538c40c1..6a18fa0b92b 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType8.ts] +//// [computedPropertyNamesContextualType8_ES6.ts] interface I { [s: string]: boolean; [s: number]: boolean; @@ -9,7 +9,7 @@ var o: I = { [""+"bar"]: 0 } -//// [computedPropertyNamesContextualType8.js] +//// [computedPropertyNamesContextualType8_ES6.js] var o = { ["" + "foo"]: "", ["" + "bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt similarity index 78% rename from tests/baselines/reference/computedPropertyNamesContextualType9.errors.txt rename to tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt index 6a1d9316fd7..d4085a37e60 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts (1 errors) ==== interface I { [s: string]: boolean; [s: number]: boolean; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js new file mode 100644 index 00000000000..c28db4ded97 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesContextualType9_ES5.ts] +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType9_ES5.js] +var o = (_a = {}, _a[+"foo"] = +"", _a[+"bar"] = +0, +_a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.errors.txt new file mode 100644 index 00000000000..eca1360c26f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. + Index signatures are incompatible. + Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts (1 errors) ==== + interface I { + [s: string]: boolean; + [s: number]: boolean; + } + + var o: I = { + ~ +!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + [+"foo"]: "", + [+"bar"]: 0 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9.js b/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.js similarity index 60% rename from tests/baselines/reference/computedPropertyNamesContextualType9.js rename to tests/baselines/reference/computedPropertyNamesContextualType9_ES6.js index ed8791a51e0..e94ded1a47a 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType9.ts] +//// [computedPropertyNamesContextualType9_ES6.ts] interface I { [s: string]: boolean; [s: number]: boolean; @@ -9,7 +9,7 @@ var o: I = { [+"bar"]: 0 } -//// [computedPropertyNamesContextualType9.js] +//// [computedPropertyNamesContextualType9_ES6.js] var o = { [+"foo"]: "", [+"bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js similarity index 67% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js index bbdb6cd7baf..84b92f6c92d 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js @@ -1,19 +1,17 @@ -//// [computedPropertyNamesDeclarationEmit1.ts] +//// [computedPropertyNamesDeclarationEmit1_ES5.ts] class C { ["" + ""]() { } get ["" + ""]() { return 0; } set ["" + ""](x) { } } -//// [computedPropertyNamesDeclarationEmit1.js] +//// [computedPropertyNamesDeclarationEmit1_ES5.js] var C = (function () { function C() { } C.prototype["" + ""] = function () { }; Object.defineProperty(C.prototype, "" + "", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -26,6 +24,6 @@ var C = (function () { })(); -//// [computedPropertyNamesDeclarationEmit1.d.ts] +//// [computedPropertyNamesDeclarationEmit1_ES5.d.ts] declare class C { } diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.types similarity index 82% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit1.types rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.types index e8e184a652e..a5fe3dc0fa1 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.types +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.js new file mode 100644 index 00000000000..b7505212baf --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.js @@ -0,0 +1,29 @@ +//// [computedPropertyNamesDeclarationEmit1_ES6.ts] +class C { + ["" + ""]() { } + get ["" + ""]() { return 0; } + set ["" + ""](x) { } +} + +//// [computedPropertyNamesDeclarationEmit1_ES6.js] +var C = (function () { + function C() { + } + C.prototype["" + ""] = function () { }; + Object.defineProperty(C.prototype, "" + "", { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "" + "", { + set: function (x) { }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [computedPropertyNamesDeclarationEmit1_ES6.d.ts] +declare class C { +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.types new file mode 100644 index 00000000000..a48c85f8602 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES6.ts === +class C { +>C : C + + ["" + ""]() { } +>"" + "" : string + + get ["" + ""]() { return 0; } +>"" + "" : string + + set ["" + ""](x) { } +>"" + "" : string +>x : any +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js similarity index 66% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js index 10313841c4f..9847ea8b7ef 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js @@ -1,19 +1,17 @@ -//// [computedPropertyNamesDeclarationEmit2.ts] +//// [computedPropertyNamesDeclarationEmit2_ES5.ts] class C { static ["" + ""]() { } static get ["" + ""]() { return 0; } static set ["" + ""](x) { } } -//// [computedPropertyNamesDeclarationEmit2.js] +//// [computedPropertyNamesDeclarationEmit2_ES5.js] var C = (function () { function C() { } C["" + ""] = function () { }; Object.defineProperty(C, "" + "", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -26,6 +24,6 @@ var C = (function () { })(); -//// [computedPropertyNamesDeclarationEmit2.d.ts] +//// [computedPropertyNamesDeclarationEmit2_ES5.d.ts] declare class C { } diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.types similarity index 83% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit2.types rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.types index df1da17abea..949d82596c7 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.types +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.js new file mode 100644 index 00000000000..9cd90493ea6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.js @@ -0,0 +1,29 @@ +//// [computedPropertyNamesDeclarationEmit2_ES6.ts] +class C { + static ["" + ""]() { } + static get ["" + ""]() { return 0; } + static set ["" + ""](x) { } +} + +//// [computedPropertyNamesDeclarationEmit2_ES6.js] +var C = (function () { + function C() { + } + C["" + ""] = function () { }; + Object.defineProperty(C, "" + "", { + get: function () { return 0; }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "" + "", { + set: function (x) { }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [computedPropertyNamesDeclarationEmit2_ES6.d.ts] +declare class C { +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.types new file mode 100644 index 00000000000..eec55608a08 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES6.ts === +class C { +>C : C + + static ["" + ""]() { } +>"" + "" : string + + static get ["" + ""]() { return 0; } +>"" + "" : string + + static set ["" + ""](x) { } +>"" + "" : string +>x : any +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.js deleted file mode 100644 index affe949797e..00000000000 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.js +++ /dev/null @@ -1,11 +0,0 @@ -//// [computedPropertyNamesDeclarationEmit3.ts] -interface I { - ["" + ""](): void; -} - -//// [computedPropertyNamesDeclarationEmit3.js] - - -//// [computedPropertyNamesDeclarationEmit3.d.ts] -interface I { -} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt similarity index 61% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt index 961b64a7f32..b6effe98a91 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts (1 errors) ==== interface I { ["" + ""](): void; ~~~~~~~~~ diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.js new file mode 100644 index 00000000000..c24eaf68a6f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.js @@ -0,0 +1,11 @@ +//// [computedPropertyNamesDeclarationEmit3_ES5.ts] +interface I { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit3_ES5.js] + + +//// [computedPropertyNamesDeclarationEmit3_ES5.d.ts] +interface I { +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.errors.txt new file mode 100644 index 00000000000..99832a42e37 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES6.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES6.ts (1 errors) ==== + interface I { + ["" + ""](): void; + ~~~~~~~~~ +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.js new file mode 100644 index 00000000000..dc54ff2cbb2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.js @@ -0,0 +1,11 @@ +//// [computedPropertyNamesDeclarationEmit3_ES6.ts] +interface I { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit3_ES6.js] + + +//// [computedPropertyNamesDeclarationEmit3_ES6.d.ts] +interface I { +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.js deleted file mode 100644 index f68c1633ef9..00000000000 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.js +++ /dev/null @@ -1,12 +0,0 @@ -//// [computedPropertyNamesDeclarationEmit4.ts] -var v: { - ["" + ""](): void; -} - -//// [computedPropertyNamesDeclarationEmit4.js] -var v; - - -//// [computedPropertyNamesDeclarationEmit4.d.ts] -declare var v: { -}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt similarity index 60% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt index 45fa3ae521e..fd84ac72270 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts(2,5): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts(2,5): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts (1 errors) ==== var v: { ["" + ""](): void; ~~~~~~~~~ diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.js new file mode 100644 index 00000000000..c57c0384afc --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.js @@ -0,0 +1,12 @@ +//// [computedPropertyNamesDeclarationEmit4_ES5.ts] +var v: { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit4_ES5.js] +var v; + + +//// [computedPropertyNamesDeclarationEmit4_ES5.d.ts] +declare var v: { +}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.errors.txt new file mode 100644 index 00000000000..7cdd26576cb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES6.ts(2,5): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES6.ts (1 errors) ==== + var v: { + ["" + ""](): void; + ~~~~~~~~~ +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.js new file mode 100644 index 00000000000..903687d0780 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.js @@ -0,0 +1,12 @@ +//// [computedPropertyNamesDeclarationEmit4_ES6.ts] +var v: { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit4_ES6.js] +var v; + + +//// [computedPropertyNamesDeclarationEmit4_ES6.d.ts] +declare var v: { +}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js new file mode 100644 index 00000000000..a0666f166d4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesDeclarationEmit5_ES5.ts] +var v = { + ["" + ""]: 0, + ["" + ""]() { }, + get ["" + ""]() { return 0; }, + set ["" + ""](x) { } +} + +//// [computedPropertyNamesDeclarationEmit5_ES5.js] +var v = (_a = {}, _a["" + ""] = +0, _a["" + ""] = function () { }, _a["" + ""] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }), +_a); +var _a; + + +//// [computedPropertyNamesDeclarationEmit5_ES5.d.ts] +declare var v: {}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.types similarity index 87% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit5.types rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.types index c63d6d0d5c3..3f5a7355a20 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.types +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts === var v = { >v : {} >{ ["" + ""]: 0, ["" + ""]() { }, get ["" + ""]() { return 0; }, set ["" + ""](x) { }} : {} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.js similarity index 50% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.js index d59d84b9e72..e19ac43656e 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesDeclarationEmit5.ts] +//// [computedPropertyNamesDeclarationEmit5_ES6.ts] var v = { ["" + ""]: 0, ["" + ""]() { }, @@ -6,16 +6,14 @@ var v = { set ["" + ""](x) { } } -//// [computedPropertyNamesDeclarationEmit5.js] +//// [computedPropertyNamesDeclarationEmit5_ES6.js] var v = { ["" + ""]: 0, ["" + ""]() { }, - get ["" + ""]() { - return 0; - }, + get ["" + ""]() { return 0; }, set ["" + ""](x) { } }; -//// [computedPropertyNamesDeclarationEmit5.d.ts] +//// [computedPropertyNamesDeclarationEmit5_ES6.d.ts] declare var v: {}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.types new file mode 100644 index 00000000000..10b70587e32 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.types @@ -0,0 +1,18 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES6.ts === +var v = { +>v : {} +>{ ["" + ""]: 0, ["" + ""]() { }, get ["" + ""]() { return 0; }, set ["" + ""](x) { }} : {} + + ["" + ""]: 0, +>"" + "" : string + + ["" + ""]() { }, +>"" + "" : string + + get ["" + ""]() { return 0; }, +>"" + "" : string + + set ["" + ""](x) { } +>"" + "" : string +>x : any +} diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt similarity index 66% rename from tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt rename to tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt index ee7b67ad829..2a17d7da815 100644 --- a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(4,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(5,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts(4,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts(5,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts (2 errors) ==== var methodName = "method"; var accessorName = "accessor"; class C { diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads.js b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.js similarity index 75% rename from tests/baselines/reference/computedPropertyNamesOnOverloads.js rename to tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.js index 4312e533318..1470605413a 100644 --- a/tests/baselines/reference/computedPropertyNamesOnOverloads.js +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesOnOverloads.ts] +//// [computedPropertyNamesOnOverloads_ES5.ts] var methodName = "method"; var accessorName = "accessor"; class C { @@ -7,7 +7,7 @@ class C { [methodName](v?: string) { } } -//// [computedPropertyNamesOnOverloads.js] +//// [computedPropertyNamesOnOverloads_ES5.js] var methodName = "method"; var accessorName = "accessor"; var C = (function () { diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.errors.txt new file mode 100644 index 00000000000..381ee7c17ba --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts(4,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts(5,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts (2 errors) ==== + var methodName = "method"; + var accessorName = "accessor"; + class C { + [methodName](v: string); + ~~~~~~~~~~~~ +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. + [methodName](); + ~~~~~~~~~~~~ +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. + [methodName](v?: string) { } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.js b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.js new file mode 100644 index 00000000000..1cbddb58dc2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.js @@ -0,0 +1,18 @@ +//// [computedPropertyNamesOnOverloads_ES6.ts] +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName](v: string); + [methodName](); + [methodName](v?: string) { } +} + +//// [computedPropertyNamesOnOverloads_ES6.js] +var methodName = "method"; +var accessorName = "accessor"; +var C = (function () { + function C() { + } + C.prototype[methodName] = function (v) { }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap1.js.map deleted file mode 100644 index 5833df72f7f..00000000000 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [computedPropertyNamesSourceMap1.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap1.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1.ts"],"names":["C","C.constructor","C[\"hello\"]"],"mappings":"AAAA,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAIPC,CAACA;IAHGD,YAACA,OAAOA,CAACA,GAATA;QACIE,QAAQA,CAACA;IACbA,CAACA;IACLF,QAACA;AAADA,CAACA,AAJD,IAIC"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.js b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js similarity index 53% rename from tests/baselines/reference/computedPropertyNamesSourceMap1.js rename to tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js index b65e3f0ce5b..5b99f534002 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1.js +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js @@ -1,11 +1,11 @@ -//// [computedPropertyNamesSourceMap1.ts] +//// [computedPropertyNamesSourceMap1_ES5.ts] class C { ["hello"]() { debugger; } } -//// [computedPropertyNamesSourceMap1.js] +//// [computedPropertyNamesSourceMap1_ES5.js] var C = (function () { function C() { } @@ -14,4 +14,4 @@ var C = (function () { }; return C; })(); -//# sourceMappingURL=computedPropertyNamesSourceMap1.js.map \ No newline at end of file +//# sourceMappingURL=computedPropertyNamesSourceMap1_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map new file mode 100644 index 00000000000..f3881a54bd5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap1_ES5.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap1_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES5.ts"],"names":["C","C.constructor","C[\"hello\"]"],"mappings":"AAAA,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAIPC,CAACA;IAHGD,YAACA,OAAOA,CAACA,GAATA;QACIE,QAAQA,CAACA;IACbA,CAACA;IACLF,QAACA;AAADA,CAACA,AAJD,IAIC"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt similarity index 85% rename from tests/baselines/reference/computedPropertyNamesSourceMap1.sourcemap.txt rename to tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt index e806eee1aa7..607d51ca5dc 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt @@ -1,12 +1,12 @@ =================================================================== -JsFile: computedPropertyNamesSourceMap1.js -mapUrl: computedPropertyNamesSourceMap1.js.map +JsFile: computedPropertyNamesSourceMap1_ES5.js +mapUrl: computedPropertyNamesSourceMap1_ES5.js.map sourceRoot: -sources: computedPropertyNamesSourceMap1.ts +sources: computedPropertyNamesSourceMap1_ES5.ts =================================================================== ------------------------------------------------------------------- -emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.js -sourceFile:computedPropertyNamesSourceMap1.ts +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.js +sourceFile:computedPropertyNamesSourceMap1_ES5.ts ------------------------------------------------------------------- >>>var C = (function () { 1 > @@ -97,7 +97,7 @@ sourceFile:computedPropertyNamesSourceMap1.ts 2 >^ 3 > 4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 >} 3 > @@ -111,4 +111,4 @@ sourceFile:computedPropertyNamesSourceMap1.ts 3 >Emitted(8, 2) Source(1, 1) + SourceIndex(0) 4 >Emitted(8, 6) Source(5, 2) + SourceIndex(0) --- ->>>//# sourceMappingURL=computedPropertyNamesSourceMap1.js.map \ No newline at end of file +>>>//# sourceMappingURL=computedPropertyNamesSourceMap1_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.types b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.types similarity index 76% rename from tests/baselines/reference/computedPropertyNamesSourceMap1.types rename to tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.types index 54a2a9f19d0..1c57d97a7e8 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1.types +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js new file mode 100644 index 00000000000..f7dc9e17836 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesSourceMap1_ES6.ts] +class C { + ["hello"]() { + debugger; + } +} + +//// [computedPropertyNamesSourceMap1_ES6.js] +var C = (function () { + function C() { + } + C.prototype["hello"] = function () { + debugger; + }; + return C; +})(); +//# sourceMappingURL=computedPropertyNamesSourceMap1_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js.map new file mode 100644 index 00000000000..51154cc4676 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap1_ES6.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap1_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES6.ts"],"names":["C","C.constructor","C[\"hello\"]"],"mappings":"AAAA,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAIPC,CAACA;IAHGD,YAACA,OAAOA,CAACA,GAATA;QACIE,QAAQA,CAACA;IACbA,CAACA;IACLF,QAACA;AAADA,CAACA,AAJD,IAIC"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.sourcemap.txt new file mode 100644 index 00000000000..bb482f68cba --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.sourcemap.txt @@ -0,0 +1,114 @@ +=================================================================== +JsFile: computedPropertyNamesSourceMap1_ES6.js +mapUrl: computedPropertyNamesSourceMap1_ES6.js.map +sourceRoot: +sources: computedPropertyNamesSourceMap1_ES6.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.js +sourceFile:computedPropertyNamesSourceMap1_ES6.ts +------------------------------------------------------------------- +>>>var C = (function () { +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^-> +1 > +2 >class +3 > C +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 7) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 8) + SourceIndex(0) +--- +>>> function C() { +1->^^^^ +2 > ^^^^^^^^^ +3 > ^ +1-> +2 > class +3 > C +1->Emitted(2, 5) Source(1, 1) + SourceIndex(0) name (C) +2 >Emitted(2, 14) Source(1, 7) + SourceIndex(0) name (C) +3 >Emitted(2, 15) Source(1, 8) + SourceIndex(0) name (C) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > { + > ["hello"]() { + > debugger; + > } + > +2 > } +1 >Emitted(3, 5) Source(5, 1) + SourceIndex(0) name (C.constructor) +2 >Emitted(3, 6) Source(5, 2) + SourceIndex(0) name (C.constructor) +--- +>>> C.prototype["hello"] = function () { +1->^^^^ +2 > ^^^^^^^^^^^^ +3 > ^^^^^^^ +4 > ^ +5 > ^^^ +1-> +2 > [ +3 > "hello" +4 > ] +5 > +1->Emitted(4, 5) Source(2, 5) + SourceIndex(0) name (C) +2 >Emitted(4, 17) Source(2, 6) + SourceIndex(0) name (C) +3 >Emitted(4, 24) Source(2, 13) + SourceIndex(0) name (C) +4 >Emitted(4, 25) Source(2, 14) + SourceIndex(0) name (C) +5 >Emitted(4, 28) Source(2, 5) + SourceIndex(0) name (C) +--- +>>> debugger; +1 >^^^^^^^^ +2 > ^^^^^^^^ +3 > ^ +1 >["hello"]() { + > +2 > debugger +3 > ; +1 >Emitted(5, 9) Source(3, 9) + SourceIndex(0) name (C["hello"]) +2 >Emitted(5, 17) Source(3, 17) + SourceIndex(0) name (C["hello"]) +3 >Emitted(5, 18) Source(3, 18) + SourceIndex(0) name (C["hello"]) +--- +>>> }; +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(6, 5) Source(4, 5) + SourceIndex(0) name (C["hello"]) +2 >Emitted(6, 6) Source(4, 6) + SourceIndex(0) name (C["hello"]) +--- +>>> return C; +1->^^^^ +2 > ^^^^^^^^ +1-> + > +2 > } +1->Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (C) +2 >Emitted(7, 13) Source(5, 2) + SourceIndex(0) name (C) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class C { + > ["hello"]() { + > debugger; + > } + > } +1 >Emitted(8, 1) Source(5, 1) + SourceIndex(0) name (C) +2 >Emitted(8, 2) Source(5, 2) + SourceIndex(0) name (C) +3 >Emitted(8, 2) Source(1, 1) + SourceIndex(0) +4 >Emitted(8, 6) Source(5, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=computedPropertyNamesSourceMap1_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.types b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.types new file mode 100644 index 00000000000..d5dc8a857a0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.ts === +class C { +>C : C + + ["hello"]() { + debugger; + } +} diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.js b/tests/baselines/reference/computedPropertyNamesSourceMap2.js deleted file mode 100644 index d967cb0d468..00000000000 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2.js +++ /dev/null @@ -1,14 +0,0 @@ -//// [computedPropertyNamesSourceMap2.ts] -var v = { - ["hello"]() { - debugger; - } -} - -//// [computedPropertyNamesSourceMap2.js] -var v = { - ["hello"]() { - debugger; - } -}; -//# sourceMappingURL=computedPropertyNamesSourceMap2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2.js.map deleted file mode 100644 index 6c485c24f6f..00000000000 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [computedPropertyNamesSourceMap2.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap2.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;CACJ,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js new file mode 100644 index 00000000000..c5af22ef398 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js @@ -0,0 +1,14 @@ +//// [computedPropertyNamesSourceMap2_ES5.ts] +var v = { + ["hello"]() { + debugger; + } +} + +//// [computedPropertyNamesSourceMap2_ES5.js] +var v = (_a = {}, _a["hello"] = function () { + debugger; +}, +_a); +var _a; +//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map new file mode 100644 index 00000000000..82a729df957 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap2_ES5.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CACA,EAAA,GADA,EAAA,EACA,EAAA,CACK,OAAO,CAFA,GAAA;IAGA,QAAQ,CAAC;AACb,CAAC,AAJA;AACA,EAAA,AADA,CAKA,CAAA;IAJD,EAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt new file mode 100644 index 00000000000..33a3a2b4c2c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt @@ -0,0 +1,160 @@ +=================================================================== +JsFile: computedPropertyNamesSourceMap2_ES5.js +mapUrl: computedPropertyNamesSourceMap2_ES5.js.map +sourceRoot: +sources: computedPropertyNamesSourceMap2_ES5.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.js +sourceFile:computedPropertyNamesSourceMap2_ES5.ts +------------------------------------------------------------------- +>>>var v = (_a = {}, _a["hello"] = function () { +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > +6 > ^ +7 > ^^ +8 > ^^^ +9 > ^^ +10> ^^ +11> ^^ +12> ^ +13> ^^^^^^^ +14> ^ +15> ^^^ +1 > +2 >var +3 > v +4 > = +5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 9) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +5 > +6 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 10) Source(1, 1) + SourceIndex(0) nameIndex (-1) +6 > +7 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +7 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 10) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 12) Source(1, 1) + SourceIndex(0) nameIndex (-1) +7 > +8 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +8 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 12) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 15) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +8 > +9 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +9 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 17) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +9 > +10> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +10> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 19) Source(1, 1) + SourceIndex(0) nameIndex (-1) +10> +11> !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +11> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 21) Source(1, 1) + SourceIndex(0) nameIndex (-1) +11> +12> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +12> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 22) Source(2, 6) + SourceIndex(0) nameIndex (-1) +12> var v = { + > [ +13> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +13> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 19) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 29) Source(2, 13) + SourceIndex(0) nameIndex (-1) +13> "hello" +14> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +14> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 21) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 30) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +14> +15> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +15> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 22) Source(2, 14) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 33) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +15> +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) +5 >Emitted(1, 9) Source(0, NaN) + SourceIndex(0) +6 >Emitted(1, 10) Source(1, 1) + SourceIndex(0) +7 >Emitted(1, 12) Source(1, 1) + SourceIndex(0) +8 >Emitted(1, 15) Source(0, NaN) + SourceIndex(0) +9 >Emitted(1, 17) Source(0, NaN) + SourceIndex(0) +10>Emitted(1, 19) Source(1, 1) + SourceIndex(0) +11>Emitted(1, 21) Source(1, 1) + SourceIndex(0) +12>Emitted(1, 22) Source(2, 6) + SourceIndex(0) +13>Emitted(1, 29) Source(2, 13) + SourceIndex(0) +14>Emitted(1, 30) Source(0, NaN) + SourceIndex(0) +15>Emitted(1, 33) Source(0, NaN) + SourceIndex(0) +--- +>>> debugger; +1 >^^^^ +2 > ^^^^^^^^ +3 > ^ +1 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 29) Source(2, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 5) Source(3, 9) + SourceIndex(0) nameIndex (-1) +1 > +2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 30) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 13) Source(3, 17) + SourceIndex(0) nameIndex (-1) +2 > debugger +3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 30) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 14) Source(3, 18) + SourceIndex(0) nameIndex (-1) +3 > ; +1 >Emitted(2, 5) Source(3, 9) + SourceIndex(0) +2 >Emitted(2, 13) Source(3, 17) + SourceIndex(0) +3 >Emitted(2, 14) Source(3, 18) + SourceIndex(0) +--- +>>>}, +1 > +2 >^ +3 > +4 > ^^^^-> +1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 33) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 1) Source(4, 5) + SourceIndex(0) nameIndex (-1) +1 > + > +2 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +2 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 33) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 2) Source(4, 6) + SourceIndex(0) nameIndex (-1) +2 >} +3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 5) Source(3, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 2) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +3 > +1 >Emitted(3, 1) Source(4, 5) + SourceIndex(0) +2 >Emitted(3, 2) Source(4, 6) + SourceIndex(0) +3 >Emitted(3, 2) Source(0, NaN) + SourceIndex(0) +--- +>>>_a); +1-> +2 >^^ +3 > +4 > ^ +5 > ^ +6 > ^^^^-> +1->!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 13) Source(3, 29) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 1) Source(1, 1) + SourceIndex(0) nameIndex (-1) +1-> +2 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +2 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 14) Source(3, 30) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 3) Source(1, 1) + SourceIndex(0) nameIndex (-1) +2 > +3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 1) Source(4, 17) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 3) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +3 > +4 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(4, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 4) Source(5, 2) + SourceIndex(0) nameIndex (-1) +4 > +5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(5, 2) + SourceIndex(0) nameIndex (-1) +5 > +1->Emitted(4, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(4, 3) Source(1, 1) + SourceIndex(0) +3 >Emitted(4, 3) Source(0, NaN) + SourceIndex(0) +4 >Emitted(4, 4) Source(5, 2) + SourceIndex(0) +5 >Emitted(4, 5) Source(5, 2) + SourceIndex(0) +--- +>>>var _a; +1->^^^^ +2 > ^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1->!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) +1-> +2 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 1) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1) +2 > +1->Emitted(5, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(5, 7) Source(1, 1) + SourceIndex(0) +--- +!!!! **** There are more source map entries in the sourceMap's mapping than what was encoded +!!!! **** Remaining decoded string: ,EAAA,AADA,CAKA,CAAA;IAJD,EAAA +>>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.types b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types similarity index 81% rename from tests/baselines/reference/computedPropertyNamesSourceMap2.types rename to tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types index 972259eb3e2..1dcc49a8fae 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2.types +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts === var v = { >v : {} >{ ["hello"]() { debugger; }} : {} diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js new file mode 100644 index 00000000000..3d0274e65c7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js @@ -0,0 +1,14 @@ +//// [computedPropertyNamesSourceMap2_ES6.ts] +var v = { + ["hello"]() { + debugger; + } +} + +//// [computedPropertyNamesSourceMap2_ES6.js] +var v = { + ["hello"]() { + debugger; + } +}; +//# sourceMappingURL=computedPropertyNamesSourceMap2_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js.map new file mode 100644 index 00000000000..251171232e0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap2_ES6.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap2_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES6.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;CACJ,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.sourcemap.txt similarity index 79% rename from tests/baselines/reference/computedPropertyNamesSourceMap2.sourcemap.txt rename to tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.sourcemap.txt index 29f11b95e1f..48149aee0b5 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.sourcemap.txt @@ -1,12 +1,12 @@ =================================================================== -JsFile: computedPropertyNamesSourceMap2.js -mapUrl: computedPropertyNamesSourceMap2.js.map +JsFile: computedPropertyNamesSourceMap2_ES6.js +mapUrl: computedPropertyNamesSourceMap2_ES6.js.map sourceRoot: -sources: computedPropertyNamesSourceMap2.ts +sources: computedPropertyNamesSourceMap2_ES6.ts =================================================================== ------------------------------------------------------------------- -emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.js -sourceFile:computedPropertyNamesSourceMap2.ts +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.js +sourceFile:computedPropertyNamesSourceMap2_ES6.ts ------------------------------------------------------------------- >>>var v = { 1 > @@ -63,11 +63,11 @@ sourceFile:computedPropertyNamesSourceMap2.ts >>>}; 1 >^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >} 2 > 1 >Emitted(5, 2) Source(5, 2) + SourceIndex(0) 2 >Emitted(5, 3) Source(5, 2) + SourceIndex(0) --- ->>>//# sourceMappingURL=computedPropertyNamesSourceMap2.js.map \ No newline at end of file +>>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types new file mode 100644 index 00000000000..9a1c71364a2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts === +var v = { +>v : {} +>{ ["hello"]() { debugger; }} : {} + + ["hello"]() { + debugger; + } +} diff --git a/tests/baselines/reference/conditionalExpressions2.js b/tests/baselines/reference/conditionalExpressions2.js index b8870b564ec..6749a2c0ac0 100644 --- a/tests/baselines/reference/conditionalExpressions2.js +++ b/tests/baselines/reference/conditionalExpressions2.js @@ -18,11 +18,9 @@ var e = false ? "foo" : "bar"; var f = false ? null : undefined; var g = true ? { g: 5 } : null; var h = [{ h: 5 }, null]; -function i() { - if (true) { - return { x: 5 }; - } - else { - return null; - } +function i() { if (true) { + return { x: 5 }; } +else { + return null; +} } diff --git a/tests/baselines/reference/conditionalOperatorConditionIsNumberType.js b/tests/baselines/reference/conditionalOperatorConditionIsNumberType.js index 46a04169e93..f8fbe708e1a 100644 --- a/tests/baselines/reference/conditionalOperatorConditionIsNumberType.js +++ b/tests/baselines/reference/conditionalOperatorConditionIsNumberType.js @@ -91,9 +91,7 @@ condNumber ? exprString1 : exprBoolean1; // Union 1000000000000 ? exprIsObject1 : exprIsObject2; 10000 ? exprString1 : exprBoolean1; // Union //Cond is a number type expression -function foo() { - return 1; -} +function foo() { return 1; } ; var array = [1, 2, 3]; 1 * 0 ? exprAny1 : exprAny2; diff --git a/tests/baselines/reference/conditionalOperatorConditoinIsStringType.js b/tests/baselines/reference/conditionalOperatorConditoinIsStringType.js index 02c398e89e1..dbd68d9f009 100644 --- a/tests/baselines/reference/conditionalOperatorConditoinIsStringType.js +++ b/tests/baselines/reference/conditionalOperatorConditoinIsStringType.js @@ -92,9 +92,7 @@ condString ? exprString1 : exprBoolean1; // union " " ? exprIsObject1 : exprIsObject2; "hello " ? exprString1 : exprBoolean1; // union //Cond is a string type expression -function foo() { - return "string"; -} +function foo() { return "string"; } ; var array = ["1", "2", "3"]; typeof condString ? exprAny1 : exprAny2; diff --git a/tests/baselines/reference/constraintSatisfactionWithAny.js b/tests/baselines/reference/constraintSatisfactionWithAny.js index 924c2ab1700..06d8b17690a 100644 --- a/tests/baselines/reference/constraintSatisfactionWithAny.js +++ b/tests/baselines/reference/constraintSatisfactionWithAny.js @@ -54,16 +54,10 @@ var c8 = new C4(b); //// [constraintSatisfactionWithAny.js] // any is not a valid type argument unless there is no constraint, or the constraint is any -function foo(x) { - return null; -} -function foo2(x) { - return null; -} +function foo(x) { return null; } +function foo2(x) { return null; } //function foo3(x: T): T { return null; } -function foo4(x) { - return null; -} +function foo4(x) { return null; } var a; foo(a); foo2(a); diff --git a/tests/baselines/reference/constructorAsType.js b/tests/baselines/reference/constructorAsType.js index 1f48f214dd4..9f8c14ce743 100644 --- a/tests/baselines/reference/constructorAsType.js +++ b/tests/baselines/reference/constructorAsType.js @@ -6,8 +6,6 @@ var Person2:{new() : {name:string;};}; Person = Person2; //// [constructorAsType.js] -var Person = function () { - return { name: "joe" }; -}; +var Person = function () { return { name: "joe" }; }; var Person2; Person = Person2; diff --git a/tests/baselines/reference/constructorOverloads7.js b/tests/baselines/reference/constructorOverloads7.js index b7e152c66e1..5b7e407e806 100644 --- a/tests/baselines/reference/constructorOverloads7.js +++ b/tests/baselines/reference/constructorOverloads7.js @@ -34,6 +34,4 @@ function Point(x, y) { this.y = y; return this; } -function EF1(a, b) { - return a + b; -} +function EF1(a, b) { return a + b; } diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js index 86338c1d913..cd31308311b 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js @@ -314,10 +314,12 @@ var TypeScriptAllInOne; Program.prototype.if = function (retValue) { if (retValue === void 0) { retValue = != 0; } return 1; - ^ retValue; + ^ + retValue; bfs.TYPES(); if (retValue != 0) { - return 1 && ; + return 1 && + ; } retValue = bfs.OPERATOR; ' );; @@ -348,7 +350,8 @@ var BasicFeatures = (function () { BasicFeatures.prototype.VARIABLES = function () { var local = Number.MAX_VALUE; var min = Number.MIN_VALUE; - var inf = Number.NEGATIVE_INFINITY - ; + var inf = Number.NEGATIVE_INFINITY - + ; var nan = Number.NaN; var undef = undefined; var _\uD4A5\u7204\uC316, uE59F = local; @@ -357,16 +360,16 @@ var BasicFeatures = (function () { var local6 = local5 instanceof fs.File; var hex = 0xBADC0DE, Hex = 0XDEADBEEF; var float = 6.02e23, float2 = 6.02E-23; - var char = 'c', \u0066 = '\u0066', hexchar = '\x42' != ; + var char = 'c', \u0066 = '\u0066', hexchar = '\x42' != + ; var quoted = '"', quoted2 = "'"; var reg = /\w*/; - var objLit = { "var": number = 42, equals: function (x) { - return x["var"] === 42; - }, instanceof: function () { return 'objLit{42}'; } }; + var objLit = { "var": number = 42, equals: function (x) { return x["var"] === 42; }, instanceof: function () { return 'objLit{42}'; } }; var weekday = 0 /* Monday */; var con = char + f + hexchar + float.toString() + float2.toString() + reg.toString() + objLit + weekday; // - var any = 0 ^= ; + var any = 0 ^= + ; var bool = 0; var declare = 0; var constructor = 0; @@ -382,7 +385,8 @@ var BasicFeatures = (function () { var public = 0; var set = 0; var static = 0; - var string = 0 / > ; + var string = 0 / > + ; var yield = 0; var sum3 = any + bool + declare + constructor + get + implements + interface + let + module + number + package + private + protected + public + set + static + string + yield; return 0; @@ -483,15 +487,10 @@ var BasicFeatures = (function () { })(); var CLASS = (function () { function CLASS() { - this.d = function () { - yield; - 0; - }; + this.d = function () { yield; 0; }; } Object.defineProperty(CLASS.prototype, "Property", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -499,9 +498,7 @@ var CLASS = (function () { return 0; }; CLASS.prototype.Foo = function () { - var myEvent = function () { - return 1; - }; + var myEvent = function () { return 1; }; if (myEvent() == 1) return true ? : ; else @@ -545,7 +542,8 @@ while () : string, ; rest: string[]; { - & public; + & + public; DefaultValue(value ? : string = "Hello"); { } } diff --git a/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js b/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js index bd76a746ac9..726d45bffe5 100644 --- a/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js +++ b/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js @@ -8,9 +8,7 @@ var x = h("", f()); // Call should succeed and x should be string. All t //// [contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js] function f() { - function g(u) { - return null; - } + function g(u) { return null; } return g; } var h; diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js index b04c804ad7e..10672d86796 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js +++ b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js @@ -150,26 +150,27 @@ var i1Ori2 = { propertyOnlyInI2: "Hello" }; var arrayI1OrI2 = [i1, i2, { - commonPropertyType: "hello", - commonMethodType: function (a) { return a; }, - commonMethodWithTypeParameter: function (a) { return a; }, - methodOnlyInI1: function (a) { return a; }, - propertyOnlyInI1: "Hello" -}, { - commonPropertyType: "hello", - commonMethodType: function (a) { return a; }, - commonMethodWithTypeParameter: function (a) { return a; }, - methodOnlyInI2: function (a) { return a; }, - propertyOnlyInI2: "Hello" -}, { - commonPropertyType: "hello", - commonMethodType: function (a) { return a; }, - commonMethodWithTypeParameter: function (a) { return a; }, - methodOnlyInI1: function (a) { return a; }, - propertyOnlyInI1: "Hello", - methodOnlyInI2: function (a) { return a; }, - propertyOnlyInI2: "Hello" -}]; + commonPropertyType: "hello", + commonMethodType: function (a) { return a; }, + commonMethodWithTypeParameter: function (a) { return a; }, + methodOnlyInI1: function (a) { return a; }, + propertyOnlyInI1: "Hello" + }, + { + commonPropertyType: "hello", + commonMethodType: function (a) { return a; }, + commonMethodWithTypeParameter: function (a) { return a; }, + methodOnlyInI2: function (a) { return a; }, + propertyOnlyInI2: "Hello" + }, { + commonPropertyType: "hello", + commonMethodType: function (a) { return a; }, + commonMethodWithTypeParameter: function (a) { return a; }, + methodOnlyInI1: function (a) { return a; }, + propertyOnlyInI1: "Hello", + methodOnlyInI2: function (a) { return a; }, + propertyOnlyInI2: "Hello" + }]; var i11; var i21; var i11Ori21 = i11; @@ -191,17 +192,17 @@ var i11Ori21 = { commonPropertyDifferentType: 10 }; var arrayOrI11OrI21 = [i11, i21, i11 || i21, { - // Like i1 - commonMethodDifferentReturnType: function (a, b) { - var z = a.charAt(b); - return z; - }, - commonPropertyDifferentType: "hello" -}, { - // Like i2 - commonMethodDifferentReturnType: function (a, b) { - var z = a.charCodeAt(b); - return z; - }, - commonPropertyDifferentType: 10 -}]; + // Like i1 + commonMethodDifferentReturnType: function (a, b) { + var z = a.charAt(b); + return z; + }, + commonPropertyDifferentType: "hello" + }, { + // Like i2 + commonMethodDifferentReturnType: function (a, b) { + var z = a.charCodeAt(b); + return z; + }, + commonPropertyDifferentType: 10 + }]; diff --git a/tests/baselines/reference/contextualTyping.js b/tests/baselines/reference/contextualTyping.js index 46e09d7f9e5..75b98b16c33 100644 --- a/tests/baselines/reference/contextualTyping.js +++ b/tests/baselines/reference/contextualTyping.js @@ -249,40 +249,24 @@ var C2T5; }; })(C2T5 || (C2T5 = {})); // CONTEXT: Variable declaration -var c3t1 = (function (s) { - return s; -}); +var c3t1 = (function (s) { return s; }); var c3t2 = ({ n: 1 }); var c3t3 = []; -var c3t4 = function () { - return ({}); -}; -var c3t5 = function (n) { - return ({}); -}; -var c3t6 = function (n, s) { - return ({}); -}; -var c3t7 = function (n) { - return n; -}; -var c3t8 = function (n) { - return n; -}; +var c3t4 = function () { return ({}); }; +var c3t5 = function (n) { return ({}); }; +var c3t6 = function (n, s) { return ({}); }; +var c3t7 = function (n) { return n; }; +var c3t8 = function (n) { return n; }; var c3t9 = [[], []]; var c3t10 = [({}), ({})]; -var c3t11 = [function (n, s) { - return s; -}]; +var c3t11 = [function (n, s) { return s; }]; var c3t12 = { foo: ({}) }; var c3t13 = ({ - f: function (i, s) { - return s; - } + f: function (i, s) { return s; } }); var c3t14 = ({ a: [] @@ -306,47 +290,29 @@ var C5T5; })(C5T5 || (C5T5 = {})); // CONTEXT: Variable assignment var c6t5; -c6t5 = function (n) { - return ({}); -}; +c6t5 = function (n) { return ({}); }; // CONTEXT: Array index assignment var c7t2; c7t2[0] = ({ n: 1 }); var objc8 = ({}); -objc8.t1 = (function (s) { - return s; -}); +objc8.t1 = (function (s) { return s; }); objc8.t2 = ({ n: 1 }); objc8.t3 = []; -objc8.t4 = function () { - return ({}); -}; -objc8.t5 = function (n) { - return ({}); -}; -objc8.t6 = function (n, s) { - return ({}); -}; -objc8.t7 = function (n) { - return n; -}; -objc8.t8 = function (n) { - return n; -}; +objc8.t4 = function () { return ({}); }; +objc8.t5 = function (n) { return ({}); }; +objc8.t6 = function (n, s) { return ({}); }; +objc8.t7 = function (n) { return n; }; +objc8.t8 = function (n) { return n; }; objc8.t9 = [[], []]; objc8.t10 = [({}), ({})]; -objc8.t11 = [function (n, s) { - return s; -}]; +objc8.t11 = [function (n, s) { return s; }]; objc8.t12 = { foo: ({}) }; objc8.t13 = ({ - f: function (i, s) { - return s; - } + f: function (i, s) { return s; } }); objc8.t14 = ({ a: [] @@ -358,11 +324,7 @@ c9t5(function (n) { return ({}); }); // CONTEXT: Return statement -var c10t5 = function () { - return function (n) { - return ({}); - }; -}; +var c10t5 = function () { return function (n) { return ({}); }; }; // CONTEXT: Newing a class var C11t5 = (function () { function C11t5(f) { @@ -370,51 +332,31 @@ var C11t5 = (function () { return C11t5; })(); ; -var i = new C11t5(function (n) { - return ({}); -}); +var i = new C11t5(function (n) { return ({}); }); // CONTEXT: Type annotated expression -var c12t1 = (function (s) { - return s; -}); +var c12t1 = (function (s) { return s; }); var c12t2 = ({ n: 1 }); var c12t3 = []; -var c12t4 = function () { - return ({}); -}; -var c12t5 = function (n) { - return ({}); -}; -var c12t6 = function (n, s) { - return ({}); -}; -var c12t7 = function (n) { - return n; -}; -var c12t8 = function (n) { - return n; -}; +var c12t4 = function () { return ({}); }; +var c12t5 = function (n) { return ({}); }; +var c12t6 = function (n, s) { return ({}); }; +var c12t7 = function (n) { return n; }; +var c12t8 = function (n) { return n; }; var c12t9 = [[], []]; var c12t10 = [({}), ({})]; -var c12t11 = [function (n, s) { - return s; -}]; +var c12t11 = [function (n, s) { return s; }]; var c12t12 = { foo: ({}) }; var c12t13 = ({ - f: function (i, s) { - return s; - } + f: function (i, s) { return s; } }); var c12t14 = ({ a: [] }); -function EF1(a, b) { - return a + b; -} +function EF1(a, b) { return a + b; } var efv = EF1(1, 2); function Point(x, y) { this.x = x; diff --git a/tests/baselines/reference/contextualTyping.js.map b/tests/baselines/reference/contextualTyping.js.map index 98c41439762..ba71b082ada 100644 --- a/tests/baselines/reference/contextualTyping.js.map +++ b/tests/baselines/reference/contextualTyping.js.map @@ -1,2 +1,2 @@ //// [contextualTyping.js.map] -{"version":3,"file":"contextualTyping.js","sourceRoot":"","sources":["contextualTyping.ts"],"names":["C1T5","C1T5.constructor","C2T5","C4T5","C4T5.constructor","C5T5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"AAaA,AADA,sCAAsC;IAChC,IAAI;IAAVA,SAAMA,IAAIA;QACNC,QAAGA,GAAqCA,UAASA,CAACA;YAC9C,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IAADD,WAACA;AAADA,CAACA,AAJD,IAIC;AAGD,AADA,uCAAuC;AACvC,IAAO,IAAI,CAIV;AAJD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAGA,GAAqCA,UAASA,CAACA;QACzD,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EAJM,IAAI,KAAJ,IAAI,QAIV;AAGD,AADA,gCAAgC;IAC5B,IAAI,GAA0B,CAAC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC,CAAC;AAC7D,IAAI,IAAI,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAA;AACF,IAAI,IAAI,GAAa,EAAE,CAAC;AACxB,IAAI,IAAI,GAAe;IAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AACxD,IAAI,IAAI,GAAwB,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAClE,IAAI,IAAI,GAAmC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAChF,IAAI,IAAI,GAGJ,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC;AAE9B,IAAI,IAAI,GAAqC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC;AACvE,IAAI,IAAI,GAAe,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AAC/B,IAAI,KAAK,GAAW,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,IAAI,KAAK,GAAwC,CAAC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC,CAAC;AAChF,IAAI,KAAK,GAAS;IACd,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC;QAAI,MAAM,CAAC,CAAC,CAAC;IAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAGF,AADA,qCAAqC;IAC/B,IAAI;IAENC,SAFEA,IAAIA;QAGFC,IAAIA,CAACA,GAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;YACpB,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IACLD,WAACA;AAADA,CAACA,AAPD,IAOC;AAGD,AADA,sCAAsC;AACtC,IAAO,IAAI,CAKV;AALD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAqCA,CAACA;IACjDA,QAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;QACf,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EALM,IAAI,KAAJ,IAAI,QAKV;AAGD,AADA,+BAA+B;IAC3B,IAAyB,CAAC;AAC9B,IAAI,GAAwB,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAG9D,AADA,kCAAkC;IAC9B,IAAY,CAAC;AACjB,IAAI,CAAC,CAAC,CAAC,GAAS,CAAC,EAAC,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC;AAuBzB,IAAI,KAAK,GAkBS,CAAC,EAAE,CAAC,CAAC;AAEvB,KAAK,CAAC,EAAE,GAAG,CAAC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC,CAAC;AACtC,KAAK,CAAC,EAAE,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;AACd,KAAK,CAAC,EAAE,GAAG;IAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAC5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAC7C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAChD,KAAK,CAAC,EAAE,GAAG,UAAS,CAAS;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC;AAE5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC;AACrC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACnB,KAAK,CAAC,GAAG,GAAG,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC,CAAC;AAC3C,KAAK,CAAC,GAAG,GAAG;IACR,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC;QAAI,MAAM,CAAC,CAAC,CAAC;IAAC,CAAC;CAClC,CAAC,CAAA;AACF,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAEF,AADA,yBAAyB;SAChB,IAAI,CAAC,CAAsB,KAAI;AAAA,CAAC;AACzC,IAAI,CAAC,UAAS,CAAC;IACX,MAAM,CAAO,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC;AAGH,AADA,4BAA4B;IACxB,KAAK,GAA8B;IAAa,MAAM,CAAC,UAAS,CAAC;QAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;IAAC,CAAC,CAAA;AAAC,CAAC,CAAC;AAG/F,AADA,0BAA0B;IACpB,KAAK;IAAGC,SAARA,KAAKA,CAAeA,CAAsBA;IAAIC,CAACA;IAACD,YAACA;AAADA,CAACA,AAAvD,IAAuD;AAAA,CAAC;AACxD,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC,CAAC;AAGrD,AADA,qCAAqC;IACjC,KAAK,GAA2B,CAAC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC,CAAC;AAC/D,IAAI,KAAK,GAAU,CAAC;IAChB,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,IAAI,KAAK,GAAc,EAAE,CAAC;AAC1B,IAAI,KAAK,GAAgB;IAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAC1D,IAAI,KAAK,GAAyB,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AACpE,IAAI,KAAK,GAAoC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAClF,IAAI,KAAK,GAGN,UAAS,CAAQ;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC;AAEnC,IAAI,KAAK,GAAsC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC;AACzE,IAAI,KAAK,GAAgB,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACjC,IAAI,MAAM,GAAY,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9C,IAAI,MAAM,GAAyC,CAAC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC,CAAC;AAClF,IAAI,MAAM,GAAU;IAChB,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC;QAAI,MAAM,CAAC,CAAC,CAAC;IAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAOF,SAAS,GAAG,CAAC,CAAC,EAAC,CAAC;IAAIE,MAAMA,CAACA,CAACA,GAACA,CAACA,CAACA;AAACA,CAACA;AAEjC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAcnB,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;IACfC,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IACXA,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IAEXA,MAAMA,CAACA,IAAIA,CAACA;AAChBA,CAACA;AAED,KAAK,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/B,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,UAAS,EAAE,EAAE,EAAE;IACjC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,KAAK,CAAC,SAAS,GAAG;IACd,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,GAAG,EAAE,UAAS,EAAE,EAAE,EAAE;QAChB,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAC;AAIF,IAAI,CAAC,GAAM,EAAG,CAAC"} \ No newline at end of file +{"version":3,"file":"contextualTyping.js","sourceRoot":"","sources":["contextualTyping.ts"],"names":["C1T5","C1T5.constructor","C2T5","C4T5","C4T5.constructor","C5T5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"AAaA,AADA,sCAAsC;IAChC,IAAI;IAAVA,SAAMA,IAAIA;QACNC,QAAGA,GAAqCA,UAASA,CAACA;YAC9C,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IAADD,WAACA;AAADA,CAACA,AAJD,IAIC;AAGD,AADA,uCAAuC;AACvC,IAAO,IAAI,CAIV;AAJD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAGA,GAAqCA,UAASA,CAACA;QACzD,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EAJM,IAAI,KAAJ,IAAI,QAIV;AAGD,AADA,gCAAgC;IAC5B,IAAI,GAA0B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAC7D,IAAI,IAAI,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAA;AACF,IAAI,IAAI,GAAa,EAAE,CAAC;AACxB,IAAI,IAAI,GAAe,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AACxD,IAAI,IAAI,GAAwB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAClE,IAAI,IAAI,GAAmC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAChF,IAAI,IAAI,GAGJ,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9B,IAAI,IAAI,GAAqC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,IAAI,IAAI,GAAe,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AAC/B,IAAI,KAAK,GAAW,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,IAAI,KAAK,GAAwC,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,IAAI,KAAK,GAAS;IACd,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAGF,AADA,qCAAqC;IAC/B,IAAI;IAENC,SAFEA,IAAIA;QAGFC,IAAIA,CAACA,GAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;YACpB,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IACLD,WAACA;AAADA,CAACA,AAPD,IAOC;AAGD,AADA,sCAAsC;AACtC,IAAO,IAAI,CAKV;AALD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAqCA,CAACA;IACjDA,QAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;QACf,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EALM,IAAI,KAAJ,IAAI,QAKV;AAGD,AADA,+BAA+B;IAC3B,IAAyB,CAAC;AAC9B,IAAI,GAAwB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAG9D,AADA,kCAAkC;IAC9B,IAAY,CAAC;AACjB,IAAI,CAAC,CAAC,CAAC,GAAS,CAAC,EAAC,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC;AAuBzB,IAAI,KAAK,GAkBS,CAAC,EAAE,CAAC,CAAC;AAEvB,KAAK,CAAC,EAAE,GAAG,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AACtC,KAAK,CAAC,EAAE,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;AACd,KAAK,CAAC,EAAE,GAAG,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC7C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAChD,KAAK,CAAC,EAAE,GAAG,UAAS,CAAS,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAE5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACnB,KAAK,CAAC,GAAG,GAAG,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3C,KAAK,CAAC,GAAG,GAAG;IACR,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAEF,AADA,yBAAyB;SAChB,IAAI,CAAC,CAAsB,KAAI;AAAA,CAAC;AACzC,IAAI,CAAC,UAAS,CAAC;IACX,MAAM,CAAO,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC;AAGH,AADA,4BAA4B;IACxB,KAAK,GAA8B,cAAa,MAAM,CAAC,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAG/F,AADA,0BAA0B;IACpB,KAAK;IAAGC,SAARA,KAAKA,CAAeA,CAAsBA;IAAIC,CAACA;IAACD,YAACA;AAADA,CAACA,AAAvD,IAAuD;AAAA,CAAC;AACxD,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAGrD,AADA,qCAAqC;IACjC,KAAK,GAA2B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAC/D,IAAI,KAAK,GAAU,CAAC;IAChB,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,IAAI,KAAK,GAAc,EAAE,CAAC;AAC1B,IAAI,KAAK,GAAgB,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC1D,IAAI,KAAK,GAAyB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AACpE,IAAI,KAAK,GAAoC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAClF,IAAI,KAAK,GAGN,UAAS,CAAQ,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAEnC,IAAI,KAAK,GAAsC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzE,IAAI,KAAK,GAAgB,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACjC,IAAI,MAAM,GAAY,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9C,IAAI,MAAM,GAAyC,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,IAAI,MAAM,GAAU;IAChB,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAOF,SAAS,GAAG,CAAC,CAAC,EAAC,CAAC,IAAIE,MAAMA,CAACA,CAACA,GAACA,CAACA,CAACA,CAACA,CAACA;AAEjC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAcnB,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;IACfC,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IACXA,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IAEXA,MAAMA,CAACA,IAAIA,CAACA;AAChBA,CAACA;AAED,KAAK,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/B,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,UAAS,EAAE,EAAE,EAAE;IACjC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,KAAK,CAAC,SAAS,GAAG;IACd,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,GAAG,EAAE,UAAS,EAAE,EAAE,EAAE;QAChB,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAC;AAIF,IAAI,CAAC,GAAM,EAAG,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping.sourcemap.txt b/tests/baselines/reference/contextualTyping.sourcemap.txt index 6f9c9d2c1ec..5843e0f3f24 100644 --- a/tests/baselines/reference/contextualTyping.sourcemap.txt +++ b/tests/baselines/reference/contextualTyping.sourcemap.txt @@ -273,6 +273,7 @@ sourceFile:contextualTyping.ts 1-> 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^-> 1-> > >// CONTEXT: Variable declaration @@ -283,76 +284,71 @@ sourceFile:contextualTyping.ts 2 >Emitted(17, 1) Source(27, 1) + SourceIndex(0) 3 >Emitted(17, 33) Source(27, 33) + SourceIndex(0) --- ->>>var c3t1 = (function (s) { -1 >^^^^ +>>>var c3t1 = (function (s) { return s; }); +1->^^^^ 2 > ^^^^ 3 > ^^^ 4 > ^ 5 > ^^^^^^^^^^ 6 > ^ -1 > +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +1-> >var 2 > c3t1 3 > : (s: string) => string = 4 > ( 5 > function( 6 > s -1 >Emitted(18, 5) Source(28, 5) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> s +11> +12> +13> } +14> ) +15> ; +1->Emitted(18, 5) Source(28, 5) + SourceIndex(0) 2 >Emitted(18, 9) Source(28, 9) + SourceIndex(0) 3 >Emitted(18, 12) Source(28, 35) + SourceIndex(0) 4 >Emitted(18, 13) Source(28, 36) + SourceIndex(0) 5 >Emitted(18, 23) Source(28, 45) + SourceIndex(0) 6 >Emitted(18, 24) Source(28, 46) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > -1 >Emitted(19, 5) Source(28, 50) + SourceIndex(0) -2 >Emitted(19, 11) Source(28, 56) + SourceIndex(0) -3 >Emitted(19, 12) Source(28, 57) + SourceIndex(0) -4 >Emitted(19, 13) Source(28, 58) + SourceIndex(0) -5 >Emitted(19, 14) Source(28, 58) + SourceIndex(0) ---- ->>>}); -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^-> -1 > -2 >} -3 > ) -4 > ; -1 >Emitted(20, 1) Source(28, 59) + SourceIndex(0) -2 >Emitted(20, 2) Source(28, 60) + SourceIndex(0) -3 >Emitted(20, 3) Source(28, 61) + SourceIndex(0) -4 >Emitted(20, 4) Source(28, 62) + SourceIndex(0) +7 >Emitted(18, 28) Source(28, 50) + SourceIndex(0) +8 >Emitted(18, 34) Source(28, 56) + SourceIndex(0) +9 >Emitted(18, 35) Source(28, 57) + SourceIndex(0) +10>Emitted(18, 36) Source(28, 58) + SourceIndex(0) +11>Emitted(18, 37) Source(28, 58) + SourceIndex(0) +12>Emitted(18, 38) Source(28, 59) + SourceIndex(0) +13>Emitted(18, 39) Source(28, 60) + SourceIndex(0) +14>Emitted(18, 40) Source(28, 61) + SourceIndex(0) +15>Emitted(18, 41) Source(28, 62) + SourceIndex(0) --- >>>var c3t2 = ({ -1-> +1 > 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^ -1-> +1 > > 2 >var 3 > c3t2 4 > = 5 > ( -1->Emitted(21, 1) Source(29, 1) + SourceIndex(0) -2 >Emitted(21, 5) Source(29, 5) + SourceIndex(0) -3 >Emitted(21, 9) Source(29, 9) + SourceIndex(0) -4 >Emitted(21, 12) Source(29, 18) + SourceIndex(0) -5 >Emitted(21, 13) Source(29, 19) + SourceIndex(0) +1 >Emitted(19, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(19, 5) Source(29, 5) + SourceIndex(0) +3 >Emitted(19, 9) Source(29, 9) + SourceIndex(0) +4 >Emitted(19, 12) Source(29, 18) + SourceIndex(0) +5 >Emitted(19, 13) Source(29, 19) + SourceIndex(0) --- >>> n: 1 1 >^^^^ @@ -364,10 +360,10 @@ sourceFile:contextualTyping.ts 2 > n 3 > : 4 > 1 -1 >Emitted(22, 5) Source(30, 5) + SourceIndex(0) -2 >Emitted(22, 6) Source(30, 6) + SourceIndex(0) -3 >Emitted(22, 8) Source(30, 8) + SourceIndex(0) -4 >Emitted(22, 9) Source(30, 9) + SourceIndex(0) +1 >Emitted(20, 5) Source(30, 5) + SourceIndex(0) +2 >Emitted(20, 6) Source(30, 6) + SourceIndex(0) +3 >Emitted(20, 8) Source(30, 8) + SourceIndex(0) +4 >Emitted(20, 9) Source(30, 9) + SourceIndex(0) --- >>>}); 1 >^ @@ -378,9 +374,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(23, 2) Source(31, 2) + SourceIndex(0) -2 >Emitted(23, 3) Source(31, 3) + SourceIndex(0) -3 >Emitted(23, 4) Source(31, 3) + SourceIndex(0) +1 >Emitted(21, 2) Source(31, 2) + SourceIndex(0) +2 >Emitted(21, 3) Source(31, 3) + SourceIndex(0) +3 >Emitted(21, 4) Source(31, 3) + SourceIndex(0) --- >>>var c3t3 = []; 1-> @@ -389,7 +385,7 @@ sourceFile:contextualTyping.ts 4 > ^^^ 5 > ^^ 6 > ^ -7 > ^^^^^^^^^^^-> +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -397,71 +393,77 @@ sourceFile:contextualTyping.ts 4 > : number[] = 5 > [] 6 > ; -1->Emitted(24, 1) Source(32, 1) + SourceIndex(0) -2 >Emitted(24, 5) Source(32, 5) + SourceIndex(0) -3 >Emitted(24, 9) Source(32, 9) + SourceIndex(0) -4 >Emitted(24, 12) Source(32, 22) + SourceIndex(0) -5 >Emitted(24, 14) Source(32, 24) + SourceIndex(0) -6 >Emitted(24, 15) Source(32, 25) + SourceIndex(0) +1->Emitted(22, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(22, 5) Source(32, 5) + SourceIndex(0) +3 >Emitted(22, 9) Source(32, 9) + SourceIndex(0) +4 >Emitted(22, 12) Source(32, 22) + SourceIndex(0) +5 >Emitted(22, 14) Source(32, 24) + SourceIndex(0) +6 >Emitted(22, 15) Source(32, 25) + SourceIndex(0) --- ->>>var c3t4 = function () { +>>>var c3t4 = function () { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ -5 > ^^^^^^-> +5 > ^^^^^^^^^^^^^^ +6 > ^^^^^^ +7 > ^ +8 > ^ +9 > ^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^^-> 1-> > 2 >var 3 > c3t4 4 > : () => IFoo = -1->Emitted(25, 1) Source(33, 1) + SourceIndex(0) -2 >Emitted(25, 5) Source(33, 5) + SourceIndex(0) -3 >Emitted(25, 9) Source(33, 9) + SourceIndex(0) -4 >Emitted(25, 12) Source(33, 24) + SourceIndex(0) +5 > function() { +6 > return +7 > +8 > ( +9 > {} +10> ) +11> +12> +13> } +14> ; +1->Emitted(23, 1) Source(33, 1) + SourceIndex(0) +2 >Emitted(23, 5) Source(33, 5) + SourceIndex(0) +3 >Emitted(23, 9) Source(33, 9) + SourceIndex(0) +4 >Emitted(23, 12) Source(33, 24) + SourceIndex(0) +5 >Emitted(23, 26) Source(33, 37) + SourceIndex(0) +6 >Emitted(23, 32) Source(33, 43) + SourceIndex(0) +7 >Emitted(23, 33) Source(33, 50) + SourceIndex(0) +8 >Emitted(23, 34) Source(33, 51) + SourceIndex(0) +9 >Emitted(23, 36) Source(33, 53) + SourceIndex(0) +10>Emitted(23, 37) Source(33, 54) + SourceIndex(0) +11>Emitted(23, 38) Source(33, 54) + SourceIndex(0) +12>Emitted(23, 39) Source(33, 55) + SourceIndex(0) +13>Emitted(23, 40) Source(33, 56) + SourceIndex(0) +14>Emitted(23, 41) Source(33, 57) + SourceIndex(0) --- ->>> return ({}); -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1->function() { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1->Emitted(26, 5) Source(33, 37) + SourceIndex(0) -2 >Emitted(26, 11) Source(33, 43) + SourceIndex(0) -3 >Emitted(26, 12) Source(33, 50) + SourceIndex(0) -4 >Emitted(26, 13) Source(33, 51) + SourceIndex(0) -5 >Emitted(26, 15) Source(33, 53) + SourceIndex(0) -6 >Emitted(26, 16) Source(33, 54) + SourceIndex(0) -7 >Emitted(26, 17) Source(33, 54) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(27, 1) Source(33, 55) + SourceIndex(0) -2 >Emitted(27, 2) Source(33, 56) + SourceIndex(0) -3 >Emitted(27, 3) Source(33, 57) + SourceIndex(0) ---- ->>>var c3t5 = function (n) { +>>>var c3t5 = function (n) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^^^^-> 1-> > 2 >var @@ -469,49 +471,34 @@ sourceFile:contextualTyping.ts 4 > : (n: number) => IFoo = 5 > function( 6 > n -1->Emitted(28, 1) Source(34, 1) + SourceIndex(0) -2 >Emitted(28, 5) Source(34, 5) + SourceIndex(0) -3 >Emitted(28, 9) Source(34, 9) + SourceIndex(0) -4 >Emitted(28, 12) Source(34, 33) + SourceIndex(0) -5 >Emitted(28, 22) Source(34, 42) + SourceIndex(0) -6 >Emitted(28, 23) Source(34, 43) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> ( +11> {} +12> ) +13> +14> +15> } +16> ; +1->Emitted(24, 1) Source(34, 1) + SourceIndex(0) +2 >Emitted(24, 5) Source(34, 5) + SourceIndex(0) +3 >Emitted(24, 9) Source(34, 9) + SourceIndex(0) +4 >Emitted(24, 12) Source(34, 33) + SourceIndex(0) +5 >Emitted(24, 22) Source(34, 42) + SourceIndex(0) +6 >Emitted(24, 23) Source(34, 43) + SourceIndex(0) +7 >Emitted(24, 27) Source(34, 47) + SourceIndex(0) +8 >Emitted(24, 33) Source(34, 53) + SourceIndex(0) +9 >Emitted(24, 34) Source(34, 60) + SourceIndex(0) +10>Emitted(24, 35) Source(34, 61) + SourceIndex(0) +11>Emitted(24, 37) Source(34, 63) + SourceIndex(0) +12>Emitted(24, 38) Source(34, 64) + SourceIndex(0) +13>Emitted(24, 39) Source(34, 64) + SourceIndex(0) +14>Emitted(24, 40) Source(34, 65) + SourceIndex(0) +15>Emitted(24, 41) Source(34, 66) + SourceIndex(0) +16>Emitted(24, 42) Source(34, 67) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(29, 5) Source(34, 47) + SourceIndex(0) -2 >Emitted(29, 11) Source(34, 53) + SourceIndex(0) -3 >Emitted(29, 12) Source(34, 60) + SourceIndex(0) -4 >Emitted(29, 13) Source(34, 61) + SourceIndex(0) -5 >Emitted(29, 15) Source(34, 63) + SourceIndex(0) -6 >Emitted(29, 16) Source(34, 64) + SourceIndex(0) -7 >Emitted(29, 17) Source(34, 64) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(30, 1) Source(34, 65) + SourceIndex(0) -2 >Emitted(30, 2) Source(34, 66) + SourceIndex(0) -3 >Emitted(30, 3) Source(34, 67) + SourceIndex(0) ---- ->>>var c3t6 = function (n, s) { +>>>var c3t6 = function (n, s) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^ @@ -520,6 +507,16 @@ sourceFile:contextualTyping.ts 6 > ^ 7 > ^^ 8 > ^ +9 > ^^^^ +10> ^^^^^^ +11> ^ +12> ^ +13> ^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ 1-> > 2 >var @@ -529,58 +526,52 @@ sourceFile:contextualTyping.ts 6 > n 7 > , 8 > s -1->Emitted(31, 1) Source(35, 1) + SourceIndex(0) -2 >Emitted(31, 5) Source(35, 5) + SourceIndex(0) -3 >Emitted(31, 9) Source(35, 9) + SourceIndex(0) -4 >Emitted(31, 12) Source(35, 44) + SourceIndex(0) -5 >Emitted(31, 22) Source(35, 53) + SourceIndex(0) -6 >Emitted(31, 23) Source(35, 54) + SourceIndex(0) -7 >Emitted(31, 25) Source(35, 56) + SourceIndex(0) -8 >Emitted(31, 26) Source(35, 57) + SourceIndex(0) +9 > ) { +10> return +11> +12> ( +13> {} +14> ) +15> +16> +17> } +18> ; +1->Emitted(25, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(25, 5) Source(35, 5) + SourceIndex(0) +3 >Emitted(25, 9) Source(35, 9) + SourceIndex(0) +4 >Emitted(25, 12) Source(35, 44) + SourceIndex(0) +5 >Emitted(25, 22) Source(35, 53) + SourceIndex(0) +6 >Emitted(25, 23) Source(35, 54) + SourceIndex(0) +7 >Emitted(25, 25) Source(35, 56) + SourceIndex(0) +8 >Emitted(25, 26) Source(35, 57) + SourceIndex(0) +9 >Emitted(25, 30) Source(35, 61) + SourceIndex(0) +10>Emitted(25, 36) Source(35, 67) + SourceIndex(0) +11>Emitted(25, 37) Source(35, 74) + SourceIndex(0) +12>Emitted(25, 38) Source(35, 75) + SourceIndex(0) +13>Emitted(25, 40) Source(35, 77) + SourceIndex(0) +14>Emitted(25, 41) Source(35, 78) + SourceIndex(0) +15>Emitted(25, 42) Source(35, 78) + SourceIndex(0) +16>Emitted(25, 43) Source(35, 79) + SourceIndex(0) +17>Emitted(25, 44) Source(35, 80) + SourceIndex(0) +18>Emitted(25, 45) Source(35, 81) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(32, 5) Source(35, 61) + SourceIndex(0) -2 >Emitted(32, 11) Source(35, 67) + SourceIndex(0) -3 >Emitted(32, 12) Source(35, 74) + SourceIndex(0) -4 >Emitted(32, 13) Source(35, 75) + SourceIndex(0) -5 >Emitted(32, 15) Source(35, 77) + SourceIndex(0) -6 >Emitted(32, 16) Source(35, 78) + SourceIndex(0) -7 >Emitted(32, 17) Source(35, 78) + SourceIndex(0) ---- ->>>}; +>>>var c3t7 = function (n) { return n; }; 1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(33, 1) Source(35, 79) + SourceIndex(0) -2 >Emitted(33, 2) Source(35, 80) + SourceIndex(0) -3 >Emitted(33, 3) Source(35, 81) + SourceIndex(0) ---- ->>>var c3t7 = function (n) { -1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ -1-> +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^-> +1 > > 2 >var 3 > c3t7 @@ -590,49 +581,44 @@ sourceFile:contextualTyping.ts > } = 5 > function( 6 > n -1->Emitted(34, 1) Source(36, 1) + SourceIndex(0) -2 >Emitted(34, 5) Source(36, 5) + SourceIndex(0) -3 >Emitted(34, 9) Source(36, 9) + SourceIndex(0) -4 >Emitted(34, 12) Source(39, 5) + SourceIndex(0) -5 >Emitted(34, 22) Source(39, 14) + SourceIndex(0) -6 >Emitted(34, 23) Source(39, 15) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> n +11> ; +12> +13> } +14> ; +1 >Emitted(26, 1) Source(36, 1) + SourceIndex(0) +2 >Emitted(26, 5) Source(36, 5) + SourceIndex(0) +3 >Emitted(26, 9) Source(36, 9) + SourceIndex(0) +4 >Emitted(26, 12) Source(39, 5) + SourceIndex(0) +5 >Emitted(26, 22) Source(39, 14) + SourceIndex(0) +6 >Emitted(26, 23) Source(39, 15) + SourceIndex(0) +7 >Emitted(26, 27) Source(39, 19) + SourceIndex(0) +8 >Emitted(26, 33) Source(39, 25) + SourceIndex(0) +9 >Emitted(26, 34) Source(39, 26) + SourceIndex(0) +10>Emitted(26, 35) Source(39, 27) + SourceIndex(0) +11>Emitted(26, 36) Source(39, 28) + SourceIndex(0) +12>Emitted(26, 37) Source(39, 29) + SourceIndex(0) +13>Emitted(26, 38) Source(39, 30) + SourceIndex(0) +14>Emitted(26, 39) Source(39, 31) + SourceIndex(0) --- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > ; -1 >Emitted(35, 5) Source(39, 19) + SourceIndex(0) -2 >Emitted(35, 11) Source(39, 25) + SourceIndex(0) -3 >Emitted(35, 12) Source(39, 26) + SourceIndex(0) -4 >Emitted(35, 13) Source(39, 27) + SourceIndex(0) -5 >Emitted(35, 14) Source(39, 28) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(36, 1) Source(39, 29) + SourceIndex(0) -2 >Emitted(36, 2) Source(39, 30) + SourceIndex(0) -3 >Emitted(36, 3) Source(39, 31) + SourceIndex(0) ---- ->>>var c3t8 = function (n) { +>>>var c3t8 = function (n) { return n; }; 1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1-> > > @@ -641,44 +627,31 @@ sourceFile:contextualTyping.ts 4 > : (n: number, s: string) => number = 5 > function( 6 > n -1->Emitted(37, 1) Source(41, 1) + SourceIndex(0) -2 >Emitted(37, 5) Source(41, 5) + SourceIndex(0) -3 >Emitted(37, 9) Source(41, 9) + SourceIndex(0) -4 >Emitted(37, 12) Source(41, 46) + SourceIndex(0) -5 >Emitted(37, 22) Source(41, 55) + SourceIndex(0) -6 >Emitted(37, 23) Source(41, 56) + SourceIndex(0) ---- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > ; -1 >Emitted(38, 5) Source(41, 60) + SourceIndex(0) -2 >Emitted(38, 11) Source(41, 66) + SourceIndex(0) -3 >Emitted(38, 12) Source(41, 67) + SourceIndex(0) -4 >Emitted(38, 13) Source(41, 68) + SourceIndex(0) -5 >Emitted(38, 14) Source(41, 69) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(39, 1) Source(41, 70) + SourceIndex(0) -2 >Emitted(39, 2) Source(41, 71) + SourceIndex(0) -3 >Emitted(39, 3) Source(41, 72) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> n +11> ; +12> +13> } +14> ; +1->Emitted(27, 1) Source(41, 1) + SourceIndex(0) +2 >Emitted(27, 5) Source(41, 5) + SourceIndex(0) +3 >Emitted(27, 9) Source(41, 9) + SourceIndex(0) +4 >Emitted(27, 12) Source(41, 46) + SourceIndex(0) +5 >Emitted(27, 22) Source(41, 55) + SourceIndex(0) +6 >Emitted(27, 23) Source(41, 56) + SourceIndex(0) +7 >Emitted(27, 27) Source(41, 60) + SourceIndex(0) +8 >Emitted(27, 33) Source(41, 66) + SourceIndex(0) +9 >Emitted(27, 34) Source(41, 67) + SourceIndex(0) +10>Emitted(27, 35) Source(41, 68) + SourceIndex(0) +11>Emitted(27, 36) Source(41, 69) + SourceIndex(0) +12>Emitted(27, 37) Source(41, 70) + SourceIndex(0) +13>Emitted(27, 38) Source(41, 71) + SourceIndex(0) +14>Emitted(27, 39) Source(41, 72) + SourceIndex(0) --- >>>var c3t9 = [[], []]; -1-> +1 > 2 >^^^^ 3 > ^^^^ 4 > ^^^ @@ -689,7 +662,7 @@ sourceFile:contextualTyping.ts 9 > ^ 10> ^ 11> ^^^^^^-> -1-> +1 > > 2 >var 3 > c3t9 @@ -700,16 +673,16 @@ sourceFile:contextualTyping.ts 8 > [] 9 > ] 10> ; -1->Emitted(40, 1) Source(42, 1) + SourceIndex(0) -2 >Emitted(40, 5) Source(42, 5) + SourceIndex(0) -3 >Emitted(40, 9) Source(42, 9) + SourceIndex(0) -4 >Emitted(40, 12) Source(42, 24) + SourceIndex(0) -5 >Emitted(40, 13) Source(42, 25) + SourceIndex(0) -6 >Emitted(40, 15) Source(42, 27) + SourceIndex(0) -7 >Emitted(40, 17) Source(42, 28) + SourceIndex(0) -8 >Emitted(40, 19) Source(42, 30) + SourceIndex(0) -9 >Emitted(40, 20) Source(42, 31) + SourceIndex(0) -10>Emitted(40, 21) Source(42, 32) + SourceIndex(0) +1 >Emitted(28, 1) Source(42, 1) + SourceIndex(0) +2 >Emitted(28, 5) Source(42, 5) + SourceIndex(0) +3 >Emitted(28, 9) Source(42, 9) + SourceIndex(0) +4 >Emitted(28, 12) Source(42, 24) + SourceIndex(0) +5 >Emitted(28, 13) Source(42, 25) + SourceIndex(0) +6 >Emitted(28, 15) Source(42, 27) + SourceIndex(0) +7 >Emitted(28, 17) Source(42, 28) + SourceIndex(0) +8 >Emitted(28, 19) Source(42, 30) + SourceIndex(0) +9 >Emitted(28, 20) Source(42, 31) + SourceIndex(0) +10>Emitted(28, 21) Source(42, 32) + SourceIndex(0) --- >>>var c3t10 = [({}), ({})]; 1-> @@ -726,7 +699,7 @@ sourceFile:contextualTyping.ts 12> ^ 13> ^ 14> ^ -15> ^^^^^^-> +15> ^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -742,22 +715,22 @@ sourceFile:contextualTyping.ts 12> ) 13> ] 14> ; -1->Emitted(41, 1) Source(43, 1) + SourceIndex(0) -2 >Emitted(41, 5) Source(43, 5) + SourceIndex(0) -3 >Emitted(41, 10) Source(43, 10) + SourceIndex(0) -4 >Emitted(41, 13) Source(43, 21) + SourceIndex(0) -5 >Emitted(41, 14) Source(43, 28) + SourceIndex(0) -6 >Emitted(41, 15) Source(43, 29) + SourceIndex(0) -7 >Emitted(41, 17) Source(43, 31) + SourceIndex(0) -8 >Emitted(41, 18) Source(43, 32) + SourceIndex(0) -9 >Emitted(41, 20) Source(43, 39) + SourceIndex(0) -10>Emitted(41, 21) Source(43, 40) + SourceIndex(0) -11>Emitted(41, 23) Source(43, 42) + SourceIndex(0) -12>Emitted(41, 24) Source(43, 43) + SourceIndex(0) -13>Emitted(41, 25) Source(43, 44) + SourceIndex(0) -14>Emitted(41, 26) Source(43, 45) + SourceIndex(0) +1->Emitted(29, 1) Source(43, 1) + SourceIndex(0) +2 >Emitted(29, 5) Source(43, 5) + SourceIndex(0) +3 >Emitted(29, 10) Source(43, 10) + SourceIndex(0) +4 >Emitted(29, 13) Source(43, 21) + SourceIndex(0) +5 >Emitted(29, 14) Source(43, 28) + SourceIndex(0) +6 >Emitted(29, 15) Source(43, 29) + SourceIndex(0) +7 >Emitted(29, 17) Source(43, 31) + SourceIndex(0) +8 >Emitted(29, 18) Source(43, 32) + SourceIndex(0) +9 >Emitted(29, 20) Source(43, 39) + SourceIndex(0) +10>Emitted(29, 21) Source(43, 40) + SourceIndex(0) +11>Emitted(29, 23) Source(43, 42) + SourceIndex(0) +12>Emitted(29, 24) Source(43, 43) + SourceIndex(0) +13>Emitted(29, 25) Source(43, 44) + SourceIndex(0) +14>Emitted(29, 26) Source(43, 45) + SourceIndex(0) --- ->>>var c3t11 = [function (n, s) { +>>>var c3t11 = [function (n, s) { return s; }]; 1-> 2 >^^^^ 3 > ^^^^^ @@ -767,6 +740,15 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^ 9 > ^ +10> ^^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ 1-> > 2 >var @@ -777,63 +759,49 @@ sourceFile:contextualTyping.ts 7 > n 8 > , 9 > s -1->Emitted(42, 1) Source(44, 1) + SourceIndex(0) -2 >Emitted(42, 5) Source(44, 5) + SourceIndex(0) -3 >Emitted(42, 10) Source(44, 10) + SourceIndex(0) -4 >Emitted(42, 13) Source(44, 50) + SourceIndex(0) -5 >Emitted(42, 14) Source(44, 51) + SourceIndex(0) -6 >Emitted(42, 24) Source(44, 60) + SourceIndex(0) -7 >Emitted(42, 25) Source(44, 61) + SourceIndex(0) -8 >Emitted(42, 27) Source(44, 63) + SourceIndex(0) -9 >Emitted(42, 28) Source(44, 64) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(43, 5) Source(44, 68) + SourceIndex(0) -2 >Emitted(43, 11) Source(44, 74) + SourceIndex(0) -3 >Emitted(43, 12) Source(44, 75) + SourceIndex(0) -4 >Emitted(43, 13) Source(44, 76) + SourceIndex(0) -5 >Emitted(43, 14) Source(44, 77) + SourceIndex(0) ---- ->>>}]; -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^-> -1 > -2 >} -3 > ] -4 > ; -1 >Emitted(44, 1) Source(44, 78) + SourceIndex(0) -2 >Emitted(44, 2) Source(44, 79) + SourceIndex(0) -3 >Emitted(44, 3) Source(44, 80) + SourceIndex(0) -4 >Emitted(44, 4) Source(44, 81) + SourceIndex(0) +10> ) { +11> return +12> +13> s +14> ; +15> +16> } +17> ] +18> ; +1->Emitted(30, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(30, 5) Source(44, 5) + SourceIndex(0) +3 >Emitted(30, 10) Source(44, 10) + SourceIndex(0) +4 >Emitted(30, 13) Source(44, 50) + SourceIndex(0) +5 >Emitted(30, 14) Source(44, 51) + SourceIndex(0) +6 >Emitted(30, 24) Source(44, 60) + SourceIndex(0) +7 >Emitted(30, 25) Source(44, 61) + SourceIndex(0) +8 >Emitted(30, 27) Source(44, 63) + SourceIndex(0) +9 >Emitted(30, 28) Source(44, 64) + SourceIndex(0) +10>Emitted(30, 32) Source(44, 68) + SourceIndex(0) +11>Emitted(30, 38) Source(44, 74) + SourceIndex(0) +12>Emitted(30, 39) Source(44, 75) + SourceIndex(0) +13>Emitted(30, 40) Source(44, 76) + SourceIndex(0) +14>Emitted(30, 41) Source(44, 77) + SourceIndex(0) +15>Emitted(30, 42) Source(44, 78) + SourceIndex(0) +16>Emitted(30, 43) Source(44, 79) + SourceIndex(0) +17>Emitted(30, 44) Source(44, 80) + SourceIndex(0) +18>Emitted(30, 45) Source(44, 81) + SourceIndex(0) --- >>>var c3t12 = { -1-> +1 > 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^^-> -1-> +1 > > 2 >var 3 > c3t12 4 > : IBar = -1->Emitted(45, 1) Source(45, 1) + SourceIndex(0) -2 >Emitted(45, 5) Source(45, 5) + SourceIndex(0) -3 >Emitted(45, 10) Source(45, 10) + SourceIndex(0) -4 >Emitted(45, 13) Source(45, 19) + SourceIndex(0) +1 >Emitted(31, 1) Source(45, 1) + SourceIndex(0) +2 >Emitted(31, 5) Source(45, 5) + SourceIndex(0) +3 >Emitted(31, 10) Source(45, 10) + SourceIndex(0) +4 >Emitted(31, 13) Source(45, 19) + SourceIndex(0) --- >>> foo: ({}) 1->^^^^ @@ -849,12 +817,12 @@ sourceFile:contextualTyping.ts 4 > ( 5 > {} 6 > ) -1->Emitted(46, 5) Source(46, 5) + SourceIndex(0) -2 >Emitted(46, 8) Source(46, 8) + SourceIndex(0) -3 >Emitted(46, 10) Source(46, 16) + SourceIndex(0) -4 >Emitted(46, 11) Source(46, 17) + SourceIndex(0) -5 >Emitted(46, 13) Source(46, 19) + SourceIndex(0) -6 >Emitted(46, 14) Source(46, 20) + SourceIndex(0) +1->Emitted(32, 5) Source(46, 5) + SourceIndex(0) +2 >Emitted(32, 8) Source(46, 8) + SourceIndex(0) +3 >Emitted(32, 10) Source(46, 16) + SourceIndex(0) +4 >Emitted(32, 11) Source(46, 17) + SourceIndex(0) +5 >Emitted(32, 13) Source(46, 19) + SourceIndex(0) +6 >Emitted(32, 14) Source(46, 20) + SourceIndex(0) --- >>>}; 1 >^ @@ -863,8 +831,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > -1 >Emitted(47, 2) Source(47, 2) + SourceIndex(0) -2 >Emitted(47, 3) Source(47, 2) + SourceIndex(0) +1 >Emitted(33, 2) Source(47, 2) + SourceIndex(0) +2 >Emitted(33, 3) Source(47, 2) + SourceIndex(0) --- >>>var c3t13 = ({ 1-> @@ -872,20 +840,20 @@ sourceFile:contextualTyping.ts 3 > ^^^^^ 4 > ^^^ 5 > ^ -6 > ^^^^^^^^^^^^-> +6 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var 3 > c3t13 4 > = 5 > ( -1->Emitted(48, 1) Source(48, 1) + SourceIndex(0) -2 >Emitted(48, 5) Source(48, 5) + SourceIndex(0) -3 >Emitted(48, 10) Source(48, 10) + SourceIndex(0) -4 >Emitted(48, 13) Source(48, 19) + SourceIndex(0) -5 >Emitted(48, 14) Source(48, 20) + SourceIndex(0) +1->Emitted(34, 1) Source(48, 1) + SourceIndex(0) +2 >Emitted(34, 5) Source(48, 5) + SourceIndex(0) +3 >Emitted(34, 10) Source(48, 10) + SourceIndex(0) +4 >Emitted(34, 13) Source(48, 19) + SourceIndex(0) +5 >Emitted(34, 14) Source(48, 20) + SourceIndex(0) --- ->>> f: function (i, s) { +>>> f: function (i, s) { return s; } 1->^^^^ 2 > ^ 3 > ^^ @@ -893,6 +861,13 @@ sourceFile:contextualTyping.ts 5 > ^ 6 > ^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1->{ > 2 > f @@ -901,38 +876,27 @@ sourceFile:contextualTyping.ts 5 > i 6 > , 7 > s -1->Emitted(49, 5) Source(49, 5) + SourceIndex(0) -2 >Emitted(49, 6) Source(49, 6) + SourceIndex(0) -3 >Emitted(49, 8) Source(49, 8) + SourceIndex(0) -4 >Emitted(49, 18) Source(49, 17) + SourceIndex(0) -5 >Emitted(49, 19) Source(49, 18) + SourceIndex(0) -6 >Emitted(49, 21) Source(49, 20) + SourceIndex(0) -7 >Emitted(49, 22) Source(49, 21) + SourceIndex(0) ---- ->>> return s; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(50, 9) Source(49, 25) + SourceIndex(0) -2 >Emitted(50, 15) Source(49, 31) + SourceIndex(0) -3 >Emitted(50, 16) Source(49, 32) + SourceIndex(0) -4 >Emitted(50, 17) Source(49, 33) + SourceIndex(0) -5 >Emitted(50, 18) Source(49, 34) + SourceIndex(0) ---- ->>> } -1 >^^^^ -2 > ^ -1 > -2 > } -1 >Emitted(51, 5) Source(49, 35) + SourceIndex(0) -2 >Emitted(51, 6) Source(49, 36) + SourceIndex(0) +8 > ) { +9 > return +10> +11> s +12> ; +13> +14> } +1->Emitted(35, 5) Source(49, 5) + SourceIndex(0) +2 >Emitted(35, 6) Source(49, 6) + SourceIndex(0) +3 >Emitted(35, 8) Source(49, 8) + SourceIndex(0) +4 >Emitted(35, 18) Source(49, 17) + SourceIndex(0) +5 >Emitted(35, 19) Source(49, 18) + SourceIndex(0) +6 >Emitted(35, 21) Source(49, 20) + SourceIndex(0) +7 >Emitted(35, 22) Source(49, 21) + SourceIndex(0) +8 >Emitted(35, 26) Source(49, 25) + SourceIndex(0) +9 >Emitted(35, 32) Source(49, 31) + SourceIndex(0) +10>Emitted(35, 33) Source(49, 32) + SourceIndex(0) +11>Emitted(35, 34) Source(49, 33) + SourceIndex(0) +12>Emitted(35, 35) Source(49, 34) + SourceIndex(0) +13>Emitted(35, 36) Source(49, 35) + SourceIndex(0) +14>Emitted(35, 37) Source(49, 36) + SourceIndex(0) --- >>>}); 1 >^ @@ -943,9 +907,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(52, 2) Source(50, 2) + SourceIndex(0) -2 >Emitted(52, 3) Source(50, 3) + SourceIndex(0) -3 >Emitted(52, 4) Source(50, 3) + SourceIndex(0) +1 >Emitted(36, 2) Source(50, 2) + SourceIndex(0) +2 >Emitted(36, 3) Source(50, 3) + SourceIndex(0) +3 >Emitted(36, 4) Source(50, 3) + SourceIndex(0) --- >>>var c3t14 = ({ 1-> @@ -959,11 +923,11 @@ sourceFile:contextualTyping.ts 3 > c3t14 4 > = 5 > ( -1->Emitted(53, 1) Source(51, 1) + SourceIndex(0) -2 >Emitted(53, 5) Source(51, 5) + SourceIndex(0) -3 >Emitted(53, 10) Source(51, 10) + SourceIndex(0) -4 >Emitted(53, 13) Source(51, 19) + SourceIndex(0) -5 >Emitted(53, 14) Source(51, 20) + SourceIndex(0) +1->Emitted(37, 1) Source(51, 1) + SourceIndex(0) +2 >Emitted(37, 5) Source(51, 5) + SourceIndex(0) +3 >Emitted(37, 10) Source(51, 10) + SourceIndex(0) +4 >Emitted(37, 13) Source(51, 19) + SourceIndex(0) +5 >Emitted(37, 14) Source(51, 20) + SourceIndex(0) --- >>> a: [] 1 >^^^^ @@ -975,10 +939,10 @@ sourceFile:contextualTyping.ts 2 > a 3 > : 4 > [] -1 >Emitted(54, 5) Source(52, 5) + SourceIndex(0) -2 >Emitted(54, 6) Source(52, 6) + SourceIndex(0) -3 >Emitted(54, 8) Source(52, 8) + SourceIndex(0) -4 >Emitted(54, 10) Source(52, 10) + SourceIndex(0) +1 >Emitted(38, 5) Source(52, 5) + SourceIndex(0) +2 >Emitted(38, 6) Source(52, 6) + SourceIndex(0) +3 >Emitted(38, 8) Source(52, 8) + SourceIndex(0) +4 >Emitted(38, 10) Source(52, 10) + SourceIndex(0) --- >>>}); 1 >^ @@ -989,9 +953,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(55, 2) Source(53, 2) + SourceIndex(0) -2 >Emitted(55, 3) Source(53, 3) + SourceIndex(0) -3 >Emitted(55, 4) Source(53, 3) + SourceIndex(0) +1 >Emitted(39, 2) Source(53, 2) + SourceIndex(0) +2 >Emitted(39, 3) Source(53, 3) + SourceIndex(0) +3 >Emitted(39, 4) Source(53, 3) + SourceIndex(0) --- >>>// CONTEXT: Class property assignment 1-> @@ -1003,9 +967,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Class property assignment -1->Emitted(56, 1) Source(56, 1) + SourceIndex(0) -2 >Emitted(56, 1) Source(55, 1) + SourceIndex(0) -3 >Emitted(56, 38) Source(55, 38) + SourceIndex(0) +1->Emitted(40, 1) Source(56, 1) + SourceIndex(0) +2 >Emitted(40, 1) Source(55, 1) + SourceIndex(0) +3 >Emitted(40, 38) Source(55, 38) + SourceIndex(0) --- >>>var C4T5 = (function () { 1 >^^^^ @@ -1014,8 +978,8 @@ sourceFile:contextualTyping.ts 1 > >class 2 > C4T5 -1 >Emitted(57, 5) Source(56, 7) + SourceIndex(0) -2 >Emitted(57, 9) Source(56, 11) + SourceIndex(0) +1 >Emitted(41, 5) Source(56, 7) + SourceIndex(0) +2 >Emitted(41, 9) Source(56, 11) + SourceIndex(0) --- >>> function C4T5() { 1->^^^^ @@ -1027,9 +991,9 @@ sourceFile:contextualTyping.ts > 2 > 3 > C4T5 -1->Emitted(58, 5) Source(58, 5) + SourceIndex(0) name (C4T5) -2 >Emitted(58, 14) Source(56, 7) + SourceIndex(0) name (C4T5) -3 >Emitted(58, 18) Source(56, 11) + SourceIndex(0) name (C4T5) +1->Emitted(42, 5) Source(58, 5) + SourceIndex(0) name (C4T5) +2 >Emitted(42, 14) Source(56, 7) + SourceIndex(0) name (C4T5) +3 >Emitted(42, 18) Source(56, 11) + SourceIndex(0) name (C4T5) --- >>> this.foo = function (i, s) { 1->^^^^^^^^ @@ -1053,15 +1017,15 @@ sourceFile:contextualTyping.ts 7 > i 8 > , 9 > s -1->Emitted(59, 9) Source(59, 9) + SourceIndex(0) name (C4T5.constructor) -2 >Emitted(59, 13) Source(59, 13) + SourceIndex(0) name (C4T5.constructor) -3 >Emitted(59, 14) Source(59, 14) + SourceIndex(0) name (C4T5.constructor) -4 >Emitted(59, 17) Source(59, 17) + SourceIndex(0) name (C4T5.constructor) -5 >Emitted(59, 20) Source(59, 20) + SourceIndex(0) name (C4T5.constructor) -6 >Emitted(59, 30) Source(59, 29) + SourceIndex(0) name (C4T5.constructor) -7 >Emitted(59, 31) Source(59, 30) + SourceIndex(0) name (C4T5.constructor) -8 >Emitted(59, 33) Source(59, 32) + SourceIndex(0) name (C4T5.constructor) -9 >Emitted(59, 34) Source(59, 33) + SourceIndex(0) name (C4T5.constructor) +1->Emitted(43, 9) Source(59, 9) + SourceIndex(0) name (C4T5.constructor) +2 >Emitted(43, 13) Source(59, 13) + SourceIndex(0) name (C4T5.constructor) +3 >Emitted(43, 14) Source(59, 14) + SourceIndex(0) name (C4T5.constructor) +4 >Emitted(43, 17) Source(59, 17) + SourceIndex(0) name (C4T5.constructor) +5 >Emitted(43, 20) Source(59, 20) + SourceIndex(0) name (C4T5.constructor) +6 >Emitted(43, 30) Source(59, 29) + SourceIndex(0) name (C4T5.constructor) +7 >Emitted(43, 31) Source(59, 30) + SourceIndex(0) name (C4T5.constructor) +8 >Emitted(43, 33) Source(59, 32) + SourceIndex(0) name (C4T5.constructor) +9 >Emitted(43, 34) Source(59, 33) + SourceIndex(0) name (C4T5.constructor) --- >>> return s; 1 >^^^^^^^^^^^^ @@ -1075,11 +1039,11 @@ sourceFile:contextualTyping.ts 3 > 4 > s 5 > ; -1 >Emitted(60, 13) Source(60, 13) + SourceIndex(0) -2 >Emitted(60, 19) Source(60, 19) + SourceIndex(0) -3 >Emitted(60, 20) Source(60, 20) + SourceIndex(0) -4 >Emitted(60, 21) Source(60, 21) + SourceIndex(0) -5 >Emitted(60, 22) Source(60, 22) + SourceIndex(0) +1 >Emitted(44, 13) Source(60, 13) + SourceIndex(0) +2 >Emitted(44, 19) Source(60, 19) + SourceIndex(0) +3 >Emitted(44, 20) Source(60, 20) + SourceIndex(0) +4 >Emitted(44, 21) Source(60, 21) + SourceIndex(0) +5 >Emitted(44, 22) Source(60, 22) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^ @@ -1089,9 +1053,9 @@ sourceFile:contextualTyping.ts > 2 > } 3 > -1 >Emitted(61, 9) Source(61, 9) + SourceIndex(0) -2 >Emitted(61, 10) Source(61, 10) + SourceIndex(0) -3 >Emitted(61, 11) Source(61, 10) + SourceIndex(0) name (C4T5.constructor) +1 >Emitted(45, 9) Source(61, 9) + SourceIndex(0) +2 >Emitted(45, 10) Source(61, 10) + SourceIndex(0) +3 >Emitted(45, 11) Source(61, 10) + SourceIndex(0) name (C4T5.constructor) --- >>> } 1 >^^^^ @@ -1100,8 +1064,8 @@ sourceFile:contextualTyping.ts 1 > > 2 > } -1 >Emitted(62, 5) Source(62, 5) + SourceIndex(0) name (C4T5.constructor) -2 >Emitted(62, 6) Source(62, 6) + SourceIndex(0) name (C4T5.constructor) +1 >Emitted(46, 5) Source(62, 5) + SourceIndex(0) name (C4T5.constructor) +2 >Emitted(46, 6) Source(62, 6) + SourceIndex(0) name (C4T5.constructor) --- >>> return C4T5; 1->^^^^ @@ -1109,8 +1073,8 @@ sourceFile:contextualTyping.ts 1-> > 2 > } -1->Emitted(63, 5) Source(63, 1) + SourceIndex(0) name (C4T5) -2 >Emitted(63, 16) Source(63, 2) + SourceIndex(0) name (C4T5) +1->Emitted(47, 5) Source(63, 1) + SourceIndex(0) name (C4T5) +2 >Emitted(47, 16) Source(63, 2) + SourceIndex(0) name (C4T5) --- >>>})(); 1 > @@ -1129,10 +1093,10 @@ sourceFile:contextualTyping.ts > } > } > } -1 >Emitted(64, 1) Source(63, 1) + SourceIndex(0) name (C4T5) -2 >Emitted(64, 2) Source(63, 2) + SourceIndex(0) name (C4T5) -3 >Emitted(64, 2) Source(56, 1) + SourceIndex(0) -4 >Emitted(64, 6) Source(63, 2) + SourceIndex(0) +1 >Emitted(48, 1) Source(63, 1) + SourceIndex(0) name (C4T5) +2 >Emitted(48, 2) Source(63, 2) + SourceIndex(0) name (C4T5) +3 >Emitted(48, 2) Source(56, 1) + SourceIndex(0) +4 >Emitted(48, 6) Source(63, 2) + SourceIndex(0) --- >>>// CONTEXT: Module property assignment 1-> @@ -1144,9 +1108,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Module property assignment -1->Emitted(65, 1) Source(66, 1) + SourceIndex(0) -2 >Emitted(65, 1) Source(65, 1) + SourceIndex(0) -3 >Emitted(65, 39) Source(65, 39) + SourceIndex(0) +1->Emitted(49, 1) Source(66, 1) + SourceIndex(0) +2 >Emitted(49, 1) Source(65, 1) + SourceIndex(0) +3 >Emitted(49, 39) Source(65, 39) + SourceIndex(0) --- >>>var C5T5; 1 > @@ -1164,10 +1128,10 @@ sourceFile:contextualTyping.ts > return s; > } > } -1 >Emitted(66, 1) Source(66, 1) + SourceIndex(0) -2 >Emitted(66, 5) Source(66, 8) + SourceIndex(0) -3 >Emitted(66, 9) Source(66, 12) + SourceIndex(0) -4 >Emitted(66, 10) Source(71, 2) + SourceIndex(0) +1 >Emitted(50, 1) Source(66, 1) + SourceIndex(0) +2 >Emitted(50, 5) Source(66, 8) + SourceIndex(0) +3 >Emitted(50, 9) Source(66, 12) + SourceIndex(0) +4 >Emitted(50, 10) Source(71, 2) + SourceIndex(0) --- >>>(function (C5T5) { 1-> @@ -1180,11 +1144,11 @@ sourceFile:contextualTyping.ts 3 > C5T5 4 > 5 > { -1->Emitted(67, 1) Source(66, 1) + SourceIndex(0) -2 >Emitted(67, 12) Source(66, 8) + SourceIndex(0) -3 >Emitted(67, 16) Source(66, 12) + SourceIndex(0) -4 >Emitted(67, 18) Source(66, 13) + SourceIndex(0) -5 >Emitted(67, 19) Source(66, 14) + SourceIndex(0) +1->Emitted(51, 1) Source(66, 1) + SourceIndex(0) +2 >Emitted(51, 12) Source(66, 8) + SourceIndex(0) +3 >Emitted(51, 16) Source(66, 12) + SourceIndex(0) +4 >Emitted(51, 18) Source(66, 13) + SourceIndex(0) +5 >Emitted(51, 19) Source(66, 14) + SourceIndex(0) --- >>> C5T5.foo; 1 >^^^^ @@ -1195,9 +1159,9 @@ sourceFile:contextualTyping.ts > export var 2 > foo: (i: number, s: string) => string 3 > ; -1 >Emitted(68, 5) Source(67, 16) + SourceIndex(0) name (C5T5) -2 >Emitted(68, 13) Source(67, 53) + SourceIndex(0) name (C5T5) -3 >Emitted(68, 14) Source(67, 54) + SourceIndex(0) name (C5T5) +1 >Emitted(52, 5) Source(67, 16) + SourceIndex(0) name (C5T5) +2 >Emitted(52, 13) Source(67, 53) + SourceIndex(0) name (C5T5) +3 >Emitted(52, 14) Source(67, 54) + SourceIndex(0) name (C5T5) --- >>> C5T5.foo = function (i, s) { 1->^^^^ @@ -1215,13 +1179,13 @@ sourceFile:contextualTyping.ts 5 > i 6 > , 7 > s -1->Emitted(69, 5) Source(68, 5) + SourceIndex(0) name (C5T5) -2 >Emitted(69, 13) Source(68, 8) + SourceIndex(0) name (C5T5) -3 >Emitted(69, 16) Source(68, 11) + SourceIndex(0) name (C5T5) -4 >Emitted(69, 26) Source(68, 20) + SourceIndex(0) name (C5T5) -5 >Emitted(69, 27) Source(68, 21) + SourceIndex(0) name (C5T5) -6 >Emitted(69, 29) Source(68, 23) + SourceIndex(0) name (C5T5) -7 >Emitted(69, 30) Source(68, 24) + SourceIndex(0) name (C5T5) +1->Emitted(53, 5) Source(68, 5) + SourceIndex(0) name (C5T5) +2 >Emitted(53, 13) Source(68, 8) + SourceIndex(0) name (C5T5) +3 >Emitted(53, 16) Source(68, 11) + SourceIndex(0) name (C5T5) +4 >Emitted(53, 26) Source(68, 20) + SourceIndex(0) name (C5T5) +5 >Emitted(53, 27) Source(68, 21) + SourceIndex(0) name (C5T5) +6 >Emitted(53, 29) Source(68, 23) + SourceIndex(0) name (C5T5) +7 >Emitted(53, 30) Source(68, 24) + SourceIndex(0) name (C5T5) --- >>> return s; 1 >^^^^^^^^ @@ -1235,11 +1199,11 @@ sourceFile:contextualTyping.ts 3 > 4 > s 5 > ; -1 >Emitted(70, 9) Source(69, 9) + SourceIndex(0) -2 >Emitted(70, 15) Source(69, 15) + SourceIndex(0) -3 >Emitted(70, 16) Source(69, 16) + SourceIndex(0) -4 >Emitted(70, 17) Source(69, 17) + SourceIndex(0) -5 >Emitted(70, 18) Source(69, 18) + SourceIndex(0) +1 >Emitted(54, 9) Source(69, 9) + SourceIndex(0) +2 >Emitted(54, 15) Source(69, 15) + SourceIndex(0) +3 >Emitted(54, 16) Source(69, 16) + SourceIndex(0) +4 >Emitted(54, 17) Source(69, 17) + SourceIndex(0) +5 >Emitted(54, 18) Source(69, 18) + SourceIndex(0) --- >>> }; 1 >^^^^ @@ -1250,9 +1214,9 @@ sourceFile:contextualTyping.ts > 2 > } 3 > -1 >Emitted(71, 5) Source(70, 5) + SourceIndex(0) -2 >Emitted(71, 6) Source(70, 6) + SourceIndex(0) -3 >Emitted(71, 7) Source(70, 6) + SourceIndex(0) name (C5T5) +1 >Emitted(55, 5) Source(70, 5) + SourceIndex(0) +2 >Emitted(55, 6) Source(70, 6) + SourceIndex(0) +3 >Emitted(55, 7) Source(70, 6) + SourceIndex(0) name (C5T5) --- >>>})(C5T5 || (C5T5 = {})); 1-> @@ -1276,13 +1240,13 @@ sourceFile:contextualTyping.ts > return s; > } > } -1->Emitted(72, 1) Source(71, 1) + SourceIndex(0) name (C5T5) -2 >Emitted(72, 2) Source(71, 2) + SourceIndex(0) name (C5T5) -3 >Emitted(72, 4) Source(66, 8) + SourceIndex(0) -4 >Emitted(72, 8) Source(66, 12) + SourceIndex(0) -5 >Emitted(72, 13) Source(66, 8) + SourceIndex(0) -6 >Emitted(72, 17) Source(66, 12) + SourceIndex(0) -7 >Emitted(72, 25) Source(71, 2) + SourceIndex(0) +1->Emitted(56, 1) Source(71, 1) + SourceIndex(0) name (C5T5) +2 >Emitted(56, 2) Source(71, 2) + SourceIndex(0) name (C5T5) +3 >Emitted(56, 4) Source(66, 8) + SourceIndex(0) +4 >Emitted(56, 8) Source(66, 12) + SourceIndex(0) +5 >Emitted(56, 13) Source(66, 8) + SourceIndex(0) +6 >Emitted(56, 17) Source(66, 12) + SourceIndex(0) +7 >Emitted(56, 25) Source(71, 2) + SourceIndex(0) --- >>>// CONTEXT: Variable assignment 1-> @@ -1294,89 +1258,84 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Variable assignment -1->Emitted(73, 1) Source(74, 1) + SourceIndex(0) -2 >Emitted(73, 1) Source(73, 1) + SourceIndex(0) -3 >Emitted(73, 32) Source(73, 32) + SourceIndex(0) +1->Emitted(57, 1) Source(74, 1) + SourceIndex(0) +2 >Emitted(57, 1) Source(73, 1) + SourceIndex(0) +3 >Emitted(57, 32) Source(73, 32) + SourceIndex(0) --- >>>var c6t5; 1 >^^^^ 2 > ^^^^ 3 > ^ -4 > ^^^^^^^^^^^^^-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >var 2 > c6t5: (n: number) => IFoo 3 > ; -1 >Emitted(74, 5) Source(74, 5) + SourceIndex(0) -2 >Emitted(74, 9) Source(74, 30) + SourceIndex(0) -3 >Emitted(74, 10) Source(74, 31) + SourceIndex(0) +1 >Emitted(58, 5) Source(74, 5) + SourceIndex(0) +2 >Emitted(58, 9) Source(74, 30) + SourceIndex(0) +3 >Emitted(58, 10) Source(74, 31) + SourceIndex(0) --- ->>>c6t5 = function (n) { +>>>c6t5 = function (n) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^ 4 > ^^^^^^^^^^ 5 > ^ +6 > ^^^^ +7 > ^^^^^^ +8 > ^ +9 > ^ +10> ^^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ 1-> > 2 >c6t5 3 > = <(n: number) => IFoo> 4 > function( 5 > n -1->Emitted(75, 1) Source(75, 1) + SourceIndex(0) -2 >Emitted(75, 5) Source(75, 5) + SourceIndex(0) -3 >Emitted(75, 8) Source(75, 29) + SourceIndex(0) -4 >Emitted(75, 18) Source(75, 38) + SourceIndex(0) -5 >Emitted(75, 19) Source(75, 39) + SourceIndex(0) ---- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(76, 5) Source(75, 43) + SourceIndex(0) -2 >Emitted(76, 11) Source(75, 49) + SourceIndex(0) -3 >Emitted(76, 12) Source(75, 56) + SourceIndex(0) -4 >Emitted(76, 13) Source(75, 57) + SourceIndex(0) -5 >Emitted(76, 15) Source(75, 59) + SourceIndex(0) -6 >Emitted(76, 16) Source(75, 60) + SourceIndex(0) -7 >Emitted(76, 17) Source(75, 60) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(77, 1) Source(75, 61) + SourceIndex(0) -2 >Emitted(77, 2) Source(75, 62) + SourceIndex(0) -3 >Emitted(77, 3) Source(75, 63) + SourceIndex(0) +6 > ) { +7 > return +8 > +9 > ( +10> {} +11> ) +12> +13> +14> } +15> ; +1->Emitted(59, 1) Source(75, 1) + SourceIndex(0) +2 >Emitted(59, 5) Source(75, 5) + SourceIndex(0) +3 >Emitted(59, 8) Source(75, 29) + SourceIndex(0) +4 >Emitted(59, 18) Source(75, 38) + SourceIndex(0) +5 >Emitted(59, 19) Source(75, 39) + SourceIndex(0) +6 >Emitted(59, 23) Source(75, 43) + SourceIndex(0) +7 >Emitted(59, 29) Source(75, 49) + SourceIndex(0) +8 >Emitted(59, 30) Source(75, 56) + SourceIndex(0) +9 >Emitted(59, 31) Source(75, 57) + SourceIndex(0) +10>Emitted(59, 33) Source(75, 59) + SourceIndex(0) +11>Emitted(59, 34) Source(75, 60) + SourceIndex(0) +12>Emitted(59, 35) Source(75, 60) + SourceIndex(0) +13>Emitted(59, 36) Source(75, 61) + SourceIndex(0) +14>Emitted(59, 37) Source(75, 62) + SourceIndex(0) +15>Emitted(59, 38) Source(75, 63) + SourceIndex(0) --- >>>// CONTEXT: Array index assignment -1-> +1 > 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1-> +1 > > >// CONTEXT: Array index assignment > 2 > 3 >// CONTEXT: Array index assignment -1->Emitted(78, 1) Source(78, 1) + SourceIndex(0) -2 >Emitted(78, 1) Source(77, 1) + SourceIndex(0) -3 >Emitted(78, 35) Source(77, 35) + SourceIndex(0) +1 >Emitted(60, 1) Source(78, 1) + SourceIndex(0) +2 >Emitted(60, 1) Source(77, 1) + SourceIndex(0) +3 >Emitted(60, 35) Source(77, 35) + SourceIndex(0) --- >>>var c7t2; 1 >^^^^ @@ -1387,9 +1346,9 @@ sourceFile:contextualTyping.ts >var 2 > c7t2: IFoo[] 3 > ; -1 >Emitted(79, 5) Source(78, 5) + SourceIndex(0) -2 >Emitted(79, 9) Source(78, 17) + SourceIndex(0) -3 >Emitted(79, 10) Source(78, 18) + SourceIndex(0) +1 >Emitted(61, 5) Source(78, 5) + SourceIndex(0) +2 >Emitted(61, 9) Source(78, 17) + SourceIndex(0) +3 >Emitted(61, 10) Source(78, 18) + SourceIndex(0) --- >>>c7t2[0] = ({ n: 1 }); 1-> @@ -1421,20 +1380,20 @@ sourceFile:contextualTyping.ts 12> } 13> ) 14> ; -1->Emitted(80, 1) Source(79, 1) + SourceIndex(0) -2 >Emitted(80, 5) Source(79, 5) + SourceIndex(0) -3 >Emitted(80, 6) Source(79, 6) + SourceIndex(0) -4 >Emitted(80, 7) Source(79, 7) + SourceIndex(0) -5 >Emitted(80, 8) Source(79, 8) + SourceIndex(0) -6 >Emitted(80, 11) Source(79, 17) + SourceIndex(0) -7 >Emitted(80, 12) Source(79, 18) + SourceIndex(0) -8 >Emitted(80, 14) Source(79, 19) + SourceIndex(0) -9 >Emitted(80, 15) Source(79, 20) + SourceIndex(0) -10>Emitted(80, 17) Source(79, 22) + SourceIndex(0) -11>Emitted(80, 18) Source(79, 23) + SourceIndex(0) -12>Emitted(80, 20) Source(79, 24) + SourceIndex(0) -13>Emitted(80, 21) Source(79, 25) + SourceIndex(0) -14>Emitted(80, 22) Source(79, 26) + SourceIndex(0) +1->Emitted(62, 1) Source(79, 1) + SourceIndex(0) +2 >Emitted(62, 5) Source(79, 5) + SourceIndex(0) +3 >Emitted(62, 6) Source(79, 6) + SourceIndex(0) +4 >Emitted(62, 7) Source(79, 7) + SourceIndex(0) +5 >Emitted(62, 8) Source(79, 8) + SourceIndex(0) +6 >Emitted(62, 11) Source(79, 17) + SourceIndex(0) +7 >Emitted(62, 12) Source(79, 18) + SourceIndex(0) +8 >Emitted(62, 14) Source(79, 19) + SourceIndex(0) +9 >Emitted(62, 15) Source(79, 20) + SourceIndex(0) +10>Emitted(62, 17) Source(79, 22) + SourceIndex(0) +11>Emitted(62, 18) Source(79, 23) + SourceIndex(0) +12>Emitted(62, 20) Source(79, 24) + SourceIndex(0) +13>Emitted(62, 21) Source(79, 25) + SourceIndex(0) +14>Emitted(62, 22) Source(79, 26) + SourceIndex(0) --- >>>var objc8 = ({}); 1 > @@ -1445,7 +1404,7 @@ sourceFile:contextualTyping.ts 6 > ^^ 7 > ^ 8 > ^ -9 > ^^^^^^^^^^-> +9 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > >// CONTEXT: Object property assignment @@ -1495,16 +1454,16 @@ sourceFile:contextualTyping.ts 6 > {} 7 > ) 8 > ; -1 >Emitted(81, 1) Source(102, 1) + SourceIndex(0) -2 >Emitted(81, 5) Source(102, 5) + SourceIndex(0) -3 >Emitted(81, 10) Source(102, 10) + SourceIndex(0) -4 >Emitted(81, 13) Source(120, 19) + SourceIndex(0) -5 >Emitted(81, 14) Source(120, 20) + SourceIndex(0) -6 >Emitted(81, 16) Source(120, 22) + SourceIndex(0) -7 >Emitted(81, 17) Source(120, 23) + SourceIndex(0) -8 >Emitted(81, 18) Source(120, 24) + SourceIndex(0) +1 >Emitted(63, 1) Source(102, 1) + SourceIndex(0) +2 >Emitted(63, 5) Source(102, 5) + SourceIndex(0) +3 >Emitted(63, 10) Source(102, 10) + SourceIndex(0) +4 >Emitted(63, 13) Source(120, 19) + SourceIndex(0) +5 >Emitted(63, 14) Source(120, 20) + SourceIndex(0) +6 >Emitted(63, 16) Source(120, 22) + SourceIndex(0) +7 >Emitted(63, 17) Source(120, 23) + SourceIndex(0) +8 >Emitted(63, 18) Source(120, 24) + SourceIndex(0) --- ->>>objc8.t1 = (function (s) { +>>>objc8.t1 = (function (s) { return s; }); 1-> 2 >^^^^^ 3 > ^ @@ -1513,6 +1472,15 @@ sourceFile:contextualTyping.ts 6 > ^ 7 > ^^^^^^^^^^ 8 > ^ +9 > ^^^^ +10> ^^^^^^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ 1-> > > @@ -1523,67 +1491,53 @@ sourceFile:contextualTyping.ts 6 > ( 7 > function( 8 > s -1->Emitted(82, 1) Source(122, 1) + SourceIndex(0) -2 >Emitted(82, 6) Source(122, 6) + SourceIndex(0) -3 >Emitted(82, 7) Source(122, 7) + SourceIndex(0) -4 >Emitted(82, 9) Source(122, 9) + SourceIndex(0) -5 >Emitted(82, 12) Source(122, 12) + SourceIndex(0) -6 >Emitted(82, 13) Source(122, 13) + SourceIndex(0) -7 >Emitted(82, 23) Source(122, 22) + SourceIndex(0) -8 >Emitted(82, 24) Source(122, 23) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > -1 >Emitted(83, 5) Source(122, 27) + SourceIndex(0) -2 >Emitted(83, 11) Source(122, 33) + SourceIndex(0) -3 >Emitted(83, 12) Source(122, 34) + SourceIndex(0) -4 >Emitted(83, 13) Source(122, 35) + SourceIndex(0) -5 >Emitted(83, 14) Source(122, 35) + SourceIndex(0) ---- ->>>}); -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^-> -1 > -2 >} -3 > ) -4 > ; -1 >Emitted(84, 1) Source(122, 36) + SourceIndex(0) -2 >Emitted(84, 2) Source(122, 37) + SourceIndex(0) -3 >Emitted(84, 3) Source(122, 38) + SourceIndex(0) -4 >Emitted(84, 4) Source(122, 39) + SourceIndex(0) +9 > ) { +10> return +11> +12> s +13> +14> +15> } +16> ) +17> ; +1->Emitted(64, 1) Source(122, 1) + SourceIndex(0) +2 >Emitted(64, 6) Source(122, 6) + SourceIndex(0) +3 >Emitted(64, 7) Source(122, 7) + SourceIndex(0) +4 >Emitted(64, 9) Source(122, 9) + SourceIndex(0) +5 >Emitted(64, 12) Source(122, 12) + SourceIndex(0) +6 >Emitted(64, 13) Source(122, 13) + SourceIndex(0) +7 >Emitted(64, 23) Source(122, 22) + SourceIndex(0) +8 >Emitted(64, 24) Source(122, 23) + SourceIndex(0) +9 >Emitted(64, 28) Source(122, 27) + SourceIndex(0) +10>Emitted(64, 34) Source(122, 33) + SourceIndex(0) +11>Emitted(64, 35) Source(122, 34) + SourceIndex(0) +12>Emitted(64, 36) Source(122, 35) + SourceIndex(0) +13>Emitted(64, 37) Source(122, 35) + SourceIndex(0) +14>Emitted(64, 38) Source(122, 36) + SourceIndex(0) +15>Emitted(64, 39) Source(122, 37) + SourceIndex(0) +16>Emitted(64, 40) Source(122, 38) + SourceIndex(0) +17>Emitted(64, 41) Source(122, 39) + SourceIndex(0) --- >>>objc8.t2 = ({ -1-> +1 > 2 >^^^^^ 3 > ^ 4 > ^^ 5 > ^^^ 6 > ^ -1-> +1 > > 2 >objc8 3 > . 4 > t2 5 > = 6 > ( -1->Emitted(85, 1) Source(123, 1) + SourceIndex(0) -2 >Emitted(85, 6) Source(123, 6) + SourceIndex(0) -3 >Emitted(85, 7) Source(123, 7) + SourceIndex(0) -4 >Emitted(85, 9) Source(123, 9) + SourceIndex(0) -5 >Emitted(85, 12) Source(123, 18) + SourceIndex(0) -6 >Emitted(85, 13) Source(123, 19) + SourceIndex(0) +1 >Emitted(65, 1) Source(123, 1) + SourceIndex(0) +2 >Emitted(65, 6) Source(123, 6) + SourceIndex(0) +3 >Emitted(65, 7) Source(123, 7) + SourceIndex(0) +4 >Emitted(65, 9) Source(123, 9) + SourceIndex(0) +5 >Emitted(65, 12) Source(123, 18) + SourceIndex(0) +6 >Emitted(65, 13) Source(123, 19) + SourceIndex(0) --- >>> n: 1 1 >^^^^ @@ -1595,10 +1549,10 @@ sourceFile:contextualTyping.ts 2 > n 3 > : 4 > 1 -1 >Emitted(86, 5) Source(124, 5) + SourceIndex(0) -2 >Emitted(86, 6) Source(124, 6) + SourceIndex(0) -3 >Emitted(86, 8) Source(124, 8) + SourceIndex(0) -4 >Emitted(86, 9) Source(124, 9) + SourceIndex(0) +1 >Emitted(66, 5) Source(124, 5) + SourceIndex(0) +2 >Emitted(66, 6) Source(124, 6) + SourceIndex(0) +3 >Emitted(66, 8) Source(124, 8) + SourceIndex(0) +4 >Emitted(66, 9) Source(124, 9) + SourceIndex(0) --- >>>}); 1 >^ @@ -1609,9 +1563,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > ; -1 >Emitted(87, 2) Source(125, 2) + SourceIndex(0) -2 >Emitted(87, 3) Source(125, 3) + SourceIndex(0) -3 >Emitted(87, 4) Source(125, 4) + SourceIndex(0) +1 >Emitted(67, 2) Source(125, 2) + SourceIndex(0) +2 >Emitted(67, 3) Source(125, 3) + SourceIndex(0) +3 >Emitted(67, 4) Source(125, 4) + SourceIndex(0) --- >>>objc8.t3 = []; 1-> @@ -1621,7 +1575,7 @@ sourceFile:contextualTyping.ts 5 > ^^^ 6 > ^^ 7 > ^ -8 > ^^^^^^^^^^^-> +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -1630,69 +1584,64 @@ sourceFile:contextualTyping.ts 5 > = 6 > [] 7 > ; -1->Emitted(88, 1) Source(126, 1) + SourceIndex(0) -2 >Emitted(88, 6) Source(126, 6) + SourceIndex(0) -3 >Emitted(88, 7) Source(126, 7) + SourceIndex(0) -4 >Emitted(88, 9) Source(126, 9) + SourceIndex(0) -5 >Emitted(88, 12) Source(126, 12) + SourceIndex(0) -6 >Emitted(88, 14) Source(126, 14) + SourceIndex(0) -7 >Emitted(88, 15) Source(126, 15) + SourceIndex(0) +1->Emitted(68, 1) Source(126, 1) + SourceIndex(0) +2 >Emitted(68, 6) Source(126, 6) + SourceIndex(0) +3 >Emitted(68, 7) Source(126, 7) + SourceIndex(0) +4 >Emitted(68, 9) Source(126, 9) + SourceIndex(0) +5 >Emitted(68, 12) Source(126, 12) + SourceIndex(0) +6 >Emitted(68, 14) Source(126, 14) + SourceIndex(0) +7 >Emitted(68, 15) Source(126, 15) + SourceIndex(0) --- ->>>objc8.t4 = function () { +>>>objc8.t4 = function () { return ({}); }; 1-> 2 >^^^^^ 3 > ^ 4 > ^^ 5 > ^^^ -6 > ^^^^^^-> +6 > ^^^^^^^^^^^^^^ +7 > ^^^^^^ +8 > ^ +9 > ^ +10> ^^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^^-> 1-> > 2 >objc8 3 > . 4 > t4 5 > = -1->Emitted(89, 1) Source(127, 1) + SourceIndex(0) -2 >Emitted(89, 6) Source(127, 6) + SourceIndex(0) -3 >Emitted(89, 7) Source(127, 7) + SourceIndex(0) -4 >Emitted(89, 9) Source(127, 9) + SourceIndex(0) -5 >Emitted(89, 12) Source(127, 12) + SourceIndex(0) +6 > function() { +7 > return +8 > +9 > ( +10> {} +11> ) +12> +13> +14> } +15> ; +1->Emitted(69, 1) Source(127, 1) + SourceIndex(0) +2 >Emitted(69, 6) Source(127, 6) + SourceIndex(0) +3 >Emitted(69, 7) Source(127, 7) + SourceIndex(0) +4 >Emitted(69, 9) Source(127, 9) + SourceIndex(0) +5 >Emitted(69, 12) Source(127, 12) + SourceIndex(0) +6 >Emitted(69, 26) Source(127, 25) + SourceIndex(0) +7 >Emitted(69, 32) Source(127, 31) + SourceIndex(0) +8 >Emitted(69, 33) Source(127, 38) + SourceIndex(0) +9 >Emitted(69, 34) Source(127, 39) + SourceIndex(0) +10>Emitted(69, 36) Source(127, 41) + SourceIndex(0) +11>Emitted(69, 37) Source(127, 42) + SourceIndex(0) +12>Emitted(69, 38) Source(127, 42) + SourceIndex(0) +13>Emitted(69, 39) Source(127, 43) + SourceIndex(0) +14>Emitted(69, 40) Source(127, 44) + SourceIndex(0) +15>Emitted(69, 41) Source(127, 45) + SourceIndex(0) --- ->>> return ({}); -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1->function() { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1->Emitted(90, 5) Source(127, 25) + SourceIndex(0) -2 >Emitted(90, 11) Source(127, 31) + SourceIndex(0) -3 >Emitted(90, 12) Source(127, 38) + SourceIndex(0) -4 >Emitted(90, 13) Source(127, 39) + SourceIndex(0) -5 >Emitted(90, 15) Source(127, 41) + SourceIndex(0) -6 >Emitted(90, 16) Source(127, 42) + SourceIndex(0) -7 >Emitted(90, 17) Source(127, 42) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(91, 1) Source(127, 43) + SourceIndex(0) -2 >Emitted(91, 2) Source(127, 44) + SourceIndex(0) -3 >Emitted(91, 3) Source(127, 45) + SourceIndex(0) ---- ->>>objc8.t5 = function (n) { +>>>objc8.t5 = function (n) { return ({}); }; 1-> 2 >^^^^^ 3 > ^ @@ -1700,6 +1649,17 @@ sourceFile:contextualTyping.ts 5 > ^^^ 6 > ^^^^^^^^^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^^^^-> 1-> > 2 >objc8 @@ -1708,50 +1668,35 @@ sourceFile:contextualTyping.ts 5 > = 6 > function( 7 > n -1->Emitted(92, 1) Source(128, 1) + SourceIndex(0) -2 >Emitted(92, 6) Source(128, 6) + SourceIndex(0) -3 >Emitted(92, 7) Source(128, 7) + SourceIndex(0) -4 >Emitted(92, 9) Source(128, 9) + SourceIndex(0) -5 >Emitted(92, 12) Source(128, 12) + SourceIndex(0) -6 >Emitted(92, 22) Source(128, 21) + SourceIndex(0) -7 >Emitted(92, 23) Source(128, 22) + SourceIndex(0) +8 > ) { +9 > return +10> +11> ( +12> {} +13> ) +14> +15> +16> } +17> ; +1->Emitted(70, 1) Source(128, 1) + SourceIndex(0) +2 >Emitted(70, 6) Source(128, 6) + SourceIndex(0) +3 >Emitted(70, 7) Source(128, 7) + SourceIndex(0) +4 >Emitted(70, 9) Source(128, 9) + SourceIndex(0) +5 >Emitted(70, 12) Source(128, 12) + SourceIndex(0) +6 >Emitted(70, 22) Source(128, 21) + SourceIndex(0) +7 >Emitted(70, 23) Source(128, 22) + SourceIndex(0) +8 >Emitted(70, 27) Source(128, 26) + SourceIndex(0) +9 >Emitted(70, 33) Source(128, 32) + SourceIndex(0) +10>Emitted(70, 34) Source(128, 39) + SourceIndex(0) +11>Emitted(70, 35) Source(128, 40) + SourceIndex(0) +12>Emitted(70, 37) Source(128, 42) + SourceIndex(0) +13>Emitted(70, 38) Source(128, 43) + SourceIndex(0) +14>Emitted(70, 39) Source(128, 43) + SourceIndex(0) +15>Emitted(70, 40) Source(128, 44) + SourceIndex(0) +16>Emitted(70, 41) Source(128, 45) + SourceIndex(0) +17>Emitted(70, 42) Source(128, 46) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(93, 5) Source(128, 26) + SourceIndex(0) -2 >Emitted(93, 11) Source(128, 32) + SourceIndex(0) -3 >Emitted(93, 12) Source(128, 39) + SourceIndex(0) -4 >Emitted(93, 13) Source(128, 40) + SourceIndex(0) -5 >Emitted(93, 15) Source(128, 42) + SourceIndex(0) -6 >Emitted(93, 16) Source(128, 43) + SourceIndex(0) -7 >Emitted(93, 17) Source(128, 43) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(94, 1) Source(128, 44) + SourceIndex(0) -2 >Emitted(94, 2) Source(128, 45) + SourceIndex(0) -3 >Emitted(94, 3) Source(128, 46) + SourceIndex(0) ---- ->>>objc8.t6 = function (n, s) { +>>>objc8.t6 = function (n, s) { return ({}); }; 1-> 2 >^^^^^ 3 > ^ @@ -1761,6 +1706,16 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^ 9 > ^ +10> ^^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^ 1-> > 2 >objc8 @@ -1771,60 +1726,54 @@ sourceFile:contextualTyping.ts 7 > n 8 > , 9 > s -1->Emitted(95, 1) Source(129, 1) + SourceIndex(0) -2 >Emitted(95, 6) Source(129, 6) + SourceIndex(0) -3 >Emitted(95, 7) Source(129, 7) + SourceIndex(0) -4 >Emitted(95, 9) Source(129, 9) + SourceIndex(0) -5 >Emitted(95, 12) Source(129, 12) + SourceIndex(0) -6 >Emitted(95, 22) Source(129, 21) + SourceIndex(0) -7 >Emitted(95, 23) Source(129, 22) + SourceIndex(0) -8 >Emitted(95, 25) Source(129, 24) + SourceIndex(0) -9 >Emitted(95, 26) Source(129, 25) + SourceIndex(0) +10> ) { +11> return +12> +13> ( +14> {} +15> ) +16> +17> +18> } +19> ; +1->Emitted(71, 1) Source(129, 1) + SourceIndex(0) +2 >Emitted(71, 6) Source(129, 6) + SourceIndex(0) +3 >Emitted(71, 7) Source(129, 7) + SourceIndex(0) +4 >Emitted(71, 9) Source(129, 9) + SourceIndex(0) +5 >Emitted(71, 12) Source(129, 12) + SourceIndex(0) +6 >Emitted(71, 22) Source(129, 21) + SourceIndex(0) +7 >Emitted(71, 23) Source(129, 22) + SourceIndex(0) +8 >Emitted(71, 25) Source(129, 24) + SourceIndex(0) +9 >Emitted(71, 26) Source(129, 25) + SourceIndex(0) +10>Emitted(71, 30) Source(129, 29) + SourceIndex(0) +11>Emitted(71, 36) Source(129, 35) + SourceIndex(0) +12>Emitted(71, 37) Source(129, 42) + SourceIndex(0) +13>Emitted(71, 38) Source(129, 43) + SourceIndex(0) +14>Emitted(71, 40) Source(129, 45) + SourceIndex(0) +15>Emitted(71, 41) Source(129, 46) + SourceIndex(0) +16>Emitted(71, 42) Source(129, 46) + SourceIndex(0) +17>Emitted(71, 43) Source(129, 47) + SourceIndex(0) +18>Emitted(71, 44) Source(129, 48) + SourceIndex(0) +19>Emitted(71, 45) Source(129, 49) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(96, 5) Source(129, 29) + SourceIndex(0) -2 >Emitted(96, 11) Source(129, 35) + SourceIndex(0) -3 >Emitted(96, 12) Source(129, 42) + SourceIndex(0) -4 >Emitted(96, 13) Source(129, 43) + SourceIndex(0) -5 >Emitted(96, 15) Source(129, 45) + SourceIndex(0) -6 >Emitted(96, 16) Source(129, 46) + SourceIndex(0) -7 >Emitted(96, 17) Source(129, 46) + SourceIndex(0) ---- ->>>}; +>>>objc8.t7 = function (n) { return n; }; 1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(97, 1) Source(129, 47) + SourceIndex(0) -2 >Emitted(97, 2) Source(129, 48) + SourceIndex(0) -3 >Emitted(97, 3) Source(129, 49) + SourceIndex(0) ---- ->>>objc8.t7 = function (n) { -1-> 2 >^^^^^ 3 > ^ 4 > ^^ 5 > ^^^ 6 > ^^^^^^^^^^ 7 > ^ -1-> +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^-> +1 > > 2 >objc8 3 > . @@ -1832,44 +1781,31 @@ sourceFile:contextualTyping.ts 5 > = 6 > function( 7 > n: number -1->Emitted(98, 1) Source(130, 1) + SourceIndex(0) -2 >Emitted(98, 6) Source(130, 6) + SourceIndex(0) -3 >Emitted(98, 7) Source(130, 7) + SourceIndex(0) -4 >Emitted(98, 9) Source(130, 9) + SourceIndex(0) -5 >Emitted(98, 12) Source(130, 12) + SourceIndex(0) -6 >Emitted(98, 22) Source(130, 21) + SourceIndex(0) -7 >Emitted(98, 23) Source(130, 30) + SourceIndex(0) +8 > ) { +9 > return +10> +11> n +12> +13> +14> } +15> ; +1 >Emitted(72, 1) Source(130, 1) + SourceIndex(0) +2 >Emitted(72, 6) Source(130, 6) + SourceIndex(0) +3 >Emitted(72, 7) Source(130, 7) + SourceIndex(0) +4 >Emitted(72, 9) Source(130, 9) + SourceIndex(0) +5 >Emitted(72, 12) Source(130, 12) + SourceIndex(0) +6 >Emitted(72, 22) Source(130, 21) + SourceIndex(0) +7 >Emitted(72, 23) Source(130, 30) + SourceIndex(0) +8 >Emitted(72, 27) Source(130, 34) + SourceIndex(0) +9 >Emitted(72, 33) Source(130, 40) + SourceIndex(0) +10>Emitted(72, 34) Source(130, 41) + SourceIndex(0) +11>Emitted(72, 35) Source(130, 42) + SourceIndex(0) +12>Emitted(72, 36) Source(130, 42) + SourceIndex(0) +13>Emitted(72, 37) Source(130, 43) + SourceIndex(0) +14>Emitted(72, 38) Source(130, 44) + SourceIndex(0) +15>Emitted(72, 39) Source(130, 45) + SourceIndex(0) --- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > -1 >Emitted(99, 5) Source(130, 34) + SourceIndex(0) -2 >Emitted(99, 11) Source(130, 40) + SourceIndex(0) -3 >Emitted(99, 12) Source(130, 41) + SourceIndex(0) -4 >Emitted(99, 13) Source(130, 42) + SourceIndex(0) -5 >Emitted(99, 14) Source(130, 42) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(100, 1) Source(130, 43) + SourceIndex(0) -2 >Emitted(100, 2) Source(130, 44) + SourceIndex(0) -3 >Emitted(100, 3) Source(130, 45) + SourceIndex(0) ---- ->>>objc8.t8 = function (n) { +>>>objc8.t8 = function (n) { return n; }; 1-> 2 >^^^^^ 3 > ^ @@ -1877,6 +1813,14 @@ sourceFile:contextualTyping.ts 5 > ^^^ 6 > ^^^^^^^^^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ 1-> > > @@ -1886,45 +1830,32 @@ sourceFile:contextualTyping.ts 5 > = 6 > function( 7 > n -1->Emitted(101, 1) Source(132, 1) + SourceIndex(0) -2 >Emitted(101, 6) Source(132, 6) + SourceIndex(0) -3 >Emitted(101, 7) Source(132, 7) + SourceIndex(0) -4 >Emitted(101, 9) Source(132, 9) + SourceIndex(0) -5 >Emitted(101, 12) Source(132, 12) + SourceIndex(0) -6 >Emitted(101, 22) Source(132, 21) + SourceIndex(0) -7 >Emitted(101, 23) Source(132, 22) + SourceIndex(0) ---- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > ; -1 >Emitted(102, 5) Source(132, 26) + SourceIndex(0) -2 >Emitted(102, 11) Source(132, 32) + SourceIndex(0) -3 >Emitted(102, 12) Source(132, 33) + SourceIndex(0) -4 >Emitted(102, 13) Source(132, 34) + SourceIndex(0) -5 >Emitted(102, 14) Source(132, 35) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(103, 1) Source(132, 36) + SourceIndex(0) -2 >Emitted(103, 2) Source(132, 37) + SourceIndex(0) -3 >Emitted(103, 3) Source(132, 38) + SourceIndex(0) +8 > ) { +9 > return +10> +11> n +12> ; +13> +14> } +15> ; +1->Emitted(73, 1) Source(132, 1) + SourceIndex(0) +2 >Emitted(73, 6) Source(132, 6) + SourceIndex(0) +3 >Emitted(73, 7) Source(132, 7) + SourceIndex(0) +4 >Emitted(73, 9) Source(132, 9) + SourceIndex(0) +5 >Emitted(73, 12) Source(132, 12) + SourceIndex(0) +6 >Emitted(73, 22) Source(132, 21) + SourceIndex(0) +7 >Emitted(73, 23) Source(132, 22) + SourceIndex(0) +8 >Emitted(73, 27) Source(132, 26) + SourceIndex(0) +9 >Emitted(73, 33) Source(132, 32) + SourceIndex(0) +10>Emitted(73, 34) Source(132, 33) + SourceIndex(0) +11>Emitted(73, 35) Source(132, 34) + SourceIndex(0) +12>Emitted(73, 36) Source(132, 35) + SourceIndex(0) +13>Emitted(73, 37) Source(132, 36) + SourceIndex(0) +14>Emitted(73, 38) Source(132, 37) + SourceIndex(0) +15>Emitted(73, 39) Source(132, 38) + SourceIndex(0) --- >>>objc8.t9 = [[], []]; -1-> +1 > 2 >^^^^^ 3 > ^ 4 > ^^ @@ -1936,7 +1867,7 @@ sourceFile:contextualTyping.ts 10> ^ 11> ^ 12> ^^^^^^-> -1-> +1 > > 2 >objc8 3 > . @@ -1948,17 +1879,17 @@ sourceFile:contextualTyping.ts 9 > [] 10> ] 11> ; -1->Emitted(104, 1) Source(133, 1) + SourceIndex(0) -2 >Emitted(104, 6) Source(133, 6) + SourceIndex(0) -3 >Emitted(104, 7) Source(133, 7) + SourceIndex(0) -4 >Emitted(104, 9) Source(133, 9) + SourceIndex(0) -5 >Emitted(104, 12) Source(133, 12) + SourceIndex(0) -6 >Emitted(104, 13) Source(133, 13) + SourceIndex(0) -7 >Emitted(104, 15) Source(133, 15) + SourceIndex(0) -8 >Emitted(104, 17) Source(133, 16) + SourceIndex(0) -9 >Emitted(104, 19) Source(133, 18) + SourceIndex(0) -10>Emitted(104, 20) Source(133, 19) + SourceIndex(0) -11>Emitted(104, 21) Source(133, 20) + SourceIndex(0) +1 >Emitted(74, 1) Source(133, 1) + SourceIndex(0) +2 >Emitted(74, 6) Source(133, 6) + SourceIndex(0) +3 >Emitted(74, 7) Source(133, 7) + SourceIndex(0) +4 >Emitted(74, 9) Source(133, 9) + SourceIndex(0) +5 >Emitted(74, 12) Source(133, 12) + SourceIndex(0) +6 >Emitted(74, 13) Source(133, 13) + SourceIndex(0) +7 >Emitted(74, 15) Source(133, 15) + SourceIndex(0) +8 >Emitted(74, 17) Source(133, 16) + SourceIndex(0) +9 >Emitted(74, 19) Source(133, 18) + SourceIndex(0) +10>Emitted(74, 20) Source(133, 19) + SourceIndex(0) +11>Emitted(74, 21) Source(133, 20) + SourceIndex(0) --- >>>objc8.t10 = [({}), ({})]; 1-> @@ -1976,7 +1907,7 @@ sourceFile:contextualTyping.ts 13> ^ 14> ^ 15> ^ -16> ^^^^^^-> +16> ^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -1993,23 +1924,23 @@ sourceFile:contextualTyping.ts 13> ) 14> ] 15> ; -1->Emitted(105, 1) Source(134, 1) + SourceIndex(0) -2 >Emitted(105, 6) Source(134, 6) + SourceIndex(0) -3 >Emitted(105, 7) Source(134, 7) + SourceIndex(0) -4 >Emitted(105, 10) Source(134, 10) + SourceIndex(0) -5 >Emitted(105, 13) Source(134, 13) + SourceIndex(0) -6 >Emitted(105, 14) Source(134, 20) + SourceIndex(0) -7 >Emitted(105, 15) Source(134, 21) + SourceIndex(0) -8 >Emitted(105, 17) Source(134, 23) + SourceIndex(0) -9 >Emitted(105, 18) Source(134, 24) + SourceIndex(0) -10>Emitted(105, 20) Source(134, 31) + SourceIndex(0) -11>Emitted(105, 21) Source(134, 32) + SourceIndex(0) -12>Emitted(105, 23) Source(134, 34) + SourceIndex(0) -13>Emitted(105, 24) Source(134, 35) + SourceIndex(0) -14>Emitted(105, 25) Source(134, 36) + SourceIndex(0) -15>Emitted(105, 26) Source(134, 37) + SourceIndex(0) +1->Emitted(75, 1) Source(134, 1) + SourceIndex(0) +2 >Emitted(75, 6) Source(134, 6) + SourceIndex(0) +3 >Emitted(75, 7) Source(134, 7) + SourceIndex(0) +4 >Emitted(75, 10) Source(134, 10) + SourceIndex(0) +5 >Emitted(75, 13) Source(134, 13) + SourceIndex(0) +6 >Emitted(75, 14) Source(134, 20) + SourceIndex(0) +7 >Emitted(75, 15) Source(134, 21) + SourceIndex(0) +8 >Emitted(75, 17) Source(134, 23) + SourceIndex(0) +9 >Emitted(75, 18) Source(134, 24) + SourceIndex(0) +10>Emitted(75, 20) Source(134, 31) + SourceIndex(0) +11>Emitted(75, 21) Source(134, 32) + SourceIndex(0) +12>Emitted(75, 23) Source(134, 34) + SourceIndex(0) +13>Emitted(75, 24) Source(134, 35) + SourceIndex(0) +14>Emitted(75, 25) Source(134, 36) + SourceIndex(0) +15>Emitted(75, 26) Source(134, 37) + SourceIndex(0) --- ->>>objc8.t11 = [function (n, s) { +>>>objc8.t11 = [function (n, s) { return s; }]; 1-> 2 >^^^^^ 3 > ^ @@ -2020,6 +1951,15 @@ sourceFile:contextualTyping.ts 8 > ^ 9 > ^^ 10> ^ +11> ^^^^ +12> ^^^^^^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^ 1-> > 2 >objc8 @@ -2031,67 +1971,53 @@ sourceFile:contextualTyping.ts 8 > n 9 > , 10> s -1->Emitted(106, 1) Source(135, 1) + SourceIndex(0) -2 >Emitted(106, 6) Source(135, 6) + SourceIndex(0) -3 >Emitted(106, 7) Source(135, 7) + SourceIndex(0) -4 >Emitted(106, 10) Source(135, 10) + SourceIndex(0) -5 >Emitted(106, 13) Source(135, 13) + SourceIndex(0) -6 >Emitted(106, 14) Source(135, 14) + SourceIndex(0) -7 >Emitted(106, 24) Source(135, 23) + SourceIndex(0) -8 >Emitted(106, 25) Source(135, 24) + SourceIndex(0) -9 >Emitted(106, 27) Source(135, 26) + SourceIndex(0) -10>Emitted(106, 28) Source(135, 27) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(107, 5) Source(135, 31) + SourceIndex(0) -2 >Emitted(107, 11) Source(135, 37) + SourceIndex(0) -3 >Emitted(107, 12) Source(135, 38) + SourceIndex(0) -4 >Emitted(107, 13) Source(135, 39) + SourceIndex(0) -5 >Emitted(107, 14) Source(135, 40) + SourceIndex(0) ---- ->>>}]; -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^-> -1 > -2 >} -3 > ] -4 > ; -1 >Emitted(108, 1) Source(135, 41) + SourceIndex(0) -2 >Emitted(108, 2) Source(135, 42) + SourceIndex(0) -3 >Emitted(108, 3) Source(135, 43) + SourceIndex(0) -4 >Emitted(108, 4) Source(135, 44) + SourceIndex(0) +11> ) { +12> return +13> +14> s +15> ; +16> +17> } +18> ] +19> ; +1->Emitted(76, 1) Source(135, 1) + SourceIndex(0) +2 >Emitted(76, 6) Source(135, 6) + SourceIndex(0) +3 >Emitted(76, 7) Source(135, 7) + SourceIndex(0) +4 >Emitted(76, 10) Source(135, 10) + SourceIndex(0) +5 >Emitted(76, 13) Source(135, 13) + SourceIndex(0) +6 >Emitted(76, 14) Source(135, 14) + SourceIndex(0) +7 >Emitted(76, 24) Source(135, 23) + SourceIndex(0) +8 >Emitted(76, 25) Source(135, 24) + SourceIndex(0) +9 >Emitted(76, 27) Source(135, 26) + SourceIndex(0) +10>Emitted(76, 28) Source(135, 27) + SourceIndex(0) +11>Emitted(76, 32) Source(135, 31) + SourceIndex(0) +12>Emitted(76, 38) Source(135, 37) + SourceIndex(0) +13>Emitted(76, 39) Source(135, 38) + SourceIndex(0) +14>Emitted(76, 40) Source(135, 39) + SourceIndex(0) +15>Emitted(76, 41) Source(135, 40) + SourceIndex(0) +16>Emitted(76, 42) Source(135, 41) + SourceIndex(0) +17>Emitted(76, 43) Source(135, 42) + SourceIndex(0) +18>Emitted(76, 44) Source(135, 43) + SourceIndex(0) +19>Emitted(76, 45) Source(135, 44) + SourceIndex(0) --- >>>objc8.t12 = { -1-> +1 > 2 >^^^^^ 3 > ^ 4 > ^^^ 5 > ^^^ 6 > ^^-> -1-> +1 > > 2 >objc8 3 > . 4 > t12 5 > = -1->Emitted(109, 1) Source(136, 1) + SourceIndex(0) -2 >Emitted(109, 6) Source(136, 6) + SourceIndex(0) -3 >Emitted(109, 7) Source(136, 7) + SourceIndex(0) -4 >Emitted(109, 10) Source(136, 10) + SourceIndex(0) -5 >Emitted(109, 13) Source(136, 13) + SourceIndex(0) +1 >Emitted(77, 1) Source(136, 1) + SourceIndex(0) +2 >Emitted(77, 6) Source(136, 6) + SourceIndex(0) +3 >Emitted(77, 7) Source(136, 7) + SourceIndex(0) +4 >Emitted(77, 10) Source(136, 10) + SourceIndex(0) +5 >Emitted(77, 13) Source(136, 13) + SourceIndex(0) --- >>> foo: ({}) 1->^^^^ @@ -2107,12 +2033,12 @@ sourceFile:contextualTyping.ts 4 > ( 5 > {} 6 > ) -1->Emitted(110, 5) Source(137, 5) + SourceIndex(0) -2 >Emitted(110, 8) Source(137, 8) + SourceIndex(0) -3 >Emitted(110, 10) Source(137, 16) + SourceIndex(0) -4 >Emitted(110, 11) Source(137, 17) + SourceIndex(0) -5 >Emitted(110, 13) Source(137, 19) + SourceIndex(0) -6 >Emitted(110, 14) Source(137, 20) + SourceIndex(0) +1->Emitted(78, 5) Source(137, 5) + SourceIndex(0) +2 >Emitted(78, 8) Source(137, 8) + SourceIndex(0) +3 >Emitted(78, 10) Source(137, 16) + SourceIndex(0) +4 >Emitted(78, 11) Source(137, 17) + SourceIndex(0) +5 >Emitted(78, 13) Source(137, 19) + SourceIndex(0) +6 >Emitted(78, 14) Source(137, 20) + SourceIndex(0) --- >>>}; 1 >^ @@ -2121,8 +2047,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > -1 >Emitted(111, 2) Source(138, 2) + SourceIndex(0) -2 >Emitted(111, 3) Source(138, 2) + SourceIndex(0) +1 >Emitted(79, 2) Source(138, 2) + SourceIndex(0) +2 >Emitted(79, 3) Source(138, 2) + SourceIndex(0) --- >>>objc8.t13 = ({ 1-> @@ -2131,7 +2057,7 @@ sourceFile:contextualTyping.ts 4 > ^^^ 5 > ^^^ 6 > ^ -7 > ^^^^^^^^^^^^-> +7 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -2139,14 +2065,14 @@ sourceFile:contextualTyping.ts 4 > t13 5 > = 6 > ( -1->Emitted(112, 1) Source(139, 1) + SourceIndex(0) -2 >Emitted(112, 6) Source(139, 6) + SourceIndex(0) -3 >Emitted(112, 7) Source(139, 7) + SourceIndex(0) -4 >Emitted(112, 10) Source(139, 10) + SourceIndex(0) -5 >Emitted(112, 13) Source(139, 19) + SourceIndex(0) -6 >Emitted(112, 14) Source(139, 20) + SourceIndex(0) +1->Emitted(80, 1) Source(139, 1) + SourceIndex(0) +2 >Emitted(80, 6) Source(139, 6) + SourceIndex(0) +3 >Emitted(80, 7) Source(139, 7) + SourceIndex(0) +4 >Emitted(80, 10) Source(139, 10) + SourceIndex(0) +5 >Emitted(80, 13) Source(139, 19) + SourceIndex(0) +6 >Emitted(80, 14) Source(139, 20) + SourceIndex(0) --- ->>> f: function (i, s) { +>>> f: function (i, s) { return s; } 1->^^^^ 2 > ^ 3 > ^^ @@ -2154,6 +2080,13 @@ sourceFile:contextualTyping.ts 5 > ^ 6 > ^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1->{ > 2 > f @@ -2162,38 +2095,27 @@ sourceFile:contextualTyping.ts 5 > i 6 > , 7 > s -1->Emitted(113, 5) Source(140, 5) + SourceIndex(0) -2 >Emitted(113, 6) Source(140, 6) + SourceIndex(0) -3 >Emitted(113, 8) Source(140, 8) + SourceIndex(0) -4 >Emitted(113, 18) Source(140, 17) + SourceIndex(0) -5 >Emitted(113, 19) Source(140, 18) + SourceIndex(0) -6 >Emitted(113, 21) Source(140, 20) + SourceIndex(0) -7 >Emitted(113, 22) Source(140, 21) + SourceIndex(0) ---- ->>> return s; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(114, 9) Source(140, 25) + SourceIndex(0) -2 >Emitted(114, 15) Source(140, 31) + SourceIndex(0) -3 >Emitted(114, 16) Source(140, 32) + SourceIndex(0) -4 >Emitted(114, 17) Source(140, 33) + SourceIndex(0) -5 >Emitted(114, 18) Source(140, 34) + SourceIndex(0) ---- ->>> } -1 >^^^^ -2 > ^ -1 > -2 > } -1 >Emitted(115, 5) Source(140, 35) + SourceIndex(0) -2 >Emitted(115, 6) Source(140, 36) + SourceIndex(0) +8 > ) { +9 > return +10> +11> s +12> ; +13> +14> } +1->Emitted(81, 5) Source(140, 5) + SourceIndex(0) +2 >Emitted(81, 6) Source(140, 6) + SourceIndex(0) +3 >Emitted(81, 8) Source(140, 8) + SourceIndex(0) +4 >Emitted(81, 18) Source(140, 17) + SourceIndex(0) +5 >Emitted(81, 19) Source(140, 18) + SourceIndex(0) +6 >Emitted(81, 21) Source(140, 20) + SourceIndex(0) +7 >Emitted(81, 22) Source(140, 21) + SourceIndex(0) +8 >Emitted(81, 26) Source(140, 25) + SourceIndex(0) +9 >Emitted(81, 32) Source(140, 31) + SourceIndex(0) +10>Emitted(81, 33) Source(140, 32) + SourceIndex(0) +11>Emitted(81, 34) Source(140, 33) + SourceIndex(0) +12>Emitted(81, 35) Source(140, 34) + SourceIndex(0) +13>Emitted(81, 36) Source(140, 35) + SourceIndex(0) +14>Emitted(81, 37) Source(140, 36) + SourceIndex(0) --- >>>}); 1 >^ @@ -2204,9 +2126,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(116, 2) Source(141, 2) + SourceIndex(0) -2 >Emitted(116, 3) Source(141, 3) + SourceIndex(0) -3 >Emitted(116, 4) Source(141, 3) + SourceIndex(0) +1 >Emitted(82, 2) Source(141, 2) + SourceIndex(0) +2 >Emitted(82, 3) Source(141, 3) + SourceIndex(0) +3 >Emitted(82, 4) Source(141, 3) + SourceIndex(0) --- >>>objc8.t14 = ({ 1-> @@ -2222,12 +2144,12 @@ sourceFile:contextualTyping.ts 4 > t14 5 > = 6 > ( -1->Emitted(117, 1) Source(142, 1) + SourceIndex(0) -2 >Emitted(117, 6) Source(142, 6) + SourceIndex(0) -3 >Emitted(117, 7) Source(142, 7) + SourceIndex(0) -4 >Emitted(117, 10) Source(142, 10) + SourceIndex(0) -5 >Emitted(117, 13) Source(142, 19) + SourceIndex(0) -6 >Emitted(117, 14) Source(142, 20) + SourceIndex(0) +1->Emitted(83, 1) Source(142, 1) + SourceIndex(0) +2 >Emitted(83, 6) Source(142, 6) + SourceIndex(0) +3 >Emitted(83, 7) Source(142, 7) + SourceIndex(0) +4 >Emitted(83, 10) Source(142, 10) + SourceIndex(0) +5 >Emitted(83, 13) Source(142, 19) + SourceIndex(0) +6 >Emitted(83, 14) Source(142, 20) + SourceIndex(0) --- >>> a: [] 1 >^^^^ @@ -2239,10 +2161,10 @@ sourceFile:contextualTyping.ts 2 > a 3 > : 4 > [] -1 >Emitted(118, 5) Source(143, 5) + SourceIndex(0) -2 >Emitted(118, 6) Source(143, 6) + SourceIndex(0) -3 >Emitted(118, 8) Source(143, 8) + SourceIndex(0) -4 >Emitted(118, 10) Source(143, 10) + SourceIndex(0) +1 >Emitted(84, 5) Source(143, 5) + SourceIndex(0) +2 >Emitted(84, 6) Source(143, 6) + SourceIndex(0) +3 >Emitted(84, 8) Source(143, 8) + SourceIndex(0) +4 >Emitted(84, 10) Source(143, 10) + SourceIndex(0) --- >>>}); 1 >^ @@ -2253,9 +2175,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(119, 2) Source(144, 2) + SourceIndex(0) -2 >Emitted(119, 3) Source(144, 3) + SourceIndex(0) -3 >Emitted(119, 4) Source(144, 3) + SourceIndex(0) +1 >Emitted(85, 2) Source(144, 2) + SourceIndex(0) +2 >Emitted(85, 3) Source(144, 3) + SourceIndex(0) +3 >Emitted(85, 4) Source(144, 3) + SourceIndex(0) --- >>>// CONTEXT: Function call 1-> @@ -2266,9 +2188,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Function call -1->Emitted(120, 1) Source(146, 1) + SourceIndex(0) -2 >Emitted(120, 1) Source(145, 1) + SourceIndex(0) -3 >Emitted(120, 26) Source(145, 26) + SourceIndex(0) +1->Emitted(86, 1) Source(146, 1) + SourceIndex(0) +2 >Emitted(86, 1) Source(145, 1) + SourceIndex(0) +3 >Emitted(86, 26) Source(145, 26) + SourceIndex(0) --- >>>function c9t5(f) { } 1 >^^^^^^^^^ @@ -2282,11 +2204,11 @@ sourceFile:contextualTyping.ts 3 > ( 4 > f: (n: number) => IFoo 5 > ) {} -1 >Emitted(121, 10) Source(146, 10) + SourceIndex(0) -2 >Emitted(121, 14) Source(146, 14) + SourceIndex(0) -3 >Emitted(121, 15) Source(146, 15) + SourceIndex(0) -4 >Emitted(121, 16) Source(146, 37) + SourceIndex(0) -5 >Emitted(121, 21) Source(146, 41) + SourceIndex(0) +1 >Emitted(87, 10) Source(146, 10) + SourceIndex(0) +2 >Emitted(87, 14) Source(146, 14) + SourceIndex(0) +3 >Emitted(87, 15) Source(146, 15) + SourceIndex(0) +4 >Emitted(87, 16) Source(146, 37) + SourceIndex(0) +5 >Emitted(87, 21) Source(146, 41) + SourceIndex(0) --- >>>; 1 > @@ -2294,8 +2216,8 @@ sourceFile:contextualTyping.ts 3 > ^^^^^^^^^^^^^^^^^^^-> 1 > 2 >; -1 >Emitted(122, 1) Source(146, 41) + SourceIndex(0) -2 >Emitted(122, 2) Source(146, 42) + SourceIndex(0) +1 >Emitted(88, 1) Source(146, 41) + SourceIndex(0) +2 >Emitted(88, 2) Source(146, 42) + SourceIndex(0) --- >>>c9t5(function (n) { 1-> @@ -2310,11 +2232,11 @@ sourceFile:contextualTyping.ts 3 > ( 4 > function( 5 > n -1->Emitted(123, 1) Source(147, 1) + SourceIndex(0) -2 >Emitted(123, 5) Source(147, 5) + SourceIndex(0) -3 >Emitted(123, 6) Source(147, 6) + SourceIndex(0) -4 >Emitted(123, 16) Source(147, 15) + SourceIndex(0) -5 >Emitted(123, 17) Source(147, 16) + SourceIndex(0) +1->Emitted(89, 1) Source(147, 1) + SourceIndex(0) +2 >Emitted(89, 5) Source(147, 5) + SourceIndex(0) +3 >Emitted(89, 6) Source(147, 6) + SourceIndex(0) +4 >Emitted(89, 16) Source(147, 15) + SourceIndex(0) +5 >Emitted(89, 17) Source(147, 16) + SourceIndex(0) --- >>> return ({}); 1->^^^^ @@ -2332,13 +2254,13 @@ sourceFile:contextualTyping.ts 5 > {} 6 > ) 7 > ; -1->Emitted(124, 5) Source(148, 5) + SourceIndex(0) -2 >Emitted(124, 11) Source(148, 11) + SourceIndex(0) -3 >Emitted(124, 12) Source(148, 18) + SourceIndex(0) -4 >Emitted(124, 13) Source(148, 19) + SourceIndex(0) -5 >Emitted(124, 15) Source(148, 21) + SourceIndex(0) -6 >Emitted(124, 16) Source(148, 22) + SourceIndex(0) -7 >Emitted(124, 17) Source(148, 23) + SourceIndex(0) +1->Emitted(90, 5) Source(148, 5) + SourceIndex(0) +2 >Emitted(90, 11) Source(148, 11) + SourceIndex(0) +3 >Emitted(90, 12) Source(148, 18) + SourceIndex(0) +4 >Emitted(90, 13) Source(148, 19) + SourceIndex(0) +5 >Emitted(90, 15) Source(148, 21) + SourceIndex(0) +6 >Emitted(90, 16) Source(148, 22) + SourceIndex(0) +7 >Emitted(90, 17) Source(148, 23) + SourceIndex(0) --- >>>}); 1 > @@ -2351,115 +2273,106 @@ sourceFile:contextualTyping.ts 2 >} 3 > ) 4 > ; -1 >Emitted(125, 1) Source(149, 1) + SourceIndex(0) -2 >Emitted(125, 2) Source(149, 2) + SourceIndex(0) -3 >Emitted(125, 3) Source(149, 3) + SourceIndex(0) -4 >Emitted(125, 4) Source(149, 4) + SourceIndex(0) +1 >Emitted(91, 1) Source(149, 1) + SourceIndex(0) +2 >Emitted(91, 2) Source(149, 2) + SourceIndex(0) +3 >Emitted(91, 3) Source(149, 3) + SourceIndex(0) +4 >Emitted(91, 4) Source(149, 4) + SourceIndex(0) --- >>>// CONTEXT: Return statement 1-> 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > >// CONTEXT: Return statement > 2 > 3 >// CONTEXT: Return statement -1->Emitted(126, 1) Source(152, 1) + SourceIndex(0) -2 >Emitted(126, 1) Source(151, 1) + SourceIndex(0) -3 >Emitted(126, 29) Source(151, 29) + SourceIndex(0) +1->Emitted(92, 1) Source(152, 1) + SourceIndex(0) +2 >Emitted(92, 1) Source(151, 1) + SourceIndex(0) +3 >Emitted(92, 29) Source(151, 29) + SourceIndex(0) --- ->>>var c10t5 = function () { -1 >^^^^ +>>>var c10t5 = function () { return function (n) { return ({}); }; }; +1->^^^^ 2 > ^^^^^ 3 > ^^^ -4 > ^^^^^^^^^^^^^^-> -1 > +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^^^^^^^ +8 > ^ +9 > ^^^^ +10> ^^^^^^ +11> ^ +12> ^ +13> ^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^ +20> ^ +21> ^ +1-> >var 2 > c10t5 3 > : () => (n: number) => IFoo = -1 >Emitted(127, 5) Source(152, 5) + SourceIndex(0) -2 >Emitted(127, 10) Source(152, 10) + SourceIndex(0) -3 >Emitted(127, 13) Source(152, 40) + SourceIndex(0) ---- ->>> return function (n) { -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^ -5 > ^ -1->function() { -2 > return -3 > -4 > function( -5 > n -1->Emitted(128, 5) Source(152, 53) + SourceIndex(0) -2 >Emitted(128, 11) Source(152, 59) + SourceIndex(0) -3 >Emitted(128, 12) Source(152, 60) + SourceIndex(0) -4 >Emitted(128, 22) Source(152, 69) + SourceIndex(0) -5 >Emitted(128, 23) Source(152, 70) + SourceIndex(0) ---- ->>> return ({}); -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(129, 9) Source(152, 74) + SourceIndex(0) -2 >Emitted(129, 15) Source(152, 80) + SourceIndex(0) -3 >Emitted(129, 16) Source(152, 87) + SourceIndex(0) -4 >Emitted(129, 17) Source(152, 88) + SourceIndex(0) -5 >Emitted(129, 19) Source(152, 90) + SourceIndex(0) -6 >Emitted(129, 20) Source(152, 91) + SourceIndex(0) -7 >Emitted(129, 21) Source(152, 91) + SourceIndex(0) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^ -1 > -2 > } -3 > -1 >Emitted(130, 5) Source(152, 92) + SourceIndex(0) -2 >Emitted(130, 6) Source(152, 93) + SourceIndex(0) -3 >Emitted(130, 7) Source(152, 93) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(131, 1) Source(152, 94) + SourceIndex(0) -2 >Emitted(131, 2) Source(152, 95) + SourceIndex(0) -3 >Emitted(131, 3) Source(152, 96) + SourceIndex(0) +4 > function() { +5 > return +6 > +7 > function( +8 > n +9 > ) { +10> return +11> +12> ( +13> {} +14> ) +15> +16> +17> } +18> +19> +20> } +21> ; +1->Emitted(93, 5) Source(152, 5) + SourceIndex(0) +2 >Emitted(93, 10) Source(152, 10) + SourceIndex(0) +3 >Emitted(93, 13) Source(152, 40) + SourceIndex(0) +4 >Emitted(93, 27) Source(152, 53) + SourceIndex(0) +5 >Emitted(93, 33) Source(152, 59) + SourceIndex(0) +6 >Emitted(93, 34) Source(152, 60) + SourceIndex(0) +7 >Emitted(93, 44) Source(152, 69) + SourceIndex(0) +8 >Emitted(93, 45) Source(152, 70) + SourceIndex(0) +9 >Emitted(93, 49) Source(152, 74) + SourceIndex(0) +10>Emitted(93, 55) Source(152, 80) + SourceIndex(0) +11>Emitted(93, 56) Source(152, 87) + SourceIndex(0) +12>Emitted(93, 57) Source(152, 88) + SourceIndex(0) +13>Emitted(93, 59) Source(152, 90) + SourceIndex(0) +14>Emitted(93, 60) Source(152, 91) + SourceIndex(0) +15>Emitted(93, 61) Source(152, 91) + SourceIndex(0) +16>Emitted(93, 62) Source(152, 92) + SourceIndex(0) +17>Emitted(93, 63) Source(152, 93) + SourceIndex(0) +18>Emitted(93, 64) Source(152, 93) + SourceIndex(0) +19>Emitted(93, 65) Source(152, 94) + SourceIndex(0) +20>Emitted(93, 66) Source(152, 95) + SourceIndex(0) +21>Emitted(93, 67) Source(152, 96) + SourceIndex(0) --- >>>// CONTEXT: Newing a class -1-> +1 > 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 > ^-> -1-> +1 > > >// CONTEXT: Newing a class > 2 > 3 >// CONTEXT: Newing a class -1->Emitted(132, 1) Source(155, 1) + SourceIndex(0) -2 >Emitted(132, 1) Source(154, 1) + SourceIndex(0) -3 >Emitted(132, 27) Source(154, 27) + SourceIndex(0) +1 >Emitted(94, 1) Source(155, 1) + SourceIndex(0) +2 >Emitted(94, 1) Source(154, 1) + SourceIndex(0) +3 >Emitted(94, 27) Source(154, 27) + SourceIndex(0) --- >>>var C11t5 = (function () { 1->^^^^ @@ -2468,8 +2381,8 @@ sourceFile:contextualTyping.ts 1-> >class 2 > C11t5 -1->Emitted(133, 5) Source(155, 7) + SourceIndex(0) -2 >Emitted(133, 10) Source(155, 12) + SourceIndex(0) +1->Emitted(95, 5) Source(155, 7) + SourceIndex(0) +2 >Emitted(95, 10) Source(155, 12) + SourceIndex(0) --- >>> function C11t5(f) { 1->^^^^ @@ -2482,11 +2395,11 @@ sourceFile:contextualTyping.ts 3 > C11t5 4 > { constructor( 5 > f: (n: number) => IFoo -1->Emitted(134, 5) Source(155, 15) + SourceIndex(0) name (C11t5) -2 >Emitted(134, 14) Source(155, 7) + SourceIndex(0) name (C11t5) -3 >Emitted(134, 19) Source(155, 12) + SourceIndex(0) name (C11t5) -4 >Emitted(134, 20) Source(155, 27) + SourceIndex(0) name (C11t5) -5 >Emitted(134, 21) Source(155, 49) + SourceIndex(0) name (C11t5) +1->Emitted(96, 5) Source(155, 15) + SourceIndex(0) name (C11t5) +2 >Emitted(96, 14) Source(155, 7) + SourceIndex(0) name (C11t5) +3 >Emitted(96, 19) Source(155, 12) + SourceIndex(0) name (C11t5) +4 >Emitted(96, 20) Source(155, 27) + SourceIndex(0) name (C11t5) +5 >Emitted(96, 21) Source(155, 49) + SourceIndex(0) name (C11t5) --- >>> } 1 >^^^^ @@ -2494,16 +2407,16 @@ sourceFile:contextualTyping.ts 3 > ^^^^^^^^^^^^^-> 1 >) { 2 > } -1 >Emitted(135, 5) Source(155, 53) + SourceIndex(0) name (C11t5.constructor) -2 >Emitted(135, 6) Source(155, 54) + SourceIndex(0) name (C11t5.constructor) +1 >Emitted(97, 5) Source(155, 53) + SourceIndex(0) name (C11t5.constructor) +2 >Emitted(97, 6) Source(155, 54) + SourceIndex(0) name (C11t5.constructor) --- >>> return C11t5; 1->^^^^ 2 > ^^^^^^^^^^^^ 1-> 2 > } -1->Emitted(136, 5) Source(155, 55) + SourceIndex(0) name (C11t5) -2 >Emitted(136, 17) Source(155, 56) + SourceIndex(0) name (C11t5) +1->Emitted(98, 5) Source(155, 55) + SourceIndex(0) name (C11t5) +2 >Emitted(98, 17) Source(155, 56) + SourceIndex(0) name (C11t5) --- >>>})(); 1 > @@ -2514,21 +2427,21 @@ sourceFile:contextualTyping.ts 2 >} 3 > 4 > class C11t5 { constructor(f: (n: number) => IFoo) { } } -1 >Emitted(137, 1) Source(155, 55) + SourceIndex(0) name (C11t5) -2 >Emitted(137, 2) Source(155, 56) + SourceIndex(0) name (C11t5) -3 >Emitted(137, 2) Source(155, 1) + SourceIndex(0) -4 >Emitted(137, 6) Source(155, 56) + SourceIndex(0) +1 >Emitted(99, 1) Source(155, 55) + SourceIndex(0) name (C11t5) +2 >Emitted(99, 2) Source(155, 56) + SourceIndex(0) name (C11t5) +3 >Emitted(99, 2) Source(155, 1) + SourceIndex(0) +4 >Emitted(99, 6) Source(155, 56) + SourceIndex(0) --- >>>; 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 >; -1 >Emitted(138, 1) Source(155, 56) + SourceIndex(0) -2 >Emitted(138, 2) Source(155, 57) + SourceIndex(0) +1 >Emitted(100, 1) Source(155, 56) + SourceIndex(0) +2 >Emitted(100, 2) Source(155, 57) + SourceIndex(0) --- ->>>var i = new C11t5(function (n) { +>>>var i = new C11t5(function (n) { return ({}); }); 1-> 2 >^^^^ 3 > ^ @@ -2538,6 +2451,17 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^^^^^^^^^ 9 > ^ +10> ^^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^ +20> ^ 1-> > 2 >var @@ -2548,138 +2472,118 @@ sourceFile:contextualTyping.ts 7 > ( 8 > function( 9 > n -1->Emitted(139, 1) Source(156, 1) + SourceIndex(0) -2 >Emitted(139, 5) Source(156, 5) + SourceIndex(0) -3 >Emitted(139, 6) Source(156, 6) + SourceIndex(0) -4 >Emitted(139, 9) Source(156, 9) + SourceIndex(0) -5 >Emitted(139, 13) Source(156, 13) + SourceIndex(0) -6 >Emitted(139, 18) Source(156, 18) + SourceIndex(0) -7 >Emitted(139, 19) Source(156, 19) + SourceIndex(0) -8 >Emitted(139, 29) Source(156, 28) + SourceIndex(0) -9 >Emitted(139, 30) Source(156, 29) + SourceIndex(0) ---- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(140, 5) Source(156, 33) + SourceIndex(0) -2 >Emitted(140, 11) Source(156, 39) + SourceIndex(0) -3 >Emitted(140, 12) Source(156, 46) + SourceIndex(0) -4 >Emitted(140, 13) Source(156, 47) + SourceIndex(0) -5 >Emitted(140, 15) Source(156, 49) + SourceIndex(0) -6 >Emitted(140, 16) Source(156, 50) + SourceIndex(0) -7 >Emitted(140, 17) Source(156, 50) + SourceIndex(0) ---- ->>>}); -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ) -4 > ; -1 >Emitted(141, 1) Source(156, 51) + SourceIndex(0) -2 >Emitted(141, 2) Source(156, 52) + SourceIndex(0) -3 >Emitted(141, 3) Source(156, 53) + SourceIndex(0) -4 >Emitted(141, 4) Source(156, 54) + SourceIndex(0) +10> ) { +11> return +12> +13> ( +14> {} +15> ) +16> +17> +18> } +19> ) +20> ; +1->Emitted(101, 1) Source(156, 1) + SourceIndex(0) +2 >Emitted(101, 5) Source(156, 5) + SourceIndex(0) +3 >Emitted(101, 6) Source(156, 6) + SourceIndex(0) +4 >Emitted(101, 9) Source(156, 9) + SourceIndex(0) +5 >Emitted(101, 13) Source(156, 13) + SourceIndex(0) +6 >Emitted(101, 18) Source(156, 18) + SourceIndex(0) +7 >Emitted(101, 19) Source(156, 19) + SourceIndex(0) +8 >Emitted(101, 29) Source(156, 28) + SourceIndex(0) +9 >Emitted(101, 30) Source(156, 29) + SourceIndex(0) +10>Emitted(101, 34) Source(156, 33) + SourceIndex(0) +11>Emitted(101, 40) Source(156, 39) + SourceIndex(0) +12>Emitted(101, 41) Source(156, 46) + SourceIndex(0) +13>Emitted(101, 42) Source(156, 47) + SourceIndex(0) +14>Emitted(101, 44) Source(156, 49) + SourceIndex(0) +15>Emitted(101, 45) Source(156, 50) + SourceIndex(0) +16>Emitted(101, 46) Source(156, 50) + SourceIndex(0) +17>Emitted(101, 47) Source(156, 51) + SourceIndex(0) +18>Emitted(101, 48) Source(156, 52) + SourceIndex(0) +19>Emitted(101, 49) Source(156, 53) + SourceIndex(0) +20>Emitted(101, 50) Source(156, 54) + SourceIndex(0) --- >>>// CONTEXT: Type annotated expression -1-> +1 > 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1-> +4 > ^^^^^-> +1 > > >// CONTEXT: Type annotated expression > 2 > 3 >// CONTEXT: Type annotated expression -1->Emitted(142, 1) Source(159, 1) + SourceIndex(0) -2 >Emitted(142, 1) Source(158, 1) + SourceIndex(0) -3 >Emitted(142, 38) Source(158, 38) + SourceIndex(0) +1 >Emitted(102, 1) Source(159, 1) + SourceIndex(0) +2 >Emitted(102, 1) Source(158, 1) + SourceIndex(0) +3 >Emitted(102, 38) Source(158, 38) + SourceIndex(0) --- ->>>var c12t1 = (function (s) { -1 >^^^^ +>>>var c12t1 = (function (s) { return s; }); +1->^^^^ 2 > ^^^^^ 3 > ^^^ 4 > ^ 5 > ^^^^^^^^^^ 6 > ^ -1 > +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +1-> >var 2 > c12t1 3 > = <(s: string) => string> 4 > ( 5 > function( 6 > s -1 >Emitted(143, 5) Source(159, 5) + SourceIndex(0) -2 >Emitted(143, 10) Source(159, 10) + SourceIndex(0) -3 >Emitted(143, 13) Source(159, 37) + SourceIndex(0) -4 >Emitted(143, 14) Source(159, 38) + SourceIndex(0) -5 >Emitted(143, 24) Source(159, 47) + SourceIndex(0) -6 >Emitted(143, 25) Source(159, 48) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > -1 >Emitted(144, 5) Source(159, 52) + SourceIndex(0) -2 >Emitted(144, 11) Source(159, 58) + SourceIndex(0) -3 >Emitted(144, 12) Source(159, 59) + SourceIndex(0) -4 >Emitted(144, 13) Source(159, 60) + SourceIndex(0) -5 >Emitted(144, 14) Source(159, 60) + SourceIndex(0) ---- ->>>}); -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > ) -4 > ; -1 >Emitted(145, 1) Source(159, 61) + SourceIndex(0) -2 >Emitted(145, 2) Source(159, 62) + SourceIndex(0) -3 >Emitted(145, 3) Source(159, 63) + SourceIndex(0) -4 >Emitted(145, 4) Source(159, 64) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> s +11> +12> +13> } +14> ) +15> ; +1->Emitted(103, 5) Source(159, 5) + SourceIndex(0) +2 >Emitted(103, 10) Source(159, 10) + SourceIndex(0) +3 >Emitted(103, 13) Source(159, 37) + SourceIndex(0) +4 >Emitted(103, 14) Source(159, 38) + SourceIndex(0) +5 >Emitted(103, 24) Source(159, 47) + SourceIndex(0) +6 >Emitted(103, 25) Source(159, 48) + SourceIndex(0) +7 >Emitted(103, 29) Source(159, 52) + SourceIndex(0) +8 >Emitted(103, 35) Source(159, 58) + SourceIndex(0) +9 >Emitted(103, 36) Source(159, 59) + SourceIndex(0) +10>Emitted(103, 37) Source(159, 60) + SourceIndex(0) +11>Emitted(103, 38) Source(159, 60) + SourceIndex(0) +12>Emitted(103, 39) Source(159, 61) + SourceIndex(0) +13>Emitted(103, 40) Source(159, 62) + SourceIndex(0) +14>Emitted(103, 41) Source(159, 63) + SourceIndex(0) +15>Emitted(103, 42) Source(159, 64) + SourceIndex(0) --- >>>var c12t2 = ({ -1-> +1 > 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^ -1-> +1 > > 2 >var 3 > c12t2 4 > = 5 > ( -1->Emitted(146, 1) Source(160, 1) + SourceIndex(0) -2 >Emitted(146, 5) Source(160, 5) + SourceIndex(0) -3 >Emitted(146, 10) Source(160, 10) + SourceIndex(0) -4 >Emitted(146, 13) Source(160, 20) + SourceIndex(0) -5 >Emitted(146, 14) Source(160, 21) + SourceIndex(0) +1 >Emitted(104, 1) Source(160, 1) + SourceIndex(0) +2 >Emitted(104, 5) Source(160, 5) + SourceIndex(0) +3 >Emitted(104, 10) Source(160, 10) + SourceIndex(0) +4 >Emitted(104, 13) Source(160, 20) + SourceIndex(0) +5 >Emitted(104, 14) Source(160, 21) + SourceIndex(0) --- >>> n: 1 1 >^^^^ @@ -2691,10 +2595,10 @@ sourceFile:contextualTyping.ts 2 > n 3 > : 4 > 1 -1 >Emitted(147, 5) Source(161, 5) + SourceIndex(0) -2 >Emitted(147, 6) Source(161, 6) + SourceIndex(0) -3 >Emitted(147, 8) Source(161, 8) + SourceIndex(0) -4 >Emitted(147, 9) Source(161, 9) + SourceIndex(0) +1 >Emitted(105, 5) Source(161, 5) + SourceIndex(0) +2 >Emitted(105, 6) Source(161, 6) + SourceIndex(0) +3 >Emitted(105, 8) Source(161, 8) + SourceIndex(0) +4 >Emitted(105, 9) Source(161, 9) + SourceIndex(0) --- >>>}); 1 >^ @@ -2705,9 +2609,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > ; -1 >Emitted(148, 2) Source(162, 2) + SourceIndex(0) -2 >Emitted(148, 3) Source(162, 3) + SourceIndex(0) -3 >Emitted(148, 4) Source(162, 4) + SourceIndex(0) +1 >Emitted(106, 2) Source(162, 2) + SourceIndex(0) +2 >Emitted(106, 3) Source(162, 3) + SourceIndex(0) +3 >Emitted(106, 4) Source(162, 4) + SourceIndex(0) --- >>>var c12t3 = []; 1-> @@ -2716,7 +2620,7 @@ sourceFile:contextualTyping.ts 4 > ^^^ 5 > ^^ 6 > ^ -7 > ^^^^^^^^^^^-> +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -2724,71 +2628,77 @@ sourceFile:contextualTyping.ts 4 > = 5 > [] 6 > ; -1->Emitted(149, 1) Source(163, 1) + SourceIndex(0) -2 >Emitted(149, 5) Source(163, 5) + SourceIndex(0) -3 >Emitted(149, 10) Source(163, 10) + SourceIndex(0) -4 >Emitted(149, 13) Source(163, 24) + SourceIndex(0) -5 >Emitted(149, 15) Source(163, 26) + SourceIndex(0) -6 >Emitted(149, 16) Source(163, 27) + SourceIndex(0) +1->Emitted(107, 1) Source(163, 1) + SourceIndex(0) +2 >Emitted(107, 5) Source(163, 5) + SourceIndex(0) +3 >Emitted(107, 10) Source(163, 10) + SourceIndex(0) +4 >Emitted(107, 13) Source(163, 24) + SourceIndex(0) +5 >Emitted(107, 15) Source(163, 26) + SourceIndex(0) +6 >Emitted(107, 16) Source(163, 27) + SourceIndex(0) --- ->>>var c12t4 = function () { +>>>var c12t4 = function () { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ -5 > ^^^^^-> +5 > ^^^^^^^^^^^^^^ +6 > ^^^^^^ +7 > ^ +8 > ^ +9 > ^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^^-> 1-> > 2 >var 3 > c12t4 4 > = <() => IFoo> -1->Emitted(150, 1) Source(164, 1) + SourceIndex(0) -2 >Emitted(150, 5) Source(164, 5) + SourceIndex(0) -3 >Emitted(150, 10) Source(164, 10) + SourceIndex(0) -4 >Emitted(150, 13) Source(164, 26) + SourceIndex(0) +5 > function() { +6 > return +7 > +8 > ( +9 > {} +10> ) +11> +12> +13> } +14> ; +1->Emitted(108, 1) Source(164, 1) + SourceIndex(0) +2 >Emitted(108, 5) Source(164, 5) + SourceIndex(0) +3 >Emitted(108, 10) Source(164, 10) + SourceIndex(0) +4 >Emitted(108, 13) Source(164, 26) + SourceIndex(0) +5 >Emitted(108, 27) Source(164, 39) + SourceIndex(0) +6 >Emitted(108, 33) Source(164, 45) + SourceIndex(0) +7 >Emitted(108, 34) Source(164, 52) + SourceIndex(0) +8 >Emitted(108, 35) Source(164, 53) + SourceIndex(0) +9 >Emitted(108, 37) Source(164, 55) + SourceIndex(0) +10>Emitted(108, 38) Source(164, 56) + SourceIndex(0) +11>Emitted(108, 39) Source(164, 56) + SourceIndex(0) +12>Emitted(108, 40) Source(164, 57) + SourceIndex(0) +13>Emitted(108, 41) Source(164, 58) + SourceIndex(0) +14>Emitted(108, 42) Source(164, 59) + SourceIndex(0) --- ->>> return ({}); -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1->function() { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1->Emitted(151, 5) Source(164, 39) + SourceIndex(0) -2 >Emitted(151, 11) Source(164, 45) + SourceIndex(0) -3 >Emitted(151, 12) Source(164, 52) + SourceIndex(0) -4 >Emitted(151, 13) Source(164, 53) + SourceIndex(0) -5 >Emitted(151, 15) Source(164, 55) + SourceIndex(0) -6 >Emitted(151, 16) Source(164, 56) + SourceIndex(0) -7 >Emitted(151, 17) Source(164, 56) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(152, 1) Source(164, 57) + SourceIndex(0) -2 >Emitted(152, 2) Source(164, 58) + SourceIndex(0) -3 >Emitted(152, 3) Source(164, 59) + SourceIndex(0) ---- ->>>var c12t5 = function (n) { +>>>var c12t5 = function (n) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^^^^-> 1-> > 2 >var @@ -2796,49 +2706,34 @@ sourceFile:contextualTyping.ts 4 > = <(n: number) => IFoo> 5 > function( 6 > n -1->Emitted(153, 1) Source(165, 1) + SourceIndex(0) -2 >Emitted(153, 5) Source(165, 5) + SourceIndex(0) -3 >Emitted(153, 10) Source(165, 10) + SourceIndex(0) -4 >Emitted(153, 13) Source(165, 35) + SourceIndex(0) -5 >Emitted(153, 23) Source(165, 44) + SourceIndex(0) -6 >Emitted(153, 24) Source(165, 45) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> ( +11> {} +12> ) +13> +14> +15> } +16> ; +1->Emitted(109, 1) Source(165, 1) + SourceIndex(0) +2 >Emitted(109, 5) Source(165, 5) + SourceIndex(0) +3 >Emitted(109, 10) Source(165, 10) + SourceIndex(0) +4 >Emitted(109, 13) Source(165, 35) + SourceIndex(0) +5 >Emitted(109, 23) Source(165, 44) + SourceIndex(0) +6 >Emitted(109, 24) Source(165, 45) + SourceIndex(0) +7 >Emitted(109, 28) Source(165, 49) + SourceIndex(0) +8 >Emitted(109, 34) Source(165, 55) + SourceIndex(0) +9 >Emitted(109, 35) Source(165, 62) + SourceIndex(0) +10>Emitted(109, 36) Source(165, 63) + SourceIndex(0) +11>Emitted(109, 38) Source(165, 65) + SourceIndex(0) +12>Emitted(109, 39) Source(165, 66) + SourceIndex(0) +13>Emitted(109, 40) Source(165, 66) + SourceIndex(0) +14>Emitted(109, 41) Source(165, 67) + SourceIndex(0) +15>Emitted(109, 42) Source(165, 68) + SourceIndex(0) +16>Emitted(109, 43) Source(165, 69) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(154, 5) Source(165, 49) + SourceIndex(0) -2 >Emitted(154, 11) Source(165, 55) + SourceIndex(0) -3 >Emitted(154, 12) Source(165, 62) + SourceIndex(0) -4 >Emitted(154, 13) Source(165, 63) + SourceIndex(0) -5 >Emitted(154, 15) Source(165, 65) + SourceIndex(0) -6 >Emitted(154, 16) Source(165, 66) + SourceIndex(0) -7 >Emitted(154, 17) Source(165, 66) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(155, 1) Source(165, 67) + SourceIndex(0) -2 >Emitted(155, 2) Source(165, 68) + SourceIndex(0) -3 >Emitted(155, 3) Source(165, 69) + SourceIndex(0) ---- ->>>var c12t6 = function (n, s) { +>>>var c12t6 = function (n, s) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^^ @@ -2847,6 +2742,16 @@ sourceFile:contextualTyping.ts 6 > ^ 7 > ^^ 8 > ^ +9 > ^^^^ +10> ^^^^^^ +11> ^ +12> ^ +13> ^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ 1-> > 2 >var @@ -2856,58 +2761,52 @@ sourceFile:contextualTyping.ts 6 > n 7 > , 8 > s -1->Emitted(156, 1) Source(166, 1) + SourceIndex(0) -2 >Emitted(156, 5) Source(166, 5) + SourceIndex(0) -3 >Emitted(156, 10) Source(166, 10) + SourceIndex(0) -4 >Emitted(156, 13) Source(166, 46) + SourceIndex(0) -5 >Emitted(156, 23) Source(166, 55) + SourceIndex(0) -6 >Emitted(156, 24) Source(166, 56) + SourceIndex(0) -7 >Emitted(156, 26) Source(166, 58) + SourceIndex(0) -8 >Emitted(156, 27) Source(166, 59) + SourceIndex(0) +9 > ) { +10> return +11> +12> ( +13> {} +14> ) +15> +16> +17> } +18> ; +1->Emitted(110, 1) Source(166, 1) + SourceIndex(0) +2 >Emitted(110, 5) Source(166, 5) + SourceIndex(0) +3 >Emitted(110, 10) Source(166, 10) + SourceIndex(0) +4 >Emitted(110, 13) Source(166, 46) + SourceIndex(0) +5 >Emitted(110, 23) Source(166, 55) + SourceIndex(0) +6 >Emitted(110, 24) Source(166, 56) + SourceIndex(0) +7 >Emitted(110, 26) Source(166, 58) + SourceIndex(0) +8 >Emitted(110, 27) Source(166, 59) + SourceIndex(0) +9 >Emitted(110, 31) Source(166, 63) + SourceIndex(0) +10>Emitted(110, 37) Source(166, 69) + SourceIndex(0) +11>Emitted(110, 38) Source(166, 76) + SourceIndex(0) +12>Emitted(110, 39) Source(166, 77) + SourceIndex(0) +13>Emitted(110, 41) Source(166, 79) + SourceIndex(0) +14>Emitted(110, 42) Source(166, 80) + SourceIndex(0) +15>Emitted(110, 43) Source(166, 80) + SourceIndex(0) +16>Emitted(110, 44) Source(166, 81) + SourceIndex(0) +17>Emitted(110, 45) Source(166, 82) + SourceIndex(0) +18>Emitted(110, 46) Source(166, 83) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(157, 5) Source(166, 63) + SourceIndex(0) -2 >Emitted(157, 11) Source(166, 69) + SourceIndex(0) -3 >Emitted(157, 12) Source(166, 76) + SourceIndex(0) -4 >Emitted(157, 13) Source(166, 77) + SourceIndex(0) -5 >Emitted(157, 15) Source(166, 79) + SourceIndex(0) -6 >Emitted(157, 16) Source(166, 80) + SourceIndex(0) -7 >Emitted(157, 17) Source(166, 80) + SourceIndex(0) ---- ->>>}; +>>>var c12t7 = function (n) { return n; }; 1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(158, 1) Source(166, 81) + SourceIndex(0) -2 >Emitted(158, 2) Source(166, 82) + SourceIndex(0) -3 >Emitted(158, 3) Source(166, 83) + SourceIndex(0) ---- ->>>var c12t7 = function (n) { -1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ -1-> +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^-> +1 > > 2 >var 3 > c12t7 @@ -2917,49 +2816,44 @@ sourceFile:contextualTyping.ts > }> 5 > function( 6 > n:number -1->Emitted(159, 1) Source(167, 1) + SourceIndex(0) -2 >Emitted(159, 5) Source(167, 5) + SourceIndex(0) -3 >Emitted(159, 10) Source(167, 10) + SourceIndex(0) -4 >Emitted(159, 13) Source(170, 4) + SourceIndex(0) -5 >Emitted(159, 23) Source(170, 13) + SourceIndex(0) -6 >Emitted(159, 24) Source(170, 21) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> n +11> +12> +13> } +14> ; +1 >Emitted(111, 1) Source(167, 1) + SourceIndex(0) +2 >Emitted(111, 5) Source(167, 5) + SourceIndex(0) +3 >Emitted(111, 10) Source(167, 10) + SourceIndex(0) +4 >Emitted(111, 13) Source(170, 4) + SourceIndex(0) +5 >Emitted(111, 23) Source(170, 13) + SourceIndex(0) +6 >Emitted(111, 24) Source(170, 21) + SourceIndex(0) +7 >Emitted(111, 28) Source(170, 25) + SourceIndex(0) +8 >Emitted(111, 34) Source(170, 31) + SourceIndex(0) +9 >Emitted(111, 35) Source(170, 32) + SourceIndex(0) +10>Emitted(111, 36) Source(170, 33) + SourceIndex(0) +11>Emitted(111, 37) Source(170, 33) + SourceIndex(0) +12>Emitted(111, 38) Source(170, 34) + SourceIndex(0) +13>Emitted(111, 39) Source(170, 35) + SourceIndex(0) +14>Emitted(111, 40) Source(170, 36) + SourceIndex(0) --- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > -1 >Emitted(160, 5) Source(170, 25) + SourceIndex(0) -2 >Emitted(160, 11) Source(170, 31) + SourceIndex(0) -3 >Emitted(160, 12) Source(170, 32) + SourceIndex(0) -4 >Emitted(160, 13) Source(170, 33) + SourceIndex(0) -5 >Emitted(160, 14) Source(170, 33) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(161, 1) Source(170, 34) + SourceIndex(0) -2 >Emitted(161, 2) Source(170, 35) + SourceIndex(0) -3 >Emitted(161, 3) Source(170, 36) + SourceIndex(0) ---- ->>>var c12t8 = function (n) { +>>>var c12t8 = function (n) { return n; }; 1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1-> > > @@ -2968,44 +2862,31 @@ sourceFile:contextualTyping.ts 4 > = <(n: number, s: string) => number> 5 > function( 6 > n -1->Emitted(162, 1) Source(172, 1) + SourceIndex(0) -2 >Emitted(162, 5) Source(172, 5) + SourceIndex(0) -3 >Emitted(162, 10) Source(172, 10) + SourceIndex(0) -4 >Emitted(162, 13) Source(172, 48) + SourceIndex(0) -5 >Emitted(162, 23) Source(172, 57) + SourceIndex(0) -6 >Emitted(162, 24) Source(172, 58) + SourceIndex(0) ---- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > ; -1 >Emitted(163, 5) Source(172, 62) + SourceIndex(0) -2 >Emitted(163, 11) Source(172, 68) + SourceIndex(0) -3 >Emitted(163, 12) Source(172, 69) + SourceIndex(0) -4 >Emitted(163, 13) Source(172, 70) + SourceIndex(0) -5 >Emitted(163, 14) Source(172, 71) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(164, 1) Source(172, 72) + SourceIndex(0) -2 >Emitted(164, 2) Source(172, 73) + SourceIndex(0) -3 >Emitted(164, 3) Source(172, 74) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> n +11> ; +12> +13> } +14> ; +1->Emitted(112, 1) Source(172, 1) + SourceIndex(0) +2 >Emitted(112, 5) Source(172, 5) + SourceIndex(0) +3 >Emitted(112, 10) Source(172, 10) + SourceIndex(0) +4 >Emitted(112, 13) Source(172, 48) + SourceIndex(0) +5 >Emitted(112, 23) Source(172, 57) + SourceIndex(0) +6 >Emitted(112, 24) Source(172, 58) + SourceIndex(0) +7 >Emitted(112, 28) Source(172, 62) + SourceIndex(0) +8 >Emitted(112, 34) Source(172, 68) + SourceIndex(0) +9 >Emitted(112, 35) Source(172, 69) + SourceIndex(0) +10>Emitted(112, 36) Source(172, 70) + SourceIndex(0) +11>Emitted(112, 37) Source(172, 71) + SourceIndex(0) +12>Emitted(112, 38) Source(172, 72) + SourceIndex(0) +13>Emitted(112, 39) Source(172, 73) + SourceIndex(0) +14>Emitted(112, 40) Source(172, 74) + SourceIndex(0) --- >>>var c12t9 = [[], []]; -1-> +1 > 2 >^^^^ 3 > ^^^^^ 4 > ^^^ @@ -3016,7 +2897,7 @@ sourceFile:contextualTyping.ts 9 > ^ 10> ^ 11> ^^^^^^-> -1-> +1 > > 2 >var 3 > c12t9 @@ -3027,16 +2908,16 @@ sourceFile:contextualTyping.ts 8 > [] 9 > ] 10> ; -1->Emitted(165, 1) Source(173, 1) + SourceIndex(0) -2 >Emitted(165, 5) Source(173, 5) + SourceIndex(0) -3 >Emitted(165, 10) Source(173, 10) + SourceIndex(0) -4 >Emitted(165, 13) Source(173, 26) + SourceIndex(0) -5 >Emitted(165, 14) Source(173, 27) + SourceIndex(0) -6 >Emitted(165, 16) Source(173, 29) + SourceIndex(0) -7 >Emitted(165, 18) Source(173, 30) + SourceIndex(0) -8 >Emitted(165, 20) Source(173, 32) + SourceIndex(0) -9 >Emitted(165, 21) Source(173, 33) + SourceIndex(0) -10>Emitted(165, 22) Source(173, 34) + SourceIndex(0) +1 >Emitted(113, 1) Source(173, 1) + SourceIndex(0) +2 >Emitted(113, 5) Source(173, 5) + SourceIndex(0) +3 >Emitted(113, 10) Source(173, 10) + SourceIndex(0) +4 >Emitted(113, 13) Source(173, 26) + SourceIndex(0) +5 >Emitted(113, 14) Source(173, 27) + SourceIndex(0) +6 >Emitted(113, 16) Source(173, 29) + SourceIndex(0) +7 >Emitted(113, 18) Source(173, 30) + SourceIndex(0) +8 >Emitted(113, 20) Source(173, 32) + SourceIndex(0) +9 >Emitted(113, 21) Source(173, 33) + SourceIndex(0) +10>Emitted(113, 22) Source(173, 34) + SourceIndex(0) --- >>>var c12t10 = [({}), ({})]; 1-> @@ -3053,7 +2934,7 @@ sourceFile:contextualTyping.ts 12> ^ 13> ^ 14> ^ -15> ^^^^^^-> +15> ^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -3069,22 +2950,22 @@ sourceFile:contextualTyping.ts 12> ) 13> ] 14> ; -1->Emitted(166, 1) Source(174, 1) + SourceIndex(0) -2 >Emitted(166, 5) Source(174, 5) + SourceIndex(0) -3 >Emitted(166, 11) Source(174, 11) + SourceIndex(0) -4 >Emitted(166, 14) Source(174, 23) + SourceIndex(0) -5 >Emitted(166, 15) Source(174, 30) + SourceIndex(0) -6 >Emitted(166, 16) Source(174, 31) + SourceIndex(0) -7 >Emitted(166, 18) Source(174, 33) + SourceIndex(0) -8 >Emitted(166, 19) Source(174, 34) + SourceIndex(0) -9 >Emitted(166, 21) Source(174, 41) + SourceIndex(0) -10>Emitted(166, 22) Source(174, 42) + SourceIndex(0) -11>Emitted(166, 24) Source(174, 44) + SourceIndex(0) -12>Emitted(166, 25) Source(174, 45) + SourceIndex(0) -13>Emitted(166, 26) Source(174, 46) + SourceIndex(0) -14>Emitted(166, 27) Source(174, 47) + SourceIndex(0) +1->Emitted(114, 1) Source(174, 1) + SourceIndex(0) +2 >Emitted(114, 5) Source(174, 5) + SourceIndex(0) +3 >Emitted(114, 11) Source(174, 11) + SourceIndex(0) +4 >Emitted(114, 14) Source(174, 23) + SourceIndex(0) +5 >Emitted(114, 15) Source(174, 30) + SourceIndex(0) +6 >Emitted(114, 16) Source(174, 31) + SourceIndex(0) +7 >Emitted(114, 18) Source(174, 33) + SourceIndex(0) +8 >Emitted(114, 19) Source(174, 34) + SourceIndex(0) +9 >Emitted(114, 21) Source(174, 41) + SourceIndex(0) +10>Emitted(114, 22) Source(174, 42) + SourceIndex(0) +11>Emitted(114, 24) Source(174, 44) + SourceIndex(0) +12>Emitted(114, 25) Source(174, 45) + SourceIndex(0) +13>Emitted(114, 26) Source(174, 46) + SourceIndex(0) +14>Emitted(114, 27) Source(174, 47) + SourceIndex(0) --- ->>>var c12t11 = [function (n, s) { +>>>var c12t11 = [function (n, s) { return s; }]; 1-> 2 >^^^^ 3 > ^^^^^^ @@ -3094,6 +2975,15 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^ 9 > ^ +10> ^^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ 1-> > 2 >var @@ -3104,63 +2994,49 @@ sourceFile:contextualTyping.ts 7 > n 8 > , 9 > s -1->Emitted(167, 1) Source(175, 1) + SourceIndex(0) -2 >Emitted(167, 5) Source(175, 5) + SourceIndex(0) -3 >Emitted(167, 11) Source(175, 11) + SourceIndex(0) -4 >Emitted(167, 14) Source(175, 52) + SourceIndex(0) -5 >Emitted(167, 15) Source(175, 53) + SourceIndex(0) -6 >Emitted(167, 25) Source(175, 62) + SourceIndex(0) -7 >Emitted(167, 26) Source(175, 63) + SourceIndex(0) -8 >Emitted(167, 28) Source(175, 65) + SourceIndex(0) -9 >Emitted(167, 29) Source(175, 66) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(168, 5) Source(175, 70) + SourceIndex(0) -2 >Emitted(168, 11) Source(175, 76) + SourceIndex(0) -3 >Emitted(168, 12) Source(175, 77) + SourceIndex(0) -4 >Emitted(168, 13) Source(175, 78) + SourceIndex(0) -5 >Emitted(168, 14) Source(175, 79) + SourceIndex(0) ---- ->>>}]; -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > ] -4 > ; -1 >Emitted(169, 1) Source(175, 80) + SourceIndex(0) -2 >Emitted(169, 2) Source(175, 81) + SourceIndex(0) -3 >Emitted(169, 3) Source(175, 82) + SourceIndex(0) -4 >Emitted(169, 4) Source(175, 83) + SourceIndex(0) +10> ) { +11> return +12> +13> s +14> ; +15> +16> } +17> ] +18> ; +1->Emitted(115, 1) Source(175, 1) + SourceIndex(0) +2 >Emitted(115, 5) Source(175, 5) + SourceIndex(0) +3 >Emitted(115, 11) Source(175, 11) + SourceIndex(0) +4 >Emitted(115, 14) Source(175, 52) + SourceIndex(0) +5 >Emitted(115, 15) Source(175, 53) + SourceIndex(0) +6 >Emitted(115, 25) Source(175, 62) + SourceIndex(0) +7 >Emitted(115, 26) Source(175, 63) + SourceIndex(0) +8 >Emitted(115, 28) Source(175, 65) + SourceIndex(0) +9 >Emitted(115, 29) Source(175, 66) + SourceIndex(0) +10>Emitted(115, 33) Source(175, 70) + SourceIndex(0) +11>Emitted(115, 39) Source(175, 76) + SourceIndex(0) +12>Emitted(115, 40) Source(175, 77) + SourceIndex(0) +13>Emitted(115, 41) Source(175, 78) + SourceIndex(0) +14>Emitted(115, 42) Source(175, 79) + SourceIndex(0) +15>Emitted(115, 43) Source(175, 80) + SourceIndex(0) +16>Emitted(115, 44) Source(175, 81) + SourceIndex(0) +17>Emitted(115, 45) Source(175, 82) + SourceIndex(0) +18>Emitted(115, 46) Source(175, 83) + SourceIndex(0) --- >>>var c12t12 = { -1-> +1 > 2 >^^^^ 3 > ^^^^^^ 4 > ^^^ 5 > ^-> -1-> +1 > > 2 >var 3 > c12t12 4 > = -1->Emitted(170, 1) Source(176, 1) + SourceIndex(0) -2 >Emitted(170, 5) Source(176, 5) + SourceIndex(0) -3 >Emitted(170, 11) Source(176, 11) + SourceIndex(0) -4 >Emitted(170, 14) Source(176, 21) + SourceIndex(0) +1 >Emitted(116, 1) Source(176, 1) + SourceIndex(0) +2 >Emitted(116, 5) Source(176, 5) + SourceIndex(0) +3 >Emitted(116, 11) Source(176, 11) + SourceIndex(0) +4 >Emitted(116, 14) Source(176, 21) + SourceIndex(0) --- >>> foo: ({}) 1->^^^^ @@ -3176,12 +3052,12 @@ sourceFile:contextualTyping.ts 4 > ( 5 > {} 6 > ) -1->Emitted(171, 5) Source(177, 5) + SourceIndex(0) -2 >Emitted(171, 8) Source(177, 8) + SourceIndex(0) -3 >Emitted(171, 10) Source(177, 16) + SourceIndex(0) -4 >Emitted(171, 11) Source(177, 17) + SourceIndex(0) -5 >Emitted(171, 13) Source(177, 19) + SourceIndex(0) -6 >Emitted(171, 14) Source(177, 20) + SourceIndex(0) +1->Emitted(117, 5) Source(177, 5) + SourceIndex(0) +2 >Emitted(117, 8) Source(177, 8) + SourceIndex(0) +3 >Emitted(117, 10) Source(177, 16) + SourceIndex(0) +4 >Emitted(117, 11) Source(177, 17) + SourceIndex(0) +5 >Emitted(117, 13) Source(177, 19) + SourceIndex(0) +6 >Emitted(117, 14) Source(177, 20) + SourceIndex(0) --- >>>}; 1 >^ @@ -3190,8 +3066,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > -1 >Emitted(172, 2) Source(178, 2) + SourceIndex(0) -2 >Emitted(172, 3) Source(178, 2) + SourceIndex(0) +1 >Emitted(118, 2) Source(178, 2) + SourceIndex(0) +2 >Emitted(118, 3) Source(178, 2) + SourceIndex(0) --- >>>var c12t13 = ({ 1-> @@ -3199,20 +3075,20 @@ sourceFile:contextualTyping.ts 3 > ^^^^^^ 4 > ^^^ 5 > ^ -6 > ^^^^^^^^^^^-> +6 > ^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var 3 > c12t13 4 > = 5 > ( -1->Emitted(173, 1) Source(179, 1) + SourceIndex(0) -2 >Emitted(173, 5) Source(179, 5) + SourceIndex(0) -3 >Emitted(173, 11) Source(179, 11) + SourceIndex(0) -4 >Emitted(173, 14) Source(179, 21) + SourceIndex(0) -5 >Emitted(173, 15) Source(179, 22) + SourceIndex(0) +1->Emitted(119, 1) Source(179, 1) + SourceIndex(0) +2 >Emitted(119, 5) Source(179, 5) + SourceIndex(0) +3 >Emitted(119, 11) Source(179, 11) + SourceIndex(0) +4 >Emitted(119, 14) Source(179, 21) + SourceIndex(0) +5 >Emitted(119, 15) Source(179, 22) + SourceIndex(0) --- ->>> f: function (i, s) { +>>> f: function (i, s) { return s; } 1->^^^^ 2 > ^ 3 > ^^ @@ -3220,6 +3096,13 @@ sourceFile:contextualTyping.ts 5 > ^ 6 > ^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1->{ > 2 > f @@ -3228,38 +3111,27 @@ sourceFile:contextualTyping.ts 5 > i 6 > , 7 > s -1->Emitted(174, 5) Source(180, 5) + SourceIndex(0) -2 >Emitted(174, 6) Source(180, 6) + SourceIndex(0) -3 >Emitted(174, 8) Source(180, 8) + SourceIndex(0) -4 >Emitted(174, 18) Source(180, 17) + SourceIndex(0) -5 >Emitted(174, 19) Source(180, 18) + SourceIndex(0) -6 >Emitted(174, 21) Source(180, 20) + SourceIndex(0) -7 >Emitted(174, 22) Source(180, 21) + SourceIndex(0) ---- ->>> return s; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(175, 9) Source(180, 25) + SourceIndex(0) -2 >Emitted(175, 15) Source(180, 31) + SourceIndex(0) -3 >Emitted(175, 16) Source(180, 32) + SourceIndex(0) -4 >Emitted(175, 17) Source(180, 33) + SourceIndex(0) -5 >Emitted(175, 18) Source(180, 34) + SourceIndex(0) ---- ->>> } -1 >^^^^ -2 > ^ -1 > -2 > } -1 >Emitted(176, 5) Source(180, 35) + SourceIndex(0) -2 >Emitted(176, 6) Source(180, 36) + SourceIndex(0) +8 > ) { +9 > return +10> +11> s +12> ; +13> +14> } +1->Emitted(120, 5) Source(180, 5) + SourceIndex(0) +2 >Emitted(120, 6) Source(180, 6) + SourceIndex(0) +3 >Emitted(120, 8) Source(180, 8) + SourceIndex(0) +4 >Emitted(120, 18) Source(180, 17) + SourceIndex(0) +5 >Emitted(120, 19) Source(180, 18) + SourceIndex(0) +6 >Emitted(120, 21) Source(180, 20) + SourceIndex(0) +7 >Emitted(120, 22) Source(180, 21) + SourceIndex(0) +8 >Emitted(120, 26) Source(180, 25) + SourceIndex(0) +9 >Emitted(120, 32) Source(180, 31) + SourceIndex(0) +10>Emitted(120, 33) Source(180, 32) + SourceIndex(0) +11>Emitted(120, 34) Source(180, 33) + SourceIndex(0) +12>Emitted(120, 35) Source(180, 34) + SourceIndex(0) +13>Emitted(120, 36) Source(180, 35) + SourceIndex(0) +14>Emitted(120, 37) Source(180, 36) + SourceIndex(0) --- >>>}); 1 >^ @@ -3270,9 +3142,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(177, 2) Source(181, 2) + SourceIndex(0) -2 >Emitted(177, 3) Source(181, 3) + SourceIndex(0) -3 >Emitted(177, 4) Source(181, 3) + SourceIndex(0) +1 >Emitted(121, 2) Source(181, 2) + SourceIndex(0) +2 >Emitted(121, 3) Source(181, 3) + SourceIndex(0) +3 >Emitted(121, 4) Source(181, 3) + SourceIndex(0) --- >>>var c12t14 = ({ 1-> @@ -3286,11 +3158,11 @@ sourceFile:contextualTyping.ts 3 > c12t14 4 > = 5 > ( -1->Emitted(178, 1) Source(182, 1) + SourceIndex(0) -2 >Emitted(178, 5) Source(182, 5) + SourceIndex(0) -3 >Emitted(178, 11) Source(182, 11) + SourceIndex(0) -4 >Emitted(178, 14) Source(182, 21) + SourceIndex(0) -5 >Emitted(178, 15) Source(182, 22) + SourceIndex(0) +1->Emitted(122, 1) Source(182, 1) + SourceIndex(0) +2 >Emitted(122, 5) Source(182, 5) + SourceIndex(0) +3 >Emitted(122, 11) Source(182, 11) + SourceIndex(0) +4 >Emitted(122, 14) Source(182, 21) + SourceIndex(0) +5 >Emitted(122, 15) Source(182, 22) + SourceIndex(0) --- >>> a: [] 1 >^^^^ @@ -3302,25 +3174,25 @@ sourceFile:contextualTyping.ts 2 > a 3 > : 4 > [] -1 >Emitted(179, 5) Source(183, 5) + SourceIndex(0) -2 >Emitted(179, 6) Source(183, 6) + SourceIndex(0) -3 >Emitted(179, 8) Source(183, 8) + SourceIndex(0) -4 >Emitted(179, 10) Source(183, 10) + SourceIndex(0) +1 >Emitted(123, 5) Source(183, 5) + SourceIndex(0) +2 >Emitted(123, 6) Source(183, 6) + SourceIndex(0) +3 >Emitted(123, 8) Source(183, 8) + SourceIndex(0) +4 >Emitted(123, 10) Source(183, 10) + SourceIndex(0) --- >>>}); 1 >^ 2 > ^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >} 2 > ) 3 > -1 >Emitted(180, 2) Source(184, 2) + SourceIndex(0) -2 >Emitted(180, 3) Source(184, 3) + SourceIndex(0) -3 >Emitted(180, 4) Source(184, 3) + SourceIndex(0) +1 >Emitted(124, 2) Source(184, 2) + SourceIndex(0) +2 >Emitted(124, 3) Source(184, 3) + SourceIndex(0) +3 >Emitted(124, 4) Source(184, 3) + SourceIndex(0) --- ->>>function EF1(a, b) { +>>>function EF1(a, b) { return a + b; } 1-> 2 >^^^^^^^^^ 3 > ^^^ @@ -3328,7 +3200,15 @@ sourceFile:contextualTyping.ts 5 > ^ 6 > ^^ 7 > ^ -8 > ^-> +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^^^ +13> ^ +14> ^ +15> ^ +16> ^ 1-> > >// CONTEXT: Contextual typing declarations @@ -3343,48 +3223,34 @@ sourceFile:contextualTyping.ts 5 > a 6 > , 7 > b -1->Emitted(181, 1) Source(191, 1) + SourceIndex(0) -2 >Emitted(181, 10) Source(191, 10) + SourceIndex(0) -3 >Emitted(181, 13) Source(191, 13) + SourceIndex(0) -4 >Emitted(181, 14) Source(191, 14) + SourceIndex(0) -5 >Emitted(181, 15) Source(191, 15) + SourceIndex(0) -6 >Emitted(181, 17) Source(191, 16) + SourceIndex(0) -7 >Emitted(181, 18) Source(191, 17) + SourceIndex(0) ---- ->>> return a + b; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^^ -6 > ^ -7 > ^ -1->) { -2 > return -3 > -4 > a -5 > + -6 > b -7 > ; -1->Emitted(182, 5) Source(191, 21) + SourceIndex(0) name (EF1) -2 >Emitted(182, 11) Source(191, 27) + SourceIndex(0) name (EF1) -3 >Emitted(182, 12) Source(191, 28) + SourceIndex(0) name (EF1) -4 >Emitted(182, 13) Source(191, 29) + SourceIndex(0) name (EF1) -5 >Emitted(182, 16) Source(191, 30) + SourceIndex(0) name (EF1) -6 >Emitted(182, 17) Source(191, 31) + SourceIndex(0) name (EF1) -7 >Emitted(182, 18) Source(191, 32) + SourceIndex(0) name (EF1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -1 >Emitted(183, 1) Source(191, 33) + SourceIndex(0) name (EF1) -2 >Emitted(183, 2) Source(191, 34) + SourceIndex(0) name (EF1) +8 > ) { +9 > return +10> +11> a +12> + +13> b +14> ; +15> +16> } +1->Emitted(125, 1) Source(191, 1) + SourceIndex(0) +2 >Emitted(125, 10) Source(191, 10) + SourceIndex(0) +3 >Emitted(125, 13) Source(191, 13) + SourceIndex(0) +4 >Emitted(125, 14) Source(191, 14) + SourceIndex(0) +5 >Emitted(125, 15) Source(191, 15) + SourceIndex(0) +6 >Emitted(125, 17) Source(191, 16) + SourceIndex(0) +7 >Emitted(125, 18) Source(191, 17) + SourceIndex(0) +8 >Emitted(125, 22) Source(191, 21) + SourceIndex(0) name (EF1) +9 >Emitted(125, 28) Source(191, 27) + SourceIndex(0) name (EF1) +10>Emitted(125, 29) Source(191, 28) + SourceIndex(0) name (EF1) +11>Emitted(125, 30) Source(191, 29) + SourceIndex(0) name (EF1) +12>Emitted(125, 33) Source(191, 30) + SourceIndex(0) name (EF1) +13>Emitted(125, 34) Source(191, 31) + SourceIndex(0) name (EF1) +14>Emitted(125, 35) Source(191, 32) + SourceIndex(0) name (EF1) +15>Emitted(125, 36) Source(191, 33) + SourceIndex(0) name (EF1) +16>Emitted(125, 37) Source(191, 34) + SourceIndex(0) name (EF1) --- >>>var efv = EF1(1, 2); -1-> +1 > 2 >^^^^ 3 > ^^^ 4 > ^^^ @@ -3396,7 +3262,7 @@ sourceFile:contextualTyping.ts 10> ^ 11> ^ 12> ^^^-> -1-> +1 > > > 2 >var @@ -3409,17 +3275,17 @@ sourceFile:contextualTyping.ts 9 > 2 10> ) 11> ; -1->Emitted(184, 1) Source(193, 1) + SourceIndex(0) -2 >Emitted(184, 5) Source(193, 5) + SourceIndex(0) -3 >Emitted(184, 8) Source(193, 8) + SourceIndex(0) -4 >Emitted(184, 11) Source(193, 11) + SourceIndex(0) -5 >Emitted(184, 14) Source(193, 14) + SourceIndex(0) -6 >Emitted(184, 15) Source(193, 15) + SourceIndex(0) -7 >Emitted(184, 16) Source(193, 16) + SourceIndex(0) -8 >Emitted(184, 18) Source(193, 17) + SourceIndex(0) -9 >Emitted(184, 19) Source(193, 18) + SourceIndex(0) -10>Emitted(184, 20) Source(193, 19) + SourceIndex(0) -11>Emitted(184, 21) Source(193, 20) + SourceIndex(0) +1 >Emitted(126, 1) Source(193, 1) + SourceIndex(0) +2 >Emitted(126, 5) Source(193, 5) + SourceIndex(0) +3 >Emitted(126, 8) Source(193, 8) + SourceIndex(0) +4 >Emitted(126, 11) Source(193, 11) + SourceIndex(0) +5 >Emitted(126, 14) Source(193, 14) + SourceIndex(0) +6 >Emitted(126, 15) Source(193, 15) + SourceIndex(0) +7 >Emitted(126, 16) Source(193, 16) + SourceIndex(0) +8 >Emitted(126, 18) Source(193, 17) + SourceIndex(0) +9 >Emitted(126, 19) Source(193, 18) + SourceIndex(0) +10>Emitted(126, 20) Source(193, 19) + SourceIndex(0) +11>Emitted(126, 21) Source(193, 20) + SourceIndex(0) --- >>>function Point(x, y) { 1-> @@ -3450,13 +3316,13 @@ sourceFile:contextualTyping.ts 5 > x 6 > , 7 > y -1->Emitted(185, 1) Source(207, 1) + SourceIndex(0) -2 >Emitted(185, 10) Source(207, 10) + SourceIndex(0) -3 >Emitted(185, 15) Source(207, 15) + SourceIndex(0) -4 >Emitted(185, 16) Source(207, 16) + SourceIndex(0) -5 >Emitted(185, 17) Source(207, 17) + SourceIndex(0) -6 >Emitted(185, 19) Source(207, 19) + SourceIndex(0) -7 >Emitted(185, 20) Source(207, 20) + SourceIndex(0) +1->Emitted(127, 1) Source(207, 1) + SourceIndex(0) +2 >Emitted(127, 10) Source(207, 10) + SourceIndex(0) +3 >Emitted(127, 15) Source(207, 15) + SourceIndex(0) +4 >Emitted(127, 16) Source(207, 16) + SourceIndex(0) +5 >Emitted(127, 17) Source(207, 17) + SourceIndex(0) +6 >Emitted(127, 19) Source(207, 19) + SourceIndex(0) +7 >Emitted(127, 20) Source(207, 20) + SourceIndex(0) --- >>> this.x = x; 1 >^^^^ @@ -3475,13 +3341,13 @@ sourceFile:contextualTyping.ts 5 > = 6 > x 7 > ; -1 >Emitted(186, 5) Source(208, 5) + SourceIndex(0) name (Point) -2 >Emitted(186, 9) Source(208, 9) + SourceIndex(0) name (Point) -3 >Emitted(186, 10) Source(208, 10) + SourceIndex(0) name (Point) -4 >Emitted(186, 11) Source(208, 11) + SourceIndex(0) name (Point) -5 >Emitted(186, 14) Source(208, 14) + SourceIndex(0) name (Point) -6 >Emitted(186, 15) Source(208, 15) + SourceIndex(0) name (Point) -7 >Emitted(186, 16) Source(208, 16) + SourceIndex(0) name (Point) +1 >Emitted(128, 5) Source(208, 5) + SourceIndex(0) name (Point) +2 >Emitted(128, 9) Source(208, 9) + SourceIndex(0) name (Point) +3 >Emitted(128, 10) Source(208, 10) + SourceIndex(0) name (Point) +4 >Emitted(128, 11) Source(208, 11) + SourceIndex(0) name (Point) +5 >Emitted(128, 14) Source(208, 14) + SourceIndex(0) name (Point) +6 >Emitted(128, 15) Source(208, 15) + SourceIndex(0) name (Point) +7 >Emitted(128, 16) Source(208, 16) + SourceIndex(0) name (Point) --- >>> this.y = y; 1->^^^^ @@ -3500,13 +3366,13 @@ sourceFile:contextualTyping.ts 5 > = 6 > y 7 > ; -1->Emitted(187, 5) Source(209, 5) + SourceIndex(0) name (Point) -2 >Emitted(187, 9) Source(209, 9) + SourceIndex(0) name (Point) -3 >Emitted(187, 10) Source(209, 10) + SourceIndex(0) name (Point) -4 >Emitted(187, 11) Source(209, 11) + SourceIndex(0) name (Point) -5 >Emitted(187, 14) Source(209, 14) + SourceIndex(0) name (Point) -6 >Emitted(187, 15) Source(209, 15) + SourceIndex(0) name (Point) -7 >Emitted(187, 16) Source(209, 16) + SourceIndex(0) name (Point) +1->Emitted(129, 5) Source(209, 5) + SourceIndex(0) name (Point) +2 >Emitted(129, 9) Source(209, 9) + SourceIndex(0) name (Point) +3 >Emitted(129, 10) Source(209, 10) + SourceIndex(0) name (Point) +4 >Emitted(129, 11) Source(209, 11) + SourceIndex(0) name (Point) +5 >Emitted(129, 14) Source(209, 14) + SourceIndex(0) name (Point) +6 >Emitted(129, 15) Source(209, 15) + SourceIndex(0) name (Point) +7 >Emitted(129, 16) Source(209, 16) + SourceIndex(0) name (Point) --- >>> return this; 1->^^^^ @@ -3521,11 +3387,11 @@ sourceFile:contextualTyping.ts 3 > 4 > this 5 > ; -1->Emitted(188, 5) Source(211, 5) + SourceIndex(0) name (Point) -2 >Emitted(188, 11) Source(211, 11) + SourceIndex(0) name (Point) -3 >Emitted(188, 12) Source(211, 12) + SourceIndex(0) name (Point) -4 >Emitted(188, 16) Source(211, 16) + SourceIndex(0) name (Point) -5 >Emitted(188, 17) Source(211, 17) + SourceIndex(0) name (Point) +1->Emitted(130, 5) Source(211, 5) + SourceIndex(0) name (Point) +2 >Emitted(130, 11) Source(211, 11) + SourceIndex(0) name (Point) +3 >Emitted(130, 12) Source(211, 12) + SourceIndex(0) name (Point) +4 >Emitted(130, 16) Source(211, 16) + SourceIndex(0) name (Point) +5 >Emitted(130, 17) Source(211, 17) + SourceIndex(0) name (Point) --- >>>} 1 > @@ -3534,8 +3400,8 @@ sourceFile:contextualTyping.ts 1 > > 2 >} -1 >Emitted(189, 1) Source(212, 1) + SourceIndex(0) name (Point) -2 >Emitted(189, 2) Source(212, 2) + SourceIndex(0) name (Point) +1 >Emitted(131, 1) Source(212, 1) + SourceIndex(0) name (Point) +2 >Emitted(131, 2) Source(212, 2) + SourceIndex(0) name (Point) --- >>>Point.origin = new Point(0, 0); 1-> @@ -3567,19 +3433,19 @@ sourceFile:contextualTyping.ts 11> 0 12> ) 13> ; -1->Emitted(190, 1) Source(214, 1) + SourceIndex(0) -2 >Emitted(190, 6) Source(214, 6) + SourceIndex(0) -3 >Emitted(190, 7) Source(214, 7) + SourceIndex(0) -4 >Emitted(190, 13) Source(214, 13) + SourceIndex(0) -5 >Emitted(190, 16) Source(214, 16) + SourceIndex(0) -6 >Emitted(190, 20) Source(214, 20) + SourceIndex(0) -7 >Emitted(190, 25) Source(214, 25) + SourceIndex(0) -8 >Emitted(190, 26) Source(214, 26) + SourceIndex(0) -9 >Emitted(190, 27) Source(214, 27) + SourceIndex(0) -10>Emitted(190, 29) Source(214, 29) + SourceIndex(0) -11>Emitted(190, 30) Source(214, 30) + SourceIndex(0) -12>Emitted(190, 31) Source(214, 31) + SourceIndex(0) -13>Emitted(190, 32) Source(214, 32) + SourceIndex(0) +1->Emitted(132, 1) Source(214, 1) + SourceIndex(0) +2 >Emitted(132, 6) Source(214, 6) + SourceIndex(0) +3 >Emitted(132, 7) Source(214, 7) + SourceIndex(0) +4 >Emitted(132, 13) Source(214, 13) + SourceIndex(0) +5 >Emitted(132, 16) Source(214, 16) + SourceIndex(0) +6 >Emitted(132, 20) Source(214, 20) + SourceIndex(0) +7 >Emitted(132, 25) Source(214, 25) + SourceIndex(0) +8 >Emitted(132, 26) Source(214, 26) + SourceIndex(0) +9 >Emitted(132, 27) Source(214, 27) + SourceIndex(0) +10>Emitted(132, 29) Source(214, 29) + SourceIndex(0) +11>Emitted(132, 30) Source(214, 30) + SourceIndex(0) +12>Emitted(132, 31) Source(214, 31) + SourceIndex(0) +13>Emitted(132, 32) Source(214, 32) + SourceIndex(0) --- >>>Point.prototype.add = function (dx, dy) { 1-> @@ -3607,17 +3473,17 @@ sourceFile:contextualTyping.ts 9 > dx 10> , 11> dy -1->Emitted(191, 1) Source(216, 1) + SourceIndex(0) -2 >Emitted(191, 6) Source(216, 6) + SourceIndex(0) -3 >Emitted(191, 7) Source(216, 7) + SourceIndex(0) -4 >Emitted(191, 16) Source(216, 16) + SourceIndex(0) -5 >Emitted(191, 17) Source(216, 17) + SourceIndex(0) -6 >Emitted(191, 20) Source(216, 20) + SourceIndex(0) -7 >Emitted(191, 23) Source(216, 23) + SourceIndex(0) -8 >Emitted(191, 33) Source(216, 32) + SourceIndex(0) -9 >Emitted(191, 35) Source(216, 34) + SourceIndex(0) -10>Emitted(191, 37) Source(216, 36) + SourceIndex(0) -11>Emitted(191, 39) Source(216, 38) + SourceIndex(0) +1->Emitted(133, 1) Source(216, 1) + SourceIndex(0) +2 >Emitted(133, 6) Source(216, 6) + SourceIndex(0) +3 >Emitted(133, 7) Source(216, 7) + SourceIndex(0) +4 >Emitted(133, 16) Source(216, 16) + SourceIndex(0) +5 >Emitted(133, 17) Source(216, 17) + SourceIndex(0) +6 >Emitted(133, 20) Source(216, 20) + SourceIndex(0) +7 >Emitted(133, 23) Source(216, 23) + SourceIndex(0) +8 >Emitted(133, 33) Source(216, 32) + SourceIndex(0) +9 >Emitted(133, 35) Source(216, 34) + SourceIndex(0) +10>Emitted(133, 37) Source(216, 36) + SourceIndex(0) +11>Emitted(133, 39) Source(216, 38) + SourceIndex(0) --- >>> return new Point(this.x + dx, this.y + dy); 1->^^^^ @@ -3659,25 +3525,25 @@ sourceFile:contextualTyping.ts 17> dy 18> ) 19> ; -1->Emitted(192, 5) Source(217, 5) + SourceIndex(0) -2 >Emitted(192, 11) Source(217, 11) + SourceIndex(0) -3 >Emitted(192, 12) Source(217, 12) + SourceIndex(0) -4 >Emitted(192, 16) Source(217, 16) + SourceIndex(0) -5 >Emitted(192, 21) Source(217, 21) + SourceIndex(0) -6 >Emitted(192, 22) Source(217, 22) + SourceIndex(0) -7 >Emitted(192, 26) Source(217, 26) + SourceIndex(0) -8 >Emitted(192, 27) Source(217, 27) + SourceIndex(0) -9 >Emitted(192, 28) Source(217, 28) + SourceIndex(0) -10>Emitted(192, 31) Source(217, 31) + SourceIndex(0) -11>Emitted(192, 33) Source(217, 33) + SourceIndex(0) -12>Emitted(192, 35) Source(217, 35) + SourceIndex(0) -13>Emitted(192, 39) Source(217, 39) + SourceIndex(0) -14>Emitted(192, 40) Source(217, 40) + SourceIndex(0) -15>Emitted(192, 41) Source(217, 41) + SourceIndex(0) -16>Emitted(192, 44) Source(217, 44) + SourceIndex(0) -17>Emitted(192, 46) Source(217, 46) + SourceIndex(0) -18>Emitted(192, 47) Source(217, 47) + SourceIndex(0) -19>Emitted(192, 48) Source(217, 48) + SourceIndex(0) +1->Emitted(134, 5) Source(217, 5) + SourceIndex(0) +2 >Emitted(134, 11) Source(217, 11) + SourceIndex(0) +3 >Emitted(134, 12) Source(217, 12) + SourceIndex(0) +4 >Emitted(134, 16) Source(217, 16) + SourceIndex(0) +5 >Emitted(134, 21) Source(217, 21) + SourceIndex(0) +6 >Emitted(134, 22) Source(217, 22) + SourceIndex(0) +7 >Emitted(134, 26) Source(217, 26) + SourceIndex(0) +8 >Emitted(134, 27) Source(217, 27) + SourceIndex(0) +9 >Emitted(134, 28) Source(217, 28) + SourceIndex(0) +10>Emitted(134, 31) Source(217, 31) + SourceIndex(0) +11>Emitted(134, 33) Source(217, 33) + SourceIndex(0) +12>Emitted(134, 35) Source(217, 35) + SourceIndex(0) +13>Emitted(134, 39) Source(217, 39) + SourceIndex(0) +14>Emitted(134, 40) Source(217, 40) + SourceIndex(0) +15>Emitted(134, 41) Source(217, 41) + SourceIndex(0) +16>Emitted(134, 44) Source(217, 44) + SourceIndex(0) +17>Emitted(134, 46) Source(217, 46) + SourceIndex(0) +18>Emitted(134, 47) Source(217, 47) + SourceIndex(0) +19>Emitted(134, 48) Source(217, 48) + SourceIndex(0) --- >>>}; 1 > @@ -3688,9 +3554,9 @@ sourceFile:contextualTyping.ts > 2 >} 3 > ; -1 >Emitted(193, 1) Source(218, 1) + SourceIndex(0) -2 >Emitted(193, 2) Source(218, 2) + SourceIndex(0) -3 >Emitted(193, 3) Source(218, 3) + SourceIndex(0) +1 >Emitted(135, 1) Source(218, 1) + SourceIndex(0) +2 >Emitted(135, 2) Source(218, 2) + SourceIndex(0) +3 >Emitted(135, 3) Source(218, 3) + SourceIndex(0) --- >>>Point.prototype = { 1-> @@ -3705,11 +3571,11 @@ sourceFile:contextualTyping.ts 3 > . 4 > prototype 5 > = -1->Emitted(194, 1) Source(220, 1) + SourceIndex(0) -2 >Emitted(194, 6) Source(220, 6) + SourceIndex(0) -3 >Emitted(194, 7) Source(220, 7) + SourceIndex(0) -4 >Emitted(194, 16) Source(220, 16) + SourceIndex(0) -5 >Emitted(194, 19) Source(220, 19) + SourceIndex(0) +1->Emitted(136, 1) Source(220, 1) + SourceIndex(0) +2 >Emitted(136, 6) Source(220, 6) + SourceIndex(0) +3 >Emitted(136, 7) Source(220, 7) + SourceIndex(0) +4 >Emitted(136, 16) Source(220, 16) + SourceIndex(0) +5 >Emitted(136, 19) Source(220, 19) + SourceIndex(0) --- >>> x: 0, 1 >^^^^ @@ -3722,10 +3588,10 @@ sourceFile:contextualTyping.ts 2 > x 3 > : 4 > 0 -1 >Emitted(195, 5) Source(221, 5) + SourceIndex(0) -2 >Emitted(195, 6) Source(221, 6) + SourceIndex(0) -3 >Emitted(195, 8) Source(221, 8) + SourceIndex(0) -4 >Emitted(195, 9) Source(221, 9) + SourceIndex(0) +1 >Emitted(137, 5) Source(221, 5) + SourceIndex(0) +2 >Emitted(137, 6) Source(221, 6) + SourceIndex(0) +3 >Emitted(137, 8) Source(221, 8) + SourceIndex(0) +4 >Emitted(137, 9) Source(221, 9) + SourceIndex(0) --- >>> y: 0, 1->^^^^ @@ -3738,10 +3604,10 @@ sourceFile:contextualTyping.ts 2 > y 3 > : 4 > 0 -1->Emitted(196, 5) Source(222, 5) + SourceIndex(0) -2 >Emitted(196, 6) Source(222, 6) + SourceIndex(0) -3 >Emitted(196, 8) Source(222, 8) + SourceIndex(0) -4 >Emitted(196, 9) Source(222, 9) + SourceIndex(0) +1->Emitted(138, 5) Source(222, 5) + SourceIndex(0) +2 >Emitted(138, 6) Source(222, 6) + SourceIndex(0) +3 >Emitted(138, 8) Source(222, 8) + SourceIndex(0) +4 >Emitted(138, 9) Source(222, 9) + SourceIndex(0) --- >>> add: function (dx, dy) { 1->^^^^ @@ -3760,13 +3626,13 @@ sourceFile:contextualTyping.ts 5 > dx 6 > , 7 > dy -1->Emitted(197, 5) Source(223, 5) + SourceIndex(0) -2 >Emitted(197, 8) Source(223, 8) + SourceIndex(0) -3 >Emitted(197, 10) Source(223, 10) + SourceIndex(0) -4 >Emitted(197, 20) Source(223, 19) + SourceIndex(0) -5 >Emitted(197, 22) Source(223, 21) + SourceIndex(0) -6 >Emitted(197, 24) Source(223, 23) + SourceIndex(0) -7 >Emitted(197, 26) Source(223, 25) + SourceIndex(0) +1->Emitted(139, 5) Source(223, 5) + SourceIndex(0) +2 >Emitted(139, 8) Source(223, 8) + SourceIndex(0) +3 >Emitted(139, 10) Source(223, 10) + SourceIndex(0) +4 >Emitted(139, 20) Source(223, 19) + SourceIndex(0) +5 >Emitted(139, 22) Source(223, 21) + SourceIndex(0) +6 >Emitted(139, 24) Source(223, 23) + SourceIndex(0) +7 >Emitted(139, 26) Source(223, 25) + SourceIndex(0) --- >>> return new Point(this.x + dx, this.y + dy); 1->^^^^^^^^ @@ -3808,25 +3674,25 @@ sourceFile:contextualTyping.ts 17> dy 18> ) 19> ; -1->Emitted(198, 9) Source(224, 9) + SourceIndex(0) -2 >Emitted(198, 15) Source(224, 15) + SourceIndex(0) -3 >Emitted(198, 16) Source(224, 16) + SourceIndex(0) -4 >Emitted(198, 20) Source(224, 20) + SourceIndex(0) -5 >Emitted(198, 25) Source(224, 25) + SourceIndex(0) -6 >Emitted(198, 26) Source(224, 26) + SourceIndex(0) -7 >Emitted(198, 30) Source(224, 30) + SourceIndex(0) -8 >Emitted(198, 31) Source(224, 31) + SourceIndex(0) -9 >Emitted(198, 32) Source(224, 32) + SourceIndex(0) -10>Emitted(198, 35) Source(224, 35) + SourceIndex(0) -11>Emitted(198, 37) Source(224, 37) + SourceIndex(0) -12>Emitted(198, 39) Source(224, 39) + SourceIndex(0) -13>Emitted(198, 43) Source(224, 43) + SourceIndex(0) -14>Emitted(198, 44) Source(224, 44) + SourceIndex(0) -15>Emitted(198, 45) Source(224, 45) + SourceIndex(0) -16>Emitted(198, 48) Source(224, 48) + SourceIndex(0) -17>Emitted(198, 50) Source(224, 50) + SourceIndex(0) -18>Emitted(198, 51) Source(224, 51) + SourceIndex(0) -19>Emitted(198, 52) Source(224, 52) + SourceIndex(0) +1->Emitted(140, 9) Source(224, 9) + SourceIndex(0) +2 >Emitted(140, 15) Source(224, 15) + SourceIndex(0) +3 >Emitted(140, 16) Source(224, 16) + SourceIndex(0) +4 >Emitted(140, 20) Source(224, 20) + SourceIndex(0) +5 >Emitted(140, 25) Source(224, 25) + SourceIndex(0) +6 >Emitted(140, 26) Source(224, 26) + SourceIndex(0) +7 >Emitted(140, 30) Source(224, 30) + SourceIndex(0) +8 >Emitted(140, 31) Source(224, 31) + SourceIndex(0) +9 >Emitted(140, 32) Source(224, 32) + SourceIndex(0) +10>Emitted(140, 35) Source(224, 35) + SourceIndex(0) +11>Emitted(140, 37) Source(224, 37) + SourceIndex(0) +12>Emitted(140, 39) Source(224, 39) + SourceIndex(0) +13>Emitted(140, 43) Source(224, 43) + SourceIndex(0) +14>Emitted(140, 44) Source(224, 44) + SourceIndex(0) +15>Emitted(140, 45) Source(224, 45) + SourceIndex(0) +16>Emitted(140, 48) Source(224, 48) + SourceIndex(0) +17>Emitted(140, 50) Source(224, 50) + SourceIndex(0) +18>Emitted(140, 51) Source(224, 51) + SourceIndex(0) +19>Emitted(140, 52) Source(224, 52) + SourceIndex(0) --- >>> } 1 >^^^^ @@ -3834,8 +3700,8 @@ sourceFile:contextualTyping.ts 1 > > 2 > } -1 >Emitted(199, 5) Source(225, 5) + SourceIndex(0) -2 >Emitted(199, 6) Source(225, 6) + SourceIndex(0) +1 >Emitted(141, 5) Source(225, 5) + SourceIndex(0) +2 >Emitted(141, 6) Source(225, 6) + SourceIndex(0) --- >>>}; 1 >^ @@ -3844,8 +3710,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > ; -1 >Emitted(200, 2) Source(226, 2) + SourceIndex(0) -2 >Emitted(200, 3) Source(226, 3) + SourceIndex(0) +1 >Emitted(142, 2) Source(226, 2) + SourceIndex(0) +2 >Emitted(142, 3) Source(226, 3) + SourceIndex(0) --- >>>var x = {}; 1-> @@ -3865,11 +3731,11 @@ sourceFile:contextualTyping.ts 4 > : B = 5 > { } 6 > ; -1->Emitted(201, 1) Source(230, 1) + SourceIndex(0) -2 >Emitted(201, 5) Source(230, 5) + SourceIndex(0) -3 >Emitted(201, 6) Source(230, 6) + SourceIndex(0) -4 >Emitted(201, 9) Source(230, 12) + SourceIndex(0) -5 >Emitted(201, 11) Source(230, 15) + SourceIndex(0) -6 >Emitted(201, 12) Source(230, 16) + SourceIndex(0) +1->Emitted(143, 1) Source(230, 1) + SourceIndex(0) +2 >Emitted(143, 5) Source(230, 5) + SourceIndex(0) +3 >Emitted(143, 6) Source(230, 6) + SourceIndex(0) +4 >Emitted(143, 9) Source(230, 12) + SourceIndex(0) +5 >Emitted(143, 11) Source(230, 15) + SourceIndex(0) +6 >Emitted(143, 12) Source(230, 16) + SourceIndex(0) --- >>>//# sourceMappingURL=contextualTyping.js.map \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping13.js b/tests/baselines/reference/contextualTyping13.js index c035434342e..7965745b943 100644 --- a/tests/baselines/reference/contextualTyping13.js +++ b/tests/baselines/reference/contextualTyping13.js @@ -2,6 +2,4 @@ var foo:(a:number)=>number = function(a){return a}; //// [contextualTyping13.js] -var foo = function (a) { - return a; -}; +var foo = function (a) { return a; }; diff --git a/tests/baselines/reference/contextualTyping14.js b/tests/baselines/reference/contextualTyping14.js index ea9539ef41e..5bae8c948a2 100644 --- a/tests/baselines/reference/contextualTyping14.js +++ b/tests/baselines/reference/contextualTyping14.js @@ -4,9 +4,7 @@ class foo { public bar:(a:number)=>number = function(a){return a}; } //// [contextualTyping14.js] var foo = (function () { function foo() { - this.bar = function (a) { - return a; - }; + this.bar = function (a) { return a; }; } return foo; })(); diff --git a/tests/baselines/reference/contextualTyping15.js b/tests/baselines/reference/contextualTyping15.js index 99855681571..250076ec4d5 100644 --- a/tests/baselines/reference/contextualTyping15.js +++ b/tests/baselines/reference/contextualTyping15.js @@ -4,9 +4,7 @@ class foo { public bar: { (): number; (i: number): number; } = function() { retu //// [contextualTyping15.js] var foo = (function () { function foo() { - this.bar = function () { - return 1; - }; + this.bar = function () { return 1; }; } return foo; })(); diff --git a/tests/baselines/reference/contextualTyping22.js b/tests/baselines/reference/contextualTyping22.js index b8ebfd3ecb7..3c9a5cb4d3e 100644 --- a/tests/baselines/reference/contextualTyping22.js +++ b/tests/baselines/reference/contextualTyping22.js @@ -2,9 +2,5 @@ var foo:(a:number)=>number = function(a){return a}; foo = function(b){return b}; //// [contextualTyping22.js] -var foo = function (a) { - return a; -}; -foo = function (b) { - return b; -}; +var foo = function (a) { return a; }; +foo = function (b) { return b; }; diff --git a/tests/baselines/reference/contextualTyping23.js b/tests/baselines/reference/contextualTyping23.js index 187fd3f86d3..0207f6af15d 100644 --- a/tests/baselines/reference/contextualTyping23.js +++ b/tests/baselines/reference/contextualTyping23.js @@ -3,6 +3,4 @@ var foo:(a:{():number; (i:number):number; })=>number; foo = function(a){return 5 //// [contextualTyping23.js] var foo; -foo = function (a) { - return 5; -}; +foo = function (a) { return 5; }; diff --git a/tests/baselines/reference/contextualTyping24.js b/tests/baselines/reference/contextualTyping24.js index 170a6983b9f..04c4ecba21b 100644 --- a/tests/baselines/reference/contextualTyping24.js +++ b/tests/baselines/reference/contextualTyping24.js @@ -3,6 +3,4 @@ var foo:(a:{():number; (i:number):number; })=>number; foo = function(a:string){r //// [contextualTyping24.js] var foo; -foo = function (a) { - return 5; -}; +foo = function (a) { return 5; }; diff --git a/tests/baselines/reference/contextualTyping32.js b/tests/baselines/reference/contextualTyping32.js index 992724d4130..bbbafa70796 100644 --- a/tests/baselines/reference/contextualTyping32.js +++ b/tests/baselines/reference/contextualTyping32.js @@ -4,8 +4,4 @@ function foo(param: {():number; (i:number):number; }[]) { }; foo([function(){ret //// [contextualTyping32.js] function foo(param) { } ; -foo([function () { - return 1; -}, function () { - return 4; -}]); +foo([function () { return 1; }, function () { return 4; }]); diff --git a/tests/baselines/reference/contextualTyping33.js b/tests/baselines/reference/contextualTyping33.js index 0ca0c965b8b..1d800b1d113 100644 --- a/tests/baselines/reference/contextualTyping33.js +++ b/tests/baselines/reference/contextualTyping33.js @@ -4,8 +4,4 @@ function foo(param: {():number; (i:number):number; }[]) { }; foo([function(){ret //// [contextualTyping33.js] function foo(param) { } ; -foo([function () { - return 1; -}, function () { - return "foo"; -}]); +foo([function () { return 1; }, function () { return "foo"; }]); diff --git a/tests/baselines/reference/contextualTyping38.js b/tests/baselines/reference/contextualTyping38.js index 71ed8ece57d..9bed543ff7f 100644 --- a/tests/baselines/reference/contextualTyping38.js +++ b/tests/baselines/reference/contextualTyping38.js @@ -2,6 +2,4 @@ var foo = <{ (): number; }> function(a) { return a }; //// [contextualTyping38.js] -var foo = function (a) { - return a; -}; +var foo = function (a) { return a; }; diff --git a/tests/baselines/reference/contextualTyping39.js b/tests/baselines/reference/contextualTyping39.js index 9a97b7eb3cc..89d045830a3 100644 --- a/tests/baselines/reference/contextualTyping39.js +++ b/tests/baselines/reference/contextualTyping39.js @@ -2,6 +2,4 @@ var foo = <{ (): number; }> function() { return "err"; }; //// [contextualTyping39.js] -var foo = function () { - return "err"; -}; +var foo = function () { return "err"; }; diff --git a/tests/baselines/reference/contextualTyping40.js b/tests/baselines/reference/contextualTyping40.js index ba2c447b10f..0b98f8e45c6 100644 --- a/tests/baselines/reference/contextualTyping40.js +++ b/tests/baselines/reference/contextualTyping40.js @@ -2,6 +2,4 @@ var foo = <{():number; (i:number):number; }> function(){return 1;}; //// [contextualTyping40.js] -var foo = function () { - return 1; -}; +var foo = function () { return 1; }; diff --git a/tests/baselines/reference/contextualTyping41.js b/tests/baselines/reference/contextualTyping41.js index 720f1d178f6..8bce7918dd2 100644 --- a/tests/baselines/reference/contextualTyping41.js +++ b/tests/baselines/reference/contextualTyping41.js @@ -2,6 +2,4 @@ var foo = <{():number; (i:number):number; }> (function(){return "err";}); //// [contextualTyping41.js] -var foo = (function () { - return "err"; -}); +var foo = (function () { return "err"; }); diff --git a/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.js b/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.js index b2a8bf0dba1..8142b51dcdd 100644 --- a/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.js +++ b/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.js @@ -22,10 +22,6 @@ var r6 = _.forEach(c2, (x) => { return x.toFixed() }); var c2; var _; // errors on all 3 lines, bug was that r5 was the only line with errors -var f = function (x) { - return x.toFixed(); -}; +var f = function (x) { return x.toFixed(); }; var r5 = _.forEach(c2, f); -var r6 = _.forEach(c2, function (x) { - return x.toFixed(); -}); +var r6 = _.forEach(c2, function (x) { return x.toFixed(); }); diff --git a/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.js b/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.js index 220e06da59d..67670bf872e 100644 --- a/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.js +++ b/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.js @@ -9,6 +9,4 @@ callb((a) => { a.length; }); // Error, we picked the first overload and errored //// [contextualTypingOfLambdaReturnExpression.js] function callb(a) { } callb(function (a) { return a.length; }); // Ok, we choose the second overload because the first one gave us an error when trying to resolve the lambda return type -callb(function (a) { - a.length; -}); // Error, we picked the first overload and errored when type checking the lambda body +callb(function (a) { a.length; }); // Error, we picked the first overload and errored when type checking the lambda body diff --git a/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.js b/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.js index 415fc3acd2e..442ded4ba75 100644 --- a/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.js +++ b/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.js @@ -8,6 +8,4 @@ f = (a) => { return a.asdf } //// [contextualTypingOfLambdaWithMultipleSignatures2.js] var f; -f = function (a) { - return a.asdf; -}; +f = function (a) { return a.asdf; }; diff --git a/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.js b/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.js index f548b6daaad..5ee0c758022 100644 --- a/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.js +++ b/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.js @@ -19,10 +19,6 @@ f3 = (x, y) => { return x } //// [contextualTypingWithGenericAndNonGenericSignature.js] //• If e is a FunctionExpression or ArrowFunctionExpression with no type parameters and no parameter or return type annotations, and T is a function type with EXACTLY ONE non - generic call signature, then any inferences made for type parameters referenced by the parameters of T’s call signature are fixed(section 4.12.2) and e is processed with the contextual type T, as described in section 4.9.3. var f2; -f2 = function (x, y) { - return x; -}; +f2 = function (x, y) { return x; }; var f3; -f3 = function (x, y) { - return x; -}; +f3 = function (x, y) { return x; }; diff --git a/tests/baselines/reference/contextualTypingWithGenericSignature.js b/tests/baselines/reference/contextualTypingWithGenericSignature.js index a1417e90b43..611a35f38ac 100644 --- a/tests/baselines/reference/contextualTypingWithGenericSignature.js +++ b/tests/baselines/reference/contextualTypingWithGenericSignature.js @@ -10,6 +10,4 @@ f2 = (x, y) => { return x } //// [contextualTypingWithGenericSignature.js] // If e is a FunctionExpression or ArrowFunctionExpression with no type parameters and no parameter or return type annotations, and T is a function type with EXACTLY ONE non - generic call signature, then any inferences made for type parameters referenced by the parameters of T’s call signature are fixed(section 4.12.2) and e is processed with the contextual type T, as described in section 4.9.3. var f2; -f2 = function (x, y) { - return x; -}; +f2 = function (x, y) { return x; }; diff --git a/tests/baselines/reference/contextuallyTypingOrOperator.js b/tests/baselines/reference/contextuallyTypingOrOperator.js index 8d7babbbe6b..6dc3e09bf89 100644 --- a/tests/baselines/reference/contextuallyTypingOrOperator.js +++ b/tests/baselines/reference/contextuallyTypingOrOperator.js @@ -8,12 +8,6 @@ var v4 = (s: number) => 1 || function (s: string) { return s.length }; //// [contextuallyTypingOrOperator.js] var v = { a: function (s) { return s.length; } } || { a: function (s) { return 1; } }; -var v2 = function (s) { return s.length || function (s) { - s.length; -}; }; -var v3 = function (s) { return s.length || function (s) { - return 1; -}; }; -var v4 = function (s) { return 1 || function (s) { - return s.length; -}; }; +var v2 = function (s) { return s.length || function (s) { s.length; }; }; +var v3 = function (s) { return s.length || function (s) { return 1; }; }; +var v4 = function (s) { return 1 || function (s) { return s.length; }; }; diff --git a/tests/baselines/reference/contextuallyTypingOrOperator2.js b/tests/baselines/reference/contextuallyTypingOrOperator2.js index 9aa2c778345..fa850929b3e 100644 --- a/tests/baselines/reference/contextuallyTypingOrOperator2.js +++ b/tests/baselines/reference/contextuallyTypingOrOperator2.js @@ -5,6 +5,4 @@ var v2 = (s: string) => s.length || function (s) { s.aaa }; //// [contextuallyTypingOrOperator2.js] var v = { a: function (s) { return s.length; } } || { a: function (s) { return 1; } }; -var v2 = function (s) { return s.length || function (s) { - s.aaa; -}; }; +var v2 = function (s) { return s.length || function (s) { s.aaa; }; }; diff --git a/tests/baselines/reference/couldNotSelectGenericOverload.js b/tests/baselines/reference/couldNotSelectGenericOverload.js index 45ce1c42274..996ebde8448 100644 --- a/tests/baselines/reference/couldNotSelectGenericOverload.js +++ b/tests/baselines/reference/couldNotSelectGenericOverload.js @@ -9,13 +9,9 @@ var b3G = makeArray2(1, ""); // error //// [couldNotSelectGenericOverload.js] -function makeArray(items) { - return items; -} +function makeArray(items) { return items; } var b = [1, ""]; var b1G = makeArray(1, ""); // any, no error var b2G = makeArray(b); // any[] -function makeArray2(items) { - return items; -} +function makeArray2(items) { return items; } var b3G = makeArray2(1, ""); // error diff --git a/tests/baselines/reference/debuggerEmit.js b/tests/baselines/reference/debuggerEmit.js index c2f730271be..8cf5dc69cd0 100644 --- a/tests/baselines/reference/debuggerEmit.js +++ b/tests/baselines/reference/debuggerEmit.js @@ -3,7 +3,5 @@ var x = function () { debugger; } x(); //// [debuggerEmit.js] -var x = function () { - debugger; -}; +var x = function () { debugger; }; x(); diff --git a/tests/baselines/reference/declFileGenericType.js b/tests/baselines/reference/declFileGenericType.js index d6d63e3443a..e01626a7ead 100644 --- a/tests/baselines/reference/declFileGenericType.js +++ b/tests/baselines/reference/declFileGenericType.js @@ -60,29 +60,17 @@ var C; return B; })(); C.B = B; - function F(x) { - return null; - } + function F(x) { return null; } C.F = F; - function F2(x) { - return null; - } + function F2(x) { return null; } C.F2 = F2; - function F3(x) { - return null; - } + function F3(x) { return null; } C.F3 = F3; - function F4(x) { - return null; - } + function F4(x) { return null; } C.F4 = F4; - function F5() { - return null; - } + function F5() { return null; } C.F5 = F5; - function F6(x) { - return null; - } + function F6(x) { return null; } C.F6 = F6; var D = (function () { function D(val) { diff --git a/tests/baselines/reference/declFileObjectLiteralWithAccessors.js b/tests/baselines/reference/declFileObjectLiteralWithAccessors.js index 7d7c6ee73d3..85897bc2c9d 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithAccessors.js +++ b/tests/baselines/reference/declFileObjectLiteralWithAccessors.js @@ -15,12 +15,8 @@ point./*3*/x = 30; function makePoint(x) { return { b: 10, - get x() { - return x; - }, - set x(a) { - this.b = a; - } + get x() { return x; }, + set x(a) { this.b = a; } }; } ; diff --git a/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js b/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js index b3d41829637..dd39a30f7a2 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js +++ b/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js @@ -12,9 +12,7 @@ var /*2*/x = point./*3*/x; //// [declFileObjectLiteralWithOnlyGetter.js] function makePoint(x) { return { - get x() { - return x; - } + get x() { return x; } }; } ; diff --git a/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js b/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js index dae362caf36..e219e885053 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js +++ b/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js @@ -13,9 +13,7 @@ point./*2*/x = 30; function makePoint(x) { return { b: 10, - set x(a) { - this.b = a; - } + set x(a) { this.b = a; } }; } ; diff --git a/tests/baselines/reference/declFilePrivateStatic.js b/tests/baselines/reference/declFilePrivateStatic.js index 38efa8255a7..326ce62171d 100644 --- a/tests/baselines/reference/declFilePrivateStatic.js +++ b/tests/baselines/reference/declFilePrivateStatic.js @@ -21,16 +21,12 @@ var C = (function () { C.a = function () { }; C.b = function () { }; Object.defineProperty(C, "c", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); Object.defineProperty(C, "d", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js b/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js index 3cea09c8c26..0150c3f9d42 100644 --- a/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js +++ b/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js @@ -16,9 +16,7 @@ function f2(x) { } function f3(x) { } function f4() { } function f5() { } -var f6 = function () { - return [10]; -}; +var f6 = function () { return [10]; }; //// [declFileRestParametersOfFunctionAndFunctionType.d.ts] diff --git a/tests/baselines/reference/declFileTypeofFunction.js b/tests/baselines/reference/declFileTypeofFunction.js index 2af519f411d..656e02b8ddd 100644 --- a/tests/baselines/reference/declFileTypeofFunction.js +++ b/tests/baselines/reference/declFileTypeofFunction.js @@ -34,12 +34,8 @@ function foo5(x: number) { } //// [declFileTypeofFunction.js] -function f() { - return undefined; -} -function g() { - return undefined; -} +function f() { return undefined; } +function g() { return undefined; } var b; function b1() { return b1; diff --git a/tests/baselines/reference/declInput-2.js b/tests/baselines/reference/declInput-2.js index 30a306c09f8..dcd37454ef0 100644 --- a/tests/baselines/reference/declInput-2.js +++ b/tests/baselines/reference/declInput-2.js @@ -38,20 +38,12 @@ var M; var D = (function () { function D() { } - D.prototype.m232 = function () { - return null; - }; - D.prototype.m242 = function () { - return null; - }; - D.prototype.m252 = function () { - return null; - }; // don't generate + D.prototype.m232 = function () { return null; }; + D.prototype.m242 = function () { return null; }; + D.prototype.m252 = function () { return null; }; // don't generate D.prototype.m26 = function (i) { }; D.prototype.m262 = function (i) { }; - D.prototype.m3 = function () { - return new C(); - }; + D.prototype.m3 = function () { return new C(); }; return D; })(); M.D = D; diff --git a/tests/baselines/reference/declInput.js b/tests/baselines/reference/declInput.js index 39d466498fa..cd558c93403 100644 --- a/tests/baselines/reference/declInput.js +++ b/tests/baselines/reference/declInput.js @@ -14,12 +14,8 @@ class bar { var bar = (function () { function bar() { } - bar.prototype.f = function () { - return ''; - }; - bar.prototype.g = function () { - return { a: null, b: undefined, c: void 4 }; - }; + bar.prototype.f = function () { return ''; }; + bar.prototype.g = function () { return { a: null, b: undefined, c: void 4 }; }; bar.prototype.h = function (x, y, z) { if (x === void 0) { x = 4; } if (y === void 0) { y = null; } diff --git a/tests/baselines/reference/declInput3.js b/tests/baselines/reference/declInput3.js index fa577a90645..3be31de3de0 100644 --- a/tests/baselines/reference/declInput3.js +++ b/tests/baselines/reference/declInput3.js @@ -14,12 +14,8 @@ class bar { var bar = (function () { function bar() { } - bar.prototype.f = function () { - return ''; - }; - bar.prototype.g = function () { - return { a: null, b: undefined, c: void 4 }; - }; + bar.prototype.f = function () { return ''; }; + bar.prototype.g = function () { return { a: null, b: undefined, c: void 4 }; }; bar.prototype.h = function (x, y, z) { if (x === void 0) { x = 4; } if (y === void 0) { y = null; } diff --git a/tests/baselines/reference/declInput4.js b/tests/baselines/reference/declInput4.js index cce9127eddc..07b6f091a14 100644 --- a/tests/baselines/reference/declInput4.js +++ b/tests/baselines/reference/declInput4.js @@ -32,12 +32,8 @@ var M; var D = (function () { function D() { } - D.prototype.m232 = function () { - return null; - }; - D.prototype.m242 = function () { - return null; - }; + D.prototype.m232 = function () { return null; }; + D.prototype.m242 = function () { return null; }; D.prototype.m26 = function (i) { }; return D; })(); diff --git a/tests/baselines/reference/declarationEmit_protectedMembers.js b/tests/baselines/reference/declarationEmit_protectedMembers.js index ff4323ce542..61a4ebdfcab 100644 --- a/tests/baselines/reference/declarationEmit_protectedMembers.js +++ b/tests/baselines/reference/declarationEmit_protectedMembers.js @@ -65,9 +65,7 @@ var C1 = (function () { return this.x; }; Object.defineProperty(C1.prototype, "accessor", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (a) { }, enumerable: true, configurable: true @@ -81,9 +79,7 @@ var C1 = (function () { configurable: true }); Object.defineProperty(C1, "staticGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -116,9 +112,7 @@ var C3 = (function (_super) { return _super.sf.call(this); }; Object.defineProperty(C3, "staticGetter", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js b/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js index 8fc1c601982..34e862063ce 100644 --- a/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js +++ b/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js @@ -50,15 +50,11 @@ foo()--; // -- operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -72,14 +68,10 @@ var ResultIsNumber2 = NUMBER1--; // number type literal var ResultIsNumber3 = --1; var ResultIsNumber4 = --{ x: 1, y: 2 }; -var ResultIsNumber5 = --{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = --{ x: 1, y: function (n) { return n; } }; var ResultIsNumber6 = 1--; var ResultIsNumber7 = { x: 1, y: 2 }--; -var ResultIsNumber8 = { x: 1, y: function (n) { - return n; -} }--; +var ResultIsNumber8 = { x: 1, y: function (n) { return n; } }--; // number type expressions var ResultIsNumber9 = --foo(); var ResultIsNumber10 = --A.foo(); diff --git a/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js b/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js index 22c86aa8450..2be74a64d8f 100644 --- a/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js +++ b/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js @@ -57,15 +57,11 @@ objA.a--, M.n--; //// [decrementOperatorWithUnsupportedBooleanType.js] // -- operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return true; - }; + A.foo = function () { return true; }; return A; })(); var M; @@ -79,14 +75,10 @@ var ResultIsNumber2 = BOOLEAN--; // boolean type literal var ResultIsNumber3 = --true; var ResultIsNumber4 = --{ x: true, y: false }; -var ResultIsNumber5 = --{ x: true, y: function (n) { - return n; -} }; +var ResultIsNumber5 = --{ x: true, y: function (n) { return n; } }; var ResultIsNumber6 = true--; var ResultIsNumber7 = { x: true, y: false }--; -var ResultIsNumber8 = { x: true, y: function (n) { - return n; -} }--; +var ResultIsNumber8 = { x: true, y: function (n) { return n; } }--; // boolean type expressions var ResultIsNumber9 = --objA.a; var ResultIsNumber10 = --M.n; diff --git a/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js b/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js index 1747b1648d6..430f9af963f 100644 --- a/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js +++ b/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js @@ -69,15 +69,11 @@ objA.a--, M.n--; // -- operator on string type var STRING; var STRING1 = ["", ""]; -function foo() { - return ""; -} +function foo() { return ""; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -93,14 +89,10 @@ var ResultIsNumber4 = STRING1--; // string type literal var ResultIsNumber5 = --""; var ResultIsNumber6 = --{ x: "", y: "" }; -var ResultIsNumber7 = --{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber7 = --{ x: "", y: function (s) { return s; } }; var ResultIsNumber8 = ""--; var ResultIsNumber9 = { x: "", y: "" }--; -var ResultIsNumber10 = { x: "", y: function (s) { - return s; -} }--; +var ResultIsNumber10 = { x: "", y: function (s) { return s; } }--; // string type expressions var ResultIsNumber11 = --objA.a; var ResultIsNumber12 = --M.n; diff --git a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js index 98e135cc712..ad6181ba7c5 100644 --- a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js +++ b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js @@ -20,13 +20,9 @@ var obj1; obj1.length; var obj2; obj2.length; -function concat(x, y) { - return null; -} +function concat(x, y) { return null; } var result = concat(1, ""); // error var elementCount = result.length; -function concat2(x, y) { - return null; -} +function concat2(x, y) { return null; } var result2 = concat2(1, ""); // result2 will be number|string var elementCount2 = result.length; diff --git a/tests/baselines/reference/deleteOperatorWithBooleanType.js b/tests/baselines/reference/deleteOperatorWithBooleanType.js index cab9cba2c95..b0a60a23744 100644 --- a/tests/baselines/reference/deleteOperatorWithBooleanType.js +++ b/tests/baselines/reference/deleteOperatorWithBooleanType.js @@ -41,15 +41,11 @@ delete M.n; //// [deleteOperatorWithBooleanType.js] // delete operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/deleteOperatorWithNumberType.js b/tests/baselines/reference/deleteOperatorWithNumberType.js index d19ae045805..bb70c55024d 100644 --- a/tests/baselines/reference/deleteOperatorWithNumberType.js +++ b/tests/baselines/reference/deleteOperatorWithNumberType.js @@ -49,15 +49,11 @@ delete objA.a, M.n; // delete operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -71,9 +67,7 @@ var ResultIsBoolean2 = delete NUMBER1; // number type literal var ResultIsBoolean3 = delete 1; var ResultIsBoolean4 = delete { x: 1, y: 2 }; -var ResultIsBoolean5 = delete { x: 1, y: function (n) { - return n; -} }; +var ResultIsBoolean5 = delete { x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsBoolean6 = delete objA.a; var ResultIsBoolean7 = delete M.n; diff --git a/tests/baselines/reference/deleteOperatorWithStringType.js b/tests/baselines/reference/deleteOperatorWithStringType.js index ad27e8f84ad..79246e27725 100644 --- a/tests/baselines/reference/deleteOperatorWithStringType.js +++ b/tests/baselines/reference/deleteOperatorWithStringType.js @@ -48,15 +48,11 @@ delete objA.a,M.n; // delete operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -70,9 +66,7 @@ var ResultIsBoolean2 = delete STRING1; // string type literal var ResultIsBoolean3 = delete ""; var ResultIsBoolean4 = delete { x: "", y: "" }; -var ResultIsBoolean5 = delete { x: "", y: function (s) { - return s; -} }; +var ResultIsBoolean5 = delete { x: "", y: function (s) { return s; } }; // string type expressions var ResultIsBoolean6 = delete objA.a; var ResultIsBoolean7 = delete M.n; diff --git a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js index 1c56819b200..32e8cf4199e 100644 --- a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js +++ b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js @@ -66,9 +66,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - var r = function () { - _super.call(this); - }; // error + var r = function () { _super.call(this); }; // error } return Derived3; })(Base2); diff --git a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js index bdfa31cb04f..f2e816604d2 100644 --- a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js +++ b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js @@ -52,18 +52,14 @@ var Base = (function () { } Base.prototype.b = function () { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return ''; - }, + get: function () { return ''; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function () { }; Object.defineProperty(Base, "t", { - get: function () { - return ''; - }, + get: function () { return ''; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js index af725e9b7bd..b66d356a73e 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js @@ -50,18 +50,14 @@ var Base = (function () { } Base.prototype.b = function (a) { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function (a) { }; Object.defineProperty(Base, "t", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true @@ -75,18 +71,14 @@ var Derived = (function (_super) { } Derived.prototype.b = function (a) { }; Object.defineProperty(Derived.prototype, "c", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (v) { }, enumerable: true, configurable: true }); Derived.s = function (a) { }; Object.defineProperty(Derived, "t", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (a) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js index b1f5de00fb5..80f7456ab9a 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js @@ -77,18 +77,14 @@ var Base = (function () { } Base.prototype.b = function (a) { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function (a) { }; Object.defineProperty(Base, "t", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true @@ -103,18 +99,14 @@ var Derived = (function (_super) { } Derived.prototype.b = function (a) { }; Object.defineProperty(Derived.prototype, "c", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (v) { }, enumerable: true, configurable: true }); Derived.s = function (a) { }; Object.defineProperty(Derived, "t", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (a) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js index d6b93addbd3..cfb6116ee85 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js @@ -85,18 +85,14 @@ var Base = (function () { } Base.prototype.b = function (a) { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function (a) { }; Object.defineProperty(Base, "t", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true @@ -126,9 +122,7 @@ var Derived3 = (function (_super) { _super.call(this, a); } Object.defineProperty(Derived3.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, enumerable: true, configurable: true }); @@ -174,9 +168,7 @@ var Derived8 = (function (_super) { _super.call(this, a); } Object.defineProperty(Derived8, "t", { - get: function () { - return x; - }, + get: function () { return x; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/derivedClassOverridesPublicMembers.js b/tests/baselines/reference/derivedClassOverridesPublicMembers.js index a1df28586d9..9d7df0eee40 100644 --- a/tests/baselines/reference/derivedClassOverridesPublicMembers.js +++ b/tests/baselines/reference/derivedClassOverridesPublicMembers.js @@ -76,18 +76,14 @@ var Base = (function () { } Base.prototype.b = function (a) { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function (a) { }; Object.defineProperty(Base, "t", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true @@ -101,18 +97,14 @@ var Derived = (function (_super) { } Derived.prototype.b = function (a) { }; Object.defineProperty(Derived.prototype, "c", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (v) { }, enumerable: true, configurable: true }); Derived.s = function (a) { }; Object.defineProperty(Derived, "t", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (a) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js index 7e61be1c1c9..1902b6f4068 100644 --- a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js +++ b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js @@ -67,9 +67,7 @@ var Derived3 = (function (_super) { var Derived4 = (function (_super) { __extends(Derived4, _super); function Derived4(a) { - _super.call(this, function () { - return this; - }); // ok + _super.call(this, function () { return this; }); // ok this.a = a; } return Derived4; diff --git a/tests/baselines/reference/derivedClassWithAny.js b/tests/baselines/reference/derivedClassWithAny.js index 0b568eaec9b..8070e689bd0 100644 --- a/tests/baselines/reference/derivedClassWithAny.js +++ b/tests/baselines/reference/derivedClassWithAny.js @@ -70,9 +70,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "X", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); @@ -125,9 +123,7 @@ var E = (function (_super) { _super.apply(this, arguments); } Object.defineProperty(E.prototype, "X", { - get: function () { - return ''; - }, + get: function () { return ''; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js index 63c33f87836..8b00c632058 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js @@ -36,9 +36,7 @@ var Base = (function () { return ''; }; Object.defineProperty(Base.prototype, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -55,9 +53,7 @@ var Derived = (function (_super) { return ''; }; Object.defineProperty(Derived.prototype, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js index 692ae1569ec..4ac57d159e6 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js @@ -46,9 +46,7 @@ var Base = (function () { return ''; }; Object.defineProperty(Base.prototype, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -65,9 +63,7 @@ var Derived = (function (_super) { return ''; }; Object.defineProperty(Derived.prototype, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js index 56ce444de0b..1037d3faaae 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js @@ -35,9 +35,7 @@ var Base = (function () { return ''; }; Object.defineProperty(Base, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -54,9 +52,7 @@ var Derived = (function (_super) { return ''; }; Object.defineProperty(Derived, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js index 7ae518eeedf..c5bfea288bd 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js @@ -47,9 +47,7 @@ var Base = (function () { return ''; }; Object.defineProperty(Base, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -67,9 +65,7 @@ var Derived = (function (_super) { return ''; }; Object.defineProperty(Derived, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClasses.js b/tests/baselines/reference/derivedClasses.js index a0d6de6a819..e256313d27b 100644 --- a/tests/baselines/reference/derivedClasses.js +++ b/tests/baselines/reference/derivedClasses.js @@ -44,9 +44,7 @@ var Red = (function (_super) { } Red.prototype.shade = function () { var _this = this; - var getHue = function () { - return _this.hue(); - }; + var getHue = function () { return _this.hue(); }; return getHue() + " red"; }; return Red; @@ -54,12 +52,8 @@ var Red = (function (_super) { var Color = (function () { function Color() { } - Color.prototype.shade = function () { - return "some shade"; - }; - Color.prototype.hue = function () { - return "some hue"; - }; + Color.prototype.shade = function () { return "some shade"; }; + Color.prototype.hue = function () { return "some hue"; }; return Color; })(); var Blue = (function (_super) { @@ -69,9 +63,7 @@ var Blue = (function (_super) { } Blue.prototype.shade = function () { var _this = this; - var getHue = function () { - return _this.hue(); - }; + var getHue = function () { return _this.hue(); }; return getHue() + " blue"; }; return Blue; diff --git a/tests/baselines/reference/derivedGenericClassWithAny.js b/tests/baselines/reference/derivedGenericClassWithAny.js index 677fadf3876..4d1f0452be4 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.js +++ b/tests/baselines/reference/derivedGenericClassWithAny.js @@ -53,9 +53,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "X", { - get: function () { - return null; - }, + get: function () { return null; }, enumerable: true, configurable: true }); @@ -98,9 +96,7 @@ var E = (function (_super) { _super.apply(this, arguments); } Object.defineProperty(E.prototype, "X", { - get: function () { - return ''; - } // error + get: function () { return ''; } // error , enumerable: true, configurable: true diff --git a/tests/baselines/reference/duplicateLocalVariable1.js b/tests/baselines/reference/duplicateLocalVariable1.js index cace580eea1..e77a38c5be8 100644 --- a/tests/baselines/reference/duplicateLocalVariable1.js +++ b/tests/baselines/reference/duplicateLocalVariable1.js @@ -361,9 +361,7 @@ var TestRunner = (function () { this.tests = []; } TestRunner.arrayCompare = function (arg1, arg2) { - return (arg1.every(function (val, index) { - return val === arg2[index]; - })); + return (arg1.every(function (val, index) { return val === arg2[index]; })); }; TestRunner.prototype.addTest = function (test) { this.tests.push(test); @@ -410,23 +408,11 @@ exports.TestRunner = TestRunner; exports.tests = (function () { var testRunner = new TestRunner(); // First 3 are for simple harness validation - testRunner.addTest(new TestCase("Basic test", function () { - return true; - })); - testRunner.addTest(new TestCase("Test for any error", function () { - throw new Error(); - return false; - }, "")); - testRunner.addTest(new TestCase("Test RegEx error message match", function () { - throw new Error("Should also pass"); - return false; - }, "Should [also]+ pass")); - testRunner.addTest(new TestCase("Test array compare true", function () { - return TestRunner.arrayCompare([1, 2, 3], [1, 2, 3]); - })); - testRunner.addTest(new TestCase("Test array compare false", function () { - return !TestRunner.arrayCompare([3, 2, 3], [1, 2, 3]); - })); + testRunner.addTest(new TestCase("Basic test", function () { return true; })); + testRunner.addTest(new TestCase("Test for any error", function () { throw new Error(); return false; }, "")); + testRunner.addTest(new TestCase("Test RegEx error message match", function () { throw new Error("Should also pass"); return false; }, "Should [also]+ pass")); + testRunner.addTest(new TestCase("Test array compare true", function () { return TestRunner.arrayCompare([1, 2, 3], [1, 2, 3]); })); + testRunner.addTest(new TestCase("Test array compare false", function () { return !TestRunner.arrayCompare([3, 2, 3], [1, 2, 3]); })); // File detection tests testRunner.addTest(new TestCase("Check file exists", function () { return FileManager.DirectoryManager.fileExists(TestFileDir + "\\Test.txt"); @@ -436,22 +422,38 @@ exports.tests = (function () { })); // File pattern matching tests testRunner.addTest(new TestCase("Check text file match", function () { - return (FileManager.FileBuffer.isTextFile("C:\\somedir\\readme.txt") && FileManager.FileBuffer.isTextFile("C:\\spaces path\\myapp.str") && FileManager.FileBuffer.isTextFile("C:\\somedir\\code.js")); + return (FileManager.FileBuffer.isTextFile("C:\\somedir\\readme.txt") && + FileManager.FileBuffer.isTextFile("C:\\spaces path\\myapp.str") && + FileManager.FileBuffer.isTextFile("C:\\somedir\\code.js")); })); testRunner.addTest(new TestCase("Check makefile match", function () { return FileManager.FileBuffer.isTextFile("C:\\some dir\\makefile"); })); testRunner.addTest(new TestCase("Check binary file doesn't match", function () { - return (!FileManager.FileBuffer.isTextFile("C:\\somedir\\app.exe") && !FileManager.FileBuffer.isTextFile("C:\\somedir\\my lib.dll")); + return (!FileManager.FileBuffer.isTextFile("C:\\somedir\\app.exe") && + !FileManager.FileBuffer.isTextFile("C:\\somedir\\my lib.dll")); })); // Command-line parameter tests testRunner.addTest(new TestCase("Check App defaults", function () { var app = new App.App([]); - return (app.fixLines === false && app.recurse === true && app.lineEndings === "CRLF" && app.matchPattern === undefined && app.rootDirectory === ".\\" && app.encodings[0] === "ascii" && app.encodings[1] === "utf8nobom"); + return (app.fixLines === false && + app.recurse === true && + app.lineEndings === "CRLF" && + app.matchPattern === undefined && + app.rootDirectory === ".\\" && + app.encodings[0] === "ascii" && + app.encodings[1] === "utf8nobom"); })); testRunner.addTest(new TestCase("Check App params", function () { var app = new App.App(["-dir=C:\\test dir", "-lineEndings=LF", "-encodings=utf16be,ascii", "-recurse=false", "-fixlines"]); - return (app.fixLines === true && app.lineEndings === "LF" && app.recurse === false && app.matchPattern === undefined && app.rootDirectory === "C:\\test dir" && app.encodings[0] === "utf16be" && app.encodings[1] === "ascii" && app.encodings.length === 2); + return (app.fixLines === true && + app.lineEndings === "LF" && + app.recurse === false && + app.matchPattern === undefined && + app.rootDirectory === "C:\\test dir" && + app.encodings[0] === "utf16be" && + app.encodings[1] === "ascii" && + app.encodings.length === 2); })); // File BOM detection tests testRunner.addTest(new TestCase("Check encoding detection no BOM", function () { @@ -516,9 +518,7 @@ exports.tests = (function () { var fb = new FileManager.FileBuffer(14); fb.writeUtf16leBom(); var chars = [0x0054, 0x00E8, 0x1D23, 0x2020, 0x000D, 0x000A]; - chars.forEach(function (val) { - fb.writeUtf16CodePoint(val, false); - }); + chars.forEach(function (val) { fb.writeUtf16CodePoint(val, false); }); fb.save(filename); var savedFile = new FileManager.FileBuffer(filename); if (savedFile.encoding !== 'utf16le') { @@ -573,9 +573,7 @@ exports.tests = (function () { var filename = TestFileDir + "\\tmpUTF8nonBmp.txt"; var fb = new FileManager.FileBuffer(15); var chars = [0x10480, 0x10481, 0x10482, 0x54, 0x68, 0x69]; - chars.forEach(function (val) { - fb.writeUtf8CodePoint(val); - }); + chars.forEach(function (val) { fb.writeUtf8CodePoint(val); }); fb.save(filename); var savedFile = new FileManager.FileBuffer(filename); if (savedFile.encoding !== 'utf8') { diff --git a/tests/baselines/reference/duplicateObjectLiteralProperty.js b/tests/baselines/reference/duplicateObjectLiteralProperty.js index 5fd2d1177f8..9c629b211cf 100644 --- a/tests/baselines/reference/duplicateObjectLiteralProperty.js +++ b/tests/baselines/reference/duplicateObjectLiteralProperty.js @@ -30,11 +30,7 @@ var x = { } }; var y = { - get a() { - return 0; - }, + get a() { return 0; }, set a(v) { }, - get a() { - return 0; - } + get a() { return 0; } }; diff --git a/tests/baselines/reference/emitArrowFunction.js b/tests/baselines/reference/emitArrowFunction.js index 41c52cbfefc..9c50c4776b1 100644 --- a/tests/baselines/reference/emitArrowFunction.js +++ b/tests/baselines/reference/emitArrowFunction.js @@ -14,6 +14,4 @@ var f3 = function (x, y) { }; var f4 = function (x, y, z) { }; function foo(func) { } foo(function () { return true; }); -foo(function () { - return false; -}); +foo(function () { return false; }); diff --git a/tests/baselines/reference/emitArrowFunctionES6.js b/tests/baselines/reference/emitArrowFunctionES6.js index 39d69cc1f0e..35078502ef7 100644 --- a/tests/baselines/reference/emitArrowFunctionES6.js +++ b/tests/baselines/reference/emitArrowFunctionES6.js @@ -15,6 +15,4 @@ var f3 = (x, y, ...rest) => { }; var f4 = (x, y, z = 10) => { }; function foo(func) { } foo(() => { return true; }); -foo(() => { - return false; -}); +foo(() => { return false; }); diff --git a/tests/baselines/reference/enumBasics.js b/tests/baselines/reference/enumBasics.js index 6f1a039ca6e..eca92215fb6 100644 --- a/tests/baselines/reference/enumBasics.js +++ b/tests/baselines/reference/enumBasics.js @@ -150,21 +150,9 @@ var E9; // (refer to .js to validate) // Enum constant members are propagated var doNotPropagate = [ - E8.B, - E7.A, - E4.Z, - E3.X, - E3.Y, - E3.Z + E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z ]; // Enum computed members are not propagated var doPropagate = [ - 0 /* A */, - E9.B, - 0 /* B */, - 1 /* C */, - 0 /* A */, - 0 /* A */, - 3 /* B */, - 4 /* C */ + 0 /* A */, E9.B, 0 /* B */, 1 /* C */, 0 /* A */, 0 /* A */, 3 /* B */, 4 /* C */ ]; diff --git a/tests/baselines/reference/errorSuperPropertyAccess.js b/tests/baselines/reference/errorSuperPropertyAccess.js index 845bc9834f7..79ba631afed 100644 --- a/tests/baselines/reference/errorSuperPropertyAccess.js +++ b/tests/baselines/reference/errorSuperPropertyAccess.js @@ -209,9 +209,7 @@ var SomeDerived1 = (function (_super) { super.publicFunc.call(this); } var x = { - test: function () { - return super.publicFunc.call(this); - } + test: function () { return super.publicFunc.call(this); } }; }; return SomeDerived1; diff --git a/tests/baselines/reference/errorSupression1.js b/tests/baselines/reference/errorSupression1.js index 059530be452..53e40e585f0 100644 --- a/tests/baselines/reference/errorSupression1.js +++ b/tests/baselines/reference/errorSupression1.js @@ -12,9 +12,7 @@ baz.concat("y"); var Foo = (function () { function Foo() { } - Foo.bar = function () { - return "x"; - }; + Foo.bar = function () { return "x"; }; return Foo; })(); var baz = Foo.b; diff --git a/tests/baselines/reference/errorsInGenericTypeReference.js b/tests/baselines/reference/errorsInGenericTypeReference.js index 1a27a681e59..03bf31a6a6b 100644 --- a/tests/baselines/reference/errorsInGenericTypeReference.js +++ b/tests/baselines/reference/errorsInGenericTypeReference.js @@ -104,12 +104,8 @@ var tc2 = new testClass2(); // error: could not find symbol V var testClass3 = (function () { function testClass3() { } - testClass3.prototype.testMethod1 = function () { - return null; - }; // error: could not find symbol V - testClass3.testMethod2 = function () { - return null; - }; // error: could not find symbol V + testClass3.prototype.testMethod1 = function () { return null; }; // error: could not find symbol V + testClass3.testMethod2 = function () { return null; }; // error: could not find symbol V Object.defineProperty(testClass3.prototype, "a", { set: function (value) { } // error: could not find symbol V , @@ -119,9 +115,7 @@ var testClass3 = (function () { return testClass3; })(); // in function return type annotation -function testFunction1() { - return null; -} // error: could not find symbol V +function testFunction1() { return null; } // error: could not find symbol V // in paramter types function testFunction2(p) { } // error: could not find symbol V // in var type annotation diff --git a/tests/baselines/reference/es6ClassTest.js b/tests/baselines/reference/es6ClassTest.js index 5fd9f0e9b7f..08c184a0df2 100644 --- a/tests/baselines/reference/es6ClassTest.js +++ b/tests/baselines/reference/es6ClassTest.js @@ -112,12 +112,8 @@ var Foo = (function (_super) { this.x = x; this.gar = 5; } - Foo.prototype.bar = function () { - return 0; - }; - Foo.prototype.boo = function (x) { - return x; - }; + Foo.prototype.bar = function () { return 0; }; + Foo.prototype.boo = function (x) { return x; }; Foo.statVal = 0; return Foo; })(Bar); diff --git a/tests/baselines/reference/es6ClassTest2.js b/tests/baselines/reference/es6ClassTest2.js index f4854644079..fb0349c9044 100644 --- a/tests/baselines/reference/es6ClassTest2.js +++ b/tests/baselines/reference/es6ClassTest2.js @@ -243,9 +243,7 @@ var SplatMonster = (function () { SplatMonster.prototype.roar = function (name) { }; return SplatMonster; })(); -function foo() { - return true; -} +function foo() { return true; } var PrototypeMonster = (function () { function PrototypeMonster() { this.age = 1; diff --git a/tests/baselines/reference/es6ClassTest8.js b/tests/baselines/reference/es6ClassTest8.js index 3c616e5e893..f96bbd16b0b 100644 --- a/tests/baselines/reference/es6ClassTest8.js +++ b/tests/baselines/reference/es6ClassTest8.js @@ -41,9 +41,7 @@ class Camera { //// [es6ClassTest8.js] -function f1(x) { - return x; -} +function f1(x) { return x; } var C = (function () { function C() { var bar = (function () { @@ -59,21 +57,11 @@ var Vector = (function () { this.y = y; this.z = z; } - Vector.norm = function (v) { - return null; - }; - Vector.minus = function (v1, v2) { - return null; - }; - Vector.times = function (v1, v2) { - return null; - }; - Vector.cross = function (v1, v2) { - return null; - }; - Vector.dot = function (v1, v2) { - return null; - }; + Vector.norm = function (v) { return null; }; + Vector.minus = function (v1, v2) { return null; }; + Vector.times = function (v1, v2) { return null; }; + Vector.cross = function (v1, v2) { return null; }; + Vector.dot = function (v1, v2) { return null; }; return Vector; })(); var Camera = (function () { diff --git a/tests/baselines/reference/es6ImportDefaultBinding.errors.txt b/tests/baselines/reference/es6ImportDefaultBinding.errors.txt new file mode 100644 index 00000000000..85390ecce4b --- /dev/null +++ b/tests/baselines/reference/es6ImportDefaultBinding.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/es6ImportDefaultBinding_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBinding_0"' has no default export or export assignment. + + +==== tests/cases/compiler/es6ImportDefaultBinding_0.ts (0 errors) ==== + + export var a = 10; + +==== tests/cases/compiler/es6ImportDefaultBinding_1.ts (1 errors) ==== + import defaultBinding from "es6ImportDefaultBinding_0"; + ~~~~~~~~~~~~~~ +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBinding_0"' has no default export or export assignment. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBinding.js b/tests/baselines/reference/es6ImportDefaultBinding.js new file mode 100644 index 00000000000..d8d1fa8111d --- /dev/null +++ b/tests/baselines/reference/es6ImportDefaultBinding.js @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/es6ImportDefaultBinding.ts] //// + +//// [es6ImportDefaultBinding_0.ts] + +export var a = 10; + +//// [es6ImportDefaultBinding_1.ts] +import defaultBinding from "es6ImportDefaultBinding_0"; + +//// [es6ImportDefaultBinding_0.js] +exports.a = 10; +//// [es6ImportDefaultBinding_1.js] diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt new file mode 100644 index 00000000000..bd8714cb86f --- /dev/null +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.errors.txt @@ -0,0 +1,51 @@ +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(1,8): error TS2300: Duplicate identifier 'defaultBinding'. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(2,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(2,8): error TS2300: Duplicate identifier 'defaultBinding'. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(3,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(3,8): error TS2300: Duplicate identifier 'defaultBinding'. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(4,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(4,8): error TS2300: Duplicate identifier 'defaultBinding'. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(5,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(5,8): error TS2300: Duplicate identifier 'defaultBinding'. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(6,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts(6,8): error TS2300: Duplicate identifier 'defaultBinding'. + + +==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0.ts (0 errors) ==== + + export var a = 10; + export var x = a; + export var m = a; + +==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_1.ts (12 errors) ==== + import defaultBinding, { } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; + ~~~~~~~~~~~~~~ +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. + ~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'defaultBinding'. + import defaultBinding, { a } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; + ~~~~~~~~~~~~~~ +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. + ~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'defaultBinding'. + import defaultBinding, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; + ~~~~~~~~~~~~~~ +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. + ~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'defaultBinding'. + import defaultBinding, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; + ~~~~~~~~~~~~~~ +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. + ~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'defaultBinding'. + import defaultBinding, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; + ~~~~~~~~~~~~~~ +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. + ~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'defaultBinding'. + import defaultBinding, { m, } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; + ~~~~~~~~~~~~~~ +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0"' has no default export or export assignment. + ~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'defaultBinding'. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js new file mode 100644 index 00000000000..a7402bfeb6a --- /dev/null +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImport.js @@ -0,0 +1,21 @@ +//// [tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport.ts] //// + +//// [es6ImportDefaultBindingFollowedWithNamedImport_0.ts] + +export var a = 10; +export var x = a; +export var m = a; + +//// [es6ImportDefaultBindingFollowedWithNamedImport_1.ts] +import defaultBinding, { } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding, { a } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding, { m, } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; + +//// [es6ImportDefaultBindingFollowedWithNamedImport_0.js] +exports.a = 10; +exports.x = exports.a; +exports.m = exports.a; +//// [es6ImportDefaultBindingFollowedWithNamedImport_1.js] diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.errors.txt new file mode 100644 index 00000000000..157360f5238 --- /dev/null +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.errors.txt @@ -0,0 +1,51 @@ +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(1,8): error TS2300: Duplicate identifier 'defaultBinding'. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(2,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(2,8): error TS2300: Duplicate identifier 'defaultBinding'. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(3,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(3,8): error TS2300: Duplicate identifier 'defaultBinding'. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(4,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(4,8): error TS2300: Duplicate identifier 'defaultBinding'. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(5,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(5,8): error TS2300: Duplicate identifier 'defaultBinding'. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(6,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(6,8): error TS2300: Duplicate identifier 'defaultBinding'. + + +==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0.ts (0 errors) ==== + + export var a = 10; + export var x = a; + export var m = a; + +==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts (12 errors) ==== + import defaultBinding, { } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; + ~~~~~~~~~~~~~~ +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. + ~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'defaultBinding'. + import defaultBinding, { a } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; + ~~~~~~~~~~~~~~ +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. + ~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'defaultBinding'. + import defaultBinding, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; + ~~~~~~~~~~~~~~ +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. + ~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'defaultBinding'. + import defaultBinding, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; + ~~~~~~~~~~~~~~ +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. + ~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'defaultBinding'. + import defaultBinding, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; + ~~~~~~~~~~~~~~ +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. + ~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'defaultBinding'. + import defaultBinding, { m, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; + ~~~~~~~~~~~~~~ +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export or export assignment. + ~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier 'defaultBinding'. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.js b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.js new file mode 100644 index 00000000000..4cf3046532a --- /dev/null +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamedImportInEs5.js @@ -0,0 +1,21 @@ +//// [tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5.ts] //// + +//// [es6ImportDefaultBindingFollowedWithNamedImportInEs5_0.ts] + +export var a = 10; +export var x = a; +export var m = a; + +//// [es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts] +import defaultBinding, { } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding, { a } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding, { m, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; + +//// [es6ImportDefaultBindingFollowedWithNamedImportInEs5_0.js] +exports.a = 10; +exports.x = exports.a; +exports.m = exports.a; +//// [es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.js] diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding.errors.txt new file mode 100644 index 00000000000..98371eb9198 --- /dev/null +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0"' has no default export or export assignment. + + +==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0.ts (0 errors) ==== + + export var a = 10; + +==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_1.ts (1 errors) ==== + import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBinding_0"; + ~~~~~~~~~~~~~~ +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0"' has no default export or export assignment. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding.js b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding.js new file mode 100644 index 00000000000..5ec91279306 --- /dev/null +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBinding.js @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding.ts] //// + +//// [es6ImportDefaultBindingFollowedWithNamespaceBinding_0.ts] + +export var a = 10; + +//// [es6ImportDefaultBindingFollowedWithNamespaceBinding_1.ts] +import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBinding_0"; + +//// [es6ImportDefaultBindingFollowedWithNamespaceBinding_0.js] +exports.a = 10; +//// [es6ImportDefaultBindingFollowedWithNamespaceBinding_1.js] diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.errors.txt new file mode 100644 index 00000000000..f1d20dccc59 --- /dev/null +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"' has no default export or export assignment. + + +==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0.ts (0 errors) ==== + + export var a = 10; + +==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.ts (1 errors) ==== + import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"; + ~~~~~~~~~~~~~~ +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"' has no default export or export assignment. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.js b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.js new file mode 100644 index 00000000000..abd4736fca7 --- /dev/null +++ b/tests/baselines/reference/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.js @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.ts] //// + +//// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0.ts] + +export var a = 10; + +//// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.ts] +import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"; + +//// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0.js] +exports.a = 10; +//// [es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.js] diff --git a/tests/baselines/reference/es6ImportDefaultBindingInEs5.errors.txt b/tests/baselines/reference/es6ImportDefaultBindingInEs5.errors.txt new file mode 100644 index 00000000000..5d656094a8c --- /dev/null +++ b/tests/baselines/reference/es6ImportDefaultBindingInEs5.errors.txt @@ -0,0 +1,11 @@ +tests/cases/compiler/es6ImportDefaultBindingInEs5_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingInEs5_0"' has no default export or export assignment. + + +==== tests/cases/compiler/es6ImportDefaultBindingInEs5_0.ts (0 errors) ==== + + export var a = 10; + +==== tests/cases/compiler/es6ImportDefaultBindingInEs5_1.ts (1 errors) ==== + import defaultBinding from "es6ImportDefaultBindingInEs5_0"; + ~~~~~~~~~~~~~~ +!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingInEs5_0"' has no default export or export assignment. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportDefaultBindingInEs5.js b/tests/baselines/reference/es6ImportDefaultBindingInEs5.js new file mode 100644 index 00000000000..b6d293225fd --- /dev/null +++ b/tests/baselines/reference/es6ImportDefaultBindingInEs5.js @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/es6ImportDefaultBindingInEs5.ts] //// + +//// [es6ImportDefaultBindingInEs5_0.ts] + +export var a = 10; + +//// [es6ImportDefaultBindingInEs5_1.ts] +import defaultBinding from "es6ImportDefaultBindingInEs5_0"; + +//// [es6ImportDefaultBindingInEs5_0.js] +exports.a = 10; +//// [es6ImportDefaultBindingInEs5_1.js] diff --git a/tests/baselines/reference/es6ImportNameSpaceImport.js b/tests/baselines/reference/es6ImportNameSpaceImport.js new file mode 100644 index 00000000000..c6daa3b1222 --- /dev/null +++ b/tests/baselines/reference/es6ImportNameSpaceImport.js @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/es6ImportNameSpaceImport.ts] //// + +//// [es6ImportNameSpaceImport_0.ts] + +export var a = 10; + +//// [es6ImportNameSpaceImport_1.ts] +import * as nameSpaceBinding from "es6ImportNameSpaceImport_0"; + +//// [es6ImportNameSpaceImport_0.js] +exports.a = 10; +//// [es6ImportNameSpaceImport_1.js] diff --git a/tests/baselines/reference/es6ImportNameSpaceImport.types b/tests/baselines/reference/es6ImportNameSpaceImport.types new file mode 100644 index 00000000000..1e09de42ec6 --- /dev/null +++ b/tests/baselines/reference/es6ImportNameSpaceImport.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/es6ImportNameSpaceImport_0.ts === + +export var a = 10; +>a : number + +=== tests/cases/compiler/es6ImportNameSpaceImport_1.ts === +import * as nameSpaceBinding from "es6ImportNameSpaceImport_0"; +>nameSpaceBinding : typeof nameSpaceBinding + diff --git a/tests/baselines/reference/es6ImportNameSpaceImportInEs5.js b/tests/baselines/reference/es6ImportNameSpaceImportInEs5.js new file mode 100644 index 00000000000..2c7785dec6e --- /dev/null +++ b/tests/baselines/reference/es6ImportNameSpaceImportInEs5.js @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/es6ImportNameSpaceImportInEs5.ts] //// + +//// [es6ImportNameSpaceImportInEs5_0.ts] + +export var a = 10; + +//// [es6ImportNameSpaceImportInEs5_1.ts] +import * as nameSpaceBinding from "es6ImportNameSpaceImportInEs5_0"; + +//// [es6ImportNameSpaceImportInEs5_0.js] +exports.a = 10; +//// [es6ImportNameSpaceImportInEs5_1.js] diff --git a/tests/baselines/reference/es6ImportNameSpaceImportInEs5.types b/tests/baselines/reference/es6ImportNameSpaceImportInEs5.types new file mode 100644 index 00000000000..cb7b669eea1 --- /dev/null +++ b/tests/baselines/reference/es6ImportNameSpaceImportInEs5.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/es6ImportNameSpaceImportInEs5_0.ts === + +export var a = 10; +>a : number + +=== tests/cases/compiler/es6ImportNameSpaceImportInEs5_1.ts === +import * as nameSpaceBinding from "es6ImportNameSpaceImportInEs5_0"; +>nameSpaceBinding : typeof nameSpaceBinding + diff --git a/tests/baselines/reference/es6ImportNamedImport.js b/tests/baselines/reference/es6ImportNamedImport.js new file mode 100644 index 00000000000..c52499ef994 --- /dev/null +++ b/tests/baselines/reference/es6ImportNamedImport.js @@ -0,0 +1,27 @@ +//// [tests/cases/compiler/es6ImportNamedImport.ts] //// + +//// [es6ImportNamedImport_0.ts] + +export var a = 10; +export var x = a; +export var m = a; +export var a1 = 10; +export var x1 = 10; + +//// [es6ImportNamedImport_1.ts] +import { } from "es6ImportNamedImport_0"; +import { a } from "es6ImportNamedImport_0"; +import { a as b } from "es6ImportNamedImport_0"; +import { x, a as y } from "es6ImportNamedImport_0"; +import { x as z, } from "es6ImportNamedImport_0"; +import { m, } from "es6ImportNamedImport_0"; +import { a1, x1 } from "es6ImportNamedImport_0"; +import { a1 as a11, x1 as x11 } from "es6ImportNamedImport_0"; + +//// [es6ImportNamedImport_0.js] +exports.a = 10; +exports.x = exports.a; +exports.m = exports.a; +exports.a1 = 10; +exports.x1 = 10; +//// [es6ImportNamedImport_1.js] diff --git a/tests/baselines/reference/es6ImportNamedImport.types b/tests/baselines/reference/es6ImportNamedImport.types new file mode 100644 index 00000000000..e86955b3c96 --- /dev/null +++ b/tests/baselines/reference/es6ImportNamedImport.types @@ -0,0 +1,50 @@ +=== tests/cases/compiler/es6ImportNamedImport_0.ts === + +export var a = 10; +>a : number + +export var x = a; +>x : number +>a : number + +export var m = a; +>m : number +>a : number + +export var a1 = 10; +>a1 : number + +export var x1 = 10; +>x1 : number + +=== tests/cases/compiler/es6ImportNamedImport_1.ts === +import { } from "es6ImportNamedImport_0"; +import { a } from "es6ImportNamedImport_0"; +>a : number + +import { a as b } from "es6ImportNamedImport_0"; +>a : unknown +>b : number + +import { x, a as y } from "es6ImportNamedImport_0"; +>x : number +>a : unknown +>y : number + +import { x as z, } from "es6ImportNamedImport_0"; +>x : unknown +>z : number + +import { m, } from "es6ImportNamedImport_0"; +>m : number + +import { a1, x1 } from "es6ImportNamedImport_0"; +>a1 : number +>x1 : number + +import { a1 as a11, x1 as x11 } from "es6ImportNamedImport_0"; +>a1 : unknown +>a11 : number +>x1 : unknown +>x11 : number + diff --git a/tests/baselines/reference/es6ImportNamedImportIdentifiersParsing.errors.txt b/tests/baselines/reference/es6ImportNamedImportIdentifiersParsing.errors.txt new file mode 100644 index 00000000000..bba30908b01 --- /dev/null +++ b/tests/baselines/reference/es6ImportNamedImportIdentifiersParsing.errors.txt @@ -0,0 +1,48 @@ +tests/cases/compiler/es6ImportNamedImportIdentifiersParsing.ts(2,10): error TS2300: Duplicate identifier 'yield'. +tests/cases/compiler/es6ImportNamedImportIdentifiersParsing.ts(2,23): error TS2307: Cannot find external module 'somemodule'. +tests/cases/compiler/es6ImportNamedImportIdentifiersParsing.ts(3,10): error TS1003: Identifier expected. +tests/cases/compiler/es6ImportNamedImportIdentifiersParsing.ts(3,10): error TS2300: Duplicate identifier 'default'. +tests/cases/compiler/es6ImportNamedImportIdentifiersParsing.ts(3,25): error TS2307: Cannot find external module 'somemodule'. +tests/cases/compiler/es6ImportNamedImportIdentifiersParsing.ts(4,19): error TS1003: Identifier expected. +tests/cases/compiler/es6ImportNamedImportIdentifiersParsing.ts(4,19): error TS2300: Duplicate identifier 'default'. +tests/cases/compiler/es6ImportNamedImportIdentifiersParsing.ts(4,34): error TS2307: Cannot find external module 'somemodule'. +tests/cases/compiler/es6ImportNamedImportIdentifiersParsing.ts(5,21): error TS2300: Duplicate identifier 'yield'. +tests/cases/compiler/es6ImportNamedImportIdentifiersParsing.ts(5,34): error TS2307: Cannot find external module 'somemodule'. +tests/cases/compiler/es6ImportNamedImportIdentifiersParsing.ts(6,21): error TS1003: Identifier expected. +tests/cases/compiler/es6ImportNamedImportIdentifiersParsing.ts(6,21): error TS2300: Duplicate identifier 'default'. +tests/cases/compiler/es6ImportNamedImportIdentifiersParsing.ts(6,36): error TS2307: Cannot find external module 'somemodule'. + + +==== tests/cases/compiler/es6ImportNamedImportIdentifiersParsing.ts (13 errors) ==== + + import { yield } from "somemodule"; // Allowed + ~~~~~ +!!! error TS2300: Duplicate identifier 'yield'. + ~~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'somemodule'. + import { default } from "somemodule"; // Error - as this is keyword that is not allowed as identifier + ~~~~~~~ +!!! error TS1003: Identifier expected. + ~~~~~~~ +!!! error TS2300: Duplicate identifier 'default'. + ~~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'somemodule'. + import { yield as default } from "somemodule"; // error to use default as binding name + ~~~~~~~ +!!! error TS1003: Identifier expected. + ~~~~~~~ +!!! error TS2300: Duplicate identifier 'default'. + ~~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'somemodule'. + import { default as yield } from "somemodule"; // no error + ~~~~~ +!!! error TS2300: Duplicate identifier 'yield'. + ~~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'somemodule'. + import { default as default } from "somemodule"; // default as is ok, error of default binding name + ~~~~~~~ +!!! error TS1003: Identifier expected. + ~~~~~~~ +!!! error TS2300: Duplicate identifier 'default'. + ~~~~~~~~~~~~ +!!! error TS2307: Cannot find external module 'somemodule'. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportNamedImportIdentifiersParsing.js b/tests/baselines/reference/es6ImportNamedImportIdentifiersParsing.js new file mode 100644 index 00000000000..8db7fcd6f9c --- /dev/null +++ b/tests/baselines/reference/es6ImportNamedImportIdentifiersParsing.js @@ -0,0 +1,9 @@ +//// [es6ImportNamedImportIdentifiersParsing.ts] + +import { yield } from "somemodule"; // Allowed +import { default } from "somemodule"; // Error - as this is keyword that is not allowed as identifier +import { yield as default } from "somemodule"; // error to use default as binding name +import { default as yield } from "somemodule"; // no error +import { default as default } from "somemodule"; // default as is ok, error of default binding name + +//// [es6ImportNamedImportIdentifiersParsing.js] diff --git a/tests/baselines/reference/es6ImportNamedImportInEs5.js b/tests/baselines/reference/es6ImportNamedImportInEs5.js new file mode 100644 index 00000000000..66f8ce0ef92 --- /dev/null +++ b/tests/baselines/reference/es6ImportNamedImportInEs5.js @@ -0,0 +1,27 @@ +//// [tests/cases/compiler/es6ImportNamedImportInEs5.ts] //// + +//// [es6ImportNamedImportInEs5_0.ts] + +export var a = 10; +export var x = a; +export var m = a; +export var a1 = 10; +export var x1 = 10; + +//// [es6ImportNamedImportInEs5_1.ts] +import { } from "es6ImportNamedImportInEs5_0"; +import { a } from "es6ImportNamedImportInEs5_0"; +import { a as b } from "es6ImportNamedImportInEs5_0"; +import { x, a as y } from "es6ImportNamedImportInEs5_0"; +import { x as z, } from "es6ImportNamedImportInEs5_0"; +import { m, } from "es6ImportNamedImportInEs5_0"; +import { a1, x1 } from "es6ImportNamedImportInEs5_0"; +import { a1 as a11, x1 as x11 } from "es6ImportNamedImportInEs5_0"; + +//// [es6ImportNamedImportInEs5_0.js] +exports.a = 10; +exports.x = exports.a; +exports.m = exports.a; +exports.a1 = 10; +exports.x1 = 10; +//// [es6ImportNamedImportInEs5_1.js] diff --git a/tests/baselines/reference/es6ImportNamedImportInEs5.types b/tests/baselines/reference/es6ImportNamedImportInEs5.types new file mode 100644 index 00000000000..4f96b8a4dfa --- /dev/null +++ b/tests/baselines/reference/es6ImportNamedImportInEs5.types @@ -0,0 +1,50 @@ +=== tests/cases/compiler/es6ImportNamedImportInEs5_0.ts === + +export var a = 10; +>a : number + +export var x = a; +>x : number +>a : number + +export var m = a; +>m : number +>a : number + +export var a1 = 10; +>a1 : number + +export var x1 = 10; +>x1 : number + +=== tests/cases/compiler/es6ImportNamedImportInEs5_1.ts === +import { } from "es6ImportNamedImportInEs5_0"; +import { a } from "es6ImportNamedImportInEs5_0"; +>a : number + +import { a as b } from "es6ImportNamedImportInEs5_0"; +>a : unknown +>b : number + +import { x, a as y } from "es6ImportNamedImportInEs5_0"; +>x : number +>a : unknown +>y : number + +import { x as z, } from "es6ImportNamedImportInEs5_0"; +>x : unknown +>z : number + +import { m, } from "es6ImportNamedImportInEs5_0"; +>m : number + +import { a1, x1 } from "es6ImportNamedImportInEs5_0"; +>a1 : number +>x1 : number + +import { a1 as a11, x1 as x11 } from "es6ImportNamedImportInEs5_0"; +>a1 : unknown +>a11 : number +>x1 : unknown +>x11 : number + diff --git a/tests/baselines/reference/es6ImportNamedImportParsingError.errors.txt b/tests/baselines/reference/es6ImportNamedImportParsingError.errors.txt new file mode 100644 index 00000000000..22428100985 --- /dev/null +++ b/tests/baselines/reference/es6ImportNamedImportParsingError.errors.txt @@ -0,0 +1,55 @@ +tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,10): error TS1003: Identifier expected. +tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,10): error TS1141: String literal expected. +tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,12): error TS1109: Expression expected. +tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,14): error TS2304: Cannot find name 'from'. +tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(1,19): error TS1005: ';' expected. +tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(2,8): error TS1192: External module '"tests/cases/compiler/es6ImportNamedImportParsingError_0"' has no default export or export assignment. +tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(2,24): error TS1005: '{' expected. +tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(3,1): error TS1128: Declaration or statement expected. +tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(3,8): error TS1128: Declaration or statement expected. +tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(3,16): error TS2304: Cannot find name 'from'. +tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(3,21): error TS1005: ';' expected. +tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(4,13): error TS1005: 'from' expected. +tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(4,13): error TS1141: String literal expected. +tests/cases/compiler/es6ImportNamedImportParsingError_1.ts(4,20): error TS1005: ';' expected. + + +==== tests/cases/compiler/es6ImportNamedImportParsingError_0.ts (0 errors) ==== + + export var a = 10; + export var x = a; + export var m = a; + +==== tests/cases/compiler/es6ImportNamedImportParsingError_1.ts (14 errors) ==== + import { * } from "es6ImportNamedImportParsingError_0"; + ~ +!!! error TS1003: Identifier expected. + ~ +!!! error TS1141: String literal expected. + ~ +!!! error TS1109: Expression expected. + ~~~~ +!!! error TS2304: Cannot find name 'from'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1005: ';' expected. + import defaultBinding, from "es6ImportNamedImportParsingError_0"; + ~~~~~~~~~~~~~~ +!!! error TS1192: External module '"tests/cases/compiler/es6ImportNamedImportParsingError_0"' has no default export or export assignment. + ~~~~ +!!! error TS1005: '{' expected. + import , { a } from "es6ImportNamedImportParsingError_0"; + ~~~~~~ +!!! error TS1128: Declaration or statement expected. + ~ +!!! error TS1128: Declaration or statement expected. + ~~~~ +!!! error TS2304: Cannot find name 'from'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1005: ';' expected. + import { a }, from "es6ImportNamedImportParsingError_0"; + ~ +!!! error TS1005: 'from' expected. + ~~~~~~ +!!! error TS1141: String literal expected. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1005: ';' expected. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportNamedImportParsingError.js b/tests/baselines/reference/es6ImportNamedImportParsingError.js new file mode 100644 index 00000000000..f9d8e90f707 --- /dev/null +++ b/tests/baselines/reference/es6ImportNamedImportParsingError.js @@ -0,0 +1,28 @@ +//// [tests/cases/compiler/es6ImportNamedImportParsingError.ts] //// + +//// [es6ImportNamedImportParsingError_0.ts] + +export var a = 10; +export var x = a; +export var m = a; + +//// [es6ImportNamedImportParsingError_1.ts] +import { * } from "es6ImportNamedImportParsingError_0"; +import defaultBinding, from "es6ImportNamedImportParsingError_0"; +import , { a } from "es6ImportNamedImportParsingError_0"; +import { a }, from "es6ImportNamedImportParsingError_0"; + +//// [es6ImportNamedImportParsingError_0.js] +exports.a = 10; +exports.x = exports.a; +exports.m = exports.a; +//// [es6ImportNamedImportParsingError_1.js] +from; +"es6ImportNamedImportParsingError_0"; +{ + _module_1.a; +} +from; +"es6ImportNamedImportParsingError_0"; +var _module_1 = require(); +"es6ImportNamedImportParsingError_0"; diff --git a/tests/baselines/reference/es6ImportParseErrors.errors.txt b/tests/baselines/reference/es6ImportParseErrors.errors.txt new file mode 100644 index 00000000000..d1e1cb7d00d --- /dev/null +++ b/tests/baselines/reference/es6ImportParseErrors.errors.txt @@ -0,0 +1,8 @@ +tests/cases/compiler/es6ImportParseErrors.ts(2,1): error TS1128: Declaration or statement expected. + + +==== tests/cases/compiler/es6ImportParseErrors.ts (1 errors) ==== + + import 10; + ~~~~~~ +!!! error TS1128: Declaration or statement expected. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportParseErrors.js b/tests/baselines/reference/es6ImportParseErrors.js new file mode 100644 index 00000000000..a42d65fbc9d --- /dev/null +++ b/tests/baselines/reference/es6ImportParseErrors.js @@ -0,0 +1,6 @@ +//// [es6ImportParseErrors.ts] + +import 10; + +//// [es6ImportParseErrors.js] +10; diff --git a/tests/baselines/reference/es6ImportWithoutFromClause.js b/tests/baselines/reference/es6ImportWithoutFromClause.js new file mode 100644 index 00000000000..43d21885c27 --- /dev/null +++ b/tests/baselines/reference/es6ImportWithoutFromClause.js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/es6ImportWithoutFromClause.ts] //// + +//// [es6ImportWithoutFromClause_0.ts] + +export var a = 10; + +//// [es6ImportWithoutFromClause_1.ts] +import "es6ImportWithoutFromClause_0"; + +//// [es6ImportWithoutFromClause_0.js] +exports.a = 10; +//// [es6ImportWithoutFromClause_1.js] +require("es6ImportWithoutFromClause_0"); diff --git a/tests/baselines/reference/es6ImportWithoutFromClause.types b/tests/baselines/reference/es6ImportWithoutFromClause.types new file mode 100644 index 00000000000..1cd7df9962e --- /dev/null +++ b/tests/baselines/reference/es6ImportWithoutFromClause.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/es6ImportWithoutFromClause_0.ts === + +export var a = 10; +>a : number + +=== tests/cases/compiler/es6ImportWithoutFromClause_1.ts === +import "es6ImportWithoutFromClause_0"; +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/es6ImportWithoutFromClauseInEs5.js b/tests/baselines/reference/es6ImportWithoutFromClauseInEs5.js new file mode 100644 index 00000000000..f6610ac5ad2 --- /dev/null +++ b/tests/baselines/reference/es6ImportWithoutFromClauseInEs5.js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/es6ImportWithoutFromClauseInEs5.ts] //// + +//// [es6ImportWithoutFromClauseInEs5_0.ts] + +export var a = 10; + +//// [es6ImportWithoutFromClauseInEs5_1.ts] +import "es6ImportWithoutFromClauseInEs5_0"; + +//// [es6ImportWithoutFromClauseInEs5_0.js] +exports.a = 10; +//// [es6ImportWithoutFromClauseInEs5_1.js] +require("es6ImportWithoutFromClauseInEs5_0"); diff --git a/tests/baselines/reference/es6ImportWithoutFromClauseInEs5.types b/tests/baselines/reference/es6ImportWithoutFromClauseInEs5.types new file mode 100644 index 00000000000..3d674f9c22c --- /dev/null +++ b/tests/baselines/reference/es6ImportWithoutFromClauseInEs5.types @@ -0,0 +1,8 @@ +=== tests/cases/compiler/es6ImportWithoutFromClauseInEs5_0.ts === + +export var a = 10; +>a : number + +=== tests/cases/compiler/es6ImportWithoutFromClauseInEs5_1.ts === +import "es6ImportWithoutFromClauseInEs5_0"; +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/es6MemberScoping.js b/tests/baselines/reference/es6MemberScoping.js index 85f76a93934..7e70045ceb3 100644 --- a/tests/baselines/reference/es6MemberScoping.js +++ b/tests/baselines/reference/es6MemberScoping.js @@ -30,8 +30,6 @@ var Foo = (function () { var Foo2 = (function () { function Foo2() { } - Foo2.Foo2 = function () { - return 0; - }; // should not be an error + Foo2.Foo2 = function () { return 0; }; // should not be an error return Foo2; })(); diff --git a/tests/baselines/reference/escapedIdentifiers.js b/tests/baselines/reference/escapedIdentifiers.js index 5de505e4cb7..7051d8d2433 100644 --- a/tests/baselines/reference/escapedIdentifiers.js +++ b/tests/baselines/reference/escapedIdentifiers.js @@ -143,8 +143,8 @@ var moduleType1; moduleType1.baz1; })(moduleType1 || (moduleType1 = {})); var moduleType\u0032; -(function (moduleType\u0032) { - moduleType\u0032.baz2; +(function (moduleType2) { + moduleType2.baz2; })(moduleType\u0032 || (moduleType\u0032 = {})); moduleType1.baz1 = 3; moduleType\u0031.baz1 = 3; diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.js b/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.js index 291bcfcb68f..707801dc4ee 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.js +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.js @@ -59,9 +59,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -70,9 +68,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var aNumber = 9.9; diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.js b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.js index 7191aef20bf..40e45bf7ec0 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.js +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.js @@ -65,12 +65,8 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} -function F2(x) { - return x < 42; -} +function F(x) { return 42; } +function F2(x) { return x < 42; } var M; (function (M) { var A = (function () { @@ -79,9 +75,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var N; @@ -92,9 +86,7 @@ var N; return A; })(); N.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } N.F2 = F2; })(N || (N = {})); var aNumber = 'this is a string'; diff --git a/tests/baselines/reference/everyTypeWithInitializer.js b/tests/baselines/reference/everyTypeWithInitializer.js index 74904a5ea30..aae0a9fe291 100644 --- a/tests/baselines/reference/everyTypeWithInitializer.js +++ b/tests/baselines/reference/everyTypeWithInitializer.js @@ -60,9 +60,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -71,9 +69,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var aNumber = 9.9; diff --git a/tests/baselines/reference/exportAssignmentFunction.js b/tests/baselines/reference/exportAssignmentFunction.js index 6d4336bd4bd..825d0f983ea 100644 --- a/tests/baselines/reference/exportAssignmentFunction.js +++ b/tests/baselines/reference/exportAssignmentFunction.js @@ -12,9 +12,7 @@ var n: number = fooFunc(); //// [exportAssignmentFunction_A.js] define(["require", "exports"], function (require, exports) { - function foo() { - return 0; - } + function foo() { return 0; } return foo; }); //// [exportAssignmentFunction_B.js] diff --git a/tests/baselines/reference/exportImportMultipleFiles.js b/tests/baselines/reference/exportImportMultipleFiles.js index 225b605f689..10909808ffc 100644 --- a/tests/baselines/reference/exportImportMultipleFiles.js +++ b/tests/baselines/reference/exportImportMultipleFiles.js @@ -14,9 +14,7 @@ lib.math.add(3, 4); // Shouldnt be error //// [exportImportMultipleFiles_math.js] define(["require", "exports"], function (require, exports) { - function add(a, b) { - return a + b; - } + function add(a, b) { return a + b; } exports.add = add; }); //// [exportImportMultipleFiles_library.js] diff --git a/tests/baselines/reference/exportPrivateType.js b/tests/baselines/reference/exportPrivateType.js index 96acc83edb5..11ccc037ef6 100644 --- a/tests/baselines/reference/exportPrivateType.js +++ b/tests/baselines/reference/exportPrivateType.js @@ -41,9 +41,7 @@ var foo; var C2 = (function () { function C2() { } - C2.prototype.test = function () { - return true; - }; + C2.prototype.test = function () { return true; }; return C2; })(); // None of the types are exported, so per section 10.3, should all be errors diff --git a/tests/baselines/reference/fatArrowfunctionAsType.js b/tests/baselines/reference/fatArrowfunctionAsType.js index bd2dc4310d9..894267580c6 100644 --- a/tests/baselines/reference/fatArrowfunctionAsType.js +++ b/tests/baselines/reference/fatArrowfunctionAsType.js @@ -7,7 +7,5 @@ b = c; //// [fatArrowfunctionAsType.js] -var c = function (x) { - return 42; -}; +var c = function (x) { return 42; }; b = c; diff --git a/tests/baselines/reference/fatarrowfunctions.js b/tests/baselines/reference/fatarrowfunctions.js index 1ad00820990..eb57d1a9817 100644 --- a/tests/baselines/reference/fatarrowfunctions.js +++ b/tests/baselines/reference/fatarrowfunctions.js @@ -49,56 +49,30 @@ var messenger = { function foo(x) { return x(); } -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function () { - return 0; -}); foo(function (x, y, z) { return x + y + z; }); foo(function (x, y, z) { return x + y + z; }); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function () { - return 0; -}); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function () { return 0; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function () { return 0; }); foo((function (x) { return x; })); foo(function (x) { return x * x; }); var y = function (x) { return x * x; }; var z = function (x) { return x * x; }; var w = function () { return 3; }; function ternaryTest(isWhile) { - var f = isWhile ? function (n) { - return n > 0; - } : function (n) { - return n === 0; - }; + var f = isWhile ? function (n) { return n > 0; } : function (n) { return n === 0; }; } var messenger = { message: "Hello World", start: function () { var _this = this; - setTimeout(function () { - _this.message.toString(); - }, 3000); + setTimeout(function () { _this.message.toString(); }, 3000); } }; diff --git a/tests/baselines/reference/fatarrowfunctionsErrors.js b/tests/baselines/reference/fatarrowfunctionsErrors.js index 59baa802c9f..7b7a8f30f05 100644 --- a/tests/baselines/reference/fatarrowfunctionsErrors.js +++ b/tests/baselines/reference/fatarrowfunctionsErrors.js @@ -21,9 +21,7 @@ foo(function () { return 0; }); foo((1), { return: 0 }); -foo(function (x) { - return x; -}); +foo(function (x) { return x; }); foo(function (x) { if (x === void 0) { x = 0; } return x; diff --git a/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js b/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js index 6d6e3013fbb..9052b894337 100644 --- a/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js +++ b/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js @@ -208,9 +208,7 @@ foo( return 28; }); // in multiple paren -((((function (arg) { - return 32; -})))); +((((function (arg) { return 32; })))); // in ternary exression false ? function () { return 41; } : null; false ? function (arg) { return 42; } : null; @@ -275,17 +273,9 @@ false ? null : function () { return 68; }; // nested ternary expressions -(function (a) { - return a; -}) ? function (b) { - return b; -} : function (c) { - return c; -}; +(function (a) { return a; }) ? function (b) { return b; } : function (c) { return c; }; //multiple levels -(function (a) { - return a; -}); +(function (a) { return a; }); (function (b) { return function (c) { return 81; }; }); (function (c) { return function (d) { return 82; }; }); // In Expressions diff --git a/tests/baselines/reference/fieldAndGetterWithSameName.js b/tests/baselines/reference/fieldAndGetterWithSameName.js index 64129ff9365..ddd95b9e8f2 100644 --- a/tests/baselines/reference/fieldAndGetterWithSameName.js +++ b/tests/baselines/reference/fieldAndGetterWithSameName.js @@ -10,9 +10,7 @@ define(["require", "exports"], function (require, exports) { function C() { } Object.defineProperty(C.prototype, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/for-inStatements.js b/tests/baselines/reference/for-inStatements.js index 00f1a64a8d6..32e1389232d 100644 --- a/tests/baselines/reference/for-inStatements.js +++ b/tests/baselines/reference/for-inStatements.js @@ -106,9 +106,7 @@ for (var x in '' ? c : d) { } for (var x in 42 ? d[x] : c[x]) { } for (var x in c[d]) { } for (var x in (function (x) { return x; })) { } -for (var x in function (x, y) { - return x + y; -}) { } +for (var x in function (x, y) { return x + y; }) { } var A = (function () { function A() { } diff --git a/tests/baselines/reference/for-inStatementsInvalid.js b/tests/baselines/reference/for-inStatementsInvalid.js index fc43665e99e..6d42a550a01 100644 --- a/tests/baselines/reference/for-inStatementsInvalid.js +++ b/tests/baselines/reference/for-inStatementsInvalid.js @@ -87,9 +87,7 @@ for (var x in '' ? c : d) { } for (var x in 42 ? d[x] : c[x]) { } for (var x in c[23]) { } for (var x in (function (x) { return x; })) { } -for (var x in function (x, y) { - return x + y; -}) { } +for (var x in function (x, y) { return x + y; }) { } var A = (function () { function A() { } diff --git a/tests/baselines/reference/forStatements.js b/tests/baselines/reference/forStatements.js index 1755ff51fdc..39fdb6c8871 100644 --- a/tests/baselines/reference/forStatements.js +++ b/tests/baselines/reference/forStatements.js @@ -57,9 +57,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -68,9 +66,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); for (var aNumber = 9.9;;) { } diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js index 5c856398be2..2282136be3a 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js @@ -77,9 +77,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -88,9 +86,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); // all of these are errors diff --git a/tests/baselines/reference/forStatementsMultipleValidDecl.js b/tests/baselines/reference/forStatementsMultipleValidDecl.js index 76571ce1ff4..e95e37d63ac 100644 --- a/tests/baselines/reference/forStatementsMultipleValidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleValidDecl.js @@ -49,9 +49,7 @@ for (var p = { x: 1, y: undefined };;) { } for (var p = { x: 1, y: 2 };;) { } for (var p = { x: 0, y: undefined };;) { } for (var p;;) { } -for (var fn = function (s) { - return 42; -};;) { } +for (var fn = function (s) { return 42; };;) { } for (var fn = function (s) { return 3; };;) { } for (var fn;;) { } for (var fn;;) { } diff --git a/tests/baselines/reference/functionAssignment.js b/tests/baselines/reference/functionAssignment.js index 5a3e07c9e8d..3237f53bf9a 100644 --- a/tests/baselines/reference/functionAssignment.js +++ b/tests/baselines/reference/functionAssignment.js @@ -53,6 +53,4 @@ f2(function () { function f3(a) { } f3({ a: 0, b: 0 }); function callb(a) { } -callb(function (a) { - a.length; -}); +callb(function (a) { a.length; }); diff --git a/tests/baselines/reference/functionAssignmentError.js b/tests/baselines/reference/functionAssignmentError.js index e19547096b8..dd35ccb271a 100644 --- a/tests/baselines/reference/functionAssignmentError.js +++ b/tests/baselines/reference/functionAssignmentError.js @@ -3,9 +3,5 @@ var func = function (){return "ONE";}; func = function (){return "ONE";}; //// [functionAssignmentError.js] -var func = function () { - return "ONE"; -}; -func = function () { - return "ONE"; -}; +var func = function () { return "ONE"; }; +func = function () { return "ONE"; }; diff --git a/tests/baselines/reference/functionCall1.js b/tests/baselines/reference/functionCall1.js index 8025ad5a6f5..cb8c1a46a23 100644 --- a/tests/baselines/reference/functionCall1.js +++ b/tests/baselines/reference/functionCall1.js @@ -3,8 +3,6 @@ function foo():any{return ""}; var x = foo(); //// [functionCall1.js] -function foo() { - return ""; -} +function foo() { return ""; } ; var x = foo(); diff --git a/tests/baselines/reference/functionCall2.js b/tests/baselines/reference/functionCall2.js index 5b6da378103..5351dc116ff 100644 --- a/tests/baselines/reference/functionCall2.js +++ b/tests/baselines/reference/functionCall2.js @@ -3,8 +3,6 @@ function foo():number{return 1}; var x = foo(); //// [functionCall2.js] -function foo() { - return 1; -} +function foo() { return 1; } ; var x = foo(); diff --git a/tests/baselines/reference/functionCall3.js b/tests/baselines/reference/functionCall3.js index db29b44db7a..74540c2ccf6 100644 --- a/tests/baselines/reference/functionCall3.js +++ b/tests/baselines/reference/functionCall3.js @@ -3,7 +3,5 @@ function foo():any[]{return [1];} var x = foo(); //// [functionCall3.js] -function foo() { - return [1]; -} +function foo() { return [1]; } var x = foo(); diff --git a/tests/baselines/reference/functionCall4.js b/tests/baselines/reference/functionCall4.js index 05021c33563..0f937337d49 100644 --- a/tests/baselines/reference/functionCall4.js +++ b/tests/baselines/reference/functionCall4.js @@ -4,12 +4,8 @@ function bar():()=>any{return foo}; var x = bar(); //// [functionCall4.js] -function foo() { - return ""; -} +function foo() { return ""; } ; -function bar() { - return foo; -} +function bar() { return foo; } ; var x = bar(); diff --git a/tests/baselines/reference/functionCall5.js b/tests/baselines/reference/functionCall5.js index e6b0e049ef6..dc7db4a9959 100644 --- a/tests/baselines/reference/functionCall5.js +++ b/tests/baselines/reference/functionCall5.js @@ -13,8 +13,6 @@ var m1; })(); m1.c1 = c1; })(m1 || (m1 = {})); -function foo() { - return new m1.c1(); -} +function foo() { return new m1.c1(); } ; var x = foo(); diff --git a/tests/baselines/reference/functionCall7.js b/tests/baselines/reference/functionCall7.js index b32c21b5892..cb30e5d8b24 100644 --- a/tests/baselines/reference/functionCall7.js +++ b/tests/baselines/reference/functionCall7.js @@ -18,9 +18,7 @@ var m1; })(); m1.c1 = c1; })(m1 || (m1 = {})); -function foo(a) { - a.a = 1; -} +function foo(a) { a.a = 1; } ; var myC = new m1.c1(); foo(myC); diff --git a/tests/baselines/reference/functionConstraintSatisfaction.js b/tests/baselines/reference/functionConstraintSatisfaction.js index a16f4d1ed36..b8741456178 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction.js +++ b/tests/baselines/reference/functionConstraintSatisfaction.js @@ -63,9 +63,7 @@ function foo2(x: T, y: U) { //// [functionConstraintSatisfaction.js] // satisfaction of a constraint to Function, no errors expected -function foo(x) { - return x; -} +function foo(x) { return x; } var i; var C = (function () { function C() { @@ -78,12 +76,8 @@ var c; var r = foo(new Function()); var r1 = foo(function (x) { return x; }); var r2 = foo(function (x) { return x; }); -var r3 = foo(function (x) { - return x; -}); -var r4 = foo(function (x) { - return x; -}); +var r3 = foo(function (x) { return x; }); +var r4 = foo(function (x) { return x; }); var r5 = foo(i); var r6 = foo(C); var r7 = foo(b); @@ -98,9 +92,7 @@ var a2; var b2; var c2; var r9 = foo(function (x) { return x; }); -var r10 = foo(function (x) { - return x; -}); +var r10 = foo(function (x) { return x; }); var r11 = foo(function (x) { return x; }); var r12 = foo(function (x, y) { return x; }); var r13 = foo(i2); diff --git a/tests/baselines/reference/functionConstraintSatisfaction2.js b/tests/baselines/reference/functionConstraintSatisfaction2.js index 982dcb37a49..9e70a508ccd 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction2.js +++ b/tests/baselines/reference/functionConstraintSatisfaction2.js @@ -42,15 +42,11 @@ function fff(x: T, y: U) { //// [functionConstraintSatisfaction2.js] // satisfaction of a constraint to Function, all of these invocations are errors unless otherwise noted -function foo(x) { - return x; -} +function foo(x) { return x; } foo(1); foo(function () { }, 1); foo(1, function () { }); -function foo2(x) { - return x; -} +function foo2(x) { return x; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/functionConstraintSatisfaction3.js b/tests/baselines/reference/functionConstraintSatisfaction3.js index 4738cecedab..2c1bfa4d399 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction3.js +++ b/tests/baselines/reference/functionConstraintSatisfaction3.js @@ -43,9 +43,7 @@ var r15 = foo(c2); //// [functionConstraintSatisfaction3.js] // satisfaction of a constraint to Function, no errors expected -function foo(x) { - return x; -} +function foo(x) { return x; } var i; var C = (function () { function C() { @@ -57,12 +55,8 @@ var b; var c; var r1 = foo(function (x) { return x; }); var r2 = foo(function (x) { return x; }); -var r3 = foo(function (x) { - return x; -}); -var r4 = foo(function (x) { - return x; -}); +var r3 = foo(function (x) { return x; }); +var r4 = foo(function (x) { return x; }); var r5 = foo(i); var r8 = foo(c); var i2; @@ -74,9 +68,7 @@ var C2 = (function () { var a2; var b2; var c2; -var r9 = foo(function (x) { - return x; -}); +var r9 = foo(function (x) { return x; }); var r10 = foo(function (x) { return x; }); var r12 = foo(i2); var r15 = foo(c2); diff --git a/tests/baselines/reference/functionExpressionReturningItself.js b/tests/baselines/reference/functionExpressionReturningItself.js index 8553d2da867..9485100164e 100644 --- a/tests/baselines/reference/functionExpressionReturningItself.js +++ b/tests/baselines/reference/functionExpressionReturningItself.js @@ -2,9 +2,7 @@ var x = function somefn() { return somefn; }; //// [functionExpressionReturningItself.js] -var x = function somefn() { - return somefn; -}; +var x = function somefn() { return somefn; }; //// [functionExpressionReturningItself.d.ts] diff --git a/tests/baselines/reference/functionOverloadAmbiguity1.js b/tests/baselines/reference/functionOverloadAmbiguity1.js index f2fa78e1c14..2833ccbcdc3 100644 --- a/tests/baselines/reference/functionOverloadAmbiguity1.js +++ b/tests/baselines/reference/functionOverloadAmbiguity1.js @@ -12,10 +12,6 @@ callb2((a) => { a.length; } ); // ok, chose first overload //// [functionOverloadAmbiguity1.js] function callb(a) { } -callb(function (a) { - a.length; -}); // error, chose first overload +callb(function (a) { a.length; }); // error, chose first overload function callb2(a) { } -callb2(function (a) { - a.length; -}); // ok, chose first overload +callb2(function (a) { a.length; }); // ok, chose first overload diff --git a/tests/baselines/reference/functionOverloads.js b/tests/baselines/reference/functionOverloads.js index 5504b286628..7e38b8fe993 100644 --- a/tests/baselines/reference/functionOverloads.js +++ b/tests/baselines/reference/functionOverloads.js @@ -5,8 +5,6 @@ function foo(bar?: string): any { return "" }; var x = foo(5); //// [functionOverloads.js] -function foo(bar) { - return ""; -} +function foo(bar) { return ""; } ; var x = foo(5); diff --git a/tests/baselines/reference/functionOverloads1.js b/tests/baselines/reference/functionOverloads1.js index 695a9c37808..5b4acabd02c 100644 --- a/tests/baselines/reference/functionOverloads1.js +++ b/tests/baselines/reference/functionOverloads1.js @@ -5,6 +5,4 @@ function foo():string { return "a" } //// [functionOverloads1.js] 1 + 1; -function foo() { - return "a"; -} +function foo() { return "a"; } diff --git a/tests/baselines/reference/functionOverloads11.js b/tests/baselines/reference/functionOverloads11.js index efc9c793125..8d85b0ffb7b 100644 --- a/tests/baselines/reference/functionOverloads11.js +++ b/tests/baselines/reference/functionOverloads11.js @@ -4,6 +4,4 @@ function foo():string { return "" } //// [functionOverloads11.js] -function foo() { - return ""; -} +function foo() { return ""; } diff --git a/tests/baselines/reference/functionOverloads12.js b/tests/baselines/reference/functionOverloads12.js index ff789083eeb..4681e43ee5b 100644 --- a/tests/baselines/reference/functionOverloads12.js +++ b/tests/baselines/reference/functionOverloads12.js @@ -5,9 +5,7 @@ function foo():any { if (true) return ""; else return 0;} //// [functionOverloads12.js] -function foo() { - if (true) - return ""; - else - return 0; -} +function foo() { if (true) + return ""; +else + return 0; } diff --git a/tests/baselines/reference/functionOverloads13.js b/tests/baselines/reference/functionOverloads13.js index f9eb4d59e47..ff43c85e3df 100644 --- a/tests/baselines/reference/functionOverloads13.js +++ b/tests/baselines/reference/functionOverloads13.js @@ -5,6 +5,4 @@ function foo(bar?:number):any { return "" } //// [functionOverloads13.js] -function foo(bar) { - return ""; -} +function foo(bar) { return ""; } diff --git a/tests/baselines/reference/functionOverloads14.js b/tests/baselines/reference/functionOverloads14.js index f9a08ecf952..826b096290a 100644 --- a/tests/baselines/reference/functionOverloads14.js +++ b/tests/baselines/reference/functionOverloads14.js @@ -5,6 +5,4 @@ function foo():{a:any;} { return {a:1} } //// [functionOverloads14.js] -function foo() { - return { a: 1 }; -} +function foo() { return { a: 1 }; } diff --git a/tests/baselines/reference/functionOverloads15.js b/tests/baselines/reference/functionOverloads15.js index 2b80df6630c..fe0c90f82af 100644 --- a/tests/baselines/reference/functionOverloads15.js +++ b/tests/baselines/reference/functionOverloads15.js @@ -5,6 +5,4 @@ function foo(foo:{a:string; b?:number;}):any { return "" } //// [functionOverloads15.js] -function foo(foo) { - return ""; -} +function foo(foo) { return ""; } diff --git a/tests/baselines/reference/functionOverloads16.js b/tests/baselines/reference/functionOverloads16.js index ebf82febd16..a0fdaa88894 100644 --- a/tests/baselines/reference/functionOverloads16.js +++ b/tests/baselines/reference/functionOverloads16.js @@ -5,6 +5,4 @@ function foo(foo:{a:string; b?:number;}):any { return "" } //// [functionOverloads16.js] -function foo(foo) { - return ""; -} +function foo(foo) { return ""; } diff --git a/tests/baselines/reference/functionOverloads17.js b/tests/baselines/reference/functionOverloads17.js index d9fa54b744b..3a5dcd81914 100644 --- a/tests/baselines/reference/functionOverloads17.js +++ b/tests/baselines/reference/functionOverloads17.js @@ -4,6 +4,4 @@ function foo():{a:string;} { return {a:""} } //// [functionOverloads17.js] -function foo() { - return { a: "" }; -} +function foo() { return { a: "" }; } diff --git a/tests/baselines/reference/functionOverloads18.js b/tests/baselines/reference/functionOverloads18.js index e1061a32c09..8c196831e48 100644 --- a/tests/baselines/reference/functionOverloads18.js +++ b/tests/baselines/reference/functionOverloads18.js @@ -4,6 +4,4 @@ function foo(bar:{a:string;}) { return {a:""} } //// [functionOverloads18.js] -function foo(bar) { - return { a: "" }; -} +function foo(bar) { return { a: "" }; } diff --git a/tests/baselines/reference/functionOverloads19.js b/tests/baselines/reference/functionOverloads19.js index 6b383225dd0..4183f6a48b8 100644 --- a/tests/baselines/reference/functionOverloads19.js +++ b/tests/baselines/reference/functionOverloads19.js @@ -5,6 +5,4 @@ function foo(bar:{a:any;}) { return {a:""} } //// [functionOverloads19.js] -function foo(bar) { - return { a: "" }; -} +function foo(bar) { return { a: "" }; } diff --git a/tests/baselines/reference/functionOverloads2.js b/tests/baselines/reference/functionOverloads2.js index 7e9eb45d236..39a58663cf4 100644 --- a/tests/baselines/reference/functionOverloads2.js +++ b/tests/baselines/reference/functionOverloads2.js @@ -5,8 +5,6 @@ function foo(bar: any): any { return bar }; var x = foo(true); //// [functionOverloads2.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } ; var x = foo(true); diff --git a/tests/baselines/reference/functionOverloads20.js b/tests/baselines/reference/functionOverloads20.js index 012f2ce09cd..4f259a88538 100644 --- a/tests/baselines/reference/functionOverloads20.js +++ b/tests/baselines/reference/functionOverloads20.js @@ -5,6 +5,4 @@ function foo(bar:{a:any;}): string {return ""} //// [functionOverloads20.js] -function foo(bar) { - return ""; -} +function foo(bar) { return ""; } diff --git a/tests/baselines/reference/functionOverloads21.js b/tests/baselines/reference/functionOverloads21.js index 78fb1fe011f..6e69169efbf 100644 --- a/tests/baselines/reference/functionOverloads21.js +++ b/tests/baselines/reference/functionOverloads21.js @@ -5,6 +5,4 @@ function foo(bar:{a:any; b?:string;}[]) { return 0 } //// [functionOverloads21.js] -function foo(bar) { - return 0; -} +function foo(bar) { return 0; } diff --git a/tests/baselines/reference/functionOverloads22.js b/tests/baselines/reference/functionOverloads22.js index 531c37770b1..54b745d96dd 100644 --- a/tests/baselines/reference/functionOverloads22.js +++ b/tests/baselines/reference/functionOverloads22.js @@ -5,6 +5,4 @@ function foo(bar:any):{a:any;b?:any;}[] { return [{a:""}] } //// [functionOverloads22.js] -function foo(bar) { - return [{ a: "" }]; -} +function foo(bar) { return [{ a: "" }]; } diff --git a/tests/baselines/reference/functionOverloads23.js b/tests/baselines/reference/functionOverloads23.js index d8cac7eb8ee..aa3a7172ada 100644 --- a/tests/baselines/reference/functionOverloads23.js +++ b/tests/baselines/reference/functionOverloads23.js @@ -5,6 +5,4 @@ function foo(bar:(a?)=>void) { return 0 } //// [functionOverloads23.js] -function foo(bar) { - return 0; -} +function foo(bar) { return 0; } diff --git a/tests/baselines/reference/functionOverloads24.js b/tests/baselines/reference/functionOverloads24.js index c7255063174..8fcc3c81902 100644 --- a/tests/baselines/reference/functionOverloads24.js +++ b/tests/baselines/reference/functionOverloads24.js @@ -5,6 +5,4 @@ function foo(bar:any):(a)=>void { return function(){} } //// [functionOverloads24.js] -function foo(bar) { - return function () { }; -} +function foo(bar) { return function () { }; } diff --git a/tests/baselines/reference/functionOverloads25.js b/tests/baselines/reference/functionOverloads25.js index bbaef498926..d466aa82d21 100644 --- a/tests/baselines/reference/functionOverloads25.js +++ b/tests/baselines/reference/functionOverloads25.js @@ -6,8 +6,6 @@ var x = foo(); //// [functionOverloads25.js] -function foo(bar) { - return ''; -} +function foo(bar) { return ''; } ; var x = foo(); diff --git a/tests/baselines/reference/functionOverloads26.js b/tests/baselines/reference/functionOverloads26.js index 088c06147ba..bc4d017b9bb 100644 --- a/tests/baselines/reference/functionOverloads26.js +++ b/tests/baselines/reference/functionOverloads26.js @@ -6,7 +6,5 @@ var x = foo('baz'); //// [functionOverloads26.js] -function foo(bar) { - return ''; -} +function foo(bar) { return ''; } var x = foo('baz'); diff --git a/tests/baselines/reference/functionOverloads27.js b/tests/baselines/reference/functionOverloads27.js index 2b11b1f6c4e..199905d8219 100644 --- a/tests/baselines/reference/functionOverloads27.js +++ b/tests/baselines/reference/functionOverloads27.js @@ -6,7 +6,5 @@ var x = foo(5); //// [functionOverloads27.js] -function foo(bar) { - return ''; -} +function foo(bar) { return ''; } var x = foo(5); diff --git a/tests/baselines/reference/functionOverloads28.js b/tests/baselines/reference/functionOverloads28.js index 566972ee25d..d10ef52e2b2 100644 --- a/tests/baselines/reference/functionOverloads28.js +++ b/tests/baselines/reference/functionOverloads28.js @@ -6,8 +6,6 @@ var t:any; var x = foo(t); //// [functionOverloads28.js] -function foo(bar) { - return ''; -} +function foo(bar) { return ''; } var t; var x = foo(t); diff --git a/tests/baselines/reference/functionOverloads29.js b/tests/baselines/reference/functionOverloads29.js index c828bb95917..edc1ea178bc 100644 --- a/tests/baselines/reference/functionOverloads29.js +++ b/tests/baselines/reference/functionOverloads29.js @@ -6,7 +6,5 @@ var x = foo(); //// [functionOverloads29.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(); diff --git a/tests/baselines/reference/functionOverloads30.js b/tests/baselines/reference/functionOverloads30.js index 27b1436b6fb..bc7593a0771 100644 --- a/tests/baselines/reference/functionOverloads30.js +++ b/tests/baselines/reference/functionOverloads30.js @@ -6,7 +6,5 @@ var x = foo('bar'); //// [functionOverloads30.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo('bar'); diff --git a/tests/baselines/reference/functionOverloads31.js b/tests/baselines/reference/functionOverloads31.js index 01cee2c342b..2c2a15821a7 100644 --- a/tests/baselines/reference/functionOverloads31.js +++ b/tests/baselines/reference/functionOverloads31.js @@ -6,7 +6,5 @@ var x = foo(5); //// [functionOverloads31.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(5); diff --git a/tests/baselines/reference/functionOverloads32.js b/tests/baselines/reference/functionOverloads32.js index 4e0efa98b09..a5557042dfb 100644 --- a/tests/baselines/reference/functionOverloads32.js +++ b/tests/baselines/reference/functionOverloads32.js @@ -6,8 +6,6 @@ var baz:number; var x = foo(baz); //// [functionOverloads32.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var baz; var x = foo(baz); diff --git a/tests/baselines/reference/functionOverloads33.js b/tests/baselines/reference/functionOverloads33.js index 0c01cd54d1e..98bcc09b8b4 100644 --- a/tests/baselines/reference/functionOverloads33.js +++ b/tests/baselines/reference/functionOverloads33.js @@ -6,7 +6,5 @@ var x = foo(5); //// [functionOverloads33.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(5); diff --git a/tests/baselines/reference/functionOverloads34.js b/tests/baselines/reference/functionOverloads34.js index 48ac2b5fc59..3d4311e4193 100644 --- a/tests/baselines/reference/functionOverloads34.js +++ b/tests/baselines/reference/functionOverloads34.js @@ -6,7 +6,5 @@ var x = foo(); //// [functionOverloads34.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(); diff --git a/tests/baselines/reference/functionOverloads35.js b/tests/baselines/reference/functionOverloads35.js index fa373a9ee52..b25ac6c3c5f 100644 --- a/tests/baselines/reference/functionOverloads35.js +++ b/tests/baselines/reference/functionOverloads35.js @@ -6,7 +6,5 @@ var x = foo({a:1}); //// [functionOverloads35.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo({ a: 1 }); diff --git a/tests/baselines/reference/functionOverloads36.js b/tests/baselines/reference/functionOverloads36.js index 33f6156c66b..4e790917d93 100644 --- a/tests/baselines/reference/functionOverloads36.js +++ b/tests/baselines/reference/functionOverloads36.js @@ -6,7 +6,5 @@ var x = foo({a:'foo'}); //// [functionOverloads36.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo({ a: 'foo' }); diff --git a/tests/baselines/reference/functionOverloads37.js b/tests/baselines/reference/functionOverloads37.js index f9e6130dbd9..c4e0d4fd18b 100644 --- a/tests/baselines/reference/functionOverloads37.js +++ b/tests/baselines/reference/functionOverloads37.js @@ -6,7 +6,5 @@ var x = foo(); //// [functionOverloads37.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(); diff --git a/tests/baselines/reference/functionOverloads38.js b/tests/baselines/reference/functionOverloads38.js index 410b4358ede..c973cbe7b67 100644 --- a/tests/baselines/reference/functionOverloads38.js +++ b/tests/baselines/reference/functionOverloads38.js @@ -6,7 +6,5 @@ var x = foo([{a:1}]); //// [functionOverloads38.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{ a: 1 }]); diff --git a/tests/baselines/reference/functionOverloads39.js b/tests/baselines/reference/functionOverloads39.js index 771a3148036..ad4ded394d8 100644 --- a/tests/baselines/reference/functionOverloads39.js +++ b/tests/baselines/reference/functionOverloads39.js @@ -6,7 +6,5 @@ var x = foo([{a:true}]); //// [functionOverloads39.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{ a: true }]); diff --git a/tests/baselines/reference/functionOverloads4.js b/tests/baselines/reference/functionOverloads4.js index b428f6938b4..3a1ff2ced33 100644 --- a/tests/baselines/reference/functionOverloads4.js +++ b/tests/baselines/reference/functionOverloads4.js @@ -3,6 +3,4 @@ function foo():number; function foo():string { return "a" } //// [functionOverloads4.js] -function foo() { - return "a"; -} +function foo() { return "a"; } diff --git a/tests/baselines/reference/functionOverloads40.js b/tests/baselines/reference/functionOverloads40.js index f718f0a8847..11edff26a4b 100644 --- a/tests/baselines/reference/functionOverloads40.js +++ b/tests/baselines/reference/functionOverloads40.js @@ -6,7 +6,5 @@ var x = foo([{a:'bar'}]); //// [functionOverloads40.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{ a: 'bar' }]); diff --git a/tests/baselines/reference/functionOverloads41.js b/tests/baselines/reference/functionOverloads41.js index 566ef21424f..dd730e25b31 100644 --- a/tests/baselines/reference/functionOverloads41.js +++ b/tests/baselines/reference/functionOverloads41.js @@ -6,7 +6,5 @@ var x = foo([{}]); //// [functionOverloads41.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{}]); diff --git a/tests/baselines/reference/functionOverloads42.js b/tests/baselines/reference/functionOverloads42.js index fcca395581c..979bfa86d62 100644 --- a/tests/baselines/reference/functionOverloads42.js +++ b/tests/baselines/reference/functionOverloads42.js @@ -6,7 +6,5 @@ var x = foo([{a:'s'}]); //// [functionOverloads42.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{ a: 's' }]); diff --git a/tests/baselines/reference/functionOverloads7.js b/tests/baselines/reference/functionOverloads7.js index 52cac83af72..540abf9eb8c 100644 --- a/tests/baselines/reference/functionOverloads7.js +++ b/tests/baselines/reference/functionOverloads7.js @@ -14,9 +14,7 @@ class foo { var foo = (function () { function foo() { } - foo.prototype.bar = function (foo) { - return "foo"; - }; + foo.prototype.bar = function (foo) { return "foo"; }; foo.prototype.n = function () { var foo = this.bar(); foo = this.bar("test"); diff --git a/tests/baselines/reference/functionOverloads8.js b/tests/baselines/reference/functionOverloads8.js index 08c2c0b65a1..55539a61659 100644 --- a/tests/baselines/reference/functionOverloads8.js +++ b/tests/baselines/reference/functionOverloads8.js @@ -5,6 +5,4 @@ function foo(foo?:any){ return '' } //// [functionOverloads8.js] -function foo(foo) { - return ''; -} +function foo(foo) { return ''; } diff --git a/tests/baselines/reference/functionOverloads9.js b/tests/baselines/reference/functionOverloads9.js index 53cc0385a59..9d2ae21f4fa 100644 --- a/tests/baselines/reference/functionOverloads9.js +++ b/tests/baselines/reference/functionOverloads9.js @@ -5,8 +5,6 @@ var x = foo('foo'); //// [functionOverloads9.js] -function foo(foo) { - return ''; -} +function foo(foo) { return ''; } ; var x = foo('foo'); diff --git a/tests/baselines/reference/functionReturn.js b/tests/baselines/reference/functionReturn.js index fbb889589a0..c433eec190d 100644 --- a/tests/baselines/reference/functionReturn.js +++ b/tests/baselines/reference/functionReturn.js @@ -20,9 +20,7 @@ function f1() { var n = f0(); } function f2() { } -function f3() { - return; -} +function f3() { return; } function f4() { return ''; return; diff --git a/tests/baselines/reference/generatedContextualTyping.js b/tests/baselines/reference/generatedContextualTyping.js index 68cc22ff45e..0337ab8f1a1 100644 --- a/tests/baselines/reference/generatedContextualTyping.js +++ b/tests/baselines/reference/generatedContextualTyping.js @@ -382,30 +382,17 @@ var Derived2 = (function (_super) { })(Base); var b = new Base(), d1 = new Derived1(), d2 = new Derived2(); var x1 = function () { return [d1, d2]; }; -var x2 = function () { - return [d1, d2]; -}; -var x3 = function named() { - return [d1, d2]; -}; +var x2 = function () { return [d1, d2]; }; +var x3 = function named() { return [d1, d2]; }; var x4 = function () { return [d1, d2]; }; -var x5 = function () { - return [d1, d2]; -}; -var x6 = function named() { - return [d1, d2]; -}; +var x5 = function () { return [d1, d2]; }; +var x6 = function named() { return [d1, d2]; }; var x7 = [d1, d2]; var x8 = [d1, d2]; var x9 = [d1, d2]; var x10 = { n: [d1, d2] }; -var x11 = function (n) { - var n; - return null; -}; -var x12 = { func: function (n) { - return [d1, d2]; -} }; +var x11 = function (n) { var n; return null; }; +var x12 = { func: function (n) { return [d1, d2]; } }; var x13 = (function () { function x13() { this.member = function () { return [d1, d2]; }; @@ -414,17 +401,13 @@ var x13 = (function () { })(); var x14 = (function () { function x14() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x14; })(); var x15 = (function () { function x15() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x15; })(); @@ -436,17 +419,13 @@ var x16 = (function () { })(); var x17 = (function () { function x17() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x17; })(); var x18 = (function () { function x18() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x18; })(); @@ -476,18 +455,13 @@ var x22 = (function () { })(); var x23 = (function () { function x23() { - this.member = function (n) { - var n; - return null; - }; + this.member = function (n) { var n; return null; }; } return x23; })(); var x24 = (function () { function x24() { - this.member = { func: function (n) { - return [d1, d2]; - } }; + this.member = { func: function (n) { return [d1, d2]; } }; } return x24; })(); @@ -499,17 +473,13 @@ var x25 = (function () { })(); var x26 = (function () { function x26() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x26; })(); var x27 = (function () { function x27() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x27; })(); @@ -521,17 +491,13 @@ var x28 = (function () { })(); var x29 = (function () { function x29() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x29; })(); var x30 = (function () { function x30() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x30; })(); @@ -561,18 +527,13 @@ var x34 = (function () { })(); var x35 = (function () { function x35() { - this.member = function (n) { - var n; - return null; - }; + this.member = function (n) { var n; return null; }; } return x35; })(); var x36 = (function () { function x36() { - this.member = { func: function (n) { - return [d1, d2]; - } }; + this.member = { func: function (n) { return [d1, d2]; } }; } return x36; })(); @@ -584,17 +545,13 @@ var x37 = (function () { })(); var x38 = (function () { function x38() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x38; })(); var x39 = (function () { function x39() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x39; })(); @@ -606,17 +563,13 @@ var x40 = (function () { })(); var x41 = (function () { function x41() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x41; })(); var x42 = (function () { function x42() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x42; })(); @@ -646,18 +599,13 @@ var x46 = (function () { })(); var x47 = (function () { function x47() { - this.member = function (n) { - var n; - return null; - }; + this.member = function (n) { var n; return null; }; } return x47; })(); var x48 = (function () { function x48() { - this.member = { func: function (n) { - return [d1, d2]; - } }; + this.member = { func: function (n) { return [d1, d2]; } }; } return x48; })(); @@ -670,17 +618,13 @@ var x49 = (function () { var x50 = (function () { function x50() { } - x50.member = function () { - return [d1, d2]; - }; + x50.member = function () { return [d1, d2]; }; return x50; })(); var x51 = (function () { function x51() { } - x51.member = function named() { - return [d1, d2]; - }; + x51.member = function named() { return [d1, d2]; }; return x51; })(); var x52 = (function () { @@ -692,17 +636,13 @@ var x52 = (function () { var x53 = (function () { function x53() { } - x53.member = function () { - return [d1, d2]; - }; + x53.member = function () { return [d1, d2]; }; return x53; })(); var x54 = (function () { function x54() { } - x54.member = function named() { - return [d1, d2]; - }; + x54.member = function named() { return [d1, d2]; }; return x54; })(); var x55 = (function () { @@ -732,18 +672,13 @@ var x58 = (function () { var x59 = (function () { function x59() { } - x59.member = function (n) { - var n; - return null; - }; + x59.member = function (n) { var n; return null; }; return x59; })(); var x60 = (function () { function x60() { } - x60.member = { func: function (n) { - return [d1, d2]; - } }; + x60.member = { func: function (n) { return [d1, d2]; } }; return x60; })(); var x61 = (function () { @@ -755,17 +690,13 @@ var x61 = (function () { var x62 = (function () { function x62() { } - x62.member = function () { - return [d1, d2]; - }; + x62.member = function () { return [d1, d2]; }; return x62; })(); var x63 = (function () { function x63() { } - x63.member = function named() { - return [d1, d2]; - }; + x63.member = function named() { return [d1, d2]; }; return x63; })(); var x64 = (function () { @@ -777,17 +708,13 @@ var x64 = (function () { var x65 = (function () { function x65() { } - x65.member = function () { - return [d1, d2]; - }; + x65.member = function () { return [d1, d2]; }; return x65; })(); var x66 = (function () { function x66() { } - x66.member = function named() { - return [d1, d2]; - }; + x66.member = function named() { return [d1, d2]; }; return x66; })(); var x67 = (function () { @@ -817,18 +744,13 @@ var x70 = (function () { var x71 = (function () { function x71() { } - x71.member = function (n) { - var n; - return null; - }; + x71.member = function (n) { var n; return null; }; return x71; })(); var x72 = (function () { function x72() { } - x72.member = { func: function (n) { - return [d1, d2]; - } }; + x72.member = { func: function (n) { return [d1, d2]; } }; return x72; })(); var x73 = (function () { @@ -840,17 +762,13 @@ var x73 = (function () { var x74 = (function () { function x74() { } - x74.member = function () { - return [d1, d2]; - }; + x74.member = function () { return [d1, d2]; }; return x74; })(); var x75 = (function () { function x75() { } - x75.member = function named() { - return [d1, d2]; - }; + x75.member = function named() { return [d1, d2]; }; return x75; })(); var x76 = (function () { @@ -862,17 +780,13 @@ var x76 = (function () { var x77 = (function () { function x77() { } - x77.member = function () { - return [d1, d2]; - }; + x77.member = function () { return [d1, d2]; }; return x77; })(); var x78 = (function () { function x78() { } - x78.member = function named() { - return [d1, d2]; - }; + x78.member = function named() { return [d1, d2]; }; return x78; })(); var x79 = (function () { @@ -902,18 +816,13 @@ var x82 = (function () { var x83 = (function () { function x83() { } - x83.member = function (n) { - var n; - return null; - }; + x83.member = function (n) { var n; return null; }; return x83; })(); var x84 = (function () { function x84() { } - x84.member = { func: function (n) { - return [d1, d2]; - } }; + x84.member = { func: function (n) { return [d1, d2]; } }; return x84; })(); var x85 = (function () { @@ -924,17 +833,13 @@ var x85 = (function () { })(); var x86 = (function () { function x86(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } } return x86; })(); var x87 = (function () { function x87(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } } return x87; })(); @@ -946,17 +851,13 @@ var x88 = (function () { })(); var x89 = (function () { function x89(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } } return x89; })(); var x90 = (function () { function x90(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } } return x90; })(); @@ -986,18 +887,13 @@ var x94 = (function () { })(); var x95 = (function () { function x95(parm) { - if (parm === void 0) { parm = function (n) { - var n; - return null; - }; } + if (parm === void 0) { parm = function (n) { var n; return null; }; } } return x95; })(); var x96 = (function () { function x96(parm) { - if (parm === void 0) { parm = { func: function (n) { - return [d1, d2]; - } }; } + if (parm === void 0) { parm = { func: function (n) { return [d1, d2]; } }; } } return x96; })(); @@ -1010,18 +906,14 @@ var x97 = (function () { })(); var x98 = (function () { function x98(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } this.parm = parm; } return x98; })(); var x99 = (function () { function x99(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } this.parm = parm; } return x99; @@ -1035,18 +927,14 @@ var x100 = (function () { })(); var x101 = (function () { function x101(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } this.parm = parm; } return x101; })(); var x102 = (function () { function x102(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } this.parm = parm; } return x102; @@ -1081,19 +969,14 @@ var x106 = (function () { })(); var x107 = (function () { function x107(parm) { - if (parm === void 0) { parm = function (n) { - var n; - return null; - }; } + if (parm === void 0) { parm = function (n) { var n; return null; }; } this.parm = parm; } return x107; })(); var x108 = (function () { function x108(parm) { - if (parm === void 0) { parm = { func: function (n) { - return [d1, d2]; - } }; } + if (parm === void 0) { parm = { func: function (n) { return [d1, d2]; } }; } this.parm = parm; } return x108; @@ -1107,18 +990,14 @@ var x109 = (function () { })(); var x110 = (function () { function x110(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } this.parm = parm; } return x110; })(); var x111 = (function () { function x111(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } this.parm = parm; } return x111; @@ -1132,18 +1011,14 @@ var x112 = (function () { })(); var x113 = (function () { function x113(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } this.parm = parm; } return x113; })(); var x114 = (function () { function x114(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } this.parm = parm; } return x114; @@ -1178,19 +1053,14 @@ var x118 = (function () { })(); var x119 = (function () { function x119(parm) { - if (parm === void 0) { parm = function (n) { - var n; - return null; - }; } + if (parm === void 0) { parm = function (n) { var n; return null; }; } this.parm = parm; } return x119; })(); var x120 = (function () { function x120(parm) { - if (parm === void 0) { parm = { func: function (n) { - return [d1, d2]; - } }; } + if (parm === void 0) { parm = { func: function (n) { return [d1, d2]; } }; } this.parm = parm; } return x120; @@ -1207,242 +1077,65 @@ function x129(parm) { } function x130(parm) { } function x131(parm) { } function x132(parm) { } -function x133() { - return function () { return [d1, d2]; }; -} -function x134() { - return function () { - return [d1, d2]; - }; -} -function x135() { - return function named() { - return [d1, d2]; - }; -} -function x136() { - return function () { return [d1, d2]; }; -} -function x137() { - return function () { - return [d1, d2]; - }; -} -function x138() { - return function named() { - return [d1, d2]; - }; -} -function x139() { - return [d1, d2]; -} -function x140() { - return [d1, d2]; -} -function x141() { - return [d1, d2]; -} -function x142() { - return { n: [d1, d2] }; -} -function x143() { - return function (n) { - var n; - return null; - }; -} -function x144() { - return { func: function (n) { - return [d1, d2]; - } }; -} -function x145() { - return function () { return [d1, d2]; }; - return function () { return [d1, d2]; }; -} -function x146() { - return function () { - return [d1, d2]; - }; - return function () { - return [d1, d2]; - }; -} -function x147() { - return function named() { - return [d1, d2]; - }; - return function named() { - return [d1, d2]; - }; -} -function x148() { - return function () { return [d1, d2]; }; - return function () { return [d1, d2]; }; -} -function x149() { - return function () { - return [d1, d2]; - }; - return function () { - return [d1, d2]; - }; -} -function x150() { - return function named() { - return [d1, d2]; - }; - return function named() { - return [d1, d2]; - }; -} -function x151() { - return [d1, d2]; - return [d1, d2]; -} -function x152() { - return [d1, d2]; - return [d1, d2]; -} -function x153() { - return [d1, d2]; - return [d1, d2]; -} -function x154() { - return { n: [d1, d2] }; - return { n: [d1, d2] }; -} -function x155() { - return function (n) { - var n; - return null; - }; - return function (n) { - var n; - return null; - }; -} -function x156() { - return { func: function (n) { - return [d1, d2]; - } }; - return { func: function (n) { - return [d1, d2]; - } }; -} -var x157 = function () { - return function () { return [d1, d2]; }; -}; -var x158 = function () { - return function () { - return [d1, d2]; - }; -}; -var x159 = function () { - return function named() { - return [d1, d2]; - }; -}; -var x160 = function () { - return function () { return [d1, d2]; }; -}; -var x161 = function () { - return function () { - return [d1, d2]; - }; -}; -var x162 = function () { - return function named() { - return [d1, d2]; - }; -}; -var x163 = function () { - return [d1, d2]; -}; -var x164 = function () { - return [d1, d2]; -}; -var x165 = function () { - return [d1, d2]; -}; -var x166 = function () { - return { n: [d1, d2] }; -}; -var x167 = function () { - return function (n) { - var n; - return null; - }; -}; -var x168 = function () { - return { func: function (n) { - return [d1, d2]; - } }; -}; -var x169 = function () { - return function () { return [d1, d2]; }; -}; -var x170 = function () { - return function () { - return [d1, d2]; - }; -}; -var x171 = function () { - return function named() { - return [d1, d2]; - }; -}; -var x172 = function () { - return function () { return [d1, d2]; }; -}; -var x173 = function () { - return function () { - return [d1, d2]; - }; -}; -var x174 = function () { - return function named() { - return [d1, d2]; - }; -}; -var x175 = function () { - return [d1, d2]; -}; -var x176 = function () { - return [d1, d2]; -}; -var x177 = function () { - return [d1, d2]; -}; -var x178 = function () { - return { n: [d1, d2] }; -}; -var x179 = function () { - return function (n) { - var n; - return null; - }; -}; -var x180 = function () { - return { func: function (n) { - return [d1, d2]; - } }; -}; +function x133() { return function () { return [d1, d2]; }; } +function x134() { return function () { return [d1, d2]; }; } +function x135() { return function named() { return [d1, d2]; }; } +function x136() { return function () { return [d1, d2]; }; } +function x137() { return function () { return [d1, d2]; }; } +function x138() { return function named() { return [d1, d2]; }; } +function x139() { return [d1, d2]; } +function x140() { return [d1, d2]; } +function x141() { return [d1, d2]; } +function x142() { return { n: [d1, d2] }; } +function x143() { return function (n) { var n; return null; }; } +function x144() { return { func: function (n) { return [d1, d2]; } }; } +function x145() { return function () { return [d1, d2]; }; return function () { return [d1, d2]; }; } +function x146() { return function () { return [d1, d2]; }; return function () { return [d1, d2]; }; } +function x147() { return function named() { return [d1, d2]; }; return function named() { return [d1, d2]; }; } +function x148() { return function () { return [d1, d2]; }; return function () { return [d1, d2]; }; } +function x149() { return function () { return [d1, d2]; }; return function () { return [d1, d2]; }; } +function x150() { return function named() { return [d1, d2]; }; return function named() { return [d1, d2]; }; } +function x151() { return [d1, d2]; return [d1, d2]; } +function x152() { return [d1, d2]; return [d1, d2]; } +function x153() { return [d1, d2]; return [d1, d2]; } +function x154() { return { n: [d1, d2] }; return { n: [d1, d2] }; } +function x155() { return function (n) { var n; return null; }; return function (n) { var n; return null; }; } +function x156() { return { func: function (n) { return [d1, d2]; } }; return { func: function (n) { return [d1, d2]; } }; } +var x157 = function () { return function () { return [d1, d2]; }; }; +var x158 = function () { return function () { return [d1, d2]; }; }; +var x159 = function () { return function named() { return [d1, d2]; }; }; +var x160 = function () { return function () { return [d1, d2]; }; }; +var x161 = function () { return function () { return [d1, d2]; }; }; +var x162 = function () { return function named() { return [d1, d2]; }; }; +var x163 = function () { return [d1, d2]; }; +var x164 = function () { return [d1, d2]; }; +var x165 = function () { return [d1, d2]; }; +var x166 = function () { return { n: [d1, d2] }; }; +var x167 = function () { return function (n) { var n; return null; }; }; +var x168 = function () { return { func: function (n) { return [d1, d2]; } }; }; +var x169 = function () { return function () { return [d1, d2]; }; }; +var x170 = function () { return function () { return [d1, d2]; }; }; +var x171 = function () { return function named() { return [d1, d2]; }; }; +var x172 = function () { return function () { return [d1, d2]; }; }; +var x173 = function () { return function () { return [d1, d2]; }; }; +var x174 = function () { return function named() { return [d1, d2]; }; }; +var x175 = function () { return [d1, d2]; }; +var x176 = function () { return [d1, d2]; }; +var x177 = function () { return [d1, d2]; }; +var x178 = function () { return { n: [d1, d2] }; }; +var x179 = function () { return function (n) { var n; return null; }; }; +var x180 = function () { return { func: function (n) { return [d1, d2]; } }; }; var x181; (function (x181) { var t = function () { return [d1, d2]; }; })(x181 || (x181 = {})); var x182; (function (x182) { - var t = function () { - return [d1, d2]; - }; + var t = function () { return [d1, d2]; }; })(x182 || (x182 = {})); var x183; (function (x183) { - var t = function named() { - return [d1, d2]; - }; + var t = function named() { return [d1, d2]; }; })(x183 || (x183 = {})); var x184; (function (x184) { @@ -1450,15 +1143,11 @@ var x184; })(x184 || (x184 = {})); var x185; (function (x185) { - var t = function () { - return [d1, d2]; - }; + var t = function () { return [d1, d2]; }; })(x185 || (x185 = {})); var x186; (function (x186) { - var t = function named() { - return [d1, d2]; - }; + var t = function named() { return [d1, d2]; }; })(x186 || (x186 = {})); var x187; (function (x187) { @@ -1478,16 +1167,11 @@ var x190; })(x190 || (x190 = {})); var x191; (function (x191) { - var t = function (n) { - var n; - return null; - }; + var t = function (n) { var n; return null; }; })(x191 || (x191 = {})); var x192; (function (x192) { - var t = { func: function (n) { - return [d1, d2]; - } }; + var t = { func: function (n) { return [d1, d2]; } }; })(x192 || (x192 = {})); var x193; (function (x193) { @@ -1495,15 +1179,11 @@ var x193; })(x193 || (x193 = {})); var x194; (function (x194) { - x194.t = function () { - return [d1, d2]; - }; + x194.t = function () { return [d1, d2]; }; })(x194 || (x194 = {})); var x195; (function (x195) { - x195.t = function named() { - return [d1, d2]; - }; + x195.t = function named() { return [d1, d2]; }; })(x195 || (x195 = {})); var x196; (function (x196) { @@ -1511,15 +1191,11 @@ var x196; })(x196 || (x196 = {})); var x197; (function (x197) { - x197.t = function () { - return [d1, d2]; - }; + x197.t = function () { return [d1, d2]; }; })(x197 || (x197 = {})); var x198; (function (x198) { - x198.t = function named() { - return [d1, d2]; - }; + x198.t = function named() { return [d1, d2]; }; })(x198 || (x198 = {})); var x199; (function (x199) { @@ -1539,48 +1215,25 @@ var x202; })(x202 || (x202 = {})); var x203; (function (x203) { - x203.t = function (n) { - var n; - return null; - }; + x203.t = function (n) { var n; return null; }; })(x203 || (x203 = {})); var x204; (function (x204) { - x204.t = { func: function (n) { - return [d1, d2]; - } }; + x204.t = { func: function (n) { return [d1, d2]; } }; })(x204 || (x204 = {})); -var x206 = function () { - return [d1, d2]; -}; -var x207 = function named() { - return [d1, d2]; -}; -var x209 = function () { - return [d1, d2]; -}; -var x210 = function named() { - return [d1, d2]; -}; +var x206 = function () { return [d1, d2]; }; +var x207 = function named() { return [d1, d2]; }; +var x209 = function () { return [d1, d2]; }; +var x210 = function named() { return [d1, d2]; }; var x211 = [d1, d2]; var x212 = [d1, d2]; var x213 = [d1, d2]; var x214 = { n: [d1, d2] }; -var x216 = { func: function (n) { - return [d1, d2]; -} }; -var x217 = undefined || function () { - return [d1, d2]; -}; -var x218 = undefined || function named() { - return [d1, d2]; -}; -var x219 = undefined || function () { - return [d1, d2]; -}; -var x220 = undefined || function named() { - return [d1, d2]; -}; +var x216 = { func: function (n) { return [d1, d2]; } }; +var x217 = undefined || function () { return [d1, d2]; }; +var x218 = undefined || function named() { return [d1, d2]; }; +var x219 = undefined || function () { return [d1, d2]; }; +var x220 = undefined || function named() { return [d1, d2]; }; var x221 = undefined || [d1, d2]; var x222 = undefined || [d1, d2]; var x223 = undefined || [d1, d2]; @@ -1588,23 +1241,15 @@ var x224 = undefined || { n: [d1, d2] }; var x225; x225 = function () { return [d1, d2]; }; var x226; -x226 = function () { - return [d1, d2]; -}; +x226 = function () { return [d1, d2]; }; var x227; -x227 = function named() { - return [d1, d2]; -}; +x227 = function named() { return [d1, d2]; }; var x228; x228 = function () { return [d1, d2]; }; var x229; -x229 = function () { - return [d1, d2]; -}; +x229 = function () { return [d1, d2]; }; var x230; -x230 = function named() { - return [d1, d2]; -}; +x230 = function named() { return [d1, d2]; }; var x231; x231 = [d1, d2]; var x232; @@ -1614,223 +1259,107 @@ x233 = [d1, d2]; var x234; x234 = { n: [d1, d2] }; var x235; -x235 = function (n) { - var n; - return null; -}; +x235 = function (n) { var n; return null; }; var x236; -x236 = { func: function (n) { - return [d1, d2]; -} }; +x236 = { func: function (n) { return [d1, d2]; } }; var x237 = { n: function () { return [d1, d2]; } }; -var x238 = { n: function () { - return [d1, d2]; -} }; -var x239 = { n: function named() { - return [d1, d2]; -} }; +var x238 = { n: function () { return [d1, d2]; } }; +var x239 = { n: function named() { return [d1, d2]; } }; var x240 = { n: function () { return [d1, d2]; } }; -var x241 = { n: function () { - return [d1, d2]; -} }; -var x242 = { n: function named() { - return [d1, d2]; -} }; +var x241 = { n: function () { return [d1, d2]; } }; +var x242 = { n: function named() { return [d1, d2]; } }; var x243 = { n: [d1, d2] }; var x244 = { n: [d1, d2] }; var x245 = { n: [d1, d2] }; var x246 = { n: { n: [d1, d2] } }; -var x247 = { n: function (n) { - var n; - return null; -} }; -var x248 = { n: { func: function (n) { - return [d1, d2]; -} } }; +var x247 = { n: function (n) { var n; return null; } }; +var x248 = { n: { func: function (n) { return [d1, d2]; } } }; var x252 = [function () { return [d1, d2]; }]; -var x253 = [function () { - return [d1, d2]; -}]; -var x254 = [function named() { - return [d1, d2]; -}]; +var x253 = [function () { return [d1, d2]; }]; +var x254 = [function named() { return [d1, d2]; }]; var x255 = [[d1, d2]]; var x256 = [[d1, d2]]; var x257 = [[d1, d2]]; var x258 = [{ n: [d1, d2] }]; -var x260 = [{ func: function (n) { - return [d1, d2]; -} }]; -var x261 = function () { - return [d1, d2]; -} || undefined; -var x262 = function named() { - return [d1, d2]; -} || undefined; -var x263 = function () { - return [d1, d2]; -} || undefined; -var x264 = function named() { - return [d1, d2]; -} || undefined; +var x260 = [{ func: function (n) { return [d1, d2]; } }]; +var x261 = function () { return [d1, d2]; } || undefined; +var x262 = function named() { return [d1, d2]; } || undefined; +var x263 = function () { return [d1, d2]; } || undefined; +var x264 = function named() { return [d1, d2]; } || undefined; var x265 = [d1, d2] || undefined; var x266 = [d1, d2] || undefined; var x267 = [d1, d2] || undefined; var x268 = { n: [d1, d2] } || undefined; -var x269 = undefined || function () { - return [d1, d2]; -}; -var x270 = undefined || function named() { - return [d1, d2]; -}; -var x271 = undefined || function () { - return [d1, d2]; -}; -var x272 = undefined || function named() { - return [d1, d2]; -}; +var x269 = undefined || function () { return [d1, d2]; }; +var x270 = undefined || function named() { return [d1, d2]; }; +var x271 = undefined || function () { return [d1, d2]; }; +var x272 = undefined || function named() { return [d1, d2]; }; var x273 = undefined || [d1, d2]; var x274 = undefined || [d1, d2]; var x275 = undefined || [d1, d2]; var x276 = undefined || { n: [d1, d2] }; -var x277 = function () { - return [d1, d2]; -} || function () { - return [d1, d2]; -}; -var x278 = function named() { - return [d1, d2]; -} || function named() { - return [d1, d2]; -}; -var x279 = function () { - return [d1, d2]; -} || function () { - return [d1, d2]; -}; -var x280 = function named() { - return [d1, d2]; -} || function named() { - return [d1, d2]; -}; +var x277 = function () { return [d1, d2]; } || function () { return [d1, d2]; }; +var x278 = function named() { return [d1, d2]; } || function named() { return [d1, d2]; }; +var x279 = function () { return [d1, d2]; } || function () { return [d1, d2]; }; +var x280 = function named() { return [d1, d2]; } || function named() { return [d1, d2]; }; var x281 = [d1, d2] || [d1, d2]; var x282 = [d1, d2] || [d1, d2]; var x283 = [d1, d2] || [d1, d2]; var x284 = { n: [d1, d2] } || { n: [d1, d2] }; var x285 = true ? function () { return [d1, d2]; } : function () { return [d1, d2]; }; -var x286 = true ? function () { - return [d1, d2]; -} : function () { - return [d1, d2]; -}; -var x287 = true ? function named() { - return [d1, d2]; -} : function named() { - return [d1, d2]; -}; +var x286 = true ? function () { return [d1, d2]; } : function () { return [d1, d2]; }; +var x287 = true ? function named() { return [d1, d2]; } : function named() { return [d1, d2]; }; var x288 = true ? function () { return [d1, d2]; } : function () { return [d1, d2]; }; -var x289 = true ? function () { - return [d1, d2]; -} : function () { - return [d1, d2]; -}; -var x290 = true ? function named() { - return [d1, d2]; -} : function named() { - return [d1, d2]; -}; +var x289 = true ? function () { return [d1, d2]; } : function () { return [d1, d2]; }; +var x290 = true ? function named() { return [d1, d2]; } : function named() { return [d1, d2]; }; var x291 = true ? [d1, d2] : [d1, d2]; var x292 = true ? [d1, d2] : [d1, d2]; var x293 = true ? [d1, d2] : [d1, d2]; var x294 = true ? { n: [d1, d2] } : { n: [d1, d2] }; -var x295 = true ? function (n) { - var n; - return null; -} : function (n) { - var n; - return null; -}; -var x296 = true ? { func: function (n) { - return [d1, d2]; -} } : { func: function (n) { - return [d1, d2]; -} }; +var x295 = true ? function (n) { var n; return null; } : function (n) { var n; return null; }; +var x296 = true ? { func: function (n) { return [d1, d2]; } } : { func: function (n) { return [d1, d2]; } }; var x297 = true ? undefined : function () { return [d1, d2]; }; -var x298 = true ? undefined : function () { - return [d1, d2]; -}; -var x299 = true ? undefined : function named() { - return [d1, d2]; -}; +var x298 = true ? undefined : function () { return [d1, d2]; }; +var x299 = true ? undefined : function named() { return [d1, d2]; }; var x300 = true ? undefined : function () { return [d1, d2]; }; -var x301 = true ? undefined : function () { - return [d1, d2]; -}; -var x302 = true ? undefined : function named() { - return [d1, d2]; -}; +var x301 = true ? undefined : function () { return [d1, d2]; }; +var x302 = true ? undefined : function named() { return [d1, d2]; }; var x303 = true ? undefined : [d1, d2]; var x304 = true ? undefined : [d1, d2]; var x305 = true ? undefined : [d1, d2]; var x306 = true ? undefined : { n: [d1, d2] }; -var x307 = true ? undefined : function (n) { - var n; - return null; -}; -var x308 = true ? undefined : { func: function (n) { - return [d1, d2]; -} }; +var x307 = true ? undefined : function (n) { var n; return null; }; +var x308 = true ? undefined : { func: function (n) { return [d1, d2]; } }; var x309 = true ? function () { return [d1, d2]; } : undefined; -var x310 = true ? function () { - return [d1, d2]; -} : undefined; -var x311 = true ? function named() { - return [d1, d2]; -} : undefined; +var x310 = true ? function () { return [d1, d2]; } : undefined; +var x311 = true ? function named() { return [d1, d2]; } : undefined; var x312 = true ? function () { return [d1, d2]; } : undefined; -var x313 = true ? function () { - return [d1, d2]; -} : undefined; -var x314 = true ? function named() { - return [d1, d2]; -} : undefined; +var x313 = true ? function () { return [d1, d2]; } : undefined; +var x314 = true ? function named() { return [d1, d2]; } : undefined; var x315 = true ? [d1, d2] : undefined; var x316 = true ? [d1, d2] : undefined; var x317 = true ? [d1, d2] : undefined; var x318 = true ? { n: [d1, d2] } : undefined; -var x319 = true ? function (n) { - var n; - return null; -} : undefined; -var x320 = true ? { func: function (n) { - return [d1, d2]; -} } : undefined; +var x319 = true ? function (n) { var n; return null; } : undefined; +var x320 = true ? { func: function (n) { return [d1, d2]; } } : undefined; function x321(n) { } ; x321(function () { return [d1, d2]; }); function x322(n) { } ; -x322(function () { - return [d1, d2]; -}); +x322(function () { return [d1, d2]; }); function x323(n) { } ; -x323(function named() { - return [d1, d2]; -}); +x323(function named() { return [d1, d2]; }); function x324(n) { } ; x324(function () { return [d1, d2]; }); function x325(n) { } ; -x325(function () { - return [d1, d2]; -}); +x325(function () { return [d1, d2]; }); function x326(n) { } ; -x326(function named() { - return [d1, d2]; -}); +x326(function named() { return [d1, d2]; }); function x327(n) { } ; x327([d1, d2]); @@ -1845,35 +1374,22 @@ function x330(n) { } x330({ n: [d1, d2] }); function x331(n) { } ; -x331(function (n) { - var n; - return null; -}); +x331(function (n) { var n; return null; }); function x332(n) { } ; -x332({ func: function (n) { - return [d1, d2]; -} }); +x332({ func: function (n) { return [d1, d2]; } }); var x333 = function (n) { return n; }; x333(function () { return [d1, d2]; }); var x334 = function (n) { return n; }; -x334(function () { - return [d1, d2]; -}); +x334(function () { return [d1, d2]; }); var x335 = function (n) { return n; }; -x335(function named() { - return [d1, d2]; -}); +x335(function named() { return [d1, d2]; }); var x336 = function (n) { return n; }; x336(function () { return [d1, d2]; }); var x337 = function (n) { return n; }; -x337(function () { - return [d1, d2]; -}); +x337(function () { return [d1, d2]; }); var x338 = function (n) { return n; }; -x338(function named() { - return [d1, d2]; -}); +x338(function named() { return [d1, d2]; }); var x339 = function (n) { return n; }; x339([d1, d2]); var x340 = function (n) { return n; }; @@ -1883,34 +1399,21 @@ x341([d1, d2]); var x342 = function (n) { return n; }; x342({ n: [d1, d2] }); var x343 = function (n) { return n; }; -x343(function (n) { - var n; - return null; -}); +x343(function (n) { var n; return null; }); var x344 = function (n) { return n; }; -x344({ func: function (n) { - return [d1, d2]; -} }); +x344({ func: function (n) { return [d1, d2]; } }); var x345 = function (n) { }; x345(function () { return [d1, d2]; }); var x346 = function (n) { }; -x346(function () { - return [d1, d2]; -}); +x346(function () { return [d1, d2]; }); var x347 = function (n) { }; -x347(function named() { - return [d1, d2]; -}); +x347(function named() { return [d1, d2]; }); var x348 = function (n) { }; x348(function () { return [d1, d2]; }); var x349 = function (n) { }; -x349(function () { - return [d1, d2]; -}); +x349(function () { return [d1, d2]; }); var x350 = function (n) { }; -x350(function named() { - return [d1, d2]; -}); +x350(function named() { return [d1, d2]; }); var x351 = function (n) { }; x351([d1, d2]); var x352 = function (n) { }; @@ -1920,11 +1423,6 @@ x353([d1, d2]); var x354 = function (n) { }; x354({ n: [d1, d2] }); var x355 = function (n) { }; -x355(function (n) { - var n; - return null; -}); +x355(function (n) { var n; return null; }); var x356 = function (n) { }; -x356({ func: function (n) { - return [d1, d2]; -} }); +x356({ func: function (n) { return [d1, d2]; } }); diff --git a/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.js b/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.js index 7abeeda445a..70f70ae07ba 100644 --- a/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.js +++ b/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.js @@ -23,9 +23,7 @@ var a4: I = >z; var A = (function () { function A() { } - A.prototype.compareTo = function (other) { - return 1; - }; + A.prototype.compareTo = function (other) { return 1; }; return A; })(); var z = { x: new A() }; diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.js b/tests/baselines/reference/genericCallWithFunctionTypedArguments.js index fed1d4ca990..30d4ed353ff 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments.js +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.js @@ -48,25 +48,19 @@ var r3 = foo(function (x) { return ''; }); // {} function foo2(x, cb) { return cb(x); } -var r4 = foo2(1, function (a) { - return ''; -}); // string, contextual signature instantiation is applied to generic functions +var r4 = foo2(1, function (a) { return ''; }); // string, contextual signature instantiation is applied to generic functions var r5 = foo2(1, function (a) { return ''; }); // string var r6 = foo2('', function (a) { return 1; }); function foo3(x, cb, y) { return cb(x); } var r7 = foo3(1, function (a) { return ''; }, ''); // string -var r8 = foo3(1, function (a) { - return ''; -}, 1); // error +var r8 = foo3(1, function (a) { return ''; }, 1); // error var r9 = foo3(1, function (a) { return ''; }, ''); // string function other(t, u) { var r10 = foo2(1, function (x) { return ''; }); // error var r10 = foo2(1, function (x) { return ''; }); // string var r11 = foo3(1, function (x) { return ''; }, ''); // error var r11b = foo3(1, function (x) { return ''; }, 1); // error - var r12 = foo3(1, function (a) { - return ''; - }, 1); // error + var r12 = foo3(1, function (a) { return ''; }, 1); // error } diff --git a/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js b/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js index c289ce3de14..f140caaac61 100644 --- a/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js +++ b/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js @@ -8,9 +8,7 @@ var x4 = foo({ x: "", y: 4 }, ""); var x5 = foo({ x: "", y: 4 }, ""); //// [genericCallWithObjectLiteralArguments1.js] -function foo(n, m) { - return m; -} +function foo(n, m) { return m; } // these are all errors var x = foo({ x: 3, y: "" }, 4); var x2 = foo({ x: 3, y: "" }, 4); diff --git a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.js b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.js index 25001bd86bb..b4f96f67942 100644 --- a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.js +++ b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.js @@ -46,10 +46,7 @@ var NonGenericParameter; function foo4(cb) { return cb; } - var r3 = foo4(function (x) { - var r; - return r; - }); // ok + var r3 = foo4(function (x) { var r; return r; }); // ok })(NonGenericParameter || (NonGenericParameter = {})); var GenericParameter; (function (GenericParameter) { diff --git a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js index 5aa2c716986..4f26e35d1b0 100644 --- a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js +++ b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js @@ -92,9 +92,7 @@ var Portal; function Validator(message) { } Validator.prototype.destroy = function () { }; - Validator.prototype._validate = function (value) { - return 0; - }; + Validator.prototype._validate = function (value) { return 0; }; return Validator; })(); Validators.Validator = Validator; diff --git a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js index 7ec25949534..5156c4d6b12 100644 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js @@ -104,9 +104,7 @@ var WithCandidates; return C; })(); var c; - var r4 = c.foo2(1, function (a) { - return ''; - }); // string, contextual signature instantiation is applied to generic functions + var r4 = c.foo2(1, function (a) { return ''; }); // string, contextual signature instantiation is applied to generic functions var r5 = c.foo2(1, function (a) { return ''; }); // string var r6 = c.foo2('', function (a) { return 1; }); // number var C2 = (function () { @@ -119,9 +117,7 @@ var WithCandidates; })(); var c2; var r7 = c2.foo3(1, function (a) { return ''; }, ''); // string - var r8 = c2.foo3(1, function (a) { - return ''; - }, ''); // string + var r8 = c2.foo3(1, function (a) { return ''; }, ''); // string var C3 = (function () { function C3() { } @@ -136,8 +132,6 @@ var WithCandidates; var r10 = c.foo2(1, function (x) { return ''; }); // string var r11 = c3.foo3(1, function (x) { return ''; }, ''); // error var r11b = c3.foo3(1, function (x) { return ''; }, 1); // error - var r12 = c3.foo3(1, function (a) { - return ''; - }, 1); // error + var r12 = c3.foo3(1, function (a) { return ''; }, 1); // error } })(WithCandidates || (WithCandidates = {})); diff --git a/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js b/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js index 2fd410756b6..4caeacd19e2 100644 --- a/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js +++ b/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js @@ -28,8 +28,6 @@ var Foo = (function () { Foo.a = function (n) { }; Foo.c = []; Foo.d = false || (function (x) { return x || undefined; })(null); - Foo.e = function (x) { - return null; - }; + Foo.e = function (x) { return null; }; return Foo; })(); diff --git a/tests/baselines/reference/genericCombinators2.js b/tests/baselines/reference/genericCombinators2.js index af11f056197..a23f163a906 100644 --- a/tests/baselines/reference/genericCombinators2.js +++ b/tests/baselines/reference/genericCombinators2.js @@ -19,10 +19,6 @@ var r5b = _.map(c2, rf1); //// [genericCombinators2.js] var _; var c2; -var rf1 = function (x, y) { - return x.toFixed(); -}; -var r5a = _.map(c2, function (x, y) { - return x.toFixed(); -}); +var rf1 = function (x, y) { return x.toFixed(); }; +var r5a = _.map(c2, function (x, y) { return x.toFixed(); }); var r5b = _.map(c2, rf1); diff --git a/tests/baselines/reference/genericConstraintDeclaration.js b/tests/baselines/reference/genericConstraintDeclaration.js index cdf93d676d0..6e3f8d5ff8b 100644 --- a/tests/baselines/reference/genericConstraintDeclaration.js +++ b/tests/baselines/reference/genericConstraintDeclaration.js @@ -12,9 +12,7 @@ class List{ var List = (function () { function List() { } - List.empty = function () { - return null; - }; + List.empty = function () { return null; }; return List; })(); diff --git a/tests/baselines/reference/genericFunctions0.js b/tests/baselines/reference/genericFunctions0.js index 408abdb9ce0..b52f0583524 100644 --- a/tests/baselines/reference/genericFunctions0.js +++ b/tests/baselines/reference/genericFunctions0.js @@ -4,9 +4,7 @@ function foo (x: T) { return x; } var x = foo(5); // 'x' should be number //// [genericFunctions0.js] -function foo(x) { - return x; -} +function foo(x) { return x; } var x = foo(5); // 'x' should be number diff --git a/tests/baselines/reference/genericFunctions1.js b/tests/baselines/reference/genericFunctions1.js index 25cc91820b8..d9bb3413890 100644 --- a/tests/baselines/reference/genericFunctions1.js +++ b/tests/baselines/reference/genericFunctions1.js @@ -4,9 +4,7 @@ function foo (x: T) { return x; } var x = foo(5); // 'x' should be number //// [genericFunctions1.js] -function foo(x) { - return x; -} +function foo(x) { return x; } var x = foo(5); // 'x' should be number diff --git a/tests/baselines/reference/genericFunctionsWithOptionalParameters3.js b/tests/baselines/reference/genericFunctionsWithOptionalParameters3.js index d2e1a5ecc37..9ad885a899a 100644 --- a/tests/baselines/reference/genericFunctionsWithOptionalParameters3.js +++ b/tests/baselines/reference/genericFunctionsWithOptionalParameters3.js @@ -24,20 +24,8 @@ var Collection = (function () { })(); var utils; var c = new Collection(); -var r3 = utils.mapReduce(c, function (x) { - return 1; -}, function (y) { - return new Date(); -}); -var r4 = utils.mapReduce(c, function (x) { - return 1; -}, function (y) { - return new Date(); -}); -var f1 = function (x) { - return 1; -}; -var f2 = function (y) { - return new Date(); -}; +var r3 = utils.mapReduce(c, function (x) { return 1; }, function (y) { return new Date(); }); +var r4 = utils.mapReduce(c, function (x) { return 1; }, function (y) { return new Date(); }); +var f1 = function (x) { return 1; }; +var f2 = function (y) { return new Date(); }; var r5 = utils.mapReduce(c, f1, f2); diff --git a/tests/baselines/reference/genericFunduleInModule.js b/tests/baselines/reference/genericFunduleInModule.js index 5a85a46a395..95700edecab 100644 --- a/tests/baselines/reference/genericFunduleInModule.js +++ b/tests/baselines/reference/genericFunduleInModule.js @@ -12,9 +12,7 @@ A.B(1); //// [genericFunduleInModule.js] var A; (function (A) { - function B(x) { - return x; - } + function B(x) { return x; } A.B = B; var B; (function (B) { diff --git a/tests/baselines/reference/genericFunduleInModule2.js b/tests/baselines/reference/genericFunduleInModule2.js index 6b5a0a74e23..956e9129ec7 100644 --- a/tests/baselines/reference/genericFunduleInModule2.js +++ b/tests/baselines/reference/genericFunduleInModule2.js @@ -15,9 +15,7 @@ A.B(1); //// [genericFunduleInModule2.js] var A; (function (A) { - function B(x) { - return x; - } + function B(x) { return x; } A.B = B; })(A || (A = {})); var A; diff --git a/tests/baselines/reference/genericImplements.js b/tests/baselines/reference/genericImplements.js index 17d3d2c0d20..b8d295153a4 100644 --- a/tests/baselines/reference/genericImplements.js +++ b/tests/baselines/reference/genericImplements.js @@ -37,26 +37,20 @@ var B = (function () { var X = (function () { function X() { } - X.prototype.f = function () { - return undefined; - }; + X.prototype.f = function () { return undefined; }; return X; })(); // { f: () => { b; } } // OK var Y = (function () { function Y() { } - Y.prototype.f = function () { - return undefined; - }; + Y.prototype.f = function () { return undefined; }; return Y; })(); // { f: () => { a; } } // OK var Z = (function () { function Z() { } - Z.prototype.f = function () { - return undefined; - }; + Z.prototype.f = function () { return undefined; }; return Z; })(); // { f: () => T } diff --git a/tests/baselines/reference/genericLambaArgWithoutTypeArguments.js b/tests/baselines/reference/genericLambaArgWithoutTypeArguments.js index f57f6713c9f..e1cc5cadbd5 100644 --- a/tests/baselines/reference/genericLambaArgWithoutTypeArguments.js +++ b/tests/baselines/reference/genericLambaArgWithoutTypeArguments.js @@ -12,6 +12,4 @@ foo((arg: Foo) => { return arg.x; }); function foo(a) { return null; } -foo(function (arg) { - return arg.x; -}); +foo(function (arg) { return arg.x; }); diff --git a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js index 5d4ecdc0838..9b0fbf4bcad 100644 --- a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js +++ b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js @@ -7,9 +7,7 @@ module foo { //// [genericMergedDeclarationUsingTypeParameter.js] -function foo(y, z) { - return y; -} +function foo(y, z) { return y; } var foo; (function (foo) { foo.x; diff --git a/tests/baselines/reference/genericObjectLitReturnType.js b/tests/baselines/reference/genericObjectLitReturnType.js index 5191f17796b..826f5233b55 100644 --- a/tests/baselines/reference/genericObjectLitReturnType.js +++ b/tests/baselines/reference/genericObjectLitReturnType.js @@ -15,9 +15,7 @@ t1.a = 5; // Should not error: t1 should have type {a: number}, instead has type var X = (function () { function X() { } - X.prototype.f = function (t) { - return { a: t }; - }; + X.prototype.f = function (t) { return { a: t }; }; return X; })(); var x; diff --git a/tests/baselines/reference/genericOfACloduleType1.js b/tests/baselines/reference/genericOfACloduleType1.js index 85629db765b..1f115aa486a 100644 --- a/tests/baselines/reference/genericOfACloduleType1.js +++ b/tests/baselines/reference/genericOfACloduleType1.js @@ -16,9 +16,7 @@ var g2 = new G() // was: error Type reference cannot refer to container 'M. var G = (function () { function G() { } - G.prototype.bar = function (x) { - return x; - }; + G.prototype.bar = function (x) { return x; }; return G; })(); var M; diff --git a/tests/baselines/reference/genericOfACloduleType2.js b/tests/baselines/reference/genericOfACloduleType2.js index 0b10451bf2c..1d671289cb2 100644 --- a/tests/baselines/reference/genericOfACloduleType2.js +++ b/tests/baselines/reference/genericOfACloduleType2.js @@ -19,9 +19,7 @@ module N { var G = (function () { function G() { } - G.prototype.bar = function (x) { - return x; - }; + G.prototype.bar = function (x) { return x; }; return G; })(); var M; diff --git a/tests/baselines/reference/genericParameterAssignability1.js b/tests/baselines/reference/genericParameterAssignability1.js index 844c8f9a988..a6a465b4089 100644 --- a/tests/baselines/reference/genericParameterAssignability1.js +++ b/tests/baselines/reference/genericParameterAssignability1.js @@ -4,8 +4,6 @@ var r = (x: T) => x; r = f; // should be allowed //// [genericParameterAssignability1.js] -function f(x) { - return null; -} +function f(x) { return null; } var r = function (x) { return x; }; r = f; // should be allowed diff --git a/tests/baselines/reference/genericPrototypeProperty.js b/tests/baselines/reference/genericPrototypeProperty.js index c38cdb753a7..fb6f9b78848 100644 --- a/tests/baselines/reference/genericPrototypeProperty.js +++ b/tests/baselines/reference/genericPrototypeProperty.js @@ -13,9 +13,7 @@ var r3 = r.foo(null); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var r = C.prototype; diff --git a/tests/baselines/reference/genericReturnTypeFromGetter1.js b/tests/baselines/reference/genericReturnTypeFromGetter1.js index 208b12308e1..741c7218345 100644 --- a/tests/baselines/reference/genericReturnTypeFromGetter1.js +++ b/tests/baselines/reference/genericReturnTypeFromGetter1.js @@ -14,9 +14,7 @@ define(["require", "exports"], function (require, exports) { function DbSet() { } Object.defineProperty(DbSet.prototype, "entityType", { - get: function () { - return this._entityType; - } // used to ICE without return type annotation + get: function () { return this._entityType; } // used to ICE without return type annotation , enumerable: true, configurable: true diff --git a/tests/baselines/reference/genericReversingTypeParameters.js b/tests/baselines/reference/genericReversingTypeParameters.js index 0e51b0256ea..2a52c2e9ba6 100644 --- a/tests/baselines/reference/genericReversingTypeParameters.js +++ b/tests/baselines/reference/genericReversingTypeParameters.js @@ -14,12 +14,8 @@ var r2b = i.get(1); var BiMap = (function () { function BiMap() { } - BiMap.prototype.get = function (key) { - return null; - }; - BiMap.prototype.inverse = function () { - return null; - }; + BiMap.prototype.get = function (key) { return null; }; + BiMap.prototype.inverse = function () { return null; }; return BiMap; })(); var b = new BiMap(); diff --git a/tests/baselines/reference/genericReversingTypeParameters2.js b/tests/baselines/reference/genericReversingTypeParameters2.js index eb904f4a2ed..4f4bc564f89 100644 --- a/tests/baselines/reference/genericReversingTypeParameters2.js +++ b/tests/baselines/reference/genericReversingTypeParameters2.js @@ -13,12 +13,8 @@ var r2b = i.get(1); var BiMap = (function () { function BiMap() { } - BiMap.prototype.get = function (key) { - return null; - }; - BiMap.prototype.inverse = function () { - return null; - }; + BiMap.prototype.get = function (key) { return null; }; + BiMap.prototype.inverse = function () { return null; }; return BiMap; })(); var b = new BiMap(); diff --git a/tests/baselines/reference/genericSpecializations1.js b/tests/baselines/reference/genericSpecializations1.js index 3df2c5581b9..3e59fceff97 100644 --- a/tests/baselines/reference/genericSpecializations1.js +++ b/tests/baselines/reference/genericSpecializations1.js @@ -19,24 +19,18 @@ class StringFoo3 implements IFoo { var IntFooBad = (function () { function IntFooBad() { } - IntFooBad.prototype.foo = function (x) { - return null; - }; + IntFooBad.prototype.foo = function (x) { return null; }; return IntFooBad; })(); var StringFoo2 = (function () { function StringFoo2() { } - StringFoo2.prototype.foo = function (x) { - return null; - }; + StringFoo2.prototype.foo = function (x) { return null; }; return StringFoo2; })(); var StringFoo3 = (function () { function StringFoo3() { } - StringFoo3.prototype.foo = function (x) { - return null; - }; + StringFoo3.prototype.foo = function (x) { return null; }; return StringFoo3; })(); diff --git a/tests/baselines/reference/genericSpecializations2.js b/tests/baselines/reference/genericSpecializations2.js index 666ea43eeba..8497d2db8b4 100644 --- a/tests/baselines/reference/genericSpecializations2.js +++ b/tests/baselines/reference/genericSpecializations2.js @@ -31,24 +31,18 @@ var IFoo = (function () { var IntFooBad = (function () { function IntFooBad() { } - IntFooBad.prototype.foo = function (x) { - return null; - }; + IntFooBad.prototype.foo = function (x) { return null; }; return IntFooBad; })(); var StringFoo2 = (function () { function StringFoo2() { } - StringFoo2.prototype.foo = function (x) { - return null; - }; + StringFoo2.prototype.foo = function (x) { return null; }; return StringFoo2; })(); var StringFoo3 = (function () { function StringFoo3() { } - StringFoo3.prototype.foo = function (x) { - return null; - }; + StringFoo3.prototype.foo = function (x) { return null; }; return StringFoo3; })(); diff --git a/tests/baselines/reference/genericSpecializations3.js b/tests/baselines/reference/genericSpecializations3.js index 8d157761160..3c582ae31fd 100644 --- a/tests/baselines/reference/genericSpecializations3.js +++ b/tests/baselines/reference/genericSpecializations3.js @@ -41,27 +41,21 @@ iFoo.foo(1); var IntFooBad = (function () { function IntFooBad() { } - IntFooBad.prototype.foo = function (x) { - return null; - }; + IntFooBad.prototype.foo = function (x) { return null; }; return IntFooBad; })(); var intFooBad; var IntFoo = (function () { function IntFoo() { } - IntFoo.prototype.foo = function (x) { - return null; - }; + IntFoo.prototype.foo = function (x) { return null; }; return IntFoo; })(); var intFoo; var StringFoo2 = (function () { function StringFoo2() { } - StringFoo2.prototype.foo = function (x) { - return null; - }; + StringFoo2.prototype.foo = function (x) { return null; }; return StringFoo2; })(); var stringFoo2; @@ -71,9 +65,7 @@ stringFoo2 = intFoo; // error var StringFoo3 = (function () { function StringFoo3() { } - StringFoo3.prototype.foo = function (x) { - return null; - }; + StringFoo3.prototype.foo = function (x) { return null; }; return StringFoo3; })(); var stringFoo3; diff --git a/tests/baselines/reference/genericStaticAnyTypeFunction.js b/tests/baselines/reference/genericStaticAnyTypeFunction.js index 055e6b4f683..6816afec910 100644 --- a/tests/baselines/reference/genericStaticAnyTypeFunction.js +++ b/tests/baselines/reference/genericStaticAnyTypeFunction.js @@ -25,9 +25,7 @@ var A = (function () { A.one = function (source, value) { return source; }; - A.goo = function () { - return 0; - }; + A.goo = function () { return 0; }; A.two = function (source) { return this.one(source, 42); // should not error }; diff --git a/tests/baselines/reference/genericTypeAssertions3.js b/tests/baselines/reference/genericTypeAssertions3.js index 19a477c142c..b67a277654f 100644 --- a/tests/baselines/reference/genericTypeAssertions3.js +++ b/tests/baselines/reference/genericTypeAssertions3.js @@ -4,9 +4,5 @@ var s = < (x: T) => T > ((x: any) => { return null; }); // no error //// [genericTypeAssertions3.js] -var r = (function (x) { - return null; -}); // bug was 'could not find dotted symbol T' on x's annotation in the type assertion instead of no error -var s = (function (x) { - return null; -}); // no error +var r = (function (x) { return null; }); // bug was 'could not find dotted symbol T' on x's annotation in the type assertion instead of no error +var s = (function (x) { return null; }); // no error diff --git a/tests/baselines/reference/genericTypeAssertions4.js b/tests/baselines/reference/genericTypeAssertions4.js index d04b6cbe104..a607fb07428 100644 --- a/tests/baselines/reference/genericTypeAssertions4.js +++ b/tests/baselines/reference/genericTypeAssertions4.js @@ -35,9 +35,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ""; - }; + A.prototype.foo = function () { return ""; }; return A; })(); var B = (function (_super) { @@ -45,9 +43,7 @@ var B = (function (_super) { function B() { _super.apply(this, arguments); } - B.prototype.bar = function () { - return 1; - }; + B.prototype.bar = function () { return 1; }; return B; })(A); var C = (function (_super) { @@ -55,9 +51,7 @@ var C = (function (_super) { function C() { _super.apply(this, arguments); } - C.prototype.baz = function () { - return 1; - }; + C.prototype.baz = function () { return 1; }; return C; })(A); var a; diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js index 1b41116732a..4be1cce27a9 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js @@ -55,18 +55,9 @@ var c; var a; var b; var d; -var e = function (x) { - var y; - return y; -}; -function f(x) { - var y; - return y; -} -var g = function f(x) { - var y; - return y; -}; +var e = function (x) { var y; return y; }; +function f(x) { var y; return y; } +var g = function f(x) { var y; return y; }; var D = (function (_super) { __extends(D, _super); function D() { diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js index f96e25301be..803d499705a 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js @@ -50,18 +50,9 @@ var c; var a; var b; var d; -var e = function (x) { - var y; - return y; -}; -function f(x) { - var y; - return y; -} -var g = function f(x) { - var y; - return y; -}; +var e = function (x) { var y; return y; }; +function f(x) { var y; return y; } +var g = function f(x) { var y; return y; }; var D = (function (_super) { __extends(D, _super); function D() { diff --git a/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.js b/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.js index 69bc1c372b3..90ad9e1ff93 100644 --- a/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.js +++ b/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.js @@ -15,9 +15,7 @@ var i2: I; // should be an error var C = (function () { function C() { } - C.prototype.foo = function () { - return null; - }; + C.prototype.foo = function () { return null; }; return C; })(); var c1; // error diff --git a/tests/baselines/reference/genericWithOpenTypeParameters1.js b/tests/baselines/reference/genericWithOpenTypeParameters1.js index afdce73cb11..90202767012 100644 --- a/tests/baselines/reference/genericWithOpenTypeParameters1.js +++ b/tests/baselines/reference/genericWithOpenTypeParameters1.js @@ -15,22 +15,12 @@ var f4 = (x: B) => { return x.foo(1); } // no error var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var x; x.foo(1); // no error -var f = function (x) { - return x.foo(1); -}; // error -var f2 = function (x) { - return x.foo(1); -}; // error -var f3 = function (x) { - return x.foo(1); -}; // error -var f4 = function (x) { - return x.foo(1); -}; // no error +var f = function (x) { return x.foo(1); }; // error +var f2 = function (x) { return x.foo(1); }; // error +var f3 = function (x) { return x.foo(1); }; // error +var f4 = function (x) { return x.foo(1); }; // no error diff --git a/tests/baselines/reference/genericsAndHigherOrderFunctions.js b/tests/baselines/reference/genericsAndHigherOrderFunctions.js index 1086bd78c54..f2e6ef58f22 100644 --- a/tests/baselines/reference/genericsAndHigherOrderFunctions.js +++ b/tests/baselines/reference/genericsAndHigherOrderFunctions.js @@ -19,5 +19,13 @@ var foo: (g: (x: K) => N) => //// [genericsAndHigherOrderFunctions.js] // no errors expected -var combine = function (f) { return function (g) { return function (x) { return f(g(x)); }; }; }; -var foo = function (g) { return function (h) { return function (f) { return h(combine(f)(g)); }; }; }; +var combine = function (f) { + return function (g) { + return function (x) { return f(g(x)); }; + }; +}; +var foo = function (g) { + return function (h) { + return function (f) { return h(combine(f)(g)); }; + }; +}; diff --git a/tests/baselines/reference/genericsManyTypeParameters.js b/tests/baselines/reference/genericsManyTypeParameters.js index 19a5117cb6b..491f0c41168 100644 --- a/tests/baselines/reference/genericsManyTypeParameters.js +++ b/tests/baselines/reference/genericsManyTypeParameters.js @@ -61,5 +61,22 @@ function Foo< //// [genericsManyTypeParameters.js] function Foo(x1, y1, z1, a1, b1, c1, x2, y2, z2, a2, b2, c2, x3, y3, z3, a3, b3, c3, x4, y4, z4, a4, b4, c4, x5, y5, z5, a5, b5, c5, x6, y6, z6, a6, b6, c6, x7, y7, z7, a7, b7, c7, x8, y8, z8, a8, b8, c8, x9, y9, z9, a9, b9, c9, x10, y12, z10, a10, b10, c10, x11, y13, z11, a11, b11, c11, x12, y14, z12, a12, b12, c12, x13, y15, z13, a13, b13, c13, x14, y16, z14, a14, b14, c14, x15, y17, z15, a15, b15, c15, x16, y18, z16, a16, b16, c16, x17, y19, z17, a17, b17, c17, x18, y10, z18, a18, b18, c18) { - return [x1, y1, z1, a1, b1, c1, x2, y2, z2, a2, b2, c2, x3, y3, z3, a3, b3, c3, x4, y4, z4, a4, b4, c4, x5, y5, z5, a5, b5, c5, x6, y6, z6, a6, b6, c6, x7, y7, z7, a7, b7, c7, x8, y8, z8, a8, b8, c8, x9, y9, z9, a9, b9, c9, x10, y12, z10, a10, b10, c10, x11, y13, z11, a11, b11, c11, x12, y14, z12, a12, b12, c12, x13, y15, z13, a13, b13, c13, x14, y16, z14, a14, b14, c14, x15, y17, z15, a15, b15, c15, x16, y18, z16, a16, b16, c16, x17, y19, z17, a17, b17, c17, x18, y10, z18, a18, b18, c18]; + return [x1, y1, z1, a1, b1, c1, + x2, y2, z2, a2, b2, c2, + x3, y3, z3, a3, b3, c3, + x4, y4, z4, a4, b4, c4, + x5, y5, z5, a5, b5, c5, + x6, y6, z6, a6, b6, c6, + x7, y7, z7, a7, b7, c7, + x8, y8, z8, a8, b8, c8, + x9, y9, z9, a9, b9, c9, + x10, y12, z10, a10, b10, c10, + x11, y13, z11, a11, b11, c11, + x12, y14, z12, a12, b12, c12, + x13, y15, z13, a13, b13, c13, + x14, y16, z14, a14, b14, c14, + x15, y17, z15, a15, b15, c15, + x16, y18, z16, a16, b16, c16, + x17, y19, z17, a17, b17, c17, + x18, y10, z18, a18, b18, c18]; } diff --git a/tests/baselines/reference/genericsWithDuplicateTypeParameters1.js b/tests/baselines/reference/genericsWithDuplicateTypeParameters1.js index f01f01dbf21..72eeb1ab683 100644 --- a/tests/baselines/reference/genericsWithDuplicateTypeParameters1.js +++ b/tests/baselines/reference/genericsWithDuplicateTypeParameters1.js @@ -18,21 +18,15 @@ var m = { //// [genericsWithDuplicateTypeParameters1.js] function f() { } -function f2(a, b) { - return null; -} +function f2(a, b) { return null; } var C = (function () { function C() { } C.prototype.f = function () { }; - C.prototype.f2 = function (a, b) { - return null; - }; + C.prototype.f2 = function (a, b) { return null; }; return C; })(); var m = { a: function f() { }, - b: function f2(a, b) { - return null; - } + b: function f2(a, b) { return null; } }; diff --git a/tests/baselines/reference/genericsWithoutTypeParameters1.js b/tests/baselines/reference/genericsWithoutTypeParameters1.js index 8446d40cb11..41abffcb854 100644 --- a/tests/baselines/reference/genericsWithoutTypeParameters1.js +++ b/tests/baselines/reference/genericsWithoutTypeParameters1.js @@ -37,9 +37,7 @@ function f(x: T): A { var C = (function () { function C() { } - C.prototype.foo = function () { - return null; - }; + C.prototype.foo = function () { return null; }; return C; })(); var c1; @@ -49,9 +47,7 @@ var i2; function foo(x, y) { } function foo2(x, y) { } var x = { a: new C() }; -var x2 = { a: { bar: function () { - return 1; -} } }; +var x2 = { a: { bar: function () { return 1; } } }; var D = (function () { function D() { } diff --git a/tests/baselines/reference/getAndSetAsMemberNames.js b/tests/baselines/reference/getAndSetAsMemberNames.js index 41a89e6ec37..8b036cd0f73 100644 --- a/tests/baselines/reference/getAndSetAsMemberNames.js +++ b/tests/baselines/reference/getAndSetAsMemberNames.js @@ -49,13 +49,9 @@ var C4 = (function () { })(); var C5 = (function () { function C5() { - this.set = function () { - return true; - }; + this.set = function () { return true; }; } - C5.prototype.get = function () { - return true; - }; + C5.prototype.get = function () { return true; }; Object.defineProperty(C5.prototype, "t", { set: function (x) { }, enumerable: true, diff --git a/tests/baselines/reference/getsetReturnTypes.js b/tests/baselines/reference/getsetReturnTypes.js index 55d7e9285b0..27b6fc52fe5 100644 --- a/tests/baselines/reference/getsetReturnTypes.js +++ b/tests/baselines/reference/getsetReturnTypes.js @@ -10,9 +10,7 @@ var y: number = makePoint(2).x; //// [getsetReturnTypes.js] function makePoint(x) { return { - get x() { - return x; - } + get x() { return x; } }; } ; diff --git a/tests/baselines/reference/getterSetterNonAccessor.js b/tests/baselines/reference/getterSetterNonAccessor.js index e32c62c497e..c28337ff7b4 100644 --- a/tests/baselines/reference/getterSetterNonAccessor.js +++ b/tests/baselines/reference/getterSetterNonAccessor.js @@ -10,9 +10,7 @@ Object.defineProperty({}, "0", ({ //// [getterSetterNonAccessor.js] -function getFunc() { - return 0; -} +function getFunc() { return 0; } function setFunc(v) { } Object.defineProperty({}, "0", ({ get: getFunc, diff --git a/tests/baselines/reference/gettersAndSetters.js b/tests/baselines/reference/gettersAndSetters.js index 6fb9518cfdb..92f959e5988 100644 --- a/tests/baselines/reference/gettersAndSetters.js +++ b/tests/baselines/reference/gettersAndSetters.js @@ -50,25 +50,17 @@ var C = (function () { this.set = function () { }; // ok } Object.defineProperty(C.prototype, "Foo", { - get: function () { - return this.fooBack; - } // ok + get: function () { return this.fooBack; } // ok , - set: function (foo) { - this.fooBack = foo; - } // ok + set: function (foo) { this.fooBack = foo; } // ok , enumerable: true, configurable: true }); Object.defineProperty(C, "Bar", { - get: function () { - return C.barBack; - } // ok + get: function () { return C.barBack; } // ok , - set: function (bar) { - C.barBack = bar; - } // ok + set: function (bar) { C.barBack = bar; } // ok , enumerable: true, configurable: true @@ -84,13 +76,7 @@ C.Bar = "barv"; var baz = c.Baz; c.Baz = "bazv"; // The Foo accessors' return and param types should be contextually typed to the Foo field -var o = { get Foo() { - return 0; -}, set Foo(val) { - val; -} }; // o +var o = { get Foo() { return 0; }, set Foo(val) { val; } }; // o var ofg = o.Foo; o.Foo = 0; -var i = function (n) { - return n; -}; +var i = function (n) { return n; }; diff --git a/tests/baselines/reference/gettersAndSettersAccessibility.js b/tests/baselines/reference/gettersAndSettersAccessibility.js index f472fa36a98..e0cfa3d17c5 100644 --- a/tests/baselines/reference/gettersAndSettersAccessibility.js +++ b/tests/baselines/reference/gettersAndSettersAccessibility.js @@ -10,9 +10,7 @@ var C99 = (function () { function C99() { } Object.defineProperty(C99.prototype, "Baz", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (n) { } // error - accessors do not agree in visibility , enumerable: true, diff --git a/tests/baselines/reference/gettersAndSettersErrors.js b/tests/baselines/reference/gettersAndSettersErrors.js index 545517facea..d92f0d833f5 100644 --- a/tests/baselines/reference/gettersAndSettersErrors.js +++ b/tests/baselines/reference/gettersAndSettersErrors.js @@ -22,9 +22,7 @@ var C = (function () { this.Foo = 0; // error - duplicate identifier Foo - confirmed } Object.defineProperty(C.prototype, "Foo", { - get: function () { - return "foo"; - } // ok + get: function () { return "foo"; } // ok , set: function (foo) { } // ok , @@ -32,9 +30,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, "Goo", { - get: function (v) { - return null; - } // error - getters must not have a parameter + get: function (v) { return null; } // error - getters must not have a parameter , set: function (v) { } // error - setters must not specify a return type , @@ -47,9 +43,7 @@ var E = (function () { function E() { } Object.defineProperty(E.prototype, "Baz", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (n) { } // error - accessors do not agree in visibility , enumerable: true, diff --git a/tests/baselines/reference/gettersAndSettersTypesAgree.js b/tests/baselines/reference/gettersAndSettersTypesAgree.js index c291c457613..91d3d844981 100644 --- a/tests/baselines/reference/gettersAndSettersTypesAgree.js +++ b/tests/baselines/reference/gettersAndSettersTypesAgree.js @@ -15,9 +15,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "Foo", { - get: function () { - return "foo"; - } // ok + get: function () { return "foo"; } // ok , set: function (foo) { } // ok - type inferred from getter return statement , @@ -25,9 +23,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, "Bar", { - get: function () { - return "foo"; - } // ok + get: function () { return "foo"; } // ok , set: function (bar) { } // ok - type must be declared , @@ -36,9 +32,5 @@ var C = (function () { }); return C; })(); -var o1 = { get Foo() { - return 0; -}, set Foo(val) { } }; // ok - types agree (inference) -var o2 = { get Foo() { - return 0; -}, set Foo(val) { } }; // ok - types agree +var o1 = { get Foo() { return 0; }, set Foo(val) { } }; // ok - types agree (inference) +var o2 = { get Foo() { return 0; }, set Foo(val) { } }; // ok - types agree diff --git a/tests/baselines/reference/giant.js b/tests/baselines/reference/giant.js index 7f2c2453b0f..a5109b6e113 100644 --- a/tests/baselines/reference/giant.js +++ b/tests/baselines/reference/giant.js @@ -706,44 +706,38 @@ define(["require", "exports"], function (require, exports) { C.prototype.rF = function () { }; C.prototype.pgF = function () { }; Object.defineProperty(C.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.psF = function (param) { }; Object.defineProperty(C.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.prototype.rgF = function () { }; Object.defineProperty(C.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.rsF = function (param) { }; Object.defineProperty(C.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tF = function () { }; C.tsF = function (param) { }; Object.defineProperty(C, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tgF = function () { }; Object.defineProperty(C, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -761,44 +755,38 @@ define(["require", "exports"], function (require, exports) { C.prototype.rF = function () { }; C.prototype.pgF = function () { }; Object.defineProperty(C.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.psF = function (param) { }; Object.defineProperty(C.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.prototype.rgF = function () { }; Object.defineProperty(C.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.rsF = function (param) { }; Object.defineProperty(C.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tF = function () { }; C.tsF = function (param) { }; Object.defineProperty(C, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tgF = function () { }; Object.defineProperty(C, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -845,44 +833,38 @@ define(["require", "exports"], function (require, exports) { eC.prototype.rF = function () { }; eC.prototype.pgF = function () { }; Object.defineProperty(eC.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.psF = function (param) { }; Object.defineProperty(eC.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.prototype.rgF = function () { }; Object.defineProperty(eC.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.rsF = function (param) { }; Object.defineProperty(eC.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tF = function () { }; eC.tsF = function (param) { }; Object.defineProperty(eC, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tgF = function () { }; Object.defineProperty(eC, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -932,44 +914,38 @@ define(["require", "exports"], function (require, exports) { eC.prototype.rF = function () { }; eC.prototype.pgF = function () { }; Object.defineProperty(eC.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.psF = function (param) { }; Object.defineProperty(eC.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.prototype.rgF = function () { }; Object.defineProperty(eC.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.rsF = function (param) { }; Object.defineProperty(eC.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tF = function () { }; eC.tsF = function (param) { }; Object.defineProperty(eC, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tgF = function () { }; Object.defineProperty(eC, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -988,44 +964,38 @@ define(["require", "exports"], function (require, exports) { C.prototype.rF = function () { }; C.prototype.pgF = function () { }; Object.defineProperty(C.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.psF = function (param) { }; Object.defineProperty(C.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.prototype.rgF = function () { }; Object.defineProperty(C.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.rsF = function (param) { }; Object.defineProperty(C.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tF = function () { }; C.tsF = function (param) { }; Object.defineProperty(C, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tgF = function () { }; Object.defineProperty(C, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -1072,44 +1042,38 @@ define(["require", "exports"], function (require, exports) { eC.prototype.rF = function () { }; eC.prototype.pgF = function () { }; Object.defineProperty(eC.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.psF = function (param) { }; Object.defineProperty(eC.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.prototype.rgF = function () { }; Object.defineProperty(eC.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.rsF = function (param) { }; Object.defineProperty(eC.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tF = function () { }; eC.tsF = function (param) { }; Object.defineProperty(eC, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tgF = function () { }; Object.defineProperty(eC, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/grammarAmbiguities.js b/tests/baselines/reference/grammarAmbiguities.js index ee81d947ff6..f603bd1023f 100644 --- a/tests/baselines/reference/grammarAmbiguities.js +++ b/tests/baselines/reference/grammarAmbiguities.js @@ -12,12 +12,8 @@ f(g < A, B > +(7)); // Should error //// [grammarAmbiguities.js] -function f(n) { - return null; -} -function g(x) { - return null; -} +function f(n) { return null; } +function g(x) { return null; } var A, B; f(g(7)); f(g < A, B > 7); // Should error diff --git a/tests/baselines/reference/grammarAmbiguities1.js b/tests/baselines/reference/grammarAmbiguities1.js index 6ee64527bcc..1917acb7128 100644 --- a/tests/baselines/reference/grammarAmbiguities1.js +++ b/tests/baselines/reference/grammarAmbiguities1.js @@ -23,12 +23,8 @@ var B = (function () { B.prototype.bar = function () { }; return B; })(); -function f(x) { - return x; -} -function g(x) { - return f(x); -} +function f(x) { return x; } +function g(x) { return f(x); } g(7); f(g(7)); f(g < A, B > 7); diff --git a/tests/baselines/reference/ifDoWhileStatements.js b/tests/baselines/reference/ifDoWhileStatements.js index c7f6ead6b28..793094584bf 100644 --- a/tests/baselines/reference/ifDoWhileStatements.js +++ b/tests/baselines/reference/ifDoWhileStatements.js @@ -186,12 +186,8 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} -function F2(x) { - return x < 42; -} +function F(x) { return 42; } +function F2(x) { return x < 42; } var M; (function (M) { var A = (function () { @@ -200,9 +196,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var N; @@ -213,9 +207,7 @@ var N; return A; })(); N.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } N.F2 = F2; })(N || (N = {})); // literals @@ -306,9 +298,7 @@ var k = { x: 1, y: 'a' }; if (k) { } while (k) { } do { } while (k); -function fn(x) { - return null; -} +function fn(x) { return null; } if (fn()) { } while (fn()) { } do { } while (fn()); diff --git a/tests/baselines/reference/illegalSuperCallsInConstructor.js b/tests/baselines/reference/illegalSuperCallsInConstructor.js index b978af1a609..0bdcebed9c5 100644 --- a/tests/baselines/reference/illegalSuperCallsInConstructor.js +++ b/tests/baselines/reference/illegalSuperCallsInConstructor.js @@ -36,12 +36,8 @@ var Derived = (function (_super) { __extends(Derived, _super); function Derived() { var r2 = function () { return _super.call(this); }; - var r3 = function () { - _super.call(this); - }; - var r4 = function () { - _super.call(this); - }; + var r3 = function () { _super.call(this); }; + var r4 = function () { _super.call(this); }; var r5 = { get foo() { _super.call(this); diff --git a/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.js b/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.js index df1c4d51e74..9bfad713d82 100644 --- a/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.js +++ b/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.js @@ -22,26 +22,12 @@ var lambda10 = function temp1() { return 5; } var lambda = function (l1) { }; // Error at "l1" var lambd2 = function (ll1, ll2) { }; // Error at "ll1" var lamda3 = function myLambda3(myParam) { }; -var lamda4 = function () { - return null; -}; +var lamda4 = function () { return null; }; // these should be error for implicit any return type -var lambda5 = function temp() { - return null; -}; -var lambda6 = function () { - return null; -}; -var lambda7 = function temp() { - return undefined; -}; -var lambda8 = function () { - return undefined; -}; +var lambda5 = function temp() { return null; }; +var lambda6 = function () { return null; }; +var lambda7 = function temp() { return undefined; }; +var lambda8 = function () { return undefined; }; // this shouldn't be an error -var lambda9 = function () { - return 5; -}; -var lambda10 = function temp1() { - return 5; -}; +var lambda9 = function () { return 5; }; +var lambda10 = function temp1() { return 5; }; diff --git a/tests/baselines/reference/implicitAnyFromCircularInference.js b/tests/baselines/reference/implicitAnyFromCircularInference.js index d97b8420ebf..d818ea17105 100644 --- a/tests/baselines/reference/implicitAnyFromCircularInference.js +++ b/tests/baselines/reference/implicitAnyFromCircularInference.js @@ -58,13 +58,9 @@ var b; var c; // Error expected var d; -function f() { - return f; -} +function f() { return f; } // Error expected -function g() { - return g(); -} +function g() { return g(); } // Error expected var f1 = function () { return f1(); @@ -78,9 +74,7 @@ function h() { return h() || "hello"; } } -function foo(x) { - return "abc"; -} +function foo(x) { return "abc"; } var C = (function () { function C() { // Error expected diff --git a/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.js b/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.js index 699b57603eb..82eb56fbde6 100644 --- a/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.js +++ b/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.js @@ -26,12 +26,8 @@ undefinedWidenFunction(); //// [implicitAnyFunctionReturnNullOrUndefined.js] // this should be an error -function nullWidenFunction() { - return null; -} // error at "nullWidenFunction" -function undefinedWidenFunction() { - return undefined; -} // error at "undefinedWidenFunction" +function nullWidenFunction() { return null; } // error at "nullWidenFunction" +function undefinedWidenFunction() { return undefined; } // error at "undefinedWidenFunction" var C = (function () { function C() { } @@ -44,18 +40,10 @@ var C = (function () { return C; })(); // this should not be an error -function foo1() { - return null; -} -function bar1() { - return undefined; -} -function fooBar() { - return 1; -} -function fooFoo() { - return 5; -} +function foo1() { return null; } +function bar1() { return undefined; } +function fooBar() { return 1; } +function fooFoo() { return 5; } // this should not be an error as the error is raised by expr above nullWidenFunction(); undefinedWidenFunction(); diff --git a/tests/baselines/reference/implicitAnyGenericTypeInference.js b/tests/baselines/reference/implicitAnyGenericTypeInference.js index 2679ae8285c..583ab7f0b01 100644 --- a/tests/baselines/reference/implicitAnyGenericTypeInference.js +++ b/tests/baselines/reference/implicitAnyGenericTypeInference.js @@ -10,7 +10,5 @@ var r = c.compareTo(1, ''); //// [implicitAnyGenericTypeInference.js] var c; -c = { compareTo: function (x, y) { - return y; -} }; +c = { compareTo: function (x, y) { return y; } }; var r = c.compareTo(1, ''); diff --git a/tests/baselines/reference/implicitAnyGenerics.js b/tests/baselines/reference/implicitAnyGenerics.js index a5c98590a8f..daea0dfe54c 100644 --- a/tests/baselines/reference/implicitAnyGenerics.js +++ b/tests/baselines/reference/implicitAnyGenerics.js @@ -46,9 +46,7 @@ var d2 = new D(1); var d3 = new D(1); var d4 = new D(1); var d5 = new D(null); -function foo() { - return null; -} +function foo() { return null; } ; foo(); foo(); diff --git a/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.js b/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.js index 4218d9a9a21..9e558122b15 100644 --- a/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.js +++ b/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.js @@ -3,7 +3,5 @@ function Point() { this.x = 3; } var x: any = new Point(); // error at "new" //// [implicitAnyNewExprLackConstructorSignature.js] -function Point() { - this.x = 3; -} +function Point() { this.x = 3; } var x = new Point(); // error at "new" diff --git a/tests/baselines/reference/importAsBaseClass.js b/tests/baselines/reference/importAsBaseClass.js index 9e52c4dd067..8114e88ca4b 100644 --- a/tests/baselines/reference/importAsBaseClass.js +++ b/tests/baselines/reference/importAsBaseClass.js @@ -14,9 +14,7 @@ class Hello extends Greeter { } var Greeter = (function () { function Greeter() { } - Greeter.prototype.greet = function () { - return 'greet'; - }; + Greeter.prototype.greet = function () { return 'greet'; }; return Greeter; })(); exports.Greeter = Greeter; diff --git a/tests/baselines/reference/importDecl.js b/tests/baselines/reference/importDecl.js index d6f2855908e..9d4839e5e7c 100644 --- a/tests/baselines/reference/importDecl.js +++ b/tests/baselines/reference/importDecl.js @@ -89,9 +89,7 @@ var d = (function () { })(); exports.d = d; exports.x; -function foo() { - return null; -} +function foo() { return null; } exports.foo = foo; //// [importDecl_require1.js] var d = (function () { @@ -101,9 +99,7 @@ var d = (function () { })(); exports.d = d; var x; -function foo() { - return null; -} +function foo() { return null; } exports.foo = foo; //// [importDecl_require2.js] var d = (function () { @@ -113,9 +109,7 @@ var d = (function () { })(); exports.d = d; exports.x; -function foo() { - return null; -} +function foo() { return null; } exports.foo = foo; //// [importDecl_require3.js] var d = (function () { @@ -125,14 +119,10 @@ var d = (function () { })(); exports.d = d; exports.x; -function foo() { - return null; -} +function foo() { return null; } exports.foo = foo; //// [importDecl_require4.js] -function foo2() { - return null; -} +function foo2() { return null; } exports.foo2 = foo2; //// [importDecl_1.js] /// diff --git a/tests/baselines/reference/importInsideModule.js b/tests/baselines/reference/importInsideModule.js index b0ba16fa850..5151e01f764 100644 --- a/tests/baselines/reference/importInsideModule.js +++ b/tests/baselines/reference/importInsideModule.js @@ -12,6 +12,5 @@ export module myModule { //// [importInsideModule_file2.js] var myModule; (function (myModule) { - var foo = require("importInsideModule_file1"); var a = foo.x; })(myModule = exports.myModule || (exports.myModule = {})); diff --git a/tests/baselines/reference/importedModuleAddToGlobal.js b/tests/baselines/reference/importedModuleAddToGlobal.js index 6685bec69e3..dd7dfcd5fc9 100644 --- a/tests/baselines/reference/importedModuleAddToGlobal.js +++ b/tests/baselines/reference/importedModuleAddToGlobal.js @@ -28,7 +28,5 @@ var B; })(B || (B = {})); var C; (function (C) { - function hello() { - return null; - } + function hello() { return null; } })(C || (C = {})); diff --git a/tests/baselines/reference/inOperatorWithFunction.js b/tests/baselines/reference/inOperatorWithFunction.js index 8daeb5a30fb..bc293ca2c43 100644 --- a/tests/baselines/reference/inOperatorWithFunction.js +++ b/tests/baselines/reference/inOperatorWithFunction.js @@ -4,7 +4,5 @@ fn("a" in { "a": true }); //// [inOperatorWithFunction.js] -var fn = function (val) { - return val; -}; +var fn = function (val) { return val; }; fn("a" in { "a": true }); diff --git a/tests/baselines/reference/incompatibleTypes.js b/tests/baselines/reference/incompatibleTypes.js index 2f804f2efa1..7e24afecf5f 100644 --- a/tests/baselines/reference/incompatibleTypes.js +++ b/tests/baselines/reference/incompatibleTypes.js @@ -106,9 +106,7 @@ function if1(a) { } var c1; var c2; if1(c1); -function of1(a) { - return null; -} +function of1(a) { return null; } of1({ e: 0, f: 0 }); function foo(fn) { } diff --git a/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js b/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js index 564516ead64..eb9cd949280 100644 --- a/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js +++ b/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js @@ -50,15 +50,11 @@ foo()++; // ++ operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -72,14 +68,10 @@ var ResultIsNumber2 = NUMBER1++; // number type literal var ResultIsNumber3 = ++1; var ResultIsNumber4 = ++{ x: 1, y: 2 }; -var ResultIsNumber5 = ++{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = ++{ x: 1, y: function (n) { return n; } }; var ResultIsNumber6 = 1++; var ResultIsNumber7 = { x: 1, y: 2 }++; -var ResultIsNumber8 = { x: 1, y: function (n) { - return n; -} }++; +var ResultIsNumber8 = { x: 1, y: function (n) { return n; } }++; // number type expressions var ResultIsNumber9 = ++foo(); var ResultIsNumber10 = ++A.foo(); diff --git a/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js b/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js index 6c0775b520f..6a974443f7b 100644 --- a/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js +++ b/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js @@ -57,15 +57,11 @@ objA.a++, M.n++; //// [incrementOperatorWithUnsupportedBooleanType.js] // ++ operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return true; - }; + A.foo = function () { return true; }; return A; })(); var M; @@ -79,14 +75,10 @@ var ResultIsNumber2 = BOOLEAN++; // boolean type literal var ResultIsNumber3 = ++true; var ResultIsNumber4 = ++{ x: true, y: false }; -var ResultIsNumber5 = ++{ x: true, y: function (n) { - return n; -} }; +var ResultIsNumber5 = ++{ x: true, y: function (n) { return n; } }; var ResultIsNumber6 = true++; var ResultIsNumber7 = { x: true, y: false }++; -var ResultIsNumber8 = { x: true, y: function (n) { - return n; -} }++; +var ResultIsNumber8 = { x: true, y: function (n) { return n; } }++; // boolean type expressions var ResultIsNumber9 = ++objA.a; var ResultIsNumber10 = ++M.n; diff --git a/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js b/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js index 065cf6ed5eb..82bf03cd83a 100644 --- a/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js +++ b/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js @@ -69,15 +69,11 @@ objA.a++, M.n++; // ++ operator on string type var STRING; var STRING1 = ["", ""]; -function foo() { - return ""; -} +function foo() { return ""; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -93,14 +89,10 @@ var ResultIsNumber4 = STRING1++; // string type literal var ResultIsNumber5 = ++""; var ResultIsNumber6 = ++{ x: "", y: "" }; -var ResultIsNumber7 = ++{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber7 = ++{ x: "", y: function (s) { return s; } }; var ResultIsNumber8 = ""++; var ResultIsNumber9 = { x: "", y: "" }++; -var ResultIsNumber10 = { x: "", y: function (s) { - return s; -} }++; +var ResultIsNumber10 = { x: "", y: function (s) { return s; } }++; // string type expressions var ResultIsNumber11 = ++objA.a; var ResultIsNumber12 = ++M.n; diff --git a/tests/baselines/reference/indexSignaturesInferentialTyping.js b/tests/baselines/reference/indexSignaturesInferentialTyping.js index d8200338b62..53636be716c 100644 --- a/tests/baselines/reference/indexSignaturesInferentialTyping.js +++ b/tests/baselines/reference/indexSignaturesInferentialTyping.js @@ -9,12 +9,8 @@ var x4 = bar({ zero: 0, one: 1 }); // type should be number //// [indexSignaturesInferentialTyping.js] -function foo(items) { - return undefined; -} -function bar(items) { - return undefined; -} +function foo(items) { return undefined; } +function bar(items) { return undefined; } var x1 = foo({ 0: 0, 1: 1 }); // type should be number var x2 = foo({ zero: 0, one: 1 }); var x3 = bar({ 0: 0, 1: 1 }); diff --git a/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.js b/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.js index 6b6a47405ad..aeb9a840773 100644 --- a/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.js +++ b/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.js @@ -5,6 +5,4 @@ declare function identity(y: V): V; var s = map("", () => { return { x: identity }; }); //// [inferentialTypingWithFunctionTypeNested.js] -var s = map("", function () { - return { x: identity }; -}); +var s = map("", function () { return { x: identity }; }); diff --git a/tests/baselines/reference/inheritance.js b/tests/baselines/reference/inheritance.js index 1fca887a9b1..f7a274b1990 100644 --- a/tests/baselines/reference/inheritance.js +++ b/tests/baselines/reference/inheritance.js @@ -79,13 +79,9 @@ var ND = (function (_super) { })(N); var Good = (function () { function Good() { - this.f = function () { - return 0; - }; + this.f = function () { return 0; }; } - Good.prototype.g = function () { - return 0; - }; + Good.prototype.g = function () { return 0; }; return Good; })(); var Baad = (function (_super) { @@ -93,11 +89,7 @@ var Baad = (function (_super) { function Baad() { _super.apply(this, arguments); } - Baad.prototype.f = function () { - return 0; - }; - Baad.prototype.g = function (n) { - return 0; - }; + Baad.prototype.f = function () { return 0; }; + Baad.prototype.g = function (n) { return 0; }; return Baad; })(Good); diff --git a/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.js b/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.js index 3ea0e6e1594..85801ca704f 100644 --- a/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.js +++ b/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.js @@ -11,6 +11,4 @@ fn(function (a, b) { return true; }) //// [inheritedFunctionAssignmentCompatibility.js] function fn(cb) { } fn(function (a, b) { return true; }); -fn(function (a, b) { - return true; -}); +fn(function (a, b) { return true; }); diff --git a/tests/baselines/reference/innerFunc.js b/tests/baselines/reference/innerFunc.js index 1676d0789d1..c790c09e271 100644 --- a/tests/baselines/reference/innerFunc.js +++ b/tests/baselines/reference/innerFunc.js @@ -14,17 +14,13 @@ module M { //// [innerFunc.js] function salt() { - function pepper() { - return 5; - } + function pepper() { return 5; } return pepper(); } var M; (function (M) { function tungsten() { - function oxygen() { - return 6; - } + function oxygen() { return 6; } ; return oxygen(); } diff --git a/tests/baselines/reference/innerModExport1.js b/tests/baselines/reference/innerModExport1.js index d61e79f2396..cbeced37046 100644 --- a/tests/baselines/reference/innerModExport1.js +++ b/tests/baselines/reference/innerModExport1.js @@ -28,18 +28,12 @@ var Outer; { var non_export_var = 0; Outer.export_var = 1; - function NonExportFunc() { - return 0; - } - function ExportFunc() { - return 0; - } + function NonExportFunc() { return 0; } + function ExportFunc() { return 0; } Outer.ExportFunc = ExportFunc; } Outer.outer_var_export = 0; - function outerFuncExport() { - return 0; - } + function outerFuncExport() { return 0; } Outer.outerFuncExport = outerFuncExport; })(Outer || (Outer = {})); Outer.ExportFunc(); diff --git a/tests/baselines/reference/innerModExport2.js b/tests/baselines/reference/innerModExport2.js index 26399879e6d..a1526daf6f3 100644 --- a/tests/baselines/reference/innerModExport2.js +++ b/tests/baselines/reference/innerModExport2.js @@ -29,19 +29,13 @@ var Outer; { var non_export_var = 0; Outer.export_var = 1; - function NonExportFunc() { - return 0; - } - function ExportFunc() { - return 0; - } + function NonExportFunc() { return 0; } + function ExportFunc() { return 0; } Outer.ExportFunc = ExportFunc; } var export_var; Outer.outer_var_export = 0; - function outerFuncExport() { - return 0; - } + function outerFuncExport() { return 0; } Outer.outerFuncExport = outerFuncExport; })(Outer || (Outer = {})); Outer.NonExportFunc(); diff --git a/tests/baselines/reference/innerOverloads.js b/tests/baselines/reference/innerOverloads.js index 184b644406e..19e3fa78909 100644 --- a/tests/baselines/reference/innerOverloads.js +++ b/tests/baselines/reference/innerOverloads.js @@ -14,9 +14,7 @@ var x = outer(); // should work //// [innerOverloads.js] function outer() { - function inner(a) { - return a; - } + function inner(a) { return a; } return inner(0); } var x = outer(); // should work diff --git a/tests/baselines/reference/instanceAndStaticDeclarations1.js b/tests/baselines/reference/instanceAndStaticDeclarations1.js index 1396e2bcfa8..7dbd6dcbe7d 100644 --- a/tests/baselines/reference/instanceAndStaticDeclarations1.js +++ b/tests/baselines/reference/instanceAndStaticDeclarations1.js @@ -24,9 +24,7 @@ var Point = (function () { var dy = this.y - p.y; return Math.sqrt(dx * dx + dy * dy); }; - Point.distance = function (p1, p2) { - return p1.distance(p2); - }; + Point.distance = function (p1, p2) { return p1.distance(p2); }; Point.origin = new Point(0, 0); return Point; })(); diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js index 32507e8209e..7ab3b4a0aa3 100644 --- a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js @@ -64,9 +64,7 @@ var NonGeneric; enumerable: true, configurable: true }); - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; return C; })(); var D = (function (_super) { @@ -98,9 +96,7 @@ var Generic; enumerable: true, configurable: true }); - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; return C; })(); var D = (function (_super) { diff --git a/tests/baselines/reference/instancePropertyInClassType.js b/tests/baselines/reference/instancePropertyInClassType.js index ac89621b7b9..863f18de323 100644 --- a/tests/baselines/reference/instancePropertyInClassType.js +++ b/tests/baselines/reference/instancePropertyInClassType.js @@ -54,9 +54,7 @@ var NonGeneric; enumerable: true, configurable: true }); - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; return C; })(); var c = new C(1, 2); @@ -81,9 +79,7 @@ var Generic; enumerable: true, configurable: true }); - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; return C; })(); var c = new C(1, ''); diff --git a/tests/baselines/reference/intTypeCheck.js b/tests/baselines/reference/intTypeCheck.js index ab62168007e..fbbe1bb5d03 100644 --- a/tests/baselines/reference/intTypeCheck.js +++ b/tests/baselines/reference/intTypeCheck.js @@ -219,15 +219,9 @@ var anyVar; var obj0; var obj1 = { p: null, - p3: function () { - return 0; - }, - p6: function (pa1) { - return 0; - }, - p7: function (pa1, pa2) { - return 0; - } + p3: function () { return 0; }, + p6: function (pa1) { return 0; }, + p7: function (pa1, pa2) { return 0; } }; var obj2 = new Object(); var obj3 = new obj0; @@ -247,9 +241,7 @@ var obj13 = new Object(); var obj14 = new obj11; var obj15 = new Base; var obj16 = null; -var obj17 = function () { - return 0; -}; +var obj17 = function () { return 0; }; //var obj18: i2 = function foo() { }; var obj19 = anyVar; var obj20 = new < i2 > anyVar; diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js index a230318dcc9..521a71199ad 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js @@ -38,9 +38,7 @@ var C = (function () { function C() { this.x = 1; } - C.prototype.foo = function (x) { - return x; - }; + C.prototype.foo = function (x) { return x; }; return C; })(); var D = (function (_super) { @@ -48,12 +46,8 @@ var D = (function (_super) { function D() { _super.apply(this, arguments); } - D.prototype.foo = function (x) { - return x; - }; - D.prototype.other = function (x) { - return x; - }; + D.prototype.foo = function (x) { return x; }; + D.prototype.other = function (x) { return x; }; D.prototype.bar = function () { }; return D; })(C); diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js index b55c6207661..c177f2e7a90 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js @@ -34,9 +34,7 @@ var C = (function () { function C() { this.x = 1; } - C.prototype.foo = function (x) { - return x; - }; + C.prototype.foo = function (x) { return x; }; return C; })(); var D = (function (_super) { @@ -46,12 +44,8 @@ var D = (function (_super) { this.x = 2; this.y = 3; } - D.prototype.foo = function (x) { - return x; - }; - D.prototype.other = function (x) { - return x; - }; + D.prototype.foo = function (x) { return x; }; + D.prototype.other = function (x) { return x; }; D.prototype.bar = function () { }; return D; })(C); @@ -61,12 +55,8 @@ var D2 = (function (_super) { _super.apply(this, arguments); this.x = ""; } - D2.prototype.foo = function (x) { - return x; - }; - D2.prototype.other = function (x) { - return x; - }; + D2.prototype.foo = function (x) { return x; }; + D2.prototype.other = function (x) { return x; }; D2.prototype.bar = function () { }; return D2; })(C); diff --git a/tests/baselines/reference/interfaceImplementation5.js b/tests/baselines/reference/interfaceImplementation5.js index 1edfdeb8294..c710eda84f5 100644 --- a/tests/baselines/reference/interfaceImplementation5.js +++ b/tests/baselines/reference/interfaceImplementation5.js @@ -36,9 +36,7 @@ var C1 = (function () { function C1() { } Object.defineProperty(C1.prototype, "getset1", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); @@ -58,9 +56,7 @@ var C3 = (function () { function C3() { } Object.defineProperty(C3.prototype, "getset1", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (baz) { }, enumerable: true, configurable: true @@ -71,10 +67,7 @@ var C4 = (function () { function C4() { } Object.defineProperty(C4.prototype, "getset1", { - get: function () { - var x; - return x; - }, + get: function () { var x; return x; }, enumerable: true, configurable: true }); @@ -94,10 +87,7 @@ var C6 = (function () { function C6() { } Object.defineProperty(C6.prototype, "getset1", { - get: function () { - var x; - return x; - }, + get: function () { var x; return x; }, set: function (baz) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/interfaceImplementation7.js b/tests/baselines/reference/interfaceImplementation7.js index 6345fe93a33..2813d7ee0fe 100644 --- a/tests/baselines/reference/interfaceImplementation7.js +++ b/tests/baselines/reference/interfaceImplementation7.js @@ -14,8 +14,6 @@ class C1 implements i4 { var C1 = (function () { function C1() { } - C1.prototype.name = function () { - return ""; - }; + C1.prototype.name = function () { return ""; }; return C1; })(); diff --git a/tests/baselines/reference/interfaceSubtyping.js b/tests/baselines/reference/interfaceSubtyping.js index 840ce79d869..43004985782 100644 --- a/tests/baselines/reference/interfaceSubtyping.js +++ b/tests/baselines/reference/interfaceSubtyping.js @@ -14,8 +14,6 @@ var Camera = (function () { function Camera(str) { this.str = str; } - Camera.prototype.foo = function () { - return "s"; - }; + Camera.prototype.foo = function () { return "s"; }; return Camera; })(); diff --git a/tests/baselines/reference/invalidMultipleVariableDeclarations.js b/tests/baselines/reference/invalidMultipleVariableDeclarations.js index fe3d62c4ba5..824bee92227 100644 --- a/tests/baselines/reference/invalidMultipleVariableDeclarations.js +++ b/tests/baselines/reference/invalidMultipleVariableDeclarations.js @@ -77,9 +77,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -88,9 +86,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); // all of these are errors diff --git a/tests/baselines/reference/invalidReturnStatements.js b/tests/baselines/reference/invalidReturnStatements.js index 9dc30431326..d637158780a 100644 --- a/tests/baselines/reference/invalidReturnStatements.js +++ b/tests/baselines/reference/invalidReturnStatements.js @@ -46,9 +46,5 @@ var D = (function (_super) { } return D; })(C); -function fn10() { - return { id: 12 }; -} -function fn11() { - return new C(); -} +function fn10() { return { id: 12 }; } +function fn11() { return new C(); } diff --git a/tests/baselines/reference/invalidStaticField.js b/tests/baselines/reference/invalidStaticField.js index 5521af05c83..620c019fc18 100644 --- a/tests/baselines/reference/invalidStaticField.js +++ b/tests/baselines/reference/invalidStaticField.js @@ -6,9 +6,7 @@ class B { static NOT_NULL = new B(); } var A = (function () { function A() { } - A.prototype.foo = function () { - return B.NULL; - }; + A.prototype.foo = function () { return B.NULL; }; return A; })(); var B = (function () { diff --git a/tests/baselines/reference/ipromise4.js b/tests/baselines/reference/ipromise4.js index bb8a3f12e0b..98660aa5824 100644 --- a/tests/baselines/reference/ipromise4.js +++ b/tests/baselines/reference/ipromise4.js @@ -19,8 +19,4 @@ p.then(function (x) { return "hello"; } ).then(function (x) { return x } ); // s //// [ipromise4.js] var p = null; p.then(function (x) { }); // should not error -p.then(function (x) { - return "hello"; -}).then(function (x) { - return x; -}); // should not error +p.then(function (x) { return "hello"; }).then(function (x) { return x; }); // should not error diff --git a/tests/baselines/reference/isDeclarationVisibleNodeKinds.js b/tests/baselines/reference/isDeclarationVisibleNodeKinds.js index 0d1664c7f59..d357922f5bc 100644 --- a/tests/baselines/reference/isDeclarationVisibleNodeKinds.js +++ b/tests/baselines/reference/isDeclarationVisibleNodeKinds.js @@ -80,59 +80,59 @@ var schema; })(schema || (schema = {})); // Constructor types var schema; -(function (_schema) { +(function (_schema_1) { function createValidator2(schema) { return undefined; } - _schema.createValidator2 = createValidator2; + _schema_1.createValidator2 = createValidator2; })(schema || (schema = {})); // union types var schema; -(function (_schema) { +(function (_schema_2) { function createValidator3(schema) { return undefined; } - _schema.createValidator3 = createValidator3; + _schema_2.createValidator3 = createValidator3; })(schema || (schema = {})); // Array types var schema; -(function (_schema) { +(function (_schema_3) { function createValidator4(schema) { return undefined; } - _schema.createValidator4 = createValidator4; + _schema_3.createValidator4 = createValidator4; })(schema || (schema = {})); // TypeLiterals var schema; -(function (_schema) { +(function (_schema_4) { function createValidator5(schema) { return undefined; } - _schema.createValidator5 = createValidator5; + _schema_4.createValidator5 = createValidator5; })(schema || (schema = {})); // Tuple types var schema; -(function (_schema) { +(function (_schema_5) { function createValidator6(schema) { return undefined; } - _schema.createValidator6 = createValidator6; + _schema_5.createValidator6 = createValidator6; })(schema || (schema = {})); // Paren Types var schema; -(function (_schema) { +(function (_schema_6) { function createValidator7(schema) { return undefined; } - _schema.createValidator7 = createValidator7; + _schema_6.createValidator7 = createValidator7; })(schema || (schema = {})); // Type reference var schema; -(function (_schema) { +(function (_schema_7) { function createValidator8(schema) { return undefined; } - _schema.createValidator8 = createValidator8; + _schema_7.createValidator8 = createValidator8; })(schema || (schema = {})); var schema; (function (schema) { diff --git a/tests/baselines/reference/lambdaASIEmit.js b/tests/baselines/reference/lambdaASIEmit.js index 551aa5f93dd..49672b75c7c 100644 --- a/tests/baselines/reference/lambdaASIEmit.js +++ b/tests/baselines/reference/lambdaASIEmit.js @@ -12,4 +12,7 @@ Foo(() => //// [lambdaASIEmit.js] function Foo(x) { } -Foo(function () { return 127; }); +Foo(function () { + // do something + return 127; +}); diff --git a/tests/baselines/reference/lift.js b/tests/baselines/reference/lift.js index 21c09aaeb53..33f8200530b 100644 --- a/tests/baselines/reference/lift.js +++ b/tests/baselines/reference/lift.js @@ -37,11 +37,7 @@ var C = (function (_super) { var x = 10 + w; var ll = x * w; } - C.prototype.liftxyz = function () { - return x + z + this.y; - }; - C.prototype.liftxylocllz = function () { - return x + z + this.y + this.ll; - }; + C.prototype.liftxyz = function () { return x + z + this.y; }; + C.prototype.liftxylocllz = function () { return x + z + this.y + this.ll; }; return C; })(B); diff --git a/tests/baselines/reference/logicalNotOperatorWithBooleanType.js b/tests/baselines/reference/logicalNotOperatorWithBooleanType.js index 0f3c39a09ff..107bd9a88ec 100644 --- a/tests/baselines/reference/logicalNotOperatorWithBooleanType.js +++ b/tests/baselines/reference/logicalNotOperatorWithBooleanType.js @@ -41,15 +41,11 @@ var ResultIsBoolean = !!BOOLEAN; //// [logicalNotOperatorWithBooleanType.js] // ! operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/logicalNotOperatorWithNumberType.js b/tests/baselines/reference/logicalNotOperatorWithNumberType.js index 48e1468285e..0d0601cad23 100644 --- a/tests/baselines/reference/logicalNotOperatorWithNumberType.js +++ b/tests/baselines/reference/logicalNotOperatorWithNumberType.js @@ -49,15 +49,11 @@ var ResultIsBoolean13 = !!!(NUMBER + NUMBER); // ! operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -71,9 +67,7 @@ var ResultIsBoolean2 = !NUMBER1; // number type literal var ResultIsBoolean3 = !1; var ResultIsBoolean4 = !{ x: 1, y: 2 }; -var ResultIsBoolean5 = !{ x: 1, y: function (n) { - return n; -} }; +var ResultIsBoolean5 = !{ x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsBoolean6 = !objA.a; var ResultIsBoolean7 = !M.n; diff --git a/tests/baselines/reference/logicalNotOperatorWithStringType.js b/tests/baselines/reference/logicalNotOperatorWithStringType.js index 1bab5de239d..7f75814d601 100644 --- a/tests/baselines/reference/logicalNotOperatorWithStringType.js +++ b/tests/baselines/reference/logicalNotOperatorWithStringType.js @@ -48,15 +48,11 @@ var ResultIsBoolean14 = !!!(STRING + STRING); // ! operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -70,9 +66,7 @@ var ResultIsBoolean2 = !STRING1; // string type literal var ResultIsBoolean3 = !""; var ResultIsBoolean4 = !{ x: "", y: "" }; -var ResultIsBoolean5 = !{ x: "", y: function (s) { - return s; -} }; +var ResultIsBoolean5 = !{ x: "", y: function (s) { return s; } }; // string type expressions var ResultIsBoolean6 = !objA.a; var ResultIsBoolean7 = !M.n; diff --git a/tests/baselines/reference/maxConstraints.js b/tests/baselines/reference/maxConstraints.js index 4ea37d30501..b2098ccaf2b 100644 --- a/tests/baselines/reference/maxConstraints.js +++ b/tests/baselines/reference/maxConstraints.js @@ -9,7 +9,5 @@ var max2: Comparer = (x, y) => { return (x.compareTo(y) > 0) ? x : y }; var maxResult = max2(1, 2); //// [maxConstraints.js] -var max2 = function (x, y) { - return (x.compareTo(y) > 0) ? x : y; -}; +var max2 = function (x, y) { return (x.compareTo(y) > 0) ? x : y; }; var maxResult = max2(1, 2); diff --git a/tests/baselines/reference/missingSelf.js b/tests/baselines/reference/missingSelf.js index c2c1e04ad5c..56dcc4f9fa0 100644 --- a/tests/baselines/reference/missingSelf.js +++ b/tests/baselines/reference/missingSelf.js @@ -22,9 +22,7 @@ c2.b(); var CalcButton = (function () { function CalcButton() { } - CalcButton.prototype.a = function () { - this.onClick(); - }; + CalcButton.prototype.a = function () { this.onClick(); }; CalcButton.prototype.onClick = function () { }; return CalcButton; })(); diff --git a/tests/baselines/reference/modFunctionCrash.js b/tests/baselines/reference/modFunctionCrash.js index f216788c0eb..0d4f62eae63 100644 --- a/tests/baselines/reference/modFunctionCrash.js +++ b/tests/baselines/reference/modFunctionCrash.js @@ -7,6 +7,4 @@ declare module Q { Q.f(function() {this;}); //// [modFunctionCrash.js] -Q.f(function () { - this; -}); +Q.f(function () { this; }); diff --git a/tests/baselines/reference/moduleReopenedTypeOtherBlock.js b/tests/baselines/reference/moduleReopenedTypeOtherBlock.js index d2dc938872a..951c558ddfd 100644 --- a/tests/baselines/reference/moduleReopenedTypeOtherBlock.js +++ b/tests/baselines/reference/moduleReopenedTypeOtherBlock.js @@ -23,9 +23,7 @@ var M; var C2 = (function () { function C2() { } - C2.prototype.f = function () { - return null; - }; + C2.prototype.f = function () { return null; }; return C2; })(); M.C2 = C2; diff --git a/tests/baselines/reference/moduleReopenedTypeSameBlock.js b/tests/baselines/reference/moduleReopenedTypeSameBlock.js index c3546f20b2f..92e7e9e5228 100644 --- a/tests/baselines/reference/moduleReopenedTypeSameBlock.js +++ b/tests/baselines/reference/moduleReopenedTypeSameBlock.js @@ -21,9 +21,7 @@ var M; var C2 = (function () { function C2() { } - C2.prototype.f = function () { - return null; - }; + C2.prototype.f = function () { return null; }; return C2; })(); M.C2 = C2; diff --git a/tests/baselines/reference/moduleSharesNameWithImportDeclarationInsideIt5.js b/tests/baselines/reference/moduleSharesNameWithImportDeclarationInsideIt5.js index 0995dcbb9c0..0bc314ccc07 100644 --- a/tests/baselines/reference/moduleSharesNameWithImportDeclarationInsideIt5.js +++ b/tests/baselines/reference/moduleSharesNameWithImportDeclarationInsideIt5.js @@ -30,10 +30,10 @@ var Z; var A; (function (A) { var M; - (function (M) { + (function (_M) { function bar() { } - M.bar = bar; + _M.bar = bar; M.bar(); // Should call Z.M.bar })(M = A.M || (A.M = {})); })(A || (A = {})); diff --git a/tests/baselines/reference/moduleSharesNameWithImportDeclarationInsideIt6.js b/tests/baselines/reference/moduleSharesNameWithImportDeclarationInsideIt6.js index 51b2d4f89f9..4ba0a33c29a 100644 --- a/tests/baselines/reference/moduleSharesNameWithImportDeclarationInsideIt6.js +++ b/tests/baselines/reference/moduleSharesNameWithImportDeclarationInsideIt6.js @@ -24,9 +24,9 @@ var Z; var A; (function (A) { var M; - (function (M) { + (function (_M) { function bar() { } - M.bar = bar; + _M.bar = bar; })(M = A.M || (A.M = {})); })(A || (A = {})); diff --git a/tests/baselines/reference/moduleSymbolMerging.js b/tests/baselines/reference/moduleSymbolMerging.js index 0a812a62e09..d43fff1378a 100644 --- a/tests/baselines/reference/moduleSymbolMerging.js +++ b/tests/baselines/reference/moduleSymbolMerging.js @@ -22,9 +22,7 @@ var A; })(A || (A = {})); var B; (function (B) { - function f() { - return null; - } + function f() { return null; } B.f = f; })(B || (B = {})); diff --git a/tests/baselines/reference/moduleUnassignedVariable.js b/tests/baselines/reference/moduleUnassignedVariable.js index 179a2577adf..1765342efcd 100644 --- a/tests/baselines/reference/moduleUnassignedVariable.js +++ b/tests/baselines/reference/moduleUnassignedVariable.js @@ -12,11 +12,7 @@ module Bar { var Bar; (function (Bar) { Bar.a = 1; - function fooA() { - return Bar.a; - } // Correct: return Bar.a + function fooA() { return Bar.a; } // Correct: return Bar.a Bar.b; - function fooB() { - return Bar.b; - } // Incorrect: return b + function fooB() { return Bar.b; } // Incorrect: return b })(Bar || (Bar = {})); diff --git a/tests/baselines/reference/moduleVisibilityTest1.js b/tests/baselines/reference/moduleVisibilityTest1.js index d8bdedfafe2..a2957cb9582 100644 --- a/tests/baselines/reference/moduleVisibilityTest1.js +++ b/tests/baselines/reference/moduleVisibilityTest1.js @@ -70,15 +70,11 @@ c.someMethodThatCallsAnOuterMethod(); //// [moduleVisibilityTest1.js] var OuterMod; (function (OuterMod) { - function someExportedOuterFunc() { - return -1; - } + function someExportedOuterFunc() { return -1; } OuterMod.someExportedOuterFunc = someExportedOuterFunc; var OuterInnerMod; (function (OuterInnerMod) { - function someExportedOuterInnerFunc() { - return "foo"; - } + function someExportedOuterInnerFunc() { return "foo"; } OuterInnerMod.someExportedOuterInnerFunc = someExportedOuterInnerFunc; })(OuterInnerMod = OuterMod.OuterInnerMod || (OuterMod.OuterInnerMod = {})); })(OuterMod || (OuterMod = {})); @@ -87,9 +83,7 @@ var M; (function (M) { var InnerMod; (function (InnerMod) { - function someExportedInnerFunc() { - return -2; - } + function someExportedInnerFunc() { return -2; } InnerMod.someExportedInnerFunc = someExportedInnerFunc; })(InnerMod = M.InnerMod || (M.InnerMod = {})); (function (E) { @@ -109,30 +103,18 @@ var M; var C = (function () { function C() { this.someProp = 1; - function someInnerFunc() { - return 2; - } + function someInnerFunc() { return 2; } var someInnerVar = 3; } - C.prototype.someMethodThatCallsAnOuterMethod = function () { - return OuterInnerAlias.someExportedOuterInnerFunc(); - }; - C.prototype.someMethodThatCallsAnInnerMethod = function () { - return InnerMod.someExportedInnerFunc(); - }; - C.prototype.someMethodThatCallsAnOuterInnerMethod = function () { - return OuterMod.someExportedOuterFunc(); - }; - C.prototype.someMethod = function () { - return 0; - }; + C.prototype.someMethodThatCallsAnOuterMethod = function () { return OuterInnerAlias.someExportedOuterInnerFunc(); }; + C.prototype.someMethodThatCallsAnInnerMethod = function () { return InnerMod.someExportedInnerFunc(); }; + C.prototype.someMethodThatCallsAnOuterInnerMethod = function () { return OuterMod.someExportedOuterFunc(); }; + C.prototype.someMethod = function () { return 0; }; return C; })(); M.C = C; var someModuleVar = 4; - function someModuleFunction() { - return 5; - } + function someModuleFunction() { return 5; } })(M || (M = {})); var M; (function (M) { diff --git a/tests/baselines/reference/moduleVisibilityTest2.js b/tests/baselines/reference/moduleVisibilityTest2.js index 63ecaf0c135..9102bd17ae2 100644 --- a/tests/baselines/reference/moduleVisibilityTest2.js +++ b/tests/baselines/reference/moduleVisibilityTest2.js @@ -71,15 +71,11 @@ c.someMethodThatCallsAnOuterMethod(); //// [moduleVisibilityTest2.js] var OuterMod; (function (OuterMod) { - function someExportedOuterFunc() { - return -1; - } + function someExportedOuterFunc() { return -1; } OuterMod.someExportedOuterFunc = someExportedOuterFunc; var OuterInnerMod; (function (OuterInnerMod) { - function someExportedOuterInnerFunc() { - return "foo"; - } + function someExportedOuterInnerFunc() { return "foo"; } OuterInnerMod.someExportedOuterInnerFunc = someExportedOuterInnerFunc; })(OuterInnerMod = OuterMod.OuterInnerMod || (OuterMod.OuterInnerMod = {})); })(OuterMod || (OuterMod = {})); @@ -88,9 +84,7 @@ var M; (function (M) { var InnerMod; (function (InnerMod) { - function someExportedInnerFunc() { - return -2; - } + function someExportedInnerFunc() { return -2; } InnerMod.someExportedInnerFunc = someExportedInnerFunc; })(InnerMod || (InnerMod = {})); var E; @@ -110,30 +104,18 @@ var M; var C = (function () { function C() { this.someProp = 1; - function someInnerFunc() { - return 2; - } + function someInnerFunc() { return 2; } var someInnerVar = 3; } - C.prototype.someMethodThatCallsAnOuterMethod = function () { - return OuterInnerAlias.someExportedOuterInnerFunc(); - }; - C.prototype.someMethodThatCallsAnInnerMethod = function () { - return InnerMod.someExportedInnerFunc(); - }; - C.prototype.someMethodThatCallsAnOuterInnerMethod = function () { - return OuterMod.someExportedOuterFunc(); - }; - C.prototype.someMethod = function () { - return 0; - }; + C.prototype.someMethodThatCallsAnOuterMethod = function () { return OuterInnerAlias.someExportedOuterInnerFunc(); }; + C.prototype.someMethodThatCallsAnInnerMethod = function () { return InnerMod.someExportedInnerFunc(); }; + C.prototype.someMethodThatCallsAnOuterInnerMethod = function () { return OuterMod.someExportedOuterFunc(); }; + C.prototype.someMethod = function () { return 0; }; return C; })(); M.C = C; var someModuleVar = 4; - function someModuleFunction() { - return 5; - } + function someModuleFunction() { return 5; } })(M || (M = {})); var M; (function (M) { diff --git a/tests/baselines/reference/multiModuleClodule1.js b/tests/baselines/reference/multiModuleClodule1.js index 8fa142812cd..9f6d7b5014c 100644 --- a/tests/baselines/reference/multiModuleClodule1.js +++ b/tests/baselines/reference/multiModuleClodule1.js @@ -36,9 +36,7 @@ var C; (function (C) { function foo() { } C.foo = foo; - function baz() { - return ''; - } + function baz() { return ''; } })(C || (C = {})); var c = new C(C.x); c.foo = C.foo; diff --git a/tests/baselines/reference/multipleInheritance.js b/tests/baselines/reference/multipleInheritance.js index 9cab77f3dba..269d5c2ea19 100644 --- a/tests/baselines/reference/multipleInheritance.js +++ b/tests/baselines/reference/multipleInheritance.js @@ -97,13 +97,9 @@ var ND = (function (_super) { })(N); var Good = (function () { function Good() { - this.f = function () { - return 0; - }; + this.f = function () { return 0; }; } - Good.prototype.g = function () { - return 0; - }; + Good.prototype.g = function () { return 0; }; return Good; })(); var Baad = (function (_super) { @@ -111,11 +107,7 @@ var Baad = (function (_super) { function Baad() { _super.apply(this, arguments); } - Baad.prototype.f = function () { - return 0; - }; - Baad.prototype.g = function (n) { - return 0; - }; + Baad.prototype.f = function () { return 0; }; + Baad.prototype.g = function (n) { return 0; }; return Baad; })(Good); diff --git a/tests/baselines/reference/mutrec.js b/tests/baselines/reference/mutrec.js index ba6c8ade036..1d1ccb4e90b 100644 --- a/tests/baselines/reference/mutrec.js +++ b/tests/baselines/reference/mutrec.js @@ -43,15 +43,11 @@ g(i4); //// [mutrec.js] -function f(p) { - return p; -} +function f(p) { return p; } ; var b; f(b); -function g(p) { - return p; -} +function g(p) { return p; } ; var i2; g(i2); diff --git a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js index 585a3d2178b..76fd13aa320 100644 --- a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js +++ b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js @@ -20,9 +20,7 @@ var __extends = this.__extends || function (d, b) { var foo = (function () { function foo() { } - foo.prototype.bar = function () { - return null; - }; + foo.prototype.bar = function () { return null; }; return foo; })(); var foo2 = (function (_super) { diff --git a/tests/baselines/reference/nameCollision.js b/tests/baselines/reference/nameCollision.js index 67e6f3afa47..fe7bb3a8919 100644 --- a/tests/baselines/reference/nameCollision.js +++ b/tests/baselines/reference/nameCollision.js @@ -48,7 +48,7 @@ module D { //// [nameCollision.js] var A; -(function (__A) { +(function (_A_1) { // these 2 statements force an underscore before the 'A' // in the generated function call. var A = 12; @@ -83,15 +83,15 @@ var X; })(Y = _X.Y || (_X.Y = {})); })(X || (X = {})); var Y; -(function (_Y) { +(function (_Y_1) { var Y; - (function (_Y) { + (function (_Y_2) { (function (Y) { Y[Y["Red"] = 0] = "Red"; Y[Y["Blue"] = 1] = "Blue"; - })(_Y.Y || (_Y.Y = {})); - var Y = _Y.Y; - })(Y = _Y.Y || (_Y.Y = {})); + })(_Y_2.Y || (_Y_2.Y = {})); + var Y = _Y_2.Y; + })(Y = _Y_1.Y || (_Y_1.Y = {})); })(Y || (Y = {})); // no collision, since interface doesn't // generate code. diff --git a/tests/baselines/reference/nameCollisionsInPropertyAssignments.js b/tests/baselines/reference/nameCollisionsInPropertyAssignments.js index 3035ab6e628..1f3631e03ba 100644 --- a/tests/baselines/reference/nameCollisionsInPropertyAssignments.js +++ b/tests/baselines/reference/nameCollisionsInPropertyAssignments.js @@ -4,6 +4,4 @@ var y = { x() { x++; } }; //// [nameCollisionsInPropertyAssignments.js] var x = 1; -var y = { x: function () { - x++; -} }; +var y = { x: function () { x++; } }; diff --git a/tests/baselines/reference/negateOperatorWithBooleanType.js b/tests/baselines/reference/negateOperatorWithBooleanType.js index ce7b14b2d82..9442f54490f 100644 --- a/tests/baselines/reference/negateOperatorWithBooleanType.js +++ b/tests/baselines/reference/negateOperatorWithBooleanType.js @@ -38,15 +38,11 @@ var ResultIsNumber7 = -A.foo(); //// [negateOperatorWithBooleanType.js] // - operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/negateOperatorWithNumberType.js b/tests/baselines/reference/negateOperatorWithNumberType.js index 15e0eeca435..5fa83e088c8 100644 --- a/tests/baselines/reference/negateOperatorWithNumberType.js +++ b/tests/baselines/reference/negateOperatorWithNumberType.js @@ -45,15 +45,11 @@ var ResultIsNumber11 = -(NUMBER - NUMBER); // - operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -67,9 +63,7 @@ var ResultIsNumber2 = -NUMBER1; // number type literal var ResultIsNumber3 = -1; var ResultIsNumber4 = -{ x: 1, y: 2 }; -var ResultIsNumber5 = -{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = -{ x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsNumber6 = -objA.a; var ResultIsNumber7 = -M.n; diff --git a/tests/baselines/reference/negateOperatorWithStringType.js b/tests/baselines/reference/negateOperatorWithStringType.js index 228733b65c5..bdbc4a3d664 100644 --- a/tests/baselines/reference/negateOperatorWithStringType.js +++ b/tests/baselines/reference/negateOperatorWithStringType.js @@ -44,15 +44,11 @@ var ResultIsNumber12 = -STRING.charAt(0); // - operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -66,9 +62,7 @@ var ResultIsNumber2 = -STRING1; // string type literal var ResultIsNumber3 = -""; var ResultIsNumber4 = -{ x: "", y: "" }; -var ResultIsNumber5 = -{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber5 = -{ x: "", y: function (s) { return s; } }; // string type expressions var ResultIsNumber6 = -objA.a; var ResultIsNumber7 = -M.n; diff --git a/tests/baselines/reference/nestedClassDeclaration.js b/tests/baselines/reference/nestedClassDeclaration.js index fa69ef5950e..70445b3372f 100644 --- a/tests/baselines/reference/nestedClassDeclaration.js +++ b/tests/baselines/reference/nestedClassDeclaration.js @@ -37,5 +37,4 @@ var C3 = (function () { return C3; })(); var x = { - class: C4 -}, _a = void 0; + class: C4 }, _a = void 0; diff --git a/tests/baselines/reference/nestedSelf.js b/tests/baselines/reference/nestedSelf.js index 897bdd720e7..9c0feaa887f 100644 --- a/tests/baselines/reference/nestedSelf.js +++ b/tests/baselines/reference/nestedSelf.js @@ -17,9 +17,7 @@ var M; } C.prototype.foo = function () { var _this = this; - [1, 2, 3].map(function (x) { - return _this.n * x; - }); + [1, 2, 3].map(function (x) { return _this.n * x; }); }; return C; })(); diff --git a/tests/baselines/reference/newOperatorErrorCases.js b/tests/baselines/reference/newOperatorErrorCases.js index 8a44d51fb5c..b893beba02a 100644 --- a/tests/baselines/reference/newOperatorErrorCases.js +++ b/tests/baselines/reference/newOperatorErrorCases.js @@ -65,7 +65,5 @@ var c1 = new T; var c1; var c2 = new T(); // Parse error // Construct expression of non-void returning function -function fnNumber() { - return 32; -} +function fnNumber() { return 32; } var s = new fnNumber(); // Error diff --git a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.js b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.js index d144a78fae3..bdb55633682 100644 --- a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.js +++ b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.js @@ -11,7 +11,5 @@ function x() { var console; function x() { var _this = 5; - (function (x) { - console.log(_this); - }); + (function (x) { console.log(_this); }); } diff --git a/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.js b/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.js index c34ad4c97bd..b3677681822 100644 --- a/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.js +++ b/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.js @@ -12,7 +12,5 @@ var console; var _this = 5; function x() { var _this = this; - (function (x) { - console.log(_this); - }); + (function (x) { console.log(_this); }); } diff --git a/tests/baselines/reference/noConstraintInReturnType1.js b/tests/baselines/reference/noConstraintInReturnType1.js index 747cbfdf758..0402f9d83cb 100644 --- a/tests/baselines/reference/noConstraintInReturnType1.js +++ b/tests/baselines/reference/noConstraintInReturnType1.js @@ -8,9 +8,7 @@ class List { var List = (function () { function List() { } - List.empty = function () { - return null; - }; + List.empty = function () { return null; }; return List; })(); diff --git a/tests/baselines/reference/noImplicitAnyWithOverloads.js b/tests/baselines/reference/noImplicitAnyWithOverloads.js index c2e9f174ada..fd56b6e0d73 100644 --- a/tests/baselines/reference/noImplicitAnyWithOverloads.js +++ b/tests/baselines/reference/noImplicitAnyWithOverloads.js @@ -11,6 +11,4 @@ callb((a) => { a.foo; }); // error, chose first overload //// [noImplicitAnyWithOverloads.js] function callb(a) { } -callb(function (a) { - a.foo; -}); // error, chose first overload +callb(function (a) { a.foo; }); // error, chose first overload diff --git a/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js index 8afbb0c6201..c32cd84ce26 100644 --- a/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js +++ b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js @@ -112,12 +112,8 @@ var r6 = true ? { foo: 1 } : null; var r6 = true ? null : { foo: 1 }; var r7 = true ? function () { } : null; var r7 = true ? null : function () { }; -var r8 = true ? function (x) { - return x; -} : null; -var r8b = true ? null : function (x) { - return x; -}; // type parameters not identical across declarations +var r8 = true ? function (x) { return x; } : null; +var r8b = true ? null : function (x) { return x; }; // type parameters not identical across declarations var i1; var r9 = true ? i1 : null; var r9 = true ? null : i1; diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js index 1cfd94a0c97..0474abef393 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js @@ -56,9 +56,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { @@ -66,9 +64,7 @@ var B = (function (_super) { function B() { _super.apply(this, arguments); } - B.prototype.bar = function () { - return ''; - }; + B.prototype.bar = function () { return ''; }; return B; })(A); var Foo = (function () { diff --git a/tests/baselines/reference/objectLiteralErrors.js b/tests/baselines/reference/objectLiteralErrors.js index 06158cb87c9..4dccc78b67d 100644 --- a/tests/baselines/reference/objectLiteralErrors.js +++ b/tests/baselines/reference/objectLiteralErrors.js @@ -67,69 +67,25 @@ var e15 = { "100": 0, 1e2: 0 }; var e16 = { 0x20: 0, 3.2e1: 0 }; var e17 = { a: 0, b: 1, a: 0 }; // Accessor and property with the same name -var f1 = { a: 0, get a() { - return 0; -} }; -var f2 = { a: '', get a() { - return ''; -} }; -var f3 = { a: 0, get a() { - return ''; -} }; -var f4 = { a: true, get a() { - return false; -} }; -var f5 = { a: {}, get a() { - return {}; -} }; -var f6 = { a: 0, get 'a'() { - return 0; -} }; -var f7 = { 'a': 0, get a() { - return 0; -} }; -var f8 = { 'a': 0, get "a"() { - return 0; -} }; -var f9 = { 'a': 0, get 'a'() { - return 0; -} }; -var f10 = { "a": 0, get 'a'() { - return 0; -} }; -var f11 = { 1.0: 0, get '1'() { - return 0; -} }; -var f12 = { 0: 0, get 0() { - return 0; -} }; -var f13 = { 0: 0, get 0() { - return 0; -} }; -var f14 = { 0: 0, get 0x0() { - return 0; -} }; -var f14 = { 0: 0, get 000() { - return 0; -} }; -var f15 = { "100": 0, get 1e2() { - return 0; -} }; -var f16 = { 0x20: 0, get 3.2e1() { - return 0; -} }; -var f17 = { a: 0, get b() { - return 1; -}, get a() { - return 0; -} }; +var f1 = { a: 0, get a() { return 0; } }; +var f2 = { a: '', get a() { return ''; } }; +var f3 = { a: 0, get a() { return ''; } }; +var f4 = { a: true, get a() { return false; } }; +var f5 = { a: {}, get a() { return {}; } }; +var f6 = { a: 0, get 'a'() { return 0; } }; +var f7 = { 'a': 0, get a() { return 0; } }; +var f8 = { 'a': 0, get "a"() { return 0; } }; +var f9 = { 'a': 0, get 'a'() { return 0; } }; +var f10 = { "a": 0, get 'a'() { return 0; } }; +var f11 = { 1.0: 0, get '1'() { return 0; } }; +var f12 = { 0: 0, get 0() { return 0; } }; +var f13 = { 0: 0, get 0() { return 0; } }; +var f14 = { 0: 0, get 0x0() { return 0; } }; +var f14 = { 0: 0, get 000() { return 0; } }; +var f15 = { "100": 0, get 1e2() { return 0; } }; +var f16 = { 0x20: 0, get 3.2e1() { return 0; } }; +var f17 = { a: 0, get b() { return 1; }, get a() { return 0; } }; // Get and set accessor with mismatched type annotations -var g1 = { get a() { - return 4; -}, set a(n) { } }; -var g2 = { get a() { - return 4; -}, set a(n) { } }; -var g3 = { get a() { - return undefined; -}, set a(n) { } }; +var g1 = { get a() { return 4; }, set a(n) { } }; +var g2 = { get a() { return 4; }, set a(n) { } }; +var g3 = { get a() { return undefined; }, set a(n) { } }; diff --git a/tests/baselines/reference/objectLiteralErrorsES3.js b/tests/baselines/reference/objectLiteralErrorsES3.js index 6543827d9f3..031a68fd109 100644 --- a/tests/baselines/reference/objectLiteralErrorsES3.js +++ b/tests/baselines/reference/objectLiteralErrorsES3.js @@ -7,10 +7,6 @@ var e3 = { get a() { return ''; }, set a(n) { } }; //// [objectLiteralErrorsES3.js] -var e1 = { get a() { - return 4; -} }; +var e1 = { get a() { return 4; } }; var e2 = { set a(n) { } }; -var e3 = { get a() { - return ''; -}, set a(n) { } }; +var e3 = { get a() { return ''; }, set a(n) { } }; diff --git a/tests/baselines/reference/objectLiteralGettersAndSetters.js b/tests/baselines/reference/objectLiteralGettersAndSetters.js index bd261697d5f..d226c2c5569 100644 --- a/tests/baselines/reference/objectLiteralGettersAndSetters.js +++ b/tests/baselines/reference/objectLiteralGettersAndSetters.js @@ -85,62 +85,24 @@ var getParamType3 = { //// [objectLiteralGettersAndSetters.js] // Get and set accessor with the same name -var sameName1a = { get 'a'() { - return ''; -}, set a(n) { - var p = n; - var p; -} }; -var sameName2a = { get 0.0() { - return ''; -}, set 0(n) { - var p = n; - var p; -} }; -var sameName3a = { get 0x20() { - return ''; -}, set 3.2e1(n) { - var p = n; - var p; -} }; -var sameName4a = { get ''() { - return ''; -}, set ""(n) { - var p = n; - var p; -} }; -var sameName5a = { get '\t'() { - return ''; -}, set '\t'(n) { - var p = n; - var p; -} }; -var sameName6a = { get 'a'() { - return ''; -}, set a(n) { - var p = n; - var p; -} }; +var sameName1a = { get 'a'() { return ''; }, set a(n) { var p = n; var p; } }; +var sameName2a = { get 0.0() { return ''; }, set 0(n) { var p = n; var p; } }; +var sameName3a = { get 0x20() { return ''; }, set 3.2e1(n) { var p = n; var p; } }; +var sameName4a = { get ''() { return ''; }, set ""(n) { var p = n; var p; } }; +var sameName5a = { get '\t'() { return ''; }, set '\t'(n) { var p = n; var p; } }; +var sameName6a = { get 'a'() { return ''; }, set a(n) { var p = n; var p; } }; // PropertyName CallSignature{FunctionBody} is equivalent to PropertyName:function CallSignature{FunctionBody} -var callSig1 = { num: function (n) { - return ''; -} }; +var callSig1 = { num: function (n) { return ''; } }; var callSig1; -var callSig2 = { num: function (n) { - return ''; -} }; +var callSig2 = { num: function (n) { return ''; } }; var callSig2; var callSig3 = { num: function (n) { return ''; } }; var callSig3; // Get accessor only, type of the property is the annotated return type of the get accessor -var getter1 = { get x() { - return undefined; -} }; +var getter1 = { get x() { return undefined; } }; var getter1; // Get accessor only, type of the property is the inferred return type of the get accessor -var getter2 = { get x() { - return ''; -} }; +var getter2 = { get x() { return ''; } }; var getter2; // Set accessor only, type of the property is the param type of the set accessor var setter1 = { set x(n) { } }; @@ -150,18 +112,10 @@ var setter2 = { set x(n) { } }; var setter2; var anyVar; // Get and set accessor with matching type annotations -var sameType1 = { get x() { - return undefined; -}, set x(n) { } }; -var sameType2 = { get x() { - return undefined; -}, set x(n) { } }; -var sameType3 = { get x() { - return undefined; -}, set x(n) { } }; -var sameType4 = { get x() { - return undefined; -}, set x(n) { } }; +var sameType1 = { get x() { return undefined; }, set x(n) { } }; +var sameType2 = { get x() { return undefined; }, set x(n) { } }; +var sameType3 = { get x() { return undefined; }, set x(n) { } }; +var sameType4 = { get x() { return undefined; }, set x(n) { } }; // Type of unannotated get accessor return type is the type annotation of the set accessor param var setParamType1 = { set n(x) { }, @@ -187,14 +141,10 @@ var getParamType1 = { var y = x; var y; }, - get n() { - return ''; - } + get n() { return ''; } }; var getParamType2 = { - get n() { - return ''; - }, + get n() { return ''; }, set n(x) { var y = x; var y; @@ -202,9 +152,7 @@ var getParamType2 = { }; // Type of unannotated accessors is the inferred return type of the get accessor var getParamType3 = { - get n() { - return ''; - }, + get n() { return ''; }, set n(x) { var y = x; var y; diff --git a/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js b/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js index 2ad13950b14..d6a8579be04 100644 --- a/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js +++ b/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js @@ -2,5 +2,4 @@ var v = { foo(); } //// [objectLiteralMemberWithoutBlock1.js] -var v = { foo: function () { -} }; +var v = { foo: function () { } }; diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignment.js b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignment.js index c000a30181d..251098eb6c8 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignment.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignment.js @@ -20,15 +20,9 @@ var name = "my name"; var person = { name: name, id: id }; function foo(obj) { } ; -function bar(name, id) { - return { name: name, id: id }; -} -function bar1(name, id) { - return { name: name }; -} -function baz(name, id) { - return { name: name, id: id }; -} +function bar(name, id) { return { name: name, id: id }; } +function bar1(name, id) { return { name: name }; } +function baz(name, id) { return { name: name, id: id }; } foo(person); var person1 = bar("Hello", 5); var person2 = bar("Hello", 5); diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentES6.js b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentES6.js index ee99de6d470..247ec56d127 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentES6.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentES6.js @@ -20,15 +20,9 @@ var name = "my name"; var person = { name, id }; function foo(obj) { } ; -function bar(name, id) { - return { name, id }; -} -function bar1(name, id) { - return { name }; -} -function baz(name, id) { - return { name, id }; -} +function bar(name, id) { return { name, id }; } +function bar1(name, id) { return { name }; } +function baz(name, id) { return { name, id }; } foo(person); var person1 = bar("Hello", 5); var person2 = bar("Hello", 5); diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js index 1bef1cc9554..8e2d7f80356 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js @@ -16,8 +16,6 @@ var name = "my name"; var person = { name: name, id: id }; // error var person1 = name, id; ; // error: can't use short-hand property assignment in type position -function foo(name, id) { - return { name: name, id: id }; -} // error +function foo(name, id) { return { name: name, id: id }; } // error function bar(obj) { } bar({ name: name, id: id }); // error diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js index b008644116b..71449746add 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js @@ -12,12 +12,8 @@ var person2: { name: string, id: number } = bar("hello", 5); var id = 10000; var name = "my name"; var person = { name: name, id: id }; // error -function bar(name, id) { - return { name: name, id: id }; -} // error -function foo(name, id) { - return { name: name, id: id }; -} // error +function bar(name, id) { return { name: name, id: id }; } // error +function foo(name, id) { return { name: name, id: id }; } // error var person1 = name, id; ; // error : Can't use shorthand in the type position var person2 = bar("hello", 5); diff --git a/tests/baselines/reference/objectLiteralWithSemicolons4.js b/tests/baselines/reference/objectLiteralWithSemicolons4.js index 9e1e3dea4b9..a01d52548ee 100644 --- a/tests/baselines/reference/objectLiteralWithSemicolons4.js +++ b/tests/baselines/reference/objectLiteralWithSemicolons4.js @@ -5,5 +5,4 @@ var v = { //// [objectLiteralWithSemicolons4.js] var v = { - a: -}; + a: }; diff --git a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.js b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.js index 9c327ca3a38..7a2b5e2ec2f 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.js +++ b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.js @@ -29,9 +29,7 @@ i = o; // error var C = (function () { function C() { } - C.prototype.toString = function () { - return 1; - }; + C.prototype.toString = function () { return 1; }; return C; })(); var c; diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignatures.js b/tests/baselines/reference/objectTypesIdentityWithCallSignatures.js index 21cfc280500..0c6952291f9 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignatures.js +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignatures.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return ''; -} }; +var b = { foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.js b/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.js index 0c7e54ded21..43473d88e0a 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.js +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return ''; -} }; +var b = { foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.js b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.js index 434d1cdd31e..498867f0a02 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.js +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return ''; -} }; +var b = { foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.js b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.js index 52dc447f5fb..54400ad81d1 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.js +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.js @@ -121,32 +121,24 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; var b = { - foo: function (x) { - return ''; - } + foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.js b/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.js index b3381ac5825..87067b6be28 100644 --- a/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.js +++ b/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.js b/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.js index 0010d8815b4..c95159ed997 100644 --- a/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.js +++ b/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.js index cc17fcbeaf3..c8bed1a47ab 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return x; -} }; +var b = { foo: function (x) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.js index 0dc2c18d491..6ef5d15fd98 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x, y) { - return x; -} }; +var b = { foo: function (x, y) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.js index b0652b29b7f..2b83064afed 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return ''; -} }; +var b = { foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.js index 3486157840c..1f9c5fa5256 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.js @@ -121,39 +121,29 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var D = (function () { function D() { } - D.prototype.foo = function (x, y) { - return null; - }; + D.prototype.foo = function (x, y) { return null; }; return D; })(); var a; -var b = { foo: function (x, y) { - return ''; -} }; +var b = { foo: function (x, y) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.js index 714e7dbf142..21106b56b00 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.js @@ -140,39 +140,29 @@ var Two = (function () { var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var D = (function () { function D() { } - D.prototype.foo = function (x, y) { - return null; - }; + D.prototype.foo = function (x, y) { return null; }; return D; })(); var a; -var b = { foo: function (x, y) { - return ''; -} }; +var b = { foo: function (x, y) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.js index e1940c41587..99188347d36 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return null; -} }; +var b = { foo: function (x) { return null; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.js index b4eaf096ec8..10d72bde0b3 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return null; -} }; +var b = { foo: function (x) { return null; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.js index 2c9ad2767d9..5a20dfdecb6 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return x; -} }; +var b = { foo: function (x) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.js index 3e98e5887a9..ec9c786b890 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return x; -} }; +var b = { foo: function (x) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.js index 36d17758c94..a4af2bc820e 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x, y) { - return x; -} }; +var b = { foo: function (x, y) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.js index 4e58adda1c4..28b2f978b55 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x, y) { - return x; -} }; +var b = { foo: function (x, y) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.js index 71842d18781..de9b4859fa1 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x, y) { - return x; -} }; +var b = { foo: function (x, y) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.js index 6183be4fb69..fdc67d4b84a 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.js @@ -92,9 +92,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.js index 59a801134d4..11dcdf0a609 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.js @@ -109,9 +109,7 @@ var D = (function () { return D; })(); var a; -var b = { new: function (x, y) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.js index d61edd07382..5c6f59eef24 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.js @@ -128,9 +128,7 @@ var D = (function () { return D; })(); var a; -var b = { new: function (x, y) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.js index b390f7a933b..556d1bcaee0 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.js @@ -99,9 +99,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return null; -} }; // not a construct signature, function called new +var b = { new: function (x) { return null; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.js index d22cc6b254e..68c32cb0e71 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.js @@ -95,9 +95,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return null; -} }; // not a construct signature, function called new +var b = { new: function (x) { return null; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.js index 99d3f8287df..789e02d2d7b 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.js @@ -87,9 +87,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return x; -} }; +var b = { new: function (x) { return x; } }; function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.js index cd77c1ee3d1..5a501d05834 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.js @@ -87,9 +87,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return new C(x); -} }; +var b = { new: function (x) { return new C(x); } }; function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.js index 72b8e7c8d8f..685a8441d97 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x, y) { - return new C(x, y); -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return new C(x, y); } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.js index 1c781f299ce..f16d69acaa1 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x, y) { - return new C(x, y); -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return new C(x, y); } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.js index 8c5aca3cb1c..25c628e9e15 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x, y) { - return new C(x, y); -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return new C(x, y); } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties2.js b/tests/baselines/reference/objectTypesWithOptionalProperties2.js index 7a237223d7c..cf0d113c244 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties2.js +++ b/tests/baselines/reference/objectTypesWithOptionalProperties2.js @@ -42,6 +42,5 @@ var C2 = (function () { return C2; })(); var b = { - x: function () { }, - 1: // error + x: function () { }, 1: // error }; diff --git a/tests/baselines/reference/optionalAccessorsInInterface1.js b/tests/baselines/reference/optionalAccessorsInInterface1.js index 3ebccc2ea8e..dd274b133e5 100644 --- a/tests/baselines/reference/optionalAccessorsInInterface1.js +++ b/tests/baselines/reference/optionalAccessorsInInterface1.js @@ -17,9 +17,5 @@ defineMyProperty2({}, "name", { get: function () { return 5; } }); //// [optionalAccessorsInInterface1.js] -defineMyProperty({}, "name", { get: function () { - return 5; -} }); -defineMyProperty2({}, "name", { get: function () { - return 5; -} }); +defineMyProperty({}, "name", { get: function () { return 5; } }); +defineMyProperty2({}, "name", { get: function () { return 5; } }); diff --git a/tests/baselines/reference/optionalFunctionArgAssignability.js b/tests/baselines/reference/optionalFunctionArgAssignability.js index bca42060066..c82a47e88da 100644 --- a/tests/baselines/reference/optionalFunctionArgAssignability.js +++ b/tests/baselines/reference/optionalFunctionArgAssignability.js @@ -9,10 +9,6 @@ a = b; // error because number is not assignable to string //// [optionalFunctionArgAssignability.js] -var a = function then(onFulfill, onReject) { - return null; -}; -var b = function then(onFulFill, onReject) { - return null; -}; +var a = function then(onFulfill, onReject) { return null; }; +var b = function then(onFulFill, onReject) { return null; }; a = b; // error because number is not assignable to string diff --git a/tests/baselines/reference/optionalParamArgsTest.js b/tests/baselines/reference/optionalParamArgsTest.js index 6f9b97036ed..202439bc79a 100644 --- a/tests/baselines/reference/optionalParamArgsTest.js +++ b/tests/baselines/reference/optionalParamArgsTest.js @@ -139,12 +139,8 @@ var C1 = (function () { if (p === void 0) { p = 0; } this.n = 0; } - C1.prototype.C1M1 = function () { - return 0; - }; // returning C1M1A1 will result in "Unresolved symbol C1M1A1" - C1.prototype.C1M2 = function (C1M2A1) { - return C1M2A1; - }; // will return C1M1A2 without complaint + C1.prototype.C1M1 = function () { return 0; }; // returning C1M1A1 will result in "Unresolved symbol C1M1A1" + C1.prototype.C1M2 = function (C1M2A1) { return C1M2A1; }; // will return C1M1A2 without complaint // C1M3 contains all optional parameters C1.prototype.C1M3 = function (C1M3A1, C1M3A2) { if (C1M3A1 === void 0) { C1M3A1 = 0; } @@ -152,9 +148,7 @@ var C1 = (function () { return C1M3A1 + C1M3A2; }; // C1M4 contains a mix of optional and non-optional parameters - C1.prototype.C1M4 = function (C1M4A1, C1M4A2) { - return C1M4A1 + C1M4A2; - }; + C1.prototype.C1M4 = function (C1M4A1, C1M4A2) { return C1M4A1 + C1M4A2; }; C1.prototype.C1M5 = function (C1M5A1, C1M5A2, C1M5A3) { if (C1M5A2 === void 0) { C1M5A2 = 0; } return C1M5A1 + C1M5A2; @@ -175,34 +169,22 @@ var C2 = (function (_super) { } return C2; })(C1); -function F1() { - return 0; -} -function F2(F2A1) { - return F2A1; -} +function F1() { return 0; } +function F2(F2A1) { return F2A1; } function F3(F3A1, F3A2) { if (F3A1 === void 0) { F3A1 = 0; } if (F3A2 === void 0) { F3A2 = F3A1; } return F3A1 + F3A2; } -function F4(F4A1, F4A2) { - return F4A1 + F4A2; -} -var L1 = function () { - return 0; -}; -var L2 = function (L2A1) { - return L2A1; -}; +function F4(F4A1, F4A2) { return F4A1 + F4A2; } +var L1 = function () { return 0; }; +var L2 = function (L2A1) { return L2A1; }; var L3 = function (L3A1, L3A2) { if (L3A1 === void 0) { L3A1 = 0; } if (L3A2 === void 0) { L3A2 = L3A1; } return L3A1 + L3A2; }; -var L4 = function (L4A1, L4A2) { - return L4A1 + L4A2; -}; +var L4 = function (L4A1, L4A2) { return L4A1 + L4A2; }; var c1o1 = new C1(5); var i1o1 = new C1(5); // Valid diff --git a/tests/baselines/reference/overloadAssignmentCompat.js b/tests/baselines/reference/overloadAssignmentCompat.js index f6767f6f33e..2d4bd931844 100644 --- a/tests/baselines/reference/overloadAssignmentCompat.js +++ b/tests/baselines/reference/overloadAssignmentCompat.js @@ -65,7 +65,5 @@ function attr2(nameOrMap, value) { return "s"; } } -function foo() { - return "a"; -} +function foo() { return "a"; } ; diff --git a/tests/baselines/reference/overloadCallTest.js b/tests/baselines/reference/overloadCallTest.js index f7eb97fc9eb..38930b7aea3 100644 --- a/tests/baselines/reference/overloadCallTest.js +++ b/tests/baselines/reference/overloadCallTest.js @@ -18,9 +18,7 @@ class foo { //// [overloadCallTest.js] var foo = (function () { function foo() { - function bar(foo) { - return "foo"; - } + function bar(foo) { return "foo"; } ; var test = bar("test"); var goo = bar(); diff --git a/tests/baselines/reference/overloadOnConstNoAnyImplementation2.js b/tests/baselines/reference/overloadOnConstNoAnyImplementation2.js index 6c66c23f1f8..52f6639e352 100644 --- a/tests/baselines/reference/overloadOnConstNoAnyImplementation2.js +++ b/tests/baselines/reference/overloadOnConstNoAnyImplementation2.js @@ -35,15 +35,7 @@ var C = (function () { return C; })(); var c; -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); diff --git a/tests/baselines/reference/overloadOnConstNoStringImplementation2.js b/tests/baselines/reference/overloadOnConstNoStringImplementation2.js index f51f84acb2a..71d7a4e4a3f 100644 --- a/tests/baselines/reference/overloadOnConstNoStringImplementation2.js +++ b/tests/baselines/reference/overloadOnConstNoStringImplementation2.js @@ -34,15 +34,7 @@ var C = (function () { return C; })(); var c; -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); diff --git a/tests/baselines/reference/overloadResolution.js b/tests/baselines/reference/overloadResolution.js index 8737708beda..1ee5e077c08 100644 --- a/tests/baselines/reference/overloadResolution.js +++ b/tests/baselines/reference/overloadResolution.js @@ -127,16 +127,12 @@ var SomeDerived3 = (function (_super) { } return SomeDerived3; })(SomeBase); -function fn1() { - return null; -} +function fn1() { return null; } var s = fn1(undefined); var s; // No candidate overloads found fn1({}); // Error -function fn2() { - return undefined; -} +function fn2() { return undefined; } var d = fn2(0, undefined); var d; // Generic and non - generic overload where generic overload is the only candidate when called without type arguments @@ -145,9 +141,7 @@ var s = fn2(0, ''); fn2('', 0); // Error // Generic and non - generic overload where non - generic overload is the only candidate when called without type arguments fn2('', 0); // OK -function fn3() { - return null; -} +function fn3() { return null; } var s = fn3(3); var s = fn3('', 3, ''); var n = fn3(5, 5, 5); @@ -173,8 +167,6 @@ fn4(null, null); // Error // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4(true, null); // Error fn4(null, true); // Error -function fn5() { - return undefined; -} +function fn5() { return undefined; } var n = fn5(function (n) { return n.toFixed(); }); var s = fn5(function (n) { return n.substr(0); }); diff --git a/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js b/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js index 86e84ced58f..e77e8d3371f 100644 --- a/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js +++ b/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js @@ -48,13 +48,7 @@ var Bugs; return result; } })(Bugs || (Bugs = {})); -function bug3(f) { - return f("s"); -} -function fprime(x) { - return x; -} +function bug3(f) { return f("s"); } +function fprime(x) { return x; } bug3(fprime); -bug3(function (x) { - return x; -}); +bug3(function (x) { return x; }); diff --git a/tests/baselines/reference/overloadResolutionTest1.js b/tests/baselines/reference/overloadResolutionTest1.js index a08243fb27a..60b99ebf7b9 100644 --- a/tests/baselines/reference/overloadResolutionTest1.js +++ b/tests/baselines/reference/overloadResolutionTest1.js @@ -26,23 +26,17 @@ function foo4(bar:{a:any;}):any{ return bar }; var x = foo4({a:true}); // error //// [overloadResolutionTest1.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } ; var x1 = foo([{ a: true }]); // works var x11 = foo([{ a: 0 }]); // works var x111 = foo([{ a: "s" }]); // error - does not match any signature var x1111 = foo([{ a: null }]); // works - ambiguous call is resolved to be the first in the overload set so this returns a string -function foo2(bar) { - return bar; -} +function foo2(bar) { return bar; } ; var x2 = foo2({ a: 0 }); // works var x3 = foo2({ a: true }); // works var x4 = foo2({ a: "s" }); // error -function foo4(bar) { - return bar; -} +function foo4(bar) { return bar; } ; var x = foo4({ a: true }); // error diff --git a/tests/baselines/reference/parameterInitializersForwardReferencing.js b/tests/baselines/reference/parameterInitializersForwardReferencing.js index d810db54695..8ce7fae6874 100644 --- a/tests/baselines/reference/parameterInitializersForwardReferencing.js +++ b/tests/baselines/reference/parameterInitializersForwardReferencing.js @@ -92,8 +92,6 @@ var x = function (a, b, c) { }; // Should not produce errors - can reference later parameters if they occur within a function expression initializer. function f(a, b, c) { - if (b === void 0) { b = function () { - return c; - }; } + if (b === void 0) { b = function () { return c; }; } if (c === void 0) { c = b(); } } diff --git a/tests/baselines/reference/parametersWithNoAnnotationAreAny.js b/tests/baselines/reference/parametersWithNoAnnotationAreAny.js index 48f8d3e520c..a8d06125d25 100644 --- a/tests/baselines/reference/parametersWithNoAnnotationAreAny.js +++ b/tests/baselines/reference/parametersWithNoAnnotationAreAny.js @@ -30,12 +30,8 @@ var b = { } //// [parametersWithNoAnnotationAreAny.js] -function foo(x) { - return x; -} -var f = function foo(x) { - return x; -}; +function foo(x) { return x; } +var f = function foo(x) { return x; }; var f2 = function (x) { return x; }; var f3 = function (x) { return x; }; var C = (function () { diff --git a/tests/baselines/reference/parenthesizedContexualTyping2.js b/tests/baselines/reference/parenthesizedContexualTyping2.js index d5e4e0ebe8f..993a10ba49c 100644 --- a/tests/baselines/reference/parenthesizedContexualTyping2.js +++ b/tests/baselines/reference/parenthesizedContexualTyping2.js @@ -49,80 +49,20 @@ function fun() { } return undefined; } -var a = fun(function (x) { - x(undefined); - return x; -}, 10); -var b = fun((function (x) { - x(undefined); - return x; -}), 10); -var c = fun(((function (x) { - x(undefined); - return x; -})), 10); -var d = fun((((function (x) { - x(undefined); - return x; -}))), 10); -var e = fun(function (x) { - x(undefined); - return x; -}, function (x) { - x(undefined); - return x; -}, 10); -var f = fun((function (x) { - x(undefined); - return x; -}), (function (x) { - x(undefined); - return x; -}), 10); -var g = fun(((function (x) { - x(undefined); - return x; -})), ((function (x) { - x(undefined); - return x; -})), 10); -var h = fun((((function (x) { - x(undefined); - return x; -}))), ((function (x) { - x(undefined); - return x; -})), 10); +var a = fun(function (x) { x(undefined); return x; }, 10); +var b = fun((function (x) { x(undefined); return x; }), 10); +var c = fun(((function (x) { x(undefined); return x; })), 10); +var d = fun((((function (x) { x(undefined); return x; }))), 10); +var e = fun(function (x) { x(undefined); return x; }, function (x) { x(undefined); return x; }, 10); +var f = fun((function (x) { x(undefined); return x; }), (function (x) { x(undefined); return x; }), 10); +var g = fun(((function (x) { x(undefined); return x; })), ((function (x) { x(undefined); return x; })), 10); +var h = fun((((function (x) { x(undefined); return x; }))), ((function (x) { x(undefined); return x; })), 10); // Ternaries in parens -var i = fun((Math.random() < 0.5 ? function (x) { - x(undefined); - return x; -} : function (x) { return undefined; }), 10); -var j = fun((Math.random() < 0.5 ? (function (x) { - x(undefined); - return x; -}) : (function (x) { return undefined; })), 10); -var k = fun((Math.random() < 0.5 ? (function (x) { - x(undefined); - return x; -}) : (function (x) { return undefined; })), function (x) { - x(undefined); - return x; -}, 10); -var l = fun(((Math.random() < 0.5 ? ((function (x) { - x(undefined); - return x; -})) : ((function (x) { return undefined; })))), ((function (x) { - x(undefined); - return x; -})), 10); -var lambda1 = function (x) { - x(undefined); - return x; -}; -var lambda2 = (function (x) { - x(undefined); - return x; -}); +var i = fun((Math.random() < 0.5 ? function (x) { x(undefined); return x; } : function (x) { return undefined; }), 10); +var j = fun((Math.random() < 0.5 ? (function (x) { x(undefined); return x; }) : (function (x) { return undefined; })), 10); +var k = fun((Math.random() < 0.5 ? (function (x) { x(undefined); return x; }) : (function (x) { return undefined; })), function (x) { x(undefined); return x; }, 10); +var l = fun(((Math.random() < 0.5 ? ((function (x) { x(undefined); return x; })) : ((function (x) { return undefined; })))), ((function (x) { x(undefined); return x; })), 10); +var lambda1 = function (x) { x(undefined); return x; }; +var lambda2 = (function (x) { x(undefined); return x; }); var obj1 = { x: function (x) { return (x, undefined); }, y: function (y) { return (y, undefined); } }; var obj2 = ({ x: function (x) { return (x, undefined); }, y: function (y) { return (y, undefined); } }); diff --git a/tests/baselines/reference/parseTypes.js b/tests/baselines/reference/parseTypes.js index 193533de04a..08cc9f2a6bd 100644 --- a/tests/baselines/reference/parseTypes.js +++ b/tests/baselines/reference/parseTypes.js @@ -18,13 +18,9 @@ var x = null; var y = null; var z = null; var w = null; -function f() { - return 3; -} +function f() { return 3; } ; -function g(s) { - true; -} +function g(s) { true; } ; y = f; y = g; diff --git a/tests/baselines/reference/parser15.4.4.14-9-2.js b/tests/baselines/reference/parser15.4.4.14-9-2.js index 9680dbff36b..0f533cd9a26 100644 --- a/tests/baselines/reference/parser15.4.4.14-9-2.js +++ b/tests/baselines/reference/parser15.4.4.14-9-2.js @@ -37,13 +37,14 @@ runTestCase(testcase); * @description Array.prototype.indexOf must return correct index (Number) */ function testcase() { - var obj = { toString: function () { - return 0; - } }; + var obj = { toString: function () { return 0; } }; var one = 1; var _float = -(4 / 3); var a = new Array(false, undefined, null, "0", obj, -1.3333333333333, "str", -0, true, +0, one, 1, 0, false, _float, -(4 / 3)); - if (a.indexOf(-(4 / 3)) === 14 && a.indexOf(0) === 7 && a.indexOf(-0) === 7 && a.indexOf(1) === 10) { + if (a.indexOf(-(4 / 3)) === 14 && + a.indexOf(0) === 7 && + a.indexOf(-0) === 7 && + a.indexOf(1) === 10) { return true; } } diff --git a/tests/baselines/reference/parserClass1.js b/tests/baselines/reference/parserClass1.js index 1245da3363f..eb1d17566aa 100644 --- a/tests/baselines/reference/parserClass1.js +++ b/tests/baselines/reference/parserClass1.js @@ -13,21 +13,11 @@ var NullLogger = (function () { function NullLogger() { } - NullLogger.prototype.information = function () { - return false; - }; - NullLogger.prototype.debug = function () { - return false; - }; - NullLogger.prototype.warning = function () { - return false; - }; - NullLogger.prototype.error = function () { - return false; - }; - NullLogger.prototype.fatal = function () { - return false; - }; + NullLogger.prototype.information = function () { return false; }; + NullLogger.prototype.debug = function () { return false; }; + NullLogger.prototype.warning = function () { return false; }; + NullLogger.prototype.error = function () { return false; }; + NullLogger.prototype.fatal = function () { return false; }; NullLogger.prototype.log = function (s) { }; return NullLogger; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt index 5918387942d..55176bf76f1 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,12): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts (1 errors) ==== var v = { [e]: 1 }; - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName2.js b/tests/baselines/reference/parserES5ComputedPropertyName2.js index 861716a3cde..2b39e305e07 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName2.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName2.js @@ -2,4 +2,7 @@ var v = { [e]: 1 }; //// [parserES5ComputedPropertyName2.js] -var v = { [e]: 1 }; +var v = (_a = {}, _a[e] = +1, +_a); +var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt index 097ab1ea9cb..07ea47dd3f0 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,12): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts (1 errors) ==== var v = { [e]() { } }; - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.js b/tests/baselines/reference/parserES5ComputedPropertyName3.js index f83253b531d..3247b0251f1 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName3.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName3.js @@ -2,4 +2,6 @@ var v = { [e]() { } }; //// [parserES5ComputedPropertyName3.js] -var v = { [e]: function () { } }; +var v = (_a = {}, _a[e] = function () { }, +_a); +var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt index ca69791c93c..cfb12152c94 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt @@ -1,13 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,16): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts (2 errors) ==== var v = { get [e]() { } }; ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.js b/tests/baselines/reference/parserES5ComputedPropertyName4.js index 568b54500ac..436f967e8de 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName4.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.js @@ -2,4 +2,6 @@ var v = { get [e]() { } }; //// [parserES5ComputedPropertyName4.js] -var v = { get [e]() { } }; +var v = (_a = {}, _a[e] = Object.defineProperty({ get: function () { }, enumerable: true, configurable: true }), +_a); +var _a; diff --git a/tests/baselines/reference/parserES5SymbolProperty1.errors.txt b/tests/baselines/reference/parserES5SymbolProperty1.errors.txt index e82ac4c3bc6..261b28a0650 100644 --- a/tests/baselines/reference/parserES5SymbolProperty1.errors.txt +++ b/tests/baselines/reference/parserES5SymbolProperty1.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts(2,6): error TS2304: Cannot find name 'Symbol'. -==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts (1 errors) ==== interface I { [Symbol.iterator]: string; - ~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~~ !!! error TS2304: Cannot find name 'Symbol'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty2.errors.txt b/tests/baselines/reference/parserES5SymbolProperty2.errors.txt index c8ca6613da8..20e166b81f1 100644 --- a/tests/baselines/reference/parserES5SymbolProperty2.errors.txt +++ b/tests/baselines/reference/parserES5SymbolProperty2.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts(2,6): error TS2304: Cannot find name 'Symbol'. -==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts (1 errors) ==== interface I { [Symbol.unscopables](): string; - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~~ !!! error TS2304: Cannot find name 'Symbol'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty3.errors.txt b/tests/baselines/reference/parserES5SymbolProperty3.errors.txt index 4bd883b44b7..9125e8b6dcc 100644 --- a/tests/baselines/reference/parserES5SymbolProperty3.errors.txt +++ b/tests/baselines/reference/parserES5SymbolProperty3.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts(2,6): error TS2304: Cannot find name 'Symbol'. -==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts (1 errors) ==== declare class C { [Symbol.unscopables](): string; - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~~ !!! error TS2304: Cannot find name 'Symbol'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty4.errors.txt b/tests/baselines/reference/parserES5SymbolProperty4.errors.txt index cdc5510766e..af64d0895d5 100644 --- a/tests/baselines/reference/parserES5SymbolProperty4.errors.txt +++ b/tests/baselines/reference/parserES5SymbolProperty4.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts(2,6): error TS2304: Cannot find name 'Symbol'. -==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts (1 errors) ==== declare class C { [Symbol.isRegExp]: string; - ~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~~ !!! error TS2304: Cannot find name 'Symbol'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty5.errors.txt b/tests/baselines/reference/parserES5SymbolProperty5.errors.txt index 2e80a55b47e..7ebc7f589d2 100644 --- a/tests/baselines/reference/parserES5SymbolProperty5.errors.txt +++ b/tests/baselines/reference/parserES5SymbolProperty5.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts(2,6): error TS2304: Cannot find name 'Symbol'. -==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts (1 errors) ==== class C { [Symbol.isRegExp]: string; - ~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~~ !!! error TS2304: Cannot find name 'Symbol'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty6.errors.txt b/tests/baselines/reference/parserES5SymbolProperty6.errors.txt index 615be8ca8da..f72a3b4fd28 100644 --- a/tests/baselines/reference/parserES5SymbolProperty6.errors.txt +++ b/tests/baselines/reference/parserES5SymbolProperty6.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts(2,6): error TS2304: Cannot find name 'Symbol'. -==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts (1 errors) ==== class C { [Symbol.toStringTag]: string = ""; - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~~ !!! error TS2304: Cannot find name 'Symbol'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty7.errors.txt b/tests/baselines/reference/parserES5SymbolProperty7.errors.txt index fa43310f0a7..9fab662b513 100644 --- a/tests/baselines/reference/parserES5SymbolProperty7.errors.txt +++ b/tests/baselines/reference/parserES5SymbolProperty7.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts(2,6): error TS2304: Cannot find name 'Symbol'. -==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts (1 errors) ==== class C { [Symbol.toStringTag](): void { } - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~~ !!! error TS2304: Cannot find name 'Symbol'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty8.errors.txt b/tests/baselines/reference/parserES5SymbolProperty8.errors.txt index ce7ce5b8319..289b321b2af 100644 --- a/tests/baselines/reference/parserES5SymbolProperty8.errors.txt +++ b/tests/baselines/reference/parserES5SymbolProperty8.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts(2,6): error TS2304: Cannot find name 'Symbol'. -==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts (1 errors) ==== var x: { [Symbol.toPrimitive](): string - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~~ !!! error TS2304: Cannot find name 'Symbol'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty9.errors.txt b/tests/baselines/reference/parserES5SymbolProperty9.errors.txt index 90c3785c938..1b74bb23d11 100644 --- a/tests/baselines/reference/parserES5SymbolProperty9.errors.txt +++ b/tests/baselines/reference/parserES5SymbolProperty9.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts(2,6): error TS2304: Cannot find name 'Symbol'. -==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts (1 errors) ==== var x: { [Symbol.toPrimitive]: string - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~~ !!! error TS2304: Cannot find name 'Symbol'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js index 1ed36d8dac5..c33dbc2a626 100644 --- a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js +++ b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js @@ -3,4 +3,5 @@ var v = [1, 2, 3 4, 5, 6, 7]; //// [parserErrorRecoveryArrayLiteralExpression1.js] -var v = [1, 2, 3, 4, 5, 6, 7]; +var v = [1, 2, 3, + 4, 5, 6, 7]; diff --git a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js index c5386a2b6a2..0bfe59964db 100644 --- a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js +++ b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js @@ -5,4 +5,5 @@ var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0 //// [parserErrorRecoveryArrayLiteralExpression2.js] -var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0, .7042760848999023, 1.1955541372299194, 0.19600726664066315, -0.7120069861412048]; +var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0, + .7042760848999023, 1.1955541372299194, 0.19600726664066315, -0.7120069861412048]; diff --git a/tests/baselines/reference/parserErrorRecovery_Block1.js b/tests/baselines/reference/parserErrorRecovery_Block1.js index cdcd5856fa6..e2bc5f89a39 100644 --- a/tests/baselines/reference/parserErrorRecovery_Block1.js +++ b/tests/baselines/reference/parserErrorRecovery_Block1.js @@ -6,6 +6,7 @@ function f() { //// [parserErrorRecovery_Block1.js] function f() { - 1 + ; + 1 + + ; return; } diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js index c26b16b5a0a..ae2509c3f49 100644 --- a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js @@ -41,9 +41,7 @@ var Shapes; this.con = "hello"; } // Instance member - Point.prototype.getDist = function () { - return Math.sqrt(this.x * this.x + this.y * this.y); - }; + Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; // Static member Point.origin = new Point(0, 0); return Point; diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js index 866f96a8030..4936b1ea8bc 100644 --- a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js @@ -41,9 +41,7 @@ var Shapes; this.con = "hello"; } // Instance member - Point.prototype.getDist = function () { - return Math.sqrt(this.x * this.x + this.y * this.y); - }; + Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; // Static member Point.origin = new Point(0, 0); return Point; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js index 08dc96d38ef..6a703759fff 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js @@ -3,4 +3,5 @@ var v = { a return; //// [parserErrorRecovery_ObjectLiteral2.js] -var v = { a: , return: }; +var v = { a: , + return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js index 1ea23d59112..eecf45fea4f 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js @@ -3,4 +3,5 @@ var v = { a: return; //// [parserErrorRecovery_ObjectLiteral3.js] -var v = { a: , return: }; +var v = { a: , + return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js index 4fe49788740..87a1a31437e 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js @@ -3,4 +3,5 @@ var v = { a: 1 return; //// [parserErrorRecovery_ObjectLiteral4.js] -var v = { a: 1, return: }; +var v = { a: 1, + return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js index cf55b59c711..97e618946a0 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js @@ -3,4 +3,5 @@ var v = { a: 1, return; //// [parserErrorRecovery_ObjectLiteral5.js] -var v = { a: 1, return: }; +var v = { a: 1, + return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js b/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js index 63591985d1e..4d8008639c9 100644 --- a/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js +++ b/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js @@ -10,8 +10,10 @@ switch (e) { //// [parserErrorRecovery_SwitchStatement1.js] switch (e) { case 1: - 1 + ; + 1 + + ; case 2: - 1 + ; + 1 + + ; default: } diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js index 4ff1f26d890..766c95632ab 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js @@ -5,4 +5,5 @@ 2; //// [parserGreaterThanTokenAmbiguity10.js] -1 >>> 2; +1 >>> +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js index 5cc8bb3b88e..b2eba6d5873 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js @@ -3,5 +3,6 @@ = 2; //// [parserGreaterThanTokenAmbiguity14.js] -1 >> ; +1 >> +; 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js index df9e55b7e3c..8675365d9ea 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js @@ -5,4 +5,5 @@ 2; //// [parserGreaterThanTokenAmbiguity15.js] -1 >>= 2; +1 >>= +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js index 52035691c84..d0671d8649f 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js @@ -3,5 +3,6 @@ = 2; //// [parserGreaterThanTokenAmbiguity19.js] -1 >>> ; +1 >>> +; 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js index e6043febcd1..e190e94e9f9 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js @@ -5,4 +5,5 @@ 2; //// [parserGreaterThanTokenAmbiguity20.js] -1 >>>= 2; +1 >>>= +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js index 5ef065681dc..c0b8fc45cc1 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js @@ -3,4 +3,5 @@ > 2; //// [parserGreaterThanTokenAmbiguity4.js] -1 > > 2; +1 > + > 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js index a707e808b4a..59d13d5c9d3 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js @@ -5,4 +5,5 @@ 2; //// [parserGreaterThanTokenAmbiguity5.js] -1 >> 2; +1 >> +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js index 25c5ed53a7c..757ddf38a7f 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js @@ -3,4 +3,5 @@ > 2; //// [parserGreaterThanTokenAmbiguity9.js] -1 >> > 2; +1 >> + > 2; diff --git a/tests/baselines/reference/parserRealSource1.js b/tests/baselines/reference/parserRealSource1.js index c62897c9aff..d19c2242f0b 100644 --- a/tests/baselines/reference/parserRealSource1.js +++ b/tests/baselines/reference/parserRealSource1.js @@ -189,21 +189,11 @@ var TypeScript; var NullLogger = (function () { function NullLogger() { } - NullLogger.prototype.information = function () { - return false; - }; - NullLogger.prototype.debug = function () { - return false; - }; - NullLogger.prototype.warning = function () { - return false; - }; - NullLogger.prototype.error = function () { - return false; - }; - NullLogger.prototype.fatal = function () { - return false; - }; + NullLogger.prototype.information = function () { return false; }; + NullLogger.prototype.debug = function () { return false; }; + NullLogger.prototype.warning = function () { return false; }; + NullLogger.prototype.error = function () { return false; }; + NullLogger.prototype.fatal = function () { return false; }; NullLogger.prototype.log = function (s) { }; return NullLogger; @@ -218,21 +208,11 @@ var TypeScript; this._error = this.logger.error(); this._fatal = this.logger.fatal(); } - LoggerAdapter.prototype.information = function () { - return this._information; - }; - LoggerAdapter.prototype.debug = function () { - return this._debug; - }; - LoggerAdapter.prototype.warning = function () { - return this._warning; - }; - LoggerAdapter.prototype.error = function () { - return this._error; - }; - LoggerAdapter.prototype.fatal = function () { - return this._fatal; - }; + LoggerAdapter.prototype.information = function () { return this._information; }; + LoggerAdapter.prototype.debug = function () { return this._debug; }; + LoggerAdapter.prototype.warning = function () { return this._warning; }; + LoggerAdapter.prototype.error = function () { return this._error; }; + LoggerAdapter.prototype.fatal = function () { return this._fatal; }; LoggerAdapter.prototype.log = function (s) { this.logger.log(s); }; @@ -243,21 +223,11 @@ var TypeScript; function BufferedLogger() { this.logContents = []; } - BufferedLogger.prototype.information = function () { - return false; - }; - BufferedLogger.prototype.debug = function () { - return false; - }; - BufferedLogger.prototype.warning = function () { - return false; - }; - BufferedLogger.prototype.error = function () { - return false; - }; - BufferedLogger.prototype.fatal = function () { - return false; - }; + BufferedLogger.prototype.information = function () { return false; }; + BufferedLogger.prototype.debug = function () { return false; }; + BufferedLogger.prototype.warning = function () { return false; }; + BufferedLogger.prototype.error = function () { return false; }; + BufferedLogger.prototype.fatal = function () { return false; }; BufferedLogger.prototype.log = function (s) { this.logContents.push(s); }; diff --git a/tests/baselines/reference/parserRealSource10.js b/tests/baselines/reference/parserRealSource10.js index 0dd944a7721..768e35c1a3b 100644 --- a/tests/baselines/reference/parserRealSource10.js +++ b/tests/baselines/reference/parserRealSource10.js @@ -813,7 +813,8 @@ var TypeScript; else { var tokenInfo = lookupToken(this.tokenId); if (tokenInfo != undefined) { - if ((tokenInfo.unopNodeType != NodeType.None) || (tokenInfo.binopNodeType != NodeType.None)) { + if ((tokenInfo.unopNodeType != NodeType.None) || + (tokenInfo.binopNodeType != NodeType.None)) { return 2 /* Operator */; } } diff --git a/tests/baselines/reference/parserRealSource11.js b/tests/baselines/reference/parserRealSource11.js index 0574c52eaaa..72fec692184 100644 --- a/tests/baselines/reference/parserRealSource11.js +++ b/tests/baselines/reference/parserRealSource11.js @@ -2397,18 +2397,10 @@ var TypeScript; this.postComments = null; this.isParenthesized = false; } - AST.prototype.isExpression = function () { - return false; - }; - AST.prototype.isStatementOrExpression = function () { - return false; - }; - AST.prototype.isCompoundStatement = function () { - return false; - }; - AST.prototype.isLeaf = function () { - return this.isStatementOrExpression() && (!this.isCompoundStatement()); - }; + AST.prototype.isExpression = function () { return false; }; + AST.prototype.isStatementOrExpression = function () { return false; }; + AST.prototype.isCompoundStatement = function () { return false; }; + AST.prototype.isLeaf = function () { return this.isStatementOrExpression() && (!this.isCompoundStatement()); }; AST.prototype.typeCheck = function (typeFlow) { switch (this.nodeType) { case NodeType.Error: @@ -2496,7 +2488,8 @@ var TypeScript; if (context.parser !== null) { context.parser.getSourceLineCol(lineCol, this.minChar); context.parser.getSourceLineCol(limLineCol, this.limChar); - context.write("(" + lineCol.line + "," + lineCol.col + ")--" + "(" + limLineCol.line + "," + limLineCol.col + "): "); + context.write("(" + lineCol.line + "," + lineCol.col + ")--" + + "(" + limLineCol.line + "," + limLineCol.col + "): "); } var lab = this.printLabel(); if (hasFlag(this.flags, ASTFlags.Error)) { @@ -2643,12 +2636,8 @@ var TypeScript; this.text = actualText; } }; - Identifier.prototype.isMissing = function () { - return false; - }; - Identifier.prototype.isLeaf = function () { - return true; - }; + Identifier.prototype.isMissing = function () { return false; }; + Identifier.prototype.isLeaf = function () { return true; }; Identifier.prototype.treeViewLabel = function () { return "id: " + this.actualText; }; @@ -2692,9 +2681,7 @@ var TypeScript; _super.call(this, NodeType.Label); this.id = id; } - Label.prototype.printLabel = function () { - return this.id.actualText + ":"; - }; + Label.prototype.printLabel = function () { return this.id.actualText + ":"; }; Label.prototype.typeCheck = function (typeFlow) { this.type = typeFlow.voidType; return this; @@ -2717,12 +2704,8 @@ var TypeScript; function Expression(nodeType) { _super.call(this, nodeType); } - Expression.prototype.isExpression = function () { - return true; - }; - Expression.prototype.isStatementOrExpression = function () { - return true; - }; + Expression.prototype.isExpression = function () { return true; }; + Expression.prototype.isStatementOrExpression = function () { return true; }; return Expression; })(AST); TypeScript.Expression = Expression; @@ -3183,9 +3166,7 @@ var TypeScript; this.varFlags = VarFlags.None; this.isDynamicImport = false; } - ImportDeclaration.prototype.isStatementOrExpression = function () { - return true; - }; + ImportDeclaration.prototype.isStatementOrExpression = function () { return true; }; ImportDeclaration.prototype.emit = function (emitter, tokenId, startLine) { var mod = this.alias.type; // REVIEW: Only modules may be aliased for now, though there's no real @@ -3246,18 +3227,10 @@ var TypeScript; this.varFlags = VarFlags.None; this.sym = null; } - BoundDecl.prototype.isStatementOrExpression = function () { - return true; - }; - BoundDecl.prototype.isPrivate = function () { - return hasFlag(this.varFlags, VarFlags.Private); - }; - BoundDecl.prototype.isPublic = function () { - return hasFlag(this.varFlags, VarFlags.Public); - }; - BoundDecl.prototype.isProperty = function () { - return hasFlag(this.varFlags, VarFlags.Property); - }; + BoundDecl.prototype.isStatementOrExpression = function () { return true; }; + BoundDecl.prototype.isPrivate = function () { return hasFlag(this.varFlags, VarFlags.Private); }; + BoundDecl.prototype.isPublic = function () { return hasFlag(this.varFlags, VarFlags.Public); }; + BoundDecl.prototype.isProperty = function () { return hasFlag(this.varFlags, VarFlags.Property); }; BoundDecl.prototype.typeCheck = function (typeFlow) { return typeFlow.typeCheckBoundDecl(this); }; @@ -3272,15 +3245,9 @@ var TypeScript; function VarDecl(id, nest) { _super.call(this, id, NodeType.VarDecl, nest); } - VarDecl.prototype.isAmbient = function () { - return hasFlag(this.varFlags, VarFlags.Ambient); - }; - VarDecl.prototype.isExported = function () { - return hasFlag(this.varFlags, VarFlags.Exported); - }; - VarDecl.prototype.isStatic = function () { - return hasFlag(this.varFlags, VarFlags.Static); - }; + VarDecl.prototype.isAmbient = function () { return hasFlag(this.varFlags, VarFlags.Ambient); }; + VarDecl.prototype.isExported = function () { return hasFlag(this.varFlags, VarFlags.Exported); }; + VarDecl.prototype.isStatic = function () { return hasFlag(this.varFlags, VarFlags.Static); }; VarDecl.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitJavascriptVarDecl(this, tokenId); }; @@ -3297,9 +3264,7 @@ var TypeScript; this.isOptional = false; this.parameterPropertySym = null; } - ArgDecl.prototype.isOptionalArg = function () { - return this.isOptional || this.init; - }; + ArgDecl.prototype.isOptionalArg = function () { return this.isOptional || this.init; }; ArgDecl.prototype.treeViewLabel = function () { return "arg: " + this.id.actualText; }; @@ -3360,12 +3325,8 @@ var TypeScript; } return this.internalNameCache; }; - FuncDecl.prototype.hasSelfReference = function () { - return hasFlag(this.fncFlags, FncFlags.HasSelfReference); - }; - FuncDecl.prototype.setHasSelfReference = function () { - this.fncFlags |= FncFlags.HasSelfReference; - }; + FuncDecl.prototype.hasSelfReference = function () { return hasFlag(this.fncFlags, FncFlags.HasSelfReference); }; + FuncDecl.prototype.setHasSelfReference = function () { this.fncFlags |= FncFlags.HasSelfReference; }; FuncDecl.prototype.addCloRef = function (id, sym) { if (this.envids == null) { this.envids = new Identifier[]; @@ -3419,45 +3380,19 @@ var TypeScript; FuncDecl.prototype.isMethod = function () { return (this.fncFlags & FncFlags.Method) != FncFlags.None; }; - FuncDecl.prototype.isCallMember = function () { - return hasFlag(this.fncFlags, FncFlags.CallMember); - }; - FuncDecl.prototype.isConstructMember = function () { - return hasFlag(this.fncFlags, FncFlags.ConstructMember); - }; - FuncDecl.prototype.isIndexerMember = function () { - return hasFlag(this.fncFlags, FncFlags.IndexerMember); - }; - FuncDecl.prototype.isSpecialFn = function () { - return this.isCallMember() || this.isIndexerMember() || this.isConstructMember(); - }; - FuncDecl.prototype.isAnonymousFn = function () { - return this.name === null; - }; - FuncDecl.prototype.isAccessor = function () { - return hasFlag(this.fncFlags, FncFlags.GetAccessor) || hasFlag(this.fncFlags, FncFlags.SetAccessor); - }; - FuncDecl.prototype.isGetAccessor = function () { - return hasFlag(this.fncFlags, FncFlags.GetAccessor); - }; - FuncDecl.prototype.isSetAccessor = function () { - return hasFlag(this.fncFlags, FncFlags.SetAccessor); - }; - FuncDecl.prototype.isAmbient = function () { - return hasFlag(this.fncFlags, FncFlags.Ambient); - }; - FuncDecl.prototype.isExported = function () { - return hasFlag(this.fncFlags, FncFlags.Exported); - }; - FuncDecl.prototype.isPrivate = function () { - return hasFlag(this.fncFlags, FncFlags.Private); - }; - FuncDecl.prototype.isPublic = function () { - return hasFlag(this.fncFlags, FncFlags.Public); - }; - FuncDecl.prototype.isStatic = function () { - return hasFlag(this.fncFlags, FncFlags.Static); - }; + FuncDecl.prototype.isCallMember = function () { return hasFlag(this.fncFlags, FncFlags.CallMember); }; + FuncDecl.prototype.isConstructMember = function () { return hasFlag(this.fncFlags, FncFlags.ConstructMember); }; + FuncDecl.prototype.isIndexerMember = function () { return hasFlag(this.fncFlags, FncFlags.IndexerMember); }; + FuncDecl.prototype.isSpecialFn = function () { return this.isCallMember() || this.isIndexerMember() || this.isConstructMember(); }; + FuncDecl.prototype.isAnonymousFn = function () { return this.name === null; }; + FuncDecl.prototype.isAccessor = function () { return hasFlag(this.fncFlags, FncFlags.GetAccessor) || hasFlag(this.fncFlags, FncFlags.SetAccessor); }; + FuncDecl.prototype.isGetAccessor = function () { return hasFlag(this.fncFlags, FncFlags.GetAccessor); }; + FuncDecl.prototype.isSetAccessor = function () { return hasFlag(this.fncFlags, FncFlags.SetAccessor); }; + FuncDecl.prototype.isAmbient = function () { return hasFlag(this.fncFlags, FncFlags.Ambient); }; + FuncDecl.prototype.isExported = function () { return hasFlag(this.fncFlags, FncFlags.Exported); }; + FuncDecl.prototype.isPrivate = function () { return hasFlag(this.fncFlags, FncFlags.Private); }; + FuncDecl.prototype.isPublic = function () { return hasFlag(this.fncFlags, FncFlags.Public); }; + FuncDecl.prototype.isStatic = function () { return hasFlag(this.fncFlags, FncFlags.Static); }; FuncDecl.prototype.treeViewLabel = function () { if (this.name == null) { return "funcExpr"; @@ -3469,12 +3404,8 @@ var TypeScript; FuncDecl.prototype.ClearFlags = function () { this.fncFlags = FncFlags.None; }; - FuncDecl.prototype.isSignature = function () { - return (this.fncFlags & FncFlags.Signature) != FncFlags.None; - }; - FuncDecl.prototype.hasStaticDeclarations = function () { - return (!this.isConstructor && (this.statics.members.length > 0 || this.innerStaticFuncs.length > 0)); - }; + FuncDecl.prototype.isSignature = function () { return (this.fncFlags & FncFlags.Signature) != FncFlags.None; }; + FuncDecl.prototype.hasStaticDeclarations = function () { return (!this.isConstructor && (this.statics.members.length > 0 || this.innerStaticFuncs.length > 0)); }; return FuncDecl; })(AST); TypeScript.FuncDecl = FuncDecl; @@ -3583,15 +3514,9 @@ var TypeScript; this.scopes = scopes; this.prettyName = this.name.actualText; } - ModuleDeclaration.prototype.isExported = function () { - return hasFlag(this.modFlags, ModuleFlags.Exported); - }; - ModuleDeclaration.prototype.isAmbient = function () { - return hasFlag(this.modFlags, ModuleFlags.Ambient); - }; - ModuleDeclaration.prototype.isEnum = function () { - return hasFlag(this.modFlags, ModuleFlags.IsEnum); - }; + ModuleDeclaration.prototype.isExported = function () { return hasFlag(this.modFlags, ModuleFlags.Exported); }; + ModuleDeclaration.prototype.isAmbient = function () { return hasFlag(this.modFlags, ModuleFlags.Ambient); }; + ModuleDeclaration.prototype.isEnum = function () { return hasFlag(this.modFlags, ModuleFlags.IsEnum); }; ModuleDeclaration.prototype.recordNonInterface = function () { this.modFlags &= ~ModuleFlags.ShouldEmitModuleDecl; }; @@ -3664,15 +3589,9 @@ var TypeScript; _super.call(this, nodeType); this.flags |= ASTFlags.IsStatement; } - Statement.prototype.isLoop = function () { - return false; - }; - Statement.prototype.isStatementOrExpression = function () { - return true; - }; - Statement.prototype.isCompoundStatement = function () { - return this.isLoop(); - }; + Statement.prototype.isLoop = function () { return false; }; + Statement.prototype.isStatementOrExpression = function () { return true; }; + Statement.prototype.isCompoundStatement = function () { return this.isLoop(); }; Statement.prototype.typeCheck = function (typeFlow) { this.type = typeFlow.voidType; return this; @@ -3776,9 +3695,7 @@ var TypeScript; this.target = null; this.resolvedTarget = null; } - Jump.prototype.hasExplicitTarget = function () { - return (this.target); - }; + Jump.prototype.hasExplicitTarget = function () { return (this.target); }; Jump.prototype.setResolvedTarget = function (parser, stmt) { if (stmt.isLoop()) { this.resolvedTarget = stmt; @@ -3829,9 +3746,7 @@ var TypeScript; this.cond = cond; this.body = null; } - WhileStatement.prototype.isLoop = function () { - return true; - }; + WhileStatement.prototype.isLoop = function () { return true; }; WhileStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -3884,9 +3799,7 @@ var TypeScript; this.whileAST = null; this.cond = null; } - DoWhileStatement.prototype.isLoop = function () { - return true; - }; + DoWhileStatement.prototype.isLoop = function () { return true; }; DoWhileStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -3942,9 +3855,7 @@ var TypeScript; this.elseBod = null; this.statement = new ASTSpan(); } - IfStatement.prototype.isCompoundStatement = function () { - return true; - }; + IfStatement.prototype.isCompoundStatement = function () { return true; }; IfStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -4064,9 +3975,7 @@ var TypeScript; this.lval.varFlags |= VarFlags.AutoInit; } } - ForInStatement.prototype.isLoop = function () { - return true; - }; + ForInStatement.prototype.isLoop = function () { return true; }; ForInStatement.prototype.isFiltered = function () { if (this.body) { var singleItem = null; @@ -4093,13 +4002,16 @@ var TypeScript; var target = cond.target; if (target.nodeType == NodeType.Dot) { var binex = target; - if ((binex.operand1.nodeType == NodeType.Name) && (this.obj.nodeType == NodeType.Name) && (binex.operand1.actualText == this.obj.actualText)) { + if ((binex.operand1.nodeType == NodeType.Name) && + (this.obj.nodeType == NodeType.Name) && + (binex.operand1.actualText == this.obj.actualText)) { var prop = binex.operand2; if (prop.actualText == "hasOwnProperty") { var args = cond.arguments; if ((args !== null) && (args.members.length == 1)) { var arg = args.members[0]; - if ((arg.nodeType == NodeType.Name) && (this.lval.nodeType == NodeType.Name)) { + if ((arg.nodeType == NodeType.Name) && + (this.lval.nodeType == NodeType.Name)) { if ((this.lval.actualText) == arg.actualText) { return true; } @@ -4173,9 +4085,7 @@ var TypeScript; _super.call(this, NodeType.For); this.init = init; } - ForStatement.prototype.isLoop = function () { - return true; - }; + ForStatement.prototype.isLoop = function () { return true; }; ForStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -4267,9 +4177,7 @@ var TypeScript; this.expr = expr; this.withSym = null; } - WithStatement.prototype.isCompoundStatement = function () { - return true; - }; + WithStatement.prototype.isCompoundStatement = function () { return true; }; WithStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -4296,9 +4204,7 @@ var TypeScript; this.defaultCase = null; this.statement = new ASTSpan(); } - SwitchStatement.prototype.isCompoundStatement = function () { - return true; - }; + SwitchStatement.prototype.isCompoundStatement = function () { return true; }; SwitchStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -4452,9 +4358,7 @@ var TypeScript; this.tryNode = tryNode; this.finallyNode = finallyNode; } - TryFinally.prototype.isCompoundStatement = function () { - return true; - }; + TryFinally.prototype.isCompoundStatement = function () { return true; }; TryFinally.prototype.emit = function (emitter, tokenId, startLine) { emitter.recordSourceMappingStart(this); emitter.emitJavascript(this.tryNode, TokenID.Try, false); @@ -4499,9 +4403,7 @@ var TypeScript; this.tryNode = tryNode; this.catchNode = catchNode; } - TryCatch.prototype.isCompoundStatement = function () { - return true; - }; + TryCatch.prototype.isCompoundStatement = function () { return true; }; TryCatch.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); diff --git a/tests/baselines/reference/parserRealSource14.js b/tests/baselines/reference/parserRealSource14.js index 9b9ee2bcf84..540296e6973 100644 --- a/tests/baselines/reference/parserRealSource14.js +++ b/tests/baselines/reference/parserRealSource14.js @@ -607,9 +607,7 @@ var TypeScript; }; AstPath.prototype.clone = function () { var clone = new AstPath(); - clone.asts = this.asts.map(function (value) { - return value; - }); + clone.asts = this.asts.map(function (value) { return value; }); clone.top = this.top; return clone; }; @@ -658,167 +656,288 @@ var TypeScript; AstPath.prototype.isNameOfClass = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.ClassDeclaration) && (this.parent().name === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.ClassDeclaration) && + (this.parent().name === this.ast()); }; AstPath.prototype.isNameOfInterface = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.InterfaceDeclaration) && (this.parent().name === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.InterfaceDeclaration) && + (this.parent().name === this.ast()); }; AstPath.prototype.isNameOfArgument = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.ArgDecl) && (this.parent().id === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.ArgDecl) && + (this.parent().id === this.ast()); }; AstPath.prototype.isNameOfVariable = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.VarDecl) && (this.parent().id === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.VarDecl) && + (this.parent().id === this.ast()); }; AstPath.prototype.isNameOfModule = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.ModuleDeclaration) && (this.parent().name === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.ModuleDeclaration) && + (this.parent().name === this.ast()); }; AstPath.prototype.isNameOfFunction = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.FuncDecl) && (this.parent().name === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.FuncDecl) && + (this.parent().name === this.ast()); }; AstPath.prototype.isChildOfScript = function () { var ast = lastOf(this.asts); - return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.Script; + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.Script; }; AstPath.prototype.isChildOfModule = function () { var ast = lastOf(this.asts); - return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.ModuleDeclaration; + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.ModuleDeclaration; }; AstPath.prototype.isChildOfClass = function () { var ast = lastOf(this.asts); - return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.ClassDeclaration; + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.ClassDeclaration; }; AstPath.prototype.isArgumentOfClassConstructor = function () { var ast = lastOf(this.asts); - return this.count() >= 5 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 3].nodeType === TypeScript.NodeType.List && this.asts[this.top - 4].nodeType === TypeScript.NodeType.ClassDeclaration && (this.asts[this.top - 2].isConstructor) && (this.asts[this.top - 2].arguments === this.asts[this.top - 1]) && (this.asts[this.top - 4].constructorDecl === this.asts[this.top - 2]); + return this.count() >= 5 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && + this.asts[this.top - 3].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 4].nodeType === TypeScript.NodeType.ClassDeclaration && + (this.asts[this.top - 2].isConstructor) && + (this.asts[this.top - 2].arguments === this.asts[this.top - 1]) && + (this.asts[this.top - 4].constructorDecl === this.asts[this.top - 2]); }; AstPath.prototype.isChildOfInterface = function () { var ast = lastOf(this.asts); - return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.InterfaceDeclaration; + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.InterfaceDeclaration; }; AstPath.prototype.isTopLevelImplicitModule = function () { - return this.count() >= 1 && this.asts[this.top].nodeType === TypeScript.NodeType.ModuleDeclaration && TypeScript.hasFlag(this.asts[this.top].modFlags, TypeScript.ModuleFlags.IsWholeFile); + return this.count() >= 1 && + this.asts[this.top].nodeType === TypeScript.NodeType.ModuleDeclaration && + TypeScript.hasFlag(this.asts[this.top].modFlags, TypeScript.ModuleFlags.IsWholeFile); }; AstPath.prototype.isBodyOfTopLevelImplicitModule = function () { - return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0] && TypeScript.hasFlag(this.asts[this.top - 1].modFlags, TypeScript.ModuleFlags.IsWholeFile); + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && + this.asts[this.top - 1].members == this.asts[this.top - 0] && + TypeScript.hasFlag(this.asts[this.top - 1].modFlags, TypeScript.ModuleFlags.IsWholeFile); }; AstPath.prototype.isBodyOfScript = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Script && this.asts[this.top - 1].bod == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Script && + this.asts[this.top - 1].bod == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfSwitch = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Switch && this.asts[this.top - 1].caseList == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Switch && + this.asts[this.top - 1].caseList == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfModule = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && + this.asts[this.top - 1].members == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfClass = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ClassDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ClassDeclaration && + this.asts[this.top - 1].members == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfFunction = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 1].bod == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && + this.asts[this.top - 1].bod == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfInterface = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.InterfaceDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.InterfaceDeclaration && + this.asts[this.top - 1].members == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfBlock = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Block && this.asts[this.top - 1].statements == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Block && + this.asts[this.top - 1].statements == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfFor = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.For && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.For && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfCase = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Case && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Case && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfTry = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Try && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Try && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfCatch = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Catch && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Catch && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfDoWhile = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.DoWhile && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.DoWhile && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfWhile = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.While && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.While && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfForIn = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ForIn && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ForIn && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfWith = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.With && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.With && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfFinally = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Finally && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Finally && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isCaseOfSwitch = function () { - return this.count() >= 3 && this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].caseList == this.asts[this.top - 1]; + return this.count() >= 3 && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].caseList == this.asts[this.top - 1]; }; AstPath.prototype.isDefaultCaseOfSwitch = function () { - return this.count() >= 3 && this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].caseList == this.asts[this.top - 1] && this.asts[this.top - 2].defaultCase == this.asts[this.top - 0]; + return this.count() >= 3 && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].caseList == this.asts[this.top - 1] && + this.asts[this.top - 2].defaultCase == this.asts[this.top - 0]; }; AstPath.prototype.isListOfObjectLit = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].operand == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].operand == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfObjectLit = function () { return this.isListOfObjectLit(); }; AstPath.prototype.isEmptyListOfObjectLit = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].operand == this.asts[this.top - 0] && this.asts[this.top - 0].members.length == 0; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].operand == this.asts[this.top - 0] && + this.asts[this.top - 0].members.length == 0; }; AstPath.prototype.isMemberOfObjectLit = function () { - return this.count() >= 3 && this.asts[this.top - 2].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 0].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 2].operand == this.asts[this.top - 1]; + return this.count() >= 3 && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.Member && + this.asts[this.top - 2].operand == this.asts[this.top - 1]; }; AstPath.prototype.isNameOfMemberOfObjectLit = function () { - return this.count() >= 4 && this.asts[this.top - 3].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 2].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 0].nodeType === TypeScript.NodeType.Name && this.asts[this.top - 3].operand == this.asts[this.top - 2]; + return this.count() >= 4 && + this.asts[this.top - 3].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.Name && + this.asts[this.top - 3].operand == this.asts[this.top - 2]; }; AstPath.prototype.isListOfArrayLit = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ArrayLit && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].operand == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ArrayLit && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].operand == this.asts[this.top - 0]; }; AstPath.prototype.isTargetOfMember = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 1].operand1 === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && + this.asts[this.top - 1].operand1 === this.asts[this.top - 0]; }; AstPath.prototype.isMemberOfMember = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 1].operand2 === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && + this.asts[this.top - 1].operand2 === this.asts[this.top - 0]; }; AstPath.prototype.isItemOfList = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List; //(this.asts[this.top - 1]).operand2 === this.asts[this.top - 0]; }; AstPath.prototype.isThenOfIf = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && this.asts[this.top - 1].thenBod == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && + this.asts[this.top - 1].thenBod == this.asts[this.top - 0]; }; AstPath.prototype.isElseOfIf = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && this.asts[this.top - 1].elseBod == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && + this.asts[this.top - 1].elseBod == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfDefaultCase = function () { return this.isBodyOfCase(); }; AstPath.prototype.isSingleStatementList = function () { - return this.count() >= 1 && this.asts[this.top].nodeType === TypeScript.NodeType.List && this.asts[this.top].members.length === 1; + return this.count() >= 1 && + this.asts[this.top].nodeType === TypeScript.NodeType.List && + this.asts[this.top].members.length === 1; }; AstPath.prototype.isArgumentListOfFunction = function () { - return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 1].arguments === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && + this.asts[this.top - 1].arguments === this.asts[this.top - 0]; }; AstPath.prototype.isArgumentOfFunction = function () { - return this.count() >= 3 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 2].arguments === this.asts[this.top - 1]; + return this.count() >= 3 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && + this.asts[this.top - 2].arguments === this.asts[this.top - 1]; }; AstPath.prototype.isArgumentListOfCall = function () { - return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Call && this.asts[this.top - 1].arguments === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Call && + this.asts[this.top - 1].arguments === this.asts[this.top - 0]; }; AstPath.prototype.isArgumentListOfNew = function () { - return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.New && this.asts[this.top - 1].arguments === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.New && + this.asts[this.top - 1].arguments === this.asts[this.top - 0]; }; AstPath.prototype.isSynthesizedBlock = function () { - return this.count() >= 1 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.Block && this.asts[this.top - 0].isStatementBlock === false; + return this.count() >= 1 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.Block && + this.asts[this.top - 0].isStatementBlock === false; }; return AstPath; })(); @@ -879,7 +998,9 @@ var TypeScript; // bar // 0123 // If "position == 3", the caret is at the "right" of the "r" character, which should be considered valid - var inclusive = hasFlag(options, 1 /* EdgeInclusive */) || cur.nodeType === TypeScript.NodeType.Name || pos === script.limChar; // Special "EOF" case + var inclusive = hasFlag(options, 1 /* EdgeInclusive */) || + cur.nodeType === TypeScript.NodeType.Name || + pos === script.limChar; // Special "EOF" case var minChar = cur.minChar; var limChar = cur.limChar + (inclusive ? 1 : 0); if (pos >= minChar && pos < limChar) { diff --git a/tests/baselines/reference/parserRealSource4.js b/tests/baselines/reference/parserRealSource4.js index 1d6ed0aaf13..563e9e92a08 100644 --- a/tests/baselines/reference/parserRealSource4.js +++ b/tests/baselines/reference/parserRealSource4.js @@ -377,9 +377,7 @@ var TypeScript; } return false; }; - StringHashTable.prototype.count = function () { - return this.itemCount; - }; + StringHashTable.prototype.count = function () { return this.itemCount; }; StringHashTable.prototype.lookup = function (key) { var data = this.table[key]; if (data != undefined) { @@ -515,9 +513,7 @@ var TypeScript; } return result; }; - HashTable.prototype.count = function () { - return this.itemCount; - }; + HashTable.prototype.count = function () { return this.itemCount; }; HashTable.prototype.lookup = function (key) { var current; var val = this.hashFn(key); diff --git a/tests/baselines/reference/parserRealSource6.js b/tests/baselines/reference/parserRealSource6.js index e747b95e610..d65207b8c77 100644 --- a/tests/baselines/reference/parserRealSource6.js +++ b/tests/baselines/reference/parserRealSource6.js @@ -329,7 +329,8 @@ var TypeScript; // is has not been fully re-parsed yet. if (ast.nodeType == NodeType.Script && context.pos > limChar) limChar = context.pos; - if ((minChar <= context.pos) && (limChar >= context.pos)) { + if ((minChar <= context.pos) && + (limChar >= context.pos)) { switch (ast.nodeType) { case NodeType.Script: var script = ast; diff --git a/tests/baselines/reference/parserRealSource7.js b/tests/baselines/reference/parserRealSource7.js index c8dd3ae1b15..5073c33febd 100644 --- a/tests/baselines/reference/parserRealSource7.js +++ b/tests/baselines/reference/parserRealSource7.js @@ -1053,7 +1053,8 @@ var TypeScript; if (isExported) { typeSymbol.flags |= SymbolFlags.Exported; } - if ((context.scopeChain.moduleDecl) || (context.scopeChain.container == context.checker.gloMod)) { + if ((context.scopeChain.moduleDecl) || + (context.scopeChain.container == context.checker.gloMod)) { typeSymbol.flags |= SymbolFlags.ModuleMember; } moduleDecl.mod = modType; @@ -1079,7 +1080,11 @@ var TypeScript; // REVIEW-CLASSES if (!typeSymbol) { var valTypeSymbol = scopeChain.scope.findLocal(className, false, false); - if (valTypeSymbol && valTypeSymbol.isType() && valTypeSymbol.declAST && valTypeSymbol.declAST.nodeType == NodeType.FuncDecl && valTypeSymbol.declAST.isSignature()) { + if (valTypeSymbol && + valTypeSymbol.isType() && + valTypeSymbol.declAST && + valTypeSymbol.declAST.nodeType == NodeType.FuncDecl && + valTypeSymbol.declAST.isSignature()) { typeSymbol = valTypeSymbol; foundValSymbol = true; if (isExported) { @@ -1233,7 +1238,10 @@ var TypeScript; if (context.scopeChain.moduleDecl) { context.scopeChain.moduleDecl.recordNonInterface(); } - if (isProperty || isExported || (context.scopeChain.container == context.checker.gloMod) || context.scopeChain.moduleDecl) { + if (isProperty || + isExported || + (context.scopeChain.container == context.checker.gloMod) || + context.scopeChain.moduleDecl) { if (isAmbient) { var existingSym = scopeChain.scope.findLocal(varDecl.id.text, false, false); if (existingSym) { @@ -1254,7 +1262,8 @@ var TypeScript; } field.symbol = fieldSymbol; fieldSymbol.declAST = ast; - if ((context.scopeChain.moduleDecl) || (context.scopeChain.container == context.checker.gloMod)) { + if ((context.scopeChain.moduleDecl) || + (context.scopeChain.container == context.checker.gloMod)) { fieldSymbol.flags |= SymbolFlags.ModuleMember; fieldSymbol.declModule = context.scopeChain.moduleDecl; } @@ -1305,7 +1314,12 @@ var TypeScript; // If the parent is the constructor, and this isn't an instance method, skip it. // That way, we'll set the type during scope assignment, and can be sure that the // function will be placed in the constructor-local scope - if (!funcDecl.isConstructor && containerSym && containerSym.declAST && containerSym.declAST.nodeType == NodeType.FuncDecl && containerSym.declAST.isConstructor && !funcDecl.isMethod()) { + if (!funcDecl.isConstructor && + containerSym && + containerSym.declAST && + containerSym.declAST.nodeType == NodeType.FuncDecl && + containerSym.declAST.isConstructor && + !funcDecl.isMethod()) { return go; } // Interfaces and overloads @@ -1394,7 +1408,14 @@ var TypeScript; } } // REVIEW: Move this check into the typecheck phase? It's only being run over properties... - if (fgSym && !fgSym.isAccessor() && fgSym.type && fgSym.type.construct && fgSym.type.construct.signatures != [] && (fgSym.type.construct.signatures[0].declAST == null || !hasFlag(fgSym.type.construct.signatures[0].declAST.fncFlags, FncFlags.Ambient)) && !funcDecl.isConstructor) { + if (fgSym && + !fgSym.isAccessor() && + fgSym.type && + fgSym.type.construct && + fgSym.type.construct.signatures != [] && + (fgSym.type.construct.signatures[0].declAST == null || + !hasFlag(fgSym.type.construct.signatures[0].declAST.fncFlags, FncFlags.Ambient)) && + !funcDecl.isConstructor) { context.checker.errorReporter.simpleError(funcDecl, "Functions may not have class overloads"); } if (fgSym && !(fgSym.kind() == SymbolKind.Type) && funcDecl.isMethod() && !funcDecl.isAccessor() && !funcDecl.isConstructor) { diff --git a/tests/baselines/reference/parserRealSource8.js b/tests/baselines/reference/parserRealSource8.js index fcdb170ae12..8a667ad6dbe 100644 --- a/tests/baselines/reference/parserRealSource8.js +++ b/tests/baselines/reference/parserRealSource8.js @@ -632,7 +632,8 @@ var TypeScript; // the enclosing scope // REVIEW: Some twisted logic here - this needs to be cleaned up once old classes are removed // - if it's a new class, always use the contained scope, since we initialize the constructor scope below - if (context.scopeChain.thisType && (!funcDecl.isConstructor || hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod))) { + if (context.scopeChain.thisType && + (!funcDecl.isConstructor || hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod))) { var instType = context.scopeChain.thisType; if (!(instType.typeFlags & TypeFlags.IsClass) && !hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod)) { if (!funcDecl.isMethod() || isStatic) { @@ -644,7 +645,10 @@ var TypeScript; } } else { - if (context.scopeChain.previous.scope.container && context.scopeChain.previous.scope.container.declAST && context.scopeChain.previous.scope.container.declAST.nodeType == NodeType.FuncDecl && context.scopeChain.previous.scope.container.declAST.isConstructor) { + if (context.scopeChain.previous.scope.container && + context.scopeChain.previous.scope.container.declAST && + context.scopeChain.previous.scope.container.declAST.nodeType == NodeType.FuncDecl && + context.scopeChain.previous.scope.container.declAST.isConstructor) { // if the parent is the class constructor, use the constructor scope parentScope = instType.constructorScope; } @@ -681,7 +685,12 @@ var TypeScript; outerFnc.innerStaticFuncs[outerFnc.innerStaticFuncs.length] = funcDecl; } else { - if (!funcDecl.isConstructor && container && container.declAST && container.declAST.nodeType == NodeType.FuncDecl && container.declAST.isConstructor && !funcDecl.isMethod()) { + if (!funcDecl.isConstructor && + container && + container.declAST && + container.declAST.nodeType == NodeType.FuncDecl && + container.declAST.isConstructor && + !funcDecl.isMethod()) { funcScope = context.scopeChain.thisType.constructorScope; //locals; } else { @@ -702,7 +711,11 @@ var TypeScript; } context.typeFlow.checker.createFunctionSignature(funcDecl, container, funcScope, fgSym, fgSym == null); // it's a getter or setter for a class property - if (!funcDecl.accessorSymbol && (funcDecl.fncFlags & FncFlags.ClassMethod) && container && ((!fgSym || fgSym.declAST.nodeType != NodeType.FuncDecl) && funcDecl.isAccessor()) || (fgSym && fgSym.isAccessor())) { + if (!funcDecl.accessorSymbol && + (funcDecl.fncFlags & FncFlags.ClassMethod) && + container && + ((!fgSym || fgSym.declAST.nodeType != NodeType.FuncDecl) && funcDecl.isAccessor()) || + (fgSym && fgSym.isAccessor())) { funcDecl.accessorSymbol = context.typeFlow.checker.createAccessorSymbol(funcDecl, fgSym, container.getType(), (funcDecl.isMethod() && isStatic), true, funcScope, container); } funcDecl.type.symbol.flags |= SymbolFlags.TypeSetDuringScopeAssignment; diff --git a/tests/baselines/reference/parserReturnStatement4.js b/tests/baselines/reference/parserReturnStatement4.js index 3a993697cc6..f6800cbb8fd 100644 --- a/tests/baselines/reference/parserReturnStatement4.js +++ b/tests/baselines/reference/parserReturnStatement4.js @@ -2,6 +2,4 @@ var v = { get foo() { return } }; //// [parserReturnStatement4.js] -var v = { get foo() { - return; -} }; +var v = { get foo() { return; } }; diff --git a/tests/baselines/reference/parserSymbolIndexer5.js b/tests/baselines/reference/parserSymbolIndexer5.js index 43c456b64aa..3aa046e2114 100644 --- a/tests/baselines/reference/parserSymbolIndexer5.js +++ b/tests/baselines/reference/parserSymbolIndexer5.js @@ -5,6 +5,5 @@ var x = { //// [parserSymbolIndexer5.js] var x = { - [s]: symbol, - "": + [s]: symbol, "": }; diff --git a/tests/baselines/reference/parserharness.js b/tests/baselines/reference/parserharness.js index 7299abf6818..02304380013 100644 --- a/tests/baselines/reference/parserharness.js +++ b/tests/baselines/reference/parserharness.js @@ -2627,9 +2627,7 @@ var Harness; var description = b.description + (prop ? ": " + prop : ''); emitLog('testStart', { desc: description }); emitLog('pass', { - desc: description, - pass: true, - perfResults: { + desc: description, pass: true, perfResults: { mean: b.results[prop].mean(), min: b.results[prop].min(), max: b.results[prop].max(), @@ -2694,18 +2692,10 @@ var Harness; this.fileCollection[s] = writer; return writer; }; - EmitterIOHost.prototype.directoryExists = function (s) { - return false; - }; - EmitterIOHost.prototype.fileExists = function (s) { - return typeof this.fileCollection[s] !== 'undefined'; - }; - EmitterIOHost.prototype.resolvePath = function (s) { - return s; - }; - EmitterIOHost.prototype.reset = function () { - this.fileCollection = {}; - }; + EmitterIOHost.prototype.directoryExists = function (s) { return false; }; + EmitterIOHost.prototype.fileExists = function (s) { return typeof this.fileCollection[s] !== 'undefined'; }; + EmitterIOHost.prototype.resolvePath = function (s) { return s; }; + EmitterIOHost.prototype.reset = function () { this.fileCollection = {}; }; EmitterIOHost.prototype.toArray = function () { var result = []; for (var p in this.fileCollection) { @@ -3511,21 +3501,11 @@ var Harness; ////////////////////////////////////////////////////////////////////// // ILogger implementation // - TypeScriptLS.prototype.information = function () { - return false; - }; - TypeScriptLS.prototype.debug = function () { - return true; - }; - TypeScriptLS.prototype.warning = function () { - return true; - }; - TypeScriptLS.prototype.error = function () { - return true; - }; - TypeScriptLS.prototype.fatal = function () { - return true; - }; + TypeScriptLS.prototype.information = function () { return false; }; + TypeScriptLS.prototype.debug = function () { return true; }; + TypeScriptLS.prototype.warning = function () { return true; }; + TypeScriptLS.prototype.error = function () { return true; }; + TypeScriptLS.prototype.fatal = function () { return true; }; TypeScriptLS.prototype.log = function (s) { // For debugging... //IO.printLine("TypeScriptLS:" + s); diff --git a/tests/baselines/reference/parserindenter.js b/tests/baselines/reference/parserindenter.js index 514a24afcf6..511e75ea135 100644 --- a/tests/baselines/reference/parserindenter.js +++ b/tests/baselines/reference/parserindenter.js @@ -778,7 +778,10 @@ var Formatting; } Indenter.prototype.GetIndentationEdits = function (token, nextToken, node, sameLineIndent) { if (this.logger.information()) { - this.logger.log("GetIndentationEdits(" + "t1=[" + token.Span.startPosition() + "," + token.Span.endPosition() + "], " + "t2=[" + (nextToken == null ? "null" : (nextToken.Span.startPosition() + "," + nextToken.Span.endPosition())) + "]" + ")"); + this.logger.log("GetIndentationEdits(" + + "t1=[" + token.Span.startPosition() + "," + token.Span.endPosition() + "], " + + "t2=[" + (nextToken == null ? "null" : (nextToken.Span.startPosition() + "," + nextToken.Span.endPosition())) + "]" + + ")"); } var result = this.GetIndentationEditsWorker(token, nextToken, node, sameLineIndent); if (this.logger.information()) { @@ -938,7 +941,8 @@ var Formatting; }; Indenter.prototype.GetSpecialCaseIndentationForLCurly = function (node) { var indentationInfo = null; - if (node.AuthorNode.Details.Kind == AuthorParseNodeKind.apnkFncDecl || node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneThen || node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneElse) { + if (node.AuthorNode.Details.Kind == AuthorParseNodeKind.apnkFncDecl || + node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneThen || node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneElse) { // flushed with the node (function & if) indentationInfo = node.GetNodeStartLineIndentation(this); return indentationInfo; @@ -1233,7 +1237,8 @@ var Formatting; // Get the parent that is really on a different line from the self node var startNodeLineNumber = this.snapshot.GetLineNumberFromPosition(tree.StartNodeSelf.AuthorNode.Details.StartOffset); parent = tree.StartNodeSelf.Parent; - while (parent != null && startNodeLineNumber == this.snapshot.GetLineNumberFromPosition(parent.AuthorNode.Details.StartOffset)) { + while (parent != null && + startNodeLineNumber == this.snapshot.GetLineNumberFromPosition(parent.AuthorNode.Details.StartOffset)) { parent = parent.Parent; } } @@ -1331,7 +1336,8 @@ var Formatting; } }; Indenter.prototype.IsMultiLineString = function (token) { - return token.tokenID === TypeScript.TokenID.StringLiteral && this.snapshot.GetLineNumberFromPosition(token.Span.endPosition()) > this.snapshot.GetLineNumberFromPosition(token.Span.startPosition()); + return token.tokenID === TypeScript.TokenID.StringLiteral && + this.snapshot.GetLineNumberFromPosition(token.Span.endPosition()) > this.snapshot.GetLineNumberFromPosition(token.Span.startPosition()); }; return Indenter; })(); diff --git a/tests/baselines/reference/plusOperatorWithBooleanType.js b/tests/baselines/reference/plusOperatorWithBooleanType.js index 3de502f5ff6..5af1a8fb903 100644 --- a/tests/baselines/reference/plusOperatorWithBooleanType.js +++ b/tests/baselines/reference/plusOperatorWithBooleanType.js @@ -38,15 +38,11 @@ var ResultIsNumber7 = +A.foo(); //// [plusOperatorWithBooleanType.js] // + operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/plusOperatorWithNumberType.js b/tests/baselines/reference/plusOperatorWithNumberType.js index fa993b80f87..a0adaa5dec2 100644 --- a/tests/baselines/reference/plusOperatorWithNumberType.js +++ b/tests/baselines/reference/plusOperatorWithNumberType.js @@ -45,15 +45,11 @@ var ResultIsNumber11 = +(NUMBER + NUMBER); // + operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -67,9 +63,7 @@ var ResultIsNumber2 = +NUMBER1; // number type literal var ResultIsNumber3 = +1; var ResultIsNumber4 = +{ x: 1, y: 2 }; -var ResultIsNumber5 = +{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = +{ x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsNumber6 = +objA.a; var ResultIsNumber7 = +M.n; diff --git a/tests/baselines/reference/plusOperatorWithStringType.js b/tests/baselines/reference/plusOperatorWithStringType.js index 93af186ce8f..ed2c60111b3 100644 --- a/tests/baselines/reference/plusOperatorWithStringType.js +++ b/tests/baselines/reference/plusOperatorWithStringType.js @@ -44,15 +44,11 @@ var ResultIsNumber12 = +STRING.charAt(0); // + operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -66,9 +62,7 @@ var ResultIsNumber2 = +STRING1; // string type literal var ResultIsNumber3 = +""; var ResultIsNumber4 = +{ x: "", y: "" }; -var ResultIsNumber5 = +{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber5 = +{ x: "", y: function (s) { return s; } }; // string type expressions var ResultIsNumber6 = +objA.a; var ResultIsNumber7 = +M.n; diff --git a/tests/baselines/reference/primitiveMembers.js b/tests/baselines/reference/primitiveMembers.js index f41d2a65bba..bf3f1a17105 100644 --- a/tests/baselines/reference/primitiveMembers.js +++ b/tests/baselines/reference/primitiveMembers.js @@ -65,8 +65,6 @@ var foo = (function (_super) { function foo() { _super.apply(this, arguments); } - foo.prototype.bar = function () { - return undefined; - }; + foo.prototype.bar = function () { return undefined; }; return foo; })(baz); diff --git a/tests/baselines/reference/privacyGloImportParseErrors.errors.txt b/tests/baselines/reference/privacyGloImportParseErrors.errors.txt index 2a7c07bfcdb..ac19571b8c0 100644 --- a/tests/baselines/reference/privacyGloImportParseErrors.errors.txt +++ b/tests/baselines/reference/privacyGloImportParseErrors.errors.txt @@ -7,9 +7,7 @@ tests/cases/compiler/privacyGloImportParseErrors.ts(69,37): error TS1147: Import tests/cases/compiler/privacyGloImportParseErrors.ts(69,37): error TS2307: Cannot find external module 'm1_M4_private'. tests/cases/compiler/privacyGloImportParseErrors.ts(80,35): error TS4000: Import declaration 'm1_im2_public' is using private name 'm1_M2_private'. tests/cases/compiler/privacyGloImportParseErrors.ts(81,43): error TS1147: Import declarations in an internal module cannot reference an external module. -tests/cases/compiler/privacyGloImportParseErrors.ts(81,43): error TS2307: Cannot find external module 'm1_M3_public'. tests/cases/compiler/privacyGloImportParseErrors.ts(82,43): error TS1147: Import declarations in an internal module cannot reference an external module. -tests/cases/compiler/privacyGloImportParseErrors.ts(82,43): error TS2307: Cannot find external module 'm1_M4_private'. tests/cases/compiler/privacyGloImportParseErrors.ts(121,38): error TS1147: Import declarations in an internal module cannot reference an external module. tests/cases/compiler/privacyGloImportParseErrors.ts(125,45): error TS1147: Import declarations in an internal module cannot reference an external module. tests/cases/compiler/privacyGloImportParseErrors.ts(133,9): error TS1038: A 'declare' modifier cannot be used in an already ambient context. @@ -20,7 +18,7 @@ tests/cases/compiler/privacyGloImportParseErrors.ts(146,25): error TS1147: Impor tests/cases/compiler/privacyGloImportParseErrors.ts(149,29): error TS1147: Import declarations in an internal module cannot reference an external module. -==== tests/cases/compiler/privacyGloImportParseErrors.ts (20 errors) ==== +==== tests/cases/compiler/privacyGloImportParseErrors.ts (18 errors) ==== module m1 { export module m1_M1_public { export class c1 { @@ -120,13 +118,9 @@ tests/cases/compiler/privacyGloImportParseErrors.ts(149,29): error TS1147: Impor export import m1_im3_public = require("m1_M3_public"); ~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. - ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find external module 'm1_M3_public'. export import m1_im4_public = require("m1_M4_private"); ~~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find external module 'm1_M4_private'. } module glo_M1_public { diff --git a/tests/baselines/reference/privacyGloImportParseErrors.js b/tests/baselines/reference/privacyGloImportParseErrors.js index 6812b468882..3b82d65a07b 100644 --- a/tests/baselines/reference/privacyGloImportParseErrors.js +++ b/tests/baselines/reference/privacyGloImportParseErrors.js @@ -203,7 +203,6 @@ var m1; var m1_im2_private_v2_private = new m1_im2_private.c1(); var m1_im2_private_v3_private = m1_im2_private.f1; var m1_im2_private_v4_private = m1_im2_private.f1(); - var m1_im3_private = require("m1_M3_public"); m1.m1_im3_private_v1_public = m1_im3_private.c1; m1.m1_im3_private_v2_public = new m1_im3_private.c1(); m1.m1_im3_private_v3_public = m1_im3_private.f1; @@ -212,7 +211,6 @@ var m1; var m1_im3_private_v2_private = new m1_im3_private.c1(); var m1_im3_private_v3_private = m1_im3_private.f1; var m1_im3_private_v4_private = m1_im3_private.f1(); - var m1_im4_private = require("m1_M4_private"); m1.m1_im4_private_v1_public = m1_im4_private.c1; m1.m1_im4_private_v2_public = new m1_im4_private.c1(); m1.m1_im4_private_v3_public = m1_im4_private.f1; @@ -240,7 +238,7 @@ var glo_M1_public; glo_M1_public.v2; })(glo_M1_public || (glo_M1_public = {})); var m2; -(function (m2) { +(function (_m2) { var m4; (function (m4) { var a = 10; diff --git a/tests/baselines/reference/privacyImportParseErrors.errors.txt b/tests/baselines/reference/privacyImportParseErrors.errors.txt index ca2734fe126..a81bfbe738b 100644 --- a/tests/baselines/reference/privacyImportParseErrors.errors.txt +++ b/tests/baselines/reference/privacyImportParseErrors.errors.txt @@ -5,9 +5,7 @@ tests/cases/compiler/privacyImportParseErrors.ts(59,37): error TS2307: Cannot fi tests/cases/compiler/privacyImportParseErrors.ts(69,37): error TS1147: Import declarations in an internal module cannot reference an external module. tests/cases/compiler/privacyImportParseErrors.ts(69,37): error TS2307: Cannot find external module 'm1_M4_private'. tests/cases/compiler/privacyImportParseErrors.ts(81,43): error TS1147: Import declarations in an internal module cannot reference an external module. -tests/cases/compiler/privacyImportParseErrors.ts(81,43): error TS2307: Cannot find external module 'm1_M3_public'. tests/cases/compiler/privacyImportParseErrors.ts(82,43): error TS1147: Import declarations in an internal module cannot reference an external module. -tests/cases/compiler/privacyImportParseErrors.ts(82,43): error TS2307: Cannot find external module 'm1_M4_private'. tests/cases/compiler/privacyImportParseErrors.ts(106,27): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyImportParseErrors.ts(114,20): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyImportParseErrors.ts(143,37): error TS1147: Import declarations in an internal module cannot reference an external module. @@ -15,9 +13,7 @@ tests/cases/compiler/privacyImportParseErrors.ts(143,37): error TS2307: Cannot f tests/cases/compiler/privacyImportParseErrors.ts(153,37): error TS1147: Import declarations in an internal module cannot reference an external module. tests/cases/compiler/privacyImportParseErrors.ts(153,37): error TS2307: Cannot find external module 'm2_M4_private'. tests/cases/compiler/privacyImportParseErrors.ts(166,43): error TS1147: Import declarations in an internal module cannot reference an external module. -tests/cases/compiler/privacyImportParseErrors.ts(166,43): error TS2307: Cannot find external module 'm2_M3_public'. tests/cases/compiler/privacyImportParseErrors.ts(167,43): error TS1147: Import declarations in an internal module cannot reference an external module. -tests/cases/compiler/privacyImportParseErrors.ts(167,43): error TS2307: Cannot find external module 'm2_M4_private'. tests/cases/compiler/privacyImportParseErrors.ts(180,23): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyImportParseErrors.ts(198,23): error TS2435: Ambient external modules cannot be nested in other modules. tests/cases/compiler/privacyImportParseErrors.ts(218,34): error TS2307: Cannot find external module 'glo_M2_public'. @@ -53,7 +49,7 @@ tests/cases/compiler/privacyImportParseErrors.ts(350,25): error TS1147: Import d tests/cases/compiler/privacyImportParseErrors.ts(353,29): error TS1147: Import declarations in an internal module cannot reference an external module. -==== tests/cases/compiler/privacyImportParseErrors.ts (53 errors) ==== +==== tests/cases/compiler/privacyImportParseErrors.ts (49 errors) ==== export module m1 { export module m1_M1_public { export class c1 { @@ -149,13 +145,9 @@ tests/cases/compiler/privacyImportParseErrors.ts(353,29): error TS1147: Import d export import m1_im3_public = require("m1_M3_public"); ~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. - ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find external module 'm1_M3_public'. export import m1_im4_public = require("m1_M4_private"); ~~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find external module 'm1_M4_private'. } module m2 { @@ -254,13 +246,9 @@ tests/cases/compiler/privacyImportParseErrors.ts(353,29): error TS1147: Import d export import m1_im3_public = require("m2_M3_public"); ~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. - ~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find external module 'm2_M3_public'. export import m1_im4_public = require("m2_M4_private"); ~~~~~~~~~~~~~~~ !!! error TS1147: Import declarations in an internal module cannot reference an external module. - ~~~~~~~~~~~~~~~ -!!! error TS2307: Cannot find external module 'm2_M4_private'. } export module glo_M1_public { diff --git a/tests/baselines/reference/privacyImportParseErrors.js b/tests/baselines/reference/privacyImportParseErrors.js index d32c0255f78..7a875fa12d1 100644 --- a/tests/baselines/reference/privacyImportParseErrors.js +++ b/tests/baselines/reference/privacyImportParseErrors.js @@ -407,7 +407,6 @@ var m1; var m1_im2_private_v2_private = new m1_im2_private.c1(); var m1_im2_private_v3_private = m1_im2_private.f1; var m1_im2_private_v4_private = m1_im2_private.f1(); - var m1_im3_private = require("m1_M3_public"); m1.m1_im3_private_v1_public = m1_im3_private.c1; m1.m1_im3_private_v2_public = new m1_im3_private.c1(); m1.m1_im3_private_v3_public = m1_im3_private.f1; @@ -416,7 +415,6 @@ var m1; var m1_im3_private_v2_private = new m1_im3_private.c1(); var m1_im3_private_v3_private = m1_im3_private.f1; var m1_im3_private_v4_private = m1_im3_private.f1(); - var m1_im4_private = require("m1_M4_private"); m1.m1_im4_private_v1_public = m1_im4_private.c1; m1.m1_im4_private_v2_public = new m1_im4_private.c1(); m1.m1_im4_private_v3_public = m1_im4_private.f1; @@ -478,7 +476,6 @@ var m2; var m1_im2_private_v2_private = new m1_im2_private.c1(); var m1_im2_private_v3_private = m1_im2_private.f1; var m1_im2_private_v4_private = m1_im2_private.f1(); - var m1_im3_private = require("m2_M3_public"); m2.m1_im3_private_v1_public = m1_im3_private.c1; m2.m1_im3_private_v2_public = new m1_im3_private.c1(); m2.m1_im3_private_v3_public = m1_im3_private.f1; @@ -487,7 +484,6 @@ var m2; var m1_im3_private_v2_private = new m1_im3_private.c1(); var m1_im3_private_v3_private = m1_im3_private.f1; var m1_im3_private_v4_private = m1_im3_private.f1(); - var m1_im4_private = require("m2_M4_private"); m2.m1_im4_private_v1_public = m1_im4_private.c1; m2.m1_im4_private_v2_public = new m1_im4_private.c1(); m2.m1_im4_private_v3_public = m1_im4_private.f1; @@ -570,14 +566,14 @@ var glo_im4_private_v4_private = glo_im4_private.f1(); exports.glo_im1_public = glo_M1_public; exports.glo_im2_public = glo_M3_private; var m2; -(function (m2) { +(function (_m2) { var m4; (function (m4) { var a = 10; })(m4 || (m4 = {})); })(m2 || (m2 = {})); var m3; -(function (m3) { +(function (_m3) { var m4; (function (m4) { var a = 10; diff --git a/tests/baselines/reference/privateClassPropertyAccessibleWithinClass.js b/tests/baselines/reference/privateClassPropertyAccessibleWithinClass.js index 61d1a44b121..116b255a921 100644 --- a/tests/baselines/reference/privateClassPropertyAccessibleWithinClass.js +++ b/tests/baselines/reference/privateClassPropertyAccessibleWithinClass.js @@ -37,34 +37,20 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.prototype.foo = function () { - return this.foo; - }; + C.prototype.foo = function () { return this.foo; }; Object.defineProperty(C, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.foo = function () { - return this.foo; - }; - C.bar = function () { - this.foo(); - }; + C.foo = function () { return this.foo; }; + C.bar = function () { this.foo(); }; return C; })(); // added level of function nesting @@ -79,9 +65,7 @@ var C2 = (function () { }, set: function (x) { var _this = this; - (function () { - _this.y = _this.x; - }); + (function () { _this.y = _this.x; }); }, enumerable: true, configurable: true @@ -98,9 +82,7 @@ var C2 = (function () { }, set: function (x) { var _this = this; - (function () { - _this.y = _this.x; - }); + (function () { _this.y = _this.x; }); }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/privateIndexer2.js b/tests/baselines/reference/privateIndexer2.js index 13849216ca0..5a36a9eae18 100644 --- a/tests/baselines/reference/privateIndexer2.js +++ b/tests/baselines/reference/privateIndexer2.js @@ -11,8 +11,9 @@ var y: { //// [privateIndexer2.js] // private indexers not allowed -var x = { - [x]: string, - string: -}; +var x = (_a = {}, _a[x] = +string, _a.string = +, +_a); var y; +var _a; diff --git a/tests/baselines/reference/privateInstanceVisibility.js b/tests/baselines/reference/privateInstanceVisibility.js index e1ccb287515..b730a763e1e 100644 --- a/tests/baselines/reference/privateInstanceVisibility.js +++ b/tests/baselines/reference/privateInstanceVisibility.js @@ -57,9 +57,7 @@ var Test; var C = (function () { function C() { } - C.prototype.getX = function () { - return this.x; - }; + C.prototype.getX = function () { return this.x; }; C.prototype.clone = function (other) { this.x = other.x; }; diff --git a/tests/baselines/reference/privateVisibility.js b/tests/baselines/reference/privateVisibility.js index 9565b6fc25d..d70d7b4756f 100644 --- a/tests/baselines/reference/privateVisibility.js +++ b/tests/baselines/reference/privateVisibility.js @@ -32,9 +32,7 @@ var Foo = (function () { this.pubProp = 0; this.privProp = 0; } - Foo.prototype.pubMeth = function () { - this.privMeth(); - }; + Foo.prototype.pubMeth = function () { this.privMeth(); }; Foo.prototype.privMeth = function () { }; return Foo; })(); diff --git a/tests/baselines/reference/privateVisibles.js b/tests/baselines/reference/privateVisibles.js index c9206964f80..b2cb673c681 100644 --- a/tests/baselines/reference/privateVisibles.js +++ b/tests/baselines/reference/privateVisibles.js @@ -15,8 +15,6 @@ var Foo = (function () { this.pvar = 0; var n = this.pvar; } - Foo.prototype.meth = function () { - var q = this.pvar; - }; + Foo.prototype.meth = function () { var q = this.pvar; }; return Foo; })(); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js index ecbd4af1f59..7af6249615c 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js @@ -6,7 +6,6 @@ var __extends = this.__extends || function (d, b) { }; var m2; (function (m2) { - m2.mExported = require("mExported"); m2.c1 = new m2.mExported.me.class1; function f1() { return new m2.mExported.me.class1(); @@ -33,7 +32,6 @@ var m2; } return class2; })(mExported.me.class1); - var mNonExported = require("mNonExported"); m2.c3 = new mNonExported.mne.class1; function f3() { return new mNonExported.mne.class1(); diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js index ecbd4af1f59..7af6249615c 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js @@ -6,7 +6,6 @@ var __extends = this.__extends || function (d, b) { }; var m2; (function (m2) { - m2.mExported = require("mExported"); m2.c1 = new m2.mExported.me.class1; function f1() { return new m2.mExported.me.class1(); @@ -33,7 +32,6 @@ var m2; } return class2; })(mExported.me.class1); - var mNonExported = require("mNonExported"); m2.c3 = new mNonExported.mne.class1; function f3() { return new mNonExported.mne.class1(); diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js index 81cdcec5434..88baee7752e 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js @@ -92,9 +92,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js index eb3770bc0b3..941adc7ab43 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js @@ -67,9 +67,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js index 3a88ec832f7..fe3c9433796 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js @@ -54,9 +54,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { diff --git a/tests/baselines/reference/propertyOrdering.js b/tests/baselines/reference/propertyOrdering.js index 1dc930f93a1..f0f4644a983 100644 --- a/tests/baselines/reference/propertyOrdering.js +++ b/tests/baselines/reference/propertyOrdering.js @@ -31,9 +31,7 @@ var Foo = (function () { Foo.prototype.foo = function () { return this._store.length; // shouldn't be an error }; - Foo.prototype.bar = function () { - return this.store; - }; // should be an error + Foo.prototype.bar = function () { return this.store; }; // should be an error return Foo; })(); var Bar = (function () { diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js index 992011ee4af..19ec9f50d27 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js @@ -37,34 +37,20 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.prototype.foo = function () { - return this.foo; - }; + C.prototype.foo = function () { return this.foo; }; Object.defineProperty(C, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.foo = function () { - return this.foo; - }; - C.bar = function () { - this.foo(); - }; + C.foo = function () { return this.foo; }; + C.bar = function () { this.foo(); }; return C; })(); // added level of function nesting @@ -79,9 +65,7 @@ var C2 = (function () { }, set: function (x) { var _this = this; - (function () { - _this.y = _this.x; - }); + (function () { _this.y = _this.x; }); }, enumerable: true, configurable: true @@ -98,9 +82,7 @@ var C2 = (function () { }, set: function (x) { var _this = this; - (function () { - _this.y = _this.x; - }); + (function () { _this.y = _this.x; }); }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js index 381d10f43ea..28a1da5ffec 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js @@ -38,36 +38,20 @@ var C = (function (_super) { _super.apply(this, arguments); } Object.defineProperty(C.prototype, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.prototype.foo = function () { - return this.x; - }; - C.prototype.bar = function () { - return this.foo(); - }; + C.prototype.foo = function () { return this.x; }; + C.prototype.bar = function () { return this.foo(); }; Object.defineProperty(C, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.foo = function () { - return this.x; - }; - C.bar = function () { - this.foo(); - }; + C.foo = function () { return this.x; }; + C.bar = function () { this.foo(); }; return C; })(B); diff --git a/tests/baselines/reference/qualifiedModuleLocals.js b/tests/baselines/reference/qualifiedModuleLocals.js index 45d61949c63..b7ba5b70e81 100644 --- a/tests/baselines/reference/qualifiedModuleLocals.js +++ b/tests/baselines/reference/qualifiedModuleLocals.js @@ -14,9 +14,7 @@ A.a(); var A; (function (A) { function b() { } - function a() { - A.b(); - } + function a() { A.b(); } A.a = a; // A.b should be an unresolved symbol error })(A || (A = {})); A.a(); diff --git a/tests/baselines/reference/quotedAccessorName1.js b/tests/baselines/reference/quotedAccessorName1.js index 93fd5b8dd6b..69e0fdb2c8e 100644 --- a/tests/baselines/reference/quotedAccessorName1.js +++ b/tests/baselines/reference/quotedAccessorName1.js @@ -8,9 +8,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "foo", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/quotedAccessorName2.js b/tests/baselines/reference/quotedAccessorName2.js index 43041a29bf4..5d2d4861550 100644 --- a/tests/baselines/reference/quotedAccessorName2.js +++ b/tests/baselines/reference/quotedAccessorName2.js @@ -8,9 +8,7 @@ var C = (function () { function C() { } Object.defineProperty(C, "foo", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/rectype.js b/tests/baselines/reference/rectype.js index ed303b6b26e..15c5d9861f4 100644 --- a/tests/baselines/reference/rectype.js +++ b/tests/baselines/reference/rectype.js @@ -16,9 +16,7 @@ module M { //// [rectype.js] var M; (function (M) { - function f(p) { - return f; - } + function f(p) { return f; } M.f = f; ; var i; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js b/tests/baselines/reference/recursiveClassReferenceTest.js index 661ecb3a0e7..4b115d3e722 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js +++ b/tests/baselines/reference/recursiveClassReferenceTest.js @@ -116,22 +116,20 @@ var Sample; var Actions; (function (Actions) { var Thing; - (function (_Thing) { + (function (_Thing_1) { var Find; (function (Find) { var StartFindAction = (function () { function StartFindAction() { } - StartFindAction.prototype.getId = function () { - return "yo"; - }; + StartFindAction.prototype.getId = function () { return "yo"; }; StartFindAction.prototype.run = function (Thing) { return true; }; return StartFindAction; })(); Find.StartFindAction = StartFindAction; - })(Find = _Thing.Find || (_Thing.Find = {})); + })(Find = _Thing_1.Find || (_Thing_1.Find = {})); })(Thing = Actions.Thing || (Actions.Thing = {})); })(Actions = Sample.Actions || (Sample.Actions = {})); })(Sample || (Sample = {})); @@ -148,11 +146,9 @@ var Sample; // scenario 1 codeThing.addWidget("addWidget", this); } - FindWidget.prototype.gar = function (runner) { - if (true) { - return runner(this); - } - }; + FindWidget.prototype.gar = function (runner) { if (true) { + return runner(this); + } }; FindWidget.prototype.getDomNode = function () { return domNode; }; @@ -167,9 +163,7 @@ var Sample; var AbstractMode = (function () { function AbstractMode() { } - AbstractMode.prototype.getInitialState = function () { - return null; - }; + AbstractMode.prototype.getInitialState = function () { return null; }; return AbstractMode; })(); var Sample; @@ -190,9 +184,7 @@ var Sample; State.prototype.equals = function (other) { return this === other; }; - State.prototype.getMode = function () { - return mode; - }; + State.prototype.getMode = function () { return mode; }; return State; })(); PlainText.State = State; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js.map b/tests/baselines/reference/recursiveClassReferenceTest.js.map index d2e66a925a8..a2c623e2cf5 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js.map +++ b/tests/baselines/reference/recursiveClassReferenceTest.js.map @@ -1,2 +1,2 @@ //// [recursiveClassReferenceTest.js.map] -{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":["Sample","Sample.Actions","Sample.Actions.Thing","Sample.Actions.Thing.Find","Sample.Actions.Thing.Find.StartFindAction","Sample.Actions.Thing.Find.StartFindAction.constructor","Sample.Actions.Thing.Find.StartFindAction.getId","Sample.Actions.Thing.Find.StartFindAction.run","Sample.Thing","Sample.Thing.Widgets","Sample.Thing.Widgets.FindWidget","Sample.Thing.Widgets.FindWidget.constructor","Sample.Thing.Widgets.FindWidget.gar","Sample.Thing.Widgets.FindWidget.getDomNode","Sample.Thing.Widgets.FindWidget.destroy","AbstractMode","AbstractMode.constructor","AbstractMode.getInitialState","Sample.Thing.Languages","Sample.Thing.Languages.PlainText","Sample.Thing.Languages.PlainText.State","Sample.Thing.Languages.PlainText.State.constructor","Sample.Thing.Languages.PlainText.State.clone","Sample.Thing.Languages.PlainText.State.equals","Sample.Thing.Languages.PlainText.State.getMode","Sample.Thing.Languages.PlainText.Mode","Sample.Thing.Languages.PlainText.Mode.constructor","Sample.Thing.Languages.PlainText.Mode.getInitialState"],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;;;;;;;AA8B1E,IAAO,MAAM,CAUZ;AAVD,WAAO,MAAM;IAACA,IAAAA,OAAOA,CAUpBA;IAVaA,WAAAA,OAAOA;QAACC,IAAAA,KAAKA,CAU1BA;QAVqBA,WAAAA,MAAKA;YAACC,IAAAA,IAAIA,CAU/BA;YAV2BA,WAAAA,IAAIA,EAACA,CAACA;gBACjCC,IAAaA,eAAeA;oBAA5BC,SAAaA,eAAeA;oBAQ5BC,CAACA;oBANOD,+BAAKA,GAAZA;wBAAiBE,MAAMA,CAACA,IAAIA,CAACA;oBAACA,CAACA;oBAExBF,6BAAGA,GAAVA,UAAWA,KAA6BA;wBAEvCG,MAAMA,CAACA,IAAIA,CAACA;oBACbA,CAACA;oBACFH,sBAACA;gBAADA,CAACA,AARDD,IAQCA;gBARYA,oBAAeA,GAAfA,eAQZA,CAAAA;YACFA,CAACA,EAV2BD,IAAIA,GAAJA,WAAIA,KAAJA,WAAIA,QAU/BA;QAADA,CAACA,EAVqBD,KAAKA,GAALA,aAAKA,KAALA,aAAKA,QAU1BA;IAADA,CAACA,EAVaD,OAAOA,GAAPA,cAAOA,KAAPA,cAAOA,QAUpBA;AAADA,CAACA,EAVM,MAAM,KAAN,MAAM,QAUZ;AAED,IAAO,MAAM,CAoBZ;AApBD,WAAO,MAAM;IAACA,IAAAA,KAAKA,CAoBlBA;IApBaA,WAAAA,KAAKA;QAACQ,IAAAA,OAAOA,CAoB1BA;QApBmBA,WAAAA,OAAOA,EAACA,CAACA;YAC5BC,IAAaA,UAAUA;gBAKtBC,SALYA,UAAUA,CAKFA,SAAkCA;oBAAlCC,cAASA,GAATA,SAASA,CAAyBA;oBAD9CA,YAAOA,GAAOA,IAAIA,CAACA;oBAGvBA,AADAA,aAAaA;oBACbA,SAASA,CAACA,SAASA,CAACA,WAAWA,EAAEA,IAAIA,CAACA,CAACA;gBAC3CA,CAACA;gBANMD,wBAAGA,GAAVA,UAAWA,MAAyCA;oBAAIE,EAAEA,CAACA,CAACA,IAAIA,CAACA,CAACA,CAACA;wBAAAA,MAAMA,CAACA,MAAMA,CAACA,IAAIA,CAACA,CAACA;oBAAAA,CAACA;gBAAAA,CAACA;gBAQlFF,+BAAUA,GAAjBA;oBACCG,MAAMA,CAACA,OAAOA,CAACA;gBAChBA,CAACA;gBAEMH,4BAAOA,GAAdA;gBAEAI,CAACA;gBAEFJ,iBAACA;YAADA,CAACA,AAlBDD,IAkBCA;YAlBYA,kBAAUA,GAAVA,UAkBZA,CAAAA;QACFA,CAACA,EApBmBD,OAAOA,GAAPA,aAAOA,KAAPA,aAAOA,QAoB1BA;IAADA,CAACA,EApBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAoBlBA;AAADA,CAACA,EApBM,MAAM,KAAN,MAAM,QAoBZ;AAGD,IAAM,YAAY;IAAlBe,SAAMA,YAAYA;IAAqEC,CAACA;IAA3CD,sCAAeA,GAAtBA;QAAmCE,MAAMA,CAACA,IAAIA,CAACA;IAAAA,CAACA;IAACF,mBAACA;AAADA,CAACA,AAAxF,IAAwF;AASxF,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM;IAACf,IAAAA,KAAKA,CAwBlBA;IAxBaA,WAAAA,KAAKA;QAACQ,IAAAA,SAASA,CAwB5BA;QAxBmBA,WAAAA,SAASA;YAACU,IAAAA,SAASA,CAwBtCA;YAxB6BA,WAAAA,SAASA,EAACA,CAACA;gBAExCC,IAAaA,KAAKA;oBACXC,SADMA,KAAKA,CACSA,IAAWA;wBAAXC,SAAIA,GAAJA,IAAIA,CAAOA;oBAAIA,CAACA;oBACnCD,qBAAKA,GAAZA;wBACCE,MAAMA,CAACA,IAAIA,CAACA;oBACbA,CAACA;oBAEMF,sBAAMA,GAAbA,UAAcA,KAAYA;wBACzBG,MAAMA,CAACA,IAAIA,KAAKA,KAAKA,CAACA;oBACvBA,CAACA;oBAEMH,uBAAOA,GAAdA;wBAA0BI,MAAMA,CAACA,IAAIA,CAACA;oBAACA,CAACA;oBACzCJ,YAACA;gBAADA,CAACA,AAXDD,IAWCA;gBAXYA,eAAKA,GAALA,KAWZA,CAAAA;gBAEDA,IAAaA,IAAIA;oBAASM,UAAbA,IAAIA,UAAqBA;oBAAtCA,SAAaA,IAAIA;wBAASC,8BAAYA;oBAQtCA,CAACA;oBANAD,aAAaA;oBACNA,8BAAeA,GAAtBA;wBACCE,MAAMA,CAACA,IAAIA,KAAKA,CAACA,IAAIA,CAACA,CAACA;oBACxBA,CAACA;oBAGFF,WAACA;gBAADA,CAACA,AARDN,EAA0BA,YAAYA,EAQrCA;gBARYA,cAAIA,GAAJA,IAQZA,CAAAA;YACFA,CAACA,EAxB6BD,SAASA,GAATA,mBAASA,KAATA,mBAASA,QAwBtCA;QAADA,CAACA,EAxBmBV,SAASA,GAATA,eAASA,KAATA,eAASA,QAwB5BA;IAADA,CAACA,EAxBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAwBlBA;AAADA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ"} \ No newline at end of file +{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":["Sample","Sample.Actions","Sample.Actions.Thing","Sample.Actions.Thing.Find","Sample.Actions.Thing.Find.StartFindAction","Sample.Actions.Thing.Find.StartFindAction.constructor","Sample.Actions.Thing.Find.StartFindAction.getId","Sample.Actions.Thing.Find.StartFindAction.run","Sample.Thing","Sample.Thing.Widgets","Sample.Thing.Widgets.FindWidget","Sample.Thing.Widgets.FindWidget.constructor","Sample.Thing.Widgets.FindWidget.gar","Sample.Thing.Widgets.FindWidget.getDomNode","Sample.Thing.Widgets.FindWidget.destroy","AbstractMode","AbstractMode.constructor","AbstractMode.getInitialState","Sample.Thing.Languages","Sample.Thing.Languages.PlainText","Sample.Thing.Languages.PlainText.State","Sample.Thing.Languages.PlainText.State.constructor","Sample.Thing.Languages.PlainText.State.clone","Sample.Thing.Languages.PlainText.State.equals","Sample.Thing.Languages.PlainText.State.getMode","Sample.Thing.Languages.PlainText.Mode","Sample.Thing.Languages.PlainText.Mode.constructor","Sample.Thing.Languages.PlainText.Mode.getInitialState"],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;;;;;;;AA8B1E,IAAO,MAAM,CAUZ;AAVD,WAAO,MAAM;IAACA,IAAAA,OAAOA,CAUpBA;IAVaA,WAAAA,OAAOA;QAACC,IAAAA,KAAKA,CAU1BA;QAVqBA,WAAAA,QAAKA;YAACC,IAAAA,IAAIA,CAU/BA;YAV2BA,WAAAA,IAAIA,EAACA,CAACA;gBACjCC,IAAaA,eAAeA;oBAA5BC,SAAaA,eAAeA;oBAQ5BC,CAACA;oBANOD,+BAAKA,GAAZA,cAAiBE,MAAMA,CAACA,IAAIA,CAACA,CAACA,CAACA;oBAExBF,6BAAGA,GAAVA,UAAWA,KAA6BA;wBAEvCG,MAAMA,CAACA,IAAIA,CAACA;oBACbA,CAACA;oBACFH,sBAACA;gBAADA,CAACA,AARDD,IAQCA;gBARYA,oBAAeA,GAAfA,eAQZA,CAAAA;YACFA,CAACA,EAV2BD,IAAIA,GAAJA,aAAIA,KAAJA,aAAIA,QAU/BA;QAADA,CAACA,EAVqBD,KAAKA,GAALA,aAAKA,KAALA,aAAKA,QAU1BA;IAADA,CAACA,EAVaD,OAAOA,GAAPA,cAAOA,KAAPA,cAAOA,QAUpBA;AAADA,CAACA,EAVM,MAAM,KAAN,MAAM,QAUZ;AAED,IAAO,MAAM,CAoBZ;AApBD,WAAO,MAAM;IAACA,IAAAA,KAAKA,CAoBlBA;IApBaA,WAAAA,KAAKA;QAACQ,IAAAA,OAAOA,CAoB1BA;QApBmBA,WAAAA,OAAOA,EAACA,CAACA;YAC5BC,IAAaA,UAAUA;gBAKtBC,SALYA,UAAUA,CAKFA,SAAkCA;oBAAlCC,cAASA,GAATA,SAASA,CAAyBA;oBAD9CA,YAAOA,GAAOA,IAAIA,CAACA;oBAGvBA,AADAA,aAAaA;oBACbA,SAASA,CAACA,SAASA,CAACA,WAAWA,EAAEA,IAAIA,CAACA,CAACA;gBAC3CA,CAACA;gBANMD,wBAAGA,GAAVA,UAAWA,MAAyCA,IAAIE,EAAEA,CAACA,CAACA,IAAIA,CAACA,CAACA,CAACA;oBAAAA,MAAMA,CAACA,MAAMA,CAACA,IAAIA,CAACA,CAACA;gBAAAA,CAACA,CAAAA,CAACA;gBAQlFF,+BAAUA,GAAjBA;oBACCG,MAAMA,CAACA,OAAOA,CAACA;gBAChBA,CAACA;gBAEMH,4BAAOA,GAAdA;gBAEAI,CAACA;gBAEFJ,iBAACA;YAADA,CAACA,AAlBDD,IAkBCA;YAlBYA,kBAAUA,GAAVA,UAkBZA,CAAAA;QACFA,CAACA,EApBmBD,OAAOA,GAAPA,aAAOA,KAAPA,aAAOA,QAoB1BA;IAADA,CAACA,EApBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAoBlBA;AAADA,CAACA,EApBM,MAAM,KAAN,MAAM,QAoBZ;AAGD,IAAM,YAAY;IAAlBe,SAAMA,YAAYA;IAAqEC,CAACA;IAA3CD,sCAAeA,GAAtBA,cAAmCE,MAAMA,CAACA,IAAIA,CAACA,CAAAA,CAACA;IAACF,mBAACA;AAADA,CAACA,AAAxF,IAAwF;AASxF,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM;IAACf,IAAAA,KAAKA,CAwBlBA;IAxBaA,WAAAA,KAAKA;QAACQ,IAAAA,SAASA,CAwB5BA;QAxBmBA,WAAAA,SAASA;YAACU,IAAAA,SAASA,CAwBtCA;YAxB6BA,WAAAA,SAASA,EAACA,CAACA;gBAExCC,IAAaA,KAAKA;oBACXC,SADMA,KAAKA,CACSA,IAAWA;wBAAXC,SAAIA,GAAJA,IAAIA,CAAOA;oBAAIA,CAACA;oBACnCD,qBAAKA,GAAZA;wBACCE,MAAMA,CAACA,IAAIA,CAACA;oBACbA,CAACA;oBAEMF,sBAAMA,GAAbA,UAAcA,KAAYA;wBACzBG,MAAMA,CAACA,IAAIA,KAAKA,KAAKA,CAACA;oBACvBA,CAACA;oBAEMH,uBAAOA,GAAdA,cAA0BI,MAAMA,CAACA,IAAIA,CAACA,CAACA,CAACA;oBACzCJ,YAACA;gBAADA,CAACA,AAXDD,IAWCA;gBAXYA,eAAKA,GAALA,KAWZA,CAAAA;gBAEDA,IAAaA,IAAIA;oBAASM,UAAbA,IAAIA,UAAqBA;oBAAtCA,SAAaA,IAAIA;wBAASC,8BAAYA;oBAQtCA,CAACA;oBANAD,aAAaA;oBACNA,8BAAeA,GAAtBA;wBACCE,MAAMA,CAACA,IAAIA,KAAKA,CAACA,IAAIA,CAACA,CAACA;oBACxBA,CAACA;oBAGFF,WAACA;gBAADA,CAACA,AARDN,EAA0BA,YAAYA,EAQrCA;gBARYA,cAAIA,GAAJA,IAQZA,CAAAA;YACFA,CAACA,EAxB6BD,SAASA,GAATA,mBAASA,KAATA,mBAASA,QAwBtCA;QAADA,CAACA,EAxBmBV,SAASA,GAATA,eAASA,KAATA,eAASA,QAwB5BA;IAADA,CAACA,EAxBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAwBlBA;AAADA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ"} \ No newline at end of file diff --git a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt index d7163bf7760..8e4f3be36ff 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt +++ b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt @@ -139,7 +139,7 @@ sourceFile:recursiveClassReferenceTest.ts 2 > ^^^^ 3 > ^^^^^ 4 > ^ -5 > ^^^^^^^^^^^-> +5 > ^^^^^^^^^^^^^-> 1 >. 2 > 3 > Thing @@ -159,16 +159,16 @@ sourceFile:recursiveClassReferenceTest.ts 3 >Emitted(13, 18) Source(32, 28) + SourceIndex(0) name (Sample.Actions) 4 >Emitted(13, 19) Source(42, 2) + SourceIndex(0) name (Sample.Actions) --- ->>> (function (_Thing) { +>>> (function (_Thing_1) { 1->^^^^^^^^ 2 > ^^^^^^^^^^^ -3 > ^^^^^^ +3 > ^^^^^^^^ 1-> 2 > 3 > Thing 1->Emitted(14, 9) Source(32, 23) + SourceIndex(0) name (Sample.Actions) 2 >Emitted(14, 20) Source(32, 23) + SourceIndex(0) name (Sample.Actions) -3 >Emitted(14, 26) Source(32, 28) + SourceIndex(0) name (Sample.Actions) +3 >Emitted(14, 28) Source(32, 28) + SourceIndex(0) name (Sample.Actions) --- >>> var Find; 1 >^^^^^^^^^^^^ @@ -240,7 +240,7 @@ sourceFile:recursiveClassReferenceTest.ts >>> } 1 >^^^^^^^^^^^^^^^^^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > implements Sample.Thing.IAction { > > public getId() { return "yo"; } @@ -254,61 +254,56 @@ sourceFile:recursiveClassReferenceTest.ts 1 >Emitted(19, 21) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.constructor) 2 >Emitted(19, 22) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.constructor) --- ->>> StartFindAction.prototype.getId = function () { +>>> StartFindAction.prototype.getId = function () { return "yo"; }; 1->^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^ +10> ^ 1-> 2 > getId 3 > +4 > public getId() { +5 > return +6 > +7 > "yo" +8 > ; +9 > +10> } 1->Emitted(20, 21) Source(35, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) 2 >Emitted(20, 52) Source(35, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) 3 >Emitted(20, 55) Source(35, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) ---- ->>> return "yo"; -1 >^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^ -1 >public getId() { -2 > return -3 > -4 > "yo" -5 > ; -1 >Emitted(21, 25) Source(35, 20) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -2 >Emitted(21, 31) Source(35, 26) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -3 >Emitted(21, 32) Source(35, 27) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -4 >Emitted(21, 36) Source(35, 31) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -5 >Emitted(21, 37) Source(35, 32) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) ---- ->>> }; -1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -1 >Emitted(22, 21) Source(35, 33) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -2 >Emitted(22, 22) Source(35, 34) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +4 >Emitted(20, 69) Source(35, 20) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +5 >Emitted(20, 75) Source(35, 26) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +6 >Emitted(20, 76) Source(35, 27) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +7 >Emitted(20, 80) Source(35, 31) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +8 >Emitted(20, 81) Source(35, 32) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +9 >Emitted(20, 82) Source(35, 33) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +10>Emitted(20, 83) Source(35, 34) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) --- >>> StartFindAction.prototype.run = function (Thing) { -1->^^^^^^^^^^^^^^^^^^^^ +1 >^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ 4 > ^^^^^^^^^^ 5 > ^^^^^ -1-> +1 > > > public 2 > run 3 > 4 > public run( 5 > Thing:Sample.Thing.ICodeThing -1->Emitted(23, 21) Source(37, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -2 >Emitted(23, 50) Source(37, 13) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -3 >Emitted(23, 53) Source(37, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -4 >Emitted(23, 63) Source(37, 14) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -5 >Emitted(23, 68) Source(37, 43) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +1 >Emitted(21, 21) Source(37, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +2 >Emitted(21, 50) Source(37, 13) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +3 >Emitted(21, 53) Source(37, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +4 >Emitted(21, 63) Source(37, 14) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +5 >Emitted(21, 68) Source(37, 43) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) --- >>> return true; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -323,11 +318,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > true 5 > ; -1 >Emitted(24, 25) Source(39, 4) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -2 >Emitted(24, 31) Source(39, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -3 >Emitted(24, 32) Source(39, 11) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -4 >Emitted(24, 36) Source(39, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -5 >Emitted(24, 37) Source(39, 16) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +1 >Emitted(22, 25) Source(39, 4) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +2 >Emitted(22, 31) Source(39, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +3 >Emitted(22, 32) Source(39, 11) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +4 >Emitted(22, 36) Source(39, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +5 >Emitted(22, 37) Source(39, 16) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -336,8 +331,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(25, 21) Source(40, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -2 >Emitted(25, 22) Source(40, 4) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +1 >Emitted(23, 21) Source(40, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +2 >Emitted(23, 22) Source(40, 4) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) --- >>> return StartFindAction; 1->^^^^^^^^^^^^^^^^^^^^ @@ -345,8 +340,8 @@ sourceFile:recursiveClassReferenceTest.ts 1-> > 2 > } -1->Emitted(26, 21) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -2 >Emitted(26, 43) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +1->Emitted(24, 21) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +2 >Emitted(24, 43) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) --- >>> })(); 1 >^^^^^^^^^^^^^^^^ @@ -366,10 +361,10 @@ sourceFile:recursiveClassReferenceTest.ts > return true; > } > } -1 >Emitted(27, 17) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -2 >Emitted(27, 18) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -3 >Emitted(27, 18) Source(33, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find) -4 >Emitted(27, 22) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) +1 >Emitted(25, 17) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +2 >Emitted(25, 18) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +3 >Emitted(25, 18) Source(33, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find) +4 >Emitted(25, 22) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) --- >>> Find.StartFindAction = StartFindAction; 1->^^^^^^^^^^^^^^^^ @@ -377,7 +372,7 @@ sourceFile:recursiveClassReferenceTest.ts 3 > ^^^ 4 > ^^^^^^^^^^^^^^^ 5 > ^ -6 > ^^^-> +6 > ^^^^^^^-> 1-> 2 > StartFindAction 3 > @@ -391,23 +386,22 @@ sourceFile:recursiveClassReferenceTest.ts > } > } 5 > -1->Emitted(28, 17) Source(33, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find) -2 >Emitted(28, 37) Source(33, 30) + SourceIndex(0) name (Sample.Actions.Thing.Find) -3 >Emitted(28, 40) Source(33, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find) -4 >Emitted(28, 55) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) -5 >Emitted(28, 56) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) +1->Emitted(26, 17) Source(33, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find) +2 >Emitted(26, 37) Source(33, 30) + SourceIndex(0) name (Sample.Actions.Thing.Find) +3 >Emitted(26, 40) Source(33, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find) +4 >Emitted(26, 55) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) +5 >Emitted(26, 56) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) --- ->>> })(Find = _Thing.Find || (_Thing.Find = {})); +>>> })(Find = _Thing_1.Find || (_Thing_1.Find = {})); 1->^^^^^^^^^^^^ 2 > ^ 3 > ^^ 4 > ^^^^ 5 > ^^^ -6 > ^^^^^^^^^^^ -7 > ^^^^^ -8 > ^^^^^^^^^^^ -9 > ^^^^^^^^ -10> ^^-> +6 > ^^^^^^^^^^^^^ +7 > ^^^^^ +8 > ^^^^^^^^^^^^^ +9 > ^^^^^^^^ 1-> > 2 > } @@ -415,31 +409,31 @@ sourceFile:recursiveClassReferenceTest.ts 4 > Find 5 > 6 > Find -7 > -8 > Find -9 > { - > export class StartFindAction implements Sample.Thing.IAction { - > - > public getId() { return "yo"; } - > - > public run(Thing:Sample.Thing.ICodeThing):boolean { - > - > return true; - > } - > } - > } -1->Emitted(29, 13) Source(42, 1) + SourceIndex(0) name (Sample.Actions.Thing.Find) -2 >Emitted(29, 14) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find) -3 >Emitted(29, 16) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) -4 >Emitted(29, 20) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) -5 >Emitted(29, 23) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) -6 >Emitted(29, 34) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) -7 >Emitted(29, 39) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) -8 >Emitted(29, 50) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) -9 >Emitted(29, 58) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing) +7 > +8 > Find +9 > { + > export class StartFindAction implements Sample.Thing.IAction { + > + > public getId() { return "yo"; } + > + > public run(Thing:Sample.Thing.ICodeThing):boolean { + > + > return true; + > } + > } + > } +1->Emitted(27, 13) Source(42, 1) + SourceIndex(0) name (Sample.Actions.Thing.Find) +2 >Emitted(27, 14) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find) +3 >Emitted(27, 16) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) +4 >Emitted(27, 20) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) +5 >Emitted(27, 23) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) +6 >Emitted(27, 36) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) +7 >Emitted(27, 41) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) +8 >Emitted(27, 54) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) +9 >Emitted(27, 62) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing) --- >>> })(Thing = Actions.Thing || (Actions.Thing = {})); -1->^^^^^^^^ +1 >^^^^^^^^ 2 > ^ 3 > ^^ 4 > ^^^^^ @@ -449,7 +443,7 @@ sourceFile:recursiveClassReferenceTest.ts 8 > ^^^^^^^^^^^^^ 9 > ^^^^^^^^ 10> ^-> -1-> +1 > 2 > } 3 > 4 > Thing @@ -468,15 +462,15 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1->Emitted(30, 9) Source(42, 1) + SourceIndex(0) name (Sample.Actions.Thing) -2 >Emitted(30, 10) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing) -3 >Emitted(30, 12) Source(32, 23) + SourceIndex(0) name (Sample.Actions) -4 >Emitted(30, 17) Source(32, 28) + SourceIndex(0) name (Sample.Actions) -5 >Emitted(30, 20) Source(32, 23) + SourceIndex(0) name (Sample.Actions) -6 >Emitted(30, 33) Source(32, 28) + SourceIndex(0) name (Sample.Actions) -7 >Emitted(30, 38) Source(32, 23) + SourceIndex(0) name (Sample.Actions) -8 >Emitted(30, 51) Source(32, 28) + SourceIndex(0) name (Sample.Actions) -9 >Emitted(30, 59) Source(42, 2) + SourceIndex(0) name (Sample.Actions) +1 >Emitted(28, 9) Source(42, 1) + SourceIndex(0) name (Sample.Actions.Thing) +2 >Emitted(28, 10) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing) +3 >Emitted(28, 12) Source(32, 23) + SourceIndex(0) name (Sample.Actions) +4 >Emitted(28, 17) Source(32, 28) + SourceIndex(0) name (Sample.Actions) +5 >Emitted(28, 20) Source(32, 23) + SourceIndex(0) name (Sample.Actions) +6 >Emitted(28, 33) Source(32, 28) + SourceIndex(0) name (Sample.Actions) +7 >Emitted(28, 38) Source(32, 23) + SourceIndex(0) name (Sample.Actions) +8 >Emitted(28, 51) Source(32, 28) + SourceIndex(0) name (Sample.Actions) +9 >Emitted(28, 59) Source(42, 2) + SourceIndex(0) name (Sample.Actions) --- >>> })(Actions = Sample.Actions || (Sample.Actions = {})); 1->^^^^ @@ -507,15 +501,15 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1->Emitted(31, 5) Source(42, 1) + SourceIndex(0) name (Sample.Actions) -2 >Emitted(31, 6) Source(42, 2) + SourceIndex(0) name (Sample.Actions) -3 >Emitted(31, 8) Source(32, 15) + SourceIndex(0) name (Sample) -4 >Emitted(31, 15) Source(32, 22) + SourceIndex(0) name (Sample) -5 >Emitted(31, 18) Source(32, 15) + SourceIndex(0) name (Sample) -6 >Emitted(31, 32) Source(32, 22) + SourceIndex(0) name (Sample) -7 >Emitted(31, 37) Source(32, 15) + SourceIndex(0) name (Sample) -8 >Emitted(31, 51) Source(32, 22) + SourceIndex(0) name (Sample) -9 >Emitted(31, 59) Source(42, 2) + SourceIndex(0) name (Sample) +1->Emitted(29, 5) Source(42, 1) + SourceIndex(0) name (Sample.Actions) +2 >Emitted(29, 6) Source(42, 2) + SourceIndex(0) name (Sample.Actions) +3 >Emitted(29, 8) Source(32, 15) + SourceIndex(0) name (Sample) +4 >Emitted(29, 15) Source(32, 22) + SourceIndex(0) name (Sample) +5 >Emitted(29, 18) Source(32, 15) + SourceIndex(0) name (Sample) +6 >Emitted(29, 32) Source(32, 22) + SourceIndex(0) name (Sample) +7 >Emitted(29, 37) Source(32, 15) + SourceIndex(0) name (Sample) +8 >Emitted(29, 51) Source(32, 22) + SourceIndex(0) name (Sample) +9 >Emitted(29, 59) Source(42, 2) + SourceIndex(0) name (Sample) --- >>>})(Sample || (Sample = {})); 1 > @@ -542,13 +536,13 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1 >Emitted(32, 1) Source(42, 1) + SourceIndex(0) name (Sample) -2 >Emitted(32, 2) Source(42, 2) + SourceIndex(0) name (Sample) -3 >Emitted(32, 4) Source(32, 8) + SourceIndex(0) -4 >Emitted(32, 10) Source(32, 14) + SourceIndex(0) -5 >Emitted(32, 15) Source(32, 8) + SourceIndex(0) -6 >Emitted(32, 21) Source(32, 14) + SourceIndex(0) -7 >Emitted(32, 29) Source(42, 2) + SourceIndex(0) +1 >Emitted(30, 1) Source(42, 1) + SourceIndex(0) name (Sample) +2 >Emitted(30, 2) Source(42, 2) + SourceIndex(0) name (Sample) +3 >Emitted(30, 4) Source(32, 8) + SourceIndex(0) +4 >Emitted(30, 10) Source(32, 14) + SourceIndex(0) +5 >Emitted(30, 15) Source(32, 8) + SourceIndex(0) +6 >Emitted(30, 21) Source(32, 14) + SourceIndex(0) +7 >Emitted(30, 29) Source(42, 2) + SourceIndex(0) --- >>>var Sample; 1 > @@ -582,10 +576,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(33, 1) Source(44, 1) + SourceIndex(0) -2 >Emitted(33, 5) Source(44, 8) + SourceIndex(0) -3 >Emitted(33, 11) Source(44, 14) + SourceIndex(0) -4 >Emitted(33, 12) Source(64, 2) + SourceIndex(0) +1 >Emitted(31, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(31, 5) Source(44, 8) + SourceIndex(0) +3 >Emitted(31, 11) Source(44, 14) + SourceIndex(0) +4 >Emitted(31, 12) Source(64, 2) + SourceIndex(0) --- >>>(function (Sample) { 1-> @@ -594,9 +588,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 >module 3 > Sample -1->Emitted(34, 1) Source(44, 1) + SourceIndex(0) -2 >Emitted(34, 12) Source(44, 8) + SourceIndex(0) -3 >Emitted(34, 18) Source(44, 14) + SourceIndex(0) +1->Emitted(32, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(32, 12) Source(44, 8) + SourceIndex(0) +3 >Emitted(32, 18) Source(44, 14) + SourceIndex(0) --- >>> var Thing; 1 >^^^^ @@ -628,10 +622,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(35, 5) Source(44, 15) + SourceIndex(0) name (Sample) -2 >Emitted(35, 9) Source(44, 15) + SourceIndex(0) name (Sample) -3 >Emitted(35, 14) Source(44, 20) + SourceIndex(0) name (Sample) -4 >Emitted(35, 15) Source(64, 2) + SourceIndex(0) name (Sample) +1 >Emitted(33, 5) Source(44, 15) + SourceIndex(0) name (Sample) +2 >Emitted(33, 9) Source(44, 15) + SourceIndex(0) name (Sample) +3 >Emitted(33, 14) Source(44, 20) + SourceIndex(0) name (Sample) +4 >Emitted(33, 15) Source(64, 2) + SourceIndex(0) name (Sample) --- >>> (function (Thing) { 1->^^^^ @@ -641,9 +635,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Thing -1->Emitted(36, 5) Source(44, 15) + SourceIndex(0) name (Sample) -2 >Emitted(36, 16) Source(44, 15) + SourceIndex(0) name (Sample) -3 >Emitted(36, 21) Source(44, 20) + SourceIndex(0) name (Sample) +1->Emitted(34, 5) Source(44, 15) + SourceIndex(0) name (Sample) +2 >Emitted(34, 16) Source(44, 15) + SourceIndex(0) name (Sample) +3 >Emitted(34, 21) Source(44, 20) + SourceIndex(0) name (Sample) --- >>> var Widgets; 1->^^^^^^^^ @@ -675,10 +669,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(37, 9) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(37, 13) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(37, 20) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(37, 21) Source(64, 2) + SourceIndex(0) name (Sample.Thing) +1->Emitted(35, 9) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(35, 13) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(35, 20) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(35, 21) Source(64, 2) + SourceIndex(0) name (Sample.Thing) --- >>> (function (Widgets) { 1->^^^^^^^^ @@ -692,11 +686,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > Widgets 4 > 5 > { -1->Emitted(38, 9) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(38, 20) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(38, 27) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(38, 29) Source(44, 29) + SourceIndex(0) name (Sample.Thing) -5 >Emitted(38, 30) Source(44, 30) + SourceIndex(0) name (Sample.Thing) +1->Emitted(36, 9) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(36, 20) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(36, 27) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(36, 29) Source(44, 29) + SourceIndex(0) name (Sample.Thing) +5 >Emitted(36, 30) Source(44, 30) + SourceIndex(0) name (Sample.Thing) --- >>> var FindWidget = (function () { 1->^^^^^^^^^^^^ @@ -707,9 +701,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > export class 3 > FindWidget -1->Emitted(39, 13) Source(45, 2) + SourceIndex(0) name (Sample.Thing.Widgets) -2 >Emitted(39, 17) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) -3 >Emitted(39, 27) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets) +1->Emitted(37, 13) Source(45, 2) + SourceIndex(0) name (Sample.Thing.Widgets) +2 >Emitted(37, 17) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) +3 >Emitted(37, 27) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets) --- >>> function FindWidget(codeThing) { 1->^^^^^^^^^^^^^^^^ @@ -733,11 +727,11 @@ sourceFile:recursiveClassReferenceTest.ts > private domNode:any = null; > constructor(private 5 > codeThing: Sample.Thing.ICodeThing -1->Emitted(40, 17) Source(50, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(40, 26) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(40, 36) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -4 >Emitted(40, 37) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -5 >Emitted(40, 46) Source(50, 57) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +1->Emitted(38, 17) Source(50, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(38, 26) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(38, 36) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +4 >Emitted(38, 37) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +5 >Emitted(38, 46) Source(50, 57) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) --- >>> this.codeThing = codeThing; 1->^^^^^^^^^^^^^^^^^^^^ @@ -750,11 +744,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > codeThing 5 > : Sample.Thing.ICodeThing -1->Emitted(41, 21) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(41, 35) Source(50, 32) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -3 >Emitted(41, 38) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -4 >Emitted(41, 47) Source(50, 32) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -5 >Emitted(41, 48) Source(50, 57) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1->Emitted(39, 21) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(39, 35) Source(50, 32) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +3 >Emitted(39, 38) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +4 >Emitted(39, 47) Source(50, 32) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +5 >Emitted(39, 48) Source(50, 57) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- >>> this.domNode = null; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -767,11 +761,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > :any = 4 > null 5 > ; -1 >Emitted(42, 21) Source(49, 11) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(42, 33) Source(49, 18) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -3 >Emitted(42, 36) Source(49, 25) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -4 >Emitted(42, 40) Source(49, 29) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -5 >Emitted(42, 41) Source(49, 30) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1 >Emitted(40, 21) Source(49, 11) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(40, 33) Source(49, 18) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +3 >Emitted(40, 36) Source(49, 25) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +4 >Emitted(40, 40) Source(49, 29) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +5 >Emitted(40, 41) Source(49, 30) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- >>> // scenario 1 1 >^^^^^^^^^^^^^^^^^^^^ @@ -784,9 +778,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > 3 > // scenario 1 -1 >Emitted(43, 21) Source(52, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(43, 21) Source(51, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -3 >Emitted(43, 34) Source(51, 20) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1 >Emitted(41, 21) Source(52, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(41, 21) Source(51, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +3 >Emitted(41, 34) Source(51, 20) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- >>> codeThing.addWidget("addWidget", this); 1->^^^^^^^^^^^^^^^^^^^^ @@ -810,113 +804,108 @@ sourceFile:recursiveClassReferenceTest.ts 8 > this 9 > ) 10> ; -1->Emitted(44, 21) Source(52, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(44, 30) Source(52, 16) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -3 >Emitted(44, 31) Source(52, 17) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -4 >Emitted(44, 40) Source(52, 26) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -5 >Emitted(44, 41) Source(52, 27) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -6 >Emitted(44, 52) Source(52, 38) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -7 >Emitted(44, 54) Source(52, 40) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -8 >Emitted(44, 58) Source(52, 44) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -9 >Emitted(44, 59) Source(52, 45) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -10>Emitted(44, 60) Source(52, 46) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1->Emitted(42, 21) Source(52, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(42, 30) Source(52, 16) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +3 >Emitted(42, 31) Source(52, 17) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +4 >Emitted(42, 40) Source(52, 26) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +5 >Emitted(42, 41) Source(52, 27) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +6 >Emitted(42, 52) Source(52, 38) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +7 >Emitted(42, 54) Source(52, 40) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +8 >Emitted(42, 58) Source(52, 44) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +9 >Emitted(42, 59) Source(52, 45) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +10>Emitted(42, 60) Source(52, 46) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- >>> } 1 >^^^^^^^^^^^^^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 > } -1 >Emitted(45, 17) Source(53, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(45, 18) Source(53, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1 >Emitted(43, 17) Source(53, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(43, 18) Source(53, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- ->>> FindWidget.prototype.gar = function (runner) { +>>> FindWidget.prototype.gar = function (runner) { if (true) { 1->^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ 4 > ^^^^^^^^^^ 5 > ^^^^^^ +6 > ^^^^ +7 > ^^ +8 > ^ +9 > ^ +10> ^^^^ +11> ^ +12> ^ +13> ^ 1-> 2 > gar 3 > 4 > public gar( 5 > runner:(widget:Sample.Thing.IWidget)=>any -1->Emitted(46, 17) Source(47, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(46, 41) Source(47, 13) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(46, 44) Source(47, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -4 >Emitted(46, 54) Source(47, 14) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -5 >Emitted(46, 60) Source(47, 55) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +6 > ) { +7 > if +8 > +9 > ( +10> true +11> ) +12> +13> { +1->Emitted(44, 17) Source(47, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(44, 41) Source(47, 13) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(44, 44) Source(47, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +4 >Emitted(44, 54) Source(47, 14) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +5 >Emitted(44, 60) Source(47, 55) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +6 >Emitted(44, 64) Source(47, 59) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +7 >Emitted(44, 66) Source(47, 61) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +8 >Emitted(44, 67) Source(47, 62) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +9 >Emitted(44, 68) Source(47, 63) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +10>Emitted(44, 72) Source(47, 67) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +11>Emitted(44, 73) Source(47, 68) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +12>Emitted(44, 74) Source(47, 69) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +13>Emitted(44, 75) Source(47, 70) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) --- ->>> if (true) { +>>> return runner(this); 1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^^ -3 > ^ -4 > ^ -5 > ^^^^ -6 > ^ -7 > ^ -8 > ^ -9 > ^^^^^^^^^^^^^^-> -1 >) { -2 > if -3 > -4 > ( -5 > true -6 > ) -7 > -8 > { -1 >Emitted(47, 21) Source(47, 59) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -2 >Emitted(47, 23) Source(47, 61) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -3 >Emitted(47, 24) Source(47, 62) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -4 >Emitted(47, 25) Source(47, 63) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -5 >Emitted(47, 29) Source(47, 67) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -6 >Emitted(47, 30) Source(47, 68) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -7 >Emitted(47, 31) Source(47, 69) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -8 >Emitted(47, 32) Source(47, 70) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) ---- ->>> return runner(this); -1->^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^ -5 > ^ -6 > ^^^^ -7 > ^ -8 > ^ -1-> -2 > return -3 > -4 > runner -5 > ( -6 > this -7 > ) -8 > ; -1->Emitted(48, 25) Source(47, 70) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -2 >Emitted(48, 31) Source(47, 76) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -3 >Emitted(48, 32) Source(47, 77) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -4 >Emitted(48, 38) Source(47, 83) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -5 >Emitted(48, 39) Source(47, 84) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -6 >Emitted(48, 43) Source(47, 88) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -7 >Emitted(48, 44) Source(47, 89) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -8 >Emitted(48, 45) Source(47, 90) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) ---- ->>> } -1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^^^^ +7 > ^ +8 > ^ 1 > -2 > } -1 >Emitted(49, 21) Source(47, 90) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -2 >Emitted(49, 22) Source(47, 91) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +2 > return +3 > +4 > runner +5 > ( +6 > this +7 > ) +8 > ; +1 >Emitted(45, 21) Source(47, 70) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +2 >Emitted(45, 27) Source(47, 76) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +3 >Emitted(45, 28) Source(47, 77) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +4 >Emitted(45, 34) Source(47, 83) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +5 >Emitted(45, 35) Source(47, 84) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +6 >Emitted(45, 39) Source(47, 88) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +7 >Emitted(45, 40) Source(47, 89) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +8 >Emitted(45, 41) Source(47, 90) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) --- ->>> }; +>>> } }; 1 >^^^^^^^^^^^^^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 > } -1 >Emitted(50, 17) Source(47, 91) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -2 >Emitted(50, 18) Source(47, 92) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +3 > +4 > } +1 >Emitted(46, 17) Source(47, 90) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +2 >Emitted(46, 18) Source(47, 91) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +3 >Emitted(46, 19) Source(47, 91) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +4 >Emitted(46, 20) Source(47, 92) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) --- >>> FindWidget.prototype.getDomNode = function () { 1->^^^^^^^^^^^^^^^^ @@ -933,9 +922,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > getDomNode 3 > -1->Emitted(51, 17) Source(55, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(51, 48) Source(55, 20) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(51, 51) Source(55, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +1->Emitted(47, 17) Source(55, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(47, 48) Source(55, 20) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(47, 51) Source(55, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) --- >>> return domNode; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -949,11 +938,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > domNode 5 > ; -1 >Emitted(52, 21) Source(56, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -2 >Emitted(52, 27) Source(56, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -3 >Emitted(52, 28) Source(56, 11) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -4 >Emitted(52, 35) Source(56, 18) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -5 >Emitted(52, 36) Source(56, 19) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +1 >Emitted(48, 21) Source(56, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +2 >Emitted(48, 27) Source(56, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +3 >Emitted(48, 28) Source(56, 11) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +4 >Emitted(48, 35) Source(56, 18) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +5 >Emitted(48, 36) Source(56, 19) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) --- >>> }; 1 >^^^^^^^^^^^^^^^^ @@ -962,8 +951,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(53, 17) Source(57, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -2 >Emitted(53, 18) Source(57, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +1 >Emitted(49, 17) Source(57, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +2 >Emitted(49, 18) Source(57, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) --- >>> FindWidget.prototype.destroy = function () { 1->^^^^^^^^^^^^^^^^ @@ -974,9 +963,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > destroy 3 > -1->Emitted(54, 17) Source(59, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(54, 45) Source(59, 17) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(54, 48) Source(59, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +1->Emitted(50, 17) Source(59, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(50, 45) Source(59, 17) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(50, 48) Source(59, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) --- >>> }; 1 >^^^^^^^^^^^^^^^^ @@ -986,8 +975,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1 >Emitted(55, 17) Source(61, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) -2 >Emitted(55, 18) Source(61, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) +1 >Emitted(51, 17) Source(61, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) +2 >Emitted(51, 18) Source(61, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) --- >>> return FindWidget; 1->^^^^^^^^^^^^^^^^ @@ -996,8 +985,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1->Emitted(56, 17) Source(63, 2) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(56, 34) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +1->Emitted(52, 17) Source(63, 2) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(52, 34) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) --- >>> })(); 1 >^^^^^^^^^^^^ @@ -1027,10 +1016,10 @@ sourceFile:recursiveClassReferenceTest.ts > } > > } -1 >Emitted(57, 13) Source(63, 2) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(57, 14) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(57, 14) Source(45, 2) + SourceIndex(0) name (Sample.Thing.Widgets) -4 >Emitted(57, 18) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) +1 >Emitted(53, 13) Source(63, 2) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(53, 14) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(53, 14) Source(45, 2) + SourceIndex(0) name (Sample.Thing.Widgets) +4 >Emitted(53, 18) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) --- >>> Widgets.FindWidget = FindWidget; 1->^^^^^^^^^^^^ @@ -1062,11 +1051,11 @@ sourceFile:recursiveClassReferenceTest.ts > > } 5 > -1->Emitted(58, 13) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) -2 >Emitted(58, 31) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets) -3 >Emitted(58, 34) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) -4 >Emitted(58, 44) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) -5 >Emitted(58, 45) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) +1->Emitted(54, 13) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) +2 >Emitted(54, 31) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets) +3 >Emitted(54, 34) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) +4 >Emitted(54, 44) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) +5 >Emitted(54, 45) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) --- >>> })(Widgets = Thing.Widgets || (Thing.Widgets = {})); 1->^^^^^^^^ @@ -1108,15 +1097,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(59, 9) Source(64, 1) + SourceIndex(0) name (Sample.Thing.Widgets) -2 >Emitted(59, 10) Source(64, 2) + SourceIndex(0) name (Sample.Thing.Widgets) -3 >Emitted(59, 12) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(59, 19) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -5 >Emitted(59, 22) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -6 >Emitted(59, 35) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -7 >Emitted(59, 40) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -8 >Emitted(59, 53) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -9 >Emitted(59, 61) Source(64, 2) + SourceIndex(0) name (Sample.Thing) +1->Emitted(55, 9) Source(64, 1) + SourceIndex(0) name (Sample.Thing.Widgets) +2 >Emitted(55, 10) Source(64, 2) + SourceIndex(0) name (Sample.Thing.Widgets) +3 >Emitted(55, 12) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(55, 19) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +5 >Emitted(55, 22) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +6 >Emitted(55, 35) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +7 >Emitted(55, 40) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +8 >Emitted(55, 53) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +9 >Emitted(55, 61) Source(64, 2) + SourceIndex(0) name (Sample.Thing) --- >>> })(Thing = Sample.Thing || (Sample.Thing = {})); 1 >^^^^ @@ -1157,15 +1146,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(60, 5) Source(64, 1) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(60, 6) Source(64, 2) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(60, 8) Source(44, 15) + SourceIndex(0) name (Sample) -4 >Emitted(60, 13) Source(44, 20) + SourceIndex(0) name (Sample) -5 >Emitted(60, 16) Source(44, 15) + SourceIndex(0) name (Sample) -6 >Emitted(60, 28) Source(44, 20) + SourceIndex(0) name (Sample) -7 >Emitted(60, 33) Source(44, 15) + SourceIndex(0) name (Sample) -8 >Emitted(60, 45) Source(44, 20) + SourceIndex(0) name (Sample) -9 >Emitted(60, 53) Source(64, 2) + SourceIndex(0) name (Sample) +1 >Emitted(56, 5) Source(64, 1) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(56, 6) Source(64, 2) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(56, 8) Source(44, 15) + SourceIndex(0) name (Sample) +4 >Emitted(56, 13) Source(44, 20) + SourceIndex(0) name (Sample) +5 >Emitted(56, 16) Source(44, 15) + SourceIndex(0) name (Sample) +6 >Emitted(56, 28) Source(44, 20) + SourceIndex(0) name (Sample) +7 >Emitted(56, 33) Source(44, 15) + SourceIndex(0) name (Sample) +8 >Emitted(56, 45) Source(44, 20) + SourceIndex(0) name (Sample) +9 >Emitted(56, 53) Source(64, 2) + SourceIndex(0) name (Sample) --- >>>})(Sample || (Sample = {})); 1 > @@ -1203,13 +1192,13 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(61, 1) Source(64, 1) + SourceIndex(0) name (Sample) -2 >Emitted(61, 2) Source(64, 2) + SourceIndex(0) name (Sample) -3 >Emitted(61, 4) Source(44, 8) + SourceIndex(0) -4 >Emitted(61, 10) Source(44, 14) + SourceIndex(0) -5 >Emitted(61, 15) Source(44, 8) + SourceIndex(0) -6 >Emitted(61, 21) Source(44, 14) + SourceIndex(0) -7 >Emitted(61, 29) Source(64, 2) + SourceIndex(0) +1 >Emitted(57, 1) Source(64, 1) + SourceIndex(0) name (Sample) +2 >Emitted(57, 2) Source(64, 2) + SourceIndex(0) name (Sample) +3 >Emitted(57, 4) Source(44, 8) + SourceIndex(0) +4 >Emitted(57, 10) Source(44, 14) + SourceIndex(0) +5 >Emitted(57, 15) Source(44, 8) + SourceIndex(0) +6 >Emitted(57, 21) Source(44, 14) + SourceIndex(0) +7 >Emitted(57, 29) Source(64, 2) + SourceIndex(0) --- >>>var AbstractMode = (function () { 1-> @@ -1222,9 +1211,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 >class 3 > AbstractMode -1->Emitted(62, 1) Source(67, 1) + SourceIndex(0) -2 >Emitted(62, 5) Source(67, 7) + SourceIndex(0) -3 >Emitted(62, 17) Source(67, 19) + SourceIndex(0) +1->Emitted(58, 1) Source(67, 1) + SourceIndex(0) +2 >Emitted(58, 5) Source(67, 7) + SourceIndex(0) +3 >Emitted(58, 17) Source(67, 19) + SourceIndex(0) --- >>> function AbstractMode() { 1->^^^^ @@ -1233,63 +1222,58 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > class 3 > AbstractMode -1->Emitted(63, 5) Source(67, 1) + SourceIndex(0) name (AbstractMode) -2 >Emitted(63, 14) Source(67, 7) + SourceIndex(0) name (AbstractMode) -3 >Emitted(63, 26) Source(67, 19) + SourceIndex(0) name (AbstractMode) +1->Emitted(59, 5) Source(67, 1) + SourceIndex(0) name (AbstractMode) +2 >Emitted(59, 14) Source(67, 7) + SourceIndex(0) name (AbstractMode) +3 >Emitted(59, 26) Source(67, 19) + SourceIndex(0) name (AbstractMode) --- >>> } 1 >^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > implements IMode { public getInitialState(): IState { return null;} 2 > } -1 >Emitted(64, 5) Source(67, 88) + SourceIndex(0) name (AbstractMode.constructor) -2 >Emitted(64, 6) Source(67, 89) + SourceIndex(0) name (AbstractMode.constructor) +1 >Emitted(60, 5) Source(67, 88) + SourceIndex(0) name (AbstractMode.constructor) +2 >Emitted(60, 6) Source(67, 89) + SourceIndex(0) name (AbstractMode.constructor) --- ->>> AbstractMode.prototype.getInitialState = function () { +>>> AbstractMode.prototype.getInitialState = function () { return null; }; 1->^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^ +10> ^ 1-> 2 > getInitialState 3 > -1->Emitted(65, 5) Source(67, 46) + SourceIndex(0) name (AbstractMode) -2 >Emitted(65, 43) Source(67, 61) + SourceIndex(0) name (AbstractMode) -3 >Emitted(65, 46) Source(67, 39) + SourceIndex(0) name (AbstractMode) ---- ->>> return null; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^ -1 >public getInitialState(): IState { -2 > return -3 > -4 > null -5 > ; -1 >Emitted(66, 9) Source(67, 74) + SourceIndex(0) name (AbstractMode.getInitialState) -2 >Emitted(66, 15) Source(67, 80) + SourceIndex(0) name (AbstractMode.getInitialState) -3 >Emitted(66, 16) Source(67, 81) + SourceIndex(0) name (AbstractMode.getInitialState) -4 >Emitted(66, 20) Source(67, 85) + SourceIndex(0) name (AbstractMode.getInitialState) -5 >Emitted(66, 21) Source(67, 86) + SourceIndex(0) name (AbstractMode.getInitialState) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -1 >Emitted(67, 5) Source(67, 86) + SourceIndex(0) name (AbstractMode.getInitialState) -2 >Emitted(67, 6) Source(67, 87) + SourceIndex(0) name (AbstractMode.getInitialState) +4 > public getInitialState(): IState { +5 > return +6 > +7 > null +8 > ; +9 > +10> } +1->Emitted(61, 5) Source(67, 46) + SourceIndex(0) name (AbstractMode) +2 >Emitted(61, 43) Source(67, 61) + SourceIndex(0) name (AbstractMode) +3 >Emitted(61, 46) Source(67, 39) + SourceIndex(0) name (AbstractMode) +4 >Emitted(61, 60) Source(67, 74) + SourceIndex(0) name (AbstractMode.getInitialState) +5 >Emitted(61, 66) Source(67, 80) + SourceIndex(0) name (AbstractMode.getInitialState) +6 >Emitted(61, 67) Source(67, 81) + SourceIndex(0) name (AbstractMode.getInitialState) +7 >Emitted(61, 71) Source(67, 85) + SourceIndex(0) name (AbstractMode.getInitialState) +8 >Emitted(61, 72) Source(67, 86) + SourceIndex(0) name (AbstractMode.getInitialState) +9 >Emitted(61, 73) Source(67, 86) + SourceIndex(0) name (AbstractMode.getInitialState) +10>Emitted(61, 74) Source(67, 87) + SourceIndex(0) name (AbstractMode.getInitialState) --- >>> return AbstractMode; -1->^^^^ +1 >^^^^ 2 > ^^^^^^^^^^^^^^^^^^^ -1-> +1 > 2 > } -1->Emitted(68, 5) Source(67, 88) + SourceIndex(0) name (AbstractMode) -2 >Emitted(68, 24) Source(67, 89) + SourceIndex(0) name (AbstractMode) +1 >Emitted(62, 5) Source(67, 88) + SourceIndex(0) name (AbstractMode) +2 >Emitted(62, 24) Source(67, 89) + SourceIndex(0) name (AbstractMode) --- >>>})(); 1 > @@ -1301,10 +1285,10 @@ sourceFile:recursiveClassReferenceTest.ts 2 >} 3 > 4 > class AbstractMode implements IMode { public getInitialState(): IState { return null;} } -1 >Emitted(69, 1) Source(67, 88) + SourceIndex(0) name (AbstractMode) -2 >Emitted(69, 2) Source(67, 89) + SourceIndex(0) name (AbstractMode) -3 >Emitted(69, 2) Source(67, 1) + SourceIndex(0) -4 >Emitted(69, 6) Source(67, 89) + SourceIndex(0) +1 >Emitted(63, 1) Source(67, 88) + SourceIndex(0) name (AbstractMode) +2 >Emitted(63, 2) Source(67, 89) + SourceIndex(0) name (AbstractMode) +3 >Emitted(63, 2) Source(67, 1) + SourceIndex(0) +4 >Emitted(63, 6) Source(67, 89) + SourceIndex(0) --- >>>var Sample; 1-> @@ -1349,10 +1333,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(70, 1) Source(76, 1) + SourceIndex(0) -2 >Emitted(70, 5) Source(76, 8) + SourceIndex(0) -3 >Emitted(70, 11) Source(76, 14) + SourceIndex(0) -4 >Emitted(70, 12) Source(100, 2) + SourceIndex(0) +1->Emitted(64, 1) Source(76, 1) + SourceIndex(0) +2 >Emitted(64, 5) Source(76, 8) + SourceIndex(0) +3 >Emitted(64, 11) Source(76, 14) + SourceIndex(0) +4 >Emitted(64, 12) Source(100, 2) + SourceIndex(0) --- >>>(function (Sample) { 1-> @@ -1361,9 +1345,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 >module 3 > Sample -1->Emitted(71, 1) Source(76, 1) + SourceIndex(0) -2 >Emitted(71, 12) Source(76, 8) + SourceIndex(0) -3 >Emitted(71, 18) Source(76, 14) + SourceIndex(0) +1->Emitted(65, 1) Source(76, 1) + SourceIndex(0) +2 >Emitted(65, 12) Source(76, 8) + SourceIndex(0) +3 >Emitted(65, 18) Source(76, 14) + SourceIndex(0) --- >>> var Thing; 1 >^^^^ @@ -1399,10 +1383,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(72, 5) Source(76, 15) + SourceIndex(0) name (Sample) -2 >Emitted(72, 9) Source(76, 15) + SourceIndex(0) name (Sample) -3 >Emitted(72, 14) Source(76, 20) + SourceIndex(0) name (Sample) -4 >Emitted(72, 15) Source(100, 2) + SourceIndex(0) name (Sample) +1 >Emitted(66, 5) Source(76, 15) + SourceIndex(0) name (Sample) +2 >Emitted(66, 9) Source(76, 15) + SourceIndex(0) name (Sample) +3 >Emitted(66, 14) Source(76, 20) + SourceIndex(0) name (Sample) +4 >Emitted(66, 15) Source(100, 2) + SourceIndex(0) name (Sample) --- >>> (function (Thing) { 1->^^^^ @@ -1412,9 +1396,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Thing -1->Emitted(73, 5) Source(76, 15) + SourceIndex(0) name (Sample) -2 >Emitted(73, 16) Source(76, 15) + SourceIndex(0) name (Sample) -3 >Emitted(73, 21) Source(76, 20) + SourceIndex(0) name (Sample) +1->Emitted(67, 5) Source(76, 15) + SourceIndex(0) name (Sample) +2 >Emitted(67, 16) Source(76, 15) + SourceIndex(0) name (Sample) +3 >Emitted(67, 21) Source(76, 20) + SourceIndex(0) name (Sample) --- >>> var Languages; 1->^^^^^^^^ @@ -1450,10 +1434,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(74, 9) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(74, 13) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(74, 22) Source(76, 30) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(74, 23) Source(100, 2) + SourceIndex(0) name (Sample.Thing) +1->Emitted(68, 9) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(68, 13) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(68, 22) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(68, 23) Source(100, 2) + SourceIndex(0) name (Sample.Thing) --- >>> (function (Languages) { 1->^^^^^^^^ @@ -1462,9 +1446,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Languages -1->Emitted(75, 9) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(75, 20) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(75, 29) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +1->Emitted(69, 9) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(69, 20) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(69, 29) Source(76, 30) + SourceIndex(0) name (Sample.Thing) --- >>> var PlainText; 1 >^^^^^^^^^^^^ @@ -1500,10 +1484,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(76, 13) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -2 >Emitted(76, 17) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -3 >Emitted(76, 26) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -4 >Emitted(76, 27) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) +1 >Emitted(70, 13) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +2 >Emitted(70, 17) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +3 >Emitted(70, 26) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +4 >Emitted(70, 27) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) --- >>> (function (PlainText) { 1->^^^^^^^^^^^^ @@ -1517,11 +1501,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > PlainText 4 > 5 > { -1->Emitted(77, 13) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -2 >Emitted(77, 24) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -3 >Emitted(77, 33) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -4 >Emitted(77, 35) Source(76, 41) + SourceIndex(0) name (Sample.Thing.Languages) -5 >Emitted(77, 36) Source(76, 42) + SourceIndex(0) name (Sample.Thing.Languages) +1->Emitted(71, 13) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +2 >Emitted(71, 24) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +3 >Emitted(71, 33) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +4 >Emitted(71, 35) Source(76, 41) + SourceIndex(0) name (Sample.Thing.Languages) +5 >Emitted(71, 36) Source(76, 42) + SourceIndex(0) name (Sample.Thing.Languages) --- >>> var State = (function () { 1->^^^^^^^^^^^^^^^^ @@ -1533,9 +1517,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > export class 3 > State -1->Emitted(78, 17) Source(78, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(78, 21) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(78, 26) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(72, 17) Source(78, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(72, 21) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(72, 26) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> function State(mode) { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1551,11 +1535,11 @@ sourceFile:recursiveClassReferenceTest.ts 4 > implements IState { > constructor(private 5 > mode: IMode -1->Emitted(79, 21) Source(79, 9) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(79, 30) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(79, 35) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -4 >Emitted(79, 36) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -5 >Emitted(79, 40) Source(79, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +1->Emitted(73, 21) Source(79, 9) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(73, 30) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(73, 35) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +4 >Emitted(73, 36) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +5 >Emitted(73, 40) Source(79, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) --- >>> this.mode = mode; 1->^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1568,11 +1552,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > mode 5 > : IMode -1->Emitted(80, 25) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -2 >Emitted(80, 34) Source(79, 33) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -3 >Emitted(80, 37) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -4 >Emitted(80, 41) Source(79, 33) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -5 >Emitted(80, 42) Source(79, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +1->Emitted(74, 25) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +2 >Emitted(74, 34) Source(79, 33) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +3 >Emitted(74, 37) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +4 >Emitted(74, 41) Source(79, 33) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +5 >Emitted(74, 42) Source(79, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) --- >>> } 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1580,8 +1564,8 @@ sourceFile:recursiveClassReferenceTest.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 >) { 2 > } -1 >Emitted(81, 21) Source(79, 44) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -2 >Emitted(81, 22) Source(79, 45) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +1 >Emitted(75, 21) Source(79, 44) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +2 >Emitted(75, 22) Source(79, 45) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) --- >>> State.prototype.clone = function () { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1591,9 +1575,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > clone 3 > -1->Emitted(82, 21) Source(80, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(82, 42) Source(80, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(82, 45) Source(80, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +1->Emitted(76, 21) Source(80, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(76, 42) Source(80, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(76, 45) Source(80, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) --- >>> return this; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1607,11 +1591,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > this 5 > ; -1 >Emitted(83, 25) Source(81, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -2 >Emitted(83, 31) Source(81, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -3 >Emitted(83, 32) Source(81, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -4 >Emitted(83, 36) Source(81, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -5 >Emitted(83, 37) Source(81, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +1 >Emitted(77, 25) Source(81, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +2 >Emitted(77, 31) Source(81, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +3 >Emitted(77, 32) Source(81, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +4 >Emitted(77, 36) Source(81, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +5 >Emitted(77, 37) Source(81, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1620,8 +1604,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(84, 21) Source(82, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -2 >Emitted(84, 22) Source(82, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +1 >Emitted(78, 21) Source(82, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +2 >Emitted(78, 22) Source(82, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) --- >>> State.prototype.equals = function (other) { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1636,11 +1620,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > public equals( 5 > other:IState -1->Emitted(85, 21) Source(84, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(85, 43) Source(84, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(85, 46) Source(84, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -4 >Emitted(85, 56) Source(84, 17) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -5 >Emitted(85, 61) Source(84, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +1->Emitted(79, 21) Source(84, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(79, 43) Source(84, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(79, 46) Source(84, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +4 >Emitted(79, 56) Source(84, 17) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +5 >Emitted(79, 61) Source(84, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) --- >>> return this === other; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1658,71 +1642,66 @@ sourceFile:recursiveClassReferenceTest.ts 5 > === 6 > other 7 > ; -1 >Emitted(86, 25) Source(85, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -2 >Emitted(86, 31) Source(85, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -3 >Emitted(86, 32) Source(85, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -4 >Emitted(86, 36) Source(85, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -5 >Emitted(86, 41) Source(85, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -6 >Emitted(86, 46) Source(85, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -7 >Emitted(86, 47) Source(85, 26) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +1 >Emitted(80, 25) Source(85, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +2 >Emitted(80, 31) Source(85, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +3 >Emitted(80, 32) Source(85, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +4 >Emitted(80, 36) Source(85, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +5 >Emitted(80, 41) Source(85, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +6 >Emitted(80, 46) Source(85, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +7 >Emitted(80, 47) Source(85, 26) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 > } -1 >Emitted(87, 21) Source(86, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -2 >Emitted(87, 22) Source(86, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +1 >Emitted(81, 21) Source(86, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +2 >Emitted(81, 22) Source(86, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) --- ->>> State.prototype.getMode = function () { +>>> State.prototype.getMode = function () { return mode; }; 1->^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^ +10> ^ 1-> > > public 2 > getMode 3 > -1->Emitted(88, 21) Source(88, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(88, 44) Source(88, 17) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(88, 47) Source(88, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) ---- ->>> return mode; -1 >^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^ -1 >public getMode(): IMode { -2 > return -3 > -4 > mode -5 > ; -1 >Emitted(89, 25) Source(88, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -2 >Emitted(89, 31) Source(88, 35) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -3 >Emitted(89, 32) Source(88, 36) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -4 >Emitted(89, 36) Source(88, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -5 >Emitted(89, 37) Source(88, 41) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) ---- ->>> }; -1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1 > -2 > } -1 >Emitted(90, 21) Source(88, 42) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -2 >Emitted(90, 22) Source(88, 43) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +4 > public getMode(): IMode { +5 > return +6 > +7 > mode +8 > ; +9 > +10> } +1->Emitted(82, 21) Source(88, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(82, 44) Source(88, 17) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(82, 47) Source(88, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +4 >Emitted(82, 61) Source(88, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +5 >Emitted(82, 67) Source(88, 35) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +6 >Emitted(82, 68) Source(88, 36) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +7 >Emitted(82, 72) Source(88, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +8 >Emitted(82, 73) Source(88, 41) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +9 >Emitted(82, 74) Source(88, 42) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +10>Emitted(82, 75) Source(88, 43) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) --- >>> return State; -1->^^^^^^^^^^^^^^^^^^^^ +1 >^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^ -1-> +1 > > 2 > } -1->Emitted(91, 21) Source(89, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(91, 33) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +1 >Emitted(83, 21) Source(89, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(83, 33) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) --- >>> })(); 1 >^^^^^^^^^^^^^^^^ @@ -1745,10 +1724,10 @@ sourceFile:recursiveClassReferenceTest.ts > > public getMode(): IMode { return mode; } > } -1 >Emitted(92, 17) Source(89, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(92, 18) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(92, 18) Source(78, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -4 >Emitted(92, 22) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1 >Emitted(84, 17) Source(89, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(84, 18) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(84, 18) Source(78, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +4 >Emitted(84, 22) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> PlainText.State = State; 1->^^^^^^^^^^^^^^^^ @@ -1773,11 +1752,11 @@ sourceFile:recursiveClassReferenceTest.ts > public getMode(): IMode { return mode; } > } 5 > -1->Emitted(93, 17) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(93, 32) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(93, 35) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -4 >Emitted(93, 40) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -5 >Emitted(93, 41) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(85, 17) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(85, 32) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(85, 35) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +4 >Emitted(85, 40) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +5 >Emitted(85, 41) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> var Mode = (function (_super) { 1->^^^^^^^^^^^^^^^^ @@ -1789,9 +1768,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > export class 3 > Mode -1->Emitted(94, 17) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(94, 21) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(94, 25) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(86, 17) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(86, 21) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(86, 25) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> __extends(Mode, _super); 1->^^^^^^^^^^^^^^^^^^^^ @@ -1802,10 +1781,10 @@ sourceFile:recursiveClassReferenceTest.ts 2 > 3 > Mode 4 > extends AbstractMode -1->Emitted(95, 21) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(95, 31) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -3 >Emitted(95, 35) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -4 >Emitted(95, 45) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1->Emitted(87, 21) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(87, 31) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +3 >Emitted(87, 35) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +4 >Emitted(87, 45) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> function Mode() { 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1815,17 +1794,17 @@ sourceFile:recursiveClassReferenceTest.ts 1 > 2 > export class 3 > Mode -1 >Emitted(96, 21) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(96, 30) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -3 >Emitted(96, 34) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1 >Emitted(88, 21) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(88, 30) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +3 >Emitted(88, 34) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> _super.apply(this, arguments); 1->^^^^^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> extends 2 > AbstractMode -1->Emitted(97, 25) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) -2 >Emitted(97, 55) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) +1->Emitted(89, 25) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) +2 >Emitted(89, 55) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) --- >>> } 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1841,8 +1820,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1 >Emitted(98, 21) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) -2 >Emitted(98, 22) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) +1 >Emitted(90, 21) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) +2 >Emitted(90, 22) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) --- >>> // scenario 2 1->^^^^^^^^^^^^^^^^^^^^ @@ -1850,8 +1829,8 @@ sourceFile:recursiveClassReferenceTest.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> 2 > // scenario 2 -1->Emitted(99, 21) Source(93, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(99, 34) Source(93, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1->Emitted(91, 21) Source(93, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(91, 34) Source(93, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> Mode.prototype.getInitialState = function () { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1861,9 +1840,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > getInitialState 3 > -1->Emitted(100, 21) Source(94, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(100, 51) Source(94, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -3 >Emitted(100, 54) Source(94, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1->Emitted(92, 21) Source(94, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(92, 51) Source(94, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +3 >Emitted(92, 54) Source(94, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> return new State(self); 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1885,15 +1864,15 @@ sourceFile:recursiveClassReferenceTest.ts 7 > self 8 > ) 9 > ; -1 >Emitted(101, 25) Source(95, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -2 >Emitted(101, 31) Source(95, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -3 >Emitted(101, 32) Source(95, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -4 >Emitted(101, 36) Source(95, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -5 >Emitted(101, 41) Source(95, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -6 >Emitted(101, 42) Source(95, 21) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -7 >Emitted(101, 46) Source(95, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -8 >Emitted(101, 47) Source(95, 26) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -9 >Emitted(101, 48) Source(95, 27) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +1 >Emitted(93, 25) Source(95, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +2 >Emitted(93, 31) Source(95, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +3 >Emitted(93, 32) Source(95, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +4 >Emitted(93, 36) Source(95, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +5 >Emitted(93, 41) Source(95, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +6 >Emitted(93, 42) Source(95, 21) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +7 >Emitted(93, 46) Source(95, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +8 >Emitted(93, 47) Source(95, 26) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +9 >Emitted(93, 48) Source(95, 27) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1902,8 +1881,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(102, 21) Source(96, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -2 >Emitted(102, 22) Source(96, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +1 >Emitted(94, 21) Source(96, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +2 >Emitted(94, 22) Source(96, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) --- >>> return Mode; 1->^^^^^^^^^^^^^^^^^^^^ @@ -1914,8 +1893,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1->Emitted(103, 21) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(103, 32) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1->Emitted(95, 21) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(95, 32) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> })(AbstractMode); 1->^^^^^^^^^^^^^^^^ @@ -1939,12 +1918,12 @@ sourceFile:recursiveClassReferenceTest.ts > > > } -1->Emitted(104, 17) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(104, 18) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -3 >Emitted(104, 18) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -4 >Emitted(104, 20) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -5 >Emitted(104, 32) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -6 >Emitted(104, 34) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(96, 17) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(96, 18) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +3 >Emitted(96, 18) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +4 >Emitted(96, 20) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +5 >Emitted(96, 32) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +6 >Emitted(96, 34) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> PlainText.Mode = Mode; 1->^^^^^^^^^^^^^^^^ @@ -1966,11 +1945,11 @@ sourceFile:recursiveClassReferenceTest.ts > > } 5 > -1->Emitted(105, 17) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(105, 31) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(105, 34) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -4 >Emitted(105, 38) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -5 >Emitted(105, 39) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(97, 17) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(97, 31) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(97, 34) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +4 >Emitted(97, 38) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +5 >Emitted(97, 39) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> })(PlainText = Languages.PlainText || (Languages.PlainText = {})); 1->^^^^^^^^^^^^ @@ -2016,15 +1995,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(106, 13) Source(100, 1) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(106, 14) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(106, 16) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -4 >Emitted(106, 25) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -5 >Emitted(106, 28) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -6 >Emitted(106, 47) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -7 >Emitted(106, 52) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -8 >Emitted(106, 71) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -9 >Emitted(106, 79) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) +1->Emitted(98, 13) Source(100, 1) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(98, 14) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(98, 16) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +4 >Emitted(98, 25) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +5 >Emitted(98, 28) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +6 >Emitted(98, 47) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +7 >Emitted(98, 52) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +8 >Emitted(98, 71) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +9 >Emitted(98, 79) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) --- >>> })(Languages = Thing.Languages || (Thing.Languages = {})); 1 >^^^^^^^^ @@ -2069,15 +2048,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(107, 9) Source(100, 1) + SourceIndex(0) name (Sample.Thing.Languages) -2 >Emitted(107, 10) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) -3 >Emitted(107, 12) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(107, 21) Source(76, 30) + SourceIndex(0) name (Sample.Thing) -5 >Emitted(107, 24) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -6 >Emitted(107, 39) Source(76, 30) + SourceIndex(0) name (Sample.Thing) -7 >Emitted(107, 44) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -8 >Emitted(107, 59) Source(76, 30) + SourceIndex(0) name (Sample.Thing) -9 >Emitted(107, 67) Source(100, 2) + SourceIndex(0) name (Sample.Thing) +1 >Emitted(99, 9) Source(100, 1) + SourceIndex(0) name (Sample.Thing.Languages) +2 >Emitted(99, 10) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) +3 >Emitted(99, 12) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(99, 21) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +5 >Emitted(99, 24) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +6 >Emitted(99, 39) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +7 >Emitted(99, 44) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +8 >Emitted(99, 59) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +9 >Emitted(99, 67) Source(100, 2) + SourceIndex(0) name (Sample.Thing) --- >>> })(Thing = Sample.Thing || (Sample.Thing = {})); 1 >^^^^ @@ -2122,15 +2101,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(108, 5) Source(100, 1) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(108, 6) Source(100, 2) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(108, 8) Source(76, 15) + SourceIndex(0) name (Sample) -4 >Emitted(108, 13) Source(76, 20) + SourceIndex(0) name (Sample) -5 >Emitted(108, 16) Source(76, 15) + SourceIndex(0) name (Sample) -6 >Emitted(108, 28) Source(76, 20) + SourceIndex(0) name (Sample) -7 >Emitted(108, 33) Source(76, 15) + SourceIndex(0) name (Sample) -8 >Emitted(108, 45) Source(76, 20) + SourceIndex(0) name (Sample) -9 >Emitted(108, 53) Source(100, 2) + SourceIndex(0) name (Sample) +1 >Emitted(100, 5) Source(100, 1) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(100, 6) Source(100, 2) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(100, 8) Source(76, 15) + SourceIndex(0) name (Sample) +4 >Emitted(100, 13) Source(76, 20) + SourceIndex(0) name (Sample) +5 >Emitted(100, 16) Source(76, 15) + SourceIndex(0) name (Sample) +6 >Emitted(100, 28) Source(76, 20) + SourceIndex(0) name (Sample) +7 >Emitted(100, 33) Source(76, 15) + SourceIndex(0) name (Sample) +8 >Emitted(100, 45) Source(76, 20) + SourceIndex(0) name (Sample) +9 >Emitted(100, 53) Source(100, 2) + SourceIndex(0) name (Sample) --- >>>})(Sample || (Sample = {})); 1 > @@ -2172,12 +2151,12 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(109, 1) Source(100, 1) + SourceIndex(0) name (Sample) -2 >Emitted(109, 2) Source(100, 2) + SourceIndex(0) name (Sample) -3 >Emitted(109, 4) Source(76, 8) + SourceIndex(0) -4 >Emitted(109, 10) Source(76, 14) + SourceIndex(0) -5 >Emitted(109, 15) Source(76, 8) + SourceIndex(0) -6 >Emitted(109, 21) Source(76, 14) + SourceIndex(0) -7 >Emitted(109, 29) Source(100, 2) + SourceIndex(0) +1 >Emitted(101, 1) Source(100, 1) + SourceIndex(0) name (Sample) +2 >Emitted(101, 2) Source(100, 2) + SourceIndex(0) name (Sample) +3 >Emitted(101, 4) Source(76, 8) + SourceIndex(0) +4 >Emitted(101, 10) Source(76, 14) + SourceIndex(0) +5 >Emitted(101, 15) Source(76, 8) + SourceIndex(0) +6 >Emitted(101, 21) Source(76, 14) + SourceIndex(0) +7 >Emitted(101, 29) Source(100, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=recursiveClassReferenceTest.js.map \ No newline at end of file diff --git a/tests/baselines/reference/recursiveFunctionTypes.js b/tests/baselines/reference/recursiveFunctionTypes.js index 1158fb539d0..040c323066d 100644 --- a/tests/baselines/reference/recursiveFunctionTypes.js +++ b/tests/baselines/reference/recursiveFunctionTypes.js @@ -45,9 +45,7 @@ f7(""); // ok (function takes an any param) f7(); // ok //// [recursiveFunctionTypes.js] -function fn() { - return 1; -} +function fn() { return 1; } var x = fn; // error var y = fn; // ok var f; @@ -55,9 +53,7 @@ var g; function f1(d) { } function f2() { } function g2() { } -function f3() { - return f3; -} +function f3() { return f3; } var a = f3; // error var C = (function () { function C() { @@ -68,12 +64,8 @@ var C = (function () { C.g(3); // error var f4; f4 = 3; // error -function f5() { - return f5; -} -function f6(a) { - return f6; -} +function f5() { return f5; } +function f6(a) { return f6; } f6("", 3); // error (arity mismatch) f6(""); // ok (function takes an any param) f6(); // ok diff --git a/tests/baselines/reference/recursiveGetterAccess.js b/tests/baselines/reference/recursiveGetterAccess.js index cf042c2c1a0..1dea2e02d3a 100644 --- a/tests/baselines/reference/recursiveGetterAccess.js +++ b/tests/baselines/reference/recursiveGetterAccess.js @@ -10,9 +10,7 @@ var MyClass = (function () { function MyClass() { } Object.defineProperty(MyClass.prototype, "testProp", { - get: function () { - return this.testProp; - }, + get: function () { return this.testProp; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/recursiveIdenticalOverloadResolution.js b/tests/baselines/reference/recursiveIdenticalOverloadResolution.js index e1ea203ac5b..3c53c2b2a0a 100644 --- a/tests/baselines/reference/recursiveIdenticalOverloadResolution.js +++ b/tests/baselines/reference/recursiveIdenticalOverloadResolution.js @@ -20,9 +20,7 @@ module M { //// [recursiveIdenticalOverloadResolution.js] var M; (function (M) { - function f(p) { - return f; - } + function f(p) { return f; } ; var i; f(i); diff --git a/tests/baselines/reference/recursiveInference1.js b/tests/baselines/reference/recursiveInference1.js index 839e13130f2..3a26ead542d 100644 --- a/tests/baselines/reference/recursiveInference1.js +++ b/tests/baselines/reference/recursiveInference1.js @@ -3,7 +3,5 @@ function fib(x:number) { return x <= 1 ? x : fib(x - 1) + fib(x - 2); } var result = fib(5); //// [recursiveInference1.js] -function fib(x) { - return x <= 1 ? x : fib(x - 1) + fib(x - 2); -} +function fib(x) { return x <= 1 ? x : fib(x - 1) + fib(x - 2); } var result = fib(5); diff --git a/tests/baselines/reference/recursiveInferenceBug.js b/tests/baselines/reference/recursiveInferenceBug.js index ff9b1c31434..5b4d4f0c0a1 100644 --- a/tests/baselines/reference/recursiveInferenceBug.js +++ b/tests/baselines/reference/recursiveInferenceBug.js @@ -18,7 +18,5 @@ function f(x) { } var zz = { g: function () { }, - get f() { - return "abc"; - } + get f() { return "abc"; } }; diff --git a/tests/baselines/reference/recursiveInheritance3.js b/tests/baselines/reference/recursiveInheritance3.js index 710b691fa94..bc9fb6cb4f9 100644 --- a/tests/baselines/reference/recursiveInheritance3.js +++ b/tests/baselines/reference/recursiveInheritance3.js @@ -13,8 +13,6 @@ var C = (function () { function C() { this.x = 1; } - C.prototype.foo = function (x) { - return x; - }; + C.prototype.foo = function (x) { return x; }; return C; })(); diff --git a/tests/baselines/reference/recursiveProperties.js b/tests/baselines/reference/recursiveProperties.js index 63644484956..84d9ebcd27c 100644 --- a/tests/baselines/reference/recursiveProperties.js +++ b/tests/baselines/reference/recursiveProperties.js @@ -12,9 +12,7 @@ var A = (function () { function A() { } Object.defineProperty(A.prototype, "testProp", { - get: function () { - return this.testProp; - }, + get: function () { return this.testProp; }, enumerable: true, configurable: true }); @@ -24,9 +22,7 @@ var B = (function () { function B() { } Object.defineProperty(B.prototype, "testProp", { - set: function (value) { - this.testProp = value; - }, + set: function (value) { this.testProp = value; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/recursiveReturns.js b/tests/baselines/reference/recursiveReturns.js index d01825f8cbf..18c9ed4dd7c 100644 --- a/tests/baselines/reference/recursiveReturns.js +++ b/tests/baselines/reference/recursiveReturns.js @@ -20,9 +20,7 @@ function R1() { R1(); return; } -function R2() { - R2(); -} +function R2() { R2(); } function R3(n) { if (n == 0) { } diff --git a/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.js b/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.js index 0d972d3e86c..0cef9be47ab 100644 --- a/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.js +++ b/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.js @@ -61,9 +61,7 @@ function foo2(x) { function other() { function foo3(x) { } function foo4(x) { } - function foo5(x) { - return null; - } + function foo5(x) { return null; } var list; var myList; var r = foo5(list); diff --git a/tests/baselines/reference/redefineArray.js b/tests/baselines/reference/redefineArray.js index 93494232436..080d2b1a2d2 100644 --- a/tests/baselines/reference/redefineArray.js +++ b/tests/baselines/reference/redefineArray.js @@ -2,6 +2,4 @@ Array = function (n:number, s:string) {return n;}; //// [redefineArray.js] -Array = function (n, s) { - return n; -}; +Array = function (n, s) { return n; }; diff --git a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js index 608090e8722..24f0e7f1bcb 100644 --- a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js +++ b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js @@ -1036,41 +1036,31 @@ var rionegrensis; caniventer.prototype.salomonseni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; caniventer.prototype.uchidai = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; caniventer.prototype.raffrayana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; caniventer.prototype.Uranium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; caniventer.prototype.nayaur = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return caniventer; @@ -1084,41 +1074,31 @@ var rionegrensis; veraecrucis.prototype.naso = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; veraecrucis.prototype.vancouverensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; veraecrucis.prototype.africana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; veraecrucis.prototype.palliolata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; veraecrucis.prototype.nivicola = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return veraecrucis; @@ -1139,41 +1119,31 @@ var julianae; nudicaudus.prototype.brandtii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nudicaudus.prototype.maxwellii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nudicaudus.prototype.endoi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nudicaudus.prototype.venezuelae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nudicaudus.prototype.zamicrus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return nudicaudus; @@ -1185,57 +1155,43 @@ var julianae; galapagoensis.prototype.isabellae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.rueppellii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.peregusna = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.gliroides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.banakrisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.rozendaali = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.stuhlmanni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return galapagoensis; @@ -1247,57 +1203,43 @@ var julianae; albidens.prototype.mattheyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.Astatine = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.vincenti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.hirta = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.virginianus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.macrophyllum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.porcellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return albidens; @@ -1311,105 +1253,79 @@ var julianae; oralis.prototype.cepapi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.porteri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.bindi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.puda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.mindorensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.ignitus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.rufus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.monax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.unalascensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.wuchihensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.leucippe = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.ordii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.eisentrauti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return oralis; @@ -1423,57 +1339,43 @@ var julianae; sumatrana.prototype.wolffsohni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.geata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.awashensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.sturdeei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.pachyurus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.lyelli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.neohibernicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return sumatrana; @@ -1485,89 +1387,67 @@ var julianae; gerbillus.prototype.pundti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.tristrami = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.swarthi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.horsfieldii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.diazi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.rennelli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.maulinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.muscina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.pelengensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.abramus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.reevesi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return gerbillus; @@ -1579,97 +1459,73 @@ var julianae; acariensis.prototype.levicula = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.minous = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.cinereiventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.longicaudatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.baeodon = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.soricoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.datae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.spixii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.anakuma = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.kihaulei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.gymnura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.olchonensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return acariensis; @@ -1683,25 +1539,19 @@ var julianae; durangae.prototype.Californium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; durangae.prototype.Flerovium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; durangae.prototype.phrudus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return durangae; @@ -1716,17 +1566,13 @@ var ruatanica; hector.prototype.humulis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; hector.prototype.eurycerus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return hector; @@ -1741,25 +1587,19 @@ var Lanthanum; suillus.prototype.spilosoma = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; suillus.prototype.tumbalensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; suillus.prototype.anatolicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return suillus; @@ -1773,81 +1613,61 @@ var Lanthanum; nitidus.prototype.granatensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.negligens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.lewisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.arge = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.dominicensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.taurus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.tonganus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.silvatica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.midas = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.bicornis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return nitidus; @@ -1861,65 +1681,49 @@ var Lanthanum; megalonyx.prototype.phillipsii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.melanogaster = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.elaphus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.elater = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.ourebi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.caraccioli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.parva = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.albipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return megalonyx; @@ -1931,113 +1735,85 @@ var Lanthanum; jugularis.prototype.torrei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.revoili = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.macrobullatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.compactus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.talpinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.stramineus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.dartmouthi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.ogilbyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.incomtus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.surdaster = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.melanorhinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.picticaudata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.pomona = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.ileile = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return jugularis; @@ -2054,113 +1830,85 @@ var rendalli; zuluensis.prototype.telfairi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.keyensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.occasius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.damarensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.Neptunium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.griseoflavus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.thar = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.alborufus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.fusicaudus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.gordonorum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.ruber = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.desmarestianus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.lutillus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.salocco = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return zuluensis; @@ -2172,81 +1920,61 @@ var rendalli; moojeni.prototype.floweri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.montosa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.miletus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.heaneyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.marchei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.budini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.maggietaylorae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.poliocephalus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.zibethicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.biacensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return moojeni; @@ -2260,25 +1988,19 @@ var rendalli; crenulata.prototype.salvanius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; crenulata.prototype.maritimus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; crenulata.prototype.edax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return crenulata; @@ -2293,65 +2015,49 @@ var trivirgatus; tumidifrons.prototype.nivalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.vestitus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.aequatorius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.scherman = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.improvisum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.cervinipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.audax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.vallinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return tumidifrons; @@ -2365,57 +2071,43 @@ var trivirgatus; mixtus.prototype.ochrogaster = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.bryophilus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.liechtensteini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.crawfordi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.hypsibia = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.matacus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.demidoff = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return mixtus; @@ -2427,17 +2119,13 @@ var trivirgatus; lotor.prototype.balensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lotor.prototype.pullata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return lotor; @@ -2449,57 +2137,43 @@ var trivirgatus; falconeri.prototype.cabrali = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.gouldi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.fuscicollis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.martiensseni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.gaoligongensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.shawi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.gmelini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return falconeri; @@ -2511,113 +2185,85 @@ var trivirgatus; oconnelli.prototype.youngsoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.terrestris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.chrysopus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.fuscomurina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.hellwaldii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.aenea = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.perrini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.entellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.krebsii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.cephalotes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.molossinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.luisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.ceylonicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.ralli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return oconnelli; @@ -2632,33 +2278,25 @@ var quasiater; bobrinskoi.prototype.crassicaudatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; bobrinskoi.prototype.mulatta = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; bobrinskoi.prototype.ansorgei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; bobrinskoi.prototype.Copper = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return bobrinskoi; @@ -2675,33 +2313,25 @@ var ruatanica; americanus.prototype.nasoloi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; americanus.prototype.mystacalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; americanus.prototype.fardoulisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; americanus.prototype.tumidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return americanus; @@ -2718,105 +2348,79 @@ var lavali; wilsoni.prototype.setiger = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.lorentzii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.antisensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.blossevillii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.bontanus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.caligata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.franqueti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.roberti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.degelidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.amoenus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.kob = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.csorbai = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.dorsata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return wilsoni; @@ -2836,105 +2440,79 @@ var lavali; otion.prototype.bonaerensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.dussumieri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.osvaldoreigi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.grevyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.hirtula = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.cristatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.darlingtoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.fontanierii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.umbrosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.chiriquinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.orarius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.ilaeus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.musschenbroekii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return otion; @@ -2946,97 +2524,73 @@ var lavali; xanthognathus.prototype.nanulus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.albigena = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.onca = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.gunnii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.apeco = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.variegates = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.goudotii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.pohlei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.ineptus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.euryotis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.maurisca = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.coyhaiquensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return xanthognathus; @@ -3050,65 +2604,49 @@ var lavali; thaeleri.prototype.coromandra = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.parvipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.sponsorius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.vates = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.roosmalenorum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.rubicola = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.ikonnikovi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.paramicrus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return thaeleri; @@ -3122,17 +2660,13 @@ var lavali; lepturus.prototype.ferrumequinum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lepturus.prototype.aequalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return lepturus; @@ -3149,73 +2683,55 @@ var dogramacii; robustulus.prototype.fossor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.humboldti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.mexicana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.martini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.beatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.leporina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.pearsonii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.keaysi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.hindei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return robustulus; @@ -3227,9 +2743,7 @@ var dogramacii; koepckeae.prototype.culturatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return koepckeae; @@ -3241,105 +2755,79 @@ var dogramacii; kaiseri.prototype.bedfordiae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.paramorum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.rubidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.juninensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.marginata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.Meitnerium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.pinetorum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.hoolock = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.poeyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.Thulium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.patrius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.quadraticauda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.ater = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return kaiseri; @@ -3351,65 +2839,49 @@ var dogramacii; aurata.prototype.grunniens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.howensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.karlkoopmani = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.mirapitanga = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.ophiodon = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.landeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.sonomae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.erythromos = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return aurata; @@ -3426,113 +2898,85 @@ var lutreolus; schlegeli.prototype.mittendorfi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.blicki = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.culionensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.scrofa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.fernandoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.Tin = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.marmorata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.tavaratra = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.peregrina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.frontalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.cuniculus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.magdalenae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.andamanensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.dispar = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return schlegeli; @@ -3547,89 +2991,67 @@ var argurus; dauricus.prototype.chinensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.duodecimcostatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.foxi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.macleayii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.darienensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.hardwickii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.albifrons = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.jacobitus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.guentheri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.mahomet = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.misionensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return dauricus; @@ -3644,65 +3066,49 @@ var nigra; dolichurus.prototype.solomonis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.alfredi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.morrisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.lekaguli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.dimissus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.phaeotis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.ustus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.sagei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return dolichurus; @@ -3719,49 +3125,37 @@ var panglima; amphibius.prototype.bottegi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.jerdoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.camtschatica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.spadix = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.luismanueli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.aceramarcae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return amphibius; @@ -3775,25 +3169,19 @@ var panglima; fundatus.prototype.crassulus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fundatus.prototype.flamarioni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fundatus.prototype.mirabilis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return fundatus; @@ -3807,41 +3195,31 @@ var panglima; abidi.prototype.greyii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; abidi.prototype.macedonicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; abidi.prototype.galili = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; abidi.prototype.thierryi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; abidi.prototype.ega = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return abidi; @@ -3856,57 +3234,43 @@ var quasiater; carolinensis.prototype.concinna = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.aeneus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.aloysiisabaudiae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.tenellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.andium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.persephone = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.patrizii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return carolinensis; @@ -3923,97 +3287,73 @@ var minutus; himalayana.prototype.simoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.lobata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.rusticus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.latona = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.famulus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.flaviceps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.paradoxolophus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.Osmium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.vulgaris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.betsileoensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.vespuccii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.olympus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return himalayana; @@ -4030,65 +3370,49 @@ var caurinus; mahaganus.prototype.martiniquensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.devius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.masalai = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.kathleenae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.simulus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.nigrovittatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.senegalensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.acticola = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return mahaganus; @@ -4103,9 +3427,7 @@ var macrorhinos; marmosurus.prototype.tansaniana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return marmosurus; @@ -4122,9 +3444,7 @@ var howi; angulatus.prototype.pennatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return angulatus; @@ -4148,65 +3468,49 @@ var nigra; thalia.prototype.dichotomus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.arnuxii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.verheyeni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.dauuricus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.tristriatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.lasiura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.gangetica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.brucei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return thalia; @@ -4223,9 +3527,7 @@ var sagitta; walkeri.prototype.maracajuensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return walkeri; @@ -4242,9 +3544,7 @@ var minutus; inez.prototype.vexillaris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return inez; @@ -4272,73 +3572,55 @@ var panamensis; linulus.prototype.goslingi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.taki = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.fumosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.rufinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.lami = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.regina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.nanilla = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.enganus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.gomantongensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return linulus; @@ -4353,105 +3635,79 @@ var nigra; gracilis.prototype.weddellii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.echinothrix = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.garridoi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.rouxii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.aurita = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.geoffrensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.theresa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.melanocarpus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.dubiaquercus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.pectoralis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.apoensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.grisescens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.ramirohitra = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return gracilis; @@ -4468,105 +3724,79 @@ var samarensis; pelurus.prototype.Palladium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.castanea = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.chamek = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.nigriceps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.lunatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.madurae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.chinchilla = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.eliasi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.proditor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.gambianus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.petteri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.nusatenggara = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.olitor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return pelurus; @@ -4580,113 +3810,85 @@ var samarensis; fuscus.prototype.planifrons = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.badia = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.prymnolopha = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.natalensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.hunteri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.sapiens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.macrocercus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.nimbae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.suricatta = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.jagorii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.beecrofti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.imaizumii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.colocolo = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.wolfi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return fuscus; @@ -4698,33 +3900,25 @@ var samarensis; pallidus.prototype.oblativa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pallidus.prototype.watersi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pallidus.prototype.glacialis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pallidus.prototype.viaria = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return pallidus; @@ -4736,41 +3930,31 @@ var samarensis; cahirinus.prototype.alashanicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cahirinus.prototype.flaviventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cahirinus.prototype.bottai = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cahirinus.prototype.pinetis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cahirinus.prototype.saussurei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return cahirinus; @@ -4787,41 +3971,31 @@ var sagitta; leptoceros.prototype.victus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; leptoceros.prototype.hoplomyoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; leptoceros.prototype.gratiosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; leptoceros.prototype.rex = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; leptoceros.prototype.bolami = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return leptoceros; @@ -4838,9 +4012,7 @@ var daubentonii; nigricans.prototype.woosnami = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return nigricans; @@ -4866,25 +4038,19 @@ var argurus; pygmaea.prototype.pajeros = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pygmaea.prototype.capucinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pygmaea.prototype.cuvieri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return pygmaea; @@ -4901,57 +4067,43 @@ var chrysaeolus; sarasinorum.prototype.belzebul = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.hinpoon = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.kandti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.cynosuros = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.Germanium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.Ununoctium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.princeps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return sarasinorum; @@ -4966,57 +4118,43 @@ var argurus; wetmorei.prototype.leucoptera = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.ochraventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.tephromelas = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.cracens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.jamaicensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.gymnocaudus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.mayori = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return wetmorei; @@ -5033,65 +4171,49 @@ var argurus; oreas.prototype.salamonis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.paniscus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.fagani = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.papuanus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.timidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.nghetinhensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.barbei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.univittatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return oreas; @@ -5106,97 +4228,73 @@ var daubentonii; arboreus.prototype.capreolus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.moreni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.hypoleucos = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.paedulcus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.pucheranii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.stella = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.brasiliensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.brevicaudata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.vitticollis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.huangensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.cameroni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.tianshanica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return arboreus; @@ -5211,105 +4309,79 @@ var patas; uralensis.prototype.cartilagonodus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.pyrrhinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.insulans = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.nigricauda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.muricauda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.albicaudus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.fallax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.attenuata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.megalura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.neblina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.citellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.tanezumi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.albiventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return uralensis; @@ -5326,17 +4398,13 @@ var provocax; melanoleuca.prototype.Neodymium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanoleuca.prototype.baeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return melanoleuca; @@ -5351,17 +4419,13 @@ var sagitta; sicarius.prototype.Chlorine = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sicarius.prototype.simulator = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return sicarius; @@ -5378,113 +4442,85 @@ var howi; marcanoi.prototype.formosae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.dudui = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.leander = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.martinsi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.beatrix = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.griseoventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.zerda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.yucatanicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.nigrita = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.jouvenetae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.indefessus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.vuquangensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.Zirconium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.hyaena = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return marcanoi; @@ -5499,97 +4535,73 @@ var argurus; gilbertii.prototype.nasutus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.poecilops = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.sondaicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.auriventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.cherriei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.lindberghi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.pipistrellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.paranus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.dubosti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.opossum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.oreopolus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.amurensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return gilbertii; @@ -5613,105 +4625,79 @@ var lutreolus; punicus.prototype.strandi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.lar = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.erica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.trichura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.lemniscatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.aspalax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.marshalli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.Zinc = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.monochromos = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.purinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.ischyrus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.tenuis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.Helium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return punicus; @@ -5726,49 +4712,37 @@ var macrorhinos; daphaenodon.prototype.bredanensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.othus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.hammondi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.aureocollaris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.flavipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.callosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return daphaenodon; @@ -5783,97 +4757,73 @@ var sagitta; cinereus.prototype.zunigae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.microps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.guaporensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.tonkeana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.montensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.sphinx = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.glis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.dorsalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.fimbriatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.sara = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.epimelas = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.pittieri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return cinereus; @@ -5905,81 +4855,61 @@ var gabriellae; amicus.prototype.pirrensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.phaeura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.voratus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.satarae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.hooperi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.perrensi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.ridei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.audeberti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.Lutetium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.atrox = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return amicus; @@ -5991,9 +4921,7 @@ var gabriellae; echinatus.prototype.tenuipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return echinatus; @@ -6008,49 +4936,37 @@ var imperfecta; lasiurus.prototype.marisae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.fulvus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.paranaensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.didactylus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.schreibersii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.orii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return lasiurus; @@ -6062,89 +4978,67 @@ var imperfecta; subspinosus.prototype.monticularis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.Gadolinium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.oasicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.paterculus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.punctata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.invictus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.stangeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.siskiyou = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.welwitschii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.Polonium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.harpia = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return subspinosus; @@ -6158,25 +5052,19 @@ var imperfecta; ciliolabrum.prototype.leschenaultii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; ciliolabrum.prototype.ludia = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; ciliolabrum.prototype.sinicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return ciliolabrum; @@ -6191,33 +5079,25 @@ var quasiater; wattsi.prototype.lagotis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wattsi.prototype.hussoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wattsi.prototype.bilarni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wattsi.prototype.cabrerae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return wattsi; @@ -6234,73 +5114,55 @@ var petrophilus; sodyi.prototype.saundersiae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.imberbis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.cansdalei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.Lawrencium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.catta = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.breviceps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.transitionalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.heptneri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.bairdii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return sodyi; @@ -6317,65 +5179,49 @@ var caurinus; megaphyllus.prototype.montana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.amatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.bucculentus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.lepida = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.graecus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.forsteri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.perotensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.cirrhosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return megaphyllus; @@ -6390,25 +5236,19 @@ var minutus; portoricensis.prototype.relictus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; portoricensis.prototype.aequatorianus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; portoricensis.prototype.rhinogradoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return portoricensis; @@ -6423,105 +5263,79 @@ var lutreolus; foina.prototype.tarfayensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.Promethium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.salinae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.kerri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.scotti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.camerunensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.affinis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.siebersi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.maquassiensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.layardi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.bishopi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.apodemoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.argentiventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return foina; @@ -6538,81 +5352,61 @@ var lutreolus; cor.prototype.antinorii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.voi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.mussoi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.truncatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.achates = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.praedatrix = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.mzabi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.xanthinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.tapoatafa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.castroviejoi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return cor; @@ -6627,17 +5421,13 @@ var howi; coludo.prototype.bernhardi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; coludo.prototype.isseli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return coludo; @@ -6654,17 +5444,13 @@ var argurus; germaini.prototype.sharpei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; germaini.prototype.palmarum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return germaini; @@ -6679,89 +5465,67 @@ var sagitta; stolzmanni.prototype.riparius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.dhofarensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.tricolor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.gardneri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.walleri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.talpoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.pallipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.lagurus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.hipposideros = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.griselda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.florium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return stolzmanni; @@ -6778,105 +5542,79 @@ var dammermani; melanops.prototype.blarina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.harwoodi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.ashaninka = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.wiedii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.godmani = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.condorensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.xerophila = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.laminatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.archeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.hidalgo = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.unicolor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.philippii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.bocagei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return melanops; @@ -6893,65 +5631,49 @@ var argurus; peninsulae.prototype.aitkeni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.novaeangliae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.olallae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.anselli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.timminsi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.sordidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.telfordi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.cavernarum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return peninsulae; @@ -6966,105 +5688,79 @@ var argurus; netscheri.prototype.gravis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.ruschii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.tricuspidatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.fernandezi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.colletti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.microbullatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.eburneae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.tatei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.millardi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.pruinosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.delator = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.nyikae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.ruemmleri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return netscheri; @@ -7081,105 +5777,79 @@ var ruatanica; Praseodymium.prototype.clara = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.spectabilis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.kamensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.ruddi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.bartelsii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.yerbabuenae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.davidi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.pilirostris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.catherinae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.frontata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.Terbium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.thomensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.soricinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return Praseodymium; @@ -7196,9 +5866,7 @@ var caurinus; johorensis.prototype.maini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return johorensis; @@ -7213,9 +5881,7 @@ var argurus; luctuosa.prototype.loriae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return luctuosa; @@ -7230,65 +5896,49 @@ var panamensis; setulosus.prototype.duthieae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.guereza = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.buselaphus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.nuttalli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.pelii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.tunneyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.lamula = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.vampyrus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return setulosus; @@ -7303,41 +5953,31 @@ var petrophilus; rosalia.prototype.palmeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; rosalia.prototype.baeops = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; rosalia.prototype.ozensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; rosalia.prototype.creaghi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; rosalia.prototype.montivaga = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return rosalia; @@ -7354,49 +5994,37 @@ var caurinus; psilurus.prototype.socialis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.lundi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.araeum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.calamianensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.petersoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.nitela = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return psilurus; diff --git a/tests/baselines/reference/restElementWithNullInitializer.errors.txt b/tests/baselines/reference/restElementWithNullInitializer.errors.txt new file mode 100644 index 00000000000..7beb7b9a642 --- /dev/null +++ b/tests/baselines/reference/restElementWithNullInitializer.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(1,15): error TS2461: Type 'null' is not an array type. +tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(4,15): error TS2461: Type 'undefined' is not an array type. +tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(7,15): error TS2461: Type '{ [x: number]: undefined; }' is not an array type. + + +==== tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts (3 errors) ==== + function foo1([...r] = null) { + ~~~~~~ +!!! error TS2461: Type 'null' is not an array type. + } + + function foo2([...r] = undefined) { + ~~~~~~ +!!! error TS2461: Type 'undefined' is not an array type. + } + + function foo3([...r] = {}) { + ~~~~~~ +!!! error TS2461: Type '{ [x: number]: undefined; }' is not an array type. + } + + function foo4([...r] = []) { + } + \ No newline at end of file diff --git a/tests/baselines/reference/restElementWithNullInitializer.js b/tests/baselines/reference/restElementWithNullInitializer.js new file mode 100644 index 00000000000..9f326602fb8 --- /dev/null +++ b/tests/baselines/reference/restElementWithNullInitializer.js @@ -0,0 +1,27 @@ +//// [restElementWithNullInitializer.ts] +function foo1([...r] = null) { +} + +function foo2([...r] = undefined) { +} + +function foo3([...r] = {}) { +} + +function foo4([...r] = []) { +} + + +//// [restElementWithNullInitializer.js] +function foo1(_a) { + var _b = _a === void 0 ? null : _a, r = _b.slice(0); +} +function foo2(_a) { + var _b = _a === void 0 ? undefined : _a, r = _b.slice(0); +} +function foo3(_a) { + var _b = _a === void 0 ? {} : _a, r = _b.slice(0); +} +function foo4(_a) { + var _b = _a === void 0 ? [] : _a, r = _b.slice(0); +} diff --git a/tests/baselines/reference/returnStatements.js b/tests/baselines/reference/returnStatements.js index 59a91566043..77b6ae1f774 100644 --- a/tests/baselines/reference/returnStatements.js +++ b/tests/baselines/reference/returnStatements.js @@ -32,30 +32,14 @@ var __extends = this.__extends || function (d, b) { d.prototype = new __(); }; // all the following should be valid -function fn1() { - return 1; -} -function fn2() { - return ''; -} -function fn3() { - return undefined; -} -function fn4() { - return; -} -function fn5() { - return true; -} -function fn6() { - return new Date(12); -} -function fn7() { - return null; -} -function fn8() { - return; -} // OK, eq. to 'return undefined' +function fn1() { return 1; } +function fn2() { return ''; } +function fn3() { return undefined; } +function fn4() { return; } +function fn5() { return true; } +function fn6() { return new Date(12); } +function fn7() { return null; } +function fn8() { return; } // OK, eq. to 'return undefined' var C = (function () { function C() { } @@ -69,15 +53,7 @@ var D = (function (_super) { } return D; })(C); -function fn10() { - return { id: 12 }; -} -function fn11() { - return new C(); -} -function fn12() { - return new D(); -} -function fn13() { - return null; -} +function fn10() { return { id: 12 }; } +function fn11() { return new C(); } +function fn12() { return new D(); } +function fn13() { return null; } diff --git a/tests/baselines/reference/returnTypeParameter.js b/tests/baselines/reference/returnTypeParameter.js index 75e8a998942..d5f46cba776 100644 --- a/tests/baselines/reference/returnTypeParameter.js +++ b/tests/baselines/reference/returnTypeParameter.js @@ -4,6 +4,4 @@ function f2(a: T): T { return T; } // bug was that this satisfied the return //// [returnTypeParameter.js] function f(a) { } // error, no return statement -function f2(a) { - return T; -} // bug was that this satisfied the return statement requirement +function f2(a) { return T; } // bug was that this satisfied the return statement requirement diff --git a/tests/baselines/reference/returnTypeParameterWithModules.js b/tests/baselines/reference/returnTypeParameterWithModules.js index 2894774de01..4790fe1341b 100644 --- a/tests/baselines/reference/returnTypeParameterWithModules.js +++ b/tests/baselines/reference/returnTypeParameterWithModules.js @@ -33,9 +33,7 @@ var M2; M2.compose = compose; ; function compose2(g, f) { - return function (x) { - return g(f(x)); - }; + return function (x) { return g(f(x)); }; } M2.compose2 = compose2; ; diff --git a/tests/baselines/reference/returnTypeTypeArguments.js b/tests/baselines/reference/returnTypeTypeArguments.js index 5be549d2f34..b374cb1c581 100644 --- a/tests/baselines/reference/returnTypeTypeArguments.js +++ b/tests/baselines/reference/returnTypeTypeArguments.js @@ -92,65 +92,31 @@ var Three = (function () { } return Three; })(); -function A1() { - return null; -} -function A2() { - return null; -} -function A3() { - return null; -} -function B1() { - return null; -} -function B2() { - return null; -} -function B3() { - return null; -} +function A1() { return null; } +function A2() { return null; } +function A3() { return null; } +function B1() { return null; } +function B2() { return null; } +function B3() { return null; } var C = (function () { function C() { } - C.prototype.A1 = function () { - return null; - }; - C.prototype.A2 = function () { - return null; - }; - C.prototype.A3 = function () { - return null; - }; - C.prototype.B1 = function () { - return null; - }; - C.prototype.B2 = function () { - return null; - }; - C.prototype.B3 = function () { - return null; - }; + C.prototype.A1 = function () { return null; }; + C.prototype.A2 = function () { return null; }; + C.prototype.A3 = function () { return null; }; + C.prototype.B1 = function () { return null; }; + C.prototype.B2 = function () { return null; }; + C.prototype.B3 = function () { return null; }; return C; })(); var D = (function () { function D() { } - D.prototype.A2 = function () { - return null; - }; - D.prototype.A3 = function () { - return null; - }; - D.prototype.B1 = function () { - return null; - }; - D.prototype.B2 = function () { - return null; - }; - D.prototype.B3 = function () { - return null; - }; + D.prototype.A2 = function () { return null; }; + D.prototype.A3 = function () { return null; }; + D.prototype.B1 = function () { return null; }; + D.prototype.B2 = function () { return null; }; + D.prototype.B3 = function () { return null; }; return D; })(); var Y = (function () { diff --git a/tests/baselines/reference/reverseInferenceInContextualInstantiation.js b/tests/baselines/reference/reverseInferenceInContextualInstantiation.js index 7108029ac54..f9c3242e1ea 100644 --- a/tests/baselines/reference/reverseInferenceInContextualInstantiation.js +++ b/tests/baselines/reference/reverseInferenceInContextualInstantiation.js @@ -5,8 +5,6 @@ x.sort(compare); // Error, but shouldn't be //// [reverseInferenceInContextualInstantiation.js] -function compare(a, b) { - return 0; -} +function compare(a, b) { return 0; } var x; x.sort(compare); // Error, but shouldn't be diff --git a/tests/baselines/reference/scannertest1.js b/tests/baselines/reference/scannertest1.js index dc003e95a8f..8c9d805c5f2 100644 --- a/tests/baselines/reference/scannertest1.js +++ b/tests/baselines/reference/scannertest1.js @@ -33,7 +33,9 @@ var CharacterInfo = (function () { return c >= CharacterCodes._0 && c <= CharacterCodes._9; }; CharacterInfo.isHexDigit = function (c) { - return isDecimalDigit(c) || (c >= CharacterCodes.A && c <= CharacterCodes.F) || (c >= CharacterCodes.a && c <= CharacterCodes.f); + return isDecimalDigit(c) || + (c >= CharacterCodes.A && c <= CharacterCodes.F) || + (c >= CharacterCodes.a && c <= CharacterCodes.f); }; CharacterInfo.hexValue = function (c) { Debug.assert(isHexDigit(c)); diff --git a/tests/baselines/reference/selfInCallback.js b/tests/baselines/reference/selfInCallback.js index 85f16390f96..25228b03187 100644 --- a/tests/baselines/reference/selfInCallback.js +++ b/tests/baselines/reference/selfInCallback.js @@ -12,14 +12,10 @@ var C = (function () { function C() { this.p1 = 0; } - C.prototype.callback = function (cb) { - cb(); - }; + C.prototype.callback = function (cb) { cb(); }; C.prototype.doit = function () { var _this = this; - this.callback(function () { - _this.p1 + 1; - }); + this.callback(function () { _this.p1 + 1; }); }; return C; })(); diff --git a/tests/baselines/reference/sourceMap-FileWithComments.js b/tests/baselines/reference/sourceMap-FileWithComments.js index 6143ff95fb8..e9755f6c048 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.js +++ b/tests/baselines/reference/sourceMap-FileWithComments.js @@ -48,9 +48,7 @@ var Shapes; this.y = y; } // Instance member - Point.prototype.getDist = function () { - return Math.sqrt(this.x * this.x + this.y * this.y); - }; + Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; // Static member Point.origin = new Point(0, 0); return Point; diff --git a/tests/baselines/reference/sourceMap-FileWithComments.js.map b/tests/baselines/reference/sourceMap-FileWithComments.js.map index 7405d21eb85..28d4566efc7 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.js.map +++ b/tests/baselines/reference/sourceMap-FileWithComments.js.map @@ -1,2 +1,2 @@ //// [sourceMap-FileWithComments.js.map] -{"version":3,"file":"sourceMap-FileWithComments.js","sourceRoot":"","sources":["sourceMap-FileWithComments.ts"],"names":["Shapes","Shapes.Point","Shapes.Point.constructor","Shapes.Point.getDist","Shapes.foo"],"mappings":"AAOA,AADA,SAAS;AACT,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM,EAAC,CAAC;IAGXA,AADAA,QAAQA;QACKA,KAAKA;QACdC,cAAcA;QACdA,SAFSA,KAAKA,CAEKA,CAASA,EAASA,CAASA;YAA3BC,MAACA,GAADA,CAACA,CAAQA;YAASA,MAACA,GAADA,CAACA,CAAQA;QAAIA,CAACA;QAEnDD,kBAAkBA;QAClBA,uBAAOA,GAAPA;YAAYE,MAAMA,CAACA,IAAIA,CAACA,IAAIA,CAACA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,CAACA,CAACA;QAACA,CAACA;QAElEF,gBAAgBA;QACTA,YAAMA,GAAGA,IAAIA,KAAKA,CAACA,CAACA,EAAEA,CAACA,CAACA,CAACA;QACpCA,YAACA;IAADA,CAACA,AATDD,IASCA;IATYA,YAAKA,GAALA,KASZA,CAAAA;IAGDA,AADAA,+BAA+BA;QAC3BA,CAACA,GAAGA,EAAEA,CAACA;IAEXA,SAAgBA,GAAGA;IACnBI,CAACA;IADeJ,UAAGA,GAAHA,GACfA,CAAAA;IAKDA,AAHAA;;MAEEA;QACEA,CAACA,GAAGA,EAAEA,CAACA;AACfA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ;AAGD,AADA,qBAAqB;IACjB,CAAC,GAAW,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,IAAI,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMap-FileWithComments.js","sourceRoot":"","sources":["sourceMap-FileWithComments.ts"],"names":["Shapes","Shapes.Point","Shapes.Point.constructor","Shapes.Point.getDist","Shapes.foo"],"mappings":"AAOA,AADA,SAAS;AACT,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM,EAAC,CAAC;IAGXA,AADAA,QAAQA;QACKA,KAAKA;QACdC,cAAcA;QACdA,SAFSA,KAAKA,CAEKA,CAASA,EAASA,CAASA;YAA3BC,MAACA,GAADA,CAACA,CAAQA;YAASA,MAACA,GAADA,CAACA,CAAQA;QAAIA,CAACA;QAEnDD,kBAAkBA;QAClBA,uBAAOA,GAAPA,cAAYE,MAAMA,CAACA,IAAIA,CAACA,IAAIA,CAACA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;QAElEF,gBAAgBA;QACTA,YAAMA,GAAGA,IAAIA,KAAKA,CAACA,CAACA,EAAEA,CAACA,CAACA,CAACA;QACpCA,YAACA;IAADA,CAACA,AATDD,IASCA;IATYA,YAAKA,GAALA,KASZA,CAAAA;IAGDA,AADAA,+BAA+BA;QAC3BA,CAACA,GAAGA,EAAEA,CAACA;IAEXA,SAAgBA,GAAGA;IACnBI,CAACA;IADeJ,UAAGA,GAAHA,GACfA,CAAAA;IAKDA,AAHAA;;MAEEA;QACEA,CAACA,GAAGA,EAAEA,CAACA;AACfA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ;AAGD,AADA,qBAAqB;IACjB,CAAC,GAAW,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,IAAI,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt index 8dc11688ab0..c0e46430688 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt +++ b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt @@ -192,7 +192,7 @@ sourceFile:sourceMap-FileWithComments.ts >>> // Instance member 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @@ -200,112 +200,106 @@ sourceFile:sourceMap-FileWithComments.ts 1->Emitted(11, 9) Source(15, 9) + SourceIndex(0) name (Shapes.Point) 2 >Emitted(11, 27) Source(15, 27) + SourceIndex(0) name (Shapes.Point) --- ->>> Point.prototype.getDist = function () { +>>> Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^^^^ +10> ^ +11> ^^^^ +12> ^ +13> ^ +14> ^^^ +15> ^^^^ +16> ^ +17> ^ +18> ^^^ +19> ^^^^ +20> ^ +21> ^ +22> ^^^ +23> ^^^^ +24> ^ +25> ^ +26> ^ +27> ^ +28> ^ +29> ^ 1-> > 2 > getDist 3 > +4 > getDist() { +5 > return +6 > +7 > Math +8 > . +9 > sqrt +10> ( +11> this +12> . +13> x +14> * +15> this +16> . +17> x +18> + +19> this +20> . +21> y +22> * +23> this +24> . +25> y +26> ) +27> ; +28> +29> } 1->Emitted(12, 9) Source(16, 9) + SourceIndex(0) name (Shapes.Point) 2 >Emitted(12, 32) Source(16, 16) + SourceIndex(0) name (Shapes.Point) 3 >Emitted(12, 35) Source(16, 9) + SourceIndex(0) name (Shapes.Point) ---- ->>> return Math.sqrt(this.x * this.x + this.y * this.y); -1->^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^ -6 > ^^^^ -7 > ^ -8 > ^^^^ -9 > ^ -10> ^ -11> ^^^ -12> ^^^^ -13> ^ -14> ^ -15> ^^^ -16> ^^^^ -17> ^ -18> ^ -19> ^^^ -20> ^^^^ -21> ^ -22> ^ -23> ^ -24> ^ -1->getDist() { -2 > return -3 > -4 > Math -5 > . -6 > sqrt -7 > ( -8 > this -9 > . -10> x -11> * -12> this -13> . -14> x -15> + -16> this -17> . -18> y -19> * -20> this -21> . -22> y -23> ) -24> ; -1->Emitted(13, 13) Source(16, 21) + SourceIndex(0) name (Shapes.Point.getDist) -2 >Emitted(13, 19) Source(16, 27) + SourceIndex(0) name (Shapes.Point.getDist) -3 >Emitted(13, 20) Source(16, 28) + SourceIndex(0) name (Shapes.Point.getDist) -4 >Emitted(13, 24) Source(16, 32) + SourceIndex(0) name (Shapes.Point.getDist) -5 >Emitted(13, 25) Source(16, 33) + SourceIndex(0) name (Shapes.Point.getDist) -6 >Emitted(13, 29) Source(16, 37) + SourceIndex(0) name (Shapes.Point.getDist) -7 >Emitted(13, 30) Source(16, 38) + SourceIndex(0) name (Shapes.Point.getDist) -8 >Emitted(13, 34) Source(16, 42) + SourceIndex(0) name (Shapes.Point.getDist) -9 >Emitted(13, 35) Source(16, 43) + SourceIndex(0) name (Shapes.Point.getDist) -10>Emitted(13, 36) Source(16, 44) + SourceIndex(0) name (Shapes.Point.getDist) -11>Emitted(13, 39) Source(16, 47) + SourceIndex(0) name (Shapes.Point.getDist) -12>Emitted(13, 43) Source(16, 51) + SourceIndex(0) name (Shapes.Point.getDist) -13>Emitted(13, 44) Source(16, 52) + SourceIndex(0) name (Shapes.Point.getDist) -14>Emitted(13, 45) Source(16, 53) + SourceIndex(0) name (Shapes.Point.getDist) -15>Emitted(13, 48) Source(16, 56) + SourceIndex(0) name (Shapes.Point.getDist) -16>Emitted(13, 52) Source(16, 60) + SourceIndex(0) name (Shapes.Point.getDist) -17>Emitted(13, 53) Source(16, 61) + SourceIndex(0) name (Shapes.Point.getDist) -18>Emitted(13, 54) Source(16, 62) + SourceIndex(0) name (Shapes.Point.getDist) -19>Emitted(13, 57) Source(16, 65) + SourceIndex(0) name (Shapes.Point.getDist) -20>Emitted(13, 61) Source(16, 69) + SourceIndex(0) name (Shapes.Point.getDist) -21>Emitted(13, 62) Source(16, 70) + SourceIndex(0) name (Shapes.Point.getDist) -22>Emitted(13, 63) Source(16, 71) + SourceIndex(0) name (Shapes.Point.getDist) -23>Emitted(13, 64) Source(16, 72) + SourceIndex(0) name (Shapes.Point.getDist) -24>Emitted(13, 65) Source(16, 73) + SourceIndex(0) name (Shapes.Point.getDist) ---- ->>> }; -1 >^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > -2 > } -1 >Emitted(14, 9) Source(16, 74) + SourceIndex(0) name (Shapes.Point.getDist) -2 >Emitted(14, 10) Source(16, 75) + SourceIndex(0) name (Shapes.Point.getDist) +4 >Emitted(12, 49) Source(16, 21) + SourceIndex(0) name (Shapes.Point.getDist) +5 >Emitted(12, 55) Source(16, 27) + SourceIndex(0) name (Shapes.Point.getDist) +6 >Emitted(12, 56) Source(16, 28) + SourceIndex(0) name (Shapes.Point.getDist) +7 >Emitted(12, 60) Source(16, 32) + SourceIndex(0) name (Shapes.Point.getDist) +8 >Emitted(12, 61) Source(16, 33) + SourceIndex(0) name (Shapes.Point.getDist) +9 >Emitted(12, 65) Source(16, 37) + SourceIndex(0) name (Shapes.Point.getDist) +10>Emitted(12, 66) Source(16, 38) + SourceIndex(0) name (Shapes.Point.getDist) +11>Emitted(12, 70) Source(16, 42) + SourceIndex(0) name (Shapes.Point.getDist) +12>Emitted(12, 71) Source(16, 43) + SourceIndex(0) name (Shapes.Point.getDist) +13>Emitted(12, 72) Source(16, 44) + SourceIndex(0) name (Shapes.Point.getDist) +14>Emitted(12, 75) Source(16, 47) + SourceIndex(0) name (Shapes.Point.getDist) +15>Emitted(12, 79) Source(16, 51) + SourceIndex(0) name (Shapes.Point.getDist) +16>Emitted(12, 80) Source(16, 52) + SourceIndex(0) name (Shapes.Point.getDist) +17>Emitted(12, 81) Source(16, 53) + SourceIndex(0) name (Shapes.Point.getDist) +18>Emitted(12, 84) Source(16, 56) + SourceIndex(0) name (Shapes.Point.getDist) +19>Emitted(12, 88) Source(16, 60) + SourceIndex(0) name (Shapes.Point.getDist) +20>Emitted(12, 89) Source(16, 61) + SourceIndex(0) name (Shapes.Point.getDist) +21>Emitted(12, 90) Source(16, 62) + SourceIndex(0) name (Shapes.Point.getDist) +22>Emitted(12, 93) Source(16, 65) + SourceIndex(0) name (Shapes.Point.getDist) +23>Emitted(12, 97) Source(16, 69) + SourceIndex(0) name (Shapes.Point.getDist) +24>Emitted(12, 98) Source(16, 70) + SourceIndex(0) name (Shapes.Point.getDist) +25>Emitted(12, 99) Source(16, 71) + SourceIndex(0) name (Shapes.Point.getDist) +26>Emitted(12, 100) Source(16, 72) + SourceIndex(0) name (Shapes.Point.getDist) +27>Emitted(12, 101) Source(16, 73) + SourceIndex(0) name (Shapes.Point.getDist) +28>Emitted(12, 102) Source(16, 74) + SourceIndex(0) name (Shapes.Point.getDist) +29>Emitted(12, 103) Source(16, 75) + SourceIndex(0) name (Shapes.Point.getDist) --- >>> // Static member -1->^^^^^^^^ +1 >^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^-> -1-> +1 > > > 2 > // Static member -1->Emitted(15, 9) Source(18, 9) + SourceIndex(0) name (Shapes.Point) -2 >Emitted(15, 25) Source(18, 25) + SourceIndex(0) name (Shapes.Point) +1 >Emitted(13, 9) Source(18, 9) + SourceIndex(0) name (Shapes.Point) +2 >Emitted(13, 25) Source(18, 25) + SourceIndex(0) name (Shapes.Point) --- >>> Point.origin = new Point(0, 0); 1->^^^^^^^^ @@ -331,17 +325,17 @@ sourceFile:sourceMap-FileWithComments.ts 9 > 0 10> ) 11> ; -1->Emitted(16, 9) Source(19, 16) + SourceIndex(0) name (Shapes.Point) -2 >Emitted(16, 21) Source(19, 22) + SourceIndex(0) name (Shapes.Point) -3 >Emitted(16, 24) Source(19, 25) + SourceIndex(0) name (Shapes.Point) -4 >Emitted(16, 28) Source(19, 29) + SourceIndex(0) name (Shapes.Point) -5 >Emitted(16, 33) Source(19, 34) + SourceIndex(0) name (Shapes.Point) -6 >Emitted(16, 34) Source(19, 35) + SourceIndex(0) name (Shapes.Point) -7 >Emitted(16, 35) Source(19, 36) + SourceIndex(0) name (Shapes.Point) -8 >Emitted(16, 37) Source(19, 38) + SourceIndex(0) name (Shapes.Point) -9 >Emitted(16, 38) Source(19, 39) + SourceIndex(0) name (Shapes.Point) -10>Emitted(16, 39) Source(19, 40) + SourceIndex(0) name (Shapes.Point) -11>Emitted(16, 40) Source(19, 41) + SourceIndex(0) name (Shapes.Point) +1->Emitted(14, 9) Source(19, 16) + SourceIndex(0) name (Shapes.Point) +2 >Emitted(14, 21) Source(19, 22) + SourceIndex(0) name (Shapes.Point) +3 >Emitted(14, 24) Source(19, 25) + SourceIndex(0) name (Shapes.Point) +4 >Emitted(14, 28) Source(19, 29) + SourceIndex(0) name (Shapes.Point) +5 >Emitted(14, 33) Source(19, 34) + SourceIndex(0) name (Shapes.Point) +6 >Emitted(14, 34) Source(19, 35) + SourceIndex(0) name (Shapes.Point) +7 >Emitted(14, 35) Source(19, 36) + SourceIndex(0) name (Shapes.Point) +8 >Emitted(14, 37) Source(19, 38) + SourceIndex(0) name (Shapes.Point) +9 >Emitted(14, 38) Source(19, 39) + SourceIndex(0) name (Shapes.Point) +10>Emitted(14, 39) Source(19, 40) + SourceIndex(0) name (Shapes.Point) +11>Emitted(14, 40) Source(19, 41) + SourceIndex(0) name (Shapes.Point) --- >>> return Point; 1 >^^^^^^^^ @@ -349,8 +343,8 @@ sourceFile:sourceMap-FileWithComments.ts 1 > > 2 > } -1 >Emitted(17, 9) Source(20, 5) + SourceIndex(0) name (Shapes.Point) -2 >Emitted(17, 21) Source(20, 6) + SourceIndex(0) name (Shapes.Point) +1 >Emitted(15, 9) Source(20, 5) + SourceIndex(0) name (Shapes.Point) +2 >Emitted(15, 21) Source(20, 6) + SourceIndex(0) name (Shapes.Point) --- >>> })(); 1 >^^^^ @@ -371,10 +365,10 @@ sourceFile:sourceMap-FileWithComments.ts > // Static member > static origin = new Point(0, 0); > } -1 >Emitted(18, 5) Source(20, 5) + SourceIndex(0) name (Shapes.Point) -2 >Emitted(18, 6) Source(20, 6) + SourceIndex(0) name (Shapes.Point) -3 >Emitted(18, 6) Source(11, 5) + SourceIndex(0) name (Shapes) -4 >Emitted(18, 10) Source(20, 6) + SourceIndex(0) name (Shapes) +1 >Emitted(16, 5) Source(20, 5) + SourceIndex(0) name (Shapes.Point) +2 >Emitted(16, 6) Source(20, 6) + SourceIndex(0) name (Shapes.Point) +3 >Emitted(16, 6) Source(11, 5) + SourceIndex(0) name (Shapes) +4 >Emitted(16, 10) Source(20, 6) + SourceIndex(0) name (Shapes) --- >>> Shapes.Point = Point; 1->^^^^ @@ -397,11 +391,11 @@ sourceFile:sourceMap-FileWithComments.ts > static origin = new Point(0, 0); > } 5 > -1->Emitted(19, 5) Source(11, 18) + SourceIndex(0) name (Shapes) -2 >Emitted(19, 17) Source(11, 23) + SourceIndex(0) name (Shapes) -3 >Emitted(19, 20) Source(11, 18) + SourceIndex(0) name (Shapes) -4 >Emitted(19, 25) Source(20, 6) + SourceIndex(0) name (Shapes) -5 >Emitted(19, 26) Source(20, 6) + SourceIndex(0) name (Shapes) +1->Emitted(17, 5) Source(11, 18) + SourceIndex(0) name (Shapes) +2 >Emitted(17, 17) Source(11, 23) + SourceIndex(0) name (Shapes) +3 >Emitted(17, 20) Source(11, 18) + SourceIndex(0) name (Shapes) +4 >Emitted(17, 25) Source(20, 6) + SourceIndex(0) name (Shapes) +5 >Emitted(17, 26) Source(20, 6) + SourceIndex(0) name (Shapes) --- >>> // Variable comment after class 1->^^^^ @@ -413,9 +407,9 @@ sourceFile:sourceMap-FileWithComments.ts > 2 > 3 > // Variable comment after class -1->Emitted(20, 5) Source(23, 5) + SourceIndex(0) name (Shapes) -2 >Emitted(20, 5) Source(22, 5) + SourceIndex(0) name (Shapes) -3 >Emitted(20, 36) Source(22, 36) + SourceIndex(0) name (Shapes) +1->Emitted(18, 5) Source(23, 5) + SourceIndex(0) name (Shapes) +2 >Emitted(18, 5) Source(22, 5) + SourceIndex(0) name (Shapes) +3 >Emitted(18, 36) Source(22, 36) + SourceIndex(0) name (Shapes) --- >>> var a = 10; 1 >^^^^^^^^ @@ -430,11 +424,11 @@ sourceFile:sourceMap-FileWithComments.ts 3 > = 4 > 10 5 > ; -1 >Emitted(21, 9) Source(23, 9) + SourceIndex(0) name (Shapes) -2 >Emitted(21, 10) Source(23, 10) + SourceIndex(0) name (Shapes) -3 >Emitted(21, 13) Source(23, 13) + SourceIndex(0) name (Shapes) -4 >Emitted(21, 15) Source(23, 15) + SourceIndex(0) name (Shapes) -5 >Emitted(21, 16) Source(23, 16) + SourceIndex(0) name (Shapes) +1 >Emitted(19, 9) Source(23, 9) + SourceIndex(0) name (Shapes) +2 >Emitted(19, 10) Source(23, 10) + SourceIndex(0) name (Shapes) +3 >Emitted(19, 13) Source(23, 13) + SourceIndex(0) name (Shapes) +4 >Emitted(19, 15) Source(23, 15) + SourceIndex(0) name (Shapes) +5 >Emitted(19, 16) Source(23, 16) + SourceIndex(0) name (Shapes) --- >>> function foo() { 1->^^^^ @@ -445,9 +439,9 @@ sourceFile:sourceMap-FileWithComments.ts > 2 > export function 3 > foo -1->Emitted(22, 5) Source(25, 5) + SourceIndex(0) name (Shapes) -2 >Emitted(22, 14) Source(25, 21) + SourceIndex(0) name (Shapes) -3 >Emitted(22, 17) Source(25, 24) + SourceIndex(0) name (Shapes) +1->Emitted(20, 5) Source(25, 5) + SourceIndex(0) name (Shapes) +2 >Emitted(20, 14) Source(25, 21) + SourceIndex(0) name (Shapes) +3 >Emitted(20, 17) Source(25, 24) + SourceIndex(0) name (Shapes) --- >>> } 1 >^^^^ @@ -456,8 +450,8 @@ sourceFile:sourceMap-FileWithComments.ts 1 >() { > 2 > } -1 >Emitted(23, 5) Source(26, 5) + SourceIndex(0) name (Shapes.foo) -2 >Emitted(23, 6) Source(26, 6) + SourceIndex(0) name (Shapes.foo) +1 >Emitted(21, 5) Source(26, 5) + SourceIndex(0) name (Shapes.foo) +2 >Emitted(21, 6) Source(26, 6) + SourceIndex(0) name (Shapes.foo) --- >>> Shapes.foo = foo; 1->^^^^ @@ -472,11 +466,11 @@ sourceFile:sourceMap-FileWithComments.ts 4 > foo() { > } 5 > -1->Emitted(24, 5) Source(25, 21) + SourceIndex(0) name (Shapes) -2 >Emitted(24, 15) Source(25, 24) + SourceIndex(0) name (Shapes) -3 >Emitted(24, 18) Source(25, 21) + SourceIndex(0) name (Shapes) -4 >Emitted(24, 21) Source(26, 6) + SourceIndex(0) name (Shapes) -5 >Emitted(24, 22) Source(26, 6) + SourceIndex(0) name (Shapes) +1->Emitted(22, 5) Source(25, 21) + SourceIndex(0) name (Shapes) +2 >Emitted(22, 15) Source(25, 24) + SourceIndex(0) name (Shapes) +3 >Emitted(22, 18) Source(25, 21) + SourceIndex(0) name (Shapes) +4 >Emitted(22, 21) Source(26, 6) + SourceIndex(0) name (Shapes) +5 >Emitted(22, 22) Source(26, 6) + SourceIndex(0) name (Shapes) --- >>> /** comment after function 1->^^^^ @@ -489,8 +483,8 @@ sourceFile:sourceMap-FileWithComments.ts > */ > 2 > -1->Emitted(25, 5) Source(31, 5) + SourceIndex(0) name (Shapes) -2 >Emitted(25, 5) Source(28, 5) + SourceIndex(0) name (Shapes) +1->Emitted(23, 5) Source(31, 5) + SourceIndex(0) name (Shapes) +2 >Emitted(23, 5) Source(28, 5) + SourceIndex(0) name (Shapes) --- >>> * this is another comment >>> */ @@ -499,7 +493,7 @@ sourceFile:sourceMap-FileWithComments.ts 1->/** comment after function > * this is another comment > */ -1->Emitted(27, 7) Source(30, 7) + SourceIndex(0) name (Shapes) +1->Emitted(25, 7) Source(30, 7) + SourceIndex(0) name (Shapes) --- >>> var b = 10; 1->^^^^^^^^ @@ -514,11 +508,11 @@ sourceFile:sourceMap-FileWithComments.ts 3 > = 4 > 10 5 > ; -1->Emitted(28, 9) Source(31, 9) + SourceIndex(0) name (Shapes) -2 >Emitted(28, 10) Source(31, 10) + SourceIndex(0) name (Shapes) -3 >Emitted(28, 13) Source(31, 13) + SourceIndex(0) name (Shapes) -4 >Emitted(28, 15) Source(31, 15) + SourceIndex(0) name (Shapes) -5 >Emitted(28, 16) Source(31, 16) + SourceIndex(0) name (Shapes) +1->Emitted(26, 9) Source(31, 9) + SourceIndex(0) name (Shapes) +2 >Emitted(26, 10) Source(31, 10) + SourceIndex(0) name (Shapes) +3 >Emitted(26, 13) Source(31, 13) + SourceIndex(0) name (Shapes) +4 >Emitted(26, 15) Source(31, 15) + SourceIndex(0) name (Shapes) +5 >Emitted(26, 16) Source(31, 16) + SourceIndex(0) name (Shapes) --- >>>})(Shapes || (Shapes = {})); 1-> @@ -560,13 +554,13 @@ sourceFile:sourceMap-FileWithComments.ts > */ > var b = 10; > } -1->Emitted(29, 1) Source(32, 1) + SourceIndex(0) name (Shapes) -2 >Emitted(29, 2) Source(32, 2) + SourceIndex(0) name (Shapes) -3 >Emitted(29, 4) Source(8, 8) + SourceIndex(0) -4 >Emitted(29, 10) Source(8, 14) + SourceIndex(0) -5 >Emitted(29, 15) Source(8, 8) + SourceIndex(0) -6 >Emitted(29, 21) Source(8, 14) + SourceIndex(0) -7 >Emitted(29, 29) Source(32, 2) + SourceIndex(0) +1->Emitted(27, 1) Source(32, 1) + SourceIndex(0) name (Shapes) +2 >Emitted(27, 2) Source(32, 2) + SourceIndex(0) name (Shapes) +3 >Emitted(27, 4) Source(8, 8) + SourceIndex(0) +4 >Emitted(27, 10) Source(8, 14) + SourceIndex(0) +5 >Emitted(27, 15) Source(8, 8) + SourceIndex(0) +6 >Emitted(27, 21) Source(8, 14) + SourceIndex(0) +7 >Emitted(27, 29) Source(32, 2) + SourceIndex(0) --- >>>/** Local Variable */ 1 > @@ -579,9 +573,9 @@ sourceFile:sourceMap-FileWithComments.ts > 2 > 3 >/** Local Variable */ -1 >Emitted(30, 1) Source(35, 1) + SourceIndex(0) -2 >Emitted(30, 1) Source(34, 1) + SourceIndex(0) -3 >Emitted(30, 22) Source(34, 22) + SourceIndex(0) +1 >Emitted(28, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(28, 1) Source(34, 1) + SourceIndex(0) +3 >Emitted(28, 22) Source(34, 22) + SourceIndex(0) --- >>>var p = new Shapes.Point(3, 4); 1->^^^^ @@ -611,19 +605,19 @@ sourceFile:sourceMap-FileWithComments.ts 11> 4 12> ) 13> ; -1->Emitted(31, 5) Source(35, 5) + SourceIndex(0) -2 >Emitted(31, 6) Source(35, 6) + SourceIndex(0) -3 >Emitted(31, 9) Source(35, 17) + SourceIndex(0) -4 >Emitted(31, 13) Source(35, 21) + SourceIndex(0) -5 >Emitted(31, 19) Source(35, 27) + SourceIndex(0) -6 >Emitted(31, 20) Source(35, 28) + SourceIndex(0) -7 >Emitted(31, 25) Source(35, 33) + SourceIndex(0) -8 >Emitted(31, 26) Source(35, 34) + SourceIndex(0) -9 >Emitted(31, 27) Source(35, 35) + SourceIndex(0) -10>Emitted(31, 29) Source(35, 37) + SourceIndex(0) -11>Emitted(31, 30) Source(35, 38) + SourceIndex(0) -12>Emitted(31, 31) Source(35, 39) + SourceIndex(0) -13>Emitted(31, 32) Source(35, 40) + SourceIndex(0) +1->Emitted(29, 5) Source(35, 5) + SourceIndex(0) +2 >Emitted(29, 6) Source(35, 6) + SourceIndex(0) +3 >Emitted(29, 9) Source(35, 17) + SourceIndex(0) +4 >Emitted(29, 13) Source(35, 21) + SourceIndex(0) +5 >Emitted(29, 19) Source(35, 27) + SourceIndex(0) +6 >Emitted(29, 20) Source(35, 28) + SourceIndex(0) +7 >Emitted(29, 25) Source(35, 33) + SourceIndex(0) +8 >Emitted(29, 26) Source(35, 34) + SourceIndex(0) +9 >Emitted(29, 27) Source(35, 35) + SourceIndex(0) +10>Emitted(29, 29) Source(35, 37) + SourceIndex(0) +11>Emitted(29, 30) Source(35, 38) + SourceIndex(0) +12>Emitted(29, 31) Source(35, 39) + SourceIndex(0) +13>Emitted(29, 32) Source(35, 40) + SourceIndex(0) --- >>>var dist = p.getDist(); 1 > @@ -646,14 +640,14 @@ sourceFile:sourceMap-FileWithComments.ts 7 > getDist 8 > () 9 > ; -1 >Emitted(32, 1) Source(36, 1) + SourceIndex(0) -2 >Emitted(32, 5) Source(36, 5) + SourceIndex(0) -3 >Emitted(32, 9) Source(36, 9) + SourceIndex(0) -4 >Emitted(32, 12) Source(36, 12) + SourceIndex(0) -5 >Emitted(32, 13) Source(36, 13) + SourceIndex(0) -6 >Emitted(32, 14) Source(36, 14) + SourceIndex(0) -7 >Emitted(32, 21) Source(36, 21) + SourceIndex(0) -8 >Emitted(32, 23) Source(36, 23) + SourceIndex(0) -9 >Emitted(32, 24) Source(36, 24) + SourceIndex(0) +1 >Emitted(30, 1) Source(36, 1) + SourceIndex(0) +2 >Emitted(30, 5) Source(36, 5) + SourceIndex(0) +3 >Emitted(30, 9) Source(36, 9) + SourceIndex(0) +4 >Emitted(30, 12) Source(36, 12) + SourceIndex(0) +5 >Emitted(30, 13) Source(36, 13) + SourceIndex(0) +6 >Emitted(30, 14) Source(36, 14) + SourceIndex(0) +7 >Emitted(30, 21) Source(36, 21) + SourceIndex(0) +8 >Emitted(30, 23) Source(36, 23) + SourceIndex(0) +9 >Emitted(30, 24) Source(36, 24) + SourceIndex(0) --- >>>//# sourceMappingURL=sourceMap-FileWithComments.js.map \ No newline at end of file diff --git a/tests/baselines/reference/specializationsShouldNotAffectEachOther.js b/tests/baselines/reference/specializationsShouldNotAffectEachOther.js index d56e0938684..3116571166f 100644 --- a/tests/baselines/reference/specializationsShouldNotAffectEachOther.js +++ b/tests/baselines/reference/specializationsShouldNotAffectEachOther.js @@ -28,6 +28,4 @@ function foo() { series2.map(seriesExtent); return null; } -var keyExtent2 = series.data.map(function (d) { - return d; -}); +var keyExtent2 = series.data.map(function (d) { return d; }); diff --git a/tests/baselines/reference/specializeVarArgs1.js b/tests/baselines/reference/specializeVarArgs1.js index 3eac6daa61f..cc09df1daa6 100644 --- a/tests/baselines/reference/specializeVarArgs1.js +++ b/tests/baselines/reference/specializeVarArgs1.js @@ -23,8 +23,6 @@ a.push('Some Value'); //// [specializeVarArgs1.js] -function observableArray() { - return null; -} +function observableArray() { return null; } var a = observableArray(); a.push('Some Value'); diff --git a/tests/baselines/reference/staticFactory1.js b/tests/baselines/reference/staticFactory1.js index af5780d96cf..529cc230d73 100644 --- a/tests/baselines/reference/staticFactory1.js +++ b/tests/baselines/reference/staticFactory1.js @@ -23,9 +23,7 @@ var __extends = this.__extends || function (d, b) { var Base = (function () { function Base() { } - Base.prototype.foo = function () { - return 1; - }; + Base.prototype.foo = function () { return 1; }; Base.create = function () { return new this(); }; @@ -36,9 +34,7 @@ var Derived = (function (_super) { function Derived() { _super.apply(this, arguments); } - Derived.prototype.foo = function () { - return 2; - }; + Derived.prototype.foo = function () { return 2; }; return Derived; })(Base); var d = Derived.create(); diff --git a/tests/baselines/reference/staticGetterAndSetter.js b/tests/baselines/reference/staticGetterAndSetter.js index 64fcc134ad9..5c61af0b7cc 100644 --- a/tests/baselines/reference/staticGetterAndSetter.js +++ b/tests/baselines/reference/staticGetterAndSetter.js @@ -10,9 +10,7 @@ var Foo = (function () { function Foo() { } Object.defineProperty(Foo, "Foo", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (n) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/staticMemberExportAccess.js b/tests/baselines/reference/staticMemberExportAccess.js index 5de5a76ca7a..37799356708 100644 --- a/tests/baselines/reference/staticMemberExportAccess.js +++ b/tests/baselines/reference/staticMemberExportAccess.js @@ -24,9 +24,7 @@ Sammy.bar(); var Sammy = (function () { function Sammy() { } - Sammy.prototype.foo = function () { - return "hi"; - }; + Sammy.prototype.foo = function () { return "hi"; }; Sammy.bar = function () { return -1; }; diff --git a/tests/baselines/reference/staticMethodsReferencingClassTypeParameters.js b/tests/baselines/reference/staticMethodsReferencingClassTypeParameters.js index 499e16ec581..76fa7d6249e 100644 --- a/tests/baselines/reference/staticMethodsReferencingClassTypeParameters.js +++ b/tests/baselines/reference/staticMethodsReferencingClassTypeParameters.js @@ -7,8 +7,6 @@ class C { var C = (function () { function C() { } - C.s = function (p) { - return p; - }; + C.s = function (p) { return p; }; return C; })(); diff --git a/tests/baselines/reference/staticPropertyNotInClassType.js b/tests/baselines/reference/staticPropertyNotInClassType.js index 3a00c80e033..e9df2b2158d 100644 --- a/tests/baselines/reference/staticPropertyNotInClassType.js +++ b/tests/baselines/reference/staticPropertyNotInClassType.js @@ -47,13 +47,9 @@ var NonGeneric; this.a = a; this.b = b; } - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; Object.defineProperty(C, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -77,13 +73,9 @@ var Generic; this.a = a; this.b = b; } - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; Object.defineProperty(C, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/staticVisibility.js b/tests/baselines/reference/staticVisibility.js index 0da2e3dbe2c..7dbf49a2baa 100644 --- a/tests/baselines/reference/staticVisibility.js +++ b/tests/baselines/reference/staticVisibility.js @@ -58,13 +58,9 @@ var C2 = (function () { this.barback = ""; } Object.defineProperty(C2, "Bar", { - get: function () { - return "bar"; - } // ok + get: function () { return "bar"; } // ok , - set: function (bar) { - barback = bar; - } // not ok + set: function (bar) { barback = bar; } // not ok , enumerable: true, configurable: true diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js index b9195403b20..c9278c40446 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js @@ -50,9 +50,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { @@ -60,9 +58,7 @@ var B = (function (_super) { function B() { _super.apply(this, arguments); } - B.prototype.bar = function () { - return ''; - }; + B.prototype.bar = function () { return ''; }; return B; })(A); var Foo = (function () { diff --git a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js index 3a6280b15ba..6260493dea0 100644 --- a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js +++ b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js @@ -113,15 +113,9 @@ function f9(x) { } var C = (function () { function C() { } - C.prototype.toString = function () { - return null; - }; - C.prototype.charAt = function (pos) { - return null; - }; - C.prototype.charCodeAt = function (index) { - return null; - }; + C.prototype.toString = function () { return null; }; + C.prototype.charAt = function (pos) { return null; }; + C.prototype.charCodeAt = function (index) { return null; }; C.prototype.concat = function () { var strings = []; for (var _i = 0; _i < arguments.length; _i++) { @@ -129,51 +123,21 @@ var C = (function () { } return null; }; - C.prototype.indexOf = function (searchString, position) { - return null; - }; - C.prototype.lastIndexOf = function (searchString, position) { - return null; - }; - C.prototype.localeCompare = function (that) { - return null; - }; - C.prototype.match = function (regexp) { - return null; - }; - C.prototype.replace = function (searchValue, replaceValue) { - return null; - }; - C.prototype.search = function (regexp) { - return null; - }; - C.prototype.slice = function (start, end) { - return null; - }; - C.prototype.split = function (separator, limit) { - return null; - }; - C.prototype.substring = function (start, end) { - return null; - }; - C.prototype.toLowerCase = function () { - return null; - }; - C.prototype.toLocaleLowerCase = function () { - return null; - }; - C.prototype.toUpperCase = function () { - return null; - }; - C.prototype.toLocaleUpperCase = function () { - return null; - }; - C.prototype.trim = function () { - return null; - }; - C.prototype.substr = function (from, length) { - return null; - }; + C.prototype.indexOf = function (searchString, position) { return null; }; + C.prototype.lastIndexOf = function (searchString, position) { return null; }; + C.prototype.localeCompare = function (that) { return null; }; + C.prototype.match = function (regexp) { return null; }; + C.prototype.replace = function (searchValue, replaceValue) { return null; }; + C.prototype.search = function (regexp) { return null; }; + C.prototype.slice = function (start, end) { return null; }; + C.prototype.split = function (separator, limit) { return null; }; + C.prototype.substring = function (start, end) { return null; }; + C.prototype.toLowerCase = function () { return null; }; + C.prototype.toLocaleLowerCase = function () { return null; }; + C.prototype.toUpperCase = function () { return null; }; + C.prototype.toLocaleUpperCase = function () { return null; }; + C.prototype.trim = function () { return null; }; + C.prototype.substr = function (from, length) { return null; }; return C; })(); function f10(x) { } diff --git a/tests/baselines/reference/subtypesOfTypeParameter.js b/tests/baselines/reference/subtypesOfTypeParameter.js index 5a5a02733ba..7d739132a77 100644 --- a/tests/baselines/reference/subtypesOfTypeParameter.js +++ b/tests/baselines/reference/subtypesOfTypeParameter.js @@ -178,12 +178,8 @@ function f2(x, y) { var r6 = true ? x : { foo: 1 }; var r7 = true ? function () { } : x; var r7 = true ? x : function () { }; - var r8 = true ? function (x) { - return x; - } : x; - var r8b = true ? x : function (x) { - return x; - }; // type parameters not identical across declarations + var r8 = true ? function (x) { return x; } : x; + var r8b = true ? x : function (x) { return x; }; // type parameters not identical across declarations var i1; var r9 = true ? i1 : x; var r9 = true ? x : i1; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js index 0687a434ae6..df4511fb7ad 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js @@ -249,12 +249,8 @@ function f11(x) { var r7 = true ? x : function () { }; // ok } function f12(x) { - var r8 = true ? function (x) { - return x; - } : x; // ok - var r8b = true ? x : function (x) { - return x; - }; // ok, type parameters not identical across declarations + var r8 = true ? function (x) { return x; } : x; // ok + var r8b = true ? x : function (x) { return x; }; // ok, type parameters not identical across declarations } function f13(x) { var i1; diff --git a/tests/baselines/reference/superCallInNonStaticMethod.js b/tests/baselines/reference/superCallInNonStaticMethod.js index cf29ac3b1a4..7ef1ce1c62a 100644 --- a/tests/baselines/reference/superCallInNonStaticMethod.js +++ b/tests/baselines/reference/superCallInNonStaticMethod.js @@ -70,9 +70,7 @@ var Other = (function (_super) { var _this = this; _super.call(this); this.propertyInitializer = _super.prototype.instanceMethod.call(this); - this.functionProperty = function () { - _super.prototype.instanceMethod.call(_this); - }; + this.functionProperty = function () { _super.prototype.instanceMethod.call(_this); }; _super.prototype.instanceMethod.call(this); } // in instance method diff --git a/tests/baselines/reference/superErrors.js b/tests/baselines/reference/superErrors.js index 418aeed61ed..ce49da10687 100644 --- a/tests/baselines/reference/superErrors.js +++ b/tests/baselines/reference/superErrors.js @@ -87,9 +87,7 @@ var RegisteredUser = (function (_super) { var x = function () { return super.sayHello.call(this); }; } // super call in a lambda in a function expression in a constructor - (function () { - return function () { return super.; }; - })(); + (function () { return function () { return super.; }; })(); } RegisteredUser.prototype.sayHello = function () { // super call in a method @@ -99,9 +97,7 @@ var RegisteredUser = (function (_super) { var x = function () { return super.sayHello.call(this); }; } // super call in a lambda in a function expression in a constructor - (function () { - return function () { return super.; }; - })(); + (function () { return function () { return super.; }; })(); }; RegisteredUser.staticFunction = function () { var _this = this; diff --git a/tests/baselines/reference/superPropertyAccess.js b/tests/baselines/reference/superPropertyAccess.js index 13dfe1ee3a7..a5419aaf36e 100644 --- a/tests/baselines/reference/superPropertyAccess.js +++ b/tests/baselines/reference/superPropertyAccess.js @@ -49,14 +49,10 @@ var MyBase = (function () { this.d1 = 42; this.d2 = 42; } - MyBase.prototype.m1 = function (a) { - return a; - }; + MyBase.prototype.m1 = function (a) { return a; }; MyBase.prototype.p1 = function () { }; Object.defineProperty(MyBase.prototype, "value", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (v) { }, enumerable: true, configurable: true @@ -76,9 +72,7 @@ var MyDerived = (function (_super) { _super.prototype.p1.call(this); // Should error, private not public instance member function var l1 = _super.prototype.d1; // Should error, instance data property not a public instance member function var l1 = _super.prototype.d2; // Should error, instance data property not a public instance member function - _super.prototype.m1 = function (a) { - return ""; - }; // Should be allowed, we will not restrict assignment + _super.prototype.m1 = function (a) { return ""; }; // Should be allowed, we will not restrict assignment _super.prototype.value = 0; // Should error, instance data property not a public instance member function var z = _super.prototype.value; // Should error, instance data property not a public instance member function }; diff --git a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js index 48ae609cdc6..7fd55d221ab 100644 --- a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js +++ b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js @@ -52,9 +52,7 @@ var ObjectLiteral; var F = (function () { function F() { } - F.prototype.test = function () { - return ""; - }; + F.prototype.test = function () { return ""; }; return F; })(); var SuperObjectTest = (function (_super) { diff --git a/tests/baselines/reference/symbolDeclarationEmit10.js b/tests/baselines/reference/symbolDeclarationEmit10.js index 090adc03a1c..0c46d8750e9 100644 --- a/tests/baselines/reference/symbolDeclarationEmit10.js +++ b/tests/baselines/reference/symbolDeclarationEmit10.js @@ -6,9 +6,7 @@ var obj = { //// [symbolDeclarationEmit10.js] var obj = { - get [Symbol.isConcatSpreadable]() { - return ''; - }, + get [Symbol.isConcatSpreadable]() { return ''; }, set [Symbol.isConcatSpreadable](x) { } }; diff --git a/tests/baselines/reference/symbolDeclarationEmit11.js b/tests/baselines/reference/symbolDeclarationEmit11.js index eeaf66db3e0..e5822104bf8 100644 --- a/tests/baselines/reference/symbolDeclarationEmit11.js +++ b/tests/baselines/reference/symbolDeclarationEmit11.js @@ -12,9 +12,7 @@ var C = (function () { } C[Symbol.toPrimitive] = function () { }; Object.defineProperty(C, Symbol.isRegExp, { - get: function () { - return ""; - }, + get: function () { return ""; }, set: function (x) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/symbolDeclarationEmit12.js b/tests/baselines/reference/symbolDeclarationEmit12.js index e39e62f62ed..68a256bd39d 100644 --- a/tests/baselines/reference/symbolDeclarationEmit12.js +++ b/tests/baselines/reference/symbolDeclarationEmit12.js @@ -23,9 +23,7 @@ var M; return undefined; }; Object.defineProperty(C.prototype, Symbol.isRegExp, { - get: function () { - return undefined; - }, + get: function () { return undefined; }, set: function (x) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/symbolDeclarationEmit13.js b/tests/baselines/reference/symbolDeclarationEmit13.js index 83e2a2501e4..acf470ffce1 100644 --- a/tests/baselines/reference/symbolDeclarationEmit13.js +++ b/tests/baselines/reference/symbolDeclarationEmit13.js @@ -9,9 +9,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, Symbol.isRegExp, { - get: function () { - return ""; - }, + get: function () { return ""; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/symbolDeclarationEmit14.js b/tests/baselines/reference/symbolDeclarationEmit14.js index d81bc329927..64330c6ce92 100644 --- a/tests/baselines/reference/symbolDeclarationEmit14.js +++ b/tests/baselines/reference/symbolDeclarationEmit14.js @@ -9,16 +9,12 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, Symbol.isRegExp, { - get: function () { - return ""; - }, + get: function () { return ""; }, enumerable: true, configurable: true }); Object.defineProperty(C.prototype, Symbol.toStringTag, { - get: function () { - return ""; - }, + get: function () { return ""; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/symbolDeclarationEmit4.js b/tests/baselines/reference/symbolDeclarationEmit4.js index 85906167b11..cfe3a14122d 100644 --- a/tests/baselines/reference/symbolDeclarationEmit4.js +++ b/tests/baselines/reference/symbolDeclarationEmit4.js @@ -9,9 +9,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, Symbol.isRegExp, { - get: function () { - return ""; - }, + get: function () { return ""; }, set: function (x) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/symbolProperty18.js b/tests/baselines/reference/symbolProperty18.js index 17570e2f007..1d0a57e7b50 100644 --- a/tests/baselines/reference/symbolProperty18.js +++ b/tests/baselines/reference/symbolProperty18.js @@ -12,9 +12,7 @@ i[Symbol.toPrimitive] = false; //// [symbolProperty18.js] var i = { [Symbol.iterator]: 0, - [Symbol.toStringTag]() { - return ""; - }, + [Symbol.toStringTag]() { return ""; }, set [Symbol.toPrimitive](p) { } }; var it = i[Symbol.iterator]; diff --git a/tests/baselines/reference/symbolProperty19.js b/tests/baselines/reference/symbolProperty19.js index c64541691cc..5ec7968218a 100644 --- a/tests/baselines/reference/symbolProperty19.js +++ b/tests/baselines/reference/symbolProperty19.js @@ -10,9 +10,7 @@ var str = i[Symbol.toStringTag](); //// [symbolProperty19.js] var i = { [Symbol.iterator]: { p: null }, - [Symbol.toStringTag]() { - return { p: undefined }; - } + [Symbol.toStringTag]() { return { p: undefined }; } }; var it = i[Symbol.iterator]; var str = i[Symbol.toStringTag](); diff --git a/tests/baselines/reference/symbolProperty20.js b/tests/baselines/reference/symbolProperty20.js index 558305a577d..df7516552e0 100644 --- a/tests/baselines/reference/symbolProperty20.js +++ b/tests/baselines/reference/symbolProperty20.js @@ -12,7 +12,5 @@ var i: I = { //// [symbolProperty20.js] var i = { [Symbol.iterator]: s => { return s; }, - [Symbol.toStringTag](n) { - return n; - } + [Symbol.toStringTag](n) { return n; } }; diff --git a/tests/baselines/reference/taggedTemplateContextualTyping1.js b/tests/baselines/reference/taggedTemplateContextualTyping1.js index 173d0f56bb7..17618b50e8b 100644 --- a/tests/baselines/reference/taggedTemplateContextualTyping1.js +++ b/tests/baselines/reference/taggedTemplateContextualTyping1.js @@ -26,28 +26,7 @@ function tempTag1(...rest) { // Otherwise, the arrow functions' parameters will be typed as 'any', // and it is an error to invoke an any-typed value with type arguments, // so this test will error. -tempTag1 `${x => { - x(undefined); - return x; -}}${10}`; -tempTag1 `${x => { - x(undefined); - return x; -}}${y => { - y(undefined); - return y; -}}${10}`; -tempTag1 `${x => { - x(undefined); - return x; -}}${(y) => { - y(undefined); - return y; -}}${undefined}`; -tempTag1 `${(x) => { - x(undefined); - return x; -}}${y => { - y(undefined); - return y; -}}${undefined}`; +tempTag1 `${x => { x(undefined); return x; }}${10}`; +tempTag1 `${x => { x(undefined); return x; }}${y => { y(undefined); return y; }}${10}`; +tempTag1 `${x => { x(undefined); return x; }}${(y) => { y(undefined); return y; }}${undefined}`; +tempTag1 `${(x) => { x(undefined); return x; }}${y => { y(undefined); return y; }}${undefined}`; diff --git a/tests/baselines/reference/taggedTemplateContextualTyping2.js b/tests/baselines/reference/taggedTemplateContextualTyping2.js index 1eed600da4c..8adea53f470 100644 --- a/tests/baselines/reference/taggedTemplateContextualTyping2.js +++ b/tests/baselines/reference/taggedTemplateContextualTyping2.js @@ -25,18 +25,6 @@ function tempTag2(...rest) { // Otherwise, the arrow functions' parameters will be typed as 'any', // and it is an error to invoke an any-typed value with type arguments, // so this test will error. -tempTag2 `${x => { - x(undefined); - return x; -}}${0}`; -tempTag2 `${x => { - x(undefined); - return x; -}}${y => { - y(null); - return y; -}}${"hello"}`; -tempTag2 `${x => { - x(undefined); - return x; -}}${undefined}${"hello"}`; +tempTag2 `${x => { x(undefined); return x; }}${0}`; +tempTag2 `${x => { x(undefined); return x; }}${y => { y(null); return y; }}${"hello"}`; +tempTag2 `${x => { x(undefined); return x; }}${undefined}${"hello"}`; diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js index 14a7015f803..bbcd6637964 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js @@ -136,9 +136,7 @@ someGenerics7 "" + function (n) { return n; } + function (n) { return n; } + fun someGenerics7 "" + function (n) { return n; } + function (n) { return n; } + function (n) { return n; }; someGenerics7 "" + function (n) { return n; } + function (n) { return n; } + function (n) { return n; }; // Generic tag with argument of generic function type -function someGenerics8(strs, n) { - return n; -} +function someGenerics8(strs, n) { return n; } var x = someGenerics8 "" + someGenerics7; x "" + null + null + null; // Generic tag with multiple parameters of generic type passed arguments with no best common type diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js index 25203c40d91..3f1817c6419 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js @@ -135,9 +135,7 @@ someGenerics7 `${n => { return n; }}${n => { return n; }}${n => { return n; }}`; someGenerics7 `${n => { return n; }}${n => { return n; }}${n => { return n; }}`; someGenerics7 `${(n) => { return n; }}${(n) => { return n; }}${(n) => { return n; }}`; // Generic tag with argument of generic function type -function someGenerics8(strs, n) { - return n; -} +function someGenerics8(strs, n) { return n; } var x = someGenerics8 `${someGenerics7}`; x `${null}${null}${null}`; // Generic tag with multiple parameters of generic type passed arguments with no best common type diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js index a28e0103a7e..c6abf11419a 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js @@ -74,15 +74,11 @@ fn5 `${ (n) => n.substr(0) }`; //// [taggedTemplateStringsWithOverloadResolution3.js] -function fn1() { - return null; -} +function fn1() { return null; } var s = fn1 "" + undefined; // No candidate overloads found fn1 "" + {}; // Error -function fn2() { - return undefined; -} +function fn2() { return undefined; } var d1 = fn2 "" + 0 + undefined; // contextually typed var d2 = fn2 "" + 0 + undefined; // any d1.foo(); // error @@ -91,9 +87,7 @@ d2(); // no error (typed as any) fn2 "" + 0 + ''; // OK // Generic and non-generic overload where non-generic overload is the only candidate fn2 "" + '' + 0; // OK -function fn3() { - return null; -} +function fn3() { return null; } var s = fn3 "" + 3; var s = fn3 "" + '' + 3 + ''; var n = fn3 "" + 5 + 5 + 5; @@ -115,8 +109,6 @@ fn4 "" + null + null; // Error // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4 "" + true + null; fn4 "" + null + true; -function fn5() { - return undefined; -} +function fn5() { return undefined; } fn5 "" + function (n) { return n.toFixed(); }; // will error; 'n' should have type 'string'. fn5 "" + function (n) { return n.substr(0); }; diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js index 75a01df6af6..8bcc426627d 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js @@ -73,15 +73,11 @@ fn5 `${ (n) => n.substr(0) }`; //// [taggedTemplateStringsWithOverloadResolution3_ES6.js] -function fn1() { - return null; -} +function fn1() { return null; } var s = fn1 `${undefined}`; // No candidate overloads found fn1 `${{}}`; // Error -function fn2() { - return undefined; -} +function fn2() { return undefined; } var d1 = fn2 `${0}${undefined}`; // contextually typed var d2 = fn2 `${0}${undefined}`; // any d1.foo(); // error @@ -90,9 +86,7 @@ d2(); // no error (typed as any) fn2 `${0}${''}`; // OK // Generic and non-generic overload where non-generic overload is the only candidate fn2 `${''}${0}`; // OK -function fn3() { - return null; -} +function fn3() { return null; } var s = fn3 `${3}`; var s = fn3 `${''}${3}${''}`; var n = fn3 `${5}${5}${5}`; @@ -114,8 +108,6 @@ fn4 `${null}${null}`; // Error // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4 `${true}${null}`; fn4 `${null}${true}`; -function fn5() { - return undefined; -} +function fn5() { return undefined; } fn5 `${(n) => { return n.toFixed(); }}`; // will error; 'n' should have type 'string'. fn5 `${(n) => { return n.substr(0); }}`; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js index eb46f4b603f..a4dd1619642 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js @@ -13,6 +13,4 @@ function foo() { rest[_i - 0] = arguments[_i]; } } -foo "" + function (x) { - x = "bad"; -}; +foo "" + function (x) { x = "bad"; }; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js index bc18a600458..7691b83b3bc 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js @@ -8,6 +8,4 @@ foo `${function (x: number) { x = "bad"; } }`; //// [taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js] function foo(...rest) { } -foo `${function (x) { - x = "bad"; -}}`; +foo `${function (x) { x = "bad"; }}`; diff --git a/tests/baselines/reference/targetTypeArgs.js b/tests/baselines/reference/targetTypeArgs.js index 1a05a6d6f31..18dff375abe 100644 --- a/tests/baselines/reference/targetTypeArgs.js +++ b/tests/baselines/reference/targetTypeArgs.js @@ -18,24 +18,10 @@ foo(function(x) { x }); function foo(callback) { callback("hello"); } -foo(function (x) { - x; -}); -[1].forEach(function (v, i, a) { - v; -}); -["hello"].every(function (v, i, a) { - return true; -}); -[1].every(function (v, i, a) { - return true; -}); -[1].every(function (v, i, a) { - return true; -}); -["s"].every(function (v, i, a) { - return true; -}); -["s"].forEach(function (v, i, a) { - v; -}); +foo(function (x) { x; }); +[1].forEach(function (v, i, a) { v; }); +["hello"].every(function (v, i, a) { return true; }); +[1].every(function (v, i, a) { return true; }); +[1].every(function (v, i, a) { return true; }); +["s"].every(function (v, i, a) { return true; }); +["s"].forEach(function (v, i, a) { v; }); diff --git a/tests/baselines/reference/targetTypeBaseCalls.js b/tests/baselines/reference/targetTypeBaseCalls.js index b09d4960d01..c886183bacf 100644 --- a/tests/baselines/reference/targetTypeBaseCalls.js +++ b/tests/baselines/reference/targetTypeBaseCalls.js @@ -31,18 +31,12 @@ var Foo = (function () { } return Foo; })(); -foo(function (s) { - s = 5; -}); // Error, can’t assign number to string -new Foo(function (s) { - s = 5; -}); // error, if types are applied correctly +foo(function (s) { s = 5; }); // Error, can’t assign number to string +new Foo(function (s) { s = 5; }); // error, if types are applied correctly var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.call(this, function (s) { - s = 5; - }); + _super.call(this, function (s) { s = 5; }); } return Bar; })(Foo); // error, if types are applied correctly diff --git a/tests/baselines/reference/targetTypeCalls.js b/tests/baselines/reference/targetTypeCalls.js index 302419a2693..168195216ca 100644 --- a/tests/baselines/reference/targetTypeCalls.js +++ b/tests/baselines/reference/targetTypeCalls.js @@ -6,27 +6,7 @@ var fra3: (v:any)=>string = function() { return function() { return function(v) var fra4: (v:any)=>void = function() { return function() { return function(v) {return v;};}(); }() // should work //// [targetTypeCalls.js] -var fra1 = function () { - return function (v) { - return v; - }; -}(); // should work -var fra2 = function () { - return function () { - return 0; - }; -}(); // should work -var fra3 = function () { - return function () { - return function (v) { - return v; - }; - }(); -}(); // should work -var fra4 = function () { - return function () { - return function (v) { - return v; - }; - }(); -}(); // should work +var fra1 = function () { return function (v) { return v; }; }(); // should work +var fra2 = function () { return function () { return 0; }; }(); // should work +var fra3 = function () { return function () { return function (v) { return v; }; }(); }(); // should work +var fra4 = function () { return function () { return function (v) { return v; }; }(); }(); // should work diff --git a/tests/baselines/reference/targetTypeCastTest.js b/tests/baselines/reference/targetTypeCastTest.js index c9a30c6d685..053aced7305 100644 --- a/tests/baselines/reference/targetTypeCastTest.js +++ b/tests/baselines/reference/targetTypeCastTest.js @@ -28,12 +28,8 @@ function Point(x, y) { this.x = x; this.y = y; } -var add = function (x, y) { - return x + y; -}; +var add = function (x, y) { return x + y; }; var add2 = function (x, y) { return 0; }; -function add3(x, y) { - x; -} +function add3(x, y) { x; } diff --git a/tests/baselines/reference/targetTypeTest1.js b/tests/baselines/reference/targetTypeTest1.js index 94af7579fbb..8f9657ee9d0 100644 --- a/tests/baselines/reference/targetTypeTest1.js +++ b/tests/baselines/reference/targetTypeTest1.js @@ -80,9 +80,7 @@ function Point(x, y) { this.x = x; this.y = y; } -function EF1(a, b) { - return a + b; -} +function EF1(a, b) { return a + b; } var x = EF1(1, 2); // Point.origin declared as type Point Point.origin = new Point(0, 0); @@ -110,6 +108,10 @@ function C(a, b) { this.a = a; this.b = b; } -C.prototype = { a: 0, b: 0, C1M1: function (c, d) { - return (this.a + c) + (this.b + d); -} }; +C.prototype = + { a: 0, + b: 0, + C1M1: function (c, d) { + return (this.a + c) + (this.b + d); + } + }; diff --git a/tests/baselines/reference/targetTypeTest2.js b/tests/baselines/reference/targetTypeTest2.js index c6f940572ef..0ba82bc9cce 100644 --- a/tests/baselines/reference/targetTypeTest2.js +++ b/tests/baselines/reference/targetTypeTest2.js @@ -14,9 +14,7 @@ function func2(stuff1:string, stuff2:number, stuff3:number) { //// [targetTypeTest2.js] // Test target typing for array literals and call expressions var a = [1, 2, "3"]; -function func1(stuff) { - return stuff; -} +function func1(stuff) { return stuff; } function func2(stuff1, stuff2, stuff3) { return func1([stuff1, stuff2, stuff3]); } diff --git a/tests/baselines/reference/targetTypeTest3.js b/tests/baselines/reference/targetTypeTest3.js index 53e5691ab49..13972478582 100644 --- a/tests/baselines/reference/targetTypeTest3.js +++ b/tests/baselines/reference/targetTypeTest3.js @@ -14,9 +14,7 @@ function func2(stuff1:string, stuff2:number, stuff3:number) { //// [targetTypeTest3.js] // Test target typing for array literals and call expressions var a = [1, 2, "3"]; // should produce an error -function func1(stuff) { - return stuff; -} +function func1(stuff) { return stuff; } function func2(stuff1, stuff2, stuff3) { return func1([stuff1, stuff2, stuff3]); } diff --git a/tests/baselines/reference/targetTypeVoidFunc.js b/tests/baselines/reference/targetTypeVoidFunc.js index 9913b4bd491..dba2086b0e1 100644 --- a/tests/baselines/reference/targetTypeVoidFunc.js +++ b/tests/baselines/reference/targetTypeVoidFunc.js @@ -9,9 +9,7 @@ var z = new (f1())(); //// [targetTypeVoidFunc.js] function f1() { - return function () { - return; - }; + return function () { return; }; } ; var x = f1(); diff --git a/tests/baselines/reference/targetTypingOnFunctions.js b/tests/baselines/reference/targetTypingOnFunctions.js index 5b11a34ff4d..fad75a4bf6d 100644 --- a/tests/baselines/reference/targetTypingOnFunctions.js +++ b/tests/baselines/reference/targetTypingOnFunctions.js @@ -4,9 +4,5 @@ var fu: (s: string) => string = function (s) { return s.toLowerCase() }; var zu = fu = function (s) { return s.toLowerCase() }; //// [targetTypingOnFunctions.js] -var fu = function (s) { - return s.toLowerCase(); -}; -var zu = fu = function (s) { - return s.toLowerCase(); -}; +var fu = function (s) { return s.toLowerCase(); }; +var zu = fu = function (s) { return s.toLowerCase(); }; diff --git a/tests/baselines/reference/templateStringInEqualityChecks.js b/tests/baselines/reference/templateStringInEqualityChecks.js index 54f5fa610c2..ca9fc2ed80b 100644 --- a/tests/baselines/reference/templateStringInEqualityChecks.js +++ b/tests/baselines/reference/templateStringInEqualityChecks.js @@ -5,4 +5,7 @@ var x = `abc${0}abc` === `abc` || "abc0abc" !== `abc${0}abc`; //// [templateStringInEqualityChecks.js] -var x = "abc" + 0 + "abc" === "abc" || "abc" !== "abc" + 0 + "abc" && "abc" + 0 + "abc" == "abc0abc" && "abc0abc" !== "abc" + 0 + "abc"; +var x = "abc" + 0 + "abc" === "abc" || + "abc" !== "abc" + 0 + "abc" && + "abc" + 0 + "abc" == "abc0abc" && + "abc0abc" !== "abc" + 0 + "abc"; diff --git a/tests/baselines/reference/templateStringInEqualityChecksES6.js b/tests/baselines/reference/templateStringInEqualityChecksES6.js index 317db1ab366..db00827fac5 100644 --- a/tests/baselines/reference/templateStringInEqualityChecksES6.js +++ b/tests/baselines/reference/templateStringInEqualityChecksES6.js @@ -5,4 +5,7 @@ var x = `abc${0}abc` === `abc` || "abc0abc" !== `abc${0}abc`; //// [templateStringInEqualityChecksES6.js] -var x = `abc${0}abc` === `abc` || `abc` !== `abc${0}abc` && `abc${0}abc` == "abc0abc" && "abc0abc" !== `abc${0}abc`; +var x = `abc${0}abc` === `abc` || + `abc` !== `abc${0}abc` && + `abc${0}abc` == "abc0abc" && + "abc0abc" !== `abc${0}abc`; diff --git a/tests/baselines/reference/templateStringInObjectLiteral.js b/tests/baselines/reference/templateStringInObjectLiteral.js index b026aedf4d3..6df5a64d78a 100644 --- a/tests/baselines/reference/templateStringInObjectLiteral.js +++ b/tests/baselines/reference/templateStringInObjectLiteral.js @@ -6,6 +6,5 @@ var x = { //// [templateStringInObjectLiteral.js] var x = { - a: "abc" + 123 + "def" -} "b"; + a: "abc" + 123 + "def" } "b"; 321; diff --git a/tests/baselines/reference/templateStringInObjectLiteralES6.js b/tests/baselines/reference/templateStringInObjectLiteralES6.js index 22144e75247..7de012185a9 100644 --- a/tests/baselines/reference/templateStringInObjectLiteralES6.js +++ b/tests/baselines/reference/templateStringInObjectLiteralES6.js @@ -6,6 +6,5 @@ var x = { //// [templateStringInObjectLiteralES6.js] var x = { - a: `abc${123}def`, -} `b`; + a: `abc${123}def`, } `b`; 321; diff --git a/tests/baselines/reference/templateStringWithEmbeddedFunctionExpression.js b/tests/baselines/reference/templateStringWithEmbeddedFunctionExpression.js index 3447ff87ac3..88a8349d1a4 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedFunctionExpression.js +++ b/tests/baselines/reference/templateStringWithEmbeddedFunctionExpression.js @@ -2,6 +2,4 @@ var x = `abc${ function y() { return y; } }def`; //// [templateStringWithEmbeddedFunctionExpression.js] -var x = "abc" + function y() { - return y; -} + "def"; +var x = "abc" + function y() { return y; } + "def"; diff --git a/tests/baselines/reference/templateStringWithEmbeddedFunctionExpressionES6.js b/tests/baselines/reference/templateStringWithEmbeddedFunctionExpressionES6.js index 46e37c0ac18..f0e2f749cfd 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedFunctionExpressionES6.js +++ b/tests/baselines/reference/templateStringWithEmbeddedFunctionExpressionES6.js @@ -2,6 +2,4 @@ var x = `abc${ function y() { return y; } }def`; //// [templateStringWithEmbeddedFunctionExpressionES6.js] -var x = `abc${function y() { - return y; -}}def`; +var x = `abc${function y() { return y; }}def`; diff --git a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js index ef113312060..72d0fd8c8db 100644 --- a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js +++ b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js @@ -4,6 +4,4 @@ `${function (x: number) { x = "bad"; } }`; //// [templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js] -"" + function (x) { - x = "bad"; -}; +"" + function (x) { x = "bad"; }; diff --git a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js index 9ce47348dc1..18fae66c78a 100644 --- a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js +++ b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js @@ -3,6 +3,4 @@ `${function (x: number) { x = "bad"; } }`; //// [templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js] -`${function (x) { - x = "bad"; -}}`; +`${function (x) { x = "bad"; }}`; diff --git a/tests/baselines/reference/thisBinding2.js b/tests/baselines/reference/thisBinding2.js index ced47c0bc7b..76b99797e16 100644 --- a/tests/baselines/reference/thisBinding2.js +++ b/tests/baselines/reference/thisBinding2.js @@ -40,8 +40,6 @@ var messenger = { message: "Hello World", start: function () { var _this = this; - return setTimeout(function () { - var x = _this.message; - }, 3000); + return setTimeout(function () { var x = _this.message; }, 3000); } }; diff --git a/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.js b/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.js index fb917edf753..78b06d30dd2 100644 --- a/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.js +++ b/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.js @@ -10,9 +10,7 @@ var C = (function () { } C.prototype.foo = function () { var _this = this; - [1, 2, 3].map(function (x) { - return _this; - }); + [1, 2, 3].map(function (x) { return _this; }); }; return C; })(); diff --git a/tests/baselines/reference/thisInPropertyBoundDeclarations.js b/tests/baselines/reference/thisInPropertyBoundDeclarations.js index 36ee45b1110..3f1bac98075 100644 --- a/tests/baselines/reference/thisInPropertyBoundDeclarations.js +++ b/tests/baselines/reference/thisInPropertyBoundDeclarations.js @@ -100,15 +100,11 @@ var A = (function () { } }; this.prop4 = { - a: function () { - return this; - } + a: function () { return this; } }; this.prop5 = function () { return { - a: function () { - return this; - } + a: function () { return this; } }; }; } @@ -120,18 +116,17 @@ var B = (function () { this.prop1 = this; this.prop2 = function () { return _this; }; this.prop3 = function () { return function () { return function () { return function () { return _this; }; }; }; }; - this.prop4 = ' ' + function () { - } + ' ' + (function () { return function () { return function () { return _this; }; }; }); + this.prop4 = ' ' + + function () { + } + + ' ' + + (function () { return function () { return function () { return _this; }; }; }); this.prop5 = { - a: function () { - return _this; - } + a: function () { return _this; } }; this.prop6 = function () { return { - a: function () { - return _this; - } + a: function () { return _this; } }; }; } diff --git a/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js b/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js index d6718a56106..99341af9f86 100644 --- a/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js +++ b/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js @@ -10,7 +10,7 @@ function test() //// [thisReferencedInFunctionInsideArrowFunction1.js] var foo = function (dummy) { }; function test() { - foo(function () { return function () { - return this; - }; }); + foo(function () { + return function () { return this; }; + }); } diff --git a/tests/baselines/reference/throwInEnclosingStatements.js b/tests/baselines/reference/throwInEnclosingStatements.js index b52926e651e..0b072434f33 100644 --- a/tests/baselines/reference/throwInEnclosingStatements.js +++ b/tests/baselines/reference/throwInEnclosingStatements.js @@ -50,9 +50,7 @@ var aa = { function fn(x) { throw x; } -(function (x) { - throw x; -}); +(function (x) { throw x; }); var y; switch (y) { case 'a': diff --git a/tests/baselines/reference/throwStatements.js b/tests/baselines/reference/throwStatements.js index 146d1232792..83663d08cc4 100644 --- a/tests/baselines/reference/throwStatements.js +++ b/tests/baselines/reference/throwStatements.js @@ -97,9 +97,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -108,9 +106,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var aNumber = 9.9; @@ -155,9 +151,7 @@ throw false; throw null; throw undefined; throw 'a string'; -throw function () { - return 'a string'; -}; +throw function () { return 'a string'; }; throw function (x) { return 42; }; throw { x: 12, y: 13 }; throw []; diff --git a/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.js b/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.js index 8aa23c82469..4b00c5fd0f2 100644 --- a/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.js +++ b/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.js @@ -19,10 +19,6 @@ var r1b = _.map(c2, rf1); //// [tooFewArgumentsInGenericFunctionTypedArgument.js] var c2; var _; -var r1a = _.map(c2, function (x) { - return x.toFixed(); -}); -var rf1 = function (x) { - return x.toFixed(); -}; +var r1a = _.map(c2, function (x) { return x.toFixed(); }); +var rf1 = function (x) { return x.toFixed(); }; var r1b = _.map(c2, rf1); diff --git a/tests/baselines/reference/topLevelExports.js b/tests/baselines/reference/topLevelExports.js index 0f539310b15..91e28b6a976 100644 --- a/tests/baselines/reference/topLevelExports.js +++ b/tests/baselines/reference/topLevelExports.js @@ -8,8 +8,6 @@ void log(foo).toString(); //// [topLevelExports.js] define(["require", "exports"], function (require, exports) { exports.foo = 3; - function log(n) { - return n; - } + function log(n) { return n; } void log(exports.foo).toString(); }); diff --git a/tests/baselines/reference/topLevelLambda.js b/tests/baselines/reference/topLevelLambda.js index 756a42b4340..3c4f1a3bc84 100644 --- a/tests/baselines/reference/topLevelLambda.js +++ b/tests/baselines/reference/topLevelLambda.js @@ -8,7 +8,5 @@ module M { var M; (function (M) { var _this = this; - var f = function () { - _this.window; - }; + var f = function () { _this.window; }; })(M || (M = {})); diff --git a/tests/baselines/reference/topLevelLambda3.js b/tests/baselines/reference/topLevelLambda3.js index 1505e38956a..0314b356b0f 100644 --- a/tests/baselines/reference/topLevelLambda3.js +++ b/tests/baselines/reference/topLevelLambda3.js @@ -3,6 +3,4 @@ var f = () => {this.window;} //// [topLevelLambda3.js] var _this = this; -var f = function () { - _this.window; -}; +var f = function () { _this.window; }; diff --git a/tests/baselines/reference/twoAccessorsWithSameName.js b/tests/baselines/reference/twoAccessorsWithSameName.js index 2d15bf6a02a..1e447ea1205 100644 --- a/tests/baselines/reference/twoAccessorsWithSameName.js +++ b/tests/baselines/reference/twoAccessorsWithSameName.js @@ -39,9 +39,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/twoAccessorsWithSameName2.js b/tests/baselines/reference/twoAccessorsWithSameName2.js index b6ef280156d..847f83e6a70 100644 --- a/tests/baselines/reference/twoAccessorsWithSameName2.js +++ b/tests/baselines/reference/twoAccessorsWithSameName2.js @@ -21,9 +21,7 @@ var C = (function () { function C() { } Object.defineProperty(C, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js b/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js index be252fe345b..cf5ddb23ccd 100644 --- a/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js +++ b/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js @@ -29,8 +29,7 @@ var menuData = [ "type": "image", "link": "", "icon": "modules/menu/logo.svg" - }, - { + }, { "id": "productName", "type": "default", "link": "", diff --git a/tests/baselines/reference/typeArgumentConstraintResolution1.js b/tests/baselines/reference/typeArgumentConstraintResolution1.js index 64b1bfe5b6c..fd661dd812c 100644 --- a/tests/baselines/reference/typeArgumentConstraintResolution1.js +++ b/tests/baselines/reference/typeArgumentConstraintResolution1.js @@ -15,7 +15,5 @@ foo2(""); // Type Date does not satisfy the constraint 'Number' for type p //// [typeArgumentConstraintResolution1.js] function foo1(test) { } foo1(""); // should error -function foo2(test) { - return null; -} +function foo2(test) { return null; } foo2(""); // Type Date does not satisfy the constraint 'Number' for type parameter 'T extends Number' diff --git a/tests/baselines/reference/typeArgumentInference.js b/tests/baselines/reference/typeArgumentInference.js index 65de6ea071f..1d10562ac7c 100644 --- a/tests/baselines/reference/typeArgumentInference.js +++ b/tests/baselines/reference/typeArgumentInference.js @@ -150,9 +150,7 @@ someGenerics7(function (n) { return n; }, function (n) { return n; }, function ( someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); // Generic call with argument of generic function type -function someGenerics8(n) { - return n; -} +function someGenerics8(n) { return n; } var x = someGenerics8(someGenerics7); x(null, null, null); // Generic call with multiple parameters of generic type passed arguments with no best common type diff --git a/tests/baselines/reference/typeArgumentInferenceOrdering.js b/tests/baselines/reference/typeArgumentInferenceOrdering.js index 53917844f66..96978bfd489 100644 --- a/tests/baselines/reference/typeArgumentInferenceOrdering.js +++ b/tests/baselines/reference/typeArgumentInferenceOrdering.js @@ -16,9 +16,7 @@ interface Goo { //// [typeArgumentInferenceOrdering.js] -function foo(f) { - return null; -} +function foo(f) { return null; } var x = foo(new C()).x; // was Error that property x does not exist on type {} var C = (function () { function C() { diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.js b/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.js index 50d7767b5db..941c9330a5f 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.js +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.js @@ -8,9 +8,7 @@ var e: Elephant; f(g, e); // valid because both Giraffe and Elephant satisfy the constraint. T is Animal //// [typeArgumentInferenceWithConstraintAsCommonRoot.js] -function f(x, y) { - return undefined; -} +function f(x, y) { return undefined; } var g; var e; f(g, e); // valid because both Giraffe and Elephant satisfy the constraint. T is Animal diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraints.js b/tests/baselines/reference/typeArgumentInferenceWithConstraints.js index f2300de8144..b8c051f0c37 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraints.js +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraints.js @@ -160,9 +160,7 @@ someGenerics7(function (n) { return n; }, function (n) { return n; }, function ( someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); // Generic call with argument of generic function type -function someGenerics8(n) { - return n; -} +function someGenerics8(n) { return n; } var x = someGenerics8(someGenerics7); // Error x(null, null, null); // Error // Generic call with multiple parameters of generic type passed arguments with no best common type diff --git a/tests/baselines/reference/typeAssertionToGenericFunctionType.js b/tests/baselines/reference/typeAssertionToGenericFunctionType.js index 1746cee3e85..15e5cf82f26 100644 --- a/tests/baselines/reference/typeAssertionToGenericFunctionType.js +++ b/tests/baselines/reference/typeAssertionToGenericFunctionType.js @@ -9,9 +9,7 @@ x.b(); // error //// [typeAssertionToGenericFunctionType.js] var x = { a: (function (x) { return 1; }), - b: function (x) { - x; - } + b: function (x) { x; } }; x.a(1); // bug was that this caused 'Could not find symbol T' on return type T in the type assertion on x.a's definition x.b(); // error diff --git a/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js b/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js index 9d387d850a7..9dad9fb671f 100644 --- a/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js +++ b/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js @@ -9,8 +9,8 @@ var functions = [function () { //// [typeCheckingInsideFunctionExpressionInArray.js] var functions = [function () { - var k = 10; - k = new Object(); - [1, 2, 3].NonexistantMethod(); - derp(); -}]; + var k = 10; + k = new Object(); + [1, 2, 3].NonexistantMethod(); + derp(); + }]; diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.js b/tests/baselines/reference/typeGuardsInConditionalExpression.js index ebe84879d2b..e493df66ce6 100644 --- a/tests/baselines/reference/typeGuardsInConditionalExpression.js +++ b/tests/baselines/reference/typeGuardsInConditionalExpression.js @@ -142,7 +142,8 @@ function foo7(x) { } function foo8(x) { var b; - return typeof x === "string" ? x === "hello" : ((b = x) && (typeof x === "boolean" ? x // boolean + return typeof x === "string" ? x === "hello" : ((b = x) && + (typeof x === "boolean" ? x // boolean : x == 10)); // number } function foo9(x) { diff --git a/tests/baselines/reference/typeInfer1.js b/tests/baselines/reference/typeInfer1.js index f0b14a6b6c9..f9613298838 100644 --- a/tests/baselines/reference/typeInfer1.js +++ b/tests/baselines/reference/typeInfer1.js @@ -19,7 +19,5 @@ var x = { WriteLine: function (s) { } }; var yyyyyyyy = { - Moo: function () { - return "cow"; - } + Moo: function () { return "cow"; } }; diff --git a/tests/baselines/reference/typeMatch2.js b/tests/baselines/reference/typeMatch2.js index f262adb4e18..1fd624e4e5b 100644 --- a/tests/baselines/reference/typeMatch2.js +++ b/tests/baselines/reference/typeMatch2.js @@ -93,12 +93,8 @@ function f4() { a = { x: 1, y: _any }; a = { x: 1, y: _any, z: 1 }; a = { x: 1 }; // error - var mf = function m(n) { - return false; - }; - var zf = function z(n) { - return true; - }; + var mf = function m(n) { return false; }; + var zf = function z(n) { return true; }; mf = zf; mf(_any); zf(_any); diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraint.js b/tests/baselines/reference/typeParameterAsTypeParameterConstraint.js index c54e8694c6e..9266f520867 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraint.js +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraint.js @@ -29,18 +29,14 @@ foo2(1, ['']); //// [typeParameterAsTypeParameterConstraint.js] // using a type parameter as a constraint for a type parameter is valid // no errors expected except illegal constraints -function foo(x, y) { - return y; -} +function foo(x, y) { return y; } var r = foo(1, 2); var r = foo({}, 1); var a; var b; var r2 = foo(a, b); var r3 = foo({ x: 1 }, { x: 2, y: 3 }); -function foo2(x, y) { - return y; -} +function foo2(x, y) { return y; } foo2(1, ''); foo2({}, { length: 2 }); foo2(1, { width: 3, length: 2 }); diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.js b/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.js index 9e1b3b1b3ec..e8066b9ebfa 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.js +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.js @@ -21,16 +21,12 @@ foo2([], ['']); //// [typeParameterAsTypeParameterConstraint2.js] // using a type parameter as a constraint for a type parameter is invalid // these should be errors unless otherwise noted -function foo(x, y) { - return y; -} // this is now an error +function foo(x, y) { return y; } // this is now an error foo(1, ''); foo(1, {}); var n; var r3 = foo(1, n); -function foo2(x, y) { - return y; -} // this is now an error +function foo2(x, y) { return y; } // this is now an error foo2(1, { length: '' }); foo2(1, { length: {} }); foo2([], ['']); diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.js b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.js index 20cadec3981..bc50363036d 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.js +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.js @@ -30,18 +30,14 @@ foo(b, b, { foo: 1, bar: '', hm: '' }); var a; var b; var c; -function foo(x, y, z) { - return z; -} +function foo(x, y, z) { return z; } //function foo(x: T, y: U, z: V): V { return z; } foo(1, 2, 3); foo({ x: 1 }, { x: 1, y: '' }, { x: 2, y: '', z: true }); foo(a, b, c); foo(a, b, { foo: 1, bar: '', hm: true }); foo(function (x, y) { }, function (x) { }, function () { }); -function foo2(x, y, z) { - return z; -} +function foo2(x, y, z) { return z; } //function foo2(x: T, y: U, z: V): V { return z; } foo(a, a, a); foo(a, b, c); diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.js b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.js index c63c1e9e13a..6541cfaa231 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.js +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.js @@ -29,18 +29,14 @@ foo(c, c, a); var a; var b; var c; -function foo(x, y, z) { - return z; -} +function foo(x, y, z) { return z; } //function foo(x: T, y: U, z: V): V { return z; } foo(1, 2, ''); foo({ x: 1 }, { x: 1, y: '' }, { x: 2, y: 2, z: true }); foo(a, b, a); foo(a, { foo: 1, bar: '', hm: true }, b); foo(function (x, y) { }, function (x, y) { }, function () { }); -function foo2(x, y, z) { - return z; -} +function foo2(x, y, z) { return z; } //function foo2(x: T, y: U, z: V): V { return z; } foo(b, a, c); foo(c, c, a); diff --git a/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.js b/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.js index 04fb7b1dc25..7e923941386 100644 --- a/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.js +++ b/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.js @@ -25,14 +25,10 @@ i2 = a2; // no error //// [typeParameterCompatibilityAccrossDeclarations.js] define(["require", "exports"], function (require, exports) { var a = { - x: function (y) { - return null; - } + x: function (y) { return null; } }; var a2 = { - x: function (y) { - return null; - } + x: function (y) { return null; } }; var i; var i2; diff --git a/tests/baselines/reference/typeParametersInStaticAccessors.js b/tests/baselines/reference/typeParametersInStaticAccessors.js index 2f9d8c795ff..c621de910bc 100644 --- a/tests/baselines/reference/typeParametersInStaticAccessors.js +++ b/tests/baselines/reference/typeParametersInStaticAccessors.js @@ -9,9 +9,7 @@ var foo = (function () { function foo() { } Object.defineProperty(foo, "Foo", { - get: function () { - return null; - }, + get: function () { return null; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/typeQueryOnClass.js b/tests/baselines/reference/typeQueryOnClass.js index 5c881a5ced3..1c8b2424a7e 100644 --- a/tests/baselines/reference/typeQueryOnClass.js +++ b/tests/baselines/reference/typeQueryOnClass.js @@ -82,9 +82,7 @@ var C = (function () { enumerable: true, configurable: true }); - C.prototype.baz = function (x) { - return ''; - }; + C.prototype.baz = function (x) { return ''; }; Object.defineProperty(C.prototype, "ic", { get: function () { return 1; diff --git a/tests/baselines/reference/typeofOperatorWithBooleanType.js b/tests/baselines/reference/typeofOperatorWithBooleanType.js index d7c5a1a5edf..82af3eac26f 100644 --- a/tests/baselines/reference/typeofOperatorWithBooleanType.js +++ b/tests/baselines/reference/typeofOperatorWithBooleanType.js @@ -53,15 +53,11 @@ z: typeof M.n; //// [typeofOperatorWithBooleanType.js] // typeof operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/typeofOperatorWithNumberType.js b/tests/baselines/reference/typeofOperatorWithNumberType.js index d40f09ee604..14b45ab518f 100644 --- a/tests/baselines/reference/typeofOperatorWithNumberType.js +++ b/tests/baselines/reference/typeofOperatorWithNumberType.js @@ -61,15 +61,11 @@ z: typeof M.n; // typeof operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -83,9 +79,7 @@ var ResultIsString2 = typeof NUMBER1; // number type literal var ResultIsString3 = typeof 1; var ResultIsString4 = typeof { x: 1, y: 2 }; -var ResultIsString5 = typeof { x: 1, y: function (n) { - return n; -} }; +var ResultIsString5 = typeof { x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsString6 = typeof objA.a; var ResultIsString7 = typeof M.n; diff --git a/tests/baselines/reference/typeofOperatorWithStringType.js b/tests/baselines/reference/typeofOperatorWithStringType.js index b3c3b748df6..381205ff8c1 100644 --- a/tests/baselines/reference/typeofOperatorWithStringType.js +++ b/tests/baselines/reference/typeofOperatorWithStringType.js @@ -61,15 +61,11 @@ z: typeof M.n; // typeof operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -83,9 +79,7 @@ var ResultIsString2 = typeof STRING1; // string type literal var ResultIsString3 = typeof ""; var ResultIsString4 = typeof { x: "", y: "" }; -var ResultIsString5 = typeof { x: "", y: function (s) { - return s; -} }; +var ResultIsString5 = typeof { x: "", y: function (s) { return s; } }; // string type expressions var ResultIsString6 = typeof objA.a; var ResultIsString7 = typeof M.n; diff --git a/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js b/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js index 94211010677..f314f9ad111 100644 --- a/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js +++ b/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js @@ -11,6 +11,6 @@ var functions = [function() { //// [undefinedSymbolReferencedInArrayLiteral1.js] var tokens = [{ startIndex: deltaOffset }]; var functions = [function () { - [1, 2, 3].NonexistantMethod(); - anotherNonExistingMethod(); -}]; + [1, 2, 3].NonexistantMethod(); + anotherNonExistingMethod(); + }]; diff --git a/tests/baselines/reference/underscoreTest1.js b/tests/baselines/reference/underscoreTest1.js index b9bfe51533c..bbecbac4059 100644 --- a/tests/baselines/reference/underscoreTest1.js +++ b/tests/baselines/reference/underscoreTest1.js @@ -962,21 +962,15 @@ _.range(0, 30, 5); _.range(0, 30, 5); _.range(0); /////////////////////////////////////////////////////////////////////////////////////// -var func = function (greeting) { - return greeting + ': ' + this.name; -}; +var func = function (greeting) { return greeting + ': ' + this.name; }; // need a second var otherwise typescript thinks func signature is the above func type, // instead of the newly returned _bind => func type. var func2 = _.bind(func, { name: 'moe' }, 'hi'); func2(); var buttonView = { label: 'underscore', - onClick: function () { - alert('clicked: ' + this.label); - }, - onHover: function () { - alert('hovering: ' + this.label); - } + onClick: function () { alert('clicked: ' + this.label); }, + onHover: function () { alert('hovering: ' + this.label); } }; _.bindAll(buttonView); $('#underscore_button').bind('click', buttonView.onClick); @@ -985,9 +979,7 @@ var fibonacci = _.memoize(function (n) { }); var log = _.bind(function (message) { }, Date); _.delay(log, 1000, 'logged later'); -_.defer(function () { - alert('deferred'); -}); +_.defer(function () { alert('deferred'); }); var updatePosition = function () { return alert('updating position...'); }; var throttled = _.throttle(updatePosition, 100); $(null).scroll(throttled); @@ -1002,19 +994,11 @@ var notes; var render = function () { return alert("rendering..."); }; var renderNotes = _.after(notes.length, render); _.each(notes, function (note) { return note.asyncSave({ success: renderNotes }); }); -var hello = function (name) { - return "hello: " + name; -}; -hello = _.wrap(hello, function (func, arg) { - return "before, " + func(arg) + ", after"; -}); +var hello = function (name) { return "hello: " + name; }; +hello = _.wrap(hello, function (func, arg) { return "before, " + func(arg) + ", after"; }); hello("moe"); -var greet = function (name) { - return "hi: " + name; -}; -var exclaim = function (statement) { - return statement + "!"; -}; +var greet = function (name) { return "hi: " + name; }; +var exclaim = function (statement) { return statement + "!"; }; var welcome = _.compose(exclaim, greet); welcome('moe'); /////////////////////////////////////////////////////////////////////////////////////// @@ -1029,11 +1013,7 @@ _.omit({ name: 'moe', age: 50, userid: 'moe1' }, 'userid'); var iceCream = { flavor: "chocolate" }; _.defaults(iceCream, { flavor: "vanilla", sprinkles: "lots" }); _.clone({ name: 'moe' }); -_.chain([1, 2, 3, 200]).filter(function (num) { - return num % 2 == 0; -}).tap(alert).map(function (num) { - return num * num; -}).value(); +_.chain([1, 2, 3, 200]).filter(function (num) { return num % 2 == 0; }).tap(alert).map(function (num) { return num * num; }).value(); _.has({ a: 1, b: 2, c: 3 }, "b"); var moe = { name: 'moe', luckyNumbers: [13, 27, 34] }; var clone = { name: 'moe', luckyNumbers: [13, 27, 34] }; @@ -1042,9 +1022,7 @@ _.isEqual(moe, clone); _.isEmpty([1, 2, 3]); _.isEmpty({}); _.isElement($('body')[0]); -(function () { - return _.isArray(arguments); -})(); +(function () { return _.isArray(arguments); })(); _.isArray([1, 2, 3]); _.isObject({}); _.isObject(1); @@ -1069,9 +1047,7 @@ var underscore = _.noConflict(); var moe2 = { name: 'moe' }; moe2 === _.identity(moe); var genie; -_.times(3, function (n) { - genie.grantWishNumber(n); -}); +_.times(3, function (n) { genie.grantWishNumber(n); }); _.random(0, 100); _.mixin({ capitalize: function (string) { @@ -1081,9 +1057,7 @@ _.mixin({ _("fabio").capitalize(); _.uniqueId('contact_'); _.escape('Curly, Larry & Moe'); -var object = { cheese: 'crumpets', stuff: function () { - return 'nonsense'; -} }; +var object = { cheese: 'crumpets', stuff: function () { return 'nonsense'; } }; _.result(object, 'cheese'); _.result(object, 'stuff'); var compiled = _.template("hello: <%= name %>"); diff --git a/tests/baselines/reference/unexpectedStatementBlockTerminator.js b/tests/baselines/reference/unexpectedStatementBlockTerminator.js index c4bf2c51aee..87b4652375a 100644 --- a/tests/baselines/reference/unexpectedStatementBlockTerminator.js +++ b/tests/baselines/reference/unexpectedStatementBlockTerminator.js @@ -18,6 +18,4 @@ var Bar = (function () { } return Bar; })(); -function Goo() { - return { a: 1, b: 2 }; -} +function Goo() { return { a: 1, b: 2 }; } diff --git a/tests/baselines/reference/unknownSymbols2.js b/tests/baselines/reference/unknownSymbols2.js index ba1b92ef71c..b158f5c9503 100644 --- a/tests/baselines/reference/unknownSymbols2.js +++ b/tests/baselines/reference/unknownSymbols2.js @@ -51,9 +51,7 @@ var M; break; } var a = function () { return asdf; }; - var b = function (asdf) { - return qwerty; - }; + var b = function (asdf) { return qwerty; }; var N; (function (N) { var x = 1; diff --git a/tests/baselines/reference/unspecializedConstraints.js b/tests/baselines/reference/unspecializedConstraints.js index f7974578ee2..0ca464a93af 100644 --- a/tests/baselines/reference/unspecializedConstraints.js +++ b/tests/baselines/reference/unspecializedConstraints.js @@ -240,7 +240,9 @@ var ts; this.flags = flags; } Property.prototype.equals = function (other) { - return this.name === other.name && this.flags === other.flags && this.type.equals(other.type); + return this.name === other.name && + this.flags === other.flags && + this.type.equals(other.type); }; return Property; })(Symbol); @@ -258,10 +260,14 @@ var ts; this.returnType = returnType; } Signature.prototype.equalsNoReturn = function (other) { - return this.parameters.length === other.parameters.length && this.typeParameters.length === other.typeParameters.length && arrayEquals(this.parameters, other.parameters) && arrayEquals(this.typeParameters, other.typeParameters); + return this.parameters.length === other.parameters.length && + this.typeParameters.length === other.typeParameters.length && + arrayEquals(this.parameters, other.parameters) && + arrayEquals(this.typeParameters, other.typeParameters); }; Signature.prototype.equals = function (other) { - return this.equalsNoReturn(other) && this.returnType.equals(other.returnType); + return this.equalsNoReturn(other) && + this.returnType.equals(other.returnType); }; return Signature; })(Symbol); @@ -274,7 +280,9 @@ var ts; this.flags = flags; } Parameter.prototype.equals = function (other) { - return this.name === other.name && this.flags === other.flags && this.type.equals(other.type); + return this.name === other.name && + this.flags === other.flags && + this.type.equals(other.type); }; return Parameter; })(Symbol); diff --git a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js index 9ff4a5c469a..9e0ff95536d 100644 --- a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js +++ b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js @@ -51,9 +51,7 @@ var __extends = this.__extends || function (d, b) { d.prototype = new __(); }; // none of these function calls should be allowed -var x = function () { - return; -}; +var x = function () { return; }; var r1 = x(); var y = x; var r2 = y(); diff --git a/tests/baselines/reference/validMultipleVariableDeclarations.js b/tests/baselines/reference/validMultipleVariableDeclarations.js index 5c65d388711..16c47ce8ee2 100644 --- a/tests/baselines/reference/validMultipleVariableDeclarations.js +++ b/tests/baselines/reference/validMultipleVariableDeclarations.js @@ -59,9 +59,7 @@ var p = { x: 1, y: undefined }; var p = { x: 1, y: 2 }; var p = { x: 0, y: undefined }; var p; -var fn = function (s) { - return 42; -}; +var fn = function (s) { return 42; }; var fn = function (s) { return 3; }; var fn; var fn; diff --git a/tests/baselines/reference/voidFunctionAssignmentCompat.js b/tests/baselines/reference/voidFunctionAssignmentCompat.js index 42e0f99ec31..0b7c4b60d89 100644 --- a/tests/baselines/reference/voidFunctionAssignmentCompat.js +++ b/tests/baselines/reference/voidFunctionAssignmentCompat.js @@ -20,39 +20,15 @@ var frv3: (v:any)=>number = (function() { return function () { return 0; } })() //// [voidFunctionAssignmentCompat.js] -var fa = function () { - return 3; -}; +var fa = function () { return 3; }; fa = function () { }; // should not work var fv = function () { }; -fv = function () { - return 0; -}; // should work -function execAny(callback) { - return callback(0); -} +fv = function () { return 0; }; // should work +function execAny(callback) { return callback(0); } execAny(function () { }); // should work -function execVoid(callback) { - callback(0); -} -execVoid(function () { - return 0; -}); // should work -var fra = function () { - return function () { }; -}; // should work -var frv = function () { - return function () { - return 0; - }; -}; // should work -var fra3 = (function () { - return function (v) { - return v; - }; -})(); // should work -var frv3 = (function () { - return function () { - return 0; - }; -})(); // should work +function execVoid(callback) { callback(0); } +execVoid(function () { return 0; }); // should work +var fra = function () { return function () { }; }; // should work +var frv = function () { return function () { return 0; }; }; // should work +var fra3 = (function () { return function (v) { return v; }; })(); // should work +var frv3 = (function () { return function () { return 0; }; })(); // should work diff --git a/tests/baselines/reference/voidOperatorWithBooleanType.js b/tests/baselines/reference/voidOperatorWithBooleanType.js index 64c09e2ea65..69c609c1280 100644 --- a/tests/baselines/reference/voidOperatorWithBooleanType.js +++ b/tests/baselines/reference/voidOperatorWithBooleanType.js @@ -41,15 +41,11 @@ void M.n; //// [voidOperatorWithBooleanType.js] // void operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/voidOperatorWithNumberType.js b/tests/baselines/reference/voidOperatorWithNumberType.js index e37e5a82577..2426690489d 100644 --- a/tests/baselines/reference/voidOperatorWithNumberType.js +++ b/tests/baselines/reference/voidOperatorWithNumberType.js @@ -49,15 +49,11 @@ void objA.a, M.n; // void operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -71,9 +67,7 @@ var ResultIsAny2 = void NUMBER1; // number type literal var ResultIsAny3 = void 1; var ResultIsAny4 = void { x: 1, y: 2 }; -var ResultIsAny5 = void { x: 1, y: function (n) { - return n; -} }; +var ResultIsAny5 = void { x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsAny6 = void objA.a; var ResultIsAny7 = void M.n; diff --git a/tests/baselines/reference/voidOperatorWithStringType.js b/tests/baselines/reference/voidOperatorWithStringType.js index 7954f50bf57..9f30d1fcb0c 100644 --- a/tests/baselines/reference/voidOperatorWithStringType.js +++ b/tests/baselines/reference/voidOperatorWithStringType.js @@ -48,15 +48,11 @@ void objA.a,M.n; // void operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -70,9 +66,7 @@ var ResultIsAny2 = void STRING1; // string type literal var ResultIsAny3 = void ""; var ResultIsAny4 = void { x: "", y: "" }; -var ResultIsAny5 = void { x: "", y: function (s) { - return s; -} }; +var ResultIsAny5 = void { x: "", y: function (s) { return s; } }; // string type expressions var ResultIsAny6 = void objA.a; var ResultIsAny7 = void M.n; diff --git a/tests/baselines/reference/witness.js b/tests/baselines/reference/witness.js index 607c2415044..82a1298f156 100644 --- a/tests/baselines/reference/witness.js +++ b/tests/baselines/reference/witness.js @@ -210,9 +210,7 @@ function fnArg1(x, y) { var x; fnArg1(fnArg1, 0); } -function overload1() { - return undefined; -} +function overload1() { return undefined; } ; function fnArg2() { return overload1(fnArg2); diff --git a/tests/baselines/reference/wrappedAndRecursiveConstraints3.js b/tests/baselines/reference/wrappedAndRecursiveConstraints3.js index 01f591de323..fb0f5388aaa 100644 --- a/tests/baselines/reference/wrappedAndRecursiveConstraints3.js +++ b/tests/baselines/reference/wrappedAndRecursiveConstraints3.js @@ -30,6 +30,6 @@ var C = (function () { })(); var c = new C({ length: 2 }); var r = c.foo({ length: 3, charAt: function (x) { - ''; -} }); + ''; + } }); var r2 = r(''); diff --git a/tests/baselines/reference/wrappedAndRecursiveConstraints4.js b/tests/baselines/reference/wrappedAndRecursiveConstraints4.js index da4117860a7..998c16a9f87 100644 --- a/tests/baselines/reference/wrappedAndRecursiveConstraints4.js +++ b/tests/baselines/reference/wrappedAndRecursiveConstraints4.js @@ -28,5 +28,5 @@ var C = (function () { var c = new C({ length: 2 }); var r = c.foo(''); var r2 = r({ length: 3, charAt: function (x) { - ''; -} }); // error + ''; + } }); // error diff --git a/tests/cases/compiler/APISample_compile.ts b/tests/cases/compiler/APISample_compile.ts index 50ec02ab6f3..f1703835380 100644 --- a/tests/cases/compiler/APISample_compile.ts +++ b/tests/cases/compiler/APISample_compile.ts @@ -21,8 +21,8 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); allDiagnostics.forEach(diagnostic => { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }); var exitCode = emitResult.emitSkipped ? 1 : 0; diff --git a/tests/cases/compiler/APISample_linter.ts b/tests/cases/compiler/APISample_linter.ts index c95d6273d4e..287a2a56dee 100644 --- a/tests/cases/compiler/APISample_linter.ts +++ b/tests/cases/compiler/APISample_linter.ts @@ -39,7 +39,7 @@ export function delint(sourceFile: ts.SourceFile) { break; case ts.SyntaxKind.BinaryExpression: - var op = (node).operator; + var op = (node).operatorToken.kind; if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) { report(node, "Use '===' and '!=='.") @@ -51,8 +51,8 @@ export function delint(sourceFile: ts.SourceFile) { } function report(node: ts.Node, message: string) { - var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); - console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) + var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); + console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) } } diff --git a/tests/cases/compiler/APISample_transform.ts b/tests/cases/compiler/APISample_transform.ts index e9d9a46d286..438b9520010 100644 --- a/tests/cases/compiler/APISample_transform.ts +++ b/tests/cases/compiler/APISample_transform.ts @@ -54,7 +54,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { return { outputs: outputs, errors: errors.map(function (e) { - return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) }; diff --git a/tests/cases/compiler/APISample_watcher.ts b/tests/cases/compiler/APISample_watcher.ts index 212f83b3935..3b1c83419bf 100644 --- a/tests/cases/compiler/APISample_watcher.ts +++ b/tests/cases/compiler/APISample_watcher.ts @@ -87,8 +87,8 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); diff --git a/tests/cases/compiler/es6ImportDefaultBinding.ts b/tests/cases/compiler/es6ImportDefaultBinding.ts new file mode 100644 index 00000000000..dc5b4ab98d6 --- /dev/null +++ b/tests/cases/compiler/es6ImportDefaultBinding.ts @@ -0,0 +1,8 @@ +// @target: es6 +// @module: commonjs + +// @filename: es6ImportDefaultBinding_0.ts +export var a = 10; + +// @filename: es6ImportDefaultBinding_1.ts +import defaultBinding from "es6ImportDefaultBinding_0"; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport.ts b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport.ts new file mode 100644 index 00000000000..96b277d6640 --- /dev/null +++ b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport.ts @@ -0,0 +1,15 @@ +// @target: es6 +// @module: commonjs + +// @filename: es6ImportDefaultBindingFollowedWithNamedImport_0.ts +export var a = 10; +export var x = a; +export var m = a; + +// @filename: es6ImportDefaultBindingFollowedWithNamedImport_1.ts +import defaultBinding, { } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding, { a } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; +import defaultBinding, { m, } from "es6ImportDefaultBindingFollowedWithNamedImport_0"; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5.ts b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5.ts new file mode 100644 index 00000000000..bf34687f791 --- /dev/null +++ b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5.ts @@ -0,0 +1,15 @@ +// @target: es5 +// @module: commonjs + +// @filename: es6ImportDefaultBindingFollowedWithNamedImportInEs5_0.ts +export var a = 10; +export var x = a; +export var m = a; + +// @filename: es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts +import defaultBinding, { } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding, { a } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; +import defaultBinding, { m, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding.ts b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding.ts new file mode 100644 index 00000000000..3d029e28738 --- /dev/null +++ b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding.ts @@ -0,0 +1,8 @@ +// @target: es6 +// @module: commonjs + +// @filename: es6ImportDefaultBindingFollowedWithNamespaceBinding_0.ts +export var a = 10; + +// @filename: es6ImportDefaultBindingFollowedWithNamespaceBinding_1.ts +import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBinding_0"; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.ts b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.ts new file mode 100644 index 00000000000..5943fa8bfc4 --- /dev/null +++ b/tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5.ts @@ -0,0 +1,8 @@ +// @target: es5 +// @module: commonjs + +// @filename: es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0.ts +export var a = 10; + +// @filename: es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_1.ts +import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBindingInEs5_0"; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportDefaultBindingInEs5.ts b/tests/cases/compiler/es6ImportDefaultBindingInEs5.ts new file mode 100644 index 00000000000..c037d283dfa --- /dev/null +++ b/tests/cases/compiler/es6ImportDefaultBindingInEs5.ts @@ -0,0 +1,8 @@ +// @target: es5 +// @module: commonjs + +// @filename: es6ImportDefaultBindingInEs5_0.ts +export var a = 10; + +// @filename: es6ImportDefaultBindingInEs5_1.ts +import defaultBinding from "es6ImportDefaultBindingInEs5_0"; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportNameSpaceImport.ts b/tests/cases/compiler/es6ImportNameSpaceImport.ts new file mode 100644 index 00000000000..9937606c41f --- /dev/null +++ b/tests/cases/compiler/es6ImportNameSpaceImport.ts @@ -0,0 +1,8 @@ +// @target: es6 +// @module: commonjs + +// @filename: es6ImportNameSpaceImport_0.ts +export var a = 10; + +// @filename: es6ImportNameSpaceImport_1.ts +import * as nameSpaceBinding from "es6ImportNameSpaceImport_0"; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportNameSpaceImportInEs5.ts b/tests/cases/compiler/es6ImportNameSpaceImportInEs5.ts new file mode 100644 index 00000000000..ca00ac3f981 --- /dev/null +++ b/tests/cases/compiler/es6ImportNameSpaceImportInEs5.ts @@ -0,0 +1,8 @@ +// @target: es5 +// @module: commonjs + +// @filename: es6ImportNameSpaceImportInEs5_0.ts +export var a = 10; + +// @filename: es6ImportNameSpaceImportInEs5_1.ts +import * as nameSpaceBinding from "es6ImportNameSpaceImportInEs5_0"; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportNamedImport.ts b/tests/cases/compiler/es6ImportNamedImport.ts new file mode 100644 index 00000000000..ed34434bd29 --- /dev/null +++ b/tests/cases/compiler/es6ImportNamedImport.ts @@ -0,0 +1,19 @@ +// @target: es6 +// @module: commonjs + +// @filename: es6ImportNamedImport_0.ts +export var a = 10; +export var x = a; +export var m = a; +export var a1 = 10; +export var x1 = 10; + +// @filename: es6ImportNamedImport_1.ts +import { } from "es6ImportNamedImport_0"; +import { a } from "es6ImportNamedImport_0"; +import { a as b } from "es6ImportNamedImport_0"; +import { x, a as y } from "es6ImportNamedImport_0"; +import { x as z, } from "es6ImportNamedImport_0"; +import { m, } from "es6ImportNamedImport_0"; +import { a1, x1 } from "es6ImportNamedImport_0"; +import { a1 as a11, x1 as x11 } from "es6ImportNamedImport_0"; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportNamedImportIdentifiersParsing.ts b/tests/cases/compiler/es6ImportNamedImportIdentifiersParsing.ts new file mode 100644 index 00000000000..e1be293e446 --- /dev/null +++ b/tests/cases/compiler/es6ImportNamedImportIdentifiersParsing.ts @@ -0,0 +1,8 @@ +// @target: es6 +// @module: commonjs + +import { yield } from "somemodule"; // Allowed +import { default } from "somemodule"; // Error - as this is keyword that is not allowed as identifier +import { yield as default } from "somemodule"; // error to use default as binding name +import { default as yield } from "somemodule"; // no error +import { default as default } from "somemodule"; // default as is ok, error of default binding name \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportNamedImportInEs5.ts b/tests/cases/compiler/es6ImportNamedImportInEs5.ts new file mode 100644 index 00000000000..22e66bc95fa --- /dev/null +++ b/tests/cases/compiler/es6ImportNamedImportInEs5.ts @@ -0,0 +1,19 @@ +// @target: es5 +// @module: commonjs + +// @filename: es6ImportNamedImportInEs5_0.ts +export var a = 10; +export var x = a; +export var m = a; +export var a1 = 10; +export var x1 = 10; + +// @filename: es6ImportNamedImportInEs5_1.ts +import { } from "es6ImportNamedImportInEs5_0"; +import { a } from "es6ImportNamedImportInEs5_0"; +import { a as b } from "es6ImportNamedImportInEs5_0"; +import { x, a as y } from "es6ImportNamedImportInEs5_0"; +import { x as z, } from "es6ImportNamedImportInEs5_0"; +import { m, } from "es6ImportNamedImportInEs5_0"; +import { a1, x1 } from "es6ImportNamedImportInEs5_0"; +import { a1 as a11, x1 as x11 } from "es6ImportNamedImportInEs5_0"; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportNamedImportParsingError.ts b/tests/cases/compiler/es6ImportNamedImportParsingError.ts new file mode 100644 index 00000000000..a836acc1140 --- /dev/null +++ b/tests/cases/compiler/es6ImportNamedImportParsingError.ts @@ -0,0 +1,13 @@ +// @target: es6 +// @module: commonjs + +// @filename: es6ImportNamedImportParsingError_0.ts +export var a = 10; +export var x = a; +export var m = a; + +// @filename: es6ImportNamedImportParsingError_1.ts +import { * } from "es6ImportNamedImportParsingError_0"; +import defaultBinding, from "es6ImportNamedImportParsingError_0"; +import , { a } from "es6ImportNamedImportParsingError_0"; +import { a }, from "es6ImportNamedImportParsingError_0"; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportParseErrors.ts b/tests/cases/compiler/es6ImportParseErrors.ts new file mode 100644 index 00000000000..2cc21dad746 --- /dev/null +++ b/tests/cases/compiler/es6ImportParseErrors.ts @@ -0,0 +1,4 @@ +// @target: es6 +// @module: commonjs + +import 10; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportWithoutFromClause.ts b/tests/cases/compiler/es6ImportWithoutFromClause.ts new file mode 100644 index 00000000000..70a15a9bc54 --- /dev/null +++ b/tests/cases/compiler/es6ImportWithoutFromClause.ts @@ -0,0 +1,8 @@ +// @target: es6 +// @module: commonjs + +// @filename: es6ImportWithoutFromClause_0.ts +export var a = 10; + +// @filename: es6ImportWithoutFromClause_1.ts +import "es6ImportWithoutFromClause_0"; \ No newline at end of file diff --git a/tests/cases/compiler/es6ImportWithoutFromClauseInEs5.ts b/tests/cases/compiler/es6ImportWithoutFromClauseInEs5.ts new file mode 100644 index 00000000000..339880ee097 --- /dev/null +++ b/tests/cases/compiler/es6ImportWithoutFromClauseInEs5.ts @@ -0,0 +1,8 @@ +// @target: es5 +// @module: commonjs + +// @filename: es6ImportWithoutFromClauseInEs5_0.ts +export var a = 10; + +// @filename: es6ImportWithoutFromClauseInEs5_1.ts +import "es6ImportWithoutFromClauseInEs5_0"; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts new file mode 100644 index 00000000000..59a8e9d3420 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +var v = { + [s]() { }, + [n]() { }, + [s + s]() { }, + [s + n]() { }, + [+s]() { }, + [""]() { }, + [0]() { }, + [a]() { }, + [true]() { }, + [`hello bye`]() { }, + [`hello ${a} bye`]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames10.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames10.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts new file mode 100644 index 00000000000..33288184b16 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +var v = { + get [s]() { return 0; }, + set [n](v) { }, + get [s + s]() { return 0; }, + set [s + n](v) { }, + get [+s]() { return 0; }, + set [""](v) { }, + get [0]() { return 0; }, + set [a](v) { }, + get [true]() { return 0; }, + set [`hello bye`](v) { }, + get [`hello ${a} bye`]() { return 0; } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames11.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames11.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts new file mode 100644 index 00000000000..365ca67c1a3 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +class C { + [s]: number; + [n] = n; + static [s + s]: string; + [s + n] = 2; + [+s]: typeof s; + static [""]: number; + [0]: number; + [a]: number; + static [true]: number; + [`hello bye`] = 0; + static [`hello ${a} bye`] = 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts new file mode 100644 index 00000000000..fb44bfb4145 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +class C { + [s]() {} + [n]() { } + static [s + s]() { } + [s + n]() { } + [+s]() { } + static [""]() { } + [0]() { } + [a]() { } + static [true]() { } + [`hello bye`]() { } + static [`hello ${a} bye`]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames13.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames13.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts new file mode 100644 index 00000000000..8f78f279eba --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var b: boolean; +class C { + [b]() {} + static [true]() { } + [[]]() { } + static [{}]() { } + [undefined]() { } + static [null]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts new file mode 100644 index 00000000000..2baa39cf61a --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +class C { + [p1]() { } + [p2]() { } + [p3]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts new file mode 100644 index 00000000000..01204a1e619 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +class C { + get [s]() { return 0;} + set [n](v) { } + static get [s + s]() { return 0; } + set [s + n](v) { } + get [+s]() { return 0; } + static set [""](v) { } + get [0]() { return 0; } + set [a](v) { } + static get [true]() { return 0; } + set [`hello bye`](v) { } + get [`hello ${a} bye`]() { return 0; } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames16.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames16.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts new file mode 100644 index 00000000000..e52067cc7f4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var b: boolean; +class C { + get [b]() { return 0;} + static set [true](v) { } + get [[]]() { return 0; } + set [{}](v) { } + static get [undefined]() { return 0; } + set [null](v) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts new file mode 100644 index 00000000000..3c929b20ddf --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +function foo() { + var obj = { + [this.bar]: 0 + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames18.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames18.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts new file mode 100644 index 00000000000..87a1bf81178 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +module M { + var obj = { + [this.bar]: 0 + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts new file mode 100644 index 00000000000..70ba98a818c --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts @@ -0,0 +1,5 @@ +// @target: es5 +var v = { + get [0 + 1]() { return 0 }, + set [0 + 1](v: string) { } //No error +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts new file mode 100644 index 00000000000..6cff3715d83 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts @@ -0,0 +1,4 @@ +// @target: es5 +var obj = { + [this.bar]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames20.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames20.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts new file mode 100644 index 00000000000..caee82c8ea3 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +class C { + bar() { + return 0; + } + [this.bar()]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts new file mode 100644 index 00000000000..41142951421 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +class C { + bar() { + var obj = { + [this.bar()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames22.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames22.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts new file mode 100644 index 00000000000..e0a86c21842 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +class C { + bar() { + return 0; + } + [ + { [this.bar()]: 1 }[0] + ]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts new file mode 100644 index 00000000000..ff94b6c9617 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [super.bar()]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts new file mode 100644 index 00000000000..d791b8b9178 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts @@ -0,0 +1,14 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + var obj = { + [super.bar()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames25.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames25.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts new file mode 100644 index 00000000000..4b0d794b1a7 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts @@ -0,0 +1,13 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [ + { [super.bar()]: 1 }[0] + ]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts new file mode 100644 index 00000000000..1cae37aa093 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +class Base { +} +class C extends Base { + [(super(), "prop")]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts new file mode 100644 index 00000000000..c82d7b000e2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Base { +} +class C extends Base { + constructor() { + super(); + var obj = { + [(super(), "prop")]() { } + }; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames28.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames28.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts new file mode 100644 index 00000000000..c650c6e6c3f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class C { + bar() { + () => { + var obj = { + [this.bar()]() { } // needs capture + }; + } + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames29.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames29.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts new file mode 100644 index 00000000000..7c2517cd514 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName]() { } + static [methodName]() { } + get [accessorName]() { } + set [accessorName](v) { } + static get [accessorName]() { } + static set [accessorName](v) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts new file mode 100644 index 00000000000..528e9b7c583 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts @@ -0,0 +1,16 @@ +// @target: es5 +class Base { +} +class C extends Base { + constructor() { + super(); + () => { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(super(), "prop")]() { } + }; + } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts new file mode 100644 index 00000000000..39c5ca2b747 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts @@ -0,0 +1,16 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + () => { + var obj = { + [super.bar()]() { } // needs capture + }; + } + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames31.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames31.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts new file mode 100644 index 00000000000..f9c17c632ae --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 +function foo() { return '' } +class C { + bar() { + return 0; + } + [foo()]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts new file mode 100644 index 00000000000..0dcbabf4063 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +function foo() { return '' } +class C { + bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames33.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames33.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts new file mode 100644 index 00000000000..b6892f1bd80 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +function foo() { return '' } +class C { + static bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts new file mode 100644 index 00000000000..7d3df135b10 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +function foo() { return '' } +interface I { + bar(): string; + [foo()](): void; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts new file mode 100644 index 00000000000..95099715ad8 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts new file mode 100644 index 00000000000..cb931fc31d6 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames37.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames37.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts new file mode 100644 index 00000000000..5ea07aa1605 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts new file mode 100644 index 00000000000..929332c5d32 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts new file mode 100644 index 00000000000..1f34f9ad287 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var id; +class C { + [0 + 1]() { } + static [() => { }]() { } + get [delete id]() { } + set [[0, 1]](v) { } + static get [""]() { } + static set [id.toString()](v) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts new file mode 100644 index 00000000000..bba1068fef3 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + [""]() { return new Foo } + [""]() { return new Foo2 } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts new file mode 100644 index 00000000000..1e8ed7d6cd1 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + static [""]() { return new Foo } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames41.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames41.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts new file mode 100644 index 00000000000..fc181d5a548 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + [""]: Foo; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts new file mode 100644 index 00000000000..c130692c118 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts @@ -0,0 +1,13 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; +} + +class D extends C { + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts new file mode 100644 index 00000000000..4c9422ed44e --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts @@ -0,0 +1,12 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + get ["get1"]() { return new Foo } +} + +class D extends C { + set ["set1"](p: Foo) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts new file mode 100644 index 00000000000..c1eb09275c5 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts @@ -0,0 +1,13 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + get ["get1"]() { return new Foo } +} + +class D extends C { + // No error when the indexer is in a class more derived than the computed property + [s: string]: Foo2; + set ["set1"](p: Foo) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts new file mode 100644 index 00000000000..d009c960d6b --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts @@ -0,0 +1,4 @@ +// @target: es5 +var o = { + ["" || 0]: 0 +}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames46.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames46.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts new file mode 100644 index 00000000000..b158ef76447 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +enum E1 { x } +enum E2 { x } +var o = { + [E1.x || E2.x]: 0 +}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames47.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames47.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts new file mode 100644 index 00000000000..1c854603b09 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts @@ -0,0 +1,18 @@ +// @target: es5 +declare function extractIndexer(p: { [n: number]: T }): T; + +enum E { x } + +var a: any; + +extractIndexer({ + [a]: "" +}); // Should return string + +extractIndexer({ + [E.x]: "" +}); // Should return string + +extractIndexer({ + ["" || 0]: "" +}); // Should return any (widened form of undefined) \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames48.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames48.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts new file mode 100644 index 00000000000..611d6a7d30f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts @@ -0,0 +1,25 @@ + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts new file mode 100644 index 00000000000..58f97a80feb --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts @@ -0,0 +1,26 @@ +// @target: es6 + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts new file mode 100644 index 00000000000..17089b7244f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +var v = { + [s]: 0, + [n]: n, + [s + s]: 1, + [s + n]: 2, + [+s]: s, + [""]: 0, + [0]: 0, + [a]: 1, + [true]: 0, + [`hello bye`]: 0, + [`hello ${a} bye`]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames4.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames4.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts new file mode 100644 index 00000000000..f7411e7cb4f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts @@ -0,0 +1,25 @@ + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts new file mode 100644 index 00000000000..c599477c2e2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts @@ -0,0 +1,26 @@ +// @target: es6 + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts new file mode 100644 index 00000000000..e9d7d6ffab4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var b: boolean; +var v = { + [b]: 0, + [true]: 1, + [[]]: 0, + [{}]: 0, + [undefined]: undefined, + [null]: null +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts new file mode 100644 index 00000000000..0521873d70c --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +var v = { + [p1]: 0, + [p2]: 1, + [p3]: 2 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts new file mode 100644 index 00000000000..e3b379602b9 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +enum E { + member +} +var v = { + [E.member]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames7.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames7.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts new file mode 100644 index 00000000000..0723552edc2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +function f() { + var t: T; + var u: U; + var v = { + [t]: 0, + [u]: 1 + }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts new file mode 100644 index 00000000000..e1c675d95e4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +function f(s: string): string; +function f(n: number): number; +function f(x: T): T; +function f(x): any { } + +var v = { + [f("")]: 0, + [f(0)]: 0, + [f(true)]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts new file mode 100644 index 00000000000..dd208340520 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +interface I { + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts new file mode 100644 index 00000000000..d8aad5bf468 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: (x: string) => number; + [s: number]: (x: any) => number; // Doesn't get hit +} + +var o: I = { + ["" + 0](y) { return y.length; }, + ["" + 1]: y => y.length +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts new file mode 100644 index 00000000000..c9a425b5a99 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: (x: any) => number; // Doesn't get hit + [s: number]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts new file mode 100644 index 00000000000..3f5a6f7f91f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +interface I { + [s: string]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts new file mode 100644 index 00000000000..8ce0503c449 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts new file mode 100644 index 00000000000..42acf42ee2a --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts new file mode 100644 index 00000000000..9e6248878b9 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts @@ -0,0 +1,14 @@ +// @target: es5 +interface I { + [s: string]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts new file mode 100644 index 00000000000..722891c2f6a --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts @@ -0,0 +1,14 @@ +// @target: es5 +interface I { + [s: number]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts new file mode 100644 index 00000000000..5e6835b5948 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts new file mode 100644 index 00000000000..aa30d333d11 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts new file mode 100644 index 00000000000..1091304b6b2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @declaration: true +class C { + ["" + ""]() { } + get ["" + ""]() { return 0; } + set ["" + ""](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts new file mode 100644 index 00000000000..b30b8e13062 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @declaration: true +class C { + static ["" + ""]() { } + static get ["" + ""]() { return 0; } + static set ["" + ""](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts new file mode 100644 index 00000000000..aa4e3b2cf2f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts @@ -0,0 +1,5 @@ +// @target: es5 +// @declaration: true +interface I { + ["" + ""](): void; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts new file mode 100644 index 00000000000..9a6e17f4c93 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts @@ -0,0 +1,5 @@ +// @target: es5 +// @declaration: true +var v: { + ["" + ""](): void; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts new file mode 100644 index 00000000000..eb12ea9b471 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 +// @declaration: true +var v = { + ["" + ""]: 0, + ["" + ""]() { }, + get ["" + ""]() { return 0; }, + set ["" + ""](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts new file mode 100644 index 00000000000..a025a074e31 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName](v: string); + [methodName](); + [methodName](v?: string) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts new file mode 100644 index 00000000000..9454483cdb4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @sourceMap: true +class C { + ["hello"]() { + debugger; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts new file mode 100644 index 00000000000..3d35cd12430 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @sourceMap: true +var v = { + ["hello"]() { + debugger; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts diff --git a/tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts b/tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts new file mode 100644 index 00000000000..1b03c533e7d --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts @@ -0,0 +1,11 @@ +function foo1([...r] = null) { +} + +function foo2([...r] = undefined) { +} + +function foo3([...r] = {}) { +} + +function foo4([...r] = []) { +} diff --git a/tests/cases/unittests/incrementalParser.ts b/tests/cases/unittests/incrementalParser.ts index 7c4213e22c2..54adcaf345f 100644 --- a/tests/cases/unittests/incrementalParser.ts +++ b/tests/cases/unittests/incrementalParser.ts @@ -248,7 +248,7 @@ module ts { var oldText = ScriptSnapshot.fromString(source); var newTextAndChange = withChange(oldText, index, 2, "+"); - compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 21); + compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 24); }); it('Strict mode 1',() => { diff --git a/tests/cases/unittests/services/patternMatcher.ts b/tests/cases/unittests/services/patternMatcher.ts new file mode 100644 index 00000000000..ddf1f9fe344 --- /dev/null +++ b/tests/cases/unittests/services/patternMatcher.ts @@ -0,0 +1,532 @@ +/// +/// + +describe('PatternMatcher', function () { + describe("BreakIntoCharacterSpans", function () { + it("EmptyIdentifier", () => { + verifyBreakIntoCharacterSpans("") + }); + + it("SimpleIdentifier", () => { + verifyBreakIntoCharacterSpans("foo", "foo"); + }); + + it("PrefixUnderscoredIdentifier", () => { + verifyBreakIntoCharacterSpans("_foo", "_", "foo"); + }); + + it("UnderscoredIdentifier", () => { + verifyBreakIntoCharacterSpans("f_oo", "f", "_", "oo"); + }); + + it("PostfixUnderscoredIdentifier", () => { + verifyBreakIntoCharacterSpans("foo_", "foo", "_"); + }); + + it("PrefixUnderscoredIdentifierWithCapital", () => { + verifyBreakIntoCharacterSpans("_Foo", "_", "Foo"); + }); + + it("MUnderscorePrefixed", () => { + verifyBreakIntoCharacterSpans("m_foo", "m", "_", "foo"); + }); + + it("CamelCaseIdentifier", () => { + verifyBreakIntoCharacterSpans("FogBar", "Fog", "Bar"); + }); + + it("MixedCaseIdentifier", () => { + verifyBreakIntoCharacterSpans("fogBar", "fog", "Bar"); + }); + + it("TwoCharacterCapitalIdentifier", () => { + verifyBreakIntoCharacterSpans("UIElement", "U", "I", "Element"); + }); + + it("NumberSuffixedIdentifier", () => { + verifyBreakIntoCharacterSpans("Foo42", "Foo", "42"); + }); + + it("NumberContainingIdentifier", () => { + verifyBreakIntoCharacterSpans("Fog42Bar", "Fog", "42", "Bar"); + }); + + it("NumberPrefixedIdentifier", () => { + verifyBreakIntoCharacterSpans("42Bar", "42", "Bar"); + }); + }); + + describe("BreakIntoWordSpans", function () { + it("VarbatimIdentifier", () => { + verifyBreakIntoWordSpans("@int:", "int"); + }); + + it("AllCapsConstant", () => { + verifyBreakIntoWordSpans("C_STYLE_CONSTANT", "C", "_", "STYLE", "_", "CONSTANT"); + }); + + it("SingleLetterPrefix1", () => { + verifyBreakIntoWordSpans("UInteger", "U", "Integer"); + }); + + it("SingleLetterPrefix2", () => { + verifyBreakIntoWordSpans("IDisposable", "I", "Disposable"); + }); + + it("TwoCharacterCapitalIdentifier", () => { + verifyBreakIntoWordSpans("UIElement", "UI", "Element"); + }); + + it("XDocument", () => { + verifyBreakIntoWordSpans("XDocument", "X", "Document"); + }); + + it("XMLDocument1", () => { + verifyBreakIntoWordSpans("XMLDocument", "XML", "Document"); + }); + + it("XMLDocument2", () => { + verifyBreakIntoWordSpans("XmlDocument", "Xml", "Document"); + }); + + it("TwoUppercaseCharacters", () => { + verifyBreakIntoWordSpans("SimpleUIElement", "Simple", "UI", "Element"); + }); + }); + + describe("SingleWordPattern", () => { + it("PreferCaseSensitiveExact", () => { + debugger; + var match = getFirstMatch("Foo", "Foo"); + + assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveExactInsensitive", () => { + var match = getFirstMatch("foo", "Foo"); + + assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitivePrefix", () => { + var match = getFirstMatch("Foo", "Fo"); + + assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitivePrefixCaseInsensitive", () => { + var match = getFirstMatch("Foo", "fo"); + + assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveCamelCaseMatchSimple", () => { + debugger; + var match = getFirstMatch("FogBar", "FB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + assertInRange(match.camelCaseWeight, 1, 1 << 30); + }); + + it("PreferCaseSensitiveCamelCaseMatchPartialPattern", () => { + var match = getFirstMatch("FogBar", "FoB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveCamelCaseMatchToLongPattern1", () => { + var match = getFirstMatch("FogBar", "FBB"); + + assert.isTrue(match === undefined); + }); + + it("PreferCaseSensitiveCamelCaseMatchToLongPattern2", () => { + var match = getFirstMatch("FogBar", "FoooB"); + + assert.isTrue(match === undefined); + }); + + it("CamelCaseMatchPartiallyUnmatched", () => { + var match = getFirstMatch("FogBarBaz", "FZ"); + + assert.isTrue(match === undefined); + }); + + it("CamelCaseMatchCompletelyUnmatched", () => { + var match = getFirstMatch("FogBarBaz", "ZZ"); + + assert.isTrue(match === undefined); + }); + + it("TwoUppercaseCharacters", () => { + var match = getFirstMatch("SimpleUIElement", "SiUI"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveLowercasePattern", () => { + debugger; + var match = getFirstMatch("FogBar", "b"); + + assert.equal(ts.PatternMatchKind.Substring, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveLowercasePattern2", () => { + var match = getFirstMatch("FogBar", "fB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveTryUnderscoredName", () => { + var match = getFirstMatch("_fogBar", "_fB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveTryUnderscoredName2", () => { + var match = getFirstMatch("_fogBar", "fB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveTryUnderscoredNameInsensitive", () => { + var match = getFirstMatch("_FogBar", "_fB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveMiddleUnderscore", () => { + var match = getFirstMatch("Fog_Bar", "FB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveMiddleUnderscore2", () => { + var match = getFirstMatch("Fog_Bar", "F_B"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveMiddleUnderscore3", () => { + var match = getFirstMatch("Fog_Bar", "F__B"); + + assert.isTrue(undefined === match); + }); + + it("PreferCaseSensitiveMiddleUnderscore4", () => { + var match = getFirstMatch("Fog_Bar", "f_B"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveMiddleUnderscore5", () => { + var match = getFirstMatch("Fog_Bar", "F_b"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveRelativeWeights1", () => { + var match1 = getFirstMatch("FogBarBaz", "FB"); + var match2 = getFirstMatch("FooFlobBaz", "FB"); + + // We should prefer something that starts at the beginning if possible + assertInRange(match1.camelCaseWeight, match2.camelCaseWeight + 1, 1 << 30); + }); + + it("PreferCaseSensitiveRelativeWeights2", () => { + var match1 = getFirstMatch("BazBarFooFooFoo", "FFF"); + var match2 = getFirstMatch("BazFogBarFooFoo", "FFF"); + + // Contiguous things should also be preferred + assertInRange(match1.camelCaseWeight, match2.camelCaseWeight + 1, 1 << 30); + }); + + it("PreferCaseSensitiveRelativeWeights3", () => { + var match1 = getFirstMatch("FogBarFooFoo", "FFF"); + var match2 = getFirstMatch("BarFooFooFoo", "FFF"); + + // The weight of being first should be greater than the weight of being contiguous + assertInRange(match1.camelCaseWeight, match2.camelCaseWeight + 1, 1 << 30); + }); + + it("AllLowerPattern1", () => { + debugger; + var match = getFirstMatch("FogBarChangedEventArgs", "changedeventargs"); + + assert.isTrue(undefined !== match); + }); + + it("AllLowerPattern2", () => { + var match = getFirstMatch("FogBarChangedEventArgs", "changedeventarrrgh"); + + assert.isTrue(undefined === match); + }); + + it("AllLowerPattern3", () => { + var match = getFirstMatch("ABCDEFGH", "bcd"); + + assert.isTrue(undefined !== match); + }); + + it("AllLowerPattern4", () => { + var match = getFirstMatch("AbcdefghijEfgHij", "efghij"); + + assert.isTrue(undefined === match); + }); + }); + + describe("MultiWordPattern", () => { + it("ExactWithLowercase", () => { + var matches = getAllMatches("AddMetadataReference", "addmetadatareference"); + + assertContainsKind(ts.PatternMatchKind.Exact, matches); + }); + + it("SingleLowercasedSearchWord1", () => { + var matches = getAllMatches("AddMetadataReference", "add"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + }); + + it("SingleLowercasedSearchWord2", () => { + var matches = getAllMatches("AddMetadataReference", "metadata"); + + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("SingleUppercaseSearchWord1", () => { + var matches = getAllMatches("AddMetadataReference", "Add"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + }); + + it("SingleUppercaseSearchWord2", () => { + var matches = getAllMatches("AddMetadataReference", "Metadata"); + + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("SingleUppercaseSearchLetter1", () => { + var matches = getAllMatches("AddMetadataReference", "A"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + }); + + it("SingleUppercaseSearchLetter2", () => { + var matches = getAllMatches("AddMetadataReference", "M"); + + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "add metadata"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "A M"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "AM"); + + assertContainsKind(ts.PatternMatchKind.CamelCase, matches); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "ref Metadata") + + assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.Substring, ts.PatternMatchKind.Substring]); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "ref M") + + assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.Substring, ts.PatternMatchKind.Substring]); + }); + + it("MixedCamelCase", () => { + var matches = getAllMatches("AddMetadataReference", "AMRe"); + + assertContainsKind(ts.PatternMatchKind.CamelCase, matches); + }); + + it("BlankPattern", () => { + var matches = getAllMatches("AddMetadataReference", ""); + + assert.isTrue(matches === undefined); + }); + + it("WhitespaceOnlyPattern", () => { + var matches = getAllMatches("AddMetadataReference", " "); + + assert.isTrue(matches === undefined); + }); + + it("EachWordSeparately1", () => { + var matches = getAllMatches("AddMetadataReference", "add Meta"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("EachWordSeparately2", () => { + var matches = getAllMatches("AddMetadataReference", "Add meta"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("EachWordSeparately3", () => { + var matches = getAllMatches("AddMetadataReference", "Add Meta"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("MixedCasing", () => { + var matches = getAllMatches("AddMetadataReference", "mEta"); + + assert.isTrue(matches === undefined); + }); + + it("MixedCasing2", () => { + var matches = getAllMatches("AddMetadataReference", "Data"); + + assert.isTrue(matches === undefined); + }); + + it("AsteriskSplit", () => { + var matches = getAllMatches("GetKeyWord", "K*W"); + + assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.Substring, ts.PatternMatchKind.Substring]); + }); + + it("LowercaseSubstring1", () => { + var matches = getAllMatches("Operator", "a"); + + assert.isTrue(matches === undefined); + }); + + it("LowercaseSubstring2", () => { + var matches = getAllMatches("FooAttribute", "a"); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + assert.isFalse(matches[0].isCaseSensitive); + }); + }); + + describe("DottedPattern", () => { + it("DottedPattern1", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "B.Q"); + + assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("DottedPattern2", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "C.Q"); + assert.isTrue(match === undefined); + }); + + it("DottedPattern3", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "B.B.Q"); + assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("DottedPattern4", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "Baz.Quux"); + assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("DottedPattern5", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "F.B.B.Quux"); + assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("DottedPattern6", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "F.F.B.B.Quux"); + assert.isTrue(match === undefined); + }); + + it("DottedPattern7", () => { + debugger; + var match = getFirstMatch("UIElement", "UIElement"); + var match = getFirstMatch("GetKeyword", "UIElement"); + assert.isTrue(match === undefined); + }); + }); + + function getFirstMatch(candidate: string, pattern: string): ts.PatternMatch { + var matches = ts.createPatternMatcher(pattern).getMatchesForLastSegmentOfPattern(candidate); + return matches ? matches[0] : undefined; + } + + function getAllMatches(candidate: string, pattern: string): ts.PatternMatch[] { + return ts.createPatternMatcher(pattern).getMatchesForLastSegmentOfPattern(candidate); + } + + function getFirstMatchForDottedPattern(dottedContainer: string, candidate: string, pattern: string): ts.PatternMatch { + var matches = ts.createPatternMatcher(pattern).getMatches(candidate, dottedContainer); + return matches ? matches[0] : undefined; + } + + function spanListToSubstrings(identifier: string, spans: ts.TextSpan[]) { + return ts.map(spans, s => identifier.substr(s.start, s.length)); + } + + function breakIntoCharacterSpans(identifier: string) { + return spanListToSubstrings(identifier, ts.breakIntoCharacterSpans(identifier)); + } + + function breakIntoWordSpans(identifier: string) { + return spanListToSubstrings(identifier, ts.breakIntoWordSpans(identifier)); + } + function assertArrayEquals(array1: T[], array2: T[]) { + assert.equal(array1.length, array2.length); + + for (var i = 0, n = array1.length; i < n; i++) { + assert.equal(array1[i], array2[i]); + } + } + + function assertInRange(val: number, low: number, high: number) { + assert.isTrue(val >= low); + assert.isTrue(val <= high); + } + + function verifyBreakIntoCharacterSpans(original: string, ...parts: string[]): void { + assertArrayEquals(parts, breakIntoCharacterSpans(original)); + } + + function verifyBreakIntoWordSpans(original: string, ...parts: string[]): void { + assertArrayEquals(parts, breakIntoWordSpans(original)); + } + + function assertContainsKind(kind: ts.PatternMatchKind, results: ts.PatternMatch[]) { + assert.isTrue(ts.forEach(results, r => r.kind === kind)); + } +}); \ No newline at end of file