diff --git a/.gitignore b/.gitignore index 658c4d0d8ea..f487ea6dd29 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,4 @@ scripts/*.js.map coverage/ internal/ **/.DS_Store +.settings/ diff --git a/.npmignore b/.npmignore index 98c50479c69..2b75d37f70a 100644 --- a/.npmignore +++ b/.npmignore @@ -4,4 +4,5 @@ scripts src tests Jakefile -.travis.yml \ No newline at end of file +.travis.yml +.settings/ \ No newline at end of file diff --git a/bin/lib.core.es6.d.ts b/bin/lib.core.es6.d.ts index 3344cf3197d..902962cae51 100644 --- a/bin/lib.core.es6.d.ts +++ b/bin/lib.core.es6.d.ts @@ -1237,11 +1237,41 @@ interface SymbolConstructor { isConcatSpreadable: symbol; /** - * A method that returns the default iterator for an object.Called by the semantics of the + * A method that returns the default iterator for an object. Called by the semantics of the * for-of statement. */ iterator: symbol; + /** + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + replace: symbol; + + /** + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. + */ + search: symbol; + + /** + * A function valued property that is the constructor function that is used to create + * derived objects. + */ + species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + split: symbol; + /** * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive * abstract operation. @@ -4728,6 +4758,16 @@ declare module Reflect { function setPrototypeOf(target: any, proto: any): boolean; } +interface PromiseLike { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; +} + /** * Represents the completion of an asynchronous operation */ @@ -4738,14 +4778,16 @@ interface Promise { * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of which ever callback is executed. */ - then(onfulfilled?: (value: T) => TResult | Promise, onrejected?: (reason: any) => TResult | Promise): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; /** * Attaches a callback for only the rejection of the Promise. * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of the callback. */ - catch(onrejected?: (reason: any) => T | Promise): Promise; + catch(onrejected?: (reason: any) => T | PromiseLike): Promise; + + [Symbol.toStringTag]: string; } interface PromiseConstructor { @@ -4756,13 +4798,11 @@ interface PromiseConstructor { /** * Creates a new Promise. - * @param init A callback used to initialize the promise. This callback is passed two arguments: + * @param executor A callback used to initialize the promise. This callback is passed two arguments: * a resolve callback used resolve the promise with a value or the result of another promise, * and a reject callback used to reject the promise with a provided reason or error. */ - new (init: (resolve: (value?: T | Promise) => void, reject: (reason?: any) => void) => void): Promise; - - (init: (resolve: (value?: T | Promise) => void, reject: (reason?: any) => void) => void): Promise; + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; /** * Creates a Promise that is resolved with an array of results when all of the provided Promises @@ -4770,15 +4810,7 @@ interface PromiseConstructor { * @param values An array of Promises. * @returns A new Promise. */ - all(values: (T | Promise)[]): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of values. - * @returns A new Promise. - */ - all(values: Promise[]): Promise; + all(values: Iterable>): Promise; /** * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved @@ -4786,7 +4818,7 @@ interface PromiseConstructor { * @param values An array of Promises. * @returns A new Promise. */ - race(values: (T | Promise)[]): Promise; + race(values: Iterable>): Promise; /** * Creates a new rejected promise for the provided reason. @@ -4807,13 +4839,15 @@ interface PromiseConstructor { * @param value A promise. * @returns A promise whose internal state matches the provided promise. */ - resolve(value: T | Promise): Promise; + resolve(value: T | PromiseLike): Promise; /** * Creates a new resolved promise . * @returns A resolved promise. */ resolve(): Promise; + + [Symbol.species]: Function; } declare var Promise: PromiseConstructor; diff --git a/bin/lib.d.ts b/bin/lib.d.ts index 17e87597583..944b10ac881 100644 --- a/bin/lib.d.ts +++ b/bin/lib.d.ts @@ -1231,6 +1231,139 @@ interface ArrayBufferView { byteOffset: number; } +interface DataView { + buffer: ArrayBuffer; + byteLength: number; + byteOffset: number; + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat32(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat64(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt16(byteOffset: number, littleEndian: boolean): number; + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt32(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint16(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint32(byteOffset: number, littleEndian: boolean): number; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian: boolean): void; +} + +interface DataViewConstructor { + new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; +} +declare var DataView: DataViewConstructor; + /** * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. @@ -7222,6 +7355,8 @@ interface HTMLCanvasElement extends HTMLElement { * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); */ + getContext(contextId: "2d"): CanvasRenderingContext2D; + getContext(contextId: "experimental-webgl"): WebGLRenderingContext; getContext(contextId: string, ...args: any[]): CanvasRenderingContext2D | WebGLRenderingContext; /** * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. @@ -15857,11 +15992,13 @@ interface DocumentEvent { createEvent(eventInterface:"CloseEvent"): CloseEvent; createEvent(eventInterface:"CommandEvent"): CommandEvent; createEvent(eventInterface:"CompositionEvent"): CompositionEvent; + createEvent(eventInterface: "CustomEvent"): CustomEvent; createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; createEvent(eventInterface:"DragEvent"): DragEvent; createEvent(eventInterface:"ErrorEvent"): ErrorEvent; createEvent(eventInterface:"Event"): Event; + createEvent(eventInterface:"Events"): Event; createEvent(eventInterface:"FocusEvent"): FocusEvent; createEvent(eventInterface:"GamepadEvent"): GamepadEvent; createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; @@ -15876,8 +16013,12 @@ interface DocumentEvent { createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; createEvent(eventInterface:"MessageEvent"): MessageEvent; createEvent(eventInterface:"MouseEvent"): MouseEvent; + createEvent(eventInterface:"MouseEvents"): MouseEvent; createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent; + createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; + createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; createEvent(eventInterface:"MutationEvent"): MutationEvent; + createEvent(eventInterface:"MutationEvents"): MutationEvent; createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; createEvent(eventInterface:"NavigationEvent"): NavigationEvent; createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; @@ -15888,6 +16029,7 @@ interface DocumentEvent { createEvent(eventInterface:"PopStateEvent"): PopStateEvent; createEvent(eventInterface:"ProgressEvent"): ProgressEvent; createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; + createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; createEvent(eventInterface:"StorageEvent"): StorageEvent; createEvent(eventInterface:"TextEvent"): TextEvent; @@ -15895,6 +16037,7 @@ interface DocumentEvent { createEvent(eventInterface:"TrackEvent"): TrackEvent; createEvent(eventInterface:"TransitionEvent"): TransitionEvent; createEvent(eventInterface:"UIEvent"): UIEvent; + createEvent(eventInterface:"UIEvents"): UIEvent; createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent; createEvent(eventInterface:"WheelEvent"): WheelEvent; diff --git a/bin/lib.dom.d.ts b/bin/lib.dom.d.ts index 2c970a1cf52..422b4b8803c 100644 --- a/bin/lib.dom.d.ts +++ b/bin/lib.dom.d.ts @@ -61,6 +61,139 @@ interface ArrayBufferView { byteOffset: number; } +interface DataView { + buffer: ArrayBuffer; + byteLength: number; + byteOffset: number; + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat32(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat64(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt16(byteOffset: number, littleEndian: boolean): number; + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt32(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint16(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint32(byteOffset: number, littleEndian: boolean): number; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian: boolean): void; +} + +interface DataViewConstructor { + new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; +} +declare var DataView: DataViewConstructor; + /** * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. @@ -6052,6 +6185,8 @@ interface HTMLCanvasElement extends HTMLElement { * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); */ + getContext(contextId: "2d"): CanvasRenderingContext2D; + getContext(contextId: "experimental-webgl"): WebGLRenderingContext; getContext(contextId: string, ...args: any[]): CanvasRenderingContext2D | WebGLRenderingContext; /** * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. @@ -14687,11 +14822,13 @@ interface DocumentEvent { createEvent(eventInterface:"CloseEvent"): CloseEvent; createEvent(eventInterface:"CommandEvent"): CommandEvent; createEvent(eventInterface:"CompositionEvent"): CompositionEvent; + createEvent(eventInterface: "CustomEvent"): CustomEvent; createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; createEvent(eventInterface:"DragEvent"): DragEvent; createEvent(eventInterface:"ErrorEvent"): ErrorEvent; createEvent(eventInterface:"Event"): Event; + createEvent(eventInterface:"Events"): Event; createEvent(eventInterface:"FocusEvent"): FocusEvent; createEvent(eventInterface:"GamepadEvent"): GamepadEvent; createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; @@ -14706,8 +14843,12 @@ interface DocumentEvent { createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; createEvent(eventInterface:"MessageEvent"): MessageEvent; createEvent(eventInterface:"MouseEvent"): MouseEvent; + createEvent(eventInterface:"MouseEvents"): MouseEvent; createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent; + createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; + createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; createEvent(eventInterface:"MutationEvent"): MutationEvent; + createEvent(eventInterface:"MutationEvents"): MutationEvent; createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; createEvent(eventInterface:"NavigationEvent"): NavigationEvent; createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; @@ -14718,6 +14859,7 @@ interface DocumentEvent { createEvent(eventInterface:"PopStateEvent"): PopStateEvent; createEvent(eventInterface:"ProgressEvent"): ProgressEvent; createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; + createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; createEvent(eventInterface:"StorageEvent"): StorageEvent; createEvent(eventInterface:"TextEvent"): TextEvent; @@ -14725,6 +14867,7 @@ interface DocumentEvent { createEvent(eventInterface:"TrackEvent"): TrackEvent; createEvent(eventInterface:"TransitionEvent"): TransitionEvent; createEvent(eventInterface:"UIEvent"): UIEvent; + createEvent(eventInterface:"UIEvents"): UIEvent; createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent; createEvent(eventInterface:"WheelEvent"): WheelEvent; diff --git a/bin/lib.es6.d.ts b/bin/lib.es6.d.ts index c2361d833d1..8266e4264c1 100644 --- a/bin/lib.es6.d.ts +++ b/bin/lib.es6.d.ts @@ -1237,11 +1237,41 @@ interface SymbolConstructor { isConcatSpreadable: symbol; /** - * A method that returns the default iterator for an object.Called by the semantics of the + * A method that returns the default iterator for an object. Called by the semantics of the * for-of statement. */ iterator: symbol; + /** + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + replace: symbol; + + /** + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. + */ + search: symbol; + + /** + * A function valued property that is the constructor function that is used to create + * derived objects. + */ + species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + split: symbol; + /** * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive * abstract operation. @@ -4728,6 +4758,16 @@ declare module Reflect { function setPrototypeOf(target: any, proto: any): boolean; } +interface PromiseLike { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; +} + /** * Represents the completion of an asynchronous operation */ @@ -4738,14 +4778,16 @@ interface Promise { * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of which ever callback is executed. */ - then(onfulfilled?: (value: T) => TResult | Promise, onrejected?: (reason: any) => TResult | Promise): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; /** * Attaches a callback for only the rejection of the Promise. * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of the callback. */ - catch(onrejected?: (reason: any) => T | Promise): Promise; + catch(onrejected?: (reason: any) => T | PromiseLike): Promise; + + [Symbol.toStringTag]: string; } interface PromiseConstructor { @@ -4756,13 +4798,11 @@ interface PromiseConstructor { /** * Creates a new Promise. - * @param init A callback used to initialize the promise. This callback is passed two arguments: + * @param executor A callback used to initialize the promise. This callback is passed two arguments: * a resolve callback used resolve the promise with a value or the result of another promise, * and a reject callback used to reject the promise with a provided reason or error. */ - new (init: (resolve: (value?: T | Promise) => void, reject: (reason?: any) => void) => void): Promise; - - (init: (resolve: (value?: T | Promise) => void, reject: (reason?: any) => void) => void): Promise; + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; /** * Creates a Promise that is resolved with an array of results when all of the provided Promises @@ -4770,15 +4810,7 @@ interface PromiseConstructor { * @param values An array of Promises. * @returns A new Promise. */ - all(values: (T | Promise)[]): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of values. - * @returns A new Promise. - */ - all(values: Promise[]): Promise; + all(values: Iterable>): Promise; /** * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved @@ -4786,7 +4818,7 @@ interface PromiseConstructor { * @param values An array of Promises. * @returns A new Promise. */ - race(values: (T | Promise)[]): Promise; + race(values: Iterable>): Promise; /** * Creates a new rejected promise for the provided reason. @@ -4807,13 +4839,15 @@ interface PromiseConstructor { * @param value A promise. * @returns A promise whose internal state matches the provided promise. */ - resolve(value: T | Promise): Promise; + resolve(value: T | PromiseLike): Promise; /** * Creates a new resolved promise . * @returns A resolved promise. */ resolve(): Promise; + + [Symbol.species]: Function; } declare var Promise: PromiseConstructor; @@ -8700,6 +8734,8 @@ interface HTMLCanvasElement extends HTMLElement { * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); */ + getContext(contextId: "2d"): CanvasRenderingContext2D; + getContext(contextId: "experimental-webgl"): WebGLRenderingContext; getContext(contextId: string, ...args: any[]): CanvasRenderingContext2D | WebGLRenderingContext; /** * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. @@ -17335,11 +17371,13 @@ interface DocumentEvent { createEvent(eventInterface:"CloseEvent"): CloseEvent; createEvent(eventInterface:"CommandEvent"): CommandEvent; createEvent(eventInterface:"CompositionEvent"): CompositionEvent; + createEvent(eventInterface: "CustomEvent"): CustomEvent; createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; createEvent(eventInterface:"DragEvent"): DragEvent; createEvent(eventInterface:"ErrorEvent"): ErrorEvent; createEvent(eventInterface:"Event"): Event; + createEvent(eventInterface:"Events"): Event; createEvent(eventInterface:"FocusEvent"): FocusEvent; createEvent(eventInterface:"GamepadEvent"): GamepadEvent; createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; @@ -17354,8 +17392,12 @@ interface DocumentEvent { createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; createEvent(eventInterface:"MessageEvent"): MessageEvent; createEvent(eventInterface:"MouseEvent"): MouseEvent; + createEvent(eventInterface:"MouseEvents"): MouseEvent; createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent; + createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; + createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; createEvent(eventInterface:"MutationEvent"): MutationEvent; + createEvent(eventInterface:"MutationEvents"): MutationEvent; createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; createEvent(eventInterface:"NavigationEvent"): NavigationEvent; createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; @@ -17366,6 +17408,7 @@ interface DocumentEvent { createEvent(eventInterface:"PopStateEvent"): PopStateEvent; createEvent(eventInterface:"ProgressEvent"): ProgressEvent; createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; + createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; createEvent(eventInterface:"StorageEvent"): StorageEvent; createEvent(eventInterface:"TextEvent"): TextEvent; @@ -17373,6 +17416,7 @@ interface DocumentEvent { createEvent(eventInterface:"TrackEvent"): TrackEvent; createEvent(eventInterface:"TransitionEvent"): TransitionEvent; createEvent(eventInterface:"UIEvent"): UIEvent; + createEvent(eventInterface:"UIEvents"): UIEvent; createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent; createEvent(eventInterface:"WheelEvent"): WheelEvent; diff --git a/bin/lib.webworker.d.ts b/bin/lib.webworker.d.ts index 740ebe94fa6..1704e07f75a 100644 --- a/bin/lib.webworker.d.ts +++ b/bin/lib.webworker.d.ts @@ -61,6 +61,139 @@ interface ArrayBufferView { byteOffset: number; } +interface DataView { + buffer: ArrayBuffer; + byteLength: number; + byteOffset: number; + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat32(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat64(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt16(byteOffset: number, littleEndian: boolean): number; + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt32(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint16(byteOffset: number, littleEndian: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint32(byteOffset: number, littleEndian: boolean): number; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian: boolean): void; +} + +interface DataViewConstructor { + new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; +} +declare var DataView: DataViewConstructor; + /** * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested * number of bytes could not be allocated an exception is raised. diff --git a/bin/tsc.js b/bin/tsc.js index 49db1f2cb85..653540b7b99 100644 --- a/bin/tsc.js +++ b/bin/tsc.js @@ -960,7 +960,7 @@ var ts; A_get_accessor_cannot_have_parameters: { code: 1054, category: ts.DiagnosticCategory.Error, key: "A 'get' accessor cannot have parameters." }, Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum member must have initializer." }, - An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An export assignment cannot be used in an internal module." }, + An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An export assignment cannot be used in a namespace." }, Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: ts.DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers." }, Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an import declaration." }, @@ -1021,8 +1021,8 @@ var ts; or_expected: { code: 1144, category: ts.DiagnosticCategory.Error, key: "'{' or ';' expected." }, Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: ts.DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members." }, Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: "Declaration expected." }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Cannot compile external modules unless the '--module' flag is provided." }, + Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: "Import declarations in a namespace cannot reference a module." }, + Cannot_compile_modules_unless_the_module_flag_is_provided: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules unless the '--module' flag is provided." }, File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, var_let_or_const_expected: { code: 1152, category: ts.DiagnosticCategory.Error, key: "'var', 'let' or 'const' expected." }, @@ -1064,9 +1064,9 @@ var ts; The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: ts.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: ts.DiagnosticCategory.Error, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, An_import_declaration_cannot_have_modifiers: { code: 1191, category: ts.DiagnosticCategory.Error, key: "An import declaration cannot have modifiers." }, - External_module_0_has_no_default_export: { code: 1192, category: ts.DiagnosticCategory.Error, key: "External module '{0}' has no default export." }, + Module_0_has_no_default_export: { code: 1192, category: ts.DiagnosticCategory.Error, key: "Module '{0}' has no default export." }, An_export_declaration_cannot_have_modifiers: { code: 1193, category: ts.DiagnosticCategory.Error, key: "An export declaration cannot have modifiers." }, - Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: ts.DiagnosticCategory.Error, key: "Export declarations are not permitted in an internal module." }, + Export_declarations_are_not_permitted_in_a_namespace: { code: 1194, category: ts.DiagnosticCategory.Error, key: "Export declarations are not permitted in a namespace." }, Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: ts.DiagnosticCategory.Error, key: "Catch clause variable name must be an identifier." }, Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: ts.DiagnosticCategory.Error, key: "Catch clause variable cannot have a type annotation." }, Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: ts.DiagnosticCategory.Error, key: "Catch clause variable cannot have an initializer." }, @@ -1075,28 +1075,27 @@ var ts; Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." }, Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." }, Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." }, - Cannot_compile_external_modules_into_amd_commonjs_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher." }, + Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher." }, Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, - Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." }, + Cannot_compile_namespaces_when_the_separateCompilation_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--separateCompilation' flag is provided." }, Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." }, Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: ts.DiagnosticCategory.Error, key: "Invalid use of '{0}'. Class definitions are automatically in strict mode." }, A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" }, Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode" }, Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: ts.DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, - Identifier_expected_0_is_a_reserved_word_in_strict_mode_External_Module_is_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. External Module is automatically in strict mode." }, Type_expected_0_is_a_reserved_word_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode" }, Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, - Type_expected_0_is_a_reserved_word_in_strict_mode_Module_is_automatically_in_strict_mode: { code: 1217, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Module is automatically in strict mode." }, + Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export assignment is not supported when '--module' flag is 'system'." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.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: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, Circular_definition_of_import_alias_0: { code: 2303, category: ts.DiagnosticCategory.Error, key: "Circular definition of import alias '{0}'." }, Cannot_find_name_0: { code: 2304, category: ts.DiagnosticCategory.Error, key: "Cannot find name '{0}'." }, Module_0_has_no_exported_member_1: { code: 2305, category: ts.DiagnosticCategory.Error, key: "Module '{0}' has no exported member '{1}'." }, - File_0_is_not_an_external_module: { code: 2306, category: ts.DiagnosticCategory.Error, key: "File '{0}' is not an external module." }, - Cannot_find_external_module_0: { code: 2307, category: ts.DiagnosticCategory.Error, key: "Cannot find external module '{0}'." }, + File_0_is_not_a_module: { code: 2306, category: ts.DiagnosticCategory.Error, key: "File '{0}' is not a module." }, + Cannot_find_module_0: { code: 2307, category: ts.DiagnosticCategory.Error, key: "Cannot find module '{0}'." }, A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Type '{0}' recursively references itself as a base type." }, @@ -1119,7 +1118,7 @@ var ts; Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: ts.DiagnosticCategory.Error, key: "Types of parameters '{0}' and '{1}' are incompatible." }, Index_signature_is_missing_in_type_0: { code: 2329, category: ts.DiagnosticCategory.Error, key: "Index signature is missing in type '{0}'." }, Index_signatures_are_incompatible: { code: 2330, category: ts.DiagnosticCategory.Error, key: "Index signatures are incompatible." }, - this_cannot_be_referenced_in_a_module_body: { code: 2331, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in a module body." }, + this_cannot_be_referenced_in_a_module_or_namespace_body: { code: 2331, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in a module or namespace body." }, this_cannot_be_referenced_in_current_location: { code: 2332, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in current location." }, this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in constructor arguments." }, this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in a static property initializer." }, @@ -1211,15 +1210,15 @@ var ts; Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: "Interface '{0}' incorrectly extends interface '{1}'." }, Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Ambient external modules cannot be nested in other modules." }, - Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient external module declaration cannot specify relative module name." }, + A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be in a different file from a class or function with which it is merged" }, + A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be located prior to a class or function with which it is merged" }, + Ambient_modules_cannot_be_nested_in_other_modules: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient modules cannot be nested in other modules." }, + Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient module declaration cannot specify relative module name." }, Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module '{0}' is hidden by a local declaration with the same name" }, Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import name cannot be '{0}'" }, - Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." }, + Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: "Import or export declaration in an ambient module declaration cannot reference module through relative module name." }, Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.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: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { code: 2441, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module." }, Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, @@ -1273,8 +1272,8 @@ var ts; Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: ts.DiagnosticCategory.Error, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: ts.DiagnosticCategory.Error, key: "Type '{0}' is not an array type or a string type." }, The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: { code: 2496, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression." }, - External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, - External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." }, + Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: "Module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, + Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: "Module '{0}' uses 'export =' and cannot be used with 'export *'." }, An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." }, @@ -1353,6 +1352,7 @@ var ts; Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot read file '{0}': {1}" }, Unsupported_file_encoding: { code: 5013, category: ts.DiagnosticCategory.Error, key: "Unsupported file encoding." }, + Failed_to_parse_file_0_Colon_1: { code: 5014, category: ts.DiagnosticCategory.Error, key: "Failed to parse file '{0}': {1}." }, Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, @@ -1366,6 +1366,10 @@ var ts; Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { code: 5045, category: ts.DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." }, Option_out_cannot_be_specified_with_option_separateCompilation: { code: 5046, category: ts.DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'separateCompilation'." }, Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, + Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap: { code: 5048, category: ts.DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'." }, + Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5049, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'." }, + Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5050, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'." }, + Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -1377,7 +1381,7 @@ var ts; Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_amd_or_umd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', or 'umd'." }, + Specify_module_code_generation_Colon_commonjs_amd_system_or_umd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print the compiler's version." }, Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile the project in the given directory." }, @@ -1398,7 +1402,7 @@ var ts; Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_or_umd: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', or 'umd'." }, + Argument_for_module_option_must_be_commonjs_amd_system_or_umd: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system' or 'umd'." }, Argument_for_target_option_must_be_ES3_ES5_or_ES6: { code: 6047, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported locale '{0}'." }, @@ -1480,7 +1484,7 @@ var ts; "false": 80, "finally": 81, "for": 82, - "from": 124, + "from": 125, "function": 83, "get": 116, "if": 84, @@ -1491,33 +1495,34 @@ var ts; "interface": 103, "let": 104, "module": 117, + "namespace": 118, "new": 88, "null": 89, - "number": 119, + "number": 120, "package": 105, "private": 106, "protected": 107, "public": 108, - "require": 118, + "require": 119, "return": 90, - "set": 120, + "set": 121, "static": 109, - "string": 121, + "string": 122, "super": 91, "switch": 92, - "symbol": 122, + "symbol": 123, "this": 93, "throw": 94, "true": 95, "try": 96, - "type": 123, + "type": 124, "typeof": 97, "var": 98, "void": 99, "while": 100, "with": 101, "yield": 110, - "of": 125, + "of": 126, "{": 14, "}": 15, "(": 16, @@ -2703,16 +2708,16 @@ var ts; (function (ts) { ts.bindTime = 0; function getModuleInstanceState(node) { - if (node.kind === 202 || node.kind === 203) { + if (node.kind === 203 || node.kind === 204) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 209 || node.kind === 208) && !(node.flags & 1)) { + else if ((node.kind === 210 || node.kind === 209) && !(node.flags & 1)) { return 0; } - else if (node.kind === 206) { + else if (node.kind === 207) { var state = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -2728,7 +2733,7 @@ var ts; }); return state; } - else if (node.kind === 205) { + else if (node.kind === 206) { return getModuleInstanceState(node.body); } else { @@ -2781,10 +2786,10 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 205 && node.name.kind === 8) { + if (node.kind === 206 && node.name.kind === 8) { return '"' + node.name.text + '"'; } - if (node.name.kind === 127) { + if (node.name.kind === 128) { var nameExpression = node.name.expression; ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); @@ -2792,22 +2797,22 @@ var ts; return node.name.text; } switch (node.kind) { - case 143: - case 135: + case 144: + case 136: return "__constructor"; - case 142: - case 138: - return "__call"; + case 143: case 139: - return "__new"; + return "__call"; case 140: + return "__new"; + case 141: return "__index"; - case 215: + case 216: return "__export"; - case 214: + case 215: return node.isExportEquals ? "export=" : "default"; - case 200: case 201: + case 202: return node.flags & 256 ? "default" : undefined; } } @@ -2839,7 +2844,7 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if ((node.kind === 201 || node.kind === 174) && symbol.exports) { + if ((node.kind === 202 || node.kind === 175) && symbol.exports) { var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { @@ -2855,7 +2860,7 @@ var ts; function declareModuleMember(node, symbolKind, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolKind & 8388608) { - if (node.kind === 217 || (node.kind === 208 && hasExportModifier)) { + if (node.kind === 218 || (node.kind === 209 && hasExportModifier)) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); } else { @@ -2863,7 +2868,7 @@ var ts; } } else { - if (hasExportModifier || container.flags & 32768) { + if (hasExportModifier || container.flags & 65536) { var exportKind = (symbolKind & 107455 ? 1048576 : 0) | (symbolKind & 793056 ? 2097152 : 0) | (symbolKind & 1536 ? 4194304 : 0); @@ -2889,7 +2894,7 @@ var ts; addToContainerChain(container); } if (isBlockScopeContainer) { - setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 227); + setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 228); } ts.forEachChild(node, bind); container = saveContainer; @@ -2904,41 +2909,41 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 205: + case 206: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 227: + case 228: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; } - case 142: case 143: - case 138: + case 144: case 139: case 140: - case 134: - case 133: + case 141: case 135: + case 134: case 136: case 137: - case 200: - case 162: + case 138: + case 201: case 163: + case 164: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 174: - case 201: + case 175: + case 202: if (node.flags & 128) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } - case 145: - case 154: - case 202: + case 146: + case 155: + case 203: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 204: + case 205: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } @@ -2953,11 +2958,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 227 ? node : node.body; - if (body.kind === 227 || body.kind === 206) { + var body = node.kind === 228 ? node : node.body; + if (body.kind === 228 || body.kind === 207) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 215 || stat.kind === 214) { + if (stat.kind === 216 || stat.kind === 215) { return true; } } @@ -2966,10 +2971,10 @@ var ts; } function setExportContextFlag(node) { if (isAmbientContext(node) && !hasExportDeclarations(node)) { - node.flags |= 32768; + node.flags |= 65536; } else { - node.flags &= ~32768; + node.flags &= ~65536; } } function bindModuleDeclaration(node) { @@ -3007,7 +3012,7 @@ var ts; var typeLiteralSymbol = createSymbol(2048, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, 2048); typeLiteralSymbol.members = {}; - typeLiteralSymbol.members[node.kind === 142 ? "__call" : "__new"] = symbol; + typeLiteralSymbol.members[node.kind === 143 ? "__call" : "__new"] = symbol; } function bindAnonymousDeclaration(node, symbolKind, name, isBlockScopeContainer) { var symbol = createSymbol(symbolKind, name); @@ -3019,10 +3024,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolKind, symbolExcludes) { switch (blockScopeContainer.kind) { - case 205: + case 206: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 227: + case 228: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; @@ -3045,14 +3050,14 @@ var ts; function bind(node) { node.parent = parent; switch (node.kind) { - case 128: + case 129: bindDeclaration(node, 262144, 530912, false); break; - case 129: + case 130: bindParameter(node); break; - case 198: - case 152: + case 199: + case 153: if (ts.isBindingPattern(node.name)) { bindChildren(node, 0, false); } @@ -3063,68 +3068,68 @@ var ts; bindDeclaration(node, 1, 107454, false); } break; + case 133: case 132: - case 131: bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); break; - case 224: case 225: + case 226: bindPropertyOrMethodOrAccessor(node, 4, 107455, false); break; - case 226: + case 227: bindPropertyOrMethodOrAccessor(node, 8, 107455, false); break; - case 138: case 139: case 140: + case 141: bindDeclaration(node, 131072, 0, false); break; + case 135: case 134: - case 133: bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263, true); break; - case 200: + case 201: bindDeclaration(node, 16, 106927, true); break; - case 135: + case 136: bindDeclaration(node, 16384, 0, true); break; - case 136: + case 137: bindPropertyOrMethodOrAccessor(node, 32768, 41919, true); break; - case 137: + case 138: bindPropertyOrMethodOrAccessor(node, 65536, 74687, true); break; - case 142: case 143: + case 144: bindFunctionOrConstructorType(node); break; - case 145: + case 146: bindAnonymousDeclaration(node, 2048, "__type", false); break; - case 154: + case 155: bindAnonymousDeclaration(node, 4096, "__object", false); break; - case 162: case 163: + case 164: bindAnonymousDeclaration(node, 16, "__function", true); break; - case 174: + case 175: bindAnonymousDeclaration(node, 32, "__class", false); break; - case 223: + case 224: bindCatchVariableDeclaration(node); break; - case 201: + case 202: bindBlockScopedDeclaration(node, 32, 899583); break; - case 202: + case 203: bindDeclaration(node, 64, 792992, false); break; - case 203: + case 204: bindDeclaration(node, 524288, 793056, false); break; - case 204: + case 205: if (ts.isConst(node)) { bindDeclaration(node, 128, 899967, false); } @@ -3132,16 +3137,16 @@ var ts; bindDeclaration(node, 256, 899327, false); } break; - case 205: + case 206: bindModuleDeclaration(node); break; - case 208: - case 211: - case 213: - case 217: + case 209: + case 212: + case 214: + case 218: bindDeclaration(node, 8388608, 8388608, false); break; - case 210: + case 211: if (node.name) { bindDeclaration(node, 8388608, 8388608, false); } @@ -3149,13 +3154,13 @@ var ts; bindChildren(node, 0, false); } break; - case 215: + case 216: if (!node.exportClause) { declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); } bindChildren(node, 0, false); break; - case 214: + case 215: if (node.expression.kind === 65) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } @@ -3164,20 +3169,20 @@ var ts; } bindChildren(node, 0, false); break; - case 227: + case 228: setExportContextFlag(node); if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; } - case 179: + case 180: bindChildren(node, 0, !ts.isFunctionLike(node.parent)); break; - case 223: - case 186: + case 224: case 187: case 188: - case 207: + case 189: + case 208: bindChildren(node, 0, true); break; default: @@ -3195,8 +3200,8 @@ var ts; bindDeclaration(node, 1, 107455, false); } if (node.flags & 112 && - node.parent.kind === 135 && - (node.parent.parent.kind === 201 || node.parent.parent.kind === 174)) { + node.parent.kind === 136 && + (node.parent.parent.kind === 202 || node.parent.parent.kind === 175)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } @@ -3274,7 +3279,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 227) { + while (node && node.kind !== 228) { node = node.parent; } return node; @@ -3363,15 +3368,15 @@ var ts; return current; } switch (current.kind) { - case 227: - case 207: - case 223: - case 205: - case 186: + case 228: + case 208: + case 224: + case 206: case 187: case 188: + case 189: return current; - case 179: + case 180: if (!isFunctionLike(current.parent)) { return current; } @@ -3382,9 +3387,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 198 && + declaration.kind === 199 && declaration.parent && - declaration.parent.kind === 223; + declaration.parent.kind === 224; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3420,22 +3425,22 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 227: + case 228: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 198: - case 152: - case 201: - case 174: + case 199: + case 153: case 202: + case 175: + case 203: + case 206: case 205: - case 204: - case 226: - case 200: - case 162: + case 227: + case 201: + case 163: errorNode = node.name; break; } @@ -3457,11 +3462,11 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 204 && isConst(node); + return node.kind === 205 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 152 || isBindingPattern(node))) { + while (node && (node.kind === 153 || isBindingPattern(node))) { node = node.parent; } return node; @@ -3469,14 +3474,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 198) { + if (node.kind === 199) { node = node.parent; } - if (node && node.kind === 199) { + if (node && node.kind === 200) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 180) { + if (node && node.kind === 181) { flags |= node.flags; } return flags; @@ -3491,11 +3496,11 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 182 && node.expression.kind === 8; + return node.kind === 183 && node.expression.kind === 8; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { - if (node.kind === 129 || node.kind === 128) { + if (node.kind === 130 || node.kind === 129) { return ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)); } else { @@ -3517,23 +3522,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 191: + case 192: return visitor(node); - case 207: - case 179: - case 183: + case 208: + case 180: case 184: case 185: case 186: case 187: case 188: - case 192: + case 189: case 193: - case 220: - case 221: case 194: - case 196: - case 223: + case 221: + case 222: + case 195: + case 197: + case 224: return ts.forEachChild(node, traverse); } } @@ -3542,14 +3547,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 152: - case 226: - case 129: - case 224: - case 132: - case 131: + case 153: + case 227: + case 130: case 225: - case 198: + case 133: + case 132: + case 226: + case 199: return true; } } @@ -3559,8 +3564,8 @@ var ts; function isAccessor(node) { if (node) { switch (node.kind) { - case 136: case 137: + case 138: return true; } } @@ -3570,22 +3575,22 @@ var ts; function isFunctionLike(node) { if (node) { switch (node.kind) { - case 135: - case 162: - case 200: - case 163: - case 134: - case 133: case 136: + case 163: + case 201: + case 164: + case 135: + case 134: case 137: case 138: case 139: case 140: - case 142: + case 141: case 143: - case 162: + case 144: case 163: - case 200: + case 164: + case 201: return true; } } @@ -3593,11 +3598,11 @@ var ts; } ts.isFunctionLike = isFunctionLike; function isFunctionBlock(node) { - return node && node.kind === 179 && isFunctionLike(node.parent); + return node && node.kind === 180 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 134 && node.parent.kind === 154; + return node && node.kind === 135 && node.parent.kind === 155; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function getContainingFunction(node) { @@ -3616,36 +3621,36 @@ var ts; return undefined; } switch (node.kind) { - case 127: - if (node.parent.parent.kind === 201) { + case 128: + if (node.parent.parent.kind === 202) { return node; } node = node.parent; break; - case 130: - if (node.parent.kind === 129 && isClassElement(node.parent.parent)) { + case 131: + if (node.parent.kind === 130 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 163: + case 164: if (!includeArrowFunctions) { continue; } - case 200: - case 162: - case 205: - case 132: - case 131: - case 134: + case 201: + case 163: + case 206: case 133: + case 132: case 135: + case 134: case 136: case 137: - case 204: - case 227: + case 138: + case 205: + case 228: return node; } } @@ -3657,40 +3662,40 @@ var ts; if (!node) return node; switch (node.kind) { - case 127: - if (node.parent.parent.kind === 201) { + case 128: + if (node.parent.parent.kind === 202) { return node; } node = node.parent; break; - case 130: - if (node.parent.kind === 129 && isClassElement(node.parent.parent)) { + case 131: + if (node.parent.kind === 130 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 200: - case 162: + case 201: case 163: + case 164: if (!includeFunctions) { continue; } - case 132: - case 131: - case 134: case 133: + case 132: case 135: + case 134: case 136: case 137: + case 138: return node; } } } ts.getSuperContainer = getSuperContainer; function getInvokedExpression(node) { - if (node.kind === 159) { + if (node.kind === 160) { return node.tag; } return node.expression; @@ -3698,40 +3703,40 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 201: + case 202: return true; - case 132: - return node.parent.kind === 201; - case 129: - return node.parent.body && node.parent.parent.kind === 201; - case 136: + case 133: + return node.parent.kind === 202; + case 130: + return node.parent.body && node.parent.parent.kind === 202; case 137: - case 134: - return node.body && node.parent.kind === 201; + case 138: + case 135: + return node.body && node.parent.kind === 202; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 201: + case 202: if (node.decorators) { return true; } return false; - case 132: - case 129: + case 133: + case 130: if (node.decorators) { return true; } return false; - case 136: + case 137: if (node.body && node.decorators) { return true; } return false; - case 134: - case 137: + case 135: + case 138: if (node.body && node.decorators) { return true; } @@ -3742,10 +3747,10 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 201: + case 202: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 134: - case 137: + case 135: + case 138: return ts.forEach(node.parameters, nodeIsDecorated); } return false; @@ -3763,7 +3768,6 @@ var ts; case 95: case 80: case 9: - case 153: case 154: case 155: case 156: @@ -3773,69 +3777,70 @@ var ts; case 160: case 161: case 162: - case 174: case 163: - case 166: + case 175: case 164: - case 165: case 167: + case 165: + case 166: case 168: case 169: case 170: - case 173: case 171: + case 174: + case 172: case 10: - case 175: + case 176: return true; - case 126: - while (node.parent.kind === 126) { + case 127: + while (node.parent.kind === 127) { node = node.parent; } - return node.parent.kind === 144; + return node.parent.kind === 145; case 65: - if (node.parent.kind === 144) { + if (node.parent.kind === 145) { return true; } case 7: case 8: var parent_1 = node.parent; switch (parent_1.kind) { - case 198: - case 129: + case 199: + case 130: + case 133: case 132: - case 131: - case 226: - case 224: - case 152: + case 227: + case 225: + case 153: return parent_1.initializer === node; - case 182: case 183: case 184: case 185: - case 191: + case 186: case 192: case 193: - case 220: - case 195: - case 193: + case 194: + case 221: + case 196: + case 194: return parent_1.expression === node; - case 186: + case 187: var forStatement = parent_1; - return (forStatement.initializer === node && forStatement.initializer.kind !== 199) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 200) || forStatement.condition === node || forStatement.incrementor === node; - case 187: case 188: + case 189: var forInStatement = parent_1; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 199) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 200) || forInStatement.expression === node; - case 160: + case 161: return node === parent_1.expression; - case 176: + case 178: return node === parent_1.expression; - case 127: + case 128: return node === parent_1.expression; - case 130: + case 131: return true; default: if (isExpression(parent_1)) { @@ -3853,7 +3858,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 208 && node.moduleReference.kind === 219; + return node.kind === 209 && node.moduleReference.kind === 220; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -3862,40 +3867,40 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 208 && node.moduleReference.kind !== 219; + return node.kind === 209 && node.moduleReference.kind !== 220; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 209) { + if (node.kind === 210) { return node.moduleSpecifier; } - if (node.kind === 208) { + if (node.kind === 209) { var reference = node.moduleReference; - if (reference.kind === 219) { + if (reference.kind === 220) { return reference.expression; } } - if (node.kind === 215) { + if (node.kind === 216) { return node.moduleSpecifier; } } ts.getExternalModuleName = getExternalModuleName; function hasDotDotDotToken(node) { - return node && node.kind === 129 && node.dotDotDotToken !== undefined; + return node && node.kind === 130 && node.dotDotDotToken !== undefined; } ts.hasDotDotDotToken = hasDotDotDotToken; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 129: + case 130: return node.questionToken !== undefined; + case 135: case 134: - case 133: return node.questionToken !== undefined; + case 226: case 225: - case 224: + case 133: case 132: - case 131: return node.questionToken !== undefined; } } @@ -3919,7 +3924,7 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 151 || node.kind === 150); + return !!node && (node.kind === 152 || node.kind === 151); } ts.isBindingPattern = isBindingPattern; function isInAmbientContext(node) { @@ -3934,33 +3939,33 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 163: - case 152: - case 201: - case 135: - case 204: - case 226: - case 217: - case 200: - case 162: - case 136: - case 210: - case 208: - case 213: + case 164: + case 153: case 202: - case 134: - case 133: + case 136: case 205: - case 211: - case 129: - case 224: - case 132: - case 131: + case 227: + case 218: + case 201: + case 163: case 137: - case 225: + case 211: + case 209: + case 214: case 203: - case 128: - case 198: + case 135: + case 134: + case 206: + case 212: + case 130: + case 225: + case 133: + case 132: + case 138: + case 226: + case 204: + case 129: + case 199: return true; } return false; @@ -3968,25 +3973,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 190: - case 189: - case 197: - case 184: - case 182: - case 181: - case 187: - case 188: - case 186: - case 183: - case 194: case 191: - case 193: - case 94: - case 196: - case 180: + case 190: + case 198: case 185: + case 183: + case 182: + case 188: + case 189: + case 187: + case 184: + case 195: case 192: - case 214: + case 194: + case 94: + case 197: + case 181: + case 186: + case 193: + case 215: return true; default: return false; @@ -3995,13 +4000,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 135: - case 132: - case 134: case 136: - case 137: case 133: - case 140: + case 135: + case 137: + case 138: + case 134: + case 141: return true; default: return false; @@ -4013,7 +4018,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 213 || parent.kind === 217) { + if (parent.kind === 214 || parent.kind === 218) { if (parent.propertyName) { return true; } @@ -4025,12 +4030,12 @@ var ts; } ts.isDeclarationName = isDeclarationName; function isAliasSymbolDeclaration(node) { - return node.kind === 208 || - node.kind === 210 && !!node.name || - node.kind === 211 || - node.kind === 213 || - node.kind === 217 || - node.kind === 214 && node.expression.kind === 65; + return node.kind === 209 || + node.kind === 211 && !!node.name || + node.kind === 212 || + node.kind === 214 || + node.kind === 218 || + node.kind === 215 && node.expression.kind === 65; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { @@ -4113,7 +4118,7 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 66 <= token && token <= 125; + return 66 <= token && token <= 126; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -4122,19 +4127,19 @@ var ts; ts.isTrivia = isTrivia; function hasDynamicName(declaration) { return declaration.name && - declaration.name.kind === 127 && + declaration.name.kind === 128 && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; function isWellKnownSymbolSyntactically(node) { - return node.kind === 155 && isESSymbolIdentifier(node.expression); + return node.kind === 156 && isESSymbolIdentifier(node.expression); } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { if (name.kind === 65 || name.kind === 8 || name.kind === 7) { return name.text; } - if (name.kind === 127) { + if (name.kind === 128) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -4168,7 +4173,7 @@ var ts; } ts.isModifier = isModifier; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 205 || n.kind === 227; + return isFunctionLike(n) || n.kind === 206 || n.kind === 228; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -4392,7 +4397,7 @@ var ts; ts.getLineOfLocalPosition = getLineOfLocalPosition; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 135 && nodeIsPresent(member.body)) { + if (member.kind === 136 && nodeIsPresent(member.body)) { return member; } }); @@ -4415,10 +4420,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 136) { + if (accessor.kind === 137) { getAccessor = accessor; } - else if (accessor.kind === 137) { + else if (accessor.kind === 138) { setAccessor = accessor; } else { @@ -4427,7 +4432,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 136 || member.kind === 137) + if ((member.kind === 137 || member.kind === 138) && (member.flags & 128) === (accessor.flags & 128)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -4438,10 +4443,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 136 && !getAccessor) { + if (member.kind === 137 && !getAccessor) { getAccessor = member; } - if (member.kind === 137 && !setAccessor) { + if (member.kind === 138 && !setAccessor) { setAccessor = member; } } @@ -4562,22 +4567,22 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 155: case 156: - case 158: case 157: case 159: - case 153: - case 161: + case 158: + case 160: case 154: - case 174: case 162: + case 155: + case 175: + case 163: case 65: case 9: case 7: case 8: case 10: - case 171: + case 172: case 80: case 89: case 93: @@ -4593,30 +4598,84 @@ var ts; return token >= 53 && token <= 64; } ts.isAssignmentOperator = isAssignmentOperator; - function isSupportedHeritageClauseElement(node) { - return isSupportedHeritageClauseElementExpression(node.expression); + function isSupportedExpressionWithTypeArguments(node) { + return isSupportedExpressionWithTypeArgumentsRest(node.expression); } - ts.isSupportedHeritageClauseElement = isSupportedHeritageClauseElement; - function isSupportedHeritageClauseElementExpression(node) { + ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments; + function isSupportedExpressionWithTypeArgumentsRest(node) { if (node.kind === 65) { return true; } - else if (node.kind === 155) { - return isSupportedHeritageClauseElementExpression(node.expression); + else if (node.kind === 156) { + return isSupportedExpressionWithTypeArgumentsRest(node.expression); } else { return false; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 126 && node.parent.right === node) || - (node.parent.kind === 155 && node.parent.name === node); + return (node.parent.kind === 127 && node.parent.right === node) || + (node.parent.kind === 156 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function getLocalSymbolForExportDefault(symbol) { return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 256) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; + function getExpandedCharCodes(input) { + var output = []; + var length = input.length; + var leadSurrogate = undefined; + for (var i = 0; i < length; i++) { + var charCode = input.charCodeAt(i); + if (charCode < 0x80) { + output.push(charCode); + } + else if (charCode < 0x800) { + output.push((charCode >> 6) | 192); + output.push((charCode & 63) | 128); + } + else if (charCode < 0x10000) { + output.push((charCode >> 12) | 224); + output.push(((charCode >> 6) & 63) | 128); + output.push((charCode & 63) | 128); + } + else if (charCode < 0x20000) { + output.push((charCode >> 18) | 240); + output.push(((charCode >> 12) & 63) | 128); + output.push(((charCode >> 6) & 63) | 128); + output.push((charCode & 63) | 128); + } + else { + ts.Debug.assert(false, "Unexpected code point"); + } + } + return output; + } + var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + function convertToBase64(input) { + var result = ""; + var charCodes = getExpandedCharCodes(input); + var i = 0; + var length = charCodes.length; + var byte1, byte2, byte3, byte4; + while (i < length) { + byte1 = charCodes[i] >> 2; + byte2 = (charCodes[i] & 3) << 4 | charCodes[i + 1] >> 4; + byte3 = (charCodes[i + 1] & 15) << 2 | charCodes[i + 2] >> 6; + byte4 = charCodes[i + 2] & 63; + if (i + 1 >= length) { + byte3 = byte4 = 64; + } + else if (i + 2 >= length) { + byte4 = 64; + } + result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4); + i += 3; + } + return result; + } + ts.convertToBase64 = convertToBase64; })(ts || (ts = {})); var ts; (function (ts) { @@ -4738,7 +4797,7 @@ var ts; /// var ts; (function (ts) { - var nodeConstructors = new Array(229); + var nodeConstructors = new Array(230); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -4776,20 +4835,20 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 126: + case 127: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 128: + case 129: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 129: + case 130: + case 133: case 132: - case 131: - case 224: case 225: - case 198: - case 152: + case 226: + case 199: + case 153: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -4798,24 +4857,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 142: case 143: - case 138: + case 144: case 139: case 140: + case 141: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 134: - case 133: case 135: + case 134: case 136: case 137: - case 162: - case 200: + case 138: case 163: + case 201: + case 164: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -4826,151 +4885,144 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 141: + case 142: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 144: - return visitNode(cbNode, node.exprName); case 145: - return visitNodes(cbNodes, node.members); + return visitNode(cbNode, node.exprName); case 146: - return visitNode(cbNode, node.elementType); + return visitNodes(cbNodes, node.members); case 147: - return visitNodes(cbNodes, node.elementTypes); + return visitNode(cbNode, node.elementType); case 148: - return visitNodes(cbNodes, node.types); + return visitNodes(cbNodes, node.elementTypes); case 149: - return visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.types); case 150: + return visitNode(cbNode, node.type); case 151: - return visitNodes(cbNodes, node.elements); - case 153: + case 152: return visitNodes(cbNodes, node.elements); case 154: - return visitNodes(cbNodes, node.properties); + return visitNodes(cbNodes, node.elements); case 155: + return visitNodes(cbNodes, node.properties); + case 156: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 156: + case 157: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 157: case 158: + case 159: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 159: + case 160: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 160: + case 161: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 161: - return visitNode(cbNode, node.expression); - case 164: + case 162: return visitNode(cbNode, node.expression); case 165: return visitNode(cbNode, node.expression); case 166: return visitNode(cbNode, node.expression); case 167: - return visitNode(cbNode, node.operand); - case 172: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.expression); case 168: return visitNode(cbNode, node.operand); + case 173: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); case 169: + return visitNode(cbNode, node.operand); + case 170: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 170: + case 171: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 173: + case 174: return visitNode(cbNode, node.expression); - case 179: - case 206: + case 180: + case 207: return visitNodes(cbNodes, node.statements); - case 227: + case 228: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 180: + case 181: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 199: + case 200: return visitNodes(cbNodes, node.declarations); - case 182: - return visitNode(cbNode, node.expression); case 183: + return visitNode(cbNode, node.expression); + case 184: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 184: + case 185: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 185: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); case 186: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 187: return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); case 188: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 189: - case 190: - return visitNode(cbNode, node.label); - case 191: - return visitNode(cbNode, node.expression); - case 192: - return visitNode(cbNode, node.expression) || + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + case 190: + case 191: + return visitNode(cbNode, node.label); + case 192: + return visitNode(cbNode, node.expression); case 193: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 194: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 207: + case 208: return visitNodes(cbNodes, node.clauses); - case 220: + case 221: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 221: + case 222: return visitNodes(cbNodes, node.statements); - case 194: + case 195: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 195: - return visitNode(cbNode, node.expression); case 196: + return visitNode(cbNode, node.expression); + case 197: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 223: + case 224: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 130: + case 131: return visitNode(cbNode, node.expression); - case 201: - case 174: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); case 202: + case 175: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || @@ -4981,65 +5033,72 @@ var ts; return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNode(cbNode, node.type); + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); case 204: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.members); - case 226: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); + visitNode(cbNode, node.type); case 205: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 227: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 206: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 208: + case 209: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 209: + case 210: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 210: + case 211: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 211: - return visitNode(cbNode, node.name); case 212: - case 216: + return visitNode(cbNode, node.name); + case 213: + case 217: return visitNodes(cbNodes, node.elements); - case 215: + case 216: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 213: - case 217: + case 214: + case 218: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 214: + case 215: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 171: + case 172: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 176: + case 178: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 127: + case 128: return visitNode(cbNode, node.expression); - case 222: + case 223: return visitNodes(cbNodes, node.types); case 177: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 219: + case 220: return visitNode(cbNode, node.expression); - case 218: + case 219: return visitNodes(cbNodes, node.decorators); } } @@ -5125,7 +5184,7 @@ var ts; } } function createSourceFile(fileName, languageVersion) { - sourceFile = createNode(227, 0); + sourceFile = createNode(228, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -5418,7 +5477,7 @@ var ts; return parseIdentifierName(); } function parseComputedPropertyName() { - var node = createNode(127); + var node = createNode(128); parseExpected(18); var yieldContext = inYieldContext(); if (inGeneratorParameterContext()) { @@ -5712,14 +5771,14 @@ var ts; function isReusableModuleElement(node) { if (node) { switch (node.kind) { + case 210: case 209: - case 208: + case 216: case 215: - case 214: - case 201: case 202: + case 203: + case 206: case 205: - case 204: return true; } return isReusableStatement(node); @@ -5729,13 +5788,13 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 135: - case 140: - case 134: case 136: + case 141: + case 135: case 137: - case 132: - case 178: + case 138: + case 133: + case 179: return true; } } @@ -5744,8 +5803,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 220: case 221: + case 222: return true; } } @@ -5754,56 +5813,56 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 200: + case 201: + case 181: case 180: - case 179: + case 184: case 183: - case 182: - case 195: + case 196: + case 192: + case 194: case 191: - case 193: case 190: + case 188: case 189: case 187: - case 188: case 186: - case 185: - case 192: - case 181: - case 196: - case 194: - case 184: + case 193: + case 182: case 197: + case 195: + case 185: + case 198: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 226; + return node.kind === 227; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 139: - case 133: case 140: - case 131: - case 138: + case 134: + case 141: + case 132: + case 139: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 198) { + if (node.kind !== 199) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 129) { + if (node.kind !== 130) { return false; } var parameter = node; @@ -5898,7 +5957,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(20)) { - var node = createNode(126, entity.pos); + var node = createNode(127, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -5915,7 +5974,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(171); + var template = createNode(172); template.head = parseLiteralNode(); ts.Debug.assert(template.head.kind === 11, "Template head has wrong token kind"); var templateSpans = []; @@ -5928,7 +5987,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(176); + var span = createNode(178); span.expression = allowInAnd(parseExpression); var literal; if (token === 15) { @@ -5962,7 +6021,7 @@ var ts; return node; } function parseTypeReference() { - var node = createNode(141); + var node = createNode(142); node.typeName = parseEntityName(false, ts.Diagnostics.Type_expected); if (!scanner.hasPrecedingLineBreak() && token === 24) { node.typeArguments = parseBracketedList(17, parseType, 24, 25); @@ -5970,13 +6029,13 @@ var ts; return finishNode(node); } function parseTypeQuery() { - var node = createNode(144); + var node = createNode(145); parseExpected(97); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(128); + var node = createNode(129); node.name = parseIdentifier(); if (parseOptional(79)) { if (isStartOfType() || !isStartOfExpression()) { @@ -6011,7 +6070,7 @@ var ts; } } function parseParameter() { - var node = createNode(129); + var node = createNode(130); node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(21); @@ -6063,7 +6122,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 139) { + if (kind === 140) { parseExpected(88); } fillSignature(51, false, false, node); @@ -6103,7 +6162,7 @@ var ts; return token === 51 || token === 23 || token === 19; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(140, fullStart); + var node = createNode(141, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.parameters = parseBracketedList(15, parseParameter, 18, 19); @@ -6116,7 +6175,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(50); if (token === 16 || token === 24) { - var method = createNode(133, fullStart); + var method = createNode(134, fullStart); method.name = name; method.questionToken = questionToken; fillSignature(51, false, false, method); @@ -6124,7 +6183,7 @@ var ts; return finishNode(method); } else { - var property = createNode(131, fullStart); + var property = createNode(132, fullStart); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -6166,14 +6225,14 @@ var ts; switch (token) { case 16: case 24: - return parseSignatureMember(138); + return parseSignatureMember(139); case 18: return isIndexSignature() ? parseIndexSignatureDeclaration(scanner.getStartPos(), undefined, undefined) : parsePropertyOrMethodSignature(); case 88: if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(139); + return parseSignatureMember(140); } case 8: case 7: @@ -6203,7 +6262,7 @@ var ts; return token === 16 || token === 24; } function parseTypeLiteral() { - var node = createNode(145); + var node = createNode(146); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -6219,12 +6278,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(147); + var node = createNode(148); node.elementTypes = parseBracketedList(18, parseType, 18, 19); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(149); + var node = createNode(150); parseExpected(16); node.type = parseType(); parseExpected(17); @@ -6232,7 +6291,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 143) { + if (kind === 144) { parseExpected(88); } fillSignature(32, false, false, node); @@ -6245,10 +6304,10 @@ var ts; function parseNonArrayType() { switch (token) { case 112: - case 121: - case 119: - case 113: case 122: + case 120: + case 113: + case 123: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); case 99: @@ -6268,10 +6327,10 @@ var ts; function isStartOfType() { switch (token) { case 112: - case 121: - case 119: - case 113: case 122: + case 120: + case 113: + case 123: case 99: case 97: case 14: @@ -6293,7 +6352,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(18)) { parseExpected(19); - var node = createNode(146, type.pos); + var node = createNode(147, type.pos); node.elementType = type; type = finishNode(node); } @@ -6308,7 +6367,7 @@ var ts; types.push(parseArrayTypeOrHigher()); } types.end = getNodeEnd(); - var node = createNode(148, type.pos); + var node = createNode(149, type.pos); node.types = types; type = finishNode(node); } @@ -6353,10 +6412,10 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(142); + return parseFunctionOrConstructorType(143); } if (token === 88) { - return parseFunctionOrConstructorType(143); + return parseFunctionOrConstructorType(144); } return parseUnionTypeOrHigher(); } @@ -6494,7 +6553,7 @@ var ts; (isIdentifier() || token === 14 || token === 18); } function parseYieldExpression() { - var node = createNode(172); + var node = createNode(173); nextToken(); if (!scanner.hasPrecedingLineBreak() && (token === 35 || isStartOfExpression())) { @@ -6508,8 +6567,8 @@ var ts; } function parseSimpleArrowFunctionExpression(identifier) { ts.Debug.assert(token === 32, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(163, identifier.pos); - var parameter = createNode(129, identifier.pos); + var node = createNode(164, identifier.pos); + var parameter = createNode(130, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; @@ -6587,7 +6646,7 @@ var ts; return parseParenthesizedArrowFunctionExpressionHead(false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(163); + var node = createNode(164); fillSignature(51, false, !allowAmbiguity, node); if (!node.parameters) { return undefined; @@ -6614,7 +6673,7 @@ var ts; if (!questionToken) { return leftOperand; } - var node = createNode(170, leftOperand.pos); + var node = createNode(171, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -6627,7 +6686,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 86 || t === 125; + return t === 86 || t === 126; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -6688,37 +6747,37 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(169, left.pos); + var node = createNode(170, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(167); + var node = createNode(168); node.operator = token; nextToken(); node.operand = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(164); - nextToken(); - node.expression = parseUnaryExpressionOrHigher(); - return finishNode(node); - } - function parseTypeOfExpression() { var node = createNode(165); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } - function parseVoidExpression() { + function parseTypeOfExpression() { var node = createNode(166); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } + function parseVoidExpression() { + var node = createNode(167); + nextToken(); + node.expression = parseUnaryExpressionOrHigher(); + return finishNode(node); + } function parseUnaryExpressionOrHigher() { switch (token) { case 33: @@ -6744,7 +6803,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token === 38 || token === 39) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(168, expression.pos); + var node = createNode(169, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -6767,14 +6826,14 @@ var ts; if (token === 16 || token === 20) { return expression; } - var node = createNode(155, expression.pos); + var node = createNode(156, expression.pos); node.expression = expression; node.dotToken = parseExpectedToken(20, false, 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(160); + var node = createNode(161); parseExpected(24); node.type = parseType(); parseExpected(25); @@ -6785,7 +6844,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(20); if (dotToken) { - var propertyAccess = createNode(155, expression.pos); + var propertyAccess = createNode(156, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(true); @@ -6793,7 +6852,7 @@ var ts; continue; } if (!inDecoratorContext() && parseOptional(18)) { - var indexedAccess = createNode(156, expression.pos); + var indexedAccess = createNode(157, expression.pos); indexedAccess.expression = expression; if (token !== 19) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -6807,7 +6866,7 @@ var ts; continue; } if (token === 10 || token === 11) { - var tagExpression = createNode(159, expression.pos); + var tagExpression = createNode(160, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 10 ? parseLiteralNode() @@ -6826,7 +6885,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(157, expression.pos); + var callExpr = createNode(158, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -6834,7 +6893,7 @@ var ts; continue; } else if (token === 16) { - var callExpr = createNode(157, expression.pos); + var callExpr = createNode(158, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -6924,28 +6983,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(161); + var node = createNode(162); parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); return finishNode(node); } function parseSpreadElement() { - var node = createNode(173); + var node = createNode(174); parseExpected(21); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token === 21 ? parseSpreadElement() : - token === 23 ? createNode(175) : + token === 23 ? createNode(176) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(153); + var node = createNode(154); parseExpected(18); if (scanner.hasPrecedingLineBreak()) node.flags |= 512; @@ -6955,11 +7014,11 @@ var ts; } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(116)) { - return parseAccessorDeclaration(136, fullStart, decorators, modifiers); - } - else if (parseContextualModifier(120)) { return parseAccessorDeclaration(137, fullStart, decorators, modifiers); } + else if (parseContextualModifier(121)) { + return parseAccessorDeclaration(138, fullStart, decorators, modifiers); + } return undefined; } function parseObjectLiteralElement() { @@ -6979,13 +7038,13 @@ var ts; return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(225, fullStart); + var shorthandDeclaration = createNode(226, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(224, fullStart); + var propertyAssignment = createNode(225, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51); @@ -6994,7 +7053,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(154); + var node = createNode(155); parseExpected(14); if (scanner.hasPrecedingLineBreak()) { node.flags |= 512; @@ -7008,7 +7067,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(162); + var node = createNode(163); parseExpected(83); node.asteriskToken = parseOptionalToken(35); node.name = node.asteriskToken ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier(); @@ -7023,7 +7082,7 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(158); + var node = createNode(159); parseExpected(88); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); @@ -7033,7 +7092,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode, diagnosticMessage) { - var node = createNode(179); + var node = createNode(180); if (parseExpected(14, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(2, checkForStrictMode, parseStatement); parseExpected(15); @@ -7058,12 +7117,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(181); + var node = createNode(182); parseExpected(22); return finishNode(node); } function parseIfStatement() { - var node = createNode(183); + var node = createNode(184); parseExpected(84); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7073,7 +7132,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(184); + var node = createNode(185); parseExpected(75); node.statement = parseStatement(); parseExpected(100); @@ -7084,7 +7143,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(185); + var node = createNode(186); parseExpected(100); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7107,21 +7166,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(86)) { - var forInStatement = createNode(187, pos); + var forInStatement = createNode(188, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(17); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(125)) { - var forOfStatement = createNode(188, pos); + else if (parseOptional(126)) { + var forOfStatement = createNode(189, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(17); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(186, pos); + var forStatement = createNode(187, pos); forStatement.initializer = initializer; parseExpected(22); if (token !== 22 && token !== 17) { @@ -7139,7 +7198,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 190 ? 66 : 71); + parseExpected(kind === 191 ? 66 : 71); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -7147,7 +7206,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(191); + var node = createNode(192); parseExpected(90); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -7156,7 +7215,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(192); + var node = createNode(193); parseExpected(101); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7165,7 +7224,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(220); + var node = createNode(221); parseExpected(67); node.expression = allowInAnd(parseExpression); parseExpected(51); @@ -7173,7 +7232,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(221); + var node = createNode(222); parseExpected(73); parseExpected(51); node.statements = parseList(4, false, parseStatement); @@ -7183,12 +7242,12 @@ var ts; return token === 67 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(193); + var node = createNode(194); parseExpected(92); parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); - var caseBlock = createNode(207, scanner.getStartPos()); + var caseBlock = createNode(208, scanner.getStartPos()); parseExpected(14); caseBlock.clauses = parseList(3, false, parseCaseOrDefaultClause); parseExpected(15); @@ -7198,14 +7257,14 @@ var ts; function parseThrowStatement() { // ThrowStatement[Yield] : // throw [no LineTerminator here]Expression[In, ?Yield]; - var node = createNode(195); + var node = createNode(196); parseExpected(94); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(196); + var node = createNode(197); parseExpected(96); node.tryBlock = parseBlock(false, false); node.catchClause = token === 68 ? parseCatchClause() : undefined; @@ -7216,7 +7275,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(223); + var result = createNode(224); parseExpected(68); if (parseExpected(16)) { result.variableDeclaration = parseVariableDeclaration(); @@ -7226,7 +7285,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(197); + var node = createNode(198); parseExpected(72); parseSemicolon(); return finishNode(node); @@ -7235,13 +7294,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 65 && parseOptional(51)) { - var labeledStatement = createNode(194, fullStart); + var labeledStatement = createNode(195, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(182, fullStart); + var expressionStatement = createNode(183, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -7282,8 +7341,9 @@ var ts; return !isConstEnum; case 103: case 117: + case 118: case 77: - case 123: + case 124: if (isDeclarationStart()) { return false; } @@ -7328,9 +7388,9 @@ var ts; case 82: return parseForOrForInOrForOfStatement(); case 71: - return parseBreakOrContinueStatement(189); - case 66: return parseBreakOrContinueStatement(190); + case 66: + return parseBreakOrContinueStatement(191); case 90: return parseReturnStatement(); case 101: @@ -7393,16 +7453,16 @@ var ts; } function parseArrayBindingElement() { if (token === 23) { - return createNode(175); + return createNode(176); } - var node = createNode(152); + var node = createNode(153); node.dotDotDotToken = parseOptionalToken(21); node.name = parseIdentifierOrPattern(); node.initializer = parseInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(152); + var node = createNode(153); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); if (tokenIsIdentifier && token !== 51) { @@ -7417,14 +7477,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(150); + var node = createNode(151); parseExpected(14); node.elements = parseDelimitedList(10, parseObjectBindingElement); parseExpected(15); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(151); + var node = createNode(152); parseExpected(18); node.elements = parseDelimitedList(11, parseArrayBindingElement); parseExpected(19); @@ -7443,7 +7503,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(198); + var node = createNode(199); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -7452,7 +7512,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(199); + var node = createNode(200); switch (token) { case 98: break; @@ -7466,7 +7526,7 @@ var ts; ts.Debug.fail(); } nextToken(); - if (token === 125 && lookAhead(canFollowContextualOfKeyword)) { + if (token === 126 && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -7481,7 +7541,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 17; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(180, fullStart); + var node = createNode(181, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -7489,7 +7549,7 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(200, fullStart); + var node = createNode(201, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(83); @@ -7500,7 +7560,7 @@ var ts; return finishNode(node); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(135, pos); + var node = createNode(136, pos); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(114); @@ -7509,7 +7569,7 @@ var ts; return finishNode(node); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(134, fullStart); + var method = createNode(135, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -7520,7 +7580,7 @@ var ts; return finishNode(method); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(132, fullStart); + var property = createNode(133, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -7587,7 +7647,7 @@ var ts; return true; } if (idToken !== undefined) { - if (!ts.isKeyword(idToken) || idToken === 120 || idToken === 116) { + if (!ts.isKeyword(idToken) || idToken === 121 || idToken === 116) { return true; } switch (token) { @@ -7614,7 +7674,7 @@ var ts; decorators = []; decorators.pos = scanner.getStartPos(); } - var decorator = createNode(130, decoratorStart); + var decorator = createNode(131, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -7647,7 +7707,7 @@ var ts; } function parseClassElement() { if (token === 22) { - var result = createNode(178); + var result = createNode(179); nextToken(); return finishNode(result); } @@ -7678,10 +7738,10 @@ var ts; ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 174); + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 175); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 201); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 202); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var savedStrictModeContext = inStrictModeContext(); @@ -7722,15 +7782,15 @@ var ts; } function parseHeritageClause() { if (token === 79 || token === 102) { - var node = createNode(222); + var node = createNode(223); node.token = token; nextToken(); - node.types = parseDelimitedList(8, parseHeritageClauseElement); + node.types = parseDelimitedList(8, parseExpressionWithTypeArguments); return finishNode(node); } return undefined; } - function parseHeritageClauseElement() { + function parseExpressionWithTypeArguments() { var node = createNode(177); node.expression = parseLeftHandSideExpressionOrHigher(); if (token === 24) { @@ -7745,7 +7805,7 @@ var ts; return parseList(6, false, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(202, fullStart); + var node = createNode(203, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(103); @@ -7756,10 +7816,10 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(203, fullStart); + var node = createNode(204, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(123); + parseExpected(124); node.name = parseIdentifier(); parseExpected(53); node.type = parseType(); @@ -7767,13 +7827,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(226, scanner.getStartPos()); + var node = createNode(227, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(204, fullStart); + var node = createNode(205, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(77); @@ -7788,7 +7848,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(206, scanner.getStartPos()); + var node = createNode(207, scanner.getStartPos()); if (parseExpected(14)) { node.statements = parseList(1, false, parseModuleElement); parseExpected(15); @@ -7798,19 +7858,19 @@ var ts; } return finishNode(node); } - function parseInternalModuleTail(fullStart, decorators, modifiers, flags) { - var node = createNode(205, fullStart); + function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { + var node = createNode(206, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); node.body = parseOptional(20) - ? parseInternalModuleTail(getNodePos(), undefined, undefined, 1) + ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(205, fullStart); + var node = createNode(206, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(true); @@ -7818,13 +7878,20 @@ var ts; return finishNode(node); } function parseModuleDeclaration(fullStart, decorators, modifiers) { - parseExpected(117); - return token === 8 - ? parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) - : parseInternalModuleTail(fullStart, decorators, modifiers, modifiers ? modifiers.flags : 0); + var flags = modifiers ? modifiers.flags : 0; + if (parseOptional(118)) { + flags |= 32768; + } + else { + parseExpected(117); + if (token === 8) { + return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); + } + } + return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); } function isExternalModuleReference() { - return token === 118 && + return token === 119 && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -7833,7 +7900,7 @@ var ts; function nextTokenIsCommaOrFromKeyword() { nextToken(); return token === 23 || - token === 124; + token === 125; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { parseExpected(85); @@ -7841,8 +7908,8 @@ var ts; var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 23 && token !== 124) { - var importEqualsDeclaration = createNode(208, fullStart); + if (token !== 23 && token !== 125) { + var importEqualsDeclaration = createNode(209, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -7852,14 +7919,14 @@ var ts; return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(209, fullStart); + var importDeclaration = createNode(210, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); if (identifier || token === 35 || token === 14) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(124); + parseExpected(125); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); @@ -7872,13 +7939,13 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(210, fullStart); + var importClause = createNode(211, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(23)) { - importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(212); + importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(213); } return finishNode(importClause); } @@ -7888,8 +7955,8 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(219); - parseExpected(118); + var node = createNode(220); + parseExpected(119); parseExpected(16); node.expression = parseModuleSpecifier(); parseExpected(17); @@ -7903,7 +7970,7 @@ var ts; return result; } function parseNamespaceImport() { - var namespaceImport = createNode(211); + var namespaceImport = createNode(212); parseExpected(35); parseExpected(111); namespaceImport.name = parseIdentifier(); @@ -7911,14 +7978,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(20, kind === 212 ? parseImportSpecifier : parseExportSpecifier, 14, 15); + node.elements = parseBracketedList(20, kind === 213 ? parseImportSpecifier : parseExportSpecifier, 14, 15); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(217); + return parseImportOrExportSpecifier(218); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(213); + return parseImportOrExportSpecifier(214); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -7937,22 +8004,22 @@ var ts; else { node.name = identifierName; } - if (kind === 213 && checkIdentifierIsKeyword) { + if (kind === 214 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(215, fullStart); + var node = createNode(216, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(35)) { - parseExpected(124); + parseExpected(125); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(216); - if (parseOptional(124)) { + node.exportClause = parseNamedImportsOrExports(217); + if (parseOptional(125)) { node.moduleSpecifier = parseModuleSpecifier(); } } @@ -7960,7 +8027,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(214, fullStart); + var node = createNode(215, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(53)) { @@ -7987,11 +8054,12 @@ var ts; case 69: case 103: case 77: - case 123: + case 124: return lookAhead(nextTokenIsIdentifierOrKeyword); case 85: return lookAhead(nextTokenCanFollowImportKeyword); case 117: + case 118: return lookAhead(nextTokenIsIdentifierOrKeywordOrStringLiteral); case 78: return lookAhead(nextTokenCanFollowExportKeyword); @@ -8057,17 +8125,18 @@ var ts; return parseClassDeclaration(fullStart, decorators, modifiers); case 103: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 123: + case 124: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 77: return parseEnumDeclaration(fullStart, decorators, modifiers); case 117: + case 118: return parseModuleDeclaration(fullStart, decorators, modifiers); case 85: return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); default: if (decorators) { - var node = createMissingNode(218, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(219, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -8147,10 +8216,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 - || node.kind === 208 && node.moduleReference.kind === 219 - || node.kind === 209 - || node.kind === 214 + || node.kind === 209 && node.moduleReference.kind === 220 + || node.kind === 210 || node.kind === 215 + || node.kind === 216 ? node : undefined; }); @@ -8703,10 +8772,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 227); + return ts.getAncestor(node, 228); } function isGlobalSourceFile(node) { - return node.kind === 227 && !ts.isExternalModule(node); + return node.kind === 228 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -8748,18 +8817,18 @@ var ts; } } switch (location.kind) { - case 227: + case 228: if (!ts.isExternalModule(location)) break; - case 205: + case 206: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { - if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 217)) { + if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 218)) { break loop; } result = undefined; } - else if (location.kind === 227 || - (location.kind === 205 && location.name.kind === 8)) { + else if (location.kind === 228 || + (location.kind === 206 && location.name.kind === 8)) { result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931); var localSymbol = ts.getLocalSymbolForExportDefault(result); if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { @@ -8768,14 +8837,14 @@ var ts; result = undefined; } break; - case 204: + case 205: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; + case 133: case 132: - case 131: - if (location.parent.kind === 201 && !(location.flags & 128)) { + if (location.parent.kind === 202 && !(location.flags & 128)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455)) { @@ -8784,8 +8853,8 @@ var ts; } } break; - case 201: case 202: + case 203: 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); @@ -8794,28 +8863,28 @@ var ts; break loop; } break; - case 127: + case 128: grandparent = location.parent.parent; - if (grandparent.kind === 201 || grandparent.kind === 202) { + if (grandparent.kind === 202 || grandparent.kind === 203) { 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 134: - case 133: case 135: + case 134: case 136: case 137: - case 200: - case 163: + case 138: + case 201: + case 164: if (name === "arguments") { result = argumentsSymbol; break loop; } break; - case 162: + case 163: if (name === "arguments") { result = argumentsSymbol; break loop; @@ -8826,15 +8895,15 @@ var ts; break loop; } break; - case 174: + case 175: var className = location.name; if (className && name === className.text) { result = location.symbol; break loop; } break; - case 130: - if (location.parent && location.parent.kind === 129) { + case 131: + if (location.parent && location.parent.kind === 130) { location = location.parent; } if (location.parent && ts.isClassElement(location.parent)) { @@ -8872,14 +8941,14 @@ var ts; ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { - var variableDeclaration = ts.getAncestor(declaration, 198); + var variableDeclaration = ts.getAncestor(declaration, 199); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 180 || - variableDeclaration.parent.parent.kind === 186) { + if (variableDeclaration.parent.parent.kind === 181 || + variableDeclaration.parent.parent.kind === 187) { isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 188 || - variableDeclaration.parent.parent.kind === 187) { + else if (variableDeclaration.parent.parent.kind === 189 || + variableDeclaration.parent.parent.kind === 188) { var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } @@ -8901,10 +8970,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 208) { + if (node.kind === 209) { return node; } - while (node && node.kind !== 209) { + while (node && node.kind !== 210) { node = node.parent; } return node; @@ -8914,7 +8983,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 219) { + if (node.moduleReference.kind === 220) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -8924,7 +8993,7 @@ var ts; if (moduleSymbol) { var exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]); if (!exportDefaultSymbol) { - error(node.name, ts.Diagnostics.External_module_0_has_no_default_export, symbolToString(moduleSymbol)); + error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } return exportDefaultSymbol; } @@ -9003,17 +9072,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 208: + case 209: return getTargetOfImportEqualsDeclaration(node); - case 210: - return getTargetOfImportClause(node); case 211: + return getTargetOfImportClause(node); + case 212: return getTargetOfNamespaceImport(node); - case 213: - return getTargetOfImportSpecifier(node); - case 217: - return getTargetOfExportSpecifier(node); case 214: + return getTargetOfImportSpecifier(node); + case 218: + return getTargetOfExportSpecifier(node); + case 215: return getTargetOfExportAssignment(node); } } @@ -9055,10 +9124,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 214) { + if (node.kind === 215) { checkExpressionCached(node.expression); } - else if (node.kind === 217) { + else if (node.kind === 218) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -9068,17 +9137,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 208); + importDeclaration = ts.getAncestor(entityName, 209); ts.Debug.assert(importDeclaration !== undefined); } if (entityName.kind === 65 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 65 || entityName.parent.kind === 126) { + if (entityName.kind === 65 || entityName.parent.kind === 127) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 208); + ts.Debug.assert(entityName.parent.kind === 209); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -9096,9 +9165,9 @@ var ts; return undefined; } } - else if (name.kind === 126 || name.kind === 155) { - var left = name.kind === 126 ? name.left : name.expression; - var right = name.kind === 126 ? name.right : name.name; + else if (name.kind === 127 || name.kind === 156) { + var left = name.kind === 127 ? name.left : name.expression; + var right = name.kind === 127 ? name.right : name.name; var namespace = resolveEntityName(left, 1536); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -9151,10 +9220,10 @@ var ts; if (sourceFile.symbol) { return sourceFile.symbol; } - error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_an_external_module, sourceFile.fileName); + error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName); return; } - error(moduleReferenceLiteral, ts.Diagnostics.Cannot_find_external_module_0, moduleName); + error(moduleReferenceLiteral, ts.Diagnostics.Cannot_find_module_0, moduleName); } function resolveExternalModuleSymbol(moduleSymbol) { return moduleSymbol && resolveSymbol(moduleSymbol.exports["export="]) || moduleSymbol; @@ -9162,7 +9231,7 @@ var ts; function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression) { var symbol = resolveExternalModuleSymbol(moduleSymbol); if (symbol && !(symbol.flags & (1536 | 3))) { - error(moduleReferenceExpression, ts.Diagnostics.External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); + error(moduleReferenceExpression, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); symbol = undefined; } return symbol; @@ -9242,7 +9311,7 @@ var ts; var members = node.members; for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; - if (member.kind === 135 && ts.nodeIsPresent(member.body)) { + if (member.kind === 136 && ts.nodeIsPresent(member.body)) { return member; } } @@ -9307,17 +9376,17 @@ var ts; } } switch (location_1.kind) { - case 227: + case 228: if (!ts.isExternalModule(location_1)) { break; } - case 205: + case 206: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 201: case 202: + case 203: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -9432,8 +9501,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 205 && declaration.name.kind === 8) || - (declaration.kind === 227 && ts.isExternalModule(declaration)); + return (declaration.kind === 206 && declaration.name.kind === 8) || + (declaration.kind === 228 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -9465,11 +9534,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 144) { + if (entityName.parent.kind === 145) { meaning = 107455 | 1048576; } - else if (entityName.kind === 126 || entityName.kind === 155 || - entityName.parent.kind === 208) { + else if (entityName.kind === 127 || entityName.kind === 156 || + entityName.parent.kind === 209) { meaning = 1536; } else { @@ -9513,10 +9582,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { var node = type.symbol.declarations[0].parent; - while (node.kind === 149) { + while (node.kind === 150) { node = node.parent; } - if (node.kind === 203) { + if (node.kind === 204) { return getSymbolOfNode(node); } } @@ -9688,7 +9757,7 @@ var ts; var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 227 || declaration.parent.kind === 206; + return declaration.parent.kind === 228 || declaration.parent.kind === 207; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -9763,7 +9832,7 @@ var ts; writer.writeParameter(getIndexerParameterName(resolved, 0, "x")); writePunctuation(writer, 51); writeSpace(writer); - writeKeyword(writer, 121); + writeKeyword(writer, 122); writePunctuation(writer, 19); writePunctuation(writer, 51); writeSpace(writer); @@ -9776,7 +9845,7 @@ var ts; writer.writeParameter(getIndexerParameterName(resolved, 1, "x")); writePunctuation(writer, 51); writeSpace(writer); - writeKeyword(writer, 119); + writeKeyword(writer, 120); writePunctuation(writer, 19); writePunctuation(writer, 51); writeSpace(writer); @@ -9920,12 +9989,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 205) { + if (node.kind === 206) { if (node.name.kind === 8) { return node; } } - else if (node.kind === 227) { + else if (node.kind === 228) { return ts.isExternalModule(node) ? node : undefined; } } @@ -9968,59 +10037,59 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 152: + case 153: return isDeclarationVisible(node.parent.parent); - case 198: + case 199: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 205: - case 201: + case 206: case 202: case 203: - case 200: case 204: - case 208: + case 201: + case 205: + case 209: var parent_2 = getDeclarationContainer(node); if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 208 && parent_2.kind !== 227 && ts.isInAmbientContext(parent_2))) { + !(node.kind !== 209 && parent_2.kind !== 228 && ts.isInAmbientContext(parent_2))) { return isGlobalSourceFile(parent_2); } return isDeclarationVisible(parent_2); - case 132: - case 131: - case 136: - case 137: - case 134: case 133: + case 132: + case 137: + case 138: + case 135: + case 134: if (node.flags & (32 | 64)) { return false; } - case 135: - case 139: - case 138: + case 136: case 140: - case 129: - case 206: - case 142: - case 143: - case 145: + case 139: case 141: + case 130: + case 207: + case 143: + case 144: case 146: + case 142: case 147: case 148: case 149: + case 150: return isDeclarationVisible(node.parent); - case 210: case 211: - case 213: - return false; - case 128: - case 227: - return true; + case 212: case 214: return false; + case 129: + case 228: + return true; + case 215: + return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); } @@ -10035,10 +10104,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 214) { + if (node.parent && node.parent.kind === 215) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 217) { + else if (node.parent.kind === 218) { exportSymbol = getTargetOfExportSpecifier(node.parent); } var result = []; @@ -10063,14 +10132,14 @@ var ts; } } function getRootDeclaration(node) { - while (node.kind === 152) { + while (node.kind === 153) { node = node.parent.parent; } return node; } function getDeclarationContainer(node) { node = getRootDeclaration(node); - return node.kind === 198 ? node.parent.parent.parent : node.parent; + return node.kind === 199 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); @@ -10093,7 +10162,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 150) { + if (pattern.kind === 151) { var name_5 = declaration.propertyName || declaration.name; type = getTypeOfPropertyOfType(parentType, name_5.text) || isNumericLiteralName(name_5.text) && getIndexTypeOfType(parentType, 1) || @@ -10130,10 +10199,10 @@ var ts; return type; } function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 187) { + if (declaration.parent.parent.kind === 188) { return anyType; } - if (declaration.parent.parent.kind === 188) { + if (declaration.parent.parent.kind === 189) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { @@ -10142,10 +10211,10 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 129) { + if (declaration.kind === 130) { var func = declaration.parent; - if (func.kind === 137 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 136); + if (func.kind === 138 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 137); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -10158,7 +10227,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 225) { + if (declaration.kind === 226) { return checkIdentifier(declaration.name); } return undefined; @@ -10187,7 +10256,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 175 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 176 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -10202,7 +10271,7 @@ var ts; return createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern) { - return pattern.kind === 150 + return pattern.kind === 151 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); } @@ -10212,7 +10281,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 224 ? getWidenedType(type) : type; + return declaration.kind !== 225 ? getWidenedType(type) : type; } if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name); @@ -10220,7 +10289,7 @@ var ts; type = declaration.dotDotDotToken ? anyArrayType : anyType; if (reportErrors && compilerOptions.noImplicitAny) { var root = getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 129 && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 130 && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -10233,10 +10302,10 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 223) { + if (declaration.parent.kind === 224) { return links.type = anyType; } - if (declaration.kind === 214) { + if (declaration.kind === 215) { return links.type = checkExpression(declaration.expression); } links.type = resolvingType; @@ -10261,7 +10330,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 136) { + if (accessor.kind === 137) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -10280,8 +10349,8 @@ var ts; links = links || getSymbolLinks(symbol); if (!links.type) { links.type = resolvingType; - var getter = ts.getDeclarationOfKind(symbol, 136); - var setter = ts.getDeclarationOfKind(symbol, 137); + var getter = ts.getDeclarationOfKind(symbol, 137); + var setter = ts.getDeclarationOfKind(symbol, 138); var type; var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { @@ -10311,7 +10380,7 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 136); + var getter = ts.getDeclarationOfKind(symbol, 137); 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)); } } @@ -10378,7 +10447,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 202 || node.kind === 201) { + if (node.kind === 203 || node.kind === 202) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -10412,10 +10481,10 @@ var ts; } function resolveBaseTypesOfClass(type) { type.baseTypes = []; - var declaration = ts.getDeclarationOfKind(type.symbol, 201); + var declaration = ts.getDeclarationOfKind(type.symbol, 202); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(declaration); if (baseTypeNode) { - var baseType = getTypeFromHeritageClauseElement(baseTypeNode); + var baseType = getTypeFromTypeNode(baseTypeNode); if (baseType !== unknownType) { if (getTargetType(baseType).flags & 1024) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10435,10 +10504,10 @@ var ts; type.baseTypes = []; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 202 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 203 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; - var baseType = getTypeFromHeritageClauseElement(node); + var baseType = getTypeFromTypeNode(node); if (baseType !== unknownType) { if (getTargetType(baseType).flags & (1024 | 2048)) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10477,7 +10546,7 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = ts.getDeclarationOfKind(symbol, 203); + var declaration = ts.getDeclarationOfKind(symbol, 204); var type = getTypeFromTypeNode(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; @@ -10485,7 +10554,7 @@ var ts; } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 203); + var declaration = ts.getDeclarationOfKind(symbol, 204); error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; @@ -10504,7 +10573,7 @@ var ts; if (!links.declaredType) { var type = createType(512); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 128).constraint) { + if (!ts.getDeclarationOfKind(symbol, 129).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -10951,7 +11020,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 135 ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 136 ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; @@ -10980,8 +11049,8 @@ var ts; returnType = getTypeFromTypeNode(declaration.type); } else { - if (declaration.kind === 136 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 137); + if (declaration.kind === 137 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 138); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { @@ -10999,19 +11068,19 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 142: case 143: - case 200: - case 134: - case 133: + case 144: + case 201: case 135: - case 138: + case 134: + case 136: case 139: case 140: - case 136: + case 141: case 137: - case 162: + case 138: case 163: + case 164: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -11081,7 +11150,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 135 || signature.declaration.kind === 139; + var isConstructor = signature.declaration.kind === 136 || signature.declaration.kind === 140; var type = createObjectType(32768 | 65536); type.members = emptySymbols; type.properties = emptyArray; @@ -11095,7 +11164,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 ? 119 : 121; + var syntaxKind = kind === 1 ? 120 : 122; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; @@ -11125,7 +11194,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 128).constraint); + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 129).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -11175,13 +11244,13 @@ var ts; while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 128; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 129; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 141 && n.typeName.kind === 65) { + if (n.kind === 142 && n.typeName.kind === 65) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); @@ -11200,18 +11269,12 @@ var ts; check(typeParameter.constraint); } } - function getTypeFromTypeReference(node) { - return getTypeFromTypeReferenceOrHeritageClauseElement(node); - } - function getTypeFromHeritageClauseElement(node) { - return getTypeFromTypeReferenceOrHeritageClauseElement(node); - } - function getTypeFromTypeReferenceOrHeritageClauseElement(node) { + function getTypeFromTypeReferenceOrExpressionWithTypeArguments(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var type; - if (node.kind !== 177 || ts.isSupportedHeritageClauseElement(node)) { - var typeNameOrExpression = node.kind === 141 + if (node.kind !== 177 || ts.isSupportedExpressionWithTypeArguments(node)) { + var typeNameOrExpression = node.kind === 142 ? node.typeName : node.expression; var symbol = resolveEntityName(typeNameOrExpression, 793056); @@ -11257,9 +11320,9 @@ var ts; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 201: case 202: - case 204: + case 203: + case 205: return declaration; } } @@ -11448,38 +11511,38 @@ var ts; switch (node.kind) { case 112: return anyType; - case 121: + case 122: return stringType; - case 119: + case 120: return numberType; case 113: return booleanType; - case 122: + case 123: return esSymbolType; case 99: return voidType; case 8: return getTypeFromStringLiteral(node); - case 141: - return getTypeFromTypeReference(node); - case 177: - return getTypeFromHeritageClauseElement(node); - case 144: - return getTypeFromTypeQueryNode(node); - case 146: - return getTypeFromArrayTypeNode(node); - case 147: - return getTypeFromTupleTypeNode(node); - case 148: - return getTypeFromUnionTypeNode(node); - case 149: - return getTypeFromTypeNode(node.type); case 142: - case 143: + return getTypeFromTypeReferenceOrExpressionWithTypeArguments(node); + case 177: + return getTypeFromTypeReferenceOrExpressionWithTypeArguments(node); case 145: + return getTypeFromTypeQueryNode(node); + case 147: + return getTypeFromArrayTypeNode(node); + case 148: + return getTypeFromTupleTypeNode(node); + case 149: + return getTypeFromUnionTypeNode(node); + case 150: + return getTypeFromTypeNode(node.type); + case 143: + case 144: + case 146: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 65: - case 126: + case 127: var symbol = getSymbolInfo(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: @@ -11630,27 +11693,27 @@ var ts; return type; } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 134 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 135 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 162: case 163: + case 164: return isContextSensitiveFunctionLikeDeclaration(node); - case 154: + case 155: return ts.forEach(node.properties, isContextSensitive); - case 153: + case 154: return ts.forEach(node.elements, isContextSensitive); - case 170: + case 171: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 169: + case 170: return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 224: + case 225: return isContextSensitive(node.initializer); + case 135: case 134: - case 133: return isContextSensitiveFunctionLikeDeclaration(node); - case 161: + case 162: return isContextSensitive(node.expression); } return false; @@ -12424,22 +12487,22 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { + case 133: case 132: - case 131: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 129: + case 130: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 200: + case 201: + case 135: case 134: - case 133: - case 136: case 137: - case 162: + case 138: case 163: + case 164: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -12682,10 +12745,10 @@ var ts; function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 144: + case 145: return true; case 65: - case 126: + case 127: node = node.parent; continue; default: @@ -12727,7 +12790,7 @@ var ts; function isAssignedInBinaryExpression(node) { if (node.operatorToken.kind >= 53 && node.operatorToken.kind <= 64) { var n = node.left; - while (n.kind === 161) { + while (n.kind === 162) { n = n.expression; } if (n.kind === 65 && getResolvedSymbol(n) === symbol) { @@ -12744,46 +12807,46 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 169: + case 170: return isAssignedInBinaryExpression(node); - case 198: - case 152: - return isAssignedInVariableDeclaration(node); - case 150: - case 151: + case 199: case 153: + return isAssignedInVariableDeclaration(node); + case 151: + case 152: case 154: case 155: case 156: case 157: case 158: - case 160: + case 159: case 161: - case 167: - case 164: + case 162: + case 168: case 165: case 166: - case 168: - case 170: - case 173: - case 179: + case 167: + case 169: + case 171: + case 174: case 180: - case 182: + case 181: case 183: case 184: case 185: case 186: case 187: case 188: - case 191: + case 189: case 192: case 193: - case 220: - case 221: case 194: + case 221: + case 222: case 195: case 196: - case 223: + case 197: + case 224: return ts.forEachChild(node, isAssignedIn); } return false; @@ -12819,17 +12882,17 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 183: + case 184: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } break; - case 170: + case 171: if (child !== node.condition) { narrowedType = narrowType(type, node.condition, child === node.whenTrue); } break; - case 169: + case 170: if (child === node.right) { if (node.operatorToken.kind === 48) { narrowedType = narrowType(type, node.left, true); @@ -12839,14 +12902,14 @@ var ts; } } break; - case 227: - case 205: - case 200: - case 134: - case 133: - case 136: - case 137: + case 228: + case 206: + case 201: case 135: + case 134: + case 137: + case 138: + case 136: break loop; } if (narrowedType !== type) { @@ -12859,7 +12922,7 @@ var ts; } return type; function narrowTypeByEquality(type, expr, assumeTrue) { - if (expr.left.kind !== 165 || expr.right.kind !== 8) { + if (expr.left.kind !== 166 || expr.right.kind !== 8) { return type; } var left = expr.left; @@ -12932,9 +12995,9 @@ var ts; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 161: + case 162: return narrowType(type, expr.expression, assumeTrue); - case 169: + case 170: var operator = expr.operatorToken.kind; if (operator === 30 || operator === 31) { return narrowTypeByEquality(type, expr, assumeTrue); @@ -12949,7 +13012,7 @@ var ts; return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 167: + case 168: if (expr.operator === 46) { return narrowType(type, expr.operand, !assumeTrue); } @@ -12960,7 +13023,7 @@ var ts; } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); - if (symbol === argumentsSymbol && ts.getContainingFunction(node).kind === 163 && languageVersion < 2) { + if (symbol === argumentsSymbol && ts.getContainingFunction(node).kind === 164 && languageVersion < 2) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } if (symbol.flags & 8388608 && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) { @@ -12984,15 +13047,15 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 || (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 223) { + symbol.valueDeclaration.parent.kind === 224) { return; } var container = symbol.valueDeclaration; - while (container.kind !== 199) { + while (container.kind !== 200) { container = container.parent; } container = container.parent; - if (container.kind === 180) { + if (container.kind === 181) { container = container.parent; } var inFunction = isInsideFunction(node.parent, container); @@ -13009,9 +13072,9 @@ var ts; } } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 201 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 202 ? container.parent : undefined; getNodeLinks(node).flags |= 2; - if (container.kind === 132 || container.kind === 135) { + if (container.kind === 133 || container.kind === 136) { getNodeLinks(classNode).flags |= 4; } else { @@ -13021,36 +13084,36 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 163) { + if (container.kind === 164) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 205: - error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); + case 206: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 204: + case 205: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 135: + case 136: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; + case 133: case 132: - case 131: if (container.flags & 128) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 127: + case 128: 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 === 201 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 202 ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -13059,15 +13122,15 @@ var ts; } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 129) { + if (n.kind === 130) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 157 && node.parent.expression === node; - var enclosingClass = ts.getAncestor(node, 201); + var isCallExpression = node.parent.kind === 158 && node.parent.expression === node; + var enclosingClass = ts.getAncestor(node, 202); var baseClass; if (enclosingClass && ts.getClassExtendsHeritageClauseElement(enclosingClass)) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); @@ -13083,31 +13146,31 @@ var ts; var canUseSuperExpression = false; var needToCaptureLexicalThis; if (isCallExpression) { - canUseSuperExpression = container.kind === 135; + canUseSuperExpression = container.kind === 136; } else { needToCaptureLexicalThis = false; - while (container && container.kind === 163) { + while (container && container.kind === 164) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } - if (container && container.parent && container.parent.kind === 201) { + if (container && container.parent && container.parent.kind === 202) { if (container.flags & 128) { canUseSuperExpression = - container.kind === 134 || - container.kind === 133 || - container.kind === 136 || - container.kind === 137; + container.kind === 135 || + container.kind === 134 || + container.kind === 137 || + container.kind === 138; } else { canUseSuperExpression = - container.kind === 134 || - container.kind === 133 || - container.kind === 136 || + container.kind === 135 || + container.kind === 134 || container.kind === 137 || + container.kind === 138 || + container.kind === 133 || container.kind === 132 || - container.kind === 131 || - container.kind === 135; + container.kind === 136; } } } @@ -13121,7 +13184,7 @@ var ts; getNodeLinks(node).flags |= 16; returnType = baseClass; } - if (container.kind === 135 && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 136 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); returnType = unknownType; } @@ -13131,7 +13194,7 @@ var ts; return returnType; } } - if (container && container.kind === 127) { + if (container && container.kind === 128) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { @@ -13169,7 +13232,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 129) { + if (declaration.kind === 130) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -13184,7 +13247,7 @@ var ts; function getContextualTypeForReturnExpression(node) { var func = ts.getContainingFunction(node); if (func) { - if (func.type || func.kind === 135 || func.kind === 136 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 137))) { + if (func.type || func.kind === 136 || func.kind === 137 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 138))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(func)); } var signature = getContextualSignatureForFunctionLikeDeclaration(func); @@ -13204,7 +13267,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 159) { + if (template.parent.kind === 160) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -13312,32 +13375,32 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 198: - case 129: + case 199: + case 130: + case 133: case 132: - case 131: - case 152: - return getContextualTypeForInitializerExpression(node); - case 163: - case 191: - return getContextualTypeForReturnExpression(node); - case 157: - case 158: - return getContextualTypeForArgument(parent, node); - case 160: - return getTypeFromTypeNode(parent.type); - case 169: - return getContextualTypeForBinaryOperand(node); - case 224: - return getContextualTypeForObjectLiteralElement(parent); case 153: - return getContextualTypeForElementExpression(node); - case 170: - return getContextualTypeForConditionalOperand(node); - case 176: - ts.Debug.assert(parent.parent.kind === 171); - return getContextualTypeForSubstitutionExpression(parent.parent, node); + return getContextualTypeForInitializerExpression(node); + case 164: + case 192: + return getContextualTypeForReturnExpression(node); + case 158: + case 159: + return getContextualTypeForArgument(parent, node); case 161: + return getTypeFromTypeNode(parent.type); + case 170: + return getContextualTypeForBinaryOperand(node); + case 225: + return getContextualTypeForObjectLiteralElement(parent); + case 154: + return getContextualTypeForElementExpression(node); + case 171: + return getContextualTypeForConditionalOperand(node); + case 178: + ts.Debug.assert(parent.parent.kind === 172); + return getContextualTypeForSubstitutionExpression(parent.parent, node); + case 162: return getContextualType(parent); } return undefined; @@ -13352,13 +13415,13 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 162 || node.kind === 163; + return node.kind === 163 || node.kind === 164; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) ? getContextualSignature(node) : undefined; } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 134 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 135 || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); @@ -13402,13 +13465,13 @@ var ts; } function isAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 169 && parent.operatorToken.kind === 53 && parent.left === node) { + if (parent.kind === 170 && parent.operatorToken.kind === 53 && parent.left === node) { return true; } - if (parent.kind === 224) { + if (parent.kind === 225) { return isAssignmentTarget(parent.parent); } - if (parent.kind === 153) { + if (parent.kind === 154) { return isAssignmentTarget(parent); } return false; @@ -13427,7 +13490,7 @@ var ts; var inDestructuringPattern = isAssignmentTarget(node); for (var _i = 0; _i < elements.length; _i++) { var e = elements[_i]; - if (inDestructuringPattern && e.kind === 173) { + if (inDestructuringPattern && e.kind === 174) { var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1) || (languageVersion >= 2 ? checkIteratedType(restArrayType, undefined) : undefined); @@ -13439,7 +13502,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 173; + hasSpreadElement = hasSpreadElement || e.kind === 174; } if (!hasSpreadElement) { var contextualType = getContextualType(node); @@ -13450,7 +13513,7 @@ var ts; return createArrayType(getUnionType(elementTypes)); } function isNumericName(name) { - return name.kind === 127 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 128 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { return allConstituentTypesHaveKind(checkComputedPropertyName(name), 1 | 132); @@ -13480,18 +13543,18 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 224 || - memberDecl.kind === 225 || + if (memberDecl.kind === 225 || + memberDecl.kind === 226 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 224) { + if (memberDecl.kind === 225) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 134) { + else if (memberDecl.kind === 135) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 225); + ts.Debug.assert(memberDecl.kind === 226); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; @@ -13506,7 +13569,7 @@ var ts; member = prop; } else { - ts.Debug.assert(memberDecl.kind === 136 || memberDecl.kind === 137); + ts.Debug.assert(memberDecl.kind === 137 || memberDecl.kind === 138); checkAccessorDeclaration(memberDecl); } if (!ts.hasDynamicName(memberDecl)) { @@ -13539,7 +13602,7 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 132; + return s.valueDeclaration ? s.valueDeclaration.kind : 133; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 16 | 128 : 0; @@ -13549,7 +13612,7 @@ var ts; if (!(flags & (32 | 64))) { return; } - var enclosingClassDeclaration = ts.getAncestor(node, 201); + var enclosingClassDeclaration = ts.getAncestor(node, 202); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); if (flags & 32) { @@ -13596,7 +13659,7 @@ var ts; } getNodeLinks(node).resolvedSymbol = prop; if (prop.parent && prop.parent.flags & 32) { - if (left.kind === 91 && getDeclarationKindFromSymbol(prop) !== 134) { + if (left.kind === 91 && getDeclarationKindFromSymbol(prop) !== 135) { error(right, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); } else { @@ -13608,14 +13671,14 @@ var ts; return anyType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 155 + var left = node.kind === 156 ? 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 === 91 && getDeclarationKindFromSymbol(prop) !== 134) { + if (left.kind === 91 && getDeclarationKindFromSymbol(prop) !== 135) { return false; } else { @@ -13630,7 +13693,7 @@ var ts; function checkIndexedAccess(node) { if (!node.argumentExpression) { var sourceFile = getSourceFile(node); - if (node.parent.kind === 158 && node.parent.expression === node) { + if (node.parent.kind === 159 && 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); @@ -13726,7 +13789,7 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 159) { + if (node.kind === 160) { checkExpression(node.template); } else { @@ -13779,7 +13842,7 @@ var ts; } function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { - if (args[i].kind === 173) { + if (args[i].kind === 174) { return i; } } @@ -13789,11 +13852,11 @@ var ts; var adjustedArgCount; var typeArguments; var callIsIncomplete; - if (node.kind === 159) { + if (node.kind === 160) { var tagExpression = node; adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 171) { + if (tagExpression.template.kind === 172) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -13808,7 +13871,7 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 158); + ts.Debug.assert(callExpression.kind === 159); return signature.minArgumentCount === 0; } adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; @@ -13860,10 +13923,10 @@ var ts; } for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 175) { + if (arg.kind !== 176) { var paramType = getTypeAtPosition(signature, i); var argType = void 0; - if (i === 0 && args[i].parent.kind === 159) { + if (i === 0 && args[i].parent.kind === 160) { argType = globalTemplateStringsArrayType; } else { @@ -13903,9 +13966,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 !== 175) { + if (arg.kind !== 176) { var paramType = getTypeAtPosition(signature, i); - var argType = i === 0 && node.kind === 159 + var argType = i === 0 && node.kind === 160 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) @@ -13919,10 +13982,10 @@ var ts; } function getEffectiveCallArguments(node) { var args; - if (node.kind === 159) { + if (node.kind === 160) { var template = node.template; args = [template]; - if (template.kind === 171) { + if (template.kind === 172) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); @@ -13935,7 +13998,7 @@ var ts; } function getEffectiveTypeArguments(callExpression) { if (callExpression.expression.kind === 91) { - var containingClass = ts.getAncestor(callExpression, 201); + var containingClass = ts.getAncestor(callExpression, 202); var baseClassTypeNode = containingClass && ts.getClassExtendsHeritageClauseElement(containingClass); return baseClassTypeNode && baseClassTypeNode.typeArguments; } @@ -13944,7 +14007,7 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray) { - var isTaggedTemplate = node.kind === 159; + var isTaggedTemplate = node.kind === 160; var typeArguments; if (!isTaggedTemplate) { typeArguments = getEffectiveTypeArguments(node); @@ -14154,13 +14217,13 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 157) { + if (node.kind === 158) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 158) { + else if (node.kind === 159) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 159) { + else if (node.kind === 160) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } else { @@ -14175,12 +14238,12 @@ var ts; if (node.expression.kind === 91) { return voidType; } - if (node.kind === 158) { + if (node.kind === 159) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 135 && - declaration.kind !== 139 && - declaration.kind !== 143) { + declaration.kind !== 136 && + declaration.kind !== 140 && + declaration.kind !== 144) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -14227,7 +14290,7 @@ var ts; return unknownType; } var type; - if (func.body.kind !== 179) { + if (func.body.kind !== 180) { type = checkExpressionCached(func.body, contextualMapper); } else { @@ -14265,7 +14328,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 195); + return (body.statements.length === 1) && (body.statements[0].kind === 196); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -14274,7 +14337,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 179) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 180) { return; } var bodyBlock = func.body; @@ -14287,9 +14350,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 !== 134 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 135 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarDeclarationNameInStrictMode(node) || checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 162) { + if (!hasGrammarError && node.kind === 163) { checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { @@ -14317,19 +14380,19 @@ var ts; checkSignatureDeclaration(node); } } - if (produceDiagnostics && node.kind !== 134 && node.kind !== 133) { + if (produceDiagnostics && node.kind !== 135 && node.kind !== 134) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 134 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 135 || ts.isObjectLiteralMethod(node)); if (node.type && !node.asteriskToken) { checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); } if (node.body) { - if (node.body.kind === 179) { + if (node.body.kind === 180) { checkSourceElement(node.body); } else { @@ -14359,13 +14422,13 @@ var ts; var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; } - case 155: { + case 156: { var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; } - case 156: + case 157: return true; - case 161: + case 162: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -14374,11 +14437,11 @@ var ts; function isConstVariableReference(n) { switch (n.kind) { case 65: - case 155: { + case 156: { var symbol = findSymbol(n); return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; } - case 156: { + case 157: { var index = n.argumentExpression; var symbol = findSymbol(n.expression); if (symbol && index && index.kind === 8) { @@ -14388,7 +14451,7 @@ var ts; } return false; } - case 161: + case 162: return isConstVariableReference(n.expression); default: return false; @@ -14513,7 +14576,7 @@ var ts; var properties = node.properties; for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 224 || p.kind === 225) { + if (p.kind === 225 || p.kind === 226) { var name_8 = p.name; var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name_8.text) || @@ -14537,8 +14600,8 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 175) { - if (e.kind !== 173) { + if (e.kind !== 176) { + if (e.kind !== 174) { var propName = "" + i; var type = sourceType.flags & 1 ? sourceType : isTupleLikeType(sourceType) @@ -14562,7 +14625,7 @@ var ts; } else { var restExpression = e.expression; - if (restExpression.kind === 169 && restExpression.operatorToken.kind === 53) { + if (restExpression.kind === 170 && restExpression.operatorToken.kind === 53) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -14575,14 +14638,14 @@ var ts; return sourceType; } function checkDestructuringAssignment(target, sourceType, contextualMapper) { - if (target.kind === 169 && target.operatorToken.kind === 53) { + if (target.kind === 170 && target.operatorToken.kind === 53) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 154) { + if (target.kind === 155) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 153) { + if (target.kind === 154) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -14599,7 +14662,7 @@ var ts; checkGrammarEvalOrArgumentsInStrictMode(node, node.left); } var operator = node.operatorToken.kind; - if (operator === 53 && (node.left.kind === 154 || node.left.kind === 153)) { + if (operator === 53 && (node.left.kind === 155 || node.left.kind === 154)) { return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); } var leftType = checkExpression(node.left, contextualMapper); @@ -14773,14 +14836,14 @@ var ts; return links.resolvedType; } function checkPropertyAssignment(node, contextualMapper) { - if (node.name.kind === 127) { + if (node.name.kind === 128) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); - if (node.name.kind === 127) { + if (node.name.kind === 128) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -14807,7 +14870,7 @@ var ts; } function checkExpressionOrQualifiedName(node, contextualMapper) { var type; - if (node.kind == 126) { + if (node.kind == 127) { type = checkQualifiedName(node); } else { @@ -14815,9 +14878,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 155 && node.parent.expression === node) || - (node.parent.kind === 156 && node.parent.expression === node) || - ((node.kind === 65 || node.kind === 126) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 156 && node.parent.expression === node) || + (node.parent.kind === 157 && node.parent.expression === node) || + ((node.kind === 65 || node.kind === 127) && 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); } @@ -14843,54 +14906,54 @@ var ts; return booleanType; case 7: return checkNumericLiteral(node); - case 171: + case 172: return checkTemplateExpression(node); case 8: case 10: return stringType; case 9: return globalRegExpType; - case 153: - return checkArrayLiteral(node, contextualMapper); case 154: - return checkObjectLiteral(node, contextualMapper); + return checkArrayLiteral(node, contextualMapper); case 155: - return checkPropertyAccessExpression(node); + return checkObjectLiteral(node, contextualMapper); case 156: - return checkIndexedAccess(node); + return checkPropertyAccessExpression(node); case 157: + return checkIndexedAccess(node); case 158: - return checkCallExpression(node); case 159: - return checkTaggedTemplateExpression(node); + return checkCallExpression(node); case 160: - return checkTypeAssertion(node); + return checkTaggedTemplateExpression(node); case 161: - return checkExpression(node.expression, contextualMapper); - case 174: - return checkClassExpression(node); + return checkTypeAssertion(node); case 162: - case 163: - return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 165: - return checkTypeOfExpression(node); - case 164: - return checkDeleteExpression(node); - case 166: - return checkVoidExpression(node); - case 167: - return checkPrefixUnaryExpression(node); - case 168: - return checkPostfixUnaryExpression(node); - case 169: - return checkBinaryExpression(node, contextualMapper); - case 170: - return checkConditionalExpression(node, contextualMapper); - case 173: - return checkSpreadElementExpression(node, contextualMapper); + return checkExpression(node.expression, contextualMapper); case 175: + return checkClassExpression(node); + case 163: + case 164: + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); + case 166: + return checkTypeOfExpression(node); + case 165: + return checkDeleteExpression(node); + case 167: + return checkVoidExpression(node); + case 168: + return checkPrefixUnaryExpression(node); + case 169: + return checkPostfixUnaryExpression(node); + case 170: + return checkBinaryExpression(node, contextualMapper); + case 171: + return checkConditionalExpression(node, contextualMapper); + case 174: + return checkSpreadElementExpression(node, contextualMapper); + case 176: return undefinedType; - case 172: + case 173: checkYieldExpression(node); return unknownType; } @@ -14919,7 +14982,7 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 112) { func = ts.getContainingFunction(node); - if (!(func.kind === 135 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 136 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -14931,12 +14994,12 @@ var ts; } } function checkSignatureDeclaration(node) { - if (node.kind === 140) { + if (node.kind === 141) { checkGrammarIndexSignature(node); } - else if (node.kind === 142 || node.kind === 200 || node.kind === 143 || - node.kind === 138 || node.kind === 135 || - node.kind === 139) { + else if (node.kind === 143 || node.kind === 201 || node.kind === 144 || + node.kind === 139 || node.kind === 136 || + node.kind === 140) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -14948,10 +15011,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 139: + case 140: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 138: + case 139: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -14960,7 +15023,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 202) { + if (node.kind === 203) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -14975,7 +15038,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 121: + case 122: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -14983,7 +15046,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 119: + case 120: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -15020,17 +15083,17 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 157 && n.expression.kind === 91; + return n.kind === 158 && n.expression.kind === 91; } function containsSuperCall(n) { if (isSuperCallExpression(n)) { return true; } switch (n.kind) { - case 162: - case 200: case 163: - case 154: return false; + case 201: + case 164: + case 155: return false; default: return ts.forEachChild(n, containsSuperCall); } } @@ -15038,12 +15101,12 @@ var ts; if (n.kind === 93) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 162 && n.kind !== 200) { + else if (n.kind !== 163 && n.kind !== 201) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 132 && + return n.kind === 133 && !(n.flags & 128) && !!n.initializer; } @@ -15053,7 +15116,7 @@ var ts; 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 !== 182 || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 183 || !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 { @@ -15069,13 +15132,13 @@ var ts; function checkAccessorDeclaration(node) { if (produceDiagnostics) { checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 136) { + if (node.kind === 137) { 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 === 136 ? 137 : 136; + var otherKind = node.kind === 137 ? 138 : 137; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 112) !== (otherAccessor.flags & 112))) { @@ -15099,15 +15162,15 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeReferenceInStrictMode(node.typeName); - return checkTypeReferenceOrHeritageClauseElement(node); + return checkTypeReferenceOrExpressionWithTypeArguments(node); } - function checkHeritageClauseElement(node) { - checkGrammarHeritageClauseElementInStrictMode(node.expression); - return checkTypeReferenceOrHeritageClauseElement(node); + function checkExpressionWithTypeArguments(node) { + checkGrammarExpressionWithTypeArgumentsInStrictMode(node.expression); + return checkTypeReferenceOrExpressionWithTypeArguments(node); } - function checkTypeReferenceOrHeritageClauseElement(node) { + function checkTypeReferenceOrExpressionWithTypeArguments(node) { checkGrammarTypeArguments(node, node.typeArguments); - var type = getTypeFromTypeReferenceOrHeritageClauseElement(node); + var type = getTypeFromTypeReferenceOrExpressionWithTypeArguments(node); if (type !== unknownType && node.typeArguments) { var len = node.typeArguments.length; for (var i = 0; i < len; i++) { @@ -15160,9 +15223,9 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 202) { - ts.Debug.assert(signatureDeclarationNode.kind === 138 || signatureDeclarationNode.kind === 139); - var signatureKind = signatureDeclarationNode.kind === 138 ? 0 : 1; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 203) { + ts.Debug.assert(signatureDeclarationNode.kind === 139 || signatureDeclarationNode.kind === 140); + var signatureKind = signatureDeclarationNode.kind === 139 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -15180,7 +15243,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 202 && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 203 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; } @@ -15253,7 +15316,7 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 134 || node.kind === 133); + ts.Debug.assert(node.kind === 135 || node.kind === 134); 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_1, diagnostic); @@ -15280,11 +15343,11 @@ var ts; var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 202 || node.parent.kind === 145 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 203 || node.parent.kind === 146 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 200 || node.kind === 134 || node.kind === 133 || node.kind === 135) { + if (node.kind === 201 || node.kind === 135 || node.kind === 134 || node.kind === 136) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -15381,16 +15444,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 202: + case 203: return 2097152; - case 205: + case 206: return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 201: - case 204: + case 202: + case 205: return 2097152 | 1048576; - case 208: + case 209: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -15404,29 +15467,29 @@ var ts; var expression = node.expression; var exprType = checkExpression(expression); switch (node.parent.kind) { - case 201: + case 202: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); var classDecoratorType = instantiateSingleCallFunctionType(getGlobalClassDecoratorType(), [classConstructorType]); checkTypeAssignableTo(exprType, classDecoratorType, node); break; - case 132: + case 133: checkTypeAssignableTo(exprType, getGlobalPropertyDecoratorType(), node); break; - case 134: - case 136: + case 135: case 137: + case 138: var methodType = getTypeOfNode(node.parent); var methodDecoratorType = instantiateSingleCallFunctionType(getGlobalMethodDecoratorType(), [methodType]); checkTypeAssignableTo(exprType, methodDecoratorType, node); break; - case 129: + case 130: checkTypeAssignableTo(exprType, getGlobalParameterDecoratorType(), node); break; } } function checkTypeNodeAsExpression(node) { - if (node && node.kind === 141) { + if (node && node.kind === 142) { var type = getTypeFromTypeNode(node); var shouldCheckIfUnknownType = type === unknownType && compilerOptions.separateCompilation; if (!type || (!shouldCheckIfUnknownType && type.flags & (1048703 | 132 | 258))) { @@ -15439,19 +15502,19 @@ var ts; } function checkTypeAnnotationAsExpression(node) { switch (node.kind) { - case 132: + case 133: checkTypeNodeAsExpression(node.type); break; - case 129: + case 130: checkTypeNodeAsExpression(node.type); break; - case 134: - checkTypeNodeAsExpression(node.type); - break; - case 136: + case 135: checkTypeNodeAsExpression(node.type); break; case 137: + checkTypeNodeAsExpression(node.type); + break; + case 138: checkTypeNodeAsExpression(getSetAccessorTypeAnnotationNode(node)); break; } @@ -15471,24 +15534,24 @@ var ts; } if (compilerOptions.emitDecoratorMetadata) { switch (node.kind) { - case 201: + case 202: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 134: + case 135: checkParameterTypeAnnotationsAsExpressions(node); + case 138: case 137: - case 136: - case 132: - case 129: + case 133: + case 130: checkTypeAnnotationAsExpression(node); break; } } emitDecorate = true; - if (node.kind === 129) { + if (node.kind === 130) { emitParam = true; } ts.forEach(node.decorators, checkDecorator); @@ -15508,7 +15571,7 @@ var ts; checkGrammarDeclarationNameInStrictMode(node); checkDecorators(node); checkSignatureDeclaration(node); - if (node.name && node.name.kind === 127) { + if (node.name && node.name.kind === 128) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { @@ -15533,11 +15596,11 @@ var ts; } } function checkBlock(node) { - if (node.kind === 179) { + if (node.kind === 180) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 206) { + if (ts.isFunctionBlock(node) || node.kind === 207) { checkFunctionExpressionBodies(node); } } @@ -15555,19 +15618,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 132 || - node.kind === 131 || + if (node.kind === 133 || + node.kind === 132 || + node.kind === 135 || node.kind === 134 || - node.kind === 133 || - node.kind === 136 || - node.kind === 137) { + node.kind === 137 || + node.kind === 138) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = getRootDeclaration(node); - if (root.kind === 129 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 130 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -15597,7 +15660,7 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = ts.getAncestor(node, 201); + var enclosingClass = ts.getAncestor(node, 202); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } @@ -15615,12 +15678,12 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 205 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 206 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 227 && 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)); + if (parent.kind === 228 && ts.isExternalModule(parent)) { + error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } function checkVarDeclaredNamesNotShadowed(node) { @@ -15630,7 +15693,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || isParameterDeclaration(node)) { return; } - if (node.kind === 198 && !node.initializer) { + if (node.kind === 199 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -15640,15 +15703,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 199); - var container = varDeclList.parent.kind === 180 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 200); + var container = varDeclList.parent.kind === 181 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 179 && ts.isFunctionLike(container.parent) || + (container.kind === 180 && ts.isFunctionLike(container.parent) || + container.kind === 207 || container.kind === 206 || - container.kind === 205 || - container.kind === 227); + container.kind === 228); if (!namesShareScope) { var name_9 = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_9, name_9); @@ -15658,13 +15721,13 @@ var ts; } } function isParameterDeclaration(node) { - while (node.kind === 152) { + while (node.kind === 153) { node = node.parent.parent; } - return node.kind === 129; + return node.kind === 130; } function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind !== 129) { + if (getRootDeclaration(node).kind !== 130) { return; } var func = ts.getContainingFunction(node); @@ -15673,7 +15736,7 @@ var ts; if (n.kind === 65) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 129) { + if (referencedSymbol.valueDeclaration.kind === 130) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -15694,7 +15757,7 @@ var ts; checkGrammarDeclarationNameInStrictMode(node); checkDecorators(node); checkSourceElement(node.type); - if (node.name.kind === 127) { + if (node.name.kind === 128) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); @@ -15703,7 +15766,7 @@ var ts; if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && getRootDeclaration(node).kind === 129 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && getRootDeclaration(node).kind === 130 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -15731,9 +15794,9 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); } } - if (node.kind !== 132 && node.kind !== 131) { + if (node.kind !== 133 && node.kind !== 132) { checkExportsOnMergedDeclarations(node); - if (node.kind === 198 || node.kind === 152) { + if (node.kind === 199 || node.kind === 153) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -15762,7 +15825,7 @@ var ts; } function inBlockOrObjectLiteralExpression(node) { while (node) { - if (node.kind === 179 || node.kind === 154) { + if (node.kind === 180 || node.kind === 155) { return true; } node = node.parent; @@ -15790,12 +15853,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind == 199) { + if (node.initializer && node.initializer.kind == 200) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 199) { + if (node.initializer.kind === 200) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -15810,13 +15873,13 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 199) { + if (node.initializer.kind === 200) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); - if (varExpr.kind === 153 || varExpr.kind === 154) { + if (varExpr.kind === 154 || varExpr.kind === 155) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { @@ -15831,7 +15894,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 199) { + if (node.initializer.kind === 200) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -15841,7 +15904,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 153 || varExpr.kind === 154) { + if (varExpr.kind === 154 || varExpr.kind === 155) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!allConstituentTypesHaveKind(leftType, 1 | 258)) { @@ -16002,7 +16065,7 @@ var ts; checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 136 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 137))); + return !!(node.kind === 137 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 138))); } function checkReturnStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { @@ -16016,11 +16079,11 @@ var ts; if (func) { var returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); var exprType = checkExpressionCached(node.expression); - if (func.kind === 137) { + if (func.kind === 138) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } else { - if (func.kind === 135) { + if (func.kind === 136) { if (!isTypeAssignableTo(exprType, returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -16047,7 +16110,7 @@ var ts; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 221 && !hasDuplicateDefaultClause) { + if (clause.kind === 222 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -16059,7 +16122,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 220) { + if (produceDiagnostics && clause.kind === 221) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -16076,7 +16139,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 194 && current.label.text === node.label.text) { + if (current.kind === 195 && 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; @@ -16140,7 +16203,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 === 201) { + if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 202) { var classDeclaration = type.symbol.valueDeclaration; for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; @@ -16171,7 +16234,7 @@ var ts; return; } var errorNode; - if (prop.valueDeclaration.name.kind === 127 || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 128 || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -16222,7 +16285,7 @@ var ts; } function checkClassDeclaration(node) { checkGrammarDeclarationNameInStrictMode(node); - if (node.parent.kind !== 206 && node.parent.kind !== 227) { + if (node.parent.kind !== 207 && node.parent.kind !== 228) { grammarErrorOnNode(node, ts.Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration); } if (!node.name && !(node.flags & 256)) { @@ -16242,11 +16305,11 @@ var ts; var staticType = getTypeOfSymbol(symbol); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - if (!ts.isSupportedHeritageClauseElement(baseTypeNode)) { + if (!ts.isSupportedExpressionWithTypeArguments(baseTypeNode)) { error(baseTypeNode.expression, ts.Diagnostics.Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses); } emitExtends = emitExtends || !ts.isInAmbientContext(node); - checkHeritageClauseElement(baseTypeNode); + checkExpressionWithTypeArguments(baseTypeNode); } var baseTypes = getBaseTypes(type); if (baseTypes.length) { @@ -16267,12 +16330,12 @@ var ts; var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { ts.forEach(implementedTypeNodes, function (typeRefNode) { - if (!ts.isSupportedHeritageClauseElement(typeRefNode)) { + if (!ts.isSupportedExpressionWithTypeArguments(typeRefNode)) { error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); } - checkHeritageClauseElement(typeRefNode); + checkExpressionWithTypeArguments(typeRefNode); if (produceDiagnostics) { - var t = getTypeFromHeritageClauseElement(typeRefNode); + var t = getTypeFromTypeNode(typeRefNode); if (t !== unknownType) { var declaredType = (t.flags & 4096) ? t.target : t; if (declaredType.flags & (1024 | 2048)) { @@ -16352,7 +16415,7 @@ var ts; } } function isAccessor(kind) { - return kind === 136 || kind === 137; + return kind === 137 || kind === 138; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -16418,7 +16481,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 202); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 203); 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); @@ -16435,10 +16498,10 @@ var ts; } } ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) { - if (!ts.isSupportedHeritageClauseElement(heritageElement)) { + if (!ts.isSupportedExpressionWithTypeArguments(heritageElement)) { error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); } - checkHeritageClauseElement(heritageElement); + checkExpressionWithTypeArguments(heritageElement); }); ts.forEach(node.members, checkSourceElement); if (produceDiagnostics) { @@ -16459,7 +16522,7 @@ var ts; var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); ts.forEach(node.members, function (member) { - if (member.name.kind !== 127 && isNumericLiteralName(member.name.text)) { + if (member.name.kind !== 128 && isNumericLiteralName(member.name.text)) { error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); } var initializer = member.initializer; @@ -16495,7 +16558,7 @@ var ts; return evalConstant(initializer); function evalConstant(e) { switch (e.kind) { - case 167: + case 168: var value = evalConstant(e.operand); if (value === undefined) { return undefined; @@ -16506,7 +16569,7 @@ var ts; case 47: return ~value; } return undefined; - case 169: + case 170: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -16531,11 +16594,11 @@ var ts; return undefined; case 7: return +e.text; - case 161: + case 162: return evalConstant(e.expression); case 65: + case 157: case 156: - case 155: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType; @@ -16546,7 +16609,7 @@ var ts; } else { var expression; - if (e.kind === 156) { + if (e.kind === 157) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8) { return undefined; @@ -16563,7 +16626,7 @@ var ts; if (current.kind === 65) { break; } - else if (current.kind === 155) { + else if (current.kind === 156) { current = current.expression; } else { @@ -16620,7 +16683,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 204) { + if (declaration.kind !== 205) { return false; } var enumDeclaration = declaration; @@ -16643,8 +16706,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 201 || - (declaration.kind === 200 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 202 || + (declaration.kind === 201 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -16682,13 +16745,13 @@ var ts; var firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (firstNonAmbientClassOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(firstNonAmbientClassOrFunc)) { - error(node.name, ts.Diagnostics.A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged); + error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged); } else if (node.pos < firstNonAmbientClassOrFunc.pos) { - error(node.name, ts.Diagnostics.A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); + error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 201); + var mergedClass = ts.getDeclarationOfKind(symbol, 202); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 2048; @@ -16696,10 +16759,10 @@ var ts; } if (node.name.kind === 8) { if (!isGlobalSourceFile(node.parent)) { - error(node.name, ts.Diagnostics.Ambient_external_modules_cannot_be_nested_in_other_modules); + error(node.name, ts.Diagnostics.Ambient_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); + error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); } } } @@ -16707,10 +16770,10 @@ var ts; } function getFirstIdentifier(node) { while (true) { - if (node.kind === 126) { + if (node.kind === 127) { node = node.left; } - else if (node.kind === 155) { + else if (node.kind === 156) { node = node.expression; } else { @@ -16726,15 +16789,15 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 227 && !inAmbientExternalModule) { - error(moduleName, node.kind === 215 ? - ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : - ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + var inAmbientExternalModule = node.parent.kind === 207 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 228 && !inAmbientExternalModule) { + error(moduleName, node.kind === 216 ? + ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : + ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; } if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { - error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); + error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); return false; } return true; @@ -16747,7 +16810,7 @@ var ts; (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 217 ? + var message = node.kind === 218 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -16770,7 +16833,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 211) { + if (importClause.namedBindings.kind === 212) { checkImportBinding(importClause.namedBindings); } else { @@ -16815,15 +16878,15 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 227 && !inAmbientExternalModule) { - error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module); + var inAmbientExternalModule = node.parent.kind === 207 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 228 && !inAmbientExternalModule) { + error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } else { var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); if (moduleSymbol && moduleSymbol.exports["export="]) { - error(node.moduleSpecifier, ts.Diagnostics.External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); + error(node.moduleSpecifier, ts.Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); } } } @@ -16835,9 +16898,9 @@ var ts; } } function checkExportAssignment(node) { - var container = node.parent.kind === 227 ? node.parent : node.parent.parent; - if (container.kind === 205 && container.name.kind === 65) { - error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); + var container = node.parent.kind === 228 ? node.parent : node.parent.parent; + if (container.kind === 206 && container.name.kind === 65) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 499)) { @@ -16850,15 +16913,20 @@ var ts; checkExpressionCached(node.expression); } checkExternalModuleExports(container); - if (node.isExportEquals && languageVersion >= 2) { - grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead); + if (node.isExportEquals && !ts.isInAmbientContext(node)) { + if (languageVersion >= 2) { + grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead); + } + else if (compilerOptions.module === 4) { + grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); + } } } function getModuleStatements(node) { - if (node.kind === 227) { + if (node.kind === 228) { return node.statements; } - if (node.kind === 205 && node.body.kind === 206) { + if (node.kind === 206 && node.body.kind === 207) { return node.body.statements; } return emptyArray; @@ -16887,163 +16955,162 @@ var ts; if (!node) return; switch (node.kind) { - case 128: - return checkTypeParameter(node); case 129: + return checkTypeParameter(node); + case 130: return checkParameter(node); + case 133: case 132: - case 131: return checkPropertyDeclaration(node); - case 142: case 143: - case 138: + case 144: case 139: - return checkSignatureDeclaration(node); case 140: return checkSignatureDeclaration(node); - case 134: - case 133: - return checkMethodDeclaration(node); - case 135: - return checkConstructorDeclaration(node); - case 136: - case 137: - return checkAccessorDeclaration(node); case 141: + return checkSignatureDeclaration(node); + case 135: + case 134: + return checkMethodDeclaration(node); + case 136: + return checkConstructorDeclaration(node); + case 137: + case 138: + return checkAccessorDeclaration(node); + case 142: return checkTypeReferenceNode(node); - case 144: - return checkTypeQuery(node); case 145: - return checkTypeLiteral(node); + return checkTypeQuery(node); case 146: - return checkArrayType(node); + return checkTypeLiteral(node); case 147: - return checkTupleType(node); + return checkArrayType(node); case 148: - return checkUnionType(node); + return checkTupleType(node); case 149: + return checkUnionType(node); + case 150: return checkSourceElement(node.type); - case 200: - return checkFunctionDeclaration(node); - case 179: - case 206: - return checkBlock(node); - case 180: - return checkVariableStatement(node); - case 182: - return checkExpressionStatement(node); - case 183: - return checkIfStatement(node); - case 184: - return checkDoStatement(node); - case 185: - return checkWhileStatement(node); - case 186: - return checkForStatement(node); - case 187: - return checkForInStatement(node); - case 188: - return checkForOfStatement(node); - case 189: - case 190: - return checkBreakOrContinueStatement(node); - case 191: - return checkReturnStatement(node); - case 192: - return checkWithStatement(node); - case 193: - return checkSwitchStatement(node); - case 194: - return checkLabeledStatement(node); - case 195: - return checkThrowStatement(node); - case 196: - return checkTryStatement(node); - case 198: - return checkVariableDeclaration(node); - case 152: - return checkBindingElement(node); case 201: - return checkClassDeclaration(node); - case 202: - return checkInterfaceDeclaration(node); - case 203: - return checkTypeAliasDeclaration(node); - case 204: - return checkEnumDeclaration(node); - case 205: - return checkModuleDeclaration(node); - case 209: - return checkImportDeclaration(node); - case 208: - return checkImportEqualsDeclaration(node); - case 215: - return checkExportDeclaration(node); - case 214: - return checkExportAssignment(node); + return checkFunctionDeclaration(node); + case 180: + case 207: + return checkBlock(node); case 181: - checkGrammarStatementInAmbientContext(node); - return; + return checkVariableStatement(node); + case 183: + return checkExpressionStatement(node); + case 184: + return checkIfStatement(node); + case 185: + return checkDoStatement(node); + case 186: + return checkWhileStatement(node); + case 187: + return checkForStatement(node); + case 188: + return checkForInStatement(node); + case 189: + return checkForOfStatement(node); + case 190: + case 191: + return checkBreakOrContinueStatement(node); + case 192: + return checkReturnStatement(node); + case 193: + return checkWithStatement(node); + case 194: + return checkSwitchStatement(node); + case 195: + return checkLabeledStatement(node); + case 196: + return checkThrowStatement(node); case 197: + return checkTryStatement(node); + case 199: + return checkVariableDeclaration(node); + case 153: + return checkBindingElement(node); + case 202: + return checkClassDeclaration(node); + case 203: + return checkInterfaceDeclaration(node); + case 204: + return checkTypeAliasDeclaration(node); + case 205: + return checkEnumDeclaration(node); + case 206: + return checkModuleDeclaration(node); + case 210: + return checkImportDeclaration(node); + case 209: + return checkImportEqualsDeclaration(node); + case 216: + return checkExportDeclaration(node); + case 215: + return checkExportAssignment(node); + case 182: checkGrammarStatementInAmbientContext(node); return; - case 218: + case 198: + checkGrammarStatementInAmbientContext(node); + return; + case 219: return checkMissingDeclaration(node); } } function checkFunctionExpressionBodies(node) { switch (node.kind) { - case 162: case 163: + case 164: ts.forEach(node.parameters, checkFunctionExpressionBodies); checkFunctionExpressionOrObjectLiteralMethodBody(node); break; + case 135: case 134: - case 133: ts.forEach(node.parameters, checkFunctionExpressionBodies); if (ts.isObjectLiteralMethod(node)) { checkFunctionExpressionOrObjectLiteralMethodBody(node); } break; - case 135: case 136: case 137: - case 200: + case 138: + case 201: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 192: + case 193: checkFunctionExpressionBodies(node.expression); break; - case 129: + case 130: + case 133: case 132: - case 131: - case 150: case 151: case 152: case 153: case 154: - case 224: case 155: + case 225: case 156: case 157: case 158: case 159: - case 171: - case 176: case 160: + case 172: + case 178: case 161: - case 165: + case 162: case 166: - case 164: case 167: + case 165: case 168: case 169: case 170: - case 173: - case 179: - case 206: + case 171: + case 174: case 180: - case 182: + case 207: + case 181: case 183: case 184: case 185: @@ -17053,21 +17120,22 @@ var ts; case 189: case 190: case 191: - case 193: - case 207: - case 220: - case 221: + case 192: case 194: + case 208: + case 221: + case 222: case 195: case 196: - case 223: - case 198: + case 197: + case 224: case 199: - case 201: - case 204: - case 226: - case 214: + case 200: + case 202: + case 205: case 227: + case 215: + case 228: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -17127,7 +17195,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 192 && node.parent.statement === node) { + if (node.parent.kind === 193 && node.parent.statement === node) { return true; } node = node.parent; @@ -17149,23 +17217,23 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 227: + case 228: if (!ts.isExternalModule(location)) { break; } - case 205: + case 206: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 204: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 201: case 202: + case 203: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; - case 162: + case 163: if (location.name) { copySymbol(location.symbol, meaning); } @@ -17201,22 +17269,22 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 227: + case 228: if (!ts.isExternalModule(location)) break; - case 205: + case 206: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 204: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 201: case 202: + case 203: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; - case 162: + case 163: if (location.name) { copySymbol(location.symbol, meaning); } @@ -17235,104 +17303,104 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 128: - case 201: + case 129: case 202: case 203: case 204: + case 205: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 126) { + while (node.parent && node.parent.kind === 127) { node = node.parent; } - return node.parent && node.parent.kind === 141; + return node.parent && node.parent.kind === 142; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 155) { + while (node.parent && node.parent.kind === 156) { node = node.parent; } return node.parent && node.parent.kind === 177; } function isTypeNode(node) { - if (141 <= node.kind && node.kind <= 149) { + if (142 <= node.kind && node.kind <= 150) { return true; } switch (node.kind) { case 112: - case 119: - case 121: - case 113: + case 120: case 122: + case 113: + case 123: return true; case 99: - return node.parent.kind !== 166; + return node.parent.kind !== 167; case 8: - return node.parent.kind === 129; + return node.parent.kind === 130; case 177: return true; case 65: - if (node.parent.kind === 126 && node.parent.right === node) { + if (node.parent.kind === 127 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 155 && node.parent.name === node) { + else if (node.parent.kind === 156 && node.parent.name === node) { node = node.parent; } - case 126: - case 155: - ts.Debug.assert(node.kind === 65 || node.kind === 126 || node.kind === 155, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + case 127: + case 156: + ts.Debug.assert(node.kind === 65 || node.kind === 127 || node.kind === 156, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); var parent_5 = node.parent; - if (parent_5.kind === 144) { + if (parent_5.kind === 145) { return false; } - if (141 <= parent_5.kind && parent_5.kind <= 149) { + if (142 <= parent_5.kind && parent_5.kind <= 150) { return true; } switch (parent_5.kind) { case 177: return true; - case 128: - return node === parent_5.constraint; - case 132: - case 131: case 129: - case 198: + return node === parent_5.constraint; + case 133: + case 132: + case 130: + case 199: return node === parent_5.type; - case 200: - case 162: + case 201: case 163: + case 164: + case 136: case 135: case 134: - case 133: - case 136: case 137: - return node === parent_5.type; case 138: + return node === parent_5.type; case 139: case 140: + case 141: return node === parent_5.type; - case 160: + case 161: return node === parent_5.type; - case 157: case 158: - return parent_5.typeArguments && ts.indexOf(parent_5.typeArguments, node) >= 0; case 159: + return parent_5.typeArguments && ts.indexOf(parent_5.typeArguments, node) >= 0; + case 160: return false; } } return false; } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 126) { + while (nodeOnRightSide.parent.kind === 127) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 208) { + if (nodeOnRightSide.parent.kind === 209) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 214) { + if (nodeOnRightSide.parent.kind === 215) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -17344,10 +17412,10 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 214) { + if (entityName.parent.kind === 215) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } - if (entityName.kind !== 155) { + if (entityName.kind !== 156) { if (isInRightSideOfImportOrExportAssignment(entityName)) { return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } @@ -17368,14 +17436,14 @@ var ts; var meaning = 107455 | 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 155) { + else if (entityName.kind === 156) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 126) { + else if (entityName.kind === 127) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -17384,7 +17452,7 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 141 ? 793056 : 1536; + var meaning = entityName.parent.kind === 142 ? 793056 : 1536; meaning |= 8388608; return resolveEntityName(entityName, meaning); } @@ -17398,14 +17466,14 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 65 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 214 + return node.parent.kind === 215 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } switch (node.kind) { case 65: - case 155: - case 126: + case 156: + case 127: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 93: case 91: @@ -17413,7 +17481,7 @@ var ts; return type.symbol; case 114: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 135) { + if (constructorDeclaration && constructorDeclaration.kind === 136) { return constructorDeclaration.parent.symbol; } return undefined; @@ -17421,12 +17489,12 @@ var ts; var moduleName; if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 209 || node.parent.kind === 215) && + ((node.parent.kind === 210 || node.parent.kind === 216) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 7: - if (node.parent.kind == 156 && node.parent.argumentExpression === node) { + if (node.parent.kind == 157 && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -17440,7 +17508,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 225) { + if (location && location.kind === 226) { return resolveEntityName(location.name, 107455); } return undefined; @@ -17514,7 +17582,7 @@ var ts; return [symbol]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 227; + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 228; } function getAliasNameSubstitution(symbol, getGeneratedNameForNode) { if (languageVersion >= 2) { @@ -17522,7 +17590,7 @@ var ts; } var node = getDeclarationOfAliasSymbol(symbol); if (node) { - if (node.kind === 210) { + if (node.kind === 211) { var defaultKeyword; if (languageVersion === 0) { defaultKeyword = "[\"default\"]"; @@ -17532,7 +17600,7 @@ var ts; } return getGeneratedNameForNode(node.parent) + defaultKeyword; } - if (node.kind === 213) { + if (node.kind === 214) { var moduleName = getGeneratedNameForNode(node.parent.parent.parent); var propertyName = node.propertyName || node.name; return moduleName + "." + ts.unescapeIdentifier(propertyName.text); @@ -17541,7 +17609,7 @@ var ts; } function getExportNameSubstitution(symbol, location, getGeneratedNameForNode) { if (isExternalModuleSymbol(symbol.parent)) { - if (languageVersion >= 2) { + if (languageVersion >= 2 || compilerOptions.module === 4) { return undefined; } return "exports." + ts.unescapeIdentifier(symbol.name); @@ -17549,7 +17617,7 @@ var ts; var node = location; var containerSymbol = getParentOfSymbol(symbol); while (node) { - if ((node.kind === 205 || node.kind === 204) && getSymbolOfNode(node) === containerSymbol) { + if ((node.kind === 206 || node.kind === 205) && getSymbolOfNode(node) === containerSymbol) { return getGeneratedNameForNode(node) + "." + ts.unescapeIdentifier(symbol.name); } node = node.parent; @@ -17572,22 +17640,22 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 208: - case 210: + case 209: case 211: - case 213: - case 217: + case 212: + case 214: + case 218: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 215: + case 216: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 214: + case 215: return node.expression && node.expression.kind === 65 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 227 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 228 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -17632,7 +17700,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 226) { + if (node.kind === 227) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -17663,7 +17731,7 @@ var ts; } } function serializeTypeReferenceNode(node, getGeneratedNameForNode) { - var type = getTypeFromTypeReference(node); + var type = getTypeFromTypeNode(node); if (type.flags & 16) { return "void 0"; } @@ -17700,26 +17768,26 @@ var ts; switch (node.kind) { case 99: return "void 0"; - case 149: + case 150: return serializeTypeNode(node.type, getGeneratedNameForNode); - case 142: case 143: + case 144: return "Function"; - case 146: case 147: + case 148: return "Array"; case 113: return "Boolean"; - case 121: + case 122: case 8: return "String"; - case 119: + case 120: return "Number"; - case 141: + case 142: return serializeTypeReferenceNode(node, getGeneratedNameForNode); - case 144: case 145: - case 148: + case 146: + case 149: case 112: break; default: @@ -17731,11 +17799,11 @@ var ts; } function serializeTypeOfNode(node, getGeneratedNameForNode) { switch (node.kind) { - case 201: return "Function"; - case 132: return serializeTypeNode(node.type, getGeneratedNameForNode); - case 129: return serializeTypeNode(node.type, getGeneratedNameForNode); - case 136: return serializeTypeNode(node.type, getGeneratedNameForNode); - case 137: return serializeTypeNode(getSetAccessorTypeAnnotationNode(node), getGeneratedNameForNode); + case 202: return "Function"; + case 133: return serializeTypeNode(node.type, getGeneratedNameForNode); + case 130: return serializeTypeNode(node.type, getGeneratedNameForNode); + case 137: return serializeTypeNode(node.type, getGeneratedNameForNode); + case 138: return serializeTypeNode(getSetAccessorTypeAnnotationNode(node), getGeneratedNameForNode); } if (ts.isFunctionLike(node)) { return "Function"; @@ -17745,7 +17813,7 @@ var ts; function serializeParameterTypesOfNode(node, getGeneratedNameForNode) { if (node) { var valueDeclaration; - if (node.kind === 201) { + if (node.kind === 202) { valueDeclaration = ts.getFirstConstructorWithBody(node); } else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { @@ -17760,10 +17828,10 @@ var ts; for (var i = 0; i < parameterCount; i++) { if (parameters[i].dotDotDotToken) { var parameterType = parameters[i].type; - if (parameterType.kind === 146) { + if (parameterType.kind === 147) { parameterType = parameterType.elementType; } - else if (parameterType.kind === 141 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + else if (parameterType.kind === 142 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { parameterType = parameterType.typeArguments[0]; } else { @@ -17809,15 +17877,21 @@ var ts; ts.Debug.assert(!ts.nodeIsSynthesized(location), "resolvesToSomeValue called with a synthesized location"); return !!resolveName(location, name, 107455, undefined, undefined); } + function getReferencedValueDeclaration(reference) { + ts.Debug.assert(!ts.nodeIsSynthesized(reference)); + var symbol = getNodeLinks(reference).resolvedSymbol || + resolveName(reference, reference.text, 107455 | 8388608, undefined, undefined); + return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration; + } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 152 || (n.parent.kind === 198 && n.parent.name === n); + var isVariableDeclarationOrBindingElement = n.parent.kind === 153 || (n.parent.kind === 199 && n.parent.name === n); var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); var isLetOrConst = symbol && (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 223; + symbol.valueDeclaration.parent.kind !== 224; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -17854,6 +17928,7 @@ var ts; resolvesToSomeValue: resolvesToSomeValue, collectLinkedAliases: collectLinkedAliases, getBlockScopedVariableId: getBlockScopedVariableId, + getReferencedValueDeclaration: getReferencedValueDeclaration, serializeTypeOfNode: serializeTypeOfNode, serializeParameterTypesOfNode: serializeParameterTypesOfNode, serializeReturnTypeOfNode: serializeReturnTypeOfNode @@ -17899,10 +17974,10 @@ var ts; } function isReservedWordInStrictMode(node) { return (node.parserContextFlags & 1) && - (node.originalKeywordKind >= 102 && node.originalKeywordKind <= 110); + (102 <= node.originalKeywordKind && node.originalKeywordKind <= 110); } function reportStrictModeGrammarErrorInClassDeclaration(identifier, message, arg0, arg1, arg2) { - if (ts.getAncestor(identifier, 201) || ts.getAncestor(identifier, 174)) { + if (ts.getAncestor(identifier, 202) || ts.getAncestor(identifier, 175)) { return grammarErrorOnNode(identifier, message, arg0); } return false; @@ -17912,19 +17987,19 @@ var ts; var impotClause = node.importClause; if (impotClause.namedBindings) { var nameBindings = impotClause.namedBindings; - if (nameBindings.kind === 211) { + if (nameBindings.kind === 212) { var name_11 = nameBindings.name; - if (name_11.originalKeywordKind) { + if (isReservedWordInStrictMode(name_11)) { var nameText = ts.declarationNameToString(name_11); return grammarErrorOnNode(name_11, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); } } - else if (nameBindings.kind === 212) { + else if (nameBindings.kind === 213) { var reportError = false; for (var _i = 0, _a = nameBindings.elements; _i < _a.length; _i++) { var element = _a[_i]; var name_12 = element.name; - if (name_12.originalKeywordKind) { + if (isReservedWordInStrictMode(name_12)) { var nameText = ts.declarationNameToString(name_12); reportError = reportError || grammarErrorOnNode(name_12, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); } @@ -17940,20 +18015,20 @@ var ts; if (name && name.kind === 65 && isReservedWordInStrictMode(name)) { var nameText = ts.declarationNameToString(name); switch (node.kind) { + case 130: + case 199: + case 201: case 129: - case 198: - case 200: - case 128: - case 152: - case 202: + case 153: case 203: case 204: - return checkGrammarIdentifierInStrictMode(name); - case 201: - return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode, nameText); case 205: + return checkGrammarIdentifierInStrictMode(name); + case 202: + return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode, nameText); + case 206: return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); - case 208: + case 209: return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); } } @@ -17963,17 +18038,17 @@ var ts; if (typeName.kind === 65) { checkGrammarTypeNameInStrictMode(typeName); } - else if (typeName.kind === 126) { + else if (typeName.kind === 127) { checkGrammarTypeNameInStrictMode(typeName.right); checkGrammarTypeReferenceInStrictMode(typeName.left); } } - function checkGrammarHeritageClauseElementInStrictMode(expression) { + function checkGrammarExpressionWithTypeArgumentsInStrictMode(expression) { if (expression && expression.kind === 65) { return checkGrammarIdentifierInStrictMode(expression); } - else if (expression && expression.kind === 155) { - checkGrammarHeritageClauseElementInStrictMode(expression.expression); + else if (expression && expression.kind === 156) { + checkGrammarExpressionWithTypeArgumentsInStrictMode(expression.expression); } } function checkGrammarIdentifierInStrictMode(node, nameText) { @@ -18006,7 +18081,7 @@ var ts; else if (languageVersion < 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher); } - else if (node.kind === 136 || node.kind === 137) { + else if (node.kind === 137 || node.kind === 138) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -18016,26 +18091,26 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 136: case 137: - case 135: - case 132: - case 131: - case 134: + case 138: + case 136: case 133: - case 140: - case 201: + case 132: + case 135: + case 134: + case 141: case 202: - case 205: - case 204: - case 180: - case 200: case 203: + case 206: + case 205: + case 181: + case 201: + case 204: + case 210: case 209: - case 208: + case 216: case 215: - case 214: - case 129: + case 130: break; default: return false; @@ -18069,7 +18144,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 === 206 || node.parent.kind === 227) { + else if (node.parent.kind === 207 || node.parent.kind === 228) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -18078,10 +18153,10 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 206 || node.parent.kind === 227) { + else if (node.parent.kind === 207 || node.parent.kind === 228) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } - else if (node.kind === 129) { + else if (node.kind === 130) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } flags |= 128; @@ -18094,10 +18169,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 === 201) { + else if (node.parent.kind === 202) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 129) { + else if (node.kind === 130) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; @@ -18106,13 +18181,13 @@ var ts; if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (node.parent.kind === 201) { + else if (node.parent.kind === 202) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 129) { + else if (node.kind === 130) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 206) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 207) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -18120,7 +18195,7 @@ var ts; break; } } - if (node.kind === 135) { + if (node.kind === 136) { if (flags & 128) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -18131,13 +18206,13 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if ((node.kind === 209 || node.kind === 208) && flags & 2) { + else if ((node.kind === 210 || node.kind === 209) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 202 && flags & 2) { + else if (node.kind === 203 && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } - else if (node.kind === 129 && (flags & 112) && ts.isBindingPattern(node.name)) { + else if (node.kind === 130 && (flags & 112) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } } @@ -18200,7 +18275,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 163) { + if (node.kind === 164) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -18235,7 +18310,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 121 && parameter.type.kind !== 119) { + if (parameter.type.kind !== 122 && parameter.type.kind !== 120) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -18267,7 +18342,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0; _i < arguments.length; _i++) { var arg = arguments[_i]; - if (arg.kind === 175) { + if (arg.kind === 176) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -18338,11 +18413,11 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 127) { + if (node.kind !== 128) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 169 && computedPropertyName.expression.operatorToken.kind === 23) { + if (computedPropertyName.expression.kind === 170 && computedPropertyName.expression.operatorToken.kind === 23) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } @@ -18369,26 +18444,26 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_13 = prop.name; - if (prop.kind === 175 || - name_13.kind === 127) { + if (prop.kind === 176 || + name_13.kind === 128) { checkGrammarComputedPropertyName(name_13); continue; } var currentKind = void 0; - if (prop.kind === 224 || prop.kind === 225) { + if (prop.kind === 225 || prop.kind === 226) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_13.kind === 7) { checkGrammarNumericLiteral(name_13); } currentKind = Property; } - else if (prop.kind === 134) { + else if (prop.kind === 135) { currentKind = Property; } - else if (prop.kind === 136) { + else if (prop.kind === 137) { currentKind = GetAccessor; } - else if (prop.kind === 137) { + else if (prop.kind === 138) { currentKind = SetAccesor; } else { @@ -18422,24 +18497,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 199) { + if (forInOrOfStatement.initializer.kind === 200) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 187 + var diagnostic = forInOrOfStatement.kind === 188 ? 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 === 187 + var diagnostic = forInOrOfStatement.kind === 188 ? 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 === 187 + var diagnostic = forInOrOfStatement.kind === 188 ? 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); @@ -18462,10 +18537,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 136 && accessor.parameters.length) { + else if (kind === 137 && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 137) { + else if (kind === 138) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -18490,7 +18565,7 @@ var ts; } } function checkGrammarForNonSymbolComputedProperty(node, message) { - if (node.kind === 127 && !ts.isWellKnownSymbolSyntactically(node.expression)) { + if (node.kind === 128 && !ts.isWellKnownSymbolSyntactically(node.expression)) { return grammarErrorOnNode(node, message); } } @@ -18500,7 +18575,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 154) { + if (node.parent.kind === 155) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -18508,7 +18583,7 @@ var ts; return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } - if (node.parent.kind === 201) { + if (node.parent.kind === 202) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -18519,22 +18594,22 @@ var ts; 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 === 202) { + else if (node.parent.kind === 203) { 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 === 145) { + else if (node.parent.kind === 146) { 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 186: case 187: case 188: - case 184: + case 189: case 185: + case 186: return true; - case 194: + case 195: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -18546,9 +18621,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 194: + case 195: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 189 + var isMisplacedContinueLabel = node.kind === 190 && !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); @@ -18556,8 +18631,8 @@ var ts; return false; } break; - case 193: - if (node.kind === 190 && !node.label) { + case 194: + if (node.kind === 191 && !node.label) { return false; } break; @@ -18570,13 +18645,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 190 + var message = node.kind === 191 ? 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 === 190 + var message = node.kind === 191 ? 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); @@ -18588,7 +18663,7 @@ var ts; if (node !== elements[elements.length - 1]) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 151 || node.name.kind === 150) { + if (node.name.kind === 152 || node.name.kind === 151) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -18598,7 +18673,7 @@ var ts; return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 187 && node.parent.parent.kind !== 188) { + if (node.parent.parent.kind !== 188 && node.parent.parent.kind !== 189) { if (ts.isInAmbientContext(node)) { if (node.initializer) { var equalsTokenLength = "=".length; @@ -18628,7 +18703,7 @@ var ts; var elements = name.elements; for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; - if (element.kind !== 175) { + if (element.kind !== 176) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -18645,15 +18720,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 183: case 184: case 185: - case 192: case 186: + case 193: case 187: case 188: + case 189: return false; - case 194: + case 195: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -18669,7 +18744,7 @@ var ts; } } function isIntegerLiteral(expression) { - if (expression.kind === 167) { + if (expression.kind === 168) { var unaryExpression = expression; if (unaryExpression.operator === 33 || unaryExpression.operator === 34) { expression = unaryExpression.operand; @@ -18688,7 +18763,7 @@ var ts; var inAmbientContext = ts.isInAmbientContext(enumDecl); for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { var node = _a[_i]; - if (node.name.kind === 127) { + if (node.name.kind === 128) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } else if (inAmbientContext) { @@ -18758,18 +18833,18 @@ var ts; } } function checkGrammarProperty(node) { - if (node.parent.kind === 201) { + if (node.parent.kind === 202) { 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 === 202) { + else if (node.parent.kind === 203) { 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 === 145) { + else if (node.parent.kind === 146) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -18779,11 +18854,11 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 202 || + if (node.kind === 203 || + node.kind === 210 || node.kind === 209 || - node.kind === 208 || + node.kind === 216 || node.kind === 215 || - node.kind === 214 || (node.flags & 2) || (node.flags & (1 | 256))) { return false; @@ -18793,7 +18868,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 180) { + if (ts.isDeclaration(decl) || decl.kind === 181) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -18812,7 +18887,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 179 || node.parent.kind === 206 || node.parent.kind === 227) { + if (node.parent.kind === 180 || node.parent.kind === 207 || node.parent.kind === 228) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -18893,7 +18968,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 209); + ts.Debug.assert(aliasEmitInfo.node.kind === 210); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -18966,10 +19041,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 198) { + if (declaration.kind === 199) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 212 || declaration.kind === 213 || declaration.kind === 210) { + else if (declaration.kind === 213 || declaration.kind === 214 || declaration.kind === 211) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -18980,7 +19055,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 209) { + if (moduleElementEmitInfo.node.kind === 210) { moduleElementEmitInfo.isVisible = true; } else { @@ -18988,12 +19063,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 205) { + if (nodeToCheck.kind === 206) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 205) { + if (nodeToCheck.kind === 206) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -19081,39 +19156,39 @@ var ts; function emitType(type) { switch (type.kind) { case 112: - case 121: - case 119: - case 113: case 122: + case 120: + case 113: + case 123: case 99: case 8: return writeTextOfNode(currentSourceFile, type); case 177: - return emitHeritageClauseElement(type); - case 141: - return emitTypeReference(type); - case 144: - return emitTypeQuery(type); - case 146: - return emitArrayType(type); - case 147: - return emitTupleType(type); - case 148: - return emitUnionType(type); - case 149: - return emitParenType(type); + return emitExpressionWithTypeArguments(type); case 142: - case 143: - return emitSignatureDeclarationWithJsDocComments(type); + return emitTypeReference(type); case 145: + return emitTypeQuery(type); + case 147: + return emitArrayType(type); + case 148: + return emitTupleType(type); + case 149: + return emitUnionType(type); + case 150: + return emitParenType(type); + case 143: + case 144: + return emitSignatureDeclarationWithJsDocComments(type); + case 146: return emitTypeLiteral(type); case 65: return emitEntityName(type); - case 126: + case 127: return emitEntityName(type); } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 208 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 209 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -19121,17 +19196,17 @@ var ts; writeTextOfNode(currentSourceFile, entityName); } else { - var left = entityName.kind === 126 ? entityName.left : entityName.expression; - var right = entityName.kind === 126 ? entityName.right : entityName.name; + var left = entityName.kind === 127 ? entityName.left : entityName.expression; + var right = entityName.kind === 127 ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentSourceFile, right); } } } - function emitHeritageClauseElement(node) { - if (ts.isSupportedHeritageClauseElement(node)) { - ts.Debug.assert(node.expression.kind === 65 || node.expression.kind === 155); + function emitExpressionWithTypeArguments(node) { + if (ts.isSupportedExpressionWithTypeArguments(node)) { + ts.Debug.assert(node.expression.kind === 65 || node.expression.kind === 156); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -19235,10 +19310,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 208 || - (node.parent.kind === 227 && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 209 || + (node.parent.kind === 228 && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 227) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 228) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -19247,7 +19322,7 @@ var ts; }); } else { - if (node.kind === 209) { + if (node.kind === 210) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -19265,23 +19340,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 200: - return writeFunctionDeclaration(node); - case 180: - return writeVariableStatement(node); - case 202: - return writeInterfaceDeclaration(node); case 201: - return writeClassDeclaration(node); + return writeFunctionDeclaration(node); + case 181: + return writeVariableStatement(node); case 203: - return writeTypeAliasDeclaration(node); + return writeInterfaceDeclaration(node); + case 202: + return writeClassDeclaration(node); case 204: - return writeEnumDeclaration(node); + return writeTypeAliasDeclaration(node); case 205: + return writeEnumDeclaration(node); + case 206: return writeModuleDeclaration(node); - case 208: - return writeImportEqualsDeclaration(node); case 209: + return writeImportEqualsDeclaration(node); + case 210: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -19295,7 +19370,7 @@ var ts; if (node.flags & 256) { write("default "); } - else if (node.kind !== 202) { + else if (node.kind !== 203) { write("declare "); } } @@ -19339,7 +19414,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 211) { + if (namedBindings.kind === 212) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -19365,7 +19440,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 211) { + if (node.importClause.namedBindings.kind === 212) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -19416,7 +19491,7 @@ var ts; emitModuleElementDeclarationFlags(node); write("module "); writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 206) { + while (node.body.kind !== 207) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -19477,7 +19552,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 134 && (node.parent.flags & 32); + return node.parent.kind === 135 && (node.parent.flags & 32); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -19487,15 +19562,15 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 142 || - node.parent.kind === 143 || - (node.parent.parent && node.parent.parent.kind === 145)) { - ts.Debug.assert(node.parent.kind === 134 || - node.parent.kind === 133 || - node.parent.kind === 142 || + if (node.parent.kind === 143 || + node.parent.kind === 144 || + (node.parent.parent && node.parent.parent.kind === 146)) { + ts.Debug.assert(node.parent.kind === 135 || + node.parent.kind === 134 || node.parent.kind === 143 || - node.parent.kind === 138 || - node.parent.kind === 139); + node.parent.kind === 144 || + node.parent.kind === 139 || + node.parent.kind === 140); emitType(node.constraint); } else { @@ -19505,31 +19580,31 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 201: + case 202: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 202: + case 203: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 139: + case 140: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 138: + case 139: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; + case 135: case 134: - case 133: 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 === 201) { + else if (node.parent.parent.kind === 202) { 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 200: + case 201: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -19554,12 +19629,12 @@ var ts; emitCommaList(typeReferences, emitTypeOfTypeReference); } function emitTypeOfTypeReference(node) { - if (ts.isSupportedHeritageClauseElement(node)) { + if (ts.isSupportedExpressionWithTypeArguments(node)) { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 201) { + if (node.parent.parent.kind === 202) { 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; @@ -19636,16 +19711,16 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 198 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 199 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } else { writeTextOfNode(currentSourceFile, node.name); - if ((node.kind === 132 || node.kind === 131) && ts.hasQuestionToken(node)) { + if ((node.kind === 133 || node.kind === 132) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 132 || node.kind === 131) && node.parent.kind === 145) { + if ((node.kind === 133 || node.kind === 132) && node.parent.kind === 146) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 32)) { @@ -19654,14 +19729,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 198) { + if (node.kind === 199) { return 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 === 132 || node.kind === 131) { + else if (node.kind === 133 || node.kind === 132) { if (node.flags & 128) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -19669,7 +19744,7 @@ var ts; 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 === 201) { + else if (node.parent.kind === 202) { return 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 : @@ -19695,7 +19770,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 175) { + if (element.kind !== 176) { elements.push(element); } } @@ -19761,7 +19836,7 @@ var ts; accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 136 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 137 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -19774,7 +19849,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 136 + return accessor.kind === 137 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type @@ -19783,7 +19858,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 137) { + if (accessorWithTypeAnnotation.kind === 138) { 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 : @@ -19829,17 +19904,17 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 200) { + if (node.kind === 201) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 134) { + else if (node.kind === 135) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 200) { + if (node.kind === 201) { write("function "); writeTextOfNode(currentSourceFile, node.name); } - else if (node.kind === 135) { + else if (node.kind === 136) { write("constructor"); } else { @@ -19856,11 +19931,11 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - if (node.kind === 139 || node.kind === 143) { + if (node.kind === 140 || node.kind === 144) { write("new "); } emitTypeParameters(node.typeParameters); - if (node.kind === 140) { + if (node.kind === 141) { write("["); } else { @@ -19869,20 +19944,20 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 140) { + if (node.kind === 141) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 142 || node.kind === 143; - if (isFunctionTypeOrConstructorType || node.parent.kind === 145) { + var isFunctionTypeOrConstructorType = node.kind === 143 || node.kind === 144; + if (isFunctionTypeOrConstructorType || node.parent.kind === 146) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 135 && !(node.flags & 32)) { + else if (node.kind !== 136 && !(node.flags & 32)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -19893,23 +19968,23 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 139: + case 140: 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 138: + case 139: 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 140: + case 141: 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 135: case 134: - case 133: if (node.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -19917,7 +19992,7 @@ var ts; 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 === 201) { + else if (node.parent.kind === 202) { 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 : @@ -19930,7 +20005,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 200: + case 201: 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 : @@ -19962,9 +20037,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 142 || - node.parent.kind === 143 || - node.parent.parent.kind === 145) { + if (node.parent.kind === 143 || + node.parent.kind === 144 || + node.parent.parent.kind === 146) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { @@ -19980,22 +20055,22 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { - case 135: + case 136: return 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; - case 139: + case 140: return 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; - case 138: + case 139: return 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; + case 135: case 134: - case 133: if (node.parent.flags & 128) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -20003,7 +20078,7 @@ var ts; 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 === 201) { + else if (node.parent.parent.kind === 202) { return 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 : @@ -20015,7 +20090,7 @@ var ts; 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; } - case 200: + case 201: return 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 : @@ -20026,12 +20101,12 @@ var ts; } } function emitBindingPattern(bindingPattern) { - if (bindingPattern.kind === 150) { + if (bindingPattern.kind === 151) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 151) { + else if (bindingPattern.kind === 152) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -20050,10 +20125,10 @@ var ts; typeName: bindingElement.name } : undefined; } - if (bindingElement.kind === 175) { + if (bindingElement.kind === 176) { write(" "); } - else if (bindingElement.kind === 152) { + else if (bindingElement.kind === 153) { if (bindingElement.propertyName) { writeTextOfNode(currentSourceFile, bindingElement.propertyName); write(": "); @@ -20076,39 +20151,39 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 200: - case 205: - case 208: - case 202: case 201: - case 203: - case 204: - return emitModuleElement(node, isModuleElementVisible(node)); - case 180: - return emitModuleElement(node, isVariableStatementVisible(node)); + case 206: case 209: + case 203: + case 202: + case 204: + case 205: + return emitModuleElement(node, isModuleElementVisible(node)); + case 181: + return emitModuleElement(node, isVariableStatementVisible(node)); + case 210: return emitModuleElement(node, !node.importClause); - case 215: + case 216: return emitExportDeclaration(node); + case 136: case 135: case 134: - case 133: return writeFunctionDeclaration(node); - case 139: - case 138: case 140: + case 139: + case 141: return emitSignatureDeclarationWithJsDocComments(node); - case 136: case 137: + case 138: return emitAccessorDeclaration(node); + case 133: case 132: - case 131: return emitPropertyDeclaration(node); - case 226: - return emitEnumMemberDeclaration(node); - case 214: - return emitExportAssignment(node); case 227: + return emitEnumMemberDeclaration(node); + case 215: + return emitExportAssignment(node); + case 228: return emitSourceFile(node); } } @@ -20154,13 +20229,13 @@ var ts; } ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; function emitFiles(resolver, host, targetSourceFile) { - var extendsHelper = "\nvar __extends = this.__extends || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n __.prototype = b.prototype;\n d.prototype = new __();\n};"; - var decorateHelper = "\nif (typeof __decorate !== \"function\") __decorate = function (decorators, target, key, desc) {\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") return Reflect.decorate(decorators, target, key, desc);\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; - var metadataHelper = "\nif (typeof __metadata !== \"function\") __metadata = function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; - var paramHelper = "\nif (typeof __param !== \"function\") __param = function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; + var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n __.prototype = b.prototype;\n d.prototype = new __();\n};"; + var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") return Reflect.decorate(decorators, target, key, desc);\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; + var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; + var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0; - var sourceMapDataList = compilerOptions.sourceMap ? [] : undefined; + var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; var diagnostics = []; var newLine = host.getNewLine(); if (targetSourceFile === undefined) { @@ -20215,6 +20290,7 @@ var ts; var increaseIndent = writer.increaseIndent; var decreaseIndent = writer.decreaseIndent; var currentSourceFile; + var exportFunctionForFile; var generatedNameSet = {}; var nodeToGeneratedName = []; var blockScopedVariableToGeneratedName; @@ -20239,7 +20315,7 @@ var ts; var scopeEmitStart = function (scopeDeclaration, scopeName) { }; var scopeEmitEnd = function () { }; var sourceMapData; - if (compilerOptions.sourceMap) { + if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { initializeEmitterWithSourceMaps(); } if (root) { @@ -20257,6 +20333,7 @@ var ts; return; function emitSourceFile(sourceFile) { currentSourceFile = sourceFile; + exportFunctionForFile = undefined; emit(sourceFile); } function isUniqueName(name) { @@ -20333,25 +20410,25 @@ var ts; } function generateNameForNode(node) { switch (node.kind) { - case 200: case 201: - case 174: + case 202: + case 175: generateNameForFunctionOrClassDeclaration(node); break; - case 205: + case 206: generateNameForModuleOrEnum(node); generateNameForNode(node.body); break; - case 204: + case 205: generateNameForModuleOrEnum(node); break; - case 209: + case 210: generateNameForImportDeclaration(node); break; - case 215: + case 216: generateNameForExportDeclaration(node); break; - case 214: + case 215: generateNameForExportAssignment(node); break; } @@ -20477,6 +20554,12 @@ var ts; sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true)); sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; sourceMapData.inputSourceFileNames.push(node.fileName); + if (compilerOptions.inlineSources) { + if (!sourceMapData.sourceMapSourcesContent) { + sourceMapData.sourceMapSourcesContent = []; + } + sourceMapData.sourceMapSourcesContent.push(node.text); + } } function recordScopeNameOfNode(node, scopeName) { function recordScopeNameIndex(scopeNameIndex) { @@ -20488,7 +20571,7 @@ var ts; var parentIndex = getSourceMapNameIndex(); if (parentIndex !== -1) { var name_17 = node.name; - if (!name_17 || name_17.kind !== 127) { + if (!name_17 || name_17.kind !== 128) { scopeName = "." + scopeName; } scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; @@ -20505,18 +20588,18 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 200 || - node.kind === 162 || + else if (node.kind === 201 || + node.kind === 163 || + node.kind === 135 || node.kind === 134 || - node.kind === 133 || - node.kind === 136 || node.kind === 137 || - node.kind === 205 || - node.kind === 201 || - node.kind === 204) { + node.kind === 138 || + node.kind === 206 || + node.kind === 202 || + node.kind === 205) { if (node.name) { var name_18 = node.name; - scopeName = name_18.kind === 127 + scopeName = name_18.kind === 128 ? ts.getTextOfNode(name_18) : node.name.text; } @@ -20535,18 +20618,22 @@ var ts; ts.writeCommentRange(currentSourceFile, writer, comment, newLine); recordSourceMapSpan(comment.end); } - function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings) { + function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { if (typeof JSON !== "undefined") { - return JSON.stringify({ + var map_1 = { version: version, file: file, sourceRoot: sourceRoot, sources: sources, names: names, mappings: mappings - }); + }; + if (sourcesContent !== undefined) { + map_1.sourcesContent = sourcesContent; + } + return JSON.stringify(map_1); } - return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\"}"; + return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; function serializeStringArray(list) { var output = ""; for (var i = 0, n = list.length; i < n; i++) { @@ -20560,9 +20647,18 @@ var ts; } function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { encodeLastRecordedSourceMapSpan(); - ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings), false); + var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); sourceMapDataList.push(sourceMapData); - writeJavaScriptFile(emitOutput + "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL, writeByteOrderMark); + var sourceMapUrl; + if (compilerOptions.inlineSourceMap) { + var base64SourceMapText = ts.convertToBase64(sourceMapText); + sourceMapUrl = "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText; + } + else { + ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, false); + sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; + } + writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); } var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); sourceMapData = { @@ -20574,6 +20670,7 @@ var ts; inputSourceFileNames: [], sourceMapNames: [], sourceMapMappings: "", + sourceMapSourcesContent: undefined, sourceMapDecodedMappings: [] }; sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); @@ -20601,7 +20698,7 @@ var ts; if (ts.nodeIsSynthesized(node)) { return emitNodeWithoutSourceMap(node, false); } - if (node.kind != 227) { + if (node.kind != 228) { recordEmitNodeStartSpan(node); emitNodeWithoutSourceMap(node, allowGeneratedIdentifiers); recordEmitNodeEndSpan(node); @@ -20774,7 +20871,7 @@ var ts; } function emitLiteral(node) { var text = getLiteralText(node); - if (compilerOptions.sourceMap && (node.kind === 8 || ts.isTemplateLiteralKind(node.kind))) { + if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 8 || ts.isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } else if (languageVersion < 2 && isBinaryOrOctalIntegerLiteral(node, text)) { @@ -20846,10 +20943,10 @@ var ts; emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); write("("); emit(tempVariable); - if (node.template.kind === 171) { + if (node.template.kind === 172) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 169 + var needsParens = templateSpan.expression.kind === 170 && templateSpan.expression.operatorToken.kind === 23; emitParenthesizedIf(templateSpan.expression, needsParens); }); @@ -20873,7 +20970,7 @@ var ts; } for (var i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 161 + var needsParens = templateSpan.expression.kind !== 162 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); @@ -20906,11 +21003,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 157: case 158: - return parent.expression === template; case 159: - case 161: + return parent.expression === template; + case 160: + case 162: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1; @@ -20918,7 +21015,7 @@ var ts; } function comparePrecedenceToBinaryPlus(expression) { switch (expression.kind) { - case 169: + case 170: switch (expression.operatorToken.kind) { case 35: case 36: @@ -20930,8 +21027,8 @@ var ts; default: return -1; } - case 172: - case 170: + case 173: + case 171: return -1; default: return 1; @@ -20943,11 +21040,11 @@ var ts; emit(span.literal); } function emitExpressionForPropertyName(node) { - ts.Debug.assert(node.kind !== 152); + ts.Debug.assert(node.kind !== 153); if (node.kind === 8) { emitLiteral(node); } - else if (node.kind === 127) { + else if (node.kind === 128) { if (ts.nodeIsDecorated(node.parent)) { if (!computedPropertyNamesToGeneratedNames) { computedPropertyNamesToGeneratedNames = []; @@ -20978,36 +21075,36 @@ var ts; function isNotExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 129: - case 198: - case 152: + case 130: + case 199: + case 153: + case 133: case 132: - case 131: - case 224: case 225: case 226: + case 227: + case 135: case 134: - case 133: - case 200: - case 136: - case 137: - case 162: case 201: + case 137: + case 138: + case 163: case 202: - case 204: + case 203: case 205: - case 208: - case 210: + case 206: + case 209: case 211: + case 212: return parent.name === node; - case 213: - case 217: - return parent.name === node || parent.propertyName === node; - case 190: - case 189: case 214: + case 218: + return parent.name === node || parent.propertyName === node; + case 191: + case 190: + case 215: return false; - case 194: + case 195: return node.parent.label === node; } } @@ -21115,11 +21212,11 @@ var ts; function needsParenthesisForPropertyAccessOrInvocation(node) { switch (node.kind) { case 65: - case 153: - case 155: + case 154: case 156: case 157: - case 161: + case 158: + case 162: return false; } return true; @@ -21136,14 +21233,14 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 173) { + if (e.kind === 174) { e = e.expression; emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; } else { var i = pos; - while (i < length && elements[i].kind !== 173) { + while (i < length && elements[i].kind !== 174) { i++; } write("["); @@ -21164,7 +21261,7 @@ var ts; } } function isSpreadElementExpression(node) { - return node.kind === 173; + return node.kind === 174; } function emitArrayLiteral(node) { var elements = node.elements; @@ -21225,7 +21322,7 @@ var ts; writeComma(); var property = properties[i]; emitStart(property); - if (property.kind === 136 || property.kind === 137) { + if (property.kind === 137 || property.kind === 138) { var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property !== accessors.firstAccessor) { continue; @@ -21276,13 +21373,13 @@ var ts; emitMemberAccessForPropertyName(property.name); emitEnd(property.name); write(" = "); - if (property.kind === 224) { + if (property.kind === 225) { emit(property.initializer); } - else if (property.kind === 225) { + else if (property.kind === 226) { emitExpressionIdentifier(property.name); } - else if (property.kind === 134) { + else if (property.kind === 135) { emitFunctionDeclaration(property); } else { @@ -21314,7 +21411,7 @@ var ts; var numProperties = properties.length; var numInitialNonComputedProperties = numProperties; for (var i = 0, n = properties.length; i < n; i++) { - if (properties[i].name.kind === 127) { + if (properties[i].name.kind === 128) { numInitialNonComputedProperties = i; break; } @@ -21328,30 +21425,30 @@ var ts; emitObjectLiteralBody(node, properties.length); } function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(169, startsOnNewLine); + var result = ts.createSynthesizedNode(170, startsOnNewLine); result.operatorToken = ts.createSynthesizedNode(operator); result.left = left; result.right = right; return result; } function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(155); + var result = ts.createSynthesizedNode(156); result.expression = parenthesizeForAccess(expression); result.dotToken = ts.createSynthesizedNode(20); result.name = name; return result; } function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(156); + var result = ts.createSynthesizedNode(157); result.expression = parenthesizeForAccess(expression); result.argumentExpression = argumentExpression; return result; } function parenthesizeForAccess(expr) { - if (ts.isLeftHandSideExpression(expr) && expr.kind !== 158 && expr.kind !== 7) { + if (ts.isLeftHandSideExpression(expr) && expr.kind !== 159 && expr.kind !== 7) { return expr; } - var node = ts.createSynthesizedNode(161); + var node = ts.createSynthesizedNode(162); node.expression = expr; return node; } @@ -21400,7 +21497,7 @@ var ts; if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 155 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 156 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; @@ -21448,10 +21545,10 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 173; }); + return ts.forEach(elements, function (e) { return e.kind === 174; }); } function skipParentheses(node) { - while (node.kind === 161 || node.kind === 160) { + while (node.kind === 162 || node.kind === 161) { node = node.expression; } return node; @@ -21472,12 +21569,12 @@ var ts; function emitCallWithSpread(node) { var target; var expr = skipParentheses(node.expression); - if (expr.kind === 155) { + if (expr.kind === 156) { target = emitCallTarget(expr.expression); write("."); emit(expr.name); } - else if (expr.kind === 156) { + else if (expr.kind === 157) { target = emitCallTarget(expr.expression); write("["); emit(expr.argumentExpression); @@ -21518,7 +21615,7 @@ var ts; } else { emit(node.expression); - superCall = node.expression.kind === 155 && node.expression.expression.kind === 91; + superCall = node.expression.kind === 156 && node.expression.expression.kind === 91; } if (superCall && languageVersion < 2) { write(".call("); @@ -21555,20 +21652,20 @@ var ts; } } function emitParenExpression(node) { - if (!node.parent || node.parent.kind !== 163) { - if (node.expression.kind === 160) { + if (!node.parent || node.parent.kind !== 164) { + if (node.expression.kind === 161) { var operand = node.expression.expression; - while (operand.kind == 160) { + while (operand.kind == 161) { operand = operand.expression; } - if (operand.kind !== 167 && + if (operand.kind !== 168 && + operand.kind !== 167 && operand.kind !== 166 && operand.kind !== 165 && - operand.kind !== 164 && - operand.kind !== 168 && - operand.kind !== 158 && - !(operand.kind === 157 && node.parent.kind === 158) && - !(operand.kind === 162 && node.parent.kind === 157)) { + operand.kind !== 169 && + operand.kind !== 159 && + !(operand.kind === 158 && node.parent.kind === 159) && + !(operand.kind === 163 && node.parent.kind === 158)) { emit(operand); return; } @@ -21593,9 +21690,25 @@ var ts; write(" "); emit(node.expression); } + function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { + if (!isCurrentFileSystemExternalModule() || node.kind !== 65 || ts.nodeIsSynthesized(node)) { + return false; + } + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 199 || node.parent.kind === 153); + var targetDeclaration = isVariableDeclarationOrBindingElement + ? node.parent + : resolver.getReferencedValueDeclaration(node); + return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, true); + } function emitPrefixUnaryExpression(node) { + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + } write(ts.tokenToString(node.operator)); - if (node.operand.kind === 167) { + if (node.operand.kind === 168) { var operand = node.operand; if (node.operator === 33 && (operand.operator === 33 || operand.operator === 38)) { write(" "); @@ -21605,23 +21718,73 @@ var ts; } } emit(node.operand); + if (exportChanged) { + write(")"); + } } function emitPostfixUnaryExpression(node) { - emit(node.operand); - write(ts.tokenToString(node.operator)); + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + write("(" + exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + write(ts.tokenToString(node.operator)); + emit(node.operand); + if (node.operator === 38) { + write(") - 1)"); + } + else { + write(") + 1)"); + } + } + else { + emit(node.operand); + write(ts.tokenToString(node.operator)); + } + } + function shouldHoistDeclarationInSystemJsModule(node) { + return isSourceFileLevelDeclarationInSystemJsModule(node, false); + } + function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) { + if (!node || languageVersion >= 2 || !isCurrentFileSystemExternalModule()) { + return false; + } + var current = node; + while (current) { + if (current.kind === 228) { + return !isExported || ((ts.getCombinedNodeFlags(node) & 1) !== 0); + } + else if (ts.isFunctionLike(current) || current.kind === 207) { + return false; + } + else { + current = current.parent; + } + } } function emitBinaryExpression(node) { if (languageVersion < 2 && node.operatorToken.kind === 53 && - (node.left.kind === 154 || node.left.kind === 153)) { - emitDestructuring(node, node.parent.kind === 182); + (node.left.kind === 155 || node.left.kind === 154)) { + emitDestructuring(node, node.parent.kind === 183); } else { + var exportChanged = node.operatorToken.kind >= 53 && + node.operatorToken.kind <= 64 && + isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.left); + write("\", "); + } emit(node.left); var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 23 ? " " : undefined); write(ts.tokenToString(node.operatorToken.kind)); var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); emit(node.right); decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); + if (exportChanged) { + write(")"); + } } } function synthesizedNodeStartsOnNewLine(node) { @@ -21649,7 +21812,7 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 179) { + if (node && node.kind === 180) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } @@ -21664,12 +21827,12 @@ var ts; emitToken(14, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 206) { - ts.Debug.assert(node.parent.kind === 205); + if (node.kind === 207) { + ts.Debug.assert(node.parent.kind === 206); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 206) { + if (node.kind === 207) { emitTempDeclarations(true); } decreaseIndent(); @@ -21678,7 +21841,7 @@ var ts; scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 179) { + if (node.kind === 180) { write(" "); emit(node); } @@ -21690,7 +21853,7 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, node.expression.kind === 163); + emitParenthesizedIf(node.expression, node.expression.kind === 164); write(";"); } function emitIfStatement(node) { @@ -21703,7 +21866,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(76, node.thenStatement.end); - if (node.elseStatement.kind === 183) { + if (node.elseStatement.kind === 184) { write(" "); emit(node.elseStatement); } @@ -21715,7 +21878,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 179) { + if (node.statement.kind === 180) { write(" "); } else { @@ -21731,7 +21894,10 @@ var ts; write(")"); emitEmbeddedStatement(node.statement); } - function emitStartOfVariableDeclarationList(decl, startPos) { + function tryEmitStartOfVariableDeclarationList(decl, startPos) { + if (shouldHoistVariable(decl, true)) { + return false; + } var tokenKind = 98; if (decl && languageVersion >= 2) { if (ts.isLet(decl)) { @@ -21743,28 +21909,53 @@ var ts; } if (startPos !== undefined) { emitToken(tokenKind, startPos); + write(" "); } else { switch (tokenKind) { case 98: - return write("var "); + write("var "); + break; case 104: - return write("let "); + write("let "); + break; case 70: - return write("const "); + write("const "); + break; } } + return true; + } + function emitVariableDeclarationListSkippingUninitializedEntries(list) { + var started = false; + for (var _a = 0, _b = list.declarations; _a < _b.length; _a++) { + var decl = _b[_a]; + if (!decl.initializer) { + continue; + } + if (!started) { + started = true; + } + else { + write(", "); + } + emit(decl); + } + return started; } function emitForStatement(node) { var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer && node.initializer.kind === 199) { + if (node.initializer && node.initializer.kind === 200) { var variableDeclarationList = node.initializer; - var declarations = variableDeclarationList.declarations; - emitStartOfVariableDeclarationList(declarations[0], endPos); - write(" "); - emitCommaList(declarations); + var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + if (startIsEmitted) { + emitCommaList(variableDeclarationList.declarations); + } + else { + emitVariableDeclarationListSkippingUninitializedEntries(variableDeclarationList); + } } else if (node.initializer) { emit(node.initializer); @@ -21777,25 +21968,23 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 188) { + if (languageVersion < 2 && node.kind === 189) { return emitDownLevelForOfStatement(node); } var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer.kind === 199) { + if (node.initializer.kind === 200) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { - var decl = variableDeclarationList.declarations[0]; - emitStartOfVariableDeclarationList(decl, endPos); - write(" "); - emit(decl); + tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + emit(variableDeclarationList.declarations[0]); } } else { emit(node.initializer); } - if (node.kind === 187) { + if (node.kind === 188) { write(" in "); } else { @@ -21863,7 +22052,7 @@ var ts; increaseIndent(); var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 199) { + if (node.initializer.kind === 200) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -21885,7 +22074,7 @@ var ts; } else { var assignmentExpression = createBinaryExpression(node.initializer, 53, rhsIterationValue, false); - if (node.initializer.kind === 153 || node.initializer.kind === 154) { + if (node.initializer.kind === 154 || node.initializer.kind === 155) { emitDestructuring(assignmentExpression, true, undefined); } else { @@ -21894,7 +22083,7 @@ var ts; } emitEnd(node.initializer); write(";"); - if (node.statement.kind === 179) { + if (node.statement.kind === 180) { emitLines(node.statement.statements); } else { @@ -21906,7 +22095,7 @@ var ts; write("}"); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 190 ? 66 : 71, node.pos); + emitToken(node.kind === 191 ? 66 : 71, node.pos); emitOptional(" ", node.label); write(";"); } @@ -21951,7 +22140,7 @@ var ts; ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 220) { + if (node.kind === 221) { write("case "); emit(node.expression); write(":"); @@ -22006,7 +22195,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 205); + } while (node && node.kind !== 206); return node; } function emitContainingModuleName(node) { @@ -22021,7 +22210,7 @@ var ts; write(getGeneratedNameForNode(container)); write("."); } - else if (languageVersion < 2) { + else if (languageVersion < 2 && compilerOptions.module !== 4) { write("exports."); } } @@ -22031,7 +22220,7 @@ var ts; function createVoidZero() { var zero = ts.createSynthesizedNode(7); zero.text = "0"; - var result = ts.createSynthesizedNode(166); + var result = ts.createSynthesizedNode(167); result.expression = zero; return result; } @@ -22039,19 +22228,33 @@ var ts; if (node.flags & 1) { writeLine(); emitStart(node); - if (node.flags & 256) { - if (languageVersion === 0) { - write("exports[\"default\"]"); + if (compilerOptions.module === 4) { + write(exportFunctionForFile + "(\""); + if (node.flags & 256) { + write("default"); } else { - write("exports.default"); + emitNodeWithoutSourceMap(node.name); } + write("\", "); + emitDeclarationName(node); + write(")"); } else { - emitModuleMemberName(node); + if (node.flags & 256) { + if (languageVersion === 0) { + write("exports[\"default\"]"); + } + else { + write("exports.default"); + } + } + else { + emitModuleMemberName(node); + } + write(" = "); + emitDeclarationName(node); } - write(" = "); - emitDeclarationName(node); emitEnd(node); write(";"); } @@ -22061,21 +22264,40 @@ var ts; for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { var specifier = _b[_a]; writeLine(); - emitStart(specifier.name); - emitContainingModuleName(specifier); - write("."); - emitNodeWithoutSourceMap(specifier.name); - emitEnd(specifier.name); - write(" = "); - emitExpressionIdentifier(name); + if (compilerOptions.module === 4) { + emitStart(specifier.name); + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(specifier.name); + write("\", "); + emitExpressionIdentifier(name); + write(")"); + emitEnd(specifier.name); + } + else { + emitStart(specifier.name); + emitContainingModuleName(specifier); + write("."); + emitNodeWithoutSourceMap(specifier.name); + emitEnd(specifier.name); + write(" = "); + emitExpressionIdentifier(name); + } write(";"); } } } function emitDestructuring(root, isAssignmentExpressionStatement, value) { var emitCount = 0; - var isDeclaration = (root.kind === 198 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 129; - if (root.kind === 169) { + var canDefineTempVariablesInPlace = false; + if (root.kind === 199) { + var isExported = ts.getCombinedNodeFlags(root) & 1; + var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); + canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; + } + else if (root.kind === 130) { + canDefineTempVariablesInPlace = true; + } + if (root.kind === 170) { emitAssignmentExpression(root); } else { @@ -22087,7 +22309,14 @@ var ts; write(", "); } renameNonTopLevelLetAndConst(name); - if (name.parent && (name.parent.kind === 198 || name.parent.kind === 152)) { + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 199 || name.parent.kind === 153); + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(name); + write("\", "); + } + if (isVariableDeclarationOrBindingElement) { emitModuleMemberName(name.parent); } else { @@ -22095,11 +22324,14 @@ var ts; } write(" = "); emit(value); + if (exportChanged) { + write(")"); + } } function ensureIdentifier(expr) { if (expr.kind !== 65) { var identifier = createTempVariable(0); - if (!isDeclaration) { + if (!canDefineTempVariablesInPlace) { recordTempDeclaration(identifier); } emitAssignment(identifier, expr); @@ -22109,14 +22341,14 @@ var ts; } function createDefaultValueCheck(value, defaultValue) { value = ensureIdentifier(value); - var equals = ts.createSynthesizedNode(169); + var equals = ts.createSynthesizedNode(170); equals.left = value; equals.operatorToken = ts.createSynthesizedNode(30); equals.right = createVoidZero(); return createConditionalExpression(equals, defaultValue, value); } function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(170); + var cond = ts.createSynthesizedNode(171); cond.condition = condition; cond.questionToken = ts.createSynthesizedNode(50); cond.whenTrue = whenTrue; @@ -22136,7 +22368,7 @@ var ts; return createPropertyAccessExpression(object, propName); } function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(157); + var call = ts.createSynthesizedNode(158); var sliceIdentifier = ts.createSynthesizedNode(65); sliceIdentifier.text = "slice"; call.expression = createPropertyAccessExpression(value, sliceIdentifier); @@ -22151,7 +22383,7 @@ var ts; } for (var _a = 0; _a < properties.length; _a++) { var p = properties[_a]; - if (p.kind === 224 || p.kind === 225) { + if (p.kind === 225 || p.kind === 226) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccessForDestructuringProperty(value, propName)); } @@ -22164,8 +22396,8 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 175) { - if (e.kind !== 173) { + if (e.kind !== 176) { + if (e.kind !== 174) { emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); } else if (i === elements.length - 1) { @@ -22175,14 +22407,14 @@ var ts; } } function emitDestructuringAssignment(target, value) { - if (target.kind === 169 && target.operatorToken.kind === 53) { + if (target.kind === 170 && target.operatorToken.kind === 53) { value = createDefaultValueCheck(value, target.right); target = target.left; } - if (target.kind === 154) { + if (target.kind === 155) { emitObjectLiteralAssignment(target, value); } - else if (target.kind === 153) { + else if (target.kind === 154) { emitArrayLiteralAssignment(target, value); } else { @@ -22196,14 +22428,14 @@ var ts; emitDestructuringAssignment(target, value); } else { - if (root.parent.kind !== 161) { + if (root.parent.kind !== 162) { write("("); } value = ensureIdentifier(value); emitDestructuringAssignment(target, value); write(", "); emit(value); - if (root.parent.kind !== 161) { + if (root.parent.kind !== 162) { write(")"); } } @@ -22223,11 +22455,11 @@ var ts; } for (var i = 0; i < elements.length; i++) { var element = elements[i]; - if (pattern.kind === 150) { + if (pattern.kind === 151) { var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); } - else if (element.kind !== 175) { + else if (element.kind !== 176) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); } @@ -22254,22 +22486,31 @@ var ts; } else { renameNonTopLevelLetAndConst(node.name); - emitModuleMemberName(node); var initializer = node.initializer; if (!initializer && languageVersion < 2) { var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && (getCombinedFlagsForIdentifier(node.name) & 4096); if (isUninitializedLet && - node.parent.parent.kind !== 187 && - node.parent.parent.kind !== 188) { + node.parent.parent.kind !== 188 && + node.parent.parent.kind !== 189) { initializer = createVoidZero(); } } + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.name); + write("\", "); + } + emitModuleMemberName(node); emitOptional(" = ", initializer); + if (exportChanged) { + write(")"); + } } } function emitExportVariableAssignments(node) { - if (node.kind === 175) { + if (node.kind === 176) { return; } var name = node.name; @@ -22281,7 +22522,7 @@ var ts; } } function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 198 && node.parent.kind !== 152)) { + if (!node.parent || (node.parent.kind !== 199 && node.parent.kind !== 153)) { return 0; } return ts.getCombinedNodeFlags(node.parent); @@ -22290,24 +22531,24 @@ var ts; if (languageVersion >= 2 || ts.nodeIsSynthesized(node) || node.kind !== 65 || - (node.parent.kind !== 198 && node.parent.kind !== 152)) { + (node.parent.kind !== 199 && node.parent.kind !== 153)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); if (((combinedFlags & 12288) === 0) || combinedFlags & 1) { return; } - var list = ts.getAncestor(node, 199); - if (list.parent.kind === 180) { - var isSourceFileLevelBinding = list.parent.parent.kind === 227; - var isModuleLevelBinding = list.parent.parent.kind === 206; - var isFunctionLevelBinding = list.parent.parent.kind === 179 && ts.isFunctionLike(list.parent.parent.parent); + var list = ts.getAncestor(node, 200); + if (list.parent.kind === 181) { + var isSourceFileLevelBinding = list.parent.parent.kind === 228; + var isModuleLevelBinding = list.parent.parent.kind === 207; + var isFunctionLevelBinding = list.parent.parent.kind === 180 && ts.isFunctionLike(list.parent.parent.parent); if (isSourceFileLevelBinding || isModuleLevelBinding || isFunctionLevelBinding) { return; } } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === 227 + var parent = blockScopeContainer.kind === 228 ? blockScopeContainer : blockScopeContainer.parent; if (resolver.resolvesToSomeValue(parent, node.text)) { @@ -22322,18 +22563,27 @@ var ts; function isES6ExportedDeclaration(node) { return !!(node.flags & 1) && languageVersion >= 2 && - node.parent.kind === 227; + node.parent.kind === 228; } function emitVariableStatement(node) { + var startIsEmitted = true; if (!(node.flags & 1)) { - emitStartOfVariableDeclarationList(node.declarationList); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); } else if (isES6ExportedDeclaration(node)) { write("export "); - emitStartOfVariableDeclarationList(node.declarationList); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } + if (startIsEmitted) { + emitCommaList(node.declarationList.declarations); + write(";"); + } + else { + var atLeastOneItem = emitVariableDeclarationListSkippingUninitializedEntries(node.declarationList); + if (atLeastOneItem) { + write(";"); + } } - emitCommaList(node.declarationList.declarations); - write(";"); if (languageVersion < 2 && node.parent === currentSourceFile) { ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); } @@ -22434,12 +22684,12 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 136 ? "get " : "set "); + write(node.kind === 137 ? "get " : "set "); emit(node.name, false); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 163 && languageVersion >= 2; + return node.kind === 164 && languageVersion >= 2; } function emitDeclarationName(node) { if (node.name) { @@ -22450,10 +22700,10 @@ var ts; } } function shouldEmitFunctionName(node) { - if (node.kind === 162) { + if (node.kind === 163) { return !!node.name; } - if (node.kind === 200) { + if (node.kind === 201) { return !!node.name || languageVersion < 2; } } @@ -22461,7 +22711,7 @@ var ts; if (ts.nodeIsMissing(node.body)) { return emitOnlyPinnedOrTripleSlashComments(node); } - if (node.kind !== 134 && node.kind !== 133) { + if (node.kind !== 135 && node.kind !== 134) { emitLeadingComments(node); } if (!shouldEmitAsArrowFunction(node)) { @@ -22481,10 +22731,10 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (languageVersion < 2 && node.kind === 200 && node.parent === currentSourceFile && node.name) { + if (languageVersion < 2 && node.kind === 201 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } - if (node.kind !== 134 && node.kind !== 133) { + if (node.kind !== 135 && node.kind !== 134) { emitTrailingComments(node); } } @@ -22531,7 +22781,7 @@ var ts; if (!node.body) { write(" { }"); } - else if (node.body.kind === 179) { + else if (node.body.kind === 180) { emitBlockFunctionBody(node, node.body); } else { @@ -22556,10 +22806,10 @@ var ts; } write(" "); var current = body; - while (current.kind === 160) { + while (current.kind === 161) { current = current.expression; } - emitParenthesizedIf(body, current.kind === 154); + emitParenthesizedIf(body, current.kind === 155); } function emitDownLevelExpressionFunctionBody(node, body) { write(" {"); @@ -22631,9 +22881,9 @@ var ts; function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 182) { + if (statement && statement.kind === 183) { var expr = statement.expression; - if (expr && expr.kind === 157) { + if (expr && expr.kind === 158) { var func = expr.expression; if (func && func.kind === 91) { return statement; @@ -22664,7 +22914,7 @@ var ts; emitNodeWithoutSourceMap(memberName); write("]"); } - else if (memberName.kind === 127) { + else if (memberName.kind === 128) { emitComputedPropertyName(memberName); } else { @@ -22676,7 +22926,7 @@ var ts; var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 132 && static === ((member.flags & 128) !== 0) && member.initializer) { + if (member.kind === 133 && static === ((member.flags & 128) !== 0) && member.initializer) { properties.push(member); } } @@ -22716,11 +22966,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 178) { + if (member.kind === 179) { writeLine(); write(";"); } - else if (member.kind === 134 || node.kind === 133) { + else if (member.kind === 135 || node.kind === 134) { if (!member.body) { return emitOnlyPinnedOrTripleSlashComments(member); } @@ -22739,7 +22989,7 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 136 || member.kind === 137) { + else if (member.kind === 137 || member.kind === 138) { var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); @@ -22789,22 +23039,22 @@ var ts; function emitMemberFunctionsForES6AndHigher(node) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.kind === 134 || node.kind === 133) && !member.body) { + if ((member.kind === 135 || node.kind === 134) && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - else if (member.kind === 134 || - member.kind === 136 || - member.kind === 137) { + else if (member.kind === 135 || + member.kind === 137 || + member.kind === 138) { writeLine(); emitLeadingComments(member); emitStart(member); if (member.flags & 128) { write("static "); } - if (member.kind === 136) { + if (member.kind === 137) { write("get "); } - else if (member.kind === 137) { + else if (member.kind === 138) { write("set "); } if (member.asteriskToken) { @@ -22815,7 +23065,7 @@ var ts; emitEnd(member); emitTrailingComments(member); } - else if (member.kind === 178) { + else if (member.kind === 179) { writeLine(); write(";"); } @@ -22836,10 +23086,10 @@ var ts; function emitConstructorWorker(node, baseTypeElement) { var hasInstancePropertyWithInitializer = false; ts.forEach(node.members, function (member) { - if (member.kind === 135 && !member.body) { + if (member.kind === 136 && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - if (member.kind === 132 && member.initializer && (member.flags & 128) === 0) { + if (member.kind === 133 && member.initializer && (member.flags & 128) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -22939,7 +23189,7 @@ var ts; } function emitClassLikeDeclarationForES6AndHigher(node) { var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 201) { + if (node.kind === 202) { if (thisNodeIsDecorated) { if (isES6ExportedDeclaration(node) && !(node.flags & 256)) { write("export "); @@ -22956,7 +23206,7 @@ var ts; } } var staticProperties = getInitializedProperties(node, true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 174; + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 175; var tempVariable; if (isClassExpressionWithStaticProperties) { tempVariable = createAndRecordTempVariable(0); @@ -23032,8 +23282,10 @@ var ts; } } function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 201) { - write("var "); + if (node.kind === 202) { + if (!shouldHoistDeclarationInSystemJsModule(node)) { + write("var "); + } emitDeclarationName(node); write(" = "); } @@ -23088,11 +23340,11 @@ var ts; emit(baseTypeNode.expression); } write(")"); - if (node.kind === 201) { + if (node.kind === 202) { write(";"); } emitEnd(node); - if (node.kind === 201) { + if (node.kind === 202) { emitExportMemberAssignment(node); } if (languageVersion < 2 && node.parent === currentSourceFile && node.name) { @@ -23166,13 +23418,13 @@ var ts; } else { decorators = member.decorators; - if (member.kind === 134) { + if (member.kind === 135) { functionLikeMember = member; } } writeLine(); emitStart(member); - if (member.kind !== 132) { + if (member.kind !== 133) { write("Object.defineProperty("); emitStart(member.name); emitClassMemberPrefix(node, member); @@ -23202,7 +23454,7 @@ var ts; write(", "); emitExpressionForPropertyName(member.name); emitEnd(member.name); - if (member.kind !== 132) { + if (member.kind !== 133) { write(", Object.getOwnPropertyDescriptor("); emitStart(member.name); emitClassMemberPrefix(node, member); @@ -23241,26 +23493,26 @@ var ts; } function shouldEmitTypeMetadata(node) { switch (node.kind) { - case 134: - case 136: + case 135: case 137: - case 132: + case 138: + case 133: return true; } return false; } function shouldEmitReturnTypeMetadata(node) { switch (node.kind) { - case 134: + case 135: return true; } return false; } function shouldEmitParamTypesMetadata(node) { switch (node.kind) { - case 201: - case 134: - case 137: + case 202: + case 135: + case 138: return true; } return false; @@ -23420,7 +23672,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 205) { + if (moduleDeclaration.body.kind === 206) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -23436,7 +23688,9 @@ var ts; if (!shouldEmit) { return emitOnlyPinnedOrTripleSlashComments(node); } - if (!isModuleMergedWithES6Class(node)) { + var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); + var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); + if (emitVarForModule) { emitStart(node); if (isES6ExportedDeclaration(node)) { write("export "); @@ -23453,7 +23707,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 206) { + if (node.body.kind === 207) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; tempFlags = 0; @@ -23486,6 +23740,14 @@ var ts; write(" = {}));"); emitEnd(node); if (!isES6ExportedDeclaration(node) && node.name.kind === 65 && node.parent === currentSourceFile) { + if (compilerOptions.module === 4 && (node.flags & 1)) { + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(")"); + } emitExportMemberAssignments(node.name); } } @@ -23502,16 +23764,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 208) { + if (node.kind === 209) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 211) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 212) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 209 && node.importClause && !!node.importClause.name; + return node.kind === 210 && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -23538,7 +23800,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 211) { + if (node.importClause.namedBindings.kind === 212) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -23564,7 +23826,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 208 && (node.flags & 1) !== 0; + var isExportedImport = node.kind === 209 && (node.flags & 1) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (compilerOptions.module !== 2) { emitLeadingComments(node); @@ -23576,7 +23838,7 @@ var ts; write(" = "); } else { - var isNakedImport = 209 && !node.importClause; + var isNakedImport = 210 && !node.importClause; if (!isNakedImport) { write("var "); write(getGeneratedNameForNode(node)); @@ -23639,6 +23901,7 @@ var ts; } } function emitExportDeclaration(node) { + ts.Debug.assert(compilerOptions.module !== 4); if (languageVersion < 2) { if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { emitStart(node); @@ -23731,8 +23994,8 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 200 && - expression.kind !== 201) { + if (expression.kind !== 201 && + expression.kind !== 202) { write(";"); } emitEnd(node); @@ -23740,14 +24003,21 @@ var ts; else { writeLine(); emitStart(node); - emitContainingModuleName(node); - if (languageVersion === 0) { - write("[\"default\"] = "); + if (compilerOptions.module === 4) { + write(exportFunctionForFile + "(\"default\","); + emit(node.expression); + write(")"); } else { - write(".default = "); + emitContainingModuleName(node); + if (languageVersion === 0) { + write("[\"default\"] = "); + } + else { + write(".default = "); + } + emit(node.expression); } - emit(node.expression); write(";"); emitEnd(node); } @@ -23761,18 +24031,18 @@ var ts; for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 209: + case 210: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, true)) { externalImports.push(node); } break; - case 208: - if (node.moduleReference.kind === 219 && resolver.isReferencedAliasDeclaration(node)) { + case 209: + if (node.moduleReference.kind === 220 && resolver.isReferencedAliasDeclaration(node)) { externalImports.push(node); } break; - case 215: + case 216: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -23790,7 +24060,7 @@ var ts; } } break; - case 214: + case 215: if (node.isExportEquals && !exportEquals) { exportEquals = node; } @@ -23810,6 +24080,375 @@ var ts; write("}"); } } + function getLocalNameForExternalImport(importNode) { + var namespaceDeclaration = getNamespaceDeclarationNode(importNode); + if (namespaceDeclaration && !isDefaultImport(importNode)) { + return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); + } + else { + return getGeneratedNameForNode(importNode); + } + } + function getExternalModuleNameText(importNode) { + var moduleName = ts.getExternalModuleName(importNode); + if (moduleName.kind === 8) { + return getLiteralText(moduleName); + } + return undefined; + } + function emitVariableDeclarationsForImports() { + if (externalImports.length === 0) { + return; + } + writeLine(); + var started = false; + for (var _a = 0; _a < externalImports.length; _a++) { + var importNode = externalImports[_a]; + var skipNode = importNode.kind === 216 || + (importNode.kind === 210 && !importNode.importClause); + if (skipNode) { + continue; + } + if (!started) { + write("var "); + started = true; + } + else { + write(", "); + } + write(getLocalNameForExternalImport(importNode)); + } + if (started) { + write(";"); + } + } + function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations) { + if (!hasExportStars) { + return undefined; + } + if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { + var hasExportDeclarationWithExportClause = false; + for (var _a = 0; _a < externalImports.length; _a++) { + var externalImport = externalImports[_a]; + if (externalImport.kind === 216 && externalImport.exportClause) { + hasExportDeclarationWithExportClause = true; + break; + } + } + if (!hasExportDeclarationWithExportClause) { + return emitExportStarFunction(undefined); + } + } + var exportedNamesStorageRef = makeUniqueName("exportedNames"); + writeLine(); + write("var " + exportedNamesStorageRef + " = {"); + increaseIndent(); + var started = false; + if (exportedDeclarations) { + for (var i = 0; i < exportedDeclarations.length; ++i) { + writeExportedName(exportedDeclarations[i]); + } + } + if (exportSpecifiers) { + for (var n in exportSpecifiers) { + for (var _b = 0, _c = exportSpecifiers[n]; _b < _c.length; _b++) { + var specifier = _c[_b]; + writeExportedName(specifier.name); + } + } + } + for (var _d = 0; _d < externalImports.length; _d++) { + var externalImport = externalImports[_d]; + if (externalImport.kind !== 216) { + continue; + } + var exportDecl = externalImport; + if (!exportDecl.exportClause) { + continue; + } + for (var _e = 0, _f = exportDecl.exportClause.elements; _e < _f.length; _e++) { + var element = _f[_e]; + writeExportedName(element.name || element.propertyName); + } + } + decreaseIndent(); + writeLine(); + write("};"); + return emitExportStarFunction(exportedNamesStorageRef); + function emitExportStarFunction(localNames) { + var exportStarFunction = makeUniqueName("exportStar"); + writeLine(); + write("function " + exportStarFunction + "(m) {"); + increaseIndent(); + writeLine(); + write("for(var n in m) {"); + increaseIndent(); + writeLine(); + write("if (n !== \"default\""); + if (localNames) { + write("&& !" + localNames + ".hasOwnProperty(n)"); + } + write(") " + exportFunctionForFile + "(n, m[n]);"); + decreaseIndent(); + writeLine(); + write("}"); + decreaseIndent(); + writeLine(); + write("}"); + return exportStarFunction; + } + function writeExportedName(node) { + if (node.kind !== 65 && node.flags & 256) { + return; + } + if (started) { + write(","); + } + else { + started = true; + } + writeLine(); + write("'"); + if (node.kind === 65) { + emitNodeWithoutSourceMap(node); + } + else { + emitDeclarationName(node); + } + write("': true"); + } + } + function processTopLevelVariableAndFunctionDeclarations(node) { + var hoistedVars; + var hoistedFunctionDeclarations; + var exportedDeclarations; + visit(node); + if (hoistedVars) { + writeLine(); + write("var "); + for (var i = 0; i < hoistedVars.length; ++i) { + var local = hoistedVars[i]; + if (i !== 0) { + write(", "); + } + if (local.kind === 202 || local.kind === 206) { + emitDeclarationName(local); + } + else { + emit(local); + } + var flags = ts.getCombinedNodeFlags(local.kind === 65 ? local.parent : local); + if (flags & 1) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(local); + } + } + write(";"); + } + if (hoistedFunctionDeclarations) { + for (var _a = 0; _a < hoistedFunctionDeclarations.length; _a++) { + var f = hoistedFunctionDeclarations[_a]; + writeLine(); + emit(f); + if (f.flags & 1) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(f); + } + } + } + return exportedDeclarations; + function visit(node) { + if (node.kind === 201) { + if (!hoistedFunctionDeclarations) { + hoistedFunctionDeclarations = []; + } + hoistedFunctionDeclarations.push(node); + return; + } + if (node.kind === 202) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + return; + } + if (node.kind === 206 && shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + return; + } + if (node.kind === 199 || node.kind === 153) { + if (shouldHoistVariable(node, false)) { + var name_21 = node.name; + if (name_21.kind === 65) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(name_21); + } + else { + ts.forEachChild(name_21, visit); + } + } + return; + } + if (ts.isBindingPattern(node)) { + ts.forEach(node.elements, visit); + return; + } + if (!ts.isDeclaration(node)) { + ts.forEachChild(node, visit); + } + } + } + function shouldHoistVariable(node, checkIfSourceFileLevelDecl) { + if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { + return false; + } + return (ts.getCombinedNodeFlags(node) & 12288) === 0 || + ts.getEnclosingBlockScopeContainer(node).kind === 228; + } + function isCurrentFileSystemExternalModule() { + return compilerOptions.module === 4 && ts.isExternalModule(currentSourceFile); + } + function emitSystemModuleBody(node, startIndex) { + emitVariableDeclarationsForImports(); + writeLine(); + var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); + var exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations); + writeLine(); + write("return {"); + increaseIndent(); + writeLine(); + emitSetters(exportStarFunction); + writeLine(); + emitExecute(node, startIndex); + emitTempDeclarations(true); + decreaseIndent(); + writeLine(); + write("}"); + } + function emitSetters(exportStarFunction) { + write("setters:["); + for (var i = 0; i < externalImports.length; ++i) { + if (i !== 0) { + write(","); + } + writeLine(); + increaseIndent(); + var importNode = externalImports[i]; + var importVariableName = getLocalNameForExternalImport(importNode) || ""; + var parameterName = "_" + importVariableName; + write("function (" + parameterName + ") {"); + switch (importNode.kind) { + case 210: + if (!importNode.importClause) { + break; + } + case 209: + ts.Debug.assert(importVariableName !== ""); + increaseIndent(); + writeLine(); + write(importVariableName + " = " + parameterName + ";"); + writeLine(); + var defaultName = importNode.kind === 210 + ? importNode.importClause.name + : importNode.name; + if (defaultName) { + emitExportMemberAssignments(defaultName); + writeLine(); + } + if (importNode.kind === 210 && + importNode.importClause.namedBindings) { + var namedBindings = importNode.importClause.namedBindings; + if (namedBindings.kind === 212) { + emitExportMemberAssignments(namedBindings.name); + writeLine(); + } + else { + for (var _a = 0, _b = namedBindings.elements; _a < _b.length; _a++) { + var element = _b[_a]; + emitExportMemberAssignments(element.name || element.propertyName); + writeLine(); + } + } + } + decreaseIndent(); + break; + case 216: + ts.Debug.assert(importVariableName !== ""); + increaseIndent(); + if (importNode.exportClause) { + for (var _c = 0, _d = importNode.exportClause.elements; _c < _d.length; _c++) { + var e = _d[_c]; + writeLine(); + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(e.name); + write("\", " + parameterName + "[\""); + emitNodeWithoutSourceMap(e.propertyName || e.name); + write("\"]);"); + } + } + else { + writeLine(); + write(exportStarFunction + "(" + parameterName + ");"); + } + writeLine(); + decreaseIndent(); + break; + } + write("}"); + decreaseIndent(); + } + write("],"); + } + function emitExecute(node, startIndex) { + write("execute: function() {"); + increaseIndent(); + writeLine(); + for (var i = startIndex; i < node.statements.length; ++i) { + var statement = node.statements[i]; + switch (statement.kind) { + case 216: + case 210: + case 209: + case 201: + continue; + } + writeLine(); + emit(statement); + } + decreaseIndent(); + writeLine(); + write("}"); + } + function emitSystemModule(node, startIndex) { + collectExternalModuleInfo(node); + ts.Debug.assert(!exportFunctionForFile); + exportFunctionForFile = makeUniqueName("exports"); + write("System.register(["); + for (var i = 0; i < externalImports.length; ++i) { + var text = getExternalModuleNameText(externalImports[i]); + if (i !== 0) { + write(", "); + } + write(text); + } + write("], function(" + exportFunctionForFile + ") {"); + writeLine(); + increaseIndent(); + emitCaptureThisForNodeIfNecessary(node); + emitSystemModuleBody(node, startIndex); + decreaseIndent(); + writeLine(); + write("});"); + } function emitAMDDependencies(node, includeNonAmdDependencies) { // An AMD define function has the following shape: // define(id?, dependencies?, factory); @@ -23837,19 +24476,8 @@ var ts; } for (var _c = 0; _c < externalImports.length; _c++) { var importNode = externalImports[_c]; - var externalModuleName = ""; - var moduleName = ts.getExternalModuleName(importNode); - if (moduleName.kind === 8) { - externalModuleName = getLiteralText(moduleName); - } - var importAliasName = void 0; - var namespaceDeclaration = getNamespaceDeclarationNode(importNode); - if (namespaceDeclaration && !isDefaultImport(importNode)) { - importAliasName = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); - } - else { - importAliasName = getGeneratedNameForNode(importNode); - } + var externalModuleName = getExternalModuleNameText(importNode); + var importAliasName = getLocalNameForExternalImport(importNode); if (includeNonAmdDependencies && importAliasName) { aliasedModuleNames.push(externalModuleName); importAliasNames.push(importAliasName); @@ -23962,28 +24590,33 @@ var ts; writeLine(); emitDetachedComments(node); var startIndex = emitDirectivePrologues(node.statements, false); - if ((languageVersion < 2) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8)) { - writeLines(extendsHelper); - extendsEmitted = true; - } - if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 512) { - writeLines(decorateHelper); - if (compilerOptions.emitDecoratorMetadata) { - writeLines(metadataHelper); + if (!compilerOptions.noEmitHelpers) { + if ((languageVersion < 2) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8)) { + writeLines(extendsHelper); + extendsEmitted = true; + } + if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 512) { + writeLines(decorateHelper); + if (compilerOptions.emitDecoratorMetadata) { + writeLines(metadataHelper); + } + decorateEmitted = true; + } + if (!paramEmitted && resolver.getNodeCheckFlags(node) & 1024) { + writeLines(paramHelper); + paramEmitted = true; } - decorateEmitted = true; } - if (!paramEmitted && resolver.getNodeCheckFlags(node) & 1024) { - writeLines(paramHelper); - paramEmitted = true; - } - if (ts.isExternalModule(node)) { + if (ts.isExternalModule(node) || compilerOptions.separateCompilation) { if (languageVersion >= 2) { emitES6Module(node, startIndex); } else if (compilerOptions.module === 2) { emitAMDModule(node, startIndex); } + else if (compilerOptions.module === 4) { + emitSystemModule(node, startIndex); + } else if (compilerOptions.module === 3) { emitUMDModule(node, startIndex); } @@ -24020,21 +24653,21 @@ var ts; } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 202: - case 200: - case 209: - case 208: case 203: - case 214: - return false; - case 205: - return shouldEmitModuleDeclaration(node); + case 201: + case 210: + case 209: case 204: + case 215: + return false; + case 206: + return shouldEmitModuleDeclaration(node); + case 205: return shouldEmitEnumDeclaration(node); } - if (node.kind !== 179 && + if (node.kind !== 180 && node.parent && - node.parent.kind === 163 && + node.parent.kind === 164 && node.parent.body === node && compilerOptions.target <= 1) { return false; @@ -24046,13 +24679,13 @@ var ts; switch (node.kind) { case 65: return emitIdentifier(node, allowGeneratedIdentifiers); - case 129: + case 130: return emitParameter(node); + case 135: case 134: - case 133: return emitMethod(node); - case 136: case 137: + case 138: return emitAccessor(node); case 93: return emitThis(node); @@ -24072,131 +24705,131 @@ var ts; case 12: case 13: return emitLiteral(node); - case 171: - return emitTemplateExpression(node); - case 176: - return emitTemplateSpan(node); - case 126: - return emitQualifiedName(node); - case 150: - return emitObjectBindingPattern(node); - case 151: - return emitArrayBindingPattern(node); - case 152: - return emitBindingElement(node); - case 153: - return emitArrayLiteral(node); - case 154: - return emitObjectLiteral(node); - case 224: - return emitPropertyAssignment(node); - case 225: - return emitShorthandPropertyAssignment(node); - case 127: - return emitComputedPropertyName(node); - case 155: - return emitPropertyAccess(node); - case 156: - return emitIndexedAccess(node); - case 157: - return emitCallExpression(node); - case 158: - return emitNewExpression(node); - case 159: - return emitTaggedTemplateExpression(node); - case 160: - return emit(node.expression); - case 161: - return emitParenExpression(node); - case 200: - case 162: - case 163: - return emitFunctionDeclaration(node); - case 164: - return emitDeleteExpression(node); - case 165: - return emitTypeOfExpression(node); - case 166: - return emitVoidExpression(node); - case 167: - return emitPrefixUnaryExpression(node); - case 168: - return emitPostfixUnaryExpression(node); - case 169: - return emitBinaryExpression(node); - case 170: - return emitConditionalExpression(node); - case 173: - return emitSpreadElementExpression(node); case 172: - return emitYieldExpression(node); - case 175: - return; - case 179: - case 206: - return emitBlock(node); - case 180: - return emitVariableStatement(node); - case 181: - return write(";"); - case 182: - return emitExpressionStatement(node); - case 183: - return emitIfStatement(node); - case 184: - return emitDoStatement(node); - case 185: - return emitWhileStatement(node); - case 186: - return emitForStatement(node); - case 188: - case 187: - return emitForInOrForOfStatement(node); - case 189: - case 190: - return emitBreakOrContinueStatement(node); - case 191: - return emitReturnStatement(node); - case 192: - return emitWithStatement(node); - case 193: - return emitSwitchStatement(node); - case 220: - case 221: - return emitCaseOrDefaultClause(node); - case 194: - return emitLabelledStatement(node); - case 195: - return emitThrowStatement(node); - case 196: - return emitTryStatement(node); - case 223: - return emitCatchClause(node); - case 197: - return emitDebuggerStatement(node); - case 198: - return emitVariableDeclaration(node); - case 174: - return emitClassExpression(node); - case 201: - return emitClassDeclaration(node); - case 202: - return emitInterfaceDeclaration(node); - case 204: - return emitEnumDeclaration(node); + return emitTemplateExpression(node); + case 178: + return emitTemplateSpan(node); + case 127: + return emitQualifiedName(node); + case 151: + return emitObjectBindingPattern(node); + case 152: + return emitArrayBindingPattern(node); + case 153: + return emitBindingElement(node); + case 154: + return emitArrayLiteral(node); + case 155: + return emitObjectLiteral(node); + case 225: + return emitPropertyAssignment(node); case 226: - return emitEnumMember(node); + return emitShorthandPropertyAssignment(node); + case 128: + return emitComputedPropertyName(node); + case 156: + return emitPropertyAccess(node); + case 157: + return emitIndexedAccess(node); + case 158: + return emitCallExpression(node); + case 159: + return emitNewExpression(node); + case 160: + return emitTaggedTemplateExpression(node); + case 161: + return emit(node.expression); + case 162: + return emitParenExpression(node); + case 201: + case 163: + case 164: + return emitFunctionDeclaration(node); + case 165: + return emitDeleteExpression(node); + case 166: + return emitTypeOfExpression(node); + case 167: + return emitVoidExpression(node); + case 168: + return emitPrefixUnaryExpression(node); + case 169: + return emitPostfixUnaryExpression(node); + case 170: + return emitBinaryExpression(node); + case 171: + return emitConditionalExpression(node); + case 174: + return emitSpreadElementExpression(node); + case 173: + return emitYieldExpression(node); + case 176: + return; + case 180: + case 207: + return emitBlock(node); + case 181: + return emitVariableStatement(node); + case 182: + return write(";"); + case 183: + return emitExpressionStatement(node); + case 184: + return emitIfStatement(node); + case 185: + return emitDoStatement(node); + case 186: + return emitWhileStatement(node); + case 187: + return emitForStatement(node); + case 189: + case 188: + return emitForInOrForOfStatement(node); + case 190: + case 191: + return emitBreakOrContinueStatement(node); + case 192: + return emitReturnStatement(node); + case 193: + return emitWithStatement(node); + case 194: + return emitSwitchStatement(node); + case 221: + case 222: + return emitCaseOrDefaultClause(node); + case 195: + return emitLabelledStatement(node); + case 196: + return emitThrowStatement(node); + case 197: + return emitTryStatement(node); + case 224: + return emitCatchClause(node); + case 198: + return emitDebuggerStatement(node); + case 199: + return emitVariableDeclaration(node); + case 175: + return emitClassExpression(node); + case 202: + return emitClassDeclaration(node); + case 203: + return emitInterfaceDeclaration(node); case 205: - return emitModuleDeclaration(node); - case 209: - return emitImportDeclaration(node); - case 208: - return emitImportEqualsDeclaration(node); - case 215: - return emitExportDeclaration(node); - case 214: - return emitExportAssignment(node); + return emitEnumDeclaration(node); case 227: + return emitEnumMember(node); + case 206: + return emitModuleDeclaration(node); + case 210: + return emitImportDeclaration(node); + case 209: + return emitImportEqualsDeclaration(node); + case 216: + return emitExportDeclaration(node); + case 215: + return emitExportAssignment(node); + case 228: return emitSourceFileNode(node); } } @@ -24224,7 +24857,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 227 || node.pos !== node.parent.pos) { + if (node.parent.kind === 228 || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { return getLeadingCommentsWithoutDetachedComments(); } @@ -24236,7 +24869,7 @@ var ts; } function getTrailingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 227 || node.end !== node.parent.end) { + if (node.parent.kind === 228 || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); } } @@ -24412,10 +25045,10 @@ var ts; }; } ts.createCompilerHost = createCompilerHost; - function getPreEmitDiagnostics(program) { - var diagnostics = program.getSyntacticDiagnostics().concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics()); + function getPreEmitDiagnostics(program, sourceFile) { + var diagnostics = program.getSyntacticDiagnostics(sourceFile).concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics(sourceFile)); if (program.getCompilerOptions().declaration) { - diagnostics.concat(program.getDeclarationDiagnostics()); + diagnostics.concat(program.getDeclarationDiagnostics(sourceFile)); } return ts.sortAndDeduplicateDiagnostics(diagnostics); } @@ -24653,7 +25286,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 209 || node.kind === 208 || node.kind === 215) { + if (node.kind === 210 || node.kind === 209 || node.kind === 216) { var moduleNameExpr = ts.getExternalModuleName(node); if (moduleNameExpr && moduleNameExpr.kind === 8) { var moduleNameText = moduleNameExpr.text; @@ -24673,7 +25306,7 @@ var ts; } } } - else if (node.kind === 205 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { + else if (node.kind === 206 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { if (ts.isExternalModuleImportEqualsDeclaration(node) && ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { @@ -24756,6 +25389,22 @@ var ts; diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_out_cannot_be_specified_with_option_separateCompilation)); } } + if (options.inlineSourceMap) { + if (options.sourceMap) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap)); + } + if (options.mapRoot) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap)); + } + if (options.sourceRoot) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap)); + } + } + if (options.inlineSources) { + if (!options.sourceMap && !options.inlineSourceMap) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); + } + } 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)); @@ -24774,15 +25423,15 @@ var ts; var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); if (firstNonExternalModuleSourceFile) { var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided)); + diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_separateCompilation_flag_is_provided)); } } else if (firstExternalModuleSourceFile && languageVersion < 2 && !options.module) { var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); } if (options.module && languageVersion >= 2) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_external_modules_into_amd_commonjs_or_umd_when_targeting_ES6_or_higher)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); } if (options.outDir || options.sourceRoot || @@ -24841,6 +25490,14 @@ var ts; type: "boolean", description: ts.Diagnostics.Print_this_message }, + { + name: "inlineSourceMap", + type: "boolean" + }, + { + name: "inlineSources", + type: "boolean" + }, { name: "listFiles", type: "boolean" @@ -24862,17 +25519,22 @@ var ts; type: { "commonjs": 1, "amd": 2, + "system": 4, "umd": 3 }, - description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_or_umd, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_or_umd, paramType: ts.Diagnostics.KIND, - error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_or_umd + error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd }, { name: "noEmit", type: "boolean", description: ts.Diagnostics.Do_not_emit_outputs }, + { + name: "noEmitHelpers", + type: "boolean" + }, { name: "noEmitOnError", type: "boolean", @@ -25086,13 +25748,23 @@ var ts; function readConfigFile(fileName) { try { var text = ts.sys.readFile(fileName); - return /\S/.test(text) ? JSON.parse(text) : {}; } catch (e) { + return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) }; } + return parseConfigFileText(fileName, text); } ts.readConfigFile = readConfigFile; - function parseConfigFile(json, basePath) { + function parseConfigFileText(fileName, jsonText) { + try { + return { config: /\S/.test(jsonText) ? JSON.parse(jsonText) : {} }; + } + catch (e) { + return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; + } + } + ts.parseConfigFileText = parseConfigFileText; + function parseConfigFile(json, host, basePath) { var errors = []; return { options: getCompilerOptions(), @@ -25148,7 +25820,7 @@ var ts; } } else { - var sysFiles = ts.sys.readDirectory(basePath, ".ts"); + var sysFiles = host.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")) { @@ -25324,12 +25996,13 @@ var ts; function performCompilation() { if (!cachedProgram) { if (configFileName) { - var configObject = ts.readConfigFile(configFileName); - if (!configObject) { - reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Unable_to_open_file_0, configFileName)); + var result = ts.readConfigFile(configFileName); + if (result.error) { + reportDiagnostic(result.error); return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); } - var configParseResult = ts.parseConfigFile(configObject, ts.getDirectoryPath(configFileName)); + var configObject = result.config; + var configParseResult = ts.parseConfigFile(configObject, ts.sys, ts.getDirectoryPath(configFileName)); if (configParseResult.errors.length > 0) { reportDiagnostics(configParseResult.errors); return ts.sys.exit(ts.ExitStatus.DiagnosticsPresent_OutputsSkipped); diff --git a/bin/tsserver.js b/bin/tsserver.js index d5b7fdd0094..f49850e8aca 100644 --- a/bin/tsserver.js +++ b/bin/tsserver.js @@ -960,7 +960,7 @@ var ts; A_get_accessor_cannot_have_parameters: { code: 1054, category: ts.DiagnosticCategory.Error, key: "A 'get' accessor cannot have parameters." }, Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum member must have initializer." }, - An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An export assignment cannot be used in an internal module." }, + An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An export assignment cannot be used in a namespace." }, Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: ts.DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers." }, Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an import declaration." }, @@ -1021,8 +1021,8 @@ var ts; or_expected: { code: 1144, category: ts.DiagnosticCategory.Error, key: "'{' or ';' expected." }, Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: ts.DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members." }, Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: "Declaration expected." }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Cannot compile external modules unless the '--module' flag is provided." }, + Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: "Import declarations in a namespace cannot reference a module." }, + Cannot_compile_modules_unless_the_module_flag_is_provided: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules unless the '--module' flag is provided." }, File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, var_let_or_const_expected: { code: 1152, category: ts.DiagnosticCategory.Error, key: "'var', 'let' or 'const' expected." }, @@ -1064,9 +1064,9 @@ var ts; The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: ts.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: ts.DiagnosticCategory.Error, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, An_import_declaration_cannot_have_modifiers: { code: 1191, category: ts.DiagnosticCategory.Error, key: "An import declaration cannot have modifiers." }, - External_module_0_has_no_default_export: { code: 1192, category: ts.DiagnosticCategory.Error, key: "External module '{0}' has no default export." }, + Module_0_has_no_default_export: { code: 1192, category: ts.DiagnosticCategory.Error, key: "Module '{0}' has no default export." }, An_export_declaration_cannot_have_modifiers: { code: 1193, category: ts.DiagnosticCategory.Error, key: "An export declaration cannot have modifiers." }, - Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: ts.DiagnosticCategory.Error, key: "Export declarations are not permitted in an internal module." }, + Export_declarations_are_not_permitted_in_a_namespace: { code: 1194, category: ts.DiagnosticCategory.Error, key: "Export declarations are not permitted in a namespace." }, Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: ts.DiagnosticCategory.Error, key: "Catch clause variable name must be an identifier." }, Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: ts.DiagnosticCategory.Error, key: "Catch clause variable cannot have a type annotation." }, Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: ts.DiagnosticCategory.Error, key: "Catch clause variable cannot have an initializer." }, @@ -1075,28 +1075,27 @@ var ts; Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." }, Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." }, Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." }, - Cannot_compile_external_modules_into_amd_commonjs_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher." }, + Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher." }, Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, - Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." }, + Cannot_compile_namespaces_when_the_separateCompilation_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--separateCompilation' flag is provided." }, Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." }, Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: ts.DiagnosticCategory.Error, key: "Invalid use of '{0}'. Class definitions are automatically in strict mode." }, A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" }, Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode" }, Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: ts.DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, - Identifier_expected_0_is_a_reserved_word_in_strict_mode_External_Module_is_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. External Module is automatically in strict mode." }, Type_expected_0_is_a_reserved_word_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode" }, Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, - Type_expected_0_is_a_reserved_word_in_strict_mode_Module_is_automatically_in_strict_mode: { code: 1217, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Module is automatically in strict mode." }, + Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export assignment is not supported when '--module' flag is 'system'." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.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: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, Circular_definition_of_import_alias_0: { code: 2303, category: ts.DiagnosticCategory.Error, key: "Circular definition of import alias '{0}'." }, Cannot_find_name_0: { code: 2304, category: ts.DiagnosticCategory.Error, key: "Cannot find name '{0}'." }, Module_0_has_no_exported_member_1: { code: 2305, category: ts.DiagnosticCategory.Error, key: "Module '{0}' has no exported member '{1}'." }, - File_0_is_not_an_external_module: { code: 2306, category: ts.DiagnosticCategory.Error, key: "File '{0}' is not an external module." }, - Cannot_find_external_module_0: { code: 2307, category: ts.DiagnosticCategory.Error, key: "Cannot find external module '{0}'." }, + File_0_is_not_a_module: { code: 2306, category: ts.DiagnosticCategory.Error, key: "File '{0}' is not a module." }, + Cannot_find_module_0: { code: 2307, category: ts.DiagnosticCategory.Error, key: "Cannot find module '{0}'." }, A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Type '{0}' recursively references itself as a base type." }, @@ -1119,7 +1118,7 @@ var ts; Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: ts.DiagnosticCategory.Error, key: "Types of parameters '{0}' and '{1}' are incompatible." }, Index_signature_is_missing_in_type_0: { code: 2329, category: ts.DiagnosticCategory.Error, key: "Index signature is missing in type '{0}'." }, Index_signatures_are_incompatible: { code: 2330, category: ts.DiagnosticCategory.Error, key: "Index signatures are incompatible." }, - this_cannot_be_referenced_in_a_module_body: { code: 2331, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in a module body." }, + this_cannot_be_referenced_in_a_module_or_namespace_body: { code: 2331, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in a module or namespace body." }, this_cannot_be_referenced_in_current_location: { code: 2332, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in current location." }, this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in constructor arguments." }, this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in a static property initializer." }, @@ -1211,15 +1210,15 @@ var ts; Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: "Interface '{0}' incorrectly extends interface '{1}'." }, Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Ambient external modules cannot be nested in other modules." }, - Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient external module declaration cannot specify relative module name." }, + A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be in a different file from a class or function with which it is merged" }, + A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be located prior to a class or function with which it is merged" }, + Ambient_modules_cannot_be_nested_in_other_modules: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient modules cannot be nested in other modules." }, + Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient module declaration cannot specify relative module name." }, Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module '{0}' is hidden by a local declaration with the same name" }, Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import name cannot be '{0}'" }, - Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." }, + Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: "Import or export declaration in an ambient module declaration cannot reference module through relative module name." }, Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.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: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { code: 2441, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module." }, Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, @@ -1273,8 +1272,8 @@ var ts; Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: ts.DiagnosticCategory.Error, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: ts.DiagnosticCategory.Error, key: "Type '{0}' is not an array type or a string type." }, The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: { code: 2496, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression." }, - External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, - External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." }, + Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: "Module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, + Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: "Module '{0}' uses 'export =' and cannot be used with 'export *'." }, An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." }, @@ -1353,6 +1352,7 @@ var ts; Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot read file '{0}': {1}" }, Unsupported_file_encoding: { code: 5013, category: ts.DiagnosticCategory.Error, key: "Unsupported file encoding." }, + Failed_to_parse_file_0_Colon_1: { code: 5014, category: ts.DiagnosticCategory.Error, key: "Failed to parse file '{0}': {1}." }, Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, @@ -1366,6 +1366,10 @@ var ts; Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { code: 5045, category: ts.DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." }, Option_out_cannot_be_specified_with_option_separateCompilation: { code: 5046, category: ts.DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'separateCompilation'." }, Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, + Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap: { code: 5048, category: ts.DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'." }, + Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5049, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'." }, + Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5050, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'." }, + Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -1377,7 +1381,7 @@ var ts; Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_amd_or_umd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', or 'umd'." }, + Specify_module_code_generation_Colon_commonjs_amd_system_or_umd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print the compiler's version." }, Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile the project in the given directory." }, @@ -1398,7 +1402,7 @@ var ts; Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_or_umd: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', or 'umd'." }, + Argument_for_module_option_must_be_commonjs_amd_system_or_umd: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system' or 'umd'." }, Argument_for_target_option_must_be_ES3_ES5_or_ES6: { code: 6047, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported locale '{0}'." }, @@ -1480,7 +1484,7 @@ var ts; "false": 80, "finally": 81, "for": 82, - "from": 124, + "from": 125, "function": 83, "get": 116, "if": 84, @@ -1491,33 +1495,34 @@ var ts; "interface": 103, "let": 104, "module": 117, + "namespace": 118, "new": 88, "null": 89, - "number": 119, + "number": 120, "package": 105, "private": 106, "protected": 107, "public": 108, - "require": 118, + "require": 119, "return": 90, - "set": 120, + "set": 121, "static": 109, - "string": 121, + "string": 122, "super": 91, "switch": 92, - "symbol": 122, + "symbol": 123, "this": 93, "throw": 94, "true": 95, "try": 96, - "type": 123, + "type": 124, "typeof": 97, "var": 98, "void": 99, "while": 100, "with": 101, "yield": 110, - "of": 125, + "of": 126, "{": 14, "}": 15, "(": 16, @@ -2729,6 +2734,14 @@ var ts; type: "boolean", description: ts.Diagnostics.Print_this_message }, + { + name: "inlineSourceMap", + type: "boolean" + }, + { + name: "inlineSources", + type: "boolean" + }, { name: "listFiles", type: "boolean" @@ -2750,17 +2763,22 @@ var ts; type: { "commonjs": 1, "amd": 2, + "system": 4, "umd": 3 }, - description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_or_umd, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_or_umd, paramType: ts.Diagnostics.KIND, - error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_or_umd + error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd }, { name: "noEmit", type: "boolean", description: ts.Diagnostics.Do_not_emit_outputs }, + { + name: "noEmitHelpers", + type: "boolean" + }, { name: "noEmitOnError", type: "boolean", @@ -2974,13 +2992,23 @@ var ts; function readConfigFile(fileName) { try { var text = ts.sys.readFile(fileName); - return /\S/.test(text) ? JSON.parse(text) : {}; } catch (e) { + return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) }; } + return parseConfigFileText(fileName, text); } ts.readConfigFile = readConfigFile; - function parseConfigFile(json, basePath) { + function parseConfigFileText(fileName, jsonText) { + try { + return { config: /\S/.test(jsonText) ? JSON.parse(jsonText) : {} }; + } + catch (e) { + return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; + } + } + ts.parseConfigFileText = parseConfigFileText; + function parseConfigFile(json, host, basePath) { var errors = []; return { options: getCompilerOptions(), @@ -3036,7 +3064,7 @@ var ts; } } else { - var sysFiles = ts.sys.readDirectory(basePath, ".ts"); + var sysFiles = host.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")) { @@ -3112,7 +3140,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 227) { + while (node && node.kind !== 228) { node = node.parent; } return node; @@ -3201,15 +3229,15 @@ var ts; return current; } switch (current.kind) { - case 227: - case 207: - case 223: - case 205: - case 186: + case 228: + case 208: + case 224: + case 206: case 187: case 188: + case 189: return current; - case 179: + case 180: if (!isFunctionLike(current.parent)) { return current; } @@ -3220,9 +3248,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 198 && + declaration.kind === 199 && declaration.parent && - declaration.parent.kind === 223; + declaration.parent.kind === 224; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function declarationNameToString(name) { @@ -3258,22 +3286,22 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 227: + case 228: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 198: - case 152: - case 201: - case 174: + case 199: + case 153: case 202: + case 175: + case 203: + case 206: case 205: - case 204: - case 226: - case 200: - case 162: + case 227: + case 201: + case 163: errorNode = node.name; break; } @@ -3295,11 +3323,11 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 204 && isConst(node); + return node.kind === 205 && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 152 || isBindingPattern(node))) { + while (node && (node.kind === 153 || isBindingPattern(node))) { node = node.parent; } return node; @@ -3307,14 +3335,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 198) { + if (node.kind === 199) { node = node.parent; } - if (node && node.kind === 199) { + if (node && node.kind === 200) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 180) { + if (node && node.kind === 181) { flags |= node.flags; } return flags; @@ -3329,11 +3357,11 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 182 && node.expression.kind === 8; + return node.kind === 183 && node.expression.kind === 8; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { - if (node.kind === 129 || node.kind === 128) { + if (node.kind === 130 || node.kind === 129) { return ts.concatenate(ts.getTrailingCommentRanges(sourceFileOfNode.text, node.pos), ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos)); } else { @@ -3355,23 +3383,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 191: + case 192: return visitor(node); - case 207: - case 179: - case 183: + case 208: + case 180: case 184: case 185: case 186: case 187: case 188: - case 192: + case 189: case 193: - case 220: - case 221: case 194: - case 196: - case 223: + case 221: + case 222: + case 195: + case 197: + case 224: return ts.forEachChild(node, traverse); } } @@ -3380,14 +3408,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 152: - case 226: - case 129: - case 224: - case 132: - case 131: + case 153: + case 227: + case 130: case 225: - case 198: + case 133: + case 132: + case 226: + case 199: return true; } } @@ -3397,8 +3425,8 @@ var ts; function isAccessor(node) { if (node) { switch (node.kind) { - case 136: case 137: + case 138: return true; } } @@ -3408,22 +3436,22 @@ var ts; function isFunctionLike(node) { if (node) { switch (node.kind) { - case 135: - case 162: - case 200: - case 163: - case 134: - case 133: case 136: + case 163: + case 201: + case 164: + case 135: + case 134: case 137: case 138: case 139: case 140: - case 142: + case 141: case 143: - case 162: + case 144: case 163: - case 200: + case 164: + case 201: return true; } } @@ -3431,11 +3459,11 @@ var ts; } ts.isFunctionLike = isFunctionLike; function isFunctionBlock(node) { - return node && node.kind === 179 && isFunctionLike(node.parent); + return node && node.kind === 180 && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 134 && node.parent.kind === 154; + return node && node.kind === 135 && node.parent.kind === 155; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function getContainingFunction(node) { @@ -3454,36 +3482,36 @@ var ts; return undefined; } switch (node.kind) { - case 127: - if (node.parent.parent.kind === 201) { + case 128: + if (node.parent.parent.kind === 202) { return node; } node = node.parent; break; - case 130: - if (node.parent.kind === 129 && isClassElement(node.parent.parent)) { + case 131: + if (node.parent.kind === 130 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 163: + case 164: if (!includeArrowFunctions) { continue; } - case 200: - case 162: - case 205: - case 132: - case 131: - case 134: + case 201: + case 163: + case 206: case 133: + case 132: case 135: + case 134: case 136: case 137: - case 204: - case 227: + case 138: + case 205: + case 228: return node; } } @@ -3495,40 +3523,40 @@ var ts; if (!node) return node; switch (node.kind) { - case 127: - if (node.parent.parent.kind === 201) { + case 128: + if (node.parent.parent.kind === 202) { return node; } node = node.parent; break; - case 130: - if (node.parent.kind === 129 && isClassElement(node.parent.parent)) { + case 131: + if (node.parent.kind === 130 && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 200: - case 162: + case 201: case 163: + case 164: if (!includeFunctions) { continue; } - case 132: - case 131: - case 134: case 133: + case 132: case 135: + case 134: case 136: case 137: + case 138: return node; } } } ts.getSuperContainer = getSuperContainer; function getInvokedExpression(node) { - if (node.kind === 159) { + if (node.kind === 160) { return node.tag; } return node.expression; @@ -3536,40 +3564,40 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 201: + case 202: return true; - case 132: - return node.parent.kind === 201; - case 129: - return node.parent.body && node.parent.parent.kind === 201; - case 136: + case 133: + return node.parent.kind === 202; + case 130: + return node.parent.body && node.parent.parent.kind === 202; case 137: - case 134: - return node.body && node.parent.kind === 201; + case 138: + case 135: + return node.body && node.parent.kind === 202; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 201: + case 202: if (node.decorators) { return true; } return false; - case 132: - case 129: + case 133: + case 130: if (node.decorators) { return true; } return false; - case 136: + case 137: if (node.body && node.decorators) { return true; } return false; - case 134: - case 137: + case 135: + case 138: if (node.body && node.decorators) { return true; } @@ -3580,10 +3608,10 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 201: + case 202: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 134: - case 137: + case 135: + case 138: return ts.forEach(node.parameters, nodeIsDecorated); } return false; @@ -3601,7 +3629,6 @@ var ts; case 95: case 80: case 9: - case 153: case 154: case 155: case 156: @@ -3611,69 +3638,70 @@ var ts; case 160: case 161: case 162: - case 174: case 163: - case 166: + case 175: case 164: - case 165: case 167: + case 165: + case 166: case 168: case 169: case 170: - case 173: case 171: + case 174: + case 172: case 10: - case 175: + case 176: return true; - case 126: - while (node.parent.kind === 126) { + case 127: + while (node.parent.kind === 127) { node = node.parent; } - return node.parent.kind === 144; + return node.parent.kind === 145; case 65: - if (node.parent.kind === 144) { + if (node.parent.kind === 145) { return true; } case 7: case 8: var parent_1 = node.parent; switch (parent_1.kind) { - case 198: - case 129: + case 199: + case 130: + case 133: case 132: - case 131: - case 226: - case 224: - case 152: + case 227: + case 225: + case 153: return parent_1.initializer === node; - case 182: case 183: case 184: case 185: - case 191: + case 186: case 192: case 193: - case 220: - case 195: - case 193: + case 194: + case 221: + case 196: + case 194: return parent_1.expression === node; - case 186: + case 187: var forStatement = parent_1; - return (forStatement.initializer === node && forStatement.initializer.kind !== 199) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 200) || forStatement.condition === node || forStatement.incrementor === node; - case 187: case 188: + case 189: var forInStatement = parent_1; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 199) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 200) || forInStatement.expression === node; - case 160: + case 161: return node === parent_1.expression; - case 176: + case 178: return node === parent_1.expression; - case 127: + case 128: return node === parent_1.expression; - case 130: + case 131: return true; default: if (isExpression(parent_1)) { @@ -3691,7 +3719,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 208 && node.moduleReference.kind === 219; + return node.kind === 209 && node.moduleReference.kind === 220; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -3700,40 +3728,40 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 208 && node.moduleReference.kind !== 219; + return node.kind === 209 && node.moduleReference.kind !== 220; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 209) { + if (node.kind === 210) { return node.moduleSpecifier; } - if (node.kind === 208) { + if (node.kind === 209) { var reference = node.moduleReference; - if (reference.kind === 219) { + if (reference.kind === 220) { return reference.expression; } } - if (node.kind === 215) { + if (node.kind === 216) { return node.moduleSpecifier; } } ts.getExternalModuleName = getExternalModuleName; function hasDotDotDotToken(node) { - return node && node.kind === 129 && node.dotDotDotToken !== undefined; + return node && node.kind === 130 && node.dotDotDotToken !== undefined; } ts.hasDotDotDotToken = hasDotDotDotToken; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 129: + case 130: return node.questionToken !== undefined; + case 135: case 134: - case 133: return node.questionToken !== undefined; + case 226: case 225: - case 224: + case 133: case 132: - case 131: return node.questionToken !== undefined; } } @@ -3757,7 +3785,7 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 151 || node.kind === 150); + return !!node && (node.kind === 152 || node.kind === 151); } ts.isBindingPattern = isBindingPattern; function isInAmbientContext(node) { @@ -3772,33 +3800,33 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 163: - case 152: - case 201: - case 135: - case 204: - case 226: - case 217: - case 200: - case 162: - case 136: - case 210: - case 208: - case 213: + case 164: + case 153: case 202: - case 134: - case 133: + case 136: case 205: - case 211: - case 129: - case 224: - case 132: - case 131: + case 227: + case 218: + case 201: + case 163: case 137: - case 225: + case 211: + case 209: + case 214: case 203: - case 128: - case 198: + case 135: + case 134: + case 206: + case 212: + case 130: + case 225: + case 133: + case 132: + case 138: + case 226: + case 204: + case 129: + case 199: return true; } return false; @@ -3806,25 +3834,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 190: - case 189: - case 197: - case 184: - case 182: - case 181: - case 187: - case 188: - case 186: - case 183: - case 194: case 191: - case 193: - case 94: - case 196: - case 180: + case 190: + case 198: case 185: + case 183: + case 182: + case 188: + case 189: + case 187: + case 184: + case 195: case 192: - case 214: + case 194: + case 94: + case 197: + case 181: + case 186: + case 193: + case 215: return true; default: return false; @@ -3833,13 +3861,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 135: - case 132: - case 134: case 136: - case 137: case 133: - case 140: + case 135: + case 137: + case 138: + case 134: + case 141: return true; default: return false; @@ -3851,7 +3879,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 213 || parent.kind === 217) { + if (parent.kind === 214 || parent.kind === 218) { if (parent.propertyName) { return true; } @@ -3863,12 +3891,12 @@ var ts; } ts.isDeclarationName = isDeclarationName; function isAliasSymbolDeclaration(node) { - return node.kind === 208 || - node.kind === 210 && !!node.name || - node.kind === 211 || - node.kind === 213 || - node.kind === 217 || - node.kind === 214 && node.expression.kind === 65; + return node.kind === 209 || + node.kind === 211 && !!node.name || + node.kind === 212 || + node.kind === 214 || + node.kind === 218 || + node.kind === 215 && node.expression.kind === 65; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { @@ -3951,7 +3979,7 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 66 <= token && token <= 125; + return 66 <= token && token <= 126; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -3960,19 +3988,19 @@ var ts; ts.isTrivia = isTrivia; function hasDynamicName(declaration) { return declaration.name && - declaration.name.kind === 127 && + declaration.name.kind === 128 && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; function isWellKnownSymbolSyntactically(node) { - return node.kind === 155 && isESSymbolIdentifier(node.expression); + return node.kind === 156 && isESSymbolIdentifier(node.expression); } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { if (name.kind === 65 || name.kind === 8 || name.kind === 7) { return name.text; } - if (name.kind === 127) { + if (name.kind === 128) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -4006,7 +4034,7 @@ var ts; } ts.isModifier = isModifier; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 205 || n.kind === 227; + return isFunctionLike(n) || n.kind === 206 || n.kind === 228; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -4230,7 +4258,7 @@ var ts; ts.getLineOfLocalPosition = getLineOfLocalPosition; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 135 && nodeIsPresent(member.body)) { + if (member.kind === 136 && nodeIsPresent(member.body)) { return member; } }); @@ -4253,10 +4281,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 136) { + if (accessor.kind === 137) { getAccessor = accessor; } - else if (accessor.kind === 137) { + else if (accessor.kind === 138) { setAccessor = accessor; } else { @@ -4265,7 +4293,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 136 || member.kind === 137) + if ((member.kind === 137 || member.kind === 138) && (member.flags & 128) === (accessor.flags & 128)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -4276,10 +4304,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 136 && !getAccessor) { + if (member.kind === 137 && !getAccessor) { getAccessor = member; } - if (member.kind === 137 && !setAccessor) { + if (member.kind === 138 && !setAccessor) { setAccessor = member; } } @@ -4400,22 +4428,22 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 155: case 156: - case 158: case 157: case 159: - case 153: - case 161: + case 158: + case 160: case 154: - case 174: case 162: + case 155: + case 175: + case 163: case 65: case 9: case 7: case 8: case 10: - case 171: + case 172: case 80: case 89: case 93: @@ -4431,30 +4459,84 @@ var ts; return token >= 53 && token <= 64; } ts.isAssignmentOperator = isAssignmentOperator; - function isSupportedHeritageClauseElement(node) { - return isSupportedHeritageClauseElementExpression(node.expression); + function isSupportedExpressionWithTypeArguments(node) { + return isSupportedExpressionWithTypeArgumentsRest(node.expression); } - ts.isSupportedHeritageClauseElement = isSupportedHeritageClauseElement; - function isSupportedHeritageClauseElementExpression(node) { + ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments; + function isSupportedExpressionWithTypeArgumentsRest(node) { if (node.kind === 65) { return true; } - else if (node.kind === 155) { - return isSupportedHeritageClauseElementExpression(node.expression); + else if (node.kind === 156) { + return isSupportedExpressionWithTypeArgumentsRest(node.expression); } else { return false; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 126 && node.parent.right === node) || - (node.parent.kind === 155 && node.parent.name === node); + return (node.parent.kind === 127 && node.parent.right === node) || + (node.parent.kind === 156 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function getLocalSymbolForExportDefault(symbol) { return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 256) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; + function getExpandedCharCodes(input) { + var output = []; + var length = input.length; + var leadSurrogate = undefined; + for (var i = 0; i < length; i++) { + var charCode = input.charCodeAt(i); + if (charCode < 0x80) { + output.push(charCode); + } + else if (charCode < 0x800) { + output.push((charCode >> 6) | 192); + output.push((charCode & 63) | 128); + } + else if (charCode < 0x10000) { + output.push((charCode >> 12) | 224); + output.push(((charCode >> 6) & 63) | 128); + output.push((charCode & 63) | 128); + } + else if (charCode < 0x20000) { + output.push((charCode >> 18) | 240); + output.push(((charCode >> 12) & 63) | 128); + output.push(((charCode >> 6) & 63) | 128); + output.push((charCode & 63) | 128); + } + else { + ts.Debug.assert(false, "Unexpected code point"); + } + } + return output; + } + var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + function convertToBase64(input) { + var result = ""; + var charCodes = getExpandedCharCodes(input); + var i = 0; + var length = charCodes.length; + var byte1, byte2, byte3, byte4; + while (i < length) { + byte1 = charCodes[i] >> 2; + byte2 = (charCodes[i] & 3) << 4 | charCodes[i + 1] >> 4; + byte3 = (charCodes[i + 1] & 15) << 2 | charCodes[i + 2] >> 6; + byte4 = charCodes[i + 2] & 63; + if (i + 1 >= length) { + byte3 = byte4 = 64; + } + else if (i + 2 >= length) { + byte4 = 64; + } + result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4); + i += 3; + } + return result; + } + ts.convertToBase64 = convertToBase64; })(ts || (ts = {})); var ts; (function (ts) { @@ -4576,7 +4658,7 @@ var ts; /// var ts; (function (ts) { - var nodeConstructors = new Array(229); + var nodeConstructors = new Array(230); ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -4614,20 +4696,20 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 126: + case 127: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 128: + case 129: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 129: + case 130: + case 133: case 132: - case 131: - case 224: case 225: - case 198: - case 152: + case 226: + case 199: + case 153: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -4636,24 +4718,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 142: case 143: - case 138: + case 144: case 139: case 140: + case 141: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 134: - case 133: case 135: + case 134: case 136: case 137: - case 162: - case 200: + case 138: case 163: + case 201: + case 164: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -4664,151 +4746,144 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 141: + case 142: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 144: - return visitNode(cbNode, node.exprName); case 145: - return visitNodes(cbNodes, node.members); + return visitNode(cbNode, node.exprName); case 146: - return visitNode(cbNode, node.elementType); + return visitNodes(cbNodes, node.members); case 147: - return visitNodes(cbNodes, node.elementTypes); + return visitNode(cbNode, node.elementType); case 148: - return visitNodes(cbNodes, node.types); + return visitNodes(cbNodes, node.elementTypes); case 149: - return visitNode(cbNode, node.type); + return visitNodes(cbNodes, node.types); case 150: + return visitNode(cbNode, node.type); case 151: - return visitNodes(cbNodes, node.elements); - case 153: + case 152: return visitNodes(cbNodes, node.elements); case 154: - return visitNodes(cbNodes, node.properties); + return visitNodes(cbNodes, node.elements); case 155: + return visitNodes(cbNodes, node.properties); + case 156: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 156: + case 157: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 157: case 158: + case 159: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 159: + case 160: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 160: + case 161: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 161: - return visitNode(cbNode, node.expression); - case 164: + case 162: return visitNode(cbNode, node.expression); case 165: return visitNode(cbNode, node.expression); case 166: return visitNode(cbNode, node.expression); case 167: - return visitNode(cbNode, node.operand); - case 172: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); + return visitNode(cbNode, node.expression); case 168: return visitNode(cbNode, node.operand); + case 173: + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); case 169: + return visitNode(cbNode, node.operand); + case 170: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 170: + case 171: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 173: + case 174: return visitNode(cbNode, node.expression); - case 179: - case 206: + case 180: + case 207: return visitNodes(cbNodes, node.statements); - case 227: + case 228: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 180: + case 181: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 199: + case 200: return visitNodes(cbNodes, node.declarations); - case 182: - return visitNode(cbNode, node.expression); case 183: + return visitNode(cbNode, node.expression); + case 184: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 184: + case 185: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 185: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); case 186: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 187: return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); case 188: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); case 189: - case 190: - return visitNode(cbNode, node.label); - case 191: - return visitNode(cbNode, node.expression); - case 192: - return visitNode(cbNode, node.expression) || + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); + case 190: + case 191: + return visitNode(cbNode, node.label); + case 192: + return visitNode(cbNode, node.expression); case 193: + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + case 194: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 207: + case 208: return visitNodes(cbNodes, node.clauses); - case 220: + case 221: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 221: + case 222: return visitNodes(cbNodes, node.statements); - case 194: + case 195: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 195: - return visitNode(cbNode, node.expression); case 196: + return visitNode(cbNode, node.expression); + case 197: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 223: + case 224: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 130: + case 131: return visitNode(cbNode, node.expression); - case 201: - case 174: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); case 202: + case 175: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || @@ -4819,65 +4894,72 @@ var ts; return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNode(cbNode, node.type); + visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNodes, node.heritageClauses) || + visitNodes(cbNodes, node.members); case 204: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.members); - case 226: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); + visitNode(cbNode, node.type); case 205: + return visitNodes(cbNodes, node.decorators) || + visitNodes(cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNodes, node.members); + case 227: + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + case 206: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 208: + case 209: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 209: + case 210: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 210: + case 211: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 211: - return visitNode(cbNode, node.name); case 212: - case 216: + return visitNode(cbNode, node.name); + case 213: + case 217: return visitNodes(cbNodes, node.elements); - case 215: + case 216: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 213: - case 217: + case 214: + case 218: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 214: + case 215: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 171: + case 172: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 176: + case 178: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 127: + case 128: return visitNode(cbNode, node.expression); - case 222: + case 223: return visitNodes(cbNodes, node.types); case 177: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 219: + case 220: return visitNode(cbNode, node.expression); - case 218: + case 219: return visitNodes(cbNodes, node.decorators); } } @@ -4963,7 +5045,7 @@ var ts; } } function createSourceFile(fileName, languageVersion) { - sourceFile = createNode(227, 0); + sourceFile = createNode(228, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -5256,7 +5338,7 @@ var ts; return parseIdentifierName(); } function parseComputedPropertyName() { - var node = createNode(127); + var node = createNode(128); parseExpected(18); var yieldContext = inYieldContext(); if (inGeneratorParameterContext()) { @@ -5550,14 +5632,14 @@ var ts; function isReusableModuleElement(node) { if (node) { switch (node.kind) { + case 210: case 209: - case 208: + case 216: case 215: - case 214: - case 201: case 202: + case 203: + case 206: case 205: - case 204: return true; } return isReusableStatement(node); @@ -5567,13 +5649,13 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 135: - case 140: - case 134: case 136: + case 141: + case 135: case 137: - case 132: - case 178: + case 138: + case 133: + case 179: return true; } } @@ -5582,8 +5664,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 220: case 221: + case 222: return true; } } @@ -5592,56 +5674,56 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 200: + case 201: + case 181: case 180: - case 179: + case 184: case 183: - case 182: - case 195: + case 196: + case 192: + case 194: case 191: - case 193: case 190: + case 188: case 189: case 187: - case 188: case 186: - case 185: - case 192: - case 181: - case 196: - case 194: - case 184: + case 193: + case 182: case 197: + case 195: + case 185: + case 198: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 226; + return node.kind === 227; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 139: - case 133: case 140: - case 131: - case 138: + case 134: + case 141: + case 132: + case 139: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 198) { + if (node.kind !== 199) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 129) { + if (node.kind !== 130) { return false; } var parameter = node; @@ -5736,7 +5818,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(20)) { - var node = createNode(126, entity.pos); + var node = createNode(127, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -5753,7 +5835,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(171); + var template = createNode(172); template.head = parseLiteralNode(); ts.Debug.assert(template.head.kind === 11, "Template head has wrong token kind"); var templateSpans = []; @@ -5766,7 +5848,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(176); + var span = createNode(178); span.expression = allowInAnd(parseExpression); var literal; if (token === 15) { @@ -5800,7 +5882,7 @@ var ts; return node; } function parseTypeReference() { - var node = createNode(141); + var node = createNode(142); node.typeName = parseEntityName(false, ts.Diagnostics.Type_expected); if (!scanner.hasPrecedingLineBreak() && token === 24) { node.typeArguments = parseBracketedList(17, parseType, 24, 25); @@ -5808,13 +5890,13 @@ var ts; return finishNode(node); } function parseTypeQuery() { - var node = createNode(144); + var node = createNode(145); parseExpected(97); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(128); + var node = createNode(129); node.name = parseIdentifier(); if (parseOptional(79)) { if (isStartOfType() || !isStartOfExpression()) { @@ -5849,7 +5931,7 @@ var ts; } } function parseParameter() { - var node = createNode(129); + var node = createNode(130); node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(21); @@ -5901,7 +5983,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 139) { + if (kind === 140) { parseExpected(88); } fillSignature(51, false, false, node); @@ -5941,7 +6023,7 @@ var ts; return token === 51 || token === 23 || token === 19; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(140, fullStart); + var node = createNode(141, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.parameters = parseBracketedList(15, parseParameter, 18, 19); @@ -5954,7 +6036,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(50); if (token === 16 || token === 24) { - var method = createNode(133, fullStart); + var method = createNode(134, fullStart); method.name = name; method.questionToken = questionToken; fillSignature(51, false, false, method); @@ -5962,7 +6044,7 @@ var ts; return finishNode(method); } else { - var property = createNode(131, fullStart); + var property = createNode(132, fullStart); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -6004,14 +6086,14 @@ var ts; switch (token) { case 16: case 24: - return parseSignatureMember(138); + return parseSignatureMember(139); case 18: return isIndexSignature() ? parseIndexSignatureDeclaration(scanner.getStartPos(), undefined, undefined) : parsePropertyOrMethodSignature(); case 88: if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(139); + return parseSignatureMember(140); } case 8: case 7: @@ -6041,7 +6123,7 @@ var ts; return token === 16 || token === 24; } function parseTypeLiteral() { - var node = createNode(145); + var node = createNode(146); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -6057,12 +6139,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(147); + var node = createNode(148); node.elementTypes = parseBracketedList(18, parseType, 18, 19); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(149); + var node = createNode(150); parseExpected(16); node.type = parseType(); parseExpected(17); @@ -6070,7 +6152,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 143) { + if (kind === 144) { parseExpected(88); } fillSignature(32, false, false, node); @@ -6083,10 +6165,10 @@ var ts; function parseNonArrayType() { switch (token) { case 112: - case 121: - case 119: - case 113: case 122: + case 120: + case 113: + case 123: var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); case 99: @@ -6106,10 +6188,10 @@ var ts; function isStartOfType() { switch (token) { case 112: - case 121: - case 119: - case 113: case 122: + case 120: + case 113: + case 123: case 99: case 97: case 14: @@ -6131,7 +6213,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(18)) { parseExpected(19); - var node = createNode(146, type.pos); + var node = createNode(147, type.pos); node.elementType = type; type = finishNode(node); } @@ -6146,7 +6228,7 @@ var ts; types.push(parseArrayTypeOrHigher()); } types.end = getNodeEnd(); - var node = createNode(148, type.pos); + var node = createNode(149, type.pos); node.types = types; type = finishNode(node); } @@ -6191,10 +6273,10 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(142); + return parseFunctionOrConstructorType(143); } if (token === 88) { - return parseFunctionOrConstructorType(143); + return parseFunctionOrConstructorType(144); } return parseUnionTypeOrHigher(); } @@ -6332,7 +6414,7 @@ var ts; (isIdentifier() || token === 14 || token === 18); } function parseYieldExpression() { - var node = createNode(172); + var node = createNode(173); nextToken(); if (!scanner.hasPrecedingLineBreak() && (token === 35 || isStartOfExpression())) { @@ -6346,8 +6428,8 @@ var ts; } function parseSimpleArrowFunctionExpression(identifier) { ts.Debug.assert(token === 32, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(163, identifier.pos); - var parameter = createNode(129, identifier.pos); + var node = createNode(164, identifier.pos); + var parameter = createNode(130, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; @@ -6425,7 +6507,7 @@ var ts; return parseParenthesizedArrowFunctionExpressionHead(false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(163); + var node = createNode(164); fillSignature(51, false, !allowAmbiguity, node); if (!node.parameters) { return undefined; @@ -6452,7 +6534,7 @@ var ts; if (!questionToken) { return leftOperand; } - var node = createNode(170, leftOperand.pos); + var node = createNode(171, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -6465,7 +6547,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 86 || t === 125; + return t === 86 || t === 126; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -6526,37 +6608,37 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(169, left.pos); + var node = createNode(170, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(167); + var node = createNode(168); node.operator = token; nextToken(); node.operand = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(164); - nextToken(); - node.expression = parseUnaryExpressionOrHigher(); - return finishNode(node); - } - function parseTypeOfExpression() { var node = createNode(165); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } - function parseVoidExpression() { + function parseTypeOfExpression() { var node = createNode(166); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } + function parseVoidExpression() { + var node = createNode(167); + nextToken(); + node.expression = parseUnaryExpressionOrHigher(); + return finishNode(node); + } function parseUnaryExpressionOrHigher() { switch (token) { case 33: @@ -6582,7 +6664,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token === 38 || token === 39) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(168, expression.pos); + var node = createNode(169, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -6605,14 +6687,14 @@ var ts; if (token === 16 || token === 20) { return expression; } - var node = createNode(155, expression.pos); + var node = createNode(156, expression.pos); node.expression = expression; node.dotToken = parseExpectedToken(20, false, 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(160); + var node = createNode(161); parseExpected(24); node.type = parseType(); parseExpected(25); @@ -6623,7 +6705,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(20); if (dotToken) { - var propertyAccess = createNode(155, expression.pos); + var propertyAccess = createNode(156, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(true); @@ -6631,7 +6713,7 @@ var ts; continue; } if (!inDecoratorContext() && parseOptional(18)) { - var indexedAccess = createNode(156, expression.pos); + var indexedAccess = createNode(157, expression.pos); indexedAccess.expression = expression; if (token !== 19) { indexedAccess.argumentExpression = allowInAnd(parseExpression); @@ -6645,7 +6727,7 @@ var ts; continue; } if (token === 10 || token === 11) { - var tagExpression = createNode(159, expression.pos); + var tagExpression = createNode(160, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 10 ? parseLiteralNode() @@ -6664,7 +6746,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(157, expression.pos); + var callExpr = createNode(158, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -6672,7 +6754,7 @@ var ts; continue; } else if (token === 16) { - var callExpr = createNode(157, expression.pos); + var callExpr = createNode(158, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -6762,28 +6844,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(161); + var node = createNode(162); parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); return finishNode(node); } function parseSpreadElement() { - var node = createNode(173); + var node = createNode(174); parseExpected(21); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token === 21 ? parseSpreadElement() : - token === 23 ? createNode(175) : + token === 23 ? createNode(176) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(153); + var node = createNode(154); parseExpected(18); if (scanner.hasPrecedingLineBreak()) node.flags |= 512; @@ -6793,11 +6875,11 @@ var ts; } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(116)) { - return parseAccessorDeclaration(136, fullStart, decorators, modifiers); - } - else if (parseContextualModifier(120)) { return parseAccessorDeclaration(137, fullStart, decorators, modifiers); } + else if (parseContextualModifier(121)) { + return parseAccessorDeclaration(138, fullStart, decorators, modifiers); + } return undefined; } function parseObjectLiteralElement() { @@ -6817,13 +6899,13 @@ var ts; return parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, propertyName, questionToken); } if ((token === 23 || token === 15) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(225, fullStart); + var shorthandDeclaration = createNode(226, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(224, fullStart); + var propertyAssignment = createNode(225, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51); @@ -6832,7 +6914,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(154); + var node = createNode(155); parseExpected(14); if (scanner.hasPrecedingLineBreak()) { node.flags |= 512; @@ -6846,7 +6928,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(162); + var node = createNode(163); parseExpected(83); node.asteriskToken = parseOptionalToken(35); node.name = node.asteriskToken ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier(); @@ -6861,7 +6943,7 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(158); + var node = createNode(159); parseExpected(88); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); @@ -6871,7 +6953,7 @@ var ts; return finishNode(node); } function parseBlock(ignoreMissingOpenBrace, checkForStrictMode, diagnosticMessage) { - var node = createNode(179); + var node = createNode(180); if (parseExpected(14, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(2, checkForStrictMode, parseStatement); parseExpected(15); @@ -6896,12 +6978,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(181); + var node = createNode(182); parseExpected(22); return finishNode(node); } function parseIfStatement() { - var node = createNode(183); + var node = createNode(184); parseExpected(84); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -6911,7 +6993,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(184); + var node = createNode(185); parseExpected(75); node.statement = parseStatement(); parseExpected(100); @@ -6922,7 +7004,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(185); + var node = createNode(186); parseExpected(100); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -6945,21 +7027,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(86)) { - var forInStatement = createNode(187, pos); + var forInStatement = createNode(188, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(17); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(125)) { - var forOfStatement = createNode(188, pos); + else if (parseOptional(126)) { + var forOfStatement = createNode(189, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(17); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(186, pos); + var forStatement = createNode(187, pos); forStatement.initializer = initializer; parseExpected(22); if (token !== 22 && token !== 17) { @@ -6977,7 +7059,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 190 ? 66 : 71); + parseExpected(kind === 191 ? 66 : 71); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -6985,7 +7067,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(191); + var node = createNode(192); parseExpected(90); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -6994,7 +7076,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(192); + var node = createNode(193); parseExpected(101); parseExpected(16); node.expression = allowInAnd(parseExpression); @@ -7003,7 +7085,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(220); + var node = createNode(221); parseExpected(67); node.expression = allowInAnd(parseExpression); parseExpected(51); @@ -7011,7 +7093,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(221); + var node = createNode(222); parseExpected(73); parseExpected(51); node.statements = parseList(4, false, parseStatement); @@ -7021,12 +7103,12 @@ var ts; return token === 67 ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(193); + var node = createNode(194); parseExpected(92); parseExpected(16); node.expression = allowInAnd(parseExpression); parseExpected(17); - var caseBlock = createNode(207, scanner.getStartPos()); + var caseBlock = createNode(208, scanner.getStartPos()); parseExpected(14); caseBlock.clauses = parseList(3, false, parseCaseOrDefaultClause); parseExpected(15); @@ -7036,14 +7118,14 @@ var ts; function parseThrowStatement() { // ThrowStatement[Yield] : // throw [no LineTerminator here]Expression[In, ?Yield]; - var node = createNode(195); + var node = createNode(196); parseExpected(94); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); return finishNode(node); } function parseTryStatement() { - var node = createNode(196); + var node = createNode(197); parseExpected(96); node.tryBlock = parseBlock(false, false); node.catchClause = token === 68 ? parseCatchClause() : undefined; @@ -7054,7 +7136,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(223); + var result = createNode(224); parseExpected(68); if (parseExpected(16)) { result.variableDeclaration = parseVariableDeclaration(); @@ -7064,7 +7146,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(197); + var node = createNode(198); parseExpected(72); parseSemicolon(); return finishNode(node); @@ -7073,13 +7155,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 65 && parseOptional(51)) { - var labeledStatement = createNode(194, fullStart); + var labeledStatement = createNode(195, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(182, fullStart); + var expressionStatement = createNode(183, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -7120,8 +7202,9 @@ var ts; return !isConstEnum; case 103: case 117: + case 118: case 77: - case 123: + case 124: if (isDeclarationStart()) { return false; } @@ -7166,9 +7249,9 @@ var ts; case 82: return parseForOrForInOrForOfStatement(); case 71: - return parseBreakOrContinueStatement(189); - case 66: return parseBreakOrContinueStatement(190); + case 66: + return parseBreakOrContinueStatement(191); case 90: return parseReturnStatement(); case 101: @@ -7231,16 +7314,16 @@ var ts; } function parseArrayBindingElement() { if (token === 23) { - return createNode(175); + return createNode(176); } - var node = createNode(152); + var node = createNode(153); node.dotDotDotToken = parseOptionalToken(21); node.name = parseIdentifierOrPattern(); node.initializer = parseInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(152); + var node = createNode(153); var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); if (tokenIsIdentifier && token !== 51) { @@ -7255,14 +7338,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(150); + var node = createNode(151); parseExpected(14); node.elements = parseDelimitedList(10, parseObjectBindingElement); parseExpected(15); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(151); + var node = createNode(152); parseExpected(18); node.elements = parseDelimitedList(11, parseArrayBindingElement); parseExpected(19); @@ -7281,7 +7364,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(198); + var node = createNode(199); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -7290,7 +7373,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(199); + var node = createNode(200); switch (token) { case 98: break; @@ -7304,7 +7387,7 @@ var ts; ts.Debug.fail(); } nextToken(); - if (token === 125 && lookAhead(canFollowContextualOfKeyword)) { + if (token === 126 && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -7319,7 +7402,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 17; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(180, fullStart); + var node = createNode(181, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -7327,7 +7410,7 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(200, fullStart); + var node = createNode(201, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(83); @@ -7338,7 +7421,7 @@ var ts; return finishNode(node); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(135, pos); + var node = createNode(136, pos); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(114); @@ -7347,7 +7430,7 @@ var ts; return finishNode(node); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(134, fullStart); + var method = createNode(135, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -7358,7 +7441,7 @@ var ts; return finishNode(method); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(132, fullStart); + var property = createNode(133, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -7425,7 +7508,7 @@ var ts; return true; } if (idToken !== undefined) { - if (!ts.isKeyword(idToken) || idToken === 120 || idToken === 116) { + if (!ts.isKeyword(idToken) || idToken === 121 || idToken === 116) { return true; } switch (token) { @@ -7452,7 +7535,7 @@ var ts; decorators = []; decorators.pos = scanner.getStartPos(); } - var decorator = createNode(130, decoratorStart); + var decorator = createNode(131, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -7485,7 +7568,7 @@ var ts; } function parseClassElement() { if (token === 22) { - var result = createNode(178); + var result = createNode(179); nextToken(); return finishNode(result); } @@ -7516,10 +7599,10 @@ var ts; ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 174); + return parseClassDeclarationOrExpression(scanner.getStartPos(), undefined, undefined, 175); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 201); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 202); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { var savedStrictModeContext = inStrictModeContext(); @@ -7560,15 +7643,15 @@ var ts; } function parseHeritageClause() { if (token === 79 || token === 102) { - var node = createNode(222); + var node = createNode(223); node.token = token; nextToken(); - node.types = parseDelimitedList(8, parseHeritageClauseElement); + node.types = parseDelimitedList(8, parseExpressionWithTypeArguments); return finishNode(node); } return undefined; } - function parseHeritageClauseElement() { + function parseExpressionWithTypeArguments() { var node = createNode(177); node.expression = parseLeftHandSideExpressionOrHigher(); if (token === 24) { @@ -7583,7 +7666,7 @@ var ts; return parseList(6, false, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(202, fullStart); + var node = createNode(203, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(103); @@ -7594,10 +7677,10 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(203, fullStart); + var node = createNode(204, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(123); + parseExpected(124); node.name = parseIdentifier(); parseExpected(53); node.type = parseType(); @@ -7605,13 +7688,13 @@ var ts; return finishNode(node); } function parseEnumMember() { - var node = createNode(226, scanner.getStartPos()); + var node = createNode(227, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(204, fullStart); + var node = createNode(205, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(77); @@ -7626,7 +7709,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(206, scanner.getStartPos()); + var node = createNode(207, scanner.getStartPos()); if (parseExpected(14)) { node.statements = parseList(1, false, parseModuleElement); parseExpected(15); @@ -7636,19 +7719,19 @@ var ts; } return finishNode(node); } - function parseInternalModuleTail(fullStart, decorators, modifiers, flags) { - var node = createNode(205, fullStart); + function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { + var node = createNode(206, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); node.body = parseOptional(20) - ? parseInternalModuleTail(getNodePos(), undefined, undefined, 1) + ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(205, fullStart); + var node = createNode(206, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(true); @@ -7656,13 +7739,20 @@ var ts; return finishNode(node); } function parseModuleDeclaration(fullStart, decorators, modifiers) { - parseExpected(117); - return token === 8 - ? parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) - : parseInternalModuleTail(fullStart, decorators, modifiers, modifiers ? modifiers.flags : 0); + var flags = modifiers ? modifiers.flags : 0; + if (parseOptional(118)) { + flags |= 32768; + } + else { + parseExpected(117); + if (token === 8) { + return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); + } + } + return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); } function isExternalModuleReference() { - return token === 118 && + return token === 119 && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -7671,7 +7761,7 @@ var ts; function nextTokenIsCommaOrFromKeyword() { nextToken(); return token === 23 || - token === 124; + token === 125; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { parseExpected(85); @@ -7679,8 +7769,8 @@ var ts; var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 23 && token !== 124) { - var importEqualsDeclaration = createNode(208, fullStart); + if (token !== 23 && token !== 125) { + var importEqualsDeclaration = createNode(209, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -7690,14 +7780,14 @@ var ts; return finishNode(importEqualsDeclaration); } } - var importDeclaration = createNode(209, fullStart); + var importDeclaration = createNode(210, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); if (identifier || token === 35 || token === 14) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(124); + parseExpected(125); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); @@ -7710,13 +7800,13 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(210, fullStart); + var importClause = createNode(211, fullStart); if (identifier) { importClause.name = identifier; } if (!importClause.name || parseOptional(23)) { - importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(212); + importClause.namedBindings = token === 35 ? parseNamespaceImport() : parseNamedImportsOrExports(213); } return finishNode(importClause); } @@ -7726,8 +7816,8 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(219); - parseExpected(118); + var node = createNode(220); + parseExpected(119); parseExpected(16); node.expression = parseModuleSpecifier(); parseExpected(17); @@ -7741,7 +7831,7 @@ var ts; return result; } function parseNamespaceImport() { - var namespaceImport = createNode(211); + var namespaceImport = createNode(212); parseExpected(35); parseExpected(111); namespaceImport.name = parseIdentifier(); @@ -7749,14 +7839,14 @@ var ts; } function parseNamedImportsOrExports(kind) { var node = createNode(kind); - node.elements = parseBracketedList(20, kind === 212 ? parseImportSpecifier : parseExportSpecifier, 14, 15); + node.elements = parseBracketedList(20, kind === 213 ? parseImportSpecifier : parseExportSpecifier, 14, 15); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(217); + return parseImportOrExportSpecifier(218); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(213); + return parseImportOrExportSpecifier(214); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -7775,22 +7865,22 @@ var ts; else { node.name = identifierName; } - if (kind === 213 && checkIdentifierIsKeyword) { + if (kind === 214 && checkIdentifierIsKeyword) { parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(215, fullStart); + var node = createNode(216, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(35)) { - parseExpected(124); + parseExpected(125); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(216); - if (parseOptional(124)) { + node.exportClause = parseNamedImportsOrExports(217); + if (parseOptional(125)) { node.moduleSpecifier = parseModuleSpecifier(); } } @@ -7798,7 +7888,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(214, fullStart); + var node = createNode(215, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(53)) { @@ -7825,11 +7915,12 @@ var ts; case 69: case 103: case 77: - case 123: + case 124: return lookAhead(nextTokenIsIdentifierOrKeyword); case 85: return lookAhead(nextTokenCanFollowImportKeyword); case 117: + case 118: return lookAhead(nextTokenIsIdentifierOrKeywordOrStringLiteral); case 78: return lookAhead(nextTokenCanFollowExportKeyword); @@ -7895,17 +7986,18 @@ var ts; return parseClassDeclaration(fullStart, decorators, modifiers); case 103: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 123: + case 124: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 77: return parseEnumDeclaration(fullStart, decorators, modifiers); case 117: + case 118: return parseModuleDeclaration(fullStart, decorators, modifiers); case 85: return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); default: if (decorators) { - var node = createMissingNode(218, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(219, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -7985,10 +8077,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 - || node.kind === 208 && node.moduleReference.kind === 219 - || node.kind === 209 - || node.kind === 214 + || node.kind === 209 && node.moduleReference.kind === 220 + || node.kind === 210 || node.kind === 215 + || node.kind === 216 ? node : undefined; }); @@ -8275,16 +8367,16 @@ var ts; (function (ts) { ts.bindTime = 0; function getModuleInstanceState(node) { - if (node.kind === 202 || node.kind === 203) { + if (node.kind === 203 || node.kind === 204) { return 0; } else if (ts.isConstEnumDeclaration(node)) { return 2; } - else if ((node.kind === 209 || node.kind === 208) && !(node.flags & 1)) { + else if ((node.kind === 210 || node.kind === 209) && !(node.flags & 1)) { return 0; } - else if (node.kind === 206) { + else if (node.kind === 207) { var state = 0; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -8300,7 +8392,7 @@ var ts; }); return state; } - else if (node.kind === 205) { + else if (node.kind === 206) { return getModuleInstanceState(node.body); } else { @@ -8353,10 +8445,10 @@ var ts; } function getDeclarationName(node) { if (node.name) { - if (node.kind === 205 && node.name.kind === 8) { + if (node.kind === 206 && node.name.kind === 8) { return '"' + node.name.text + '"'; } - if (node.name.kind === 127) { + if (node.name.kind === 128) { var nameExpression = node.name.expression; ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); @@ -8364,22 +8456,22 @@ var ts; return node.name.text; } switch (node.kind) { - case 143: - case 135: + case 144: + case 136: return "__constructor"; - case 142: - case 138: - return "__call"; + case 143: case 139: - return "__new"; + return "__call"; case 140: + return "__new"; + case 141: return "__index"; - case 215: + case 216: return "__export"; - case 214: + case 215: return node.isExportEquals ? "export=" : "default"; - case 200: case 201: + case 202: return node.flags & 256 ? "default" : undefined; } } @@ -8411,7 +8503,7 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if ((node.kind === 201 || node.kind === 174) && symbol.exports) { + if ((node.kind === 202 || node.kind === 175) && symbol.exports) { var prototypeSymbol = createSymbol(4 | 134217728, "prototype"); if (ts.hasProperty(symbol.exports, prototypeSymbol.name)) { if (node.name) { @@ -8427,7 +8519,7 @@ var ts; function declareModuleMember(node, symbolKind, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1; if (symbolKind & 8388608) { - if (node.kind === 217 || (node.kind === 208 && hasExportModifier)) { + if (node.kind === 218 || (node.kind === 209 && hasExportModifier)) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); } else { @@ -8435,7 +8527,7 @@ var ts; } } else { - if (hasExportModifier || container.flags & 32768) { + if (hasExportModifier || container.flags & 65536) { var exportKind = (symbolKind & 107455 ? 1048576 : 0) | (symbolKind & 793056 ? 2097152 : 0) | (symbolKind & 1536 ? 4194304 : 0); @@ -8461,7 +8553,7 @@ var ts; addToContainerChain(container); } if (isBlockScopeContainer) { - setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 227); + setBlockScopeContainer(node, (symbolKind & 255504) === 0 && node.kind !== 228); } ts.forEachChild(node, bind); container = saveContainer; @@ -8476,41 +8568,41 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 205: + case 206: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 227: + case 228: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; } - case 142: case 143: - case 138: + case 144: case 139: case 140: - case 134: - case 133: + case 141: case 135: + case 134: case 136: case 137: - case 200: - case 162: + case 138: + case 201: case 163: + case 164: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 174: - case 201: + case 175: + case 202: if (node.flags & 128) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } - case 145: - case 154: - case 202: + case 146: + case 155: + case 203: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 204: + case 205: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } @@ -8525,11 +8617,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 227 ? node : node.body; - if (body.kind === 227 || body.kind === 206) { + var body = node.kind === 228 ? node : node.body; + if (body.kind === 228 || body.kind === 207) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 215 || stat.kind === 214) { + if (stat.kind === 216 || stat.kind === 215) { return true; } } @@ -8538,10 +8630,10 @@ var ts; } function setExportContextFlag(node) { if (isAmbientContext(node) && !hasExportDeclarations(node)) { - node.flags |= 32768; + node.flags |= 65536; } else { - node.flags &= ~32768; + node.flags &= ~65536; } } function bindModuleDeclaration(node) { @@ -8579,7 +8671,7 @@ var ts; var typeLiteralSymbol = createSymbol(2048, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, 2048); typeLiteralSymbol.members = {}; - typeLiteralSymbol.members[node.kind === 142 ? "__call" : "__new"] = symbol; + typeLiteralSymbol.members[node.kind === 143 ? "__call" : "__new"] = symbol; } function bindAnonymousDeclaration(node, symbolKind, name, isBlockScopeContainer) { var symbol = createSymbol(symbolKind, name); @@ -8591,10 +8683,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolKind, symbolExcludes) { switch (blockScopeContainer.kind) { - case 205: + case 206: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 227: + case 228: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; @@ -8617,14 +8709,14 @@ var ts; function bind(node) { node.parent = parent; switch (node.kind) { - case 128: + case 129: bindDeclaration(node, 262144, 530912, false); break; - case 129: + case 130: bindParameter(node); break; - case 198: - case 152: + case 199: + case 153: if (ts.isBindingPattern(node.name)) { bindChildren(node, 0, false); } @@ -8635,68 +8727,68 @@ var ts; bindDeclaration(node, 1, 107454, false); } break; + case 133: case 132: - case 131: bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 536870912 : 0), 107455, false); break; - case 224: case 225: + case 226: bindPropertyOrMethodOrAccessor(node, 4, 107455, false); break; - case 226: + case 227: bindPropertyOrMethodOrAccessor(node, 8, 107455, false); break; - case 138: case 139: case 140: + case 141: bindDeclaration(node, 131072, 0, false); break; + case 135: case 134: - case 133: bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 536870912 : 0), ts.isObjectLiteralMethod(node) ? 107455 : 99263, true); break; - case 200: + case 201: bindDeclaration(node, 16, 106927, true); break; - case 135: + case 136: bindDeclaration(node, 16384, 0, true); break; - case 136: + case 137: bindPropertyOrMethodOrAccessor(node, 32768, 41919, true); break; - case 137: + case 138: bindPropertyOrMethodOrAccessor(node, 65536, 74687, true); break; - case 142: case 143: + case 144: bindFunctionOrConstructorType(node); break; - case 145: + case 146: bindAnonymousDeclaration(node, 2048, "__type", false); break; - case 154: + case 155: bindAnonymousDeclaration(node, 4096, "__object", false); break; - case 162: case 163: + case 164: bindAnonymousDeclaration(node, 16, "__function", true); break; - case 174: + case 175: bindAnonymousDeclaration(node, 32, "__class", false); break; - case 223: + case 224: bindCatchVariableDeclaration(node); break; - case 201: + case 202: bindBlockScopedDeclaration(node, 32, 899583); break; - case 202: + case 203: bindDeclaration(node, 64, 792992, false); break; - case 203: + case 204: bindDeclaration(node, 524288, 793056, false); break; - case 204: + case 205: if (ts.isConst(node)) { bindDeclaration(node, 128, 899967, false); } @@ -8704,16 +8796,16 @@ var ts; bindDeclaration(node, 256, 899327, false); } break; - case 205: + case 206: bindModuleDeclaration(node); break; - case 208: - case 211: - case 213: - case 217: + case 209: + case 212: + case 214: + case 218: bindDeclaration(node, 8388608, 8388608, false); break; - case 210: + case 211: if (node.name) { bindDeclaration(node, 8388608, 8388608, false); } @@ -8721,13 +8813,13 @@ var ts; bindChildren(node, 0, false); } break; - case 215: + case 216: if (!node.exportClause) { declareSymbol(container.symbol.exports, container.symbol, node, 1073741824, 0); } bindChildren(node, 0, false); break; - case 214: + case 215: if (node.expression.kind === 65) { declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 107455 | 8388608); } @@ -8736,20 +8828,20 @@ var ts; } bindChildren(node, 0, false); break; - case 227: + case 228: setExportContextFlag(node); if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; } - case 179: + case 180: bindChildren(node, 0, !ts.isFunctionLike(node.parent)); break; - case 223: - case 186: + case 224: case 187: case 188: - case 207: + case 189: + case 208: bindChildren(node, 0, true); break; default: @@ -8767,8 +8859,8 @@ var ts; bindDeclaration(node, 1, 107455, false); } if (node.flags & 112 && - node.parent.kind === 135 && - (node.parent.parent.kind === 201 || node.parent.parent.kind === 174)) { + node.parent.kind === 136 && + (node.parent.parent.kind === 202 || node.parent.parent.kind === 175)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4, 107455); } @@ -9054,10 +9146,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 227); + return ts.getAncestor(node, 228); } function isGlobalSourceFile(node) { - return node.kind === 227 && !ts.isExternalModule(node); + return node.kind === 228 && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -9099,18 +9191,18 @@ var ts; } } switch (location.kind) { - case 227: + case 228: if (!ts.isExternalModule(location)) break; - case 205: + case 206: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931)) { - if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 217)) { + if (result.flags & meaning || !(result.flags & 8388608 && getDeclarationOfAliasSymbol(result).kind === 218)) { break loop; } result = undefined; } - else if (location.kind === 227 || - (location.kind === 205 && location.name.kind === 8)) { + else if (location.kind === 228 || + (location.kind === 206 && location.name.kind === 8)) { result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931); var localSymbol = ts.getLocalSymbolForExportDefault(result); if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { @@ -9119,14 +9211,14 @@ var ts; result = undefined; } break; - case 204: + case 205: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8)) { break loop; } break; + case 133: case 132: - case 131: - if (location.parent.kind === 201 && !(location.flags & 128)) { + if (location.parent.kind === 202 && !(location.flags & 128)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455)) { @@ -9135,8 +9227,8 @@ var ts; } } break; - case 201: case 202: + case 203: 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); @@ -9145,28 +9237,28 @@ var ts; break loop; } break; - case 127: + case 128: grandparent = location.parent.parent; - if (grandparent.kind === 201 || grandparent.kind === 202) { + if (grandparent.kind === 202 || grandparent.kind === 203) { 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 134: - case 133: case 135: + case 134: case 136: case 137: - case 200: - case 163: + case 138: + case 201: + case 164: if (name === "arguments") { result = argumentsSymbol; break loop; } break; - case 162: + case 163: if (name === "arguments") { result = argumentsSymbol; break loop; @@ -9177,15 +9269,15 @@ var ts; break loop; } break; - case 174: + case 175: var className = location.name; if (className && name === className.text) { result = location.symbol; break loop; } break; - case 130: - if (location.parent && location.parent.kind === 129) { + case 131: + if (location.parent && location.parent.kind === 130) { location = location.parent; } if (location.parent && ts.isClassElement(location.parent)) { @@ -9223,14 +9315,14 @@ var ts; ts.Debug.assert(declaration !== undefined, "Block-scoped variable declaration is undefined"); var isUsedBeforeDeclaration = !isDefinedBefore(declaration, errorLocation); if (!isUsedBeforeDeclaration) { - var variableDeclaration = ts.getAncestor(declaration, 198); + var variableDeclaration = ts.getAncestor(declaration, 199); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 180 || - variableDeclaration.parent.parent.kind === 186) { + if (variableDeclaration.parent.parent.kind === 181 || + variableDeclaration.parent.parent.kind === 187) { isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 188 || - variableDeclaration.parent.parent.kind === 187) { + else if (variableDeclaration.parent.parent.kind === 189 || + variableDeclaration.parent.parent.kind === 188) { var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); } @@ -9252,10 +9344,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 208) { + if (node.kind === 209) { return node; } - while (node && node.kind !== 209) { + while (node && node.kind !== 210) { node = node.parent; } return node; @@ -9265,7 +9357,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 219) { + if (node.moduleReference.kind === 220) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -9275,7 +9367,7 @@ var ts; if (moduleSymbol) { var exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]); if (!exportDefaultSymbol) { - error(node.name, ts.Diagnostics.External_module_0_has_no_default_export, symbolToString(moduleSymbol)); + error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } return exportDefaultSymbol; } @@ -9354,17 +9446,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 208: + case 209: return getTargetOfImportEqualsDeclaration(node); - case 210: - return getTargetOfImportClause(node); case 211: + return getTargetOfImportClause(node); + case 212: return getTargetOfNamespaceImport(node); - case 213: - return getTargetOfImportSpecifier(node); - case 217: - return getTargetOfExportSpecifier(node); case 214: + return getTargetOfImportSpecifier(node); + case 218: + return getTargetOfExportSpecifier(node); + case 215: return getTargetOfExportAssignment(node); } } @@ -9406,10 +9498,10 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 214) { + if (node.kind === 215) { checkExpressionCached(node.expression); } - else if (node.kind === 217) { + else if (node.kind === 218) { checkExpressionCached(node.propertyName || node.name); } else if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -9419,17 +9511,17 @@ var ts; } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 208); + importDeclaration = ts.getAncestor(entityName, 209); ts.Debug.assert(importDeclaration !== undefined); } if (entityName.kind === 65 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 65 || entityName.parent.kind === 126) { + if (entityName.kind === 65 || entityName.parent.kind === 127) { return resolveEntityName(entityName, 1536); } else { - ts.Debug.assert(entityName.parent.kind === 208); + ts.Debug.assert(entityName.parent.kind === 209); return resolveEntityName(entityName, 107455 | 793056 | 1536); } } @@ -9447,9 +9539,9 @@ var ts; return undefined; } } - else if (name.kind === 126 || name.kind === 155) { - var left = name.kind === 126 ? name.left : name.expression; - var right = name.kind === 126 ? name.right : name.name; + else if (name.kind === 127 || name.kind === 156) { + var left = name.kind === 127 ? name.left : name.expression; + var right = name.kind === 127 ? name.right : name.name; var namespace = resolveEntityName(left, 1536); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -9502,10 +9594,10 @@ var ts; if (sourceFile.symbol) { return sourceFile.symbol; } - error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_an_external_module, sourceFile.fileName); + error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName); return; } - error(moduleReferenceLiteral, ts.Diagnostics.Cannot_find_external_module_0, moduleName); + error(moduleReferenceLiteral, ts.Diagnostics.Cannot_find_module_0, moduleName); } function resolveExternalModuleSymbol(moduleSymbol) { return moduleSymbol && resolveSymbol(moduleSymbol.exports["export="]) || moduleSymbol; @@ -9513,7 +9605,7 @@ var ts; function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression) { var symbol = resolveExternalModuleSymbol(moduleSymbol); if (symbol && !(symbol.flags & (1536 | 3))) { - error(moduleReferenceExpression, ts.Diagnostics.External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); + error(moduleReferenceExpression, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); symbol = undefined; } return symbol; @@ -9593,7 +9685,7 @@ var ts; var members = node.members; for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; - if (member.kind === 135 && ts.nodeIsPresent(member.body)) { + if (member.kind === 136 && ts.nodeIsPresent(member.body)) { return member; } } @@ -9658,17 +9750,17 @@ var ts; } } switch (location_1.kind) { - case 227: + case 228: if (!ts.isExternalModule(location_1)) { break; } - case 205: + case 206: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 201: case 202: + case 203: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -9783,8 +9875,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 205 && declaration.name.kind === 8) || - (declaration.kind === 227 && ts.isExternalModule(declaration)); + return (declaration.kind === 206 && declaration.name.kind === 8) || + (declaration.kind === 228 && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -9816,11 +9908,11 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 144) { + if (entityName.parent.kind === 145) { meaning = 107455 | 1048576; } - else if (entityName.kind === 126 || entityName.kind === 155 || - entityName.parent.kind === 208) { + else if (entityName.kind === 127 || entityName.kind === 156 || + entityName.parent.kind === 209) { meaning = 1536; } else { @@ -9864,10 +9956,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048) { var node = type.symbol.declarations[0].parent; - while (node.kind === 149) { + while (node.kind === 150) { node = node.parent; } - if (node.kind === 203) { + if (node.kind === 204) { return getSymbolOfNode(node); } } @@ -10039,7 +10131,7 @@ var ts; var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 227 || declaration.parent.kind === 206; + return declaration.parent.kind === 228 || declaration.parent.kind === 207; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 2) || @@ -10114,7 +10206,7 @@ var ts; writer.writeParameter(getIndexerParameterName(resolved, 0, "x")); writePunctuation(writer, 51); writeSpace(writer); - writeKeyword(writer, 121); + writeKeyword(writer, 122); writePunctuation(writer, 19); writePunctuation(writer, 51); writeSpace(writer); @@ -10127,7 +10219,7 @@ var ts; writer.writeParameter(getIndexerParameterName(resolved, 1, "x")); writePunctuation(writer, 51); writeSpace(writer); - writeKeyword(writer, 119); + writeKeyword(writer, 120); writePunctuation(writer, 19); writePunctuation(writer, 51); writeSpace(writer); @@ -10271,12 +10363,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 205) { + if (node.kind === 206) { if (node.name.kind === 8) { return node; } } - else if (node.kind === 227) { + else if (node.kind === 228) { return ts.isExternalModule(node) ? node : undefined; } } @@ -10319,59 +10411,59 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 152: + case 153: return isDeclarationVisible(node.parent.parent); - case 198: + case 199: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 205: - case 201: + case 206: case 202: case 203: - case 200: case 204: - case 208: + case 201: + case 205: + case 209: var parent_2 = getDeclarationContainer(node); if (!(ts.getCombinedNodeFlags(node) & 1) && - !(node.kind !== 208 && parent_2.kind !== 227 && ts.isInAmbientContext(parent_2))) { + !(node.kind !== 209 && parent_2.kind !== 228 && ts.isInAmbientContext(parent_2))) { return isGlobalSourceFile(parent_2); } return isDeclarationVisible(parent_2); - case 132: - case 131: - case 136: - case 137: - case 134: case 133: + case 132: + case 137: + case 138: + case 135: + case 134: if (node.flags & (32 | 64)) { return false; } - case 135: - case 139: - case 138: + case 136: case 140: - case 129: - case 206: - case 142: - case 143: - case 145: + case 139: case 141: + case 130: + case 207: + case 143: + case 144: case 146: + case 142: case 147: case 148: case 149: + case 150: return isDeclarationVisible(node.parent); - case 210: case 211: - case 213: - return false; - case 128: - case 227: - return true; + case 212: case 214: return false; + case 129: + case 228: + return true; + case 215: + return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); } @@ -10386,10 +10478,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 214) { + if (node.parent && node.parent.kind === 215) { exportSymbol = resolveName(node.parent, node.text, 107455 | 793056 | 1536, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 217) { + else if (node.parent.kind === 218) { exportSymbol = getTargetOfExportSpecifier(node.parent); } var result = []; @@ -10414,14 +10506,14 @@ var ts; } } function getRootDeclaration(node) { - while (node.kind === 152) { + while (node.kind === 153) { node = node.parent.parent; } return node; } function getDeclarationContainer(node) { node = getRootDeclaration(node); - return node.kind === 198 ? node.parent.parent.parent : node.parent; + return node.kind === 199 ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { var classType = getDeclaredTypeOfSymbol(prototype.parent); @@ -10444,7 +10536,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 150) { + if (pattern.kind === 151) { var name_5 = declaration.propertyName || declaration.name; type = getTypeOfPropertyOfType(parentType, name_5.text) || isNumericLiteralName(name_5.text) && getIndexTypeOfType(parentType, 1) || @@ -10481,10 +10573,10 @@ var ts; return type; } function getTypeForVariableLikeDeclaration(declaration) { - if (declaration.parent.parent.kind === 187) { + if (declaration.parent.parent.kind === 188) { return anyType; } - if (declaration.parent.parent.kind === 188) { + if (declaration.parent.parent.kind === 189) { return checkRightHandSideOfForOf(declaration.parent.parent.expression) || anyType; } if (ts.isBindingPattern(declaration.parent)) { @@ -10493,10 +10585,10 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 129) { + if (declaration.kind === 130) { var func = declaration.parent; - if (func.kind === 137 && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 136); + if (func.kind === 138 && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 137); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -10509,7 +10601,7 @@ var ts; if (declaration.initializer) { return checkExpressionCached(declaration.initializer); } - if (declaration.kind === 225) { + if (declaration.kind === 226) { return checkIdentifier(declaration.name); } return undefined; @@ -10538,7 +10630,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 175 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 176 || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -10553,7 +10645,7 @@ var ts; return createTupleType(elementTypes); } function getTypeFromBindingPattern(pattern) { - return pattern.kind === 150 + return pattern.kind === 151 ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); } @@ -10563,7 +10655,7 @@ var ts; if (reportErrors) { reportErrorsFromWidening(declaration, type); } - return declaration.kind !== 224 ? getWidenedType(type) : type; + return declaration.kind !== 225 ? getWidenedType(type) : type; } if (ts.isBindingPattern(declaration.name)) { return getTypeFromBindingPattern(declaration.name); @@ -10571,7 +10663,7 @@ var ts; type = declaration.dotDotDotToken ? anyArrayType : anyType; if (reportErrors && compilerOptions.noImplicitAny) { var root = getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 129 && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 130 && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -10584,10 +10676,10 @@ var ts; return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 223) { + if (declaration.parent.kind === 224) { return links.type = anyType; } - if (declaration.kind === 214) { + if (declaration.kind === 215) { return links.type = checkExpression(declaration.expression); } links.type = resolvingType; @@ -10612,7 +10704,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 136) { + if (accessor.kind === 137) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -10631,8 +10723,8 @@ var ts; links = links || getSymbolLinks(symbol); if (!links.type) { links.type = resolvingType; - var getter = ts.getDeclarationOfKind(symbol, 136); - var setter = ts.getDeclarationOfKind(symbol, 137); + var getter = ts.getDeclarationOfKind(symbol, 137); + var setter = ts.getDeclarationOfKind(symbol, 138); var type; var getterReturnType = getAnnotatedAccessorType(getter); if (getterReturnType) { @@ -10662,7 +10754,7 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 136); + var getter = ts.getDeclarationOfKind(symbol, 137); 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)); } } @@ -10729,7 +10821,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 202 || node.kind === 201) { + if (node.kind === 203 || node.kind === 202) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -10763,10 +10855,10 @@ var ts; } function resolveBaseTypesOfClass(type) { type.baseTypes = []; - var declaration = ts.getDeclarationOfKind(type.symbol, 201); + var declaration = ts.getDeclarationOfKind(type.symbol, 202); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(declaration); if (baseTypeNode) { - var baseType = getTypeFromHeritageClauseElement(baseTypeNode); + var baseType = getTypeFromTypeNode(baseTypeNode); if (baseType !== unknownType) { if (getTargetType(baseType).flags & 1024) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10786,10 +10878,10 @@ var ts; type.baseTypes = []; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 202 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 203 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; - var baseType = getTypeFromHeritageClauseElement(node); + var baseType = getTypeFromTypeNode(node); if (baseType !== unknownType) { if (getTargetType(baseType).flags & (1024 | 2048)) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -10828,7 +10920,7 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = ts.getDeclarationOfKind(symbol, 203); + var declaration = ts.getDeclarationOfKind(symbol, 204); var type = getTypeFromTypeNode(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; @@ -10836,7 +10928,7 @@ var ts; } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 203); + var declaration = ts.getDeclarationOfKind(symbol, 204); error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; @@ -10855,7 +10947,7 @@ var ts; if (!links.declaredType) { var type = createType(512); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 128).constraint) { + if (!ts.getDeclarationOfKind(symbol, 129).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -11302,7 +11394,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 135 ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 136 ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; @@ -11331,8 +11423,8 @@ var ts; returnType = getTypeFromTypeNode(declaration.type); } else { - if (declaration.kind === 136 && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 137); + if (declaration.kind === 137 && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 138); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { @@ -11350,19 +11442,19 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 142: case 143: - case 200: - case 134: - case 133: + case 144: + case 201: case 135: - case 138: + case 134: + case 136: case 139: case 140: - case 136: + case 141: case 137: - case 162: + case 138: case 163: + case 164: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -11432,7 +11524,7 @@ var ts; } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 135 || signature.declaration.kind === 139; + var isConstructor = signature.declaration.kind === 136 || signature.declaration.kind === 140; var type = createObjectType(32768 | 65536); type.members = emptySymbols; type.properties = emptyArray; @@ -11446,7 +11538,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 ? 119 : 121; + var syntaxKind = kind === 1 ? 120 : 122; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; @@ -11476,7 +11568,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 128).constraint); + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 129).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -11526,13 +11618,13 @@ var ts; while (!ts.forEach(typeParameterSymbol.declarations, function (d) { return d.parent === currentNode.parent; })) { currentNode = currentNode.parent; } - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 128; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 129; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 141 && n.typeName.kind === 65) { + if (n.kind === 142 && n.typeName.kind === 65) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056, undefined, undefined); @@ -11551,18 +11643,12 @@ var ts; check(typeParameter.constraint); } } - function getTypeFromTypeReference(node) { - return getTypeFromTypeReferenceOrHeritageClauseElement(node); - } - function getTypeFromHeritageClauseElement(node) { - return getTypeFromTypeReferenceOrHeritageClauseElement(node); - } - function getTypeFromTypeReferenceOrHeritageClauseElement(node) { + function getTypeFromTypeReferenceOrExpressionWithTypeArguments(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var type; - if (node.kind !== 177 || ts.isSupportedHeritageClauseElement(node)) { - var typeNameOrExpression = node.kind === 141 + if (node.kind !== 177 || ts.isSupportedExpressionWithTypeArguments(node)) { + var typeNameOrExpression = node.kind === 142 ? node.typeName : node.expression; var symbol = resolveEntityName(typeNameOrExpression, 793056); @@ -11608,9 +11694,9 @@ var ts; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 201: case 202: - case 204: + case 203: + case 205: return declaration; } } @@ -11799,38 +11885,38 @@ var ts; switch (node.kind) { case 112: return anyType; - case 121: + case 122: return stringType; - case 119: + case 120: return numberType; case 113: return booleanType; - case 122: + case 123: return esSymbolType; case 99: return voidType; case 8: return getTypeFromStringLiteral(node); - case 141: - return getTypeFromTypeReference(node); - case 177: - return getTypeFromHeritageClauseElement(node); - case 144: - return getTypeFromTypeQueryNode(node); - case 146: - return getTypeFromArrayTypeNode(node); - case 147: - return getTypeFromTupleTypeNode(node); - case 148: - return getTypeFromUnionTypeNode(node); - case 149: - return getTypeFromTypeNode(node.type); case 142: - case 143: + return getTypeFromTypeReferenceOrExpressionWithTypeArguments(node); + case 177: + return getTypeFromTypeReferenceOrExpressionWithTypeArguments(node); case 145: + return getTypeFromTypeQueryNode(node); + case 147: + return getTypeFromArrayTypeNode(node); + case 148: + return getTypeFromTupleTypeNode(node); + case 149: + return getTypeFromUnionTypeNode(node); + case 150: + return getTypeFromTypeNode(node.type); + case 143: + case 144: + case 146: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 65: - case 126: + case 127: var symbol = getSymbolInfo(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: @@ -11981,27 +12067,27 @@ var ts; return type; } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 134 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 135 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 162: case 163: + case 164: return isContextSensitiveFunctionLikeDeclaration(node); - case 154: + case 155: return ts.forEach(node.properties, isContextSensitive); - case 153: + case 154: return ts.forEach(node.elements, isContextSensitive); - case 170: + case 171: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 169: + case 170: return node.operatorToken.kind === 49 && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 224: + case 225: return isContextSensitive(node.initializer); + case 135: case 134: - case 133: return isContextSensitiveFunctionLikeDeclaration(node); - case 161: + case 162: return isContextSensitive(node.expression); } return false; @@ -12775,22 +12861,22 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { + case 133: case 132: - case 131: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 129: + case 130: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 200: + case 201: + case 135: case 134: - case 133: - case 136: case 137: - case 162: + case 138: case 163: + case 164: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -13033,10 +13119,10 @@ var ts; function isInTypeQuery(node) { while (node) { switch (node.kind) { - case 144: + case 145: return true; case 65: - case 126: + case 127: node = node.parent; continue; default: @@ -13078,7 +13164,7 @@ var ts; function isAssignedInBinaryExpression(node) { if (node.operatorToken.kind >= 53 && node.operatorToken.kind <= 64) { var n = node.left; - while (n.kind === 161) { + while (n.kind === 162) { n = n.expression; } if (n.kind === 65 && getResolvedSymbol(n) === symbol) { @@ -13095,46 +13181,46 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 169: + case 170: return isAssignedInBinaryExpression(node); - case 198: - case 152: - return isAssignedInVariableDeclaration(node); - case 150: - case 151: + case 199: case 153: + return isAssignedInVariableDeclaration(node); + case 151: + case 152: case 154: case 155: case 156: case 157: case 158: - case 160: + case 159: case 161: - case 167: - case 164: + case 162: + case 168: case 165: case 166: - case 168: - case 170: - case 173: - case 179: + case 167: + case 169: + case 171: + case 174: case 180: - case 182: + case 181: case 183: case 184: case 185: case 186: case 187: case 188: - case 191: + case 189: case 192: case 193: - case 220: - case 221: case 194: + case 221: + case 222: case 195: case 196: - case 223: + case 197: + case 224: return ts.forEachChild(node, isAssignedIn); } return false; @@ -13170,17 +13256,17 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 183: + case 184: if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } break; - case 170: + case 171: if (child !== node.condition) { narrowedType = narrowType(type, node.condition, child === node.whenTrue); } break; - case 169: + case 170: if (child === node.right) { if (node.operatorToken.kind === 48) { narrowedType = narrowType(type, node.left, true); @@ -13190,14 +13276,14 @@ var ts; } } break; - case 227: - case 205: - case 200: - case 134: - case 133: - case 136: - case 137: + case 228: + case 206: + case 201: case 135: + case 134: + case 137: + case 138: + case 136: break loop; } if (narrowedType !== type) { @@ -13210,7 +13296,7 @@ var ts; } return type; function narrowTypeByEquality(type, expr, assumeTrue) { - if (expr.left.kind !== 165 || expr.right.kind !== 8) { + if (expr.left.kind !== 166 || expr.right.kind !== 8) { return type; } var left = expr.left; @@ -13283,9 +13369,9 @@ var ts; } function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 161: + case 162: return narrowType(type, expr.expression, assumeTrue); - case 169: + case 170: var operator = expr.operatorToken.kind; if (operator === 30 || operator === 31) { return narrowTypeByEquality(type, expr, assumeTrue); @@ -13300,7 +13386,7 @@ var ts; return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 167: + case 168: if (expr.operator === 46) { return narrowType(type, expr.operand, !assumeTrue); } @@ -13311,7 +13397,7 @@ var ts; } function checkIdentifier(node) { var symbol = getResolvedSymbol(node); - if (symbol === argumentsSymbol && ts.getContainingFunction(node).kind === 163 && languageVersion < 2) { + if (symbol === argumentsSymbol && ts.getContainingFunction(node).kind === 164 && languageVersion < 2) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } if (symbol.flags & 8388608 && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) { @@ -13335,15 +13421,15 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 || (symbol.flags & 2) === 0 || - symbol.valueDeclaration.parent.kind === 223) { + symbol.valueDeclaration.parent.kind === 224) { return; } var container = symbol.valueDeclaration; - while (container.kind !== 199) { + while (container.kind !== 200) { container = container.parent; } container = container.parent; - if (container.kind === 180) { + if (container.kind === 181) { container = container.parent; } var inFunction = isInsideFunction(node.parent, container); @@ -13360,9 +13446,9 @@ var ts; } } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 201 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 202 ? container.parent : undefined; getNodeLinks(node).flags |= 2; - if (container.kind === 132 || container.kind === 135) { + if (container.kind === 133 || container.kind === 136) { getNodeLinks(classNode).flags |= 4; } else { @@ -13372,36 +13458,36 @@ var ts; function checkThisExpression(node) { var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; - if (container.kind === 163) { + if (container.kind === 164) { container = ts.getThisContainer(container, false); needToCaptureLexicalThis = (languageVersion < 2); } switch (container.kind) { - case 205: - error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); + case 206: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 204: + case 205: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 135: + case 136: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; + case 133: case 132: - case 131: if (container.flags & 128) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 127: + case 128: 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 === 201 ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 202 ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -13410,15 +13496,15 @@ var ts; } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 129) { + if (n.kind === 130) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 157 && node.parent.expression === node; - var enclosingClass = ts.getAncestor(node, 201); + var isCallExpression = node.parent.kind === 158 && node.parent.expression === node; + var enclosingClass = ts.getAncestor(node, 202); var baseClass; if (enclosingClass && ts.getClassExtendsHeritageClauseElement(enclosingClass)) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); @@ -13434,31 +13520,31 @@ var ts; var canUseSuperExpression = false; var needToCaptureLexicalThis; if (isCallExpression) { - canUseSuperExpression = container.kind === 135; + canUseSuperExpression = container.kind === 136; } else { needToCaptureLexicalThis = false; - while (container && container.kind === 163) { + while (container && container.kind === 164) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } - if (container && container.parent && container.parent.kind === 201) { + if (container && container.parent && container.parent.kind === 202) { if (container.flags & 128) { canUseSuperExpression = - container.kind === 134 || - container.kind === 133 || - container.kind === 136 || - container.kind === 137; + container.kind === 135 || + container.kind === 134 || + container.kind === 137 || + container.kind === 138; } else { canUseSuperExpression = - container.kind === 134 || - container.kind === 133 || - container.kind === 136 || + container.kind === 135 || + container.kind === 134 || container.kind === 137 || + container.kind === 138 || + container.kind === 133 || container.kind === 132 || - container.kind === 131 || - container.kind === 135; + container.kind === 136; } } } @@ -13472,7 +13558,7 @@ var ts; getNodeLinks(node).flags |= 16; returnType = baseClass; } - if (container.kind === 135 && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 136 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); returnType = unknownType; } @@ -13482,7 +13568,7 @@ var ts; return returnType; } } - if (container && container.kind === 127) { + if (container && container.kind === 128) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { @@ -13520,7 +13606,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 129) { + if (declaration.kind === 130) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -13535,7 +13621,7 @@ var ts; function getContextualTypeForReturnExpression(node) { var func = ts.getContainingFunction(node); if (func) { - if (func.type || func.kind === 135 || func.kind === 136 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 137))) { + if (func.type || func.kind === 136 || func.kind === 137 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 138))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(func)); } var signature = getContextualSignatureForFunctionLikeDeclaration(func); @@ -13555,7 +13641,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 159) { + if (template.parent.kind === 160) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -13663,32 +13749,32 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 198: - case 129: + case 199: + case 130: + case 133: case 132: - case 131: - case 152: - return getContextualTypeForInitializerExpression(node); - case 163: - case 191: - return getContextualTypeForReturnExpression(node); - case 157: - case 158: - return getContextualTypeForArgument(parent, node); - case 160: - return getTypeFromTypeNode(parent.type); - case 169: - return getContextualTypeForBinaryOperand(node); - case 224: - return getContextualTypeForObjectLiteralElement(parent); case 153: - return getContextualTypeForElementExpression(node); - case 170: - return getContextualTypeForConditionalOperand(node); - case 176: - ts.Debug.assert(parent.parent.kind === 171); - return getContextualTypeForSubstitutionExpression(parent.parent, node); + return getContextualTypeForInitializerExpression(node); + case 164: + case 192: + return getContextualTypeForReturnExpression(node); + case 158: + case 159: + return getContextualTypeForArgument(parent, node); case 161: + return getTypeFromTypeNode(parent.type); + case 170: + return getContextualTypeForBinaryOperand(node); + case 225: + return getContextualTypeForObjectLiteralElement(parent); + case 154: + return getContextualTypeForElementExpression(node); + case 171: + return getContextualTypeForConditionalOperand(node); + case 178: + ts.Debug.assert(parent.parent.kind === 172); + return getContextualTypeForSubstitutionExpression(parent.parent, node); + case 162: return getContextualType(parent); } return undefined; @@ -13703,13 +13789,13 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 162 || node.kind === 163; + return node.kind === 163 || node.kind === 164; } function getContextualSignatureForFunctionLikeDeclaration(node) { return isFunctionExpressionOrArrowFunction(node) ? getContextualSignature(node) : undefined; } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 134 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 135 || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); @@ -13753,13 +13839,13 @@ var ts; } function isAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 169 && parent.operatorToken.kind === 53 && parent.left === node) { + if (parent.kind === 170 && parent.operatorToken.kind === 53 && parent.left === node) { return true; } - if (parent.kind === 224) { + if (parent.kind === 225) { return isAssignmentTarget(parent.parent); } - if (parent.kind === 153) { + if (parent.kind === 154) { return isAssignmentTarget(parent); } return false; @@ -13778,7 +13864,7 @@ var ts; var inDestructuringPattern = isAssignmentTarget(node); for (var _i = 0; _i < elements.length; _i++) { var e = elements[_i]; - if (inDestructuringPattern && e.kind === 173) { + if (inDestructuringPattern && e.kind === 174) { var restArrayType = checkExpression(e.expression, contextualMapper); var restElementType = getIndexTypeOfType(restArrayType, 1) || (languageVersion >= 2 ? checkIteratedType(restArrayType, undefined) : undefined); @@ -13790,7 +13876,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 173; + hasSpreadElement = hasSpreadElement || e.kind === 174; } if (!hasSpreadElement) { var contextualType = getContextualType(node); @@ -13801,7 +13887,7 @@ var ts; return createArrayType(getUnionType(elementTypes)); } function isNumericName(name) { - return name.kind === 127 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 128 ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { return allConstituentTypesHaveKind(checkComputedPropertyName(name), 1 | 132); @@ -13831,18 +13917,18 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 224 || - memberDecl.kind === 225 || + if (memberDecl.kind === 225 || + memberDecl.kind === 226 || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 224) { + if (memberDecl.kind === 225) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 134) { + else if (memberDecl.kind === 135) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 225); + ts.Debug.assert(memberDecl.kind === 226); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; @@ -13857,7 +13943,7 @@ var ts; member = prop; } else { - ts.Debug.assert(memberDecl.kind === 136 || memberDecl.kind === 137); + ts.Debug.assert(memberDecl.kind === 137 || memberDecl.kind === 138); checkAccessorDeclaration(memberDecl); } if (!ts.hasDynamicName(memberDecl)) { @@ -13890,7 +13976,7 @@ var ts; } } function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 132; + return s.valueDeclaration ? s.valueDeclaration.kind : 133; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 ? 16 | 128 : 0; @@ -13900,7 +13986,7 @@ var ts; if (!(flags & (32 | 64))) { return; } - var enclosingClassDeclaration = ts.getAncestor(node, 201); + var enclosingClassDeclaration = ts.getAncestor(node, 202); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); if (flags & 32) { @@ -13947,7 +14033,7 @@ var ts; } getNodeLinks(node).resolvedSymbol = prop; if (prop.parent && prop.parent.flags & 32) { - if (left.kind === 91 && getDeclarationKindFromSymbol(prop) !== 134) { + if (left.kind === 91 && getDeclarationKindFromSymbol(prop) !== 135) { error(right, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); } else { @@ -13959,14 +14045,14 @@ var ts; return anyType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 155 + var left = node.kind === 156 ? 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 === 91 && getDeclarationKindFromSymbol(prop) !== 134) { + if (left.kind === 91 && getDeclarationKindFromSymbol(prop) !== 135) { return false; } else { @@ -13981,7 +14067,7 @@ var ts; function checkIndexedAccess(node) { if (!node.argumentExpression) { var sourceFile = getSourceFile(node); - if (node.parent.kind === 158 && node.parent.expression === node) { + if (node.parent.kind === 159 && 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); @@ -14077,7 +14163,7 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 159) { + if (node.kind === 160) { checkExpression(node.template); } else { @@ -14130,7 +14216,7 @@ var ts; } function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { - if (args[i].kind === 173) { + if (args[i].kind === 174) { return i; } } @@ -14140,11 +14226,11 @@ var ts; var adjustedArgCount; var typeArguments; var callIsIncomplete; - if (node.kind === 159) { + if (node.kind === 160) { var tagExpression = node; adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 171) { + if (tagExpression.template.kind === 172) { var templateExpression = tagExpression.template; var lastSpan = ts.lastOrUndefined(templateExpression.templateSpans); ts.Debug.assert(lastSpan !== undefined); @@ -14159,7 +14245,7 @@ var ts; else { var callExpression = node; if (!callExpression.arguments) { - ts.Debug.assert(callExpression.kind === 158); + ts.Debug.assert(callExpression.kind === 159); return signature.minArgumentCount === 0; } adjustedArgCount = callExpression.arguments.hasTrailingComma ? args.length + 1 : args.length; @@ -14211,10 +14297,10 @@ var ts; } for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 175) { + if (arg.kind !== 176) { var paramType = getTypeAtPosition(signature, i); var argType = void 0; - if (i === 0 && args[i].parent.kind === 159) { + if (i === 0 && args[i].parent.kind === 160) { argType = globalTemplateStringsArrayType; } else { @@ -14254,9 +14340,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 !== 175) { + if (arg.kind !== 176) { var paramType = getTypeAtPosition(signature, i); - var argType = i === 0 && node.kind === 159 + var argType = i === 0 && node.kind === 160 ? globalTemplateStringsArrayType : arg.kind === 8 && !reportErrors ? getStringLiteralType(arg) @@ -14270,10 +14356,10 @@ var ts; } function getEffectiveCallArguments(node) { var args; - if (node.kind === 159) { + if (node.kind === 160) { var template = node.template; args = [template]; - if (template.kind === 171) { + if (template.kind === 172) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); @@ -14286,7 +14372,7 @@ var ts; } function getEffectiveTypeArguments(callExpression) { if (callExpression.expression.kind === 91) { - var containingClass = ts.getAncestor(callExpression, 201); + var containingClass = ts.getAncestor(callExpression, 202); var baseClassTypeNode = containingClass && ts.getClassExtendsHeritageClauseElement(containingClass); return baseClassTypeNode && baseClassTypeNode.typeArguments; } @@ -14295,7 +14381,7 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray) { - var isTaggedTemplate = node.kind === 159; + var isTaggedTemplate = node.kind === 160; var typeArguments; if (!isTaggedTemplate) { typeArguments = getEffectiveTypeArguments(node); @@ -14505,13 +14591,13 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 157) { + if (node.kind === 158) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 158) { + else if (node.kind === 159) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 159) { + else if (node.kind === 160) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } else { @@ -14526,12 +14612,12 @@ var ts; if (node.expression.kind === 91) { return voidType; } - if (node.kind === 158) { + if (node.kind === 159) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 135 && - declaration.kind !== 139 && - declaration.kind !== 143) { + declaration.kind !== 136 && + declaration.kind !== 140 && + declaration.kind !== 144) { if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -14578,7 +14664,7 @@ var ts; return unknownType; } var type; - if (func.body.kind !== 179) { + if (func.body.kind !== 180) { type = checkExpressionCached(func.body, contextualMapper); } else { @@ -14616,7 +14702,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 195); + return (body.statements.length === 1) && (body.statements[0].kind === 196); } function checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(func, returnType) { if (!produceDiagnostics) { @@ -14625,7 +14711,7 @@ var ts; if (returnType === voidType || returnType === anyType) { return; } - if (ts.nodeIsMissing(func.body) || func.body.kind !== 179) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 180) { return; } var bodyBlock = func.body; @@ -14638,9 +14724,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 !== 134 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 135 || ts.isObjectLiteralMethod(node)); var hasGrammarError = checkGrammarDeclarationNameInStrictMode(node) || checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 162) { + if (!hasGrammarError && node.kind === 163) { checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); } if (contextualMapper === identityMapper && isContextSensitive(node)) { @@ -14668,19 +14754,19 @@ var ts; checkSignatureDeclaration(node); } } - if (produceDiagnostics && node.kind !== 134 && node.kind !== 133) { + if (produceDiagnostics && node.kind !== 135 && node.kind !== 134) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 134 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 135 || ts.isObjectLiteralMethod(node)); if (node.type && !node.asteriskToken) { checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); } if (node.body) { - if (node.body.kind === 179) { + if (node.body.kind === 180) { checkSourceElement(node.body); } else { @@ -14710,13 +14796,13 @@ var ts; var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3) !== 0; } - case 155: { + case 156: { var symbol = findSymbol(n); return !symbol || symbol === unknownSymbol || (symbol.flags & ~8) !== 0; } - case 156: + case 157: return true; - case 161: + case 162: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -14725,11 +14811,11 @@ var ts; function isConstVariableReference(n) { switch (n.kind) { case 65: - case 155: { + case 156: { var symbol = findSymbol(n); return symbol && (symbol.flags & 3) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192) !== 0; } - case 156: { + case 157: { var index = n.argumentExpression; var symbol = findSymbol(n.expression); if (symbol && index && index.kind === 8) { @@ -14739,7 +14825,7 @@ var ts; } return false; } - case 161: + case 162: return isConstVariableReference(n.expression); default: return false; @@ -14864,7 +14950,7 @@ var ts; var properties = node.properties; for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 224 || p.kind === 225) { + if (p.kind === 225 || p.kind === 226) { var name_8 = p.name; var type = sourceType.flags & 1 ? sourceType : getTypeOfPropertyOfType(sourceType, name_8.text) || @@ -14888,8 +14974,8 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 175) { - if (e.kind !== 173) { + if (e.kind !== 176) { + if (e.kind !== 174) { var propName = "" + i; var type = sourceType.flags & 1 ? sourceType : isTupleLikeType(sourceType) @@ -14913,7 +14999,7 @@ var ts; } else { var restExpression = e.expression; - if (restExpression.kind === 169 && restExpression.operatorToken.kind === 53) { + if (restExpression.kind === 170 && restExpression.operatorToken.kind === 53) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -14926,14 +15012,14 @@ var ts; return sourceType; } function checkDestructuringAssignment(target, sourceType, contextualMapper) { - if (target.kind === 169 && target.operatorToken.kind === 53) { + if (target.kind === 170 && target.operatorToken.kind === 53) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 154) { + if (target.kind === 155) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 153) { + if (target.kind === 154) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -14950,7 +15036,7 @@ var ts; checkGrammarEvalOrArgumentsInStrictMode(node, node.left); } var operator = node.operatorToken.kind; - if (operator === 53 && (node.left.kind === 154 || node.left.kind === 153)) { + if (operator === 53 && (node.left.kind === 155 || node.left.kind === 154)) { return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); } var leftType = checkExpression(node.left, contextualMapper); @@ -15124,14 +15210,14 @@ var ts; return links.resolvedType; } function checkPropertyAssignment(node, contextualMapper) { - if (node.name.kind === 127) { + if (node.name.kind === 128) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); } function checkObjectLiteralMethod(node, contextualMapper) { checkGrammarMethod(node); - if (node.name.kind === 127) { + if (node.name.kind === 128) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -15158,7 +15244,7 @@ var ts; } function checkExpressionOrQualifiedName(node, contextualMapper) { var type; - if (node.kind == 126) { + if (node.kind == 127) { type = checkQualifiedName(node); } else { @@ -15166,9 +15252,9 @@ var ts; type = instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, contextualMapper); } if (isConstEnumObjectType(type)) { - var ok = (node.parent.kind === 155 && node.parent.expression === node) || - (node.parent.kind === 156 && node.parent.expression === node) || - ((node.kind === 65 || node.kind === 126) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 156 && node.parent.expression === node) || + (node.parent.kind === 157 && node.parent.expression === node) || + ((node.kind === 65 || node.kind === 127) && 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); } @@ -15194,54 +15280,54 @@ var ts; return booleanType; case 7: return checkNumericLiteral(node); - case 171: + case 172: return checkTemplateExpression(node); case 8: case 10: return stringType; case 9: return globalRegExpType; - case 153: - return checkArrayLiteral(node, contextualMapper); case 154: - return checkObjectLiteral(node, contextualMapper); + return checkArrayLiteral(node, contextualMapper); case 155: - return checkPropertyAccessExpression(node); + return checkObjectLiteral(node, contextualMapper); case 156: - return checkIndexedAccess(node); + return checkPropertyAccessExpression(node); case 157: + return checkIndexedAccess(node); case 158: - return checkCallExpression(node); case 159: - return checkTaggedTemplateExpression(node); + return checkCallExpression(node); case 160: - return checkTypeAssertion(node); + return checkTaggedTemplateExpression(node); case 161: - return checkExpression(node.expression, contextualMapper); - case 174: - return checkClassExpression(node); + return checkTypeAssertion(node); case 162: - case 163: - return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 165: - return checkTypeOfExpression(node); - case 164: - return checkDeleteExpression(node); - case 166: - return checkVoidExpression(node); - case 167: - return checkPrefixUnaryExpression(node); - case 168: - return checkPostfixUnaryExpression(node); - case 169: - return checkBinaryExpression(node, contextualMapper); - case 170: - return checkConditionalExpression(node, contextualMapper); - case 173: - return checkSpreadElementExpression(node, contextualMapper); + return checkExpression(node.expression, contextualMapper); case 175: + return checkClassExpression(node); + case 163: + case 164: + return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); + case 166: + return checkTypeOfExpression(node); + case 165: + return checkDeleteExpression(node); + case 167: + return checkVoidExpression(node); + case 168: + return checkPrefixUnaryExpression(node); + case 169: + return checkPostfixUnaryExpression(node); + case 170: + return checkBinaryExpression(node, contextualMapper); + case 171: + return checkConditionalExpression(node, contextualMapper); + case 174: + return checkSpreadElementExpression(node, contextualMapper); + case 176: return undefinedType; - case 172: + case 173: checkYieldExpression(node); return unknownType; } @@ -15270,7 +15356,7 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 112) { func = ts.getContainingFunction(node); - if (!(func.kind === 135 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 136 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -15282,12 +15368,12 @@ var ts; } } function checkSignatureDeclaration(node) { - if (node.kind === 140) { + if (node.kind === 141) { checkGrammarIndexSignature(node); } - else if (node.kind === 142 || node.kind === 200 || node.kind === 143 || - node.kind === 138 || node.kind === 135 || - node.kind === 139) { + else if (node.kind === 143 || node.kind === 201 || node.kind === 144 || + node.kind === 139 || node.kind === 136 || + node.kind === 140) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -15299,10 +15385,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 139: + case 140: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 138: + case 139: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -15311,7 +15397,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 202) { + if (node.kind === 203) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -15326,7 +15412,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 121: + case 122: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -15334,7 +15420,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 119: + case 120: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -15371,17 +15457,17 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 157 && n.expression.kind === 91; + return n.kind === 158 && n.expression.kind === 91; } function containsSuperCall(n) { if (isSuperCallExpression(n)) { return true; } switch (n.kind) { - case 162: - case 200: case 163: - case 154: return false; + case 201: + case 164: + case 155: return false; default: return ts.forEachChild(n, containsSuperCall); } } @@ -15389,12 +15475,12 @@ var ts; if (n.kind === 93) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 162 && n.kind !== 200) { + else if (n.kind !== 163 && n.kind !== 201) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 132 && + return n.kind === 133 && !(n.flags & 128) && !!n.initializer; } @@ -15404,7 +15490,7 @@ var ts; 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 !== 182 || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 183 || !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 { @@ -15420,13 +15506,13 @@ var ts; function checkAccessorDeclaration(node) { if (produceDiagnostics) { checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 136) { + if (node.kind === 137) { 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 === 136 ? 137 : 136; + var otherKind = node.kind === 137 ? 138 : 137; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 112) !== (otherAccessor.flags & 112))) { @@ -15450,15 +15536,15 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeReferenceInStrictMode(node.typeName); - return checkTypeReferenceOrHeritageClauseElement(node); + return checkTypeReferenceOrExpressionWithTypeArguments(node); } - function checkHeritageClauseElement(node) { - checkGrammarHeritageClauseElementInStrictMode(node.expression); - return checkTypeReferenceOrHeritageClauseElement(node); + function checkExpressionWithTypeArguments(node) { + checkGrammarExpressionWithTypeArgumentsInStrictMode(node.expression); + return checkTypeReferenceOrExpressionWithTypeArguments(node); } - function checkTypeReferenceOrHeritageClauseElement(node) { + function checkTypeReferenceOrExpressionWithTypeArguments(node) { checkGrammarTypeArguments(node, node.typeArguments); - var type = getTypeFromTypeReferenceOrHeritageClauseElement(node); + var type = getTypeFromTypeReferenceOrExpressionWithTypeArguments(node); if (type !== unknownType && node.typeArguments) { var len = node.typeArguments.length; for (var i = 0; i < len; i++) { @@ -15511,9 +15597,9 @@ var ts; return; } var signaturesToCheck; - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 202) { - ts.Debug.assert(signatureDeclarationNode.kind === 138 || signatureDeclarationNode.kind === 139); - var signatureKind = signatureDeclarationNode.kind === 138 ? 0 : 1; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 203) { + ts.Debug.assert(signatureDeclarationNode.kind === 139 || signatureDeclarationNode.kind === 140); + var signatureKind = signatureDeclarationNode.kind === 139 ? 0 : 1; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -15531,7 +15617,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 202 && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 203 && ts.isInAmbientContext(n)) { if (!(flags & 2)) { flags |= 1; } @@ -15604,7 +15690,7 @@ var ts; if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { - ts.Debug.assert(node.kind === 134 || node.kind === 133); + ts.Debug.assert(node.kind === 135 || node.kind === 134); 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_1, diagnostic); @@ -15631,11 +15717,11 @@ var ts; var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 202 || node.parent.kind === 145 || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 203 || node.parent.kind === 146 || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if (node.kind === 200 || node.kind === 134 || node.kind === 133 || node.kind === 135) { + if (node.kind === 201 || node.kind === 135 || node.kind === 134 || node.kind === 136) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -15732,16 +15818,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 202: + case 203: return 2097152; - case 205: + case 206: return d.name.kind === 8 || ts.getModuleInstanceState(d) !== 0 ? 4194304 | 1048576 : 4194304; - case 201: - case 204: + case 202: + case 205: return 2097152 | 1048576; - case 208: + case 209: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -15755,29 +15841,29 @@ var ts; var expression = node.expression; var exprType = checkExpression(expression); switch (node.parent.kind) { - case 201: + case 202: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); var classDecoratorType = instantiateSingleCallFunctionType(getGlobalClassDecoratorType(), [classConstructorType]); checkTypeAssignableTo(exprType, classDecoratorType, node); break; - case 132: + case 133: checkTypeAssignableTo(exprType, getGlobalPropertyDecoratorType(), node); break; - case 134: - case 136: + case 135: case 137: + case 138: var methodType = getTypeOfNode(node.parent); var methodDecoratorType = instantiateSingleCallFunctionType(getGlobalMethodDecoratorType(), [methodType]); checkTypeAssignableTo(exprType, methodDecoratorType, node); break; - case 129: + case 130: checkTypeAssignableTo(exprType, getGlobalParameterDecoratorType(), node); break; } } function checkTypeNodeAsExpression(node) { - if (node && node.kind === 141) { + if (node && node.kind === 142) { var type = getTypeFromTypeNode(node); var shouldCheckIfUnknownType = type === unknownType && compilerOptions.separateCompilation; if (!type || (!shouldCheckIfUnknownType && type.flags & (1048703 | 132 | 258))) { @@ -15790,19 +15876,19 @@ var ts; } function checkTypeAnnotationAsExpression(node) { switch (node.kind) { - case 132: + case 133: checkTypeNodeAsExpression(node.type); break; - case 129: + case 130: checkTypeNodeAsExpression(node.type); break; - case 134: - checkTypeNodeAsExpression(node.type); - break; - case 136: + case 135: checkTypeNodeAsExpression(node.type); break; case 137: + checkTypeNodeAsExpression(node.type); + break; + case 138: checkTypeNodeAsExpression(getSetAccessorTypeAnnotationNode(node)); break; } @@ -15822,24 +15908,24 @@ var ts; } if (compilerOptions.emitDecoratorMetadata) { switch (node.kind) { - case 201: + case 202: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 134: + case 135: checkParameterTypeAnnotationsAsExpressions(node); + case 138: case 137: - case 136: - case 132: - case 129: + case 133: + case 130: checkTypeAnnotationAsExpression(node); break; } } emitDecorate = true; - if (node.kind === 129) { + if (node.kind === 130) { emitParam = true; } ts.forEach(node.decorators, checkDecorator); @@ -15859,7 +15945,7 @@ var ts; checkGrammarDeclarationNameInStrictMode(node); checkDecorators(node); checkSignatureDeclaration(node); - if (node.name && node.name.kind === 127) { + if (node.name && node.name.kind === 128) { checkComputedPropertyName(node.name); } if (!ts.hasDynamicName(node)) { @@ -15884,11 +15970,11 @@ var ts; } } function checkBlock(node) { - if (node.kind === 179) { + if (node.kind === 180) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 206) { + if (ts.isFunctionBlock(node) || node.kind === 207) { checkFunctionExpressionBodies(node); } } @@ -15906,19 +15992,19 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 132 || - node.kind === 131 || + if (node.kind === 133 || + node.kind === 132 || + node.kind === 135 || node.kind === 134 || - node.kind === 133 || - node.kind === 136 || - node.kind === 137) { + node.kind === 137 || + node.kind === 138) { return false; } if (ts.isInAmbientContext(node)) { return false; } var root = getRootDeclaration(node); - if (root.kind === 129 && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 130 && ts.nodeIsMissing(root.parent.body)) { return false; } return true; @@ -15948,7 +16034,7 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "_super")) { return; } - var enclosingClass = ts.getAncestor(node, 201); + var enclosingClass = ts.getAncestor(node, 202); if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; } @@ -15966,12 +16052,12 @@ var ts; if (!needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) { return; } - if (node.kind === 205 && ts.getModuleInstanceState(node) !== 1) { + if (node.kind === 206 && ts.getModuleInstanceState(node) !== 1) { return; } var parent = getDeclarationContainer(node); - if (parent.kind === 227 && 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)); + if (parent.kind === 228 && ts.isExternalModule(parent)) { + error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } function checkVarDeclaredNamesNotShadowed(node) { @@ -15981,7 +16067,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 12288) !== 0 || isParameterDeclaration(node)) { return; } - if (node.kind === 198 && !node.initializer) { + if (node.kind === 199 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -15991,15 +16077,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 199); - var container = varDeclList.parent.kind === 180 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 200); + var container = varDeclList.parent.kind === 181 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 179 && ts.isFunctionLike(container.parent) || + (container.kind === 180 && ts.isFunctionLike(container.parent) || + container.kind === 207 || container.kind === 206 || - container.kind === 205 || - container.kind === 227); + container.kind === 228); if (!namesShareScope) { var name_9 = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name_9, name_9); @@ -16009,13 +16095,13 @@ var ts; } } function isParameterDeclaration(node) { - while (node.kind === 152) { + while (node.kind === 153) { node = node.parent.parent; } - return node.kind === 129; + return node.kind === 130; } function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind !== 129) { + if (getRootDeclaration(node).kind !== 130) { return; } var func = ts.getContainingFunction(node); @@ -16024,7 +16110,7 @@ var ts; if (n.kind === 65) { var referencedSymbol = getNodeLinks(n).resolvedSymbol; if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 129) { + if (referencedSymbol.valueDeclaration.kind === 130) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -16045,7 +16131,7 @@ var ts; checkGrammarDeclarationNameInStrictMode(node); checkDecorators(node); checkSourceElement(node.type); - if (node.name.kind === 127) { + if (node.name.kind === 128) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); @@ -16054,7 +16140,7 @@ var ts; if (ts.isBindingPattern(node.name)) { ts.forEach(node.name.elements, checkSourceElement); } - if (node.initializer && getRootDeclaration(node).kind === 129 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && getRootDeclaration(node).kind === 130 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -16082,9 +16168,9 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); } } - if (node.kind !== 132 && node.kind !== 131) { + if (node.kind !== 133 && node.kind !== 132) { checkExportsOnMergedDeclarations(node); - if (node.kind === 198 || node.kind === 152) { + if (node.kind === 199 || node.kind === 153) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -16113,7 +16199,7 @@ var ts; } function inBlockOrObjectLiteralExpression(node) { while (node) { - if (node.kind === 179 || node.kind === 154) { + if (node.kind === 180 || node.kind === 155) { return true; } node = node.parent; @@ -16141,12 +16227,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind == 199) { + if (node.initializer && node.initializer.kind == 200) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 199) { + if (node.initializer.kind === 200) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -16161,13 +16247,13 @@ var ts; } function checkForOfStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 199) { + if (node.initializer.kind === 200) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); - if (varExpr.kind === 153 || varExpr.kind === 154) { + if (varExpr.kind === 154 || varExpr.kind === 155) { checkDestructuringAssignment(varExpr, iteratedType || unknownType); } else { @@ -16182,7 +16268,7 @@ var ts; } function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); - if (node.initializer.kind === 199) { + if (node.initializer.kind === 200) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -16192,7 +16278,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 153 || varExpr.kind === 154) { + if (varExpr.kind === 154 || varExpr.kind === 155) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!allConstituentTypesHaveKind(leftType, 1 | 258)) { @@ -16353,7 +16439,7 @@ var ts; checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); } function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 136 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 137))); + return !!(node.kind === 137 && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 138))); } function checkReturnStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { @@ -16367,11 +16453,11 @@ var ts; if (func) { var returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); var exprType = checkExpressionCached(node.expression); - if (func.kind === 137) { + if (func.kind === 138) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } else { - if (func.kind === 135) { + if (func.kind === 136) { if (!isTypeAssignableTo(exprType, returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -16398,7 +16484,7 @@ var ts; var hasDuplicateDefaultClause = false; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 221 && !hasDuplicateDefaultClause) { + if (clause.kind === 222 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -16410,7 +16496,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 220) { + if (produceDiagnostics && clause.kind === 221) { var caseClause = clause; var caseType = checkExpression(caseClause.expression); if (!isTypeAssignableTo(expressionType, caseType)) { @@ -16427,7 +16513,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 194 && current.label.text === node.label.text) { + if (current.kind === 195 && 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; @@ -16491,7 +16577,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 === 201) { + if (type.flags & 1024 && type.symbol.valueDeclaration.kind === 202) { var classDeclaration = type.symbol.valueDeclaration; for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; @@ -16522,7 +16608,7 @@ var ts; return; } var errorNode; - if (prop.valueDeclaration.name.kind === 127 || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 128 || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -16573,7 +16659,7 @@ var ts; } function checkClassDeclaration(node) { checkGrammarDeclarationNameInStrictMode(node); - if (node.parent.kind !== 206 && node.parent.kind !== 227) { + if (node.parent.kind !== 207 && node.parent.kind !== 228) { grammarErrorOnNode(node, ts.Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration); } if (!node.name && !(node.flags & 256)) { @@ -16593,11 +16679,11 @@ var ts; var staticType = getTypeOfSymbol(symbol); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - if (!ts.isSupportedHeritageClauseElement(baseTypeNode)) { + if (!ts.isSupportedExpressionWithTypeArguments(baseTypeNode)) { error(baseTypeNode.expression, ts.Diagnostics.Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses); } emitExtends = emitExtends || !ts.isInAmbientContext(node); - checkHeritageClauseElement(baseTypeNode); + checkExpressionWithTypeArguments(baseTypeNode); } var baseTypes = getBaseTypes(type); if (baseTypes.length) { @@ -16618,12 +16704,12 @@ var ts; var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { ts.forEach(implementedTypeNodes, function (typeRefNode) { - if (!ts.isSupportedHeritageClauseElement(typeRefNode)) { + if (!ts.isSupportedExpressionWithTypeArguments(typeRefNode)) { error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); } - checkHeritageClauseElement(typeRefNode); + checkExpressionWithTypeArguments(typeRefNode); if (produceDiagnostics) { - var t = getTypeFromHeritageClauseElement(typeRefNode); + var t = getTypeFromTypeNode(typeRefNode); if (t !== unknownType) { var declaredType = (t.flags & 4096) ? t.target : t; if (declaredType.flags & (1024 | 2048)) { @@ -16703,7 +16789,7 @@ var ts; } } function isAccessor(kind) { - return kind === 136 || kind === 137; + return kind === 137 || kind === 138; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -16769,7 +16855,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 202); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 203); 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); @@ -16786,10 +16872,10 @@ var ts; } } ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) { - if (!ts.isSupportedHeritageClauseElement(heritageElement)) { + if (!ts.isSupportedExpressionWithTypeArguments(heritageElement)) { error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); } - checkHeritageClauseElement(heritageElement); + checkExpressionWithTypeArguments(heritageElement); }); ts.forEach(node.members, checkSourceElement); if (produceDiagnostics) { @@ -16810,7 +16896,7 @@ var ts; var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); ts.forEach(node.members, function (member) { - if (member.name.kind !== 127 && isNumericLiteralName(member.name.text)) { + if (member.name.kind !== 128 && isNumericLiteralName(member.name.text)) { error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); } var initializer = member.initializer; @@ -16846,7 +16932,7 @@ var ts; return evalConstant(initializer); function evalConstant(e) { switch (e.kind) { - case 167: + case 168: var value = evalConstant(e.operand); if (value === undefined) { return undefined; @@ -16857,7 +16943,7 @@ var ts; case 47: return ~value; } return undefined; - case 169: + case 170: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -16882,11 +16968,11 @@ var ts; return undefined; case 7: return +e.text; - case 161: + case 162: return evalConstant(e.expression); case 65: + case 157: case 156: - case 155: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType; @@ -16897,7 +16983,7 @@ var ts; } else { var expression; - if (e.kind === 156) { + if (e.kind === 157) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8) { return undefined; @@ -16914,7 +17000,7 @@ var ts; if (current.kind === 65) { break; } - else if (current.kind === 155) { + else if (current.kind === 156) { current = current.expression; } else { @@ -16971,7 +17057,7 @@ var ts; } var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 204) { + if (declaration.kind !== 205) { return false; } var enumDeclaration = declaration; @@ -16994,8 +17080,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 201 || - (declaration.kind === 200 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 202 || + (declaration.kind === 201 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -17033,13 +17119,13 @@ var ts; var firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (firstNonAmbientClassOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(firstNonAmbientClassOrFunc)) { - error(node.name, ts.Diagnostics.A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged); + error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged); } else if (node.pos < firstNonAmbientClassOrFunc.pos) { - error(node.name, ts.Diagnostics.A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); + error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 201); + var mergedClass = ts.getDeclarationOfKind(symbol, 202); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 2048; @@ -17047,10 +17133,10 @@ var ts; } if (node.name.kind === 8) { if (!isGlobalSourceFile(node.parent)) { - error(node.name, ts.Diagnostics.Ambient_external_modules_cannot_be_nested_in_other_modules); + error(node.name, ts.Diagnostics.Ambient_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); + error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); } } } @@ -17058,10 +17144,10 @@ var ts; } function getFirstIdentifier(node) { while (true) { - if (node.kind === 126) { + if (node.kind === 127) { node = node.left; } - else if (node.kind === 155) { + else if (node.kind === 156) { node = node.expression; } else { @@ -17077,15 +17163,15 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 227 && !inAmbientExternalModule) { - error(moduleName, node.kind === 215 ? - ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : - ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + var inAmbientExternalModule = node.parent.kind === 207 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 228 && !inAmbientExternalModule) { + error(moduleName, node.kind === 216 ? + ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : + ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; } if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { - error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); + error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); return false; } return true; @@ -17098,7 +17184,7 @@ var ts; (symbol.flags & 793056 ? 793056 : 0) | (symbol.flags & 1536 ? 1536 : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 217 ? + var message = node.kind === 218 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -17121,7 +17207,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 211) { + if (importClause.namedBindings.kind === 212) { checkImportBinding(importClause.namedBindings); } else { @@ -17166,15 +17252,15 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 206 && node.parent.parent.name.kind === 8; - if (node.parent.kind !== 227 && !inAmbientExternalModule) { - error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module); + var inAmbientExternalModule = node.parent.kind === 207 && node.parent.parent.name.kind === 8; + if (node.parent.kind !== 228 && !inAmbientExternalModule) { + error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } else { var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); if (moduleSymbol && moduleSymbol.exports["export="]) { - error(node.moduleSpecifier, ts.Diagnostics.External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); + error(node.moduleSpecifier, ts.Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); } } } @@ -17186,9 +17272,9 @@ var ts; } } function checkExportAssignment(node) { - var container = node.parent.kind === 227 ? node.parent : node.parent.parent; - if (container.kind === 205 && container.name.kind === 65) { - error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); + var container = node.parent.kind === 228 ? node.parent : node.parent.parent; + if (container.kind === 206 && container.name.kind === 65) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && (node.flags & 499)) { @@ -17201,15 +17287,20 @@ var ts; checkExpressionCached(node.expression); } checkExternalModuleExports(container); - if (node.isExportEquals && languageVersion >= 2) { - grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead); + if (node.isExportEquals && !ts.isInAmbientContext(node)) { + if (languageVersion >= 2) { + grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead); + } + else if (compilerOptions.module === 4) { + grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); + } } } function getModuleStatements(node) { - if (node.kind === 227) { + if (node.kind === 228) { return node.statements; } - if (node.kind === 205 && node.body.kind === 206) { + if (node.kind === 206 && node.body.kind === 207) { return node.body.statements; } return emptyArray; @@ -17238,163 +17329,162 @@ var ts; if (!node) return; switch (node.kind) { - case 128: - return checkTypeParameter(node); case 129: + return checkTypeParameter(node); + case 130: return checkParameter(node); + case 133: case 132: - case 131: return checkPropertyDeclaration(node); - case 142: case 143: - case 138: + case 144: case 139: - return checkSignatureDeclaration(node); case 140: return checkSignatureDeclaration(node); - case 134: - case 133: - return checkMethodDeclaration(node); - case 135: - return checkConstructorDeclaration(node); - case 136: - case 137: - return checkAccessorDeclaration(node); case 141: + return checkSignatureDeclaration(node); + case 135: + case 134: + return checkMethodDeclaration(node); + case 136: + return checkConstructorDeclaration(node); + case 137: + case 138: + return checkAccessorDeclaration(node); + case 142: return checkTypeReferenceNode(node); - case 144: - return checkTypeQuery(node); case 145: - return checkTypeLiteral(node); + return checkTypeQuery(node); case 146: - return checkArrayType(node); + return checkTypeLiteral(node); case 147: - return checkTupleType(node); + return checkArrayType(node); case 148: - return checkUnionType(node); + return checkTupleType(node); case 149: + return checkUnionType(node); + case 150: return checkSourceElement(node.type); - case 200: - return checkFunctionDeclaration(node); - case 179: - case 206: - return checkBlock(node); - case 180: - return checkVariableStatement(node); - case 182: - return checkExpressionStatement(node); - case 183: - return checkIfStatement(node); - case 184: - return checkDoStatement(node); - case 185: - return checkWhileStatement(node); - case 186: - return checkForStatement(node); - case 187: - return checkForInStatement(node); - case 188: - return checkForOfStatement(node); - case 189: - case 190: - return checkBreakOrContinueStatement(node); - case 191: - return checkReturnStatement(node); - case 192: - return checkWithStatement(node); - case 193: - return checkSwitchStatement(node); - case 194: - return checkLabeledStatement(node); - case 195: - return checkThrowStatement(node); - case 196: - return checkTryStatement(node); - case 198: - return checkVariableDeclaration(node); - case 152: - return checkBindingElement(node); case 201: - return checkClassDeclaration(node); - case 202: - return checkInterfaceDeclaration(node); - case 203: - return checkTypeAliasDeclaration(node); - case 204: - return checkEnumDeclaration(node); - case 205: - return checkModuleDeclaration(node); - case 209: - return checkImportDeclaration(node); - case 208: - return checkImportEqualsDeclaration(node); - case 215: - return checkExportDeclaration(node); - case 214: - return checkExportAssignment(node); + return checkFunctionDeclaration(node); + case 180: + case 207: + return checkBlock(node); case 181: - checkGrammarStatementInAmbientContext(node); - return; + return checkVariableStatement(node); + case 183: + return checkExpressionStatement(node); + case 184: + return checkIfStatement(node); + case 185: + return checkDoStatement(node); + case 186: + return checkWhileStatement(node); + case 187: + return checkForStatement(node); + case 188: + return checkForInStatement(node); + case 189: + return checkForOfStatement(node); + case 190: + case 191: + return checkBreakOrContinueStatement(node); + case 192: + return checkReturnStatement(node); + case 193: + return checkWithStatement(node); + case 194: + return checkSwitchStatement(node); + case 195: + return checkLabeledStatement(node); + case 196: + return checkThrowStatement(node); case 197: + return checkTryStatement(node); + case 199: + return checkVariableDeclaration(node); + case 153: + return checkBindingElement(node); + case 202: + return checkClassDeclaration(node); + case 203: + return checkInterfaceDeclaration(node); + case 204: + return checkTypeAliasDeclaration(node); + case 205: + return checkEnumDeclaration(node); + case 206: + return checkModuleDeclaration(node); + case 210: + return checkImportDeclaration(node); + case 209: + return checkImportEqualsDeclaration(node); + case 216: + return checkExportDeclaration(node); + case 215: + return checkExportAssignment(node); + case 182: checkGrammarStatementInAmbientContext(node); return; - case 218: + case 198: + checkGrammarStatementInAmbientContext(node); + return; + case 219: return checkMissingDeclaration(node); } } function checkFunctionExpressionBodies(node) { switch (node.kind) { - case 162: case 163: + case 164: ts.forEach(node.parameters, checkFunctionExpressionBodies); checkFunctionExpressionOrObjectLiteralMethodBody(node); break; + case 135: case 134: - case 133: ts.forEach(node.parameters, checkFunctionExpressionBodies); if (ts.isObjectLiteralMethod(node)) { checkFunctionExpressionOrObjectLiteralMethodBody(node); } break; - case 135: case 136: case 137: - case 200: + case 138: + case 201: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 192: + case 193: checkFunctionExpressionBodies(node.expression); break; - case 129: + case 130: + case 133: case 132: - case 131: - case 150: case 151: case 152: case 153: case 154: - case 224: case 155: + case 225: case 156: case 157: case 158: case 159: - case 171: - case 176: case 160: + case 172: + case 178: case 161: - case 165: + case 162: case 166: - case 164: case 167: + case 165: case 168: case 169: case 170: - case 173: - case 179: - case 206: + case 171: + case 174: case 180: - case 182: + case 207: + case 181: case 183: case 184: case 185: @@ -17404,21 +17494,22 @@ var ts; case 189: case 190: case 191: - case 193: - case 207: - case 220: - case 221: + case 192: case 194: + case 208: + case 221: + case 222: case 195: case 196: - case 223: - case 198: + case 197: + case 224: case 199: - case 201: - case 204: - case 226: - case 214: + case 200: + case 202: + case 205: case 227: + case 215: + case 228: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -17478,7 +17569,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 192 && node.parent.statement === node) { + if (node.parent.kind === 193 && node.parent.statement === node) { return true; } node = node.parent; @@ -17500,23 +17591,23 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 227: + case 228: if (!ts.isExternalModule(location)) { break; } - case 205: + case 206: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 204: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 201: case 202: + case 203: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; - case 162: + case 163: if (location.name) { copySymbol(location.symbol, meaning); } @@ -17552,22 +17643,22 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 227: + case 228: if (!ts.isExternalModule(location)) break; - case 205: + case 206: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); break; - case 204: + case 205: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 201: case 202: + case 203: if (!(memberFlags & 128)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056); } break; - case 162: + case 163: if (location.name) { copySymbol(location.symbol, meaning); } @@ -17586,104 +17677,104 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 128: - case 201: + case 129: case 202: case 203: case 204: + case 205: return true; } } function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 126) { + while (node.parent && node.parent.kind === 127) { node = node.parent; } - return node.parent && node.parent.kind === 141; + return node.parent && node.parent.kind === 142; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 155) { + while (node.parent && node.parent.kind === 156) { node = node.parent; } return node.parent && node.parent.kind === 177; } function isTypeNode(node) { - if (141 <= node.kind && node.kind <= 149) { + if (142 <= node.kind && node.kind <= 150) { return true; } switch (node.kind) { case 112: - case 119: - case 121: - case 113: + case 120: case 122: + case 113: + case 123: return true; case 99: - return node.parent.kind !== 166; + return node.parent.kind !== 167; case 8: - return node.parent.kind === 129; + return node.parent.kind === 130; case 177: return true; case 65: - if (node.parent.kind === 126 && node.parent.right === node) { + if (node.parent.kind === 127 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 155 && node.parent.name === node) { + else if (node.parent.kind === 156 && node.parent.name === node) { node = node.parent; } - case 126: - case 155: - ts.Debug.assert(node.kind === 65 || node.kind === 126 || node.kind === 155, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + case 127: + case 156: + ts.Debug.assert(node.kind === 65 || node.kind === 127 || node.kind === 156, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); var parent_5 = node.parent; - if (parent_5.kind === 144) { + if (parent_5.kind === 145) { return false; } - if (141 <= parent_5.kind && parent_5.kind <= 149) { + if (142 <= parent_5.kind && parent_5.kind <= 150) { return true; } switch (parent_5.kind) { case 177: return true; - case 128: - return node === parent_5.constraint; - case 132: - case 131: case 129: - case 198: + return node === parent_5.constraint; + case 133: + case 132: + case 130: + case 199: return node === parent_5.type; - case 200: - case 162: + case 201: case 163: + case 164: + case 136: case 135: case 134: - case 133: - case 136: case 137: - return node === parent_5.type; case 138: + return node === parent_5.type; case 139: case 140: + case 141: return node === parent_5.type; - case 160: + case 161: return node === parent_5.type; - case 157: case 158: - return parent_5.typeArguments && ts.indexOf(parent_5.typeArguments, node) >= 0; case 159: + return parent_5.typeArguments && ts.indexOf(parent_5.typeArguments, node) >= 0; + case 160: return false; } } return false; } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 126) { + while (nodeOnRightSide.parent.kind === 127) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 208) { + if (nodeOnRightSide.parent.kind === 209) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 214) { + if (nodeOnRightSide.parent.kind === 215) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -17695,10 +17786,10 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 214) { + if (entityName.parent.kind === 215) { return resolveEntityName(entityName, 107455 | 793056 | 1536 | 8388608); } - if (entityName.kind !== 155) { + if (entityName.kind !== 156) { if (isInRightSideOfImportOrExportAssignment(entityName)) { return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); } @@ -17719,14 +17810,14 @@ var ts; var meaning = 107455 | 8388608; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 155) { + else if (entityName.kind === 156) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 126) { + else if (entityName.kind === 127) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -17735,7 +17826,7 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 141 ? 793056 : 1536; + var meaning = entityName.parent.kind === 142 ? 793056 : 1536; meaning |= 8388608; return resolveEntityName(entityName, meaning); } @@ -17749,14 +17840,14 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 65 && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 214 + return node.parent.kind === 215 ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } switch (node.kind) { case 65: - case 155: - case 126: + case 156: + case 127: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 93: case 91: @@ -17764,7 +17855,7 @@ var ts; return type.symbol; case 114: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 135) { + if (constructorDeclaration && constructorDeclaration.kind === 136) { return constructorDeclaration.parent.symbol; } return undefined; @@ -17772,12 +17863,12 @@ var ts; var moduleName; if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 209 || node.parent.kind === 215) && + ((node.parent.kind === 210 || node.parent.kind === 216) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } case 7: - if (node.parent.kind == 156 && node.parent.argumentExpression === node) { + if (node.parent.kind == 157 && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -17791,7 +17882,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 225) { + if (location && location.kind === 226) { return resolveEntityName(location.name, 107455); } return undefined; @@ -17865,7 +17956,7 @@ var ts; return [symbol]; } function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 227; + return symbol.flags & 512 && symbol.declarations.length === 1 && symbol.declarations[0].kind === 228; } function getAliasNameSubstitution(symbol, getGeneratedNameForNode) { if (languageVersion >= 2) { @@ -17873,7 +17964,7 @@ var ts; } var node = getDeclarationOfAliasSymbol(symbol); if (node) { - if (node.kind === 210) { + if (node.kind === 211) { var defaultKeyword; if (languageVersion === 0) { defaultKeyword = "[\"default\"]"; @@ -17883,7 +17974,7 @@ var ts; } return getGeneratedNameForNode(node.parent) + defaultKeyword; } - if (node.kind === 213) { + if (node.kind === 214) { var moduleName = getGeneratedNameForNode(node.parent.parent.parent); var propertyName = node.propertyName || node.name; return moduleName + "." + ts.unescapeIdentifier(propertyName.text); @@ -17892,7 +17983,7 @@ var ts; } function getExportNameSubstitution(symbol, location, getGeneratedNameForNode) { if (isExternalModuleSymbol(symbol.parent)) { - if (languageVersion >= 2) { + if (languageVersion >= 2 || compilerOptions.module === 4) { return undefined; } return "exports." + ts.unescapeIdentifier(symbol.name); @@ -17900,7 +17991,7 @@ var ts; var node = location; var containerSymbol = getParentOfSymbol(symbol); while (node) { - if ((node.kind === 205 || node.kind === 204) && getSymbolOfNode(node) === containerSymbol) { + if ((node.kind === 206 || node.kind === 205) && getSymbolOfNode(node) === containerSymbol) { return getGeneratedNameForNode(node) + "." + ts.unescapeIdentifier(symbol.name); } node = node.parent; @@ -17923,22 +18014,22 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 208: - case 210: + case 209: case 211: - case 213: - case 217: + case 212: + case 214: + case 218: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 215: + case 216: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 214: + case 215: return node.expression && node.expression.kind === 65 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 227 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 228 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); @@ -17983,7 +18074,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 226) { + if (node.kind === 227) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -18014,7 +18105,7 @@ var ts; } } function serializeTypeReferenceNode(node, getGeneratedNameForNode) { - var type = getTypeFromTypeReference(node); + var type = getTypeFromTypeNode(node); if (type.flags & 16) { return "void 0"; } @@ -18051,26 +18142,26 @@ var ts; switch (node.kind) { case 99: return "void 0"; - case 149: + case 150: return serializeTypeNode(node.type, getGeneratedNameForNode); - case 142: case 143: + case 144: return "Function"; - case 146: case 147: + case 148: return "Array"; case 113: return "Boolean"; - case 121: + case 122: case 8: return "String"; - case 119: + case 120: return "Number"; - case 141: + case 142: return serializeTypeReferenceNode(node, getGeneratedNameForNode); - case 144: case 145: - case 148: + case 146: + case 149: case 112: break; default: @@ -18082,11 +18173,11 @@ var ts; } function serializeTypeOfNode(node, getGeneratedNameForNode) { switch (node.kind) { - case 201: return "Function"; - case 132: return serializeTypeNode(node.type, getGeneratedNameForNode); - case 129: return serializeTypeNode(node.type, getGeneratedNameForNode); - case 136: return serializeTypeNode(node.type, getGeneratedNameForNode); - case 137: return serializeTypeNode(getSetAccessorTypeAnnotationNode(node), getGeneratedNameForNode); + case 202: return "Function"; + case 133: return serializeTypeNode(node.type, getGeneratedNameForNode); + case 130: return serializeTypeNode(node.type, getGeneratedNameForNode); + case 137: return serializeTypeNode(node.type, getGeneratedNameForNode); + case 138: return serializeTypeNode(getSetAccessorTypeAnnotationNode(node), getGeneratedNameForNode); } if (ts.isFunctionLike(node)) { return "Function"; @@ -18096,7 +18187,7 @@ var ts; function serializeParameterTypesOfNode(node, getGeneratedNameForNode) { if (node) { var valueDeclaration; - if (node.kind === 201) { + if (node.kind === 202) { valueDeclaration = ts.getFirstConstructorWithBody(node); } else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { @@ -18111,10 +18202,10 @@ var ts; for (var i = 0; i < parameterCount; i++) { if (parameters[i].dotDotDotToken) { var parameterType = parameters[i].type; - if (parameterType.kind === 146) { + if (parameterType.kind === 147) { parameterType = parameterType.elementType; } - else if (parameterType.kind === 141 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + else if (parameterType.kind === 142 && parameterType.typeArguments && parameterType.typeArguments.length === 1) { parameterType = parameterType.typeArguments[0]; } else { @@ -18160,15 +18251,21 @@ var ts; ts.Debug.assert(!ts.nodeIsSynthesized(location), "resolvesToSomeValue called with a synthesized location"); return !!resolveName(location, name, 107455, undefined, undefined); } + function getReferencedValueDeclaration(reference) { + ts.Debug.assert(!ts.nodeIsSynthesized(reference)); + var symbol = getNodeLinks(reference).resolvedSymbol || + resolveName(reference, reference.text, 107455 | 8388608, undefined, undefined); + return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration; + } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 152 || (n.parent.kind === 198 && n.parent.name === n); + var isVariableDeclarationOrBindingElement = n.parent.kind === 153 || (n.parent.kind === 199 && n.parent.name === n); var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 | 8388608, undefined, undefined); var isLetOrConst = symbol && (symbol.flags & 2) && - symbol.valueDeclaration.parent.kind !== 223; + symbol.valueDeclaration.parent.kind !== 224; if (isLetOrConst) { getSymbolLinks(symbol); return symbol.id; @@ -18205,6 +18302,7 @@ var ts; resolvesToSomeValue: resolvesToSomeValue, collectLinkedAliases: collectLinkedAliases, getBlockScopedVariableId: getBlockScopedVariableId, + getReferencedValueDeclaration: getReferencedValueDeclaration, serializeTypeOfNode: serializeTypeOfNode, serializeParameterTypesOfNode: serializeParameterTypesOfNode, serializeReturnTypeOfNode: serializeReturnTypeOfNode @@ -18250,10 +18348,10 @@ var ts; } function isReservedWordInStrictMode(node) { return (node.parserContextFlags & 1) && - (node.originalKeywordKind >= 102 && node.originalKeywordKind <= 110); + (102 <= node.originalKeywordKind && node.originalKeywordKind <= 110); } function reportStrictModeGrammarErrorInClassDeclaration(identifier, message, arg0, arg1, arg2) { - if (ts.getAncestor(identifier, 201) || ts.getAncestor(identifier, 174)) { + if (ts.getAncestor(identifier, 202) || ts.getAncestor(identifier, 175)) { return grammarErrorOnNode(identifier, message, arg0); } return false; @@ -18263,19 +18361,19 @@ var ts; var impotClause = node.importClause; if (impotClause.namedBindings) { var nameBindings = impotClause.namedBindings; - if (nameBindings.kind === 211) { + if (nameBindings.kind === 212) { var name_11 = nameBindings.name; - if (name_11.originalKeywordKind) { + if (isReservedWordInStrictMode(name_11)) { var nameText = ts.declarationNameToString(name_11); return grammarErrorOnNode(name_11, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); } } - else if (nameBindings.kind === 212) { + else if (nameBindings.kind === 213) { var reportError = false; for (var _i = 0, _a = nameBindings.elements; _i < _a.length; _i++) { var element = _a[_i]; var name_12 = element.name; - if (name_12.originalKeywordKind) { + if (isReservedWordInStrictMode(name_12)) { var nameText = ts.declarationNameToString(name_12); reportError = reportError || grammarErrorOnNode(name_12, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); } @@ -18291,20 +18389,20 @@ var ts; if (name && name.kind === 65 && isReservedWordInStrictMode(name)) { var nameText = ts.declarationNameToString(name); switch (node.kind) { + case 130: + case 199: + case 201: case 129: - case 198: - case 200: - case 128: - case 152: - case 202: + case 153: case 203: case 204: - return checkGrammarIdentifierInStrictMode(name); - case 201: - return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode, nameText); case 205: + return checkGrammarIdentifierInStrictMode(name); + case 202: + return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode, nameText); + case 206: return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); - case 208: + case 209: return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); } } @@ -18314,17 +18412,17 @@ var ts; if (typeName.kind === 65) { checkGrammarTypeNameInStrictMode(typeName); } - else if (typeName.kind === 126) { + else if (typeName.kind === 127) { checkGrammarTypeNameInStrictMode(typeName.right); checkGrammarTypeReferenceInStrictMode(typeName.left); } } - function checkGrammarHeritageClauseElementInStrictMode(expression) { + function checkGrammarExpressionWithTypeArgumentsInStrictMode(expression) { if (expression && expression.kind === 65) { return checkGrammarIdentifierInStrictMode(expression); } - else if (expression && expression.kind === 155) { - checkGrammarHeritageClauseElementInStrictMode(expression.expression); + else if (expression && expression.kind === 156) { + checkGrammarExpressionWithTypeArgumentsInStrictMode(expression.expression); } } function checkGrammarIdentifierInStrictMode(node, nameText) { @@ -18357,7 +18455,7 @@ var ts; else if (languageVersion < 1) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher); } - else if (node.kind === 136 || node.kind === 137) { + else if (node.kind === 137 || node.kind === 138) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -18367,26 +18465,26 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 136: case 137: - case 135: - case 132: - case 131: - case 134: + case 138: + case 136: case 133: - case 140: - case 201: + case 132: + case 135: + case 134: + case 141: case 202: - case 205: - case 204: - case 180: - case 200: case 203: + case 206: + case 205: + case 181: + case 201: + case 204: + case 210: case 209: - case 208: + case 216: case 215: - case 214: - case 129: + case 130: break; default: return false; @@ -18420,7 +18518,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 === 206 || node.parent.kind === 227) { + else if (node.parent.kind === 207 || node.parent.kind === 228) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -18429,10 +18527,10 @@ var ts; if (flags & 128) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 206 || node.parent.kind === 227) { + else if (node.parent.kind === 207 || node.parent.kind === 228) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } - else if (node.kind === 129) { + else if (node.kind === 130) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } flags |= 128; @@ -18445,10 +18543,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 === 201) { + else if (node.parent.kind === 202) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 129) { + else if (node.kind === 130) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; @@ -18457,13 +18555,13 @@ var ts; if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (node.parent.kind === 201) { + else if (node.parent.kind === 202) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 129) { + else if (node.kind === 130) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 206) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 207) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2; @@ -18471,7 +18569,7 @@ var ts; break; } } - if (node.kind === 135) { + if (node.kind === 136) { if (flags & 128) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -18482,13 +18580,13 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if ((node.kind === 209 || node.kind === 208) && flags & 2) { + else if ((node.kind === 210 || node.kind === 209) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 202 && flags & 2) { + else if (node.kind === 203 && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } - else if (node.kind === 129 && (flags & 112) && ts.isBindingPattern(node.name)) { + else if (node.kind === 130 && (flags & 112) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } } @@ -18551,7 +18649,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 163) { + if (node.kind === 164) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -18586,7 +18684,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 121 && parameter.type.kind !== 119) { + if (parameter.type.kind !== 122 && parameter.type.kind !== 120) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -18618,7 +18716,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0; _i < arguments.length; _i++) { var arg = arguments[_i]; - if (arg.kind === 175) { + if (arg.kind === 176) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -18689,11 +18787,11 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 127) { + if (node.kind !== 128) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 169 && computedPropertyName.expression.operatorToken.kind === 23) { + if (computedPropertyName.expression.kind === 170 && computedPropertyName.expression.operatorToken.kind === 23) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } @@ -18720,26 +18818,26 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_13 = prop.name; - if (prop.kind === 175 || - name_13.kind === 127) { + if (prop.kind === 176 || + name_13.kind === 128) { checkGrammarComputedPropertyName(name_13); continue; } var currentKind = void 0; - if (prop.kind === 224 || prop.kind === 225) { + if (prop.kind === 225 || prop.kind === 226) { checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_13.kind === 7) { checkGrammarNumericLiteral(name_13); } currentKind = Property; } - else if (prop.kind === 134) { + else if (prop.kind === 135) { currentKind = Property; } - else if (prop.kind === 136) { + else if (prop.kind === 137) { currentKind = GetAccessor; } - else if (prop.kind === 137) { + else if (prop.kind === 138) { currentKind = SetAccesor; } else { @@ -18773,24 +18871,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 199) { + if (forInOrOfStatement.initializer.kind === 200) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 187 + var diagnostic = forInOrOfStatement.kind === 188 ? 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 === 187 + var diagnostic = forInOrOfStatement.kind === 188 ? 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 === 187 + var diagnostic = forInOrOfStatement.kind === 188 ? 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); @@ -18813,10 +18911,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 136 && accessor.parameters.length) { + else if (kind === 137 && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 137) { + else if (kind === 138) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -18841,7 +18939,7 @@ var ts; } } function checkGrammarForNonSymbolComputedProperty(node, message) { - if (node.kind === 127 && !ts.isWellKnownSymbolSyntactically(node.expression)) { + if (node.kind === 128 && !ts.isWellKnownSymbolSyntactically(node.expression)) { return grammarErrorOnNode(node, message); } } @@ -18851,7 +18949,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 154) { + if (node.parent.kind === 155) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -18859,7 +18957,7 @@ var ts; return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } - if (node.parent.kind === 201) { + if (node.parent.kind === 202) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -18870,22 +18968,22 @@ var ts; 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 === 202) { + else if (node.parent.kind === 203) { 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 === 145) { + else if (node.parent.kind === 146) { 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 186: case 187: case 188: - case 184: + case 189: case 185: + case 186: return true; - case 194: + case 195: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -18897,9 +18995,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 194: + case 195: if (node.label && current.label.text === node.label.text) { - var isMisplacedContinueLabel = node.kind === 189 + var isMisplacedContinueLabel = node.kind === 190 && !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); @@ -18907,8 +19005,8 @@ var ts; return false; } break; - case 193: - if (node.kind === 190 && !node.label) { + case 194: + if (node.kind === 191 && !node.label) { return false; } break; @@ -18921,13 +19019,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 190 + var message = node.kind === 191 ? 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 === 190 + var message = node.kind === 191 ? 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); @@ -18939,7 +19037,7 @@ var ts; if (node !== elements[elements.length - 1]) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 151 || node.name.kind === 150) { + if (node.name.kind === 152 || node.name.kind === 151) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -18949,7 +19047,7 @@ var ts; return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 187 && node.parent.parent.kind !== 188) { + if (node.parent.parent.kind !== 188 && node.parent.parent.kind !== 189) { if (ts.isInAmbientContext(node)) { if (node.initializer) { var equalsTokenLength = "=".length; @@ -18979,7 +19077,7 @@ var ts; var elements = name.elements; for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; - if (element.kind !== 175) { + if (element.kind !== 176) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -18996,15 +19094,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 183: case 184: case 185: - case 192: case 186: + case 193: case 187: case 188: + case 189: return false; - case 194: + case 195: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -19020,7 +19118,7 @@ var ts; } } function isIntegerLiteral(expression) { - if (expression.kind === 167) { + if (expression.kind === 168) { var unaryExpression = expression; if (unaryExpression.operator === 33 || unaryExpression.operator === 34) { expression = unaryExpression.operand; @@ -19039,7 +19137,7 @@ var ts; var inAmbientContext = ts.isInAmbientContext(enumDecl); for (var _i = 0, _a = enumDecl.members; _i < _a.length; _i++) { var node = _a[_i]; - if (node.name.kind === 127) { + if (node.name.kind === 128) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } else if (inAmbientContext) { @@ -19109,18 +19207,18 @@ var ts; } } function checkGrammarProperty(node) { - if (node.parent.kind === 201) { + if (node.parent.kind === 202) { 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 === 202) { + else if (node.parent.kind === 203) { 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 === 145) { + else if (node.parent.kind === 146) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -19130,11 +19228,11 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 202 || + if (node.kind === 203 || + node.kind === 210 || node.kind === 209 || - node.kind === 208 || + node.kind === 216 || node.kind === 215 || - node.kind === 214 || (node.flags & 2) || (node.flags & (1 | 256))) { return false; @@ -19144,7 +19242,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 180) { + if (ts.isDeclaration(decl) || decl.kind === 181) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -19163,7 +19261,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 179 || node.parent.kind === 206 || node.parent.kind === 227) { + if (node.parent.kind === 180 || node.parent.kind === 207 || node.parent.kind === 228) { var links_1 = getNodeLinks(node.parent); if (!links_1.hasReportedStatementInAmbientContext) { return links_1.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -19244,7 +19342,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 209); + ts.Debug.assert(aliasEmitInfo.node.kind === 210); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -19317,10 +19415,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 198) { + if (declaration.kind === 199) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 212 || declaration.kind === 213 || declaration.kind === 210) { + else if (declaration.kind === 213 || declaration.kind === 214 || declaration.kind === 211) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -19331,7 +19429,7 @@ var ts; moduleElementEmitInfo = ts.forEach(asynchronousSubModuleDeclarationEmitInfo, function (declEmitInfo) { return declEmitInfo.node === nodeToCheck ? declEmitInfo : undefined; }); } if (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 209) { + if (moduleElementEmitInfo.node.kind === 210) { moduleElementEmitInfo.isVisible = true; } else { @@ -19339,12 +19437,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 205) { + if (nodeToCheck.kind === 206) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 205) { + if (nodeToCheck.kind === 206) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -19432,39 +19530,39 @@ var ts; function emitType(type) { switch (type.kind) { case 112: - case 121: - case 119: - case 113: case 122: + case 120: + case 113: + case 123: case 99: case 8: return writeTextOfNode(currentSourceFile, type); case 177: - return emitHeritageClauseElement(type); - case 141: - return emitTypeReference(type); - case 144: - return emitTypeQuery(type); - case 146: - return emitArrayType(type); - case 147: - return emitTupleType(type); - case 148: - return emitUnionType(type); - case 149: - return emitParenType(type); + return emitExpressionWithTypeArguments(type); case 142: - case 143: - return emitSignatureDeclarationWithJsDocComments(type); + return emitTypeReference(type); case 145: + return emitTypeQuery(type); + case 147: + return emitArrayType(type); + case 148: + return emitTupleType(type); + case 149: + return emitUnionType(type); + case 150: + return emitParenType(type); + case 143: + case 144: + return emitSignatureDeclarationWithJsDocComments(type); + case 146: return emitTypeLiteral(type); case 65: return emitEntityName(type); - case 126: + case 127: return emitEntityName(type); } function emitEntityName(entityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 208 ? entityName.parent : enclosingDeclaration); + var visibilityResult = resolver.isEntityNameVisible(entityName, entityName.parent.kind === 209 ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -19472,17 +19570,17 @@ var ts; writeTextOfNode(currentSourceFile, entityName); } else { - var left = entityName.kind === 126 ? entityName.left : entityName.expression; - var right = entityName.kind === 126 ? entityName.right : entityName.name; + var left = entityName.kind === 127 ? entityName.left : entityName.expression; + var right = entityName.kind === 127 ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentSourceFile, right); } } } - function emitHeritageClauseElement(node) { - if (ts.isSupportedHeritageClauseElement(node)) { - ts.Debug.assert(node.expression.kind === 65 || node.expression.kind === 155); + function emitExpressionWithTypeArguments(node) { + if (ts.isSupportedExpressionWithTypeArguments(node)) { + ts.Debug.assert(node.expression.kind === 65 || node.expression.kind === 156); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -19586,10 +19684,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 208 || - (node.parent.kind === 227 && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 209 || + (node.parent.kind === 228 && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 227) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 228) { asynchronousSubModuleDeclarationEmitInfo.push({ node: node, outputPos: writer.getTextPos(), @@ -19598,7 +19696,7 @@ var ts; }); } else { - if (node.kind === 209) { + if (node.kind === 210) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -19616,23 +19714,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 200: - return writeFunctionDeclaration(node); - case 180: - return writeVariableStatement(node); - case 202: - return writeInterfaceDeclaration(node); case 201: - return writeClassDeclaration(node); + return writeFunctionDeclaration(node); + case 181: + return writeVariableStatement(node); case 203: - return writeTypeAliasDeclaration(node); + return writeInterfaceDeclaration(node); + case 202: + return writeClassDeclaration(node); case 204: - return writeEnumDeclaration(node); + return writeTypeAliasDeclaration(node); case 205: + return writeEnumDeclaration(node); + case 206: return writeModuleDeclaration(node); - case 208: - return writeImportEqualsDeclaration(node); case 209: + return writeImportEqualsDeclaration(node); + case 210: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -19646,7 +19744,7 @@ var ts; if (node.flags & 256) { write("default "); } - else if (node.kind !== 202) { + else if (node.kind !== 203) { write("declare "); } } @@ -19690,7 +19788,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 211) { + if (namedBindings.kind === 212) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -19716,7 +19814,7 @@ var ts; if (currentWriterPos !== writer.getTextPos()) { write(", "); } - if (node.importClause.namedBindings.kind === 211) { + if (node.importClause.namedBindings.kind === 212) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -19767,7 +19865,7 @@ var ts; emitModuleElementDeclarationFlags(node); write("module "); writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 206) { + while (node.body.kind !== 207) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -19828,7 +19926,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 134 && (node.parent.flags & 32); + return node.parent.kind === 135 && (node.parent.flags & 32); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -19838,15 +19936,15 @@ var ts; writeTextOfNode(currentSourceFile, node.name); if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 142 || - node.parent.kind === 143 || - (node.parent.parent && node.parent.parent.kind === 145)) { - ts.Debug.assert(node.parent.kind === 134 || - node.parent.kind === 133 || - node.parent.kind === 142 || + if (node.parent.kind === 143 || + node.parent.kind === 144 || + (node.parent.parent && node.parent.parent.kind === 146)) { + ts.Debug.assert(node.parent.kind === 135 || + node.parent.kind === 134 || node.parent.kind === 143 || - node.parent.kind === 138 || - node.parent.kind === 139); + node.parent.kind === 144 || + node.parent.kind === 139 || + node.parent.kind === 140); emitType(node.constraint); } else { @@ -19856,31 +19954,31 @@ var ts; function getTypeParameterConstraintVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.parent.kind) { - case 201: + case 202: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 202: + case 203: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 139: + case 140: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 138: + case 139: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; + case 135: case 134: - case 133: 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 === 201) { + else if (node.parent.parent.kind === 202) { 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 200: + case 201: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -19905,12 +20003,12 @@ var ts; emitCommaList(typeReferences, emitTypeOfTypeReference); } function emitTypeOfTypeReference(node) { - if (ts.isSupportedHeritageClauseElement(node)) { + if (ts.isSupportedExpressionWithTypeArguments(node)) { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (node.parent.parent.kind === 201) { + if (node.parent.parent.kind === 202) { 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; @@ -19987,16 +20085,16 @@ var ts; writeLine(); } function emitVariableDeclaration(node) { - if (node.kind !== 198 || resolver.isDeclarationVisible(node)) { + if (node.kind !== 199 || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } else { writeTextOfNode(currentSourceFile, node.name); - if ((node.kind === 132 || node.kind === 131) && ts.hasQuestionToken(node)) { + if ((node.kind === 133 || node.kind === 132) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 132 || node.kind === 131) && node.parent.kind === 145) { + if ((node.kind === 133 || node.kind === 132) && node.parent.kind === 146) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 32)) { @@ -20005,14 +20103,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 198) { + if (node.kind === 199) { return 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 === 132 || node.kind === 131) { + else if (node.kind === 133 || node.kind === 132) { if (node.flags & 128) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -20020,7 +20118,7 @@ var ts; 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 === 201) { + else if (node.parent.kind === 202) { return 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 : @@ -20046,7 +20144,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 175) { + if (element.kind !== 176) { elements.push(element); } } @@ -20112,7 +20210,7 @@ var ts; accessorWithTypeAnnotation = node; var type = getTypeAnnotationFromAccessor(node); if (!type) { - var anotherAccessor = node.kind === 136 ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 137 ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -20125,7 +20223,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 136 + return accessor.kind === 137 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type @@ -20134,7 +20232,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 137) { + if (accessorWithTypeAnnotation.kind === 138) { 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 : @@ -20180,17 +20278,17 @@ var ts; } if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 200) { + if (node.kind === 201) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 134) { + else if (node.kind === 135) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 200) { + if (node.kind === 201) { write("function "); writeTextOfNode(currentSourceFile, node.name); } - else if (node.kind === 135) { + else if (node.kind === 136) { write("constructor"); } else { @@ -20207,11 +20305,11 @@ var ts; emitSignatureDeclaration(node); } function emitSignatureDeclaration(node) { - if (node.kind === 139 || node.kind === 143) { + if (node.kind === 140 || node.kind === 144) { write("new "); } emitTypeParameters(node.typeParameters); - if (node.kind === 140) { + if (node.kind === 141) { write("["); } else { @@ -20220,20 +20318,20 @@ var ts; var prevEnclosingDeclaration = enclosingDeclaration; enclosingDeclaration = node; emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 140) { + if (node.kind === 141) { write("]"); } else { write(")"); } - var isFunctionTypeOrConstructorType = node.kind === 142 || node.kind === 143; - if (isFunctionTypeOrConstructorType || node.parent.kind === 145) { + var isFunctionTypeOrConstructorType = node.kind === 143 || node.kind === 144; + if (isFunctionTypeOrConstructorType || node.parent.kind === 146) { if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 135 && !(node.flags & 32)) { + else if (node.kind !== 136 && !(node.flags & 32)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -20244,23 +20342,23 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 139: + case 140: 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 138: + case 139: 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 140: + case 141: 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 135: case 134: - case 133: if (node.flags & 128) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -20268,7 +20366,7 @@ var ts; 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 === 201) { + else if (node.parent.kind === 202) { 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 : @@ -20281,7 +20379,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 200: + case 201: 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 : @@ -20313,9 +20411,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 142 || - node.parent.kind === 143 || - node.parent.parent.kind === 145) { + if (node.parent.kind === 143 || + node.parent.kind === 144 || + node.parent.parent.kind === 146) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32)) { @@ -20331,22 +20429,22 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { - case 135: + case 136: return 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; - case 139: + case 140: return 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; - case 138: + case 139: return 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; + case 135: case 134: - case 133: if (node.parent.flags & 128) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 ? @@ -20354,7 +20452,7 @@ var ts; 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 === 201) { + else if (node.parent.parent.kind === 202) { return 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 : @@ -20366,7 +20464,7 @@ var ts; 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; } - case 200: + case 201: return 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 : @@ -20377,12 +20475,12 @@ var ts; } } function emitBindingPattern(bindingPattern) { - if (bindingPattern.kind === 150) { + if (bindingPattern.kind === 151) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 151) { + else if (bindingPattern.kind === 152) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -20401,10 +20499,10 @@ var ts; typeName: bindingElement.name } : undefined; } - if (bindingElement.kind === 175) { + if (bindingElement.kind === 176) { write(" "); } - else if (bindingElement.kind === 152) { + else if (bindingElement.kind === 153) { if (bindingElement.propertyName) { writeTextOfNode(currentSourceFile, bindingElement.propertyName); write(": "); @@ -20427,39 +20525,39 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 200: - case 205: - case 208: - case 202: case 201: - case 203: - case 204: - return emitModuleElement(node, isModuleElementVisible(node)); - case 180: - return emitModuleElement(node, isVariableStatementVisible(node)); + case 206: case 209: + case 203: + case 202: + case 204: + case 205: + return emitModuleElement(node, isModuleElementVisible(node)); + case 181: + return emitModuleElement(node, isVariableStatementVisible(node)); + case 210: return emitModuleElement(node, !node.importClause); - case 215: + case 216: return emitExportDeclaration(node); + case 136: case 135: case 134: - case 133: return writeFunctionDeclaration(node); - case 139: - case 138: case 140: + case 139: + case 141: return emitSignatureDeclarationWithJsDocComments(node); - case 136: case 137: + case 138: return emitAccessorDeclaration(node); + case 133: case 132: - case 131: return emitPropertyDeclaration(node); - case 226: - return emitEnumMemberDeclaration(node); - case 214: - return emitExportAssignment(node); case 227: + return emitEnumMemberDeclaration(node); + case 215: + return emitExportAssignment(node); + case 228: return emitSourceFile(node); } } @@ -20505,13 +20603,13 @@ var ts; } ts.isExternalModuleOrDeclarationFile = isExternalModuleOrDeclarationFile; function emitFiles(resolver, host, targetSourceFile) { - var extendsHelper = "\nvar __extends = this.__extends || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n __.prototype = b.prototype;\n d.prototype = new __();\n};"; - var decorateHelper = "\nif (typeof __decorate !== \"function\") __decorate = function (decorators, target, key, desc) {\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") return Reflect.decorate(decorators, target, key, desc);\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; - var metadataHelper = "\nif (typeof __metadata !== \"function\") __metadata = function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; - var paramHelper = "\nif (typeof __param !== \"function\") __param = function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; + var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n __.prototype = b.prototype;\n d.prototype = new __();\n};"; + var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") return Reflect.decorate(decorators, target, key, desc);\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; + var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; + var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0; - var sourceMapDataList = compilerOptions.sourceMap ? [] : undefined; + var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; var diagnostics = []; var newLine = host.getNewLine(); if (targetSourceFile === undefined) { @@ -20566,6 +20664,7 @@ var ts; var increaseIndent = writer.increaseIndent; var decreaseIndent = writer.decreaseIndent; var currentSourceFile; + var exportFunctionForFile; var generatedNameSet = {}; var nodeToGeneratedName = []; var blockScopedVariableToGeneratedName; @@ -20590,7 +20689,7 @@ var ts; var scopeEmitStart = function (scopeDeclaration, scopeName) { }; var scopeEmitEnd = function () { }; var sourceMapData; - if (compilerOptions.sourceMap) { + if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { initializeEmitterWithSourceMaps(); } if (root) { @@ -20608,6 +20707,7 @@ var ts; return; function emitSourceFile(sourceFile) { currentSourceFile = sourceFile; + exportFunctionForFile = undefined; emit(sourceFile); } function isUniqueName(name) { @@ -20684,25 +20784,25 @@ var ts; } function generateNameForNode(node) { switch (node.kind) { - case 200: case 201: - case 174: + case 202: + case 175: generateNameForFunctionOrClassDeclaration(node); break; - case 205: + case 206: generateNameForModuleOrEnum(node); generateNameForNode(node.body); break; - case 204: + case 205: generateNameForModuleOrEnum(node); break; - case 209: + case 210: generateNameForImportDeclaration(node); break; - case 215: + case 216: generateNameForExportDeclaration(node); break; - case 214: + case 215: generateNameForExportAssignment(node); break; } @@ -20828,6 +20928,12 @@ var ts; sourceMapData.sourceMapSources.push(ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, node.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, true)); sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; sourceMapData.inputSourceFileNames.push(node.fileName); + if (compilerOptions.inlineSources) { + if (!sourceMapData.sourceMapSourcesContent) { + sourceMapData.sourceMapSourcesContent = []; + } + sourceMapData.sourceMapSourcesContent.push(node.text); + } } function recordScopeNameOfNode(node, scopeName) { function recordScopeNameIndex(scopeNameIndex) { @@ -20839,7 +20945,7 @@ var ts; var parentIndex = getSourceMapNameIndex(); if (parentIndex !== -1) { var name_17 = node.name; - if (!name_17 || name_17.kind !== 127) { + if (!name_17 || name_17.kind !== 128) { scopeName = "." + scopeName; } scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; @@ -20856,18 +20962,18 @@ var ts; if (scopeName) { recordScopeNameStart(scopeName); } - else if (node.kind === 200 || - node.kind === 162 || + else if (node.kind === 201 || + node.kind === 163 || + node.kind === 135 || node.kind === 134 || - node.kind === 133 || - node.kind === 136 || node.kind === 137 || - node.kind === 205 || - node.kind === 201 || - node.kind === 204) { + node.kind === 138 || + node.kind === 206 || + node.kind === 202 || + node.kind === 205) { if (node.name) { var name_18 = node.name; - scopeName = name_18.kind === 127 + scopeName = name_18.kind === 128 ? ts.getTextOfNode(name_18) : node.name.text; } @@ -20886,18 +20992,22 @@ var ts; ts.writeCommentRange(currentSourceFile, writer, comment, newLine); recordSourceMapSpan(comment.end); } - function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings) { + function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { if (typeof JSON !== "undefined") { - return JSON.stringify({ + var map_1 = { version: version, file: file, sourceRoot: sourceRoot, sources: sources, names: names, mappings: mappings - }); + }; + if (sourcesContent !== undefined) { + map_1.sourcesContent = sourcesContent; + } + return JSON.stringify(map_1); } - return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\"}"; + return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; function serializeStringArray(list) { var output = ""; for (var i = 0, n = list.length; i < n; i++) { @@ -20911,9 +21021,18 @@ var ts; } function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { encodeLastRecordedSourceMapSpan(); - ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings), false); + var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); sourceMapDataList.push(sourceMapData); - writeJavaScriptFile(emitOutput + "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL, writeByteOrderMark); + var sourceMapUrl; + if (compilerOptions.inlineSourceMap) { + var base64SourceMapText = ts.convertToBase64(sourceMapText); + sourceMapUrl = "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText; + } + else { + ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, false); + sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; + } + writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); } var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); sourceMapData = { @@ -20925,6 +21044,7 @@ var ts; inputSourceFileNames: [], sourceMapNames: [], sourceMapMappings: "", + sourceMapSourcesContent: undefined, sourceMapDecodedMappings: [] }; sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); @@ -20952,7 +21072,7 @@ var ts; if (ts.nodeIsSynthesized(node)) { return emitNodeWithoutSourceMap(node, false); } - if (node.kind != 227) { + if (node.kind != 228) { recordEmitNodeStartSpan(node); emitNodeWithoutSourceMap(node, allowGeneratedIdentifiers); recordEmitNodeEndSpan(node); @@ -21125,7 +21245,7 @@ var ts; } function emitLiteral(node) { var text = getLiteralText(node); - if (compilerOptions.sourceMap && (node.kind === 8 || ts.isTemplateLiteralKind(node.kind))) { + if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 8 || ts.isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } else if (languageVersion < 2 && isBinaryOrOctalIntegerLiteral(node, text)) { @@ -21197,10 +21317,10 @@ var ts; emitParenthesizedIf(node.tag, needsParenthesisForPropertyAccessOrInvocation(node.tag)); write("("); emit(tempVariable); - if (node.template.kind === 171) { + if (node.template.kind === 172) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 169 + var needsParens = templateSpan.expression.kind === 170 && templateSpan.expression.operatorToken.kind === 23; emitParenthesizedIf(templateSpan.expression, needsParens); }); @@ -21224,7 +21344,7 @@ var ts; } for (var i = 0, n = node.templateSpans.length; i < n; i++) { var templateSpan = node.templateSpans[i]; - var needsParens = templateSpan.expression.kind !== 161 + var needsParens = templateSpan.expression.kind !== 162 && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1; if (i > 0 || headEmitted) { write(" + "); @@ -21257,11 +21377,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 157: case 158: - return parent.expression === template; case 159: - case 161: + return parent.expression === template; + case 160: + case 162: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1; @@ -21269,7 +21389,7 @@ var ts; } function comparePrecedenceToBinaryPlus(expression) { switch (expression.kind) { - case 169: + case 170: switch (expression.operatorToken.kind) { case 35: case 36: @@ -21281,8 +21401,8 @@ var ts; default: return -1; } - case 172: - case 170: + case 173: + case 171: return -1; default: return 1; @@ -21294,11 +21414,11 @@ var ts; emit(span.literal); } function emitExpressionForPropertyName(node) { - ts.Debug.assert(node.kind !== 152); + ts.Debug.assert(node.kind !== 153); if (node.kind === 8) { emitLiteral(node); } - else if (node.kind === 127) { + else if (node.kind === 128) { if (ts.nodeIsDecorated(node.parent)) { if (!computedPropertyNamesToGeneratedNames) { computedPropertyNamesToGeneratedNames = []; @@ -21329,36 +21449,36 @@ var ts; function isNotExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 129: - case 198: - case 152: + case 130: + case 199: + case 153: + case 133: case 132: - case 131: - case 224: case 225: case 226: + case 227: + case 135: case 134: - case 133: - case 200: - case 136: - case 137: - case 162: case 201: + case 137: + case 138: + case 163: case 202: - case 204: + case 203: case 205: - case 208: - case 210: + case 206: + case 209: case 211: + case 212: return parent.name === node; - case 213: - case 217: - return parent.name === node || parent.propertyName === node; - case 190: - case 189: case 214: + case 218: + return parent.name === node || parent.propertyName === node; + case 191: + case 190: + case 215: return false; - case 194: + case 195: return node.parent.label === node; } } @@ -21466,11 +21586,11 @@ var ts; function needsParenthesisForPropertyAccessOrInvocation(node) { switch (node.kind) { case 65: - case 153: - case 155: + case 154: case 156: case 157: - case 161: + case 158: + case 162: return false; } return true; @@ -21487,14 +21607,14 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 173) { + if (e.kind === 174) { e = e.expression; emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; } else { var i = pos; - while (i < length && elements[i].kind !== 173) { + while (i < length && elements[i].kind !== 174) { i++; } write("["); @@ -21515,7 +21635,7 @@ var ts; } } function isSpreadElementExpression(node) { - return node.kind === 173; + return node.kind === 174; } function emitArrayLiteral(node) { var elements = node.elements; @@ -21576,7 +21696,7 @@ var ts; writeComma(); var property = properties[i]; emitStart(property); - if (property.kind === 136 || property.kind === 137) { + if (property.kind === 137 || property.kind === 138) { var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property !== accessors.firstAccessor) { continue; @@ -21627,13 +21747,13 @@ var ts; emitMemberAccessForPropertyName(property.name); emitEnd(property.name); write(" = "); - if (property.kind === 224) { + if (property.kind === 225) { emit(property.initializer); } - else if (property.kind === 225) { + else if (property.kind === 226) { emitExpressionIdentifier(property.name); } - else if (property.kind === 134) { + else if (property.kind === 135) { emitFunctionDeclaration(property); } else { @@ -21665,7 +21785,7 @@ var ts; var numProperties = properties.length; var numInitialNonComputedProperties = numProperties; for (var i = 0, n = properties.length; i < n; i++) { - if (properties[i].name.kind === 127) { + if (properties[i].name.kind === 128) { numInitialNonComputedProperties = i; break; } @@ -21679,30 +21799,30 @@ var ts; emitObjectLiteralBody(node, properties.length); } function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(169, startsOnNewLine); + var result = ts.createSynthesizedNode(170, startsOnNewLine); result.operatorToken = ts.createSynthesizedNode(operator); result.left = left; result.right = right; return result; } function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(155); + var result = ts.createSynthesizedNode(156); result.expression = parenthesizeForAccess(expression); result.dotToken = ts.createSynthesizedNode(20); result.name = name; return result; } function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(156); + var result = ts.createSynthesizedNode(157); result.expression = parenthesizeForAccess(expression); result.argumentExpression = argumentExpression; return result; } function parenthesizeForAccess(expr) { - if (ts.isLeftHandSideExpression(expr) && expr.kind !== 158 && expr.kind !== 7) { + if (ts.isLeftHandSideExpression(expr) && expr.kind !== 159 && expr.kind !== 7) { return expr; } - var node = ts.createSynthesizedNode(161); + var node = ts.createSynthesizedNode(162); node.expression = expr; return node; } @@ -21751,7 +21871,7 @@ var ts; if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 155 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 156 ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; @@ -21799,10 +21919,10 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 173; }); + return ts.forEach(elements, function (e) { return e.kind === 174; }); } function skipParentheses(node) { - while (node.kind === 161 || node.kind === 160) { + while (node.kind === 162 || node.kind === 161) { node = node.expression; } return node; @@ -21823,12 +21943,12 @@ var ts; function emitCallWithSpread(node) { var target; var expr = skipParentheses(node.expression); - if (expr.kind === 155) { + if (expr.kind === 156) { target = emitCallTarget(expr.expression); write("."); emit(expr.name); } - else if (expr.kind === 156) { + else if (expr.kind === 157) { target = emitCallTarget(expr.expression); write("["); emit(expr.argumentExpression); @@ -21869,7 +21989,7 @@ var ts; } else { emit(node.expression); - superCall = node.expression.kind === 155 && node.expression.expression.kind === 91; + superCall = node.expression.kind === 156 && node.expression.expression.kind === 91; } if (superCall && languageVersion < 2) { write(".call("); @@ -21906,20 +22026,20 @@ var ts; } } function emitParenExpression(node) { - if (!node.parent || node.parent.kind !== 163) { - if (node.expression.kind === 160) { + if (!node.parent || node.parent.kind !== 164) { + if (node.expression.kind === 161) { var operand = node.expression.expression; - while (operand.kind == 160) { + while (operand.kind == 161) { operand = operand.expression; } - if (operand.kind !== 167 && + if (operand.kind !== 168 && + operand.kind !== 167 && operand.kind !== 166 && operand.kind !== 165 && - operand.kind !== 164 && - operand.kind !== 168 && - operand.kind !== 158 && - !(operand.kind === 157 && node.parent.kind === 158) && - !(operand.kind === 162 && node.parent.kind === 157)) { + operand.kind !== 169 && + operand.kind !== 159 && + !(operand.kind === 158 && node.parent.kind === 159) && + !(operand.kind === 163 && node.parent.kind === 158)) { emit(operand); return; } @@ -21944,9 +22064,25 @@ var ts; write(" "); emit(node.expression); } + function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { + if (!isCurrentFileSystemExternalModule() || node.kind !== 65 || ts.nodeIsSynthesized(node)) { + return false; + } + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 199 || node.parent.kind === 153); + var targetDeclaration = isVariableDeclarationOrBindingElement + ? node.parent + : resolver.getReferencedValueDeclaration(node); + return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, true); + } function emitPrefixUnaryExpression(node) { + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + } write(ts.tokenToString(node.operator)); - if (node.operand.kind === 167) { + if (node.operand.kind === 168) { var operand = node.operand; if (node.operator === 33 && (operand.operator === 33 || operand.operator === 38)) { write(" "); @@ -21956,23 +22092,73 @@ var ts; } } emit(node.operand); + if (exportChanged) { + write(")"); + } } function emitPostfixUnaryExpression(node) { - emit(node.operand); - write(ts.tokenToString(node.operator)); + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + write("(" + exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + write(ts.tokenToString(node.operator)); + emit(node.operand); + if (node.operator === 38) { + write(") - 1)"); + } + else { + write(") + 1)"); + } + } + else { + emit(node.operand); + write(ts.tokenToString(node.operator)); + } + } + function shouldHoistDeclarationInSystemJsModule(node) { + return isSourceFileLevelDeclarationInSystemJsModule(node, false); + } + function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) { + if (!node || languageVersion >= 2 || !isCurrentFileSystemExternalModule()) { + return false; + } + var current = node; + while (current) { + if (current.kind === 228) { + return !isExported || ((ts.getCombinedNodeFlags(node) & 1) !== 0); + } + else if (ts.isFunctionLike(current) || current.kind === 207) { + return false; + } + else { + current = current.parent; + } + } } function emitBinaryExpression(node) { if (languageVersion < 2 && node.operatorToken.kind === 53 && - (node.left.kind === 154 || node.left.kind === 153)) { - emitDestructuring(node, node.parent.kind === 182); + (node.left.kind === 155 || node.left.kind === 154)) { + emitDestructuring(node, node.parent.kind === 183); } else { + var exportChanged = node.operatorToken.kind >= 53 && + node.operatorToken.kind <= 64 && + isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.left); + write("\", "); + } emit(node.left); var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 23 ? " " : undefined); write(ts.tokenToString(node.operatorToken.kind)); var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); emit(node.right); decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); + if (exportChanged) { + write(")"); + } } } function synthesizedNodeStartsOnNewLine(node) { @@ -22000,7 +22186,7 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 179) { + if (node && node.kind === 180) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } @@ -22015,12 +22201,12 @@ var ts; emitToken(14, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 206) { - ts.Debug.assert(node.parent.kind === 205); + if (node.kind === 207) { + ts.Debug.assert(node.parent.kind === 206); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 206) { + if (node.kind === 207) { emitTempDeclarations(true); } decreaseIndent(); @@ -22029,7 +22215,7 @@ var ts; scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 179) { + if (node.kind === 180) { write(" "); emit(node); } @@ -22041,7 +22227,7 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, node.expression.kind === 163); + emitParenthesizedIf(node.expression, node.expression.kind === 164); write(";"); } function emitIfStatement(node) { @@ -22054,7 +22240,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(76, node.thenStatement.end); - if (node.elseStatement.kind === 183) { + if (node.elseStatement.kind === 184) { write(" "); emit(node.elseStatement); } @@ -22066,7 +22252,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 179) { + if (node.statement.kind === 180) { write(" "); } else { @@ -22082,7 +22268,10 @@ var ts; write(")"); emitEmbeddedStatement(node.statement); } - function emitStartOfVariableDeclarationList(decl, startPos) { + function tryEmitStartOfVariableDeclarationList(decl, startPos) { + if (shouldHoistVariable(decl, true)) { + return false; + } var tokenKind = 98; if (decl && languageVersion >= 2) { if (ts.isLet(decl)) { @@ -22094,28 +22283,53 @@ var ts; } if (startPos !== undefined) { emitToken(tokenKind, startPos); + write(" "); } else { switch (tokenKind) { case 98: - return write("var "); + write("var "); + break; case 104: - return write("let "); + write("let "); + break; case 70: - return write("const "); + write("const "); + break; } } + return true; + } + function emitVariableDeclarationListSkippingUninitializedEntries(list) { + var started = false; + for (var _a = 0, _b = list.declarations; _a < _b.length; _a++) { + var decl = _b[_a]; + if (!decl.initializer) { + continue; + } + if (!started) { + started = true; + } + else { + write(", "); + } + emit(decl); + } + return started; } function emitForStatement(node) { var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer && node.initializer.kind === 199) { + if (node.initializer && node.initializer.kind === 200) { var variableDeclarationList = node.initializer; - var declarations = variableDeclarationList.declarations; - emitStartOfVariableDeclarationList(declarations[0], endPos); - write(" "); - emitCommaList(declarations); + var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + if (startIsEmitted) { + emitCommaList(variableDeclarationList.declarations); + } + else { + emitVariableDeclarationListSkippingUninitializedEntries(variableDeclarationList); + } } else if (node.initializer) { emit(node.initializer); @@ -22128,25 +22342,23 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 && node.kind === 188) { + if (languageVersion < 2 && node.kind === 189) { return emitDownLevelForOfStatement(node); } var endPos = emitToken(82, node.pos); write(" "); endPos = emitToken(16, endPos); - if (node.initializer.kind === 199) { + if (node.initializer.kind === 200) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { - var decl = variableDeclarationList.declarations[0]; - emitStartOfVariableDeclarationList(decl, endPos); - write(" "); - emit(decl); + tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + emit(variableDeclarationList.declarations[0]); } } else { emit(node.initializer); } - if (node.kind === 187) { + if (node.kind === 188) { write(" in "); } else { @@ -22214,7 +22426,7 @@ var ts; increaseIndent(); var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 199) { + if (node.initializer.kind === 200) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -22236,7 +22448,7 @@ var ts; } else { var assignmentExpression = createBinaryExpression(node.initializer, 53, rhsIterationValue, false); - if (node.initializer.kind === 153 || node.initializer.kind === 154) { + if (node.initializer.kind === 154 || node.initializer.kind === 155) { emitDestructuring(assignmentExpression, true, undefined); } else { @@ -22245,7 +22457,7 @@ var ts; } emitEnd(node.initializer); write(";"); - if (node.statement.kind === 179) { + if (node.statement.kind === 180) { emitLines(node.statement.statements); } else { @@ -22257,7 +22469,7 @@ var ts; write("}"); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 190 ? 66 : 71, node.pos); + emitToken(node.kind === 191 ? 66 : 71, node.pos); emitOptional(" ", node.label); write(";"); } @@ -22302,7 +22514,7 @@ var ts; ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 220) { + if (node.kind === 221) { write("case "); emit(node.expression); write(":"); @@ -22357,7 +22569,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 205); + } while (node && node.kind !== 206); return node; } function emitContainingModuleName(node) { @@ -22372,7 +22584,7 @@ var ts; write(getGeneratedNameForNode(container)); write("."); } - else if (languageVersion < 2) { + else if (languageVersion < 2 && compilerOptions.module !== 4) { write("exports."); } } @@ -22382,7 +22594,7 @@ var ts; function createVoidZero() { var zero = ts.createSynthesizedNode(7); zero.text = "0"; - var result = ts.createSynthesizedNode(166); + var result = ts.createSynthesizedNode(167); result.expression = zero; return result; } @@ -22390,19 +22602,33 @@ var ts; if (node.flags & 1) { writeLine(); emitStart(node); - if (node.flags & 256) { - if (languageVersion === 0) { - write("exports[\"default\"]"); + if (compilerOptions.module === 4) { + write(exportFunctionForFile + "(\""); + if (node.flags & 256) { + write("default"); } else { - write("exports.default"); + emitNodeWithoutSourceMap(node.name); } + write("\", "); + emitDeclarationName(node); + write(")"); } else { - emitModuleMemberName(node); + if (node.flags & 256) { + if (languageVersion === 0) { + write("exports[\"default\"]"); + } + else { + write("exports.default"); + } + } + else { + emitModuleMemberName(node); + } + write(" = "); + emitDeclarationName(node); } - write(" = "); - emitDeclarationName(node); emitEnd(node); write(";"); } @@ -22412,21 +22638,40 @@ var ts; for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { var specifier = _b[_a]; writeLine(); - emitStart(specifier.name); - emitContainingModuleName(specifier); - write("."); - emitNodeWithoutSourceMap(specifier.name); - emitEnd(specifier.name); - write(" = "); - emitExpressionIdentifier(name); + if (compilerOptions.module === 4) { + emitStart(specifier.name); + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(specifier.name); + write("\", "); + emitExpressionIdentifier(name); + write(")"); + emitEnd(specifier.name); + } + else { + emitStart(specifier.name); + emitContainingModuleName(specifier); + write("."); + emitNodeWithoutSourceMap(specifier.name); + emitEnd(specifier.name); + write(" = "); + emitExpressionIdentifier(name); + } write(";"); } } } function emitDestructuring(root, isAssignmentExpressionStatement, value) { var emitCount = 0; - var isDeclaration = (root.kind === 198 && !(ts.getCombinedNodeFlags(root) & 1)) || root.kind === 129; - if (root.kind === 169) { + var canDefineTempVariablesInPlace = false; + if (root.kind === 199) { + var isExported = ts.getCombinedNodeFlags(root) & 1; + var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); + canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; + } + else if (root.kind === 130) { + canDefineTempVariablesInPlace = true; + } + if (root.kind === 170) { emitAssignmentExpression(root); } else { @@ -22438,7 +22683,14 @@ var ts; write(", "); } renameNonTopLevelLetAndConst(name); - if (name.parent && (name.parent.kind === 198 || name.parent.kind === 152)) { + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 199 || name.parent.kind === 153); + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(name); + write("\", "); + } + if (isVariableDeclarationOrBindingElement) { emitModuleMemberName(name.parent); } else { @@ -22446,11 +22698,14 @@ var ts; } write(" = "); emit(value); + if (exportChanged) { + write(")"); + } } function ensureIdentifier(expr) { if (expr.kind !== 65) { var identifier = createTempVariable(0); - if (!isDeclaration) { + if (!canDefineTempVariablesInPlace) { recordTempDeclaration(identifier); } emitAssignment(identifier, expr); @@ -22460,14 +22715,14 @@ var ts; } function createDefaultValueCheck(value, defaultValue) { value = ensureIdentifier(value); - var equals = ts.createSynthesizedNode(169); + var equals = ts.createSynthesizedNode(170); equals.left = value; equals.operatorToken = ts.createSynthesizedNode(30); equals.right = createVoidZero(); return createConditionalExpression(equals, defaultValue, value); } function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(170); + var cond = ts.createSynthesizedNode(171); cond.condition = condition; cond.questionToken = ts.createSynthesizedNode(50); cond.whenTrue = whenTrue; @@ -22487,7 +22742,7 @@ var ts; return createPropertyAccessExpression(object, propName); } function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(157); + var call = ts.createSynthesizedNode(158); var sliceIdentifier = ts.createSynthesizedNode(65); sliceIdentifier.text = "slice"; call.expression = createPropertyAccessExpression(value, sliceIdentifier); @@ -22502,7 +22757,7 @@ var ts; } for (var _a = 0; _a < properties.length; _a++) { var p = properties[_a]; - if (p.kind === 224 || p.kind === 225) { + if (p.kind === 225 || p.kind === 226) { var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccessForDestructuringProperty(value, propName)); } @@ -22515,8 +22770,8 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 175) { - if (e.kind !== 173) { + if (e.kind !== 176) { + if (e.kind !== 174) { emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); } else if (i === elements.length - 1) { @@ -22526,14 +22781,14 @@ var ts; } } function emitDestructuringAssignment(target, value) { - if (target.kind === 169 && target.operatorToken.kind === 53) { + if (target.kind === 170 && target.operatorToken.kind === 53) { value = createDefaultValueCheck(value, target.right); target = target.left; } - if (target.kind === 154) { + if (target.kind === 155) { emitObjectLiteralAssignment(target, value); } - else if (target.kind === 153) { + else if (target.kind === 154) { emitArrayLiteralAssignment(target, value); } else { @@ -22547,14 +22802,14 @@ var ts; emitDestructuringAssignment(target, value); } else { - if (root.parent.kind !== 161) { + if (root.parent.kind !== 162) { write("("); } value = ensureIdentifier(value); emitDestructuringAssignment(target, value); write(", "); emit(value); - if (root.parent.kind !== 161) { + if (root.parent.kind !== 162) { write(")"); } } @@ -22574,11 +22829,11 @@ var ts; } for (var i = 0; i < elements.length; i++) { var element = elements[i]; - if (pattern.kind === 150) { + if (pattern.kind === 151) { var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); } - else if (element.kind !== 175) { + else if (element.kind !== 176) { if (!element.dotDotDotToken) { emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); } @@ -22605,22 +22860,31 @@ var ts; } else { renameNonTopLevelLetAndConst(node.name); - emitModuleMemberName(node); var initializer = node.initializer; if (!initializer && languageVersion < 2) { var isUninitializedLet = (resolver.getNodeCheckFlags(node) & 256) && (getCombinedFlagsForIdentifier(node.name) & 4096); if (isUninitializedLet && - node.parent.parent.kind !== 187 && - node.parent.parent.kind !== 188) { + node.parent.parent.kind !== 188 && + node.parent.parent.kind !== 189) { initializer = createVoidZero(); } } + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.name); + write("\", "); + } + emitModuleMemberName(node); emitOptional(" = ", initializer); + if (exportChanged) { + write(")"); + } } } function emitExportVariableAssignments(node) { - if (node.kind === 175) { + if (node.kind === 176) { return; } var name = node.name; @@ -22632,7 +22896,7 @@ var ts; } } function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 198 && node.parent.kind !== 152)) { + if (!node.parent || (node.parent.kind !== 199 && node.parent.kind !== 153)) { return 0; } return ts.getCombinedNodeFlags(node.parent); @@ -22641,24 +22905,24 @@ var ts; if (languageVersion >= 2 || ts.nodeIsSynthesized(node) || node.kind !== 65 || - (node.parent.kind !== 198 && node.parent.kind !== 152)) { + (node.parent.kind !== 199 && node.parent.kind !== 153)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); if (((combinedFlags & 12288) === 0) || combinedFlags & 1) { return; } - var list = ts.getAncestor(node, 199); - if (list.parent.kind === 180) { - var isSourceFileLevelBinding = list.parent.parent.kind === 227; - var isModuleLevelBinding = list.parent.parent.kind === 206; - var isFunctionLevelBinding = list.parent.parent.kind === 179 && ts.isFunctionLike(list.parent.parent.parent); + var list = ts.getAncestor(node, 200); + if (list.parent.kind === 181) { + var isSourceFileLevelBinding = list.parent.parent.kind === 228; + var isModuleLevelBinding = list.parent.parent.kind === 207; + var isFunctionLevelBinding = list.parent.parent.kind === 180 && ts.isFunctionLike(list.parent.parent.parent); if (isSourceFileLevelBinding || isModuleLevelBinding || isFunctionLevelBinding) { return; } } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === 227 + var parent = blockScopeContainer.kind === 228 ? blockScopeContainer : blockScopeContainer.parent; if (resolver.resolvesToSomeValue(parent, node.text)) { @@ -22673,18 +22937,27 @@ var ts; function isES6ExportedDeclaration(node) { return !!(node.flags & 1) && languageVersion >= 2 && - node.parent.kind === 227; + node.parent.kind === 228; } function emitVariableStatement(node) { + var startIsEmitted = true; if (!(node.flags & 1)) { - emitStartOfVariableDeclarationList(node.declarationList); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); } else if (isES6ExportedDeclaration(node)) { write("export "); - emitStartOfVariableDeclarationList(node.declarationList); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } + if (startIsEmitted) { + emitCommaList(node.declarationList.declarations); + write(";"); + } + else { + var atLeastOneItem = emitVariableDeclarationListSkippingUninitializedEntries(node.declarationList); + if (atLeastOneItem) { + write(";"); + } } - emitCommaList(node.declarationList.declarations); - write(";"); if (languageVersion < 2 && node.parent === currentSourceFile) { ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); } @@ -22785,12 +23058,12 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 136 ? "get " : "set "); + write(node.kind === 137 ? "get " : "set "); emit(node.name, false); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 163 && languageVersion >= 2; + return node.kind === 164 && languageVersion >= 2; } function emitDeclarationName(node) { if (node.name) { @@ -22801,10 +23074,10 @@ var ts; } } function shouldEmitFunctionName(node) { - if (node.kind === 162) { + if (node.kind === 163) { return !!node.name; } - if (node.kind === 200) { + if (node.kind === 201) { return !!node.name || languageVersion < 2; } } @@ -22812,7 +23085,7 @@ var ts; if (ts.nodeIsMissing(node.body)) { return emitOnlyPinnedOrTripleSlashComments(node); } - if (node.kind !== 134 && node.kind !== 133) { + if (node.kind !== 135 && node.kind !== 134) { emitLeadingComments(node); } if (!shouldEmitAsArrowFunction(node)) { @@ -22832,10 +23105,10 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (languageVersion < 2 && node.kind === 200 && node.parent === currentSourceFile && node.name) { + if (languageVersion < 2 && node.kind === 201 && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } - if (node.kind !== 134 && node.kind !== 133) { + if (node.kind !== 135 && node.kind !== 134) { emitTrailingComments(node); } } @@ -22882,7 +23155,7 @@ var ts; if (!node.body) { write(" { }"); } - else if (node.body.kind === 179) { + else if (node.body.kind === 180) { emitBlockFunctionBody(node, node.body); } else { @@ -22907,10 +23180,10 @@ var ts; } write(" "); var current = body; - while (current.kind === 160) { + while (current.kind === 161) { current = current.expression; } - emitParenthesizedIf(body, current.kind === 154); + emitParenthesizedIf(body, current.kind === 155); } function emitDownLevelExpressionFunctionBody(node, body) { write(" {"); @@ -22982,9 +23255,9 @@ var ts; function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 182) { + if (statement && statement.kind === 183) { var expr = statement.expression; - if (expr && expr.kind === 157) { + if (expr && expr.kind === 158) { var func = expr.expression; if (func && func.kind === 91) { return statement; @@ -23015,7 +23288,7 @@ var ts; emitNodeWithoutSourceMap(memberName); write("]"); } - else if (memberName.kind === 127) { + else if (memberName.kind === 128) { emitComputedPropertyName(memberName); } else { @@ -23027,7 +23300,7 @@ var ts; var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 132 && static === ((member.flags & 128) !== 0) && member.initializer) { + if (member.kind === 133 && static === ((member.flags & 128) !== 0) && member.initializer) { properties.push(member); } } @@ -23067,11 +23340,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 178) { + if (member.kind === 179) { writeLine(); write(";"); } - else if (member.kind === 134 || node.kind === 133) { + else if (member.kind === 135 || node.kind === 134) { if (!member.body) { return emitOnlyPinnedOrTripleSlashComments(member); } @@ -23090,7 +23363,7 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 136 || member.kind === 137) { + else if (member.kind === 137 || member.kind === 138) { var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); @@ -23140,22 +23413,22 @@ var ts; function emitMemberFunctionsForES6AndHigher(node) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.kind === 134 || node.kind === 133) && !member.body) { + if ((member.kind === 135 || node.kind === 134) && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - else if (member.kind === 134 || - member.kind === 136 || - member.kind === 137) { + else if (member.kind === 135 || + member.kind === 137 || + member.kind === 138) { writeLine(); emitLeadingComments(member); emitStart(member); if (member.flags & 128) { write("static "); } - if (member.kind === 136) { + if (member.kind === 137) { write("get "); } - else if (member.kind === 137) { + else if (member.kind === 138) { write("set "); } if (member.asteriskToken) { @@ -23166,7 +23439,7 @@ var ts; emitEnd(member); emitTrailingComments(member); } - else if (member.kind === 178) { + else if (member.kind === 179) { writeLine(); write(";"); } @@ -23187,10 +23460,10 @@ var ts; function emitConstructorWorker(node, baseTypeElement) { var hasInstancePropertyWithInitializer = false; ts.forEach(node.members, function (member) { - if (member.kind === 135 && !member.body) { + if (member.kind === 136 && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - if (member.kind === 132 && member.initializer && (member.flags & 128) === 0) { + if (member.kind === 133 && member.initializer && (member.flags & 128) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -23290,7 +23563,7 @@ var ts; } function emitClassLikeDeclarationForES6AndHigher(node) { var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 201) { + if (node.kind === 202) { if (thisNodeIsDecorated) { if (isES6ExportedDeclaration(node) && !(node.flags & 256)) { write("export "); @@ -23307,7 +23580,7 @@ var ts; } } var staticProperties = getInitializedProperties(node, true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 174; + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 175; var tempVariable; if (isClassExpressionWithStaticProperties) { tempVariable = createAndRecordTempVariable(0); @@ -23383,8 +23656,10 @@ var ts; } } function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 201) { - write("var "); + if (node.kind === 202) { + if (!shouldHoistDeclarationInSystemJsModule(node)) { + write("var "); + } emitDeclarationName(node); write(" = "); } @@ -23439,11 +23714,11 @@ var ts; emit(baseTypeNode.expression); } write(")"); - if (node.kind === 201) { + if (node.kind === 202) { write(";"); } emitEnd(node); - if (node.kind === 201) { + if (node.kind === 202) { emitExportMemberAssignment(node); } if (languageVersion < 2 && node.parent === currentSourceFile && node.name) { @@ -23517,13 +23792,13 @@ var ts; } else { decorators = member.decorators; - if (member.kind === 134) { + if (member.kind === 135) { functionLikeMember = member; } } writeLine(); emitStart(member); - if (member.kind !== 132) { + if (member.kind !== 133) { write("Object.defineProperty("); emitStart(member.name); emitClassMemberPrefix(node, member); @@ -23553,7 +23828,7 @@ var ts; write(", "); emitExpressionForPropertyName(member.name); emitEnd(member.name); - if (member.kind !== 132) { + if (member.kind !== 133) { write(", Object.getOwnPropertyDescriptor("); emitStart(member.name); emitClassMemberPrefix(node, member); @@ -23592,26 +23867,26 @@ var ts; } function shouldEmitTypeMetadata(node) { switch (node.kind) { - case 134: - case 136: + case 135: case 137: - case 132: + case 138: + case 133: return true; } return false; } function shouldEmitReturnTypeMetadata(node) { switch (node.kind) { - case 134: + case 135: return true; } return false; } function shouldEmitParamTypesMetadata(node) { switch (node.kind) { - case 201: - case 134: - case 137: + case 202: + case 135: + case 138: return true; } return false; @@ -23771,7 +24046,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 205) { + if (moduleDeclaration.body.kind === 206) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -23787,7 +24062,9 @@ var ts; if (!shouldEmit) { return emitOnlyPinnedOrTripleSlashComments(node); } - if (!isModuleMergedWithES6Class(node)) { + var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); + var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); + if (emitVarForModule) { emitStart(node); if (isES6ExportedDeclaration(node)) { write("export "); @@ -23804,7 +24081,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 206) { + if (node.body.kind === 207) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; tempFlags = 0; @@ -23837,6 +24114,14 @@ var ts; write(" = {}));"); emitEnd(node); if (!isES6ExportedDeclaration(node) && node.name.kind === 65 && node.parent === currentSourceFile) { + if (compilerOptions.module === 4 && (node.flags & 1)) { + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(")"); + } emitExportMemberAssignments(node.name); } } @@ -23853,16 +24138,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 208) { + if (node.kind === 209) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 211) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 212) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 209 && node.importClause && !!node.importClause.name; + return node.kind === 210 && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -23889,7 +24174,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 211) { + if (node.importClause.namedBindings.kind === 212) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -23915,7 +24200,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 208 && (node.flags & 1) !== 0; + var isExportedImport = node.kind === 209 && (node.flags & 1) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (compilerOptions.module !== 2) { emitLeadingComments(node); @@ -23927,7 +24212,7 @@ var ts; write(" = "); } else { - var isNakedImport = 209 && !node.importClause; + var isNakedImport = 210 && !node.importClause; if (!isNakedImport) { write("var "); write(getGeneratedNameForNode(node)); @@ -23990,6 +24275,7 @@ var ts; } } function emitExportDeclaration(node) { + ts.Debug.assert(compilerOptions.module !== 4); if (languageVersion < 2) { if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { emitStart(node); @@ -24082,8 +24368,8 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 200 && - expression.kind !== 201) { + if (expression.kind !== 201 && + expression.kind !== 202) { write(";"); } emitEnd(node); @@ -24091,14 +24377,21 @@ var ts; else { writeLine(); emitStart(node); - emitContainingModuleName(node); - if (languageVersion === 0) { - write("[\"default\"] = "); + if (compilerOptions.module === 4) { + write(exportFunctionForFile + "(\"default\","); + emit(node.expression); + write(")"); } else { - write(".default = "); + emitContainingModuleName(node); + if (languageVersion === 0) { + write("[\"default\"] = "); + } + else { + write(".default = "); + } + emit(node.expression); } - emit(node.expression); write(";"); emitEnd(node); } @@ -24112,18 +24405,18 @@ var ts; for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 209: + case 210: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, true)) { externalImports.push(node); } break; - case 208: - if (node.moduleReference.kind === 219 && resolver.isReferencedAliasDeclaration(node)) { + case 209: + if (node.moduleReference.kind === 220 && resolver.isReferencedAliasDeclaration(node)) { externalImports.push(node); } break; - case 215: + case 216: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -24141,7 +24434,7 @@ var ts; } } break; - case 214: + case 215: if (node.isExportEquals && !exportEquals) { exportEquals = node; } @@ -24161,6 +24454,375 @@ var ts; write("}"); } } + function getLocalNameForExternalImport(importNode) { + var namespaceDeclaration = getNamespaceDeclarationNode(importNode); + if (namespaceDeclaration && !isDefaultImport(importNode)) { + return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); + } + else { + return getGeneratedNameForNode(importNode); + } + } + function getExternalModuleNameText(importNode) { + var moduleName = ts.getExternalModuleName(importNode); + if (moduleName.kind === 8) { + return getLiteralText(moduleName); + } + return undefined; + } + function emitVariableDeclarationsForImports() { + if (externalImports.length === 0) { + return; + } + writeLine(); + var started = false; + for (var _a = 0; _a < externalImports.length; _a++) { + var importNode = externalImports[_a]; + var skipNode = importNode.kind === 216 || + (importNode.kind === 210 && !importNode.importClause); + if (skipNode) { + continue; + } + if (!started) { + write("var "); + started = true; + } + else { + write(", "); + } + write(getLocalNameForExternalImport(importNode)); + } + if (started) { + write(";"); + } + } + function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations) { + if (!hasExportStars) { + return undefined; + } + if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { + var hasExportDeclarationWithExportClause = false; + for (var _a = 0; _a < externalImports.length; _a++) { + var externalImport = externalImports[_a]; + if (externalImport.kind === 216 && externalImport.exportClause) { + hasExportDeclarationWithExportClause = true; + break; + } + } + if (!hasExportDeclarationWithExportClause) { + return emitExportStarFunction(undefined); + } + } + var exportedNamesStorageRef = makeUniqueName("exportedNames"); + writeLine(); + write("var " + exportedNamesStorageRef + " = {"); + increaseIndent(); + var started = false; + if (exportedDeclarations) { + for (var i = 0; i < exportedDeclarations.length; ++i) { + writeExportedName(exportedDeclarations[i]); + } + } + if (exportSpecifiers) { + for (var n in exportSpecifiers) { + for (var _b = 0, _c = exportSpecifiers[n]; _b < _c.length; _b++) { + var specifier = _c[_b]; + writeExportedName(specifier.name); + } + } + } + for (var _d = 0; _d < externalImports.length; _d++) { + var externalImport = externalImports[_d]; + if (externalImport.kind !== 216) { + continue; + } + var exportDecl = externalImport; + if (!exportDecl.exportClause) { + continue; + } + for (var _e = 0, _f = exportDecl.exportClause.elements; _e < _f.length; _e++) { + var element = _f[_e]; + writeExportedName(element.name || element.propertyName); + } + } + decreaseIndent(); + writeLine(); + write("};"); + return emitExportStarFunction(exportedNamesStorageRef); + function emitExportStarFunction(localNames) { + var exportStarFunction = makeUniqueName("exportStar"); + writeLine(); + write("function " + exportStarFunction + "(m) {"); + increaseIndent(); + writeLine(); + write("for(var n in m) {"); + increaseIndent(); + writeLine(); + write("if (n !== \"default\""); + if (localNames) { + write("&& !" + localNames + ".hasOwnProperty(n)"); + } + write(") " + exportFunctionForFile + "(n, m[n]);"); + decreaseIndent(); + writeLine(); + write("}"); + decreaseIndent(); + writeLine(); + write("}"); + return exportStarFunction; + } + function writeExportedName(node) { + if (node.kind !== 65 && node.flags & 256) { + return; + } + if (started) { + write(","); + } + else { + started = true; + } + writeLine(); + write("'"); + if (node.kind === 65) { + emitNodeWithoutSourceMap(node); + } + else { + emitDeclarationName(node); + } + write("': true"); + } + } + function processTopLevelVariableAndFunctionDeclarations(node) { + var hoistedVars; + var hoistedFunctionDeclarations; + var exportedDeclarations; + visit(node); + if (hoistedVars) { + writeLine(); + write("var "); + for (var i = 0; i < hoistedVars.length; ++i) { + var local = hoistedVars[i]; + if (i !== 0) { + write(", "); + } + if (local.kind === 202 || local.kind === 206) { + emitDeclarationName(local); + } + else { + emit(local); + } + var flags = ts.getCombinedNodeFlags(local.kind === 65 ? local.parent : local); + if (flags & 1) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(local); + } + } + write(";"); + } + if (hoistedFunctionDeclarations) { + for (var _a = 0; _a < hoistedFunctionDeclarations.length; _a++) { + var f = hoistedFunctionDeclarations[_a]; + writeLine(); + emit(f); + if (f.flags & 1) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(f); + } + } + } + return exportedDeclarations; + function visit(node) { + if (node.kind === 201) { + if (!hoistedFunctionDeclarations) { + hoistedFunctionDeclarations = []; + } + hoistedFunctionDeclarations.push(node); + return; + } + if (node.kind === 202) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + return; + } + if (node.kind === 206 && shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + return; + } + if (node.kind === 199 || node.kind === 153) { + if (shouldHoistVariable(node, false)) { + var name_21 = node.name; + if (name_21.kind === 65) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(name_21); + } + else { + ts.forEachChild(name_21, visit); + } + } + return; + } + if (ts.isBindingPattern(node)) { + ts.forEach(node.elements, visit); + return; + } + if (!ts.isDeclaration(node)) { + ts.forEachChild(node, visit); + } + } + } + function shouldHoistVariable(node, checkIfSourceFileLevelDecl) { + if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { + return false; + } + return (ts.getCombinedNodeFlags(node) & 12288) === 0 || + ts.getEnclosingBlockScopeContainer(node).kind === 228; + } + function isCurrentFileSystemExternalModule() { + return compilerOptions.module === 4 && ts.isExternalModule(currentSourceFile); + } + function emitSystemModuleBody(node, startIndex) { + emitVariableDeclarationsForImports(); + writeLine(); + var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); + var exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations); + writeLine(); + write("return {"); + increaseIndent(); + writeLine(); + emitSetters(exportStarFunction); + writeLine(); + emitExecute(node, startIndex); + emitTempDeclarations(true); + decreaseIndent(); + writeLine(); + write("}"); + } + function emitSetters(exportStarFunction) { + write("setters:["); + for (var i = 0; i < externalImports.length; ++i) { + if (i !== 0) { + write(","); + } + writeLine(); + increaseIndent(); + var importNode = externalImports[i]; + var importVariableName = getLocalNameForExternalImport(importNode) || ""; + var parameterName = "_" + importVariableName; + write("function (" + parameterName + ") {"); + switch (importNode.kind) { + case 210: + if (!importNode.importClause) { + break; + } + case 209: + ts.Debug.assert(importVariableName !== ""); + increaseIndent(); + writeLine(); + write(importVariableName + " = " + parameterName + ";"); + writeLine(); + var defaultName = importNode.kind === 210 + ? importNode.importClause.name + : importNode.name; + if (defaultName) { + emitExportMemberAssignments(defaultName); + writeLine(); + } + if (importNode.kind === 210 && + importNode.importClause.namedBindings) { + var namedBindings = importNode.importClause.namedBindings; + if (namedBindings.kind === 212) { + emitExportMemberAssignments(namedBindings.name); + writeLine(); + } + else { + for (var _a = 0, _b = namedBindings.elements; _a < _b.length; _a++) { + var element = _b[_a]; + emitExportMemberAssignments(element.name || element.propertyName); + writeLine(); + } + } + } + decreaseIndent(); + break; + case 216: + ts.Debug.assert(importVariableName !== ""); + increaseIndent(); + if (importNode.exportClause) { + for (var _c = 0, _d = importNode.exportClause.elements; _c < _d.length; _c++) { + var e = _d[_c]; + writeLine(); + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(e.name); + write("\", " + parameterName + "[\""); + emitNodeWithoutSourceMap(e.propertyName || e.name); + write("\"]);"); + } + } + else { + writeLine(); + write(exportStarFunction + "(" + parameterName + ");"); + } + writeLine(); + decreaseIndent(); + break; + } + write("}"); + decreaseIndent(); + } + write("],"); + } + function emitExecute(node, startIndex) { + write("execute: function() {"); + increaseIndent(); + writeLine(); + for (var i = startIndex; i < node.statements.length; ++i) { + var statement = node.statements[i]; + switch (statement.kind) { + case 216: + case 210: + case 209: + case 201: + continue; + } + writeLine(); + emit(statement); + } + decreaseIndent(); + writeLine(); + write("}"); + } + function emitSystemModule(node, startIndex) { + collectExternalModuleInfo(node); + ts.Debug.assert(!exportFunctionForFile); + exportFunctionForFile = makeUniqueName("exports"); + write("System.register(["); + for (var i = 0; i < externalImports.length; ++i) { + var text = getExternalModuleNameText(externalImports[i]); + if (i !== 0) { + write(", "); + } + write(text); + } + write("], function(" + exportFunctionForFile + ") {"); + writeLine(); + increaseIndent(); + emitCaptureThisForNodeIfNecessary(node); + emitSystemModuleBody(node, startIndex); + decreaseIndent(); + writeLine(); + write("});"); + } function emitAMDDependencies(node, includeNonAmdDependencies) { // An AMD define function has the following shape: // define(id?, dependencies?, factory); @@ -24188,19 +24850,8 @@ var ts; } for (var _c = 0; _c < externalImports.length; _c++) { var importNode = externalImports[_c]; - var externalModuleName = ""; - var moduleName = ts.getExternalModuleName(importNode); - if (moduleName.kind === 8) { - externalModuleName = getLiteralText(moduleName); - } - var importAliasName = void 0; - var namespaceDeclaration = getNamespaceDeclarationNode(importNode); - if (namespaceDeclaration && !isDefaultImport(importNode)) { - importAliasName = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); - } - else { - importAliasName = getGeneratedNameForNode(importNode); - } + var externalModuleName = getExternalModuleNameText(importNode); + var importAliasName = getLocalNameForExternalImport(importNode); if (includeNonAmdDependencies && importAliasName) { aliasedModuleNames.push(externalModuleName); importAliasNames.push(importAliasName); @@ -24313,28 +24964,33 @@ var ts; writeLine(); emitDetachedComments(node); var startIndex = emitDirectivePrologues(node.statements, false); - if ((languageVersion < 2) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8)) { - writeLines(extendsHelper); - extendsEmitted = true; - } - if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 512) { - writeLines(decorateHelper); - if (compilerOptions.emitDecoratorMetadata) { - writeLines(metadataHelper); + if (!compilerOptions.noEmitHelpers) { + if ((languageVersion < 2) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8)) { + writeLines(extendsHelper); + extendsEmitted = true; + } + if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 512) { + writeLines(decorateHelper); + if (compilerOptions.emitDecoratorMetadata) { + writeLines(metadataHelper); + } + decorateEmitted = true; + } + if (!paramEmitted && resolver.getNodeCheckFlags(node) & 1024) { + writeLines(paramHelper); + paramEmitted = true; } - decorateEmitted = true; } - if (!paramEmitted && resolver.getNodeCheckFlags(node) & 1024) { - writeLines(paramHelper); - paramEmitted = true; - } - if (ts.isExternalModule(node)) { + if (ts.isExternalModule(node) || compilerOptions.separateCompilation) { if (languageVersion >= 2) { emitES6Module(node, startIndex); } else if (compilerOptions.module === 2) { emitAMDModule(node, startIndex); } + else if (compilerOptions.module === 4) { + emitSystemModule(node, startIndex); + } else if (compilerOptions.module === 3) { emitUMDModule(node, startIndex); } @@ -24371,21 +25027,21 @@ var ts; } function shouldEmitLeadingAndTrailingComments(node) { switch (node.kind) { - case 202: - case 200: - case 209: - case 208: case 203: - case 214: - return false; - case 205: - return shouldEmitModuleDeclaration(node); + case 201: + case 210: + case 209: case 204: + case 215: + return false; + case 206: + return shouldEmitModuleDeclaration(node); + case 205: return shouldEmitEnumDeclaration(node); } - if (node.kind !== 179 && + if (node.kind !== 180 && node.parent && - node.parent.kind === 163 && + node.parent.kind === 164 && node.parent.body === node && compilerOptions.target <= 1) { return false; @@ -24397,13 +25053,13 @@ var ts; switch (node.kind) { case 65: return emitIdentifier(node, allowGeneratedIdentifiers); - case 129: + case 130: return emitParameter(node); + case 135: case 134: - case 133: return emitMethod(node); - case 136: case 137: + case 138: return emitAccessor(node); case 93: return emitThis(node); @@ -24423,131 +25079,131 @@ var ts; case 12: case 13: return emitLiteral(node); - case 171: - return emitTemplateExpression(node); - case 176: - return emitTemplateSpan(node); - case 126: - return emitQualifiedName(node); - case 150: - return emitObjectBindingPattern(node); - case 151: - return emitArrayBindingPattern(node); - case 152: - return emitBindingElement(node); - case 153: - return emitArrayLiteral(node); - case 154: - return emitObjectLiteral(node); - case 224: - return emitPropertyAssignment(node); - case 225: - return emitShorthandPropertyAssignment(node); - case 127: - return emitComputedPropertyName(node); - case 155: - return emitPropertyAccess(node); - case 156: - return emitIndexedAccess(node); - case 157: - return emitCallExpression(node); - case 158: - return emitNewExpression(node); - case 159: - return emitTaggedTemplateExpression(node); - case 160: - return emit(node.expression); - case 161: - return emitParenExpression(node); - case 200: - case 162: - case 163: - return emitFunctionDeclaration(node); - case 164: - return emitDeleteExpression(node); - case 165: - return emitTypeOfExpression(node); - case 166: - return emitVoidExpression(node); - case 167: - return emitPrefixUnaryExpression(node); - case 168: - return emitPostfixUnaryExpression(node); - case 169: - return emitBinaryExpression(node); - case 170: - return emitConditionalExpression(node); - case 173: - return emitSpreadElementExpression(node); case 172: - return emitYieldExpression(node); - case 175: - return; - case 179: - case 206: - return emitBlock(node); - case 180: - return emitVariableStatement(node); - case 181: - return write(";"); - case 182: - return emitExpressionStatement(node); - case 183: - return emitIfStatement(node); - case 184: - return emitDoStatement(node); - case 185: - return emitWhileStatement(node); - case 186: - return emitForStatement(node); - case 188: - case 187: - return emitForInOrForOfStatement(node); - case 189: - case 190: - return emitBreakOrContinueStatement(node); - case 191: - return emitReturnStatement(node); - case 192: - return emitWithStatement(node); - case 193: - return emitSwitchStatement(node); - case 220: - case 221: - return emitCaseOrDefaultClause(node); - case 194: - return emitLabelledStatement(node); - case 195: - return emitThrowStatement(node); - case 196: - return emitTryStatement(node); - case 223: - return emitCatchClause(node); - case 197: - return emitDebuggerStatement(node); - case 198: - return emitVariableDeclaration(node); - case 174: - return emitClassExpression(node); - case 201: - return emitClassDeclaration(node); - case 202: - return emitInterfaceDeclaration(node); - case 204: - return emitEnumDeclaration(node); + return emitTemplateExpression(node); + case 178: + return emitTemplateSpan(node); + case 127: + return emitQualifiedName(node); + case 151: + return emitObjectBindingPattern(node); + case 152: + return emitArrayBindingPattern(node); + case 153: + return emitBindingElement(node); + case 154: + return emitArrayLiteral(node); + case 155: + return emitObjectLiteral(node); + case 225: + return emitPropertyAssignment(node); case 226: - return emitEnumMember(node); + return emitShorthandPropertyAssignment(node); + case 128: + return emitComputedPropertyName(node); + case 156: + return emitPropertyAccess(node); + case 157: + return emitIndexedAccess(node); + case 158: + return emitCallExpression(node); + case 159: + return emitNewExpression(node); + case 160: + return emitTaggedTemplateExpression(node); + case 161: + return emit(node.expression); + case 162: + return emitParenExpression(node); + case 201: + case 163: + case 164: + return emitFunctionDeclaration(node); + case 165: + return emitDeleteExpression(node); + case 166: + return emitTypeOfExpression(node); + case 167: + return emitVoidExpression(node); + case 168: + return emitPrefixUnaryExpression(node); + case 169: + return emitPostfixUnaryExpression(node); + case 170: + return emitBinaryExpression(node); + case 171: + return emitConditionalExpression(node); + case 174: + return emitSpreadElementExpression(node); + case 173: + return emitYieldExpression(node); + case 176: + return; + case 180: + case 207: + return emitBlock(node); + case 181: + return emitVariableStatement(node); + case 182: + return write(";"); + case 183: + return emitExpressionStatement(node); + case 184: + return emitIfStatement(node); + case 185: + return emitDoStatement(node); + case 186: + return emitWhileStatement(node); + case 187: + return emitForStatement(node); + case 189: + case 188: + return emitForInOrForOfStatement(node); + case 190: + case 191: + return emitBreakOrContinueStatement(node); + case 192: + return emitReturnStatement(node); + case 193: + return emitWithStatement(node); + case 194: + return emitSwitchStatement(node); + case 221: + case 222: + return emitCaseOrDefaultClause(node); + case 195: + return emitLabelledStatement(node); + case 196: + return emitThrowStatement(node); + case 197: + return emitTryStatement(node); + case 224: + return emitCatchClause(node); + case 198: + return emitDebuggerStatement(node); + case 199: + return emitVariableDeclaration(node); + case 175: + return emitClassExpression(node); + case 202: + return emitClassDeclaration(node); + case 203: + return emitInterfaceDeclaration(node); case 205: - return emitModuleDeclaration(node); - case 209: - return emitImportDeclaration(node); - case 208: - return emitImportEqualsDeclaration(node); - case 215: - return emitExportDeclaration(node); - case 214: - return emitExportAssignment(node); + return emitEnumDeclaration(node); case 227: + return emitEnumMember(node); + case 206: + return emitModuleDeclaration(node); + case 210: + return emitImportDeclaration(node); + case 209: + return emitImportEqualsDeclaration(node); + case 216: + return emitExportDeclaration(node); + case 215: + return emitExportAssignment(node); + case 228: return emitSourceFileNode(node); } } @@ -24575,7 +25231,7 @@ var ts; } function getLeadingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 227 || node.pos !== node.parent.pos) { + if (node.parent.kind === 228 || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { return getLeadingCommentsWithoutDetachedComments(); } @@ -24587,7 +25243,7 @@ var ts; } function getTrailingCommentsToEmit(node) { if (node.parent) { - if (node.parent.kind === 227 || node.end !== node.parent.end) { + if (node.parent.kind === 228 || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); } } @@ -24763,10 +25419,10 @@ var ts; }; } ts.createCompilerHost = createCompilerHost; - function getPreEmitDiagnostics(program) { - var diagnostics = program.getSyntacticDiagnostics().concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics()); + function getPreEmitDiagnostics(program, sourceFile) { + var diagnostics = program.getSyntacticDiagnostics(sourceFile).concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics(sourceFile)); if (program.getCompilerOptions().declaration) { - diagnostics.concat(program.getDeclarationDiagnostics()); + diagnostics.concat(program.getDeclarationDiagnostics(sourceFile)); } return ts.sortAndDeduplicateDiagnostics(diagnostics); } @@ -25004,7 +25660,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 209 || node.kind === 208 || node.kind === 215) { + if (node.kind === 210 || node.kind === 209 || node.kind === 216) { var moduleNameExpr = ts.getExternalModuleName(node); if (moduleNameExpr && moduleNameExpr.kind === 8) { var moduleNameText = moduleNameExpr.text; @@ -25024,7 +25680,7 @@ var ts; } } } - else if (node.kind === 205 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { + else if (node.kind === 206 && node.name.kind === 8 && (node.flags & 2 || ts.isDeclarationFile(file))) { ts.forEachChild(node.body, function (node) { if (ts.isExternalModuleImportEqualsDeclaration(node) && ts.getExternalModuleImportEqualsDeclarationExpression(node).kind === 8) { @@ -25107,6 +25763,22 @@ var ts; diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_out_cannot_be_specified_with_option_separateCompilation)); } } + if (options.inlineSourceMap) { + if (options.sourceMap) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap)); + } + if (options.mapRoot) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap)); + } + if (options.sourceRoot) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap)); + } + } + if (options.inlineSources) { + if (!options.sourceMap && !options.inlineSourceMap) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); + } + } 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)); @@ -25125,15 +25797,15 @@ var ts; var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); if (firstNonExternalModuleSourceFile) { var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided)); + diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_separateCompilation_flag_is_provided)); } } else if (firstExternalModuleSourceFile && languageVersion < 2 && !options.module) { var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); } if (options.module && languageVersion >= 2) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_external_modules_into_amd_commonjs_or_umd_when_targeting_ES6_or_higher)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); } if (options.outDir || options.sourceRoot || @@ -25202,98 +25874,98 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 184) { + if (node.parent.kind === 185) { return spanInPreviousNode(node); } - if (node.parent.kind === 186) { + if (node.parent.kind === 187) { return textSpan(node); } - if (node.parent.kind === 169 && node.parent.operatorToken.kind === 23) { + if (node.parent.kind === 170 && node.parent.operatorToken.kind === 23) { return textSpan(node); } - if (node.parent.kind == 163 && node.parent.body == node) { + if (node.parent.kind == 164 && node.parent.body == node) { return textSpan(node); } } switch (node.kind) { - case 180: + case 181: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 198: - case 132: - case 131: - return spanInVariableDeclaration(node); - case 129: - return spanInParameterDeclaration(node); - case 200: - case 134: + case 199: case 133: - case 136: - case 137: + case 132: + return spanInVariableDeclaration(node); + case 130: + return spanInParameterDeclaration(node); + case 201: case 135: - case 162: + case 134: + case 137: + case 138: + case 136: case 163: + case 164: return spanInFunctionDeclaration(node); - case 179: + case 180: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 206: + case 207: return spanInBlock(node); - case 223: + case 224: return spanInBlock(node.block); - case 182: - return textSpan(node.expression); - case 191: - return textSpan(node.getChildAt(0), node.expression); - case 185: - return textSpan(node, ts.findNextToken(node.expression, node)); - case 184: - return spanInNode(node.statement); - case 197: - return textSpan(node.getChildAt(0)); case 183: + return textSpan(node.expression); + case 192: + return textSpan(node.getChildAt(0), node.expression); + case 186: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 185: + return spanInNode(node.statement); + case 198: + return textSpan(node.getChildAt(0)); + case 184: + return textSpan(node, ts.findNextToken(node.expression, node)); + case 195: + return spanInNode(node.statement); + case 191: + case 190: + return textSpan(node.getChildAt(0), node.label); + case 187: + return spanInForStatement(node); + case 188: + case 189: return textSpan(node, ts.findNextToken(node.expression, node)); case 194: - return spanInNode(node.statement); - case 190: - case 189: - return textSpan(node.getChildAt(0), node.label); - case 186: - return spanInForStatement(node); - case 187: - case 188: return textSpan(node, ts.findNextToken(node.expression, node)); - case 193: - return textSpan(node, ts.findNextToken(node.expression, node)); - case 220: case 221: + case 222: return spanInNode(node.statements[0]); - case 196: + case 197: return spanInBlock(node.tryBlock); - case 195: + case 196: return textSpan(node, node.expression); - case 214: - return textSpan(node, node.expression); - case 208: - return textSpan(node, node.moduleReference); - case 209: - return textSpan(node, node.moduleSpecifier); case 215: + return textSpan(node, node.expression); + case 209: + return textSpan(node, node.moduleReference); + case 210: return textSpan(node, node.moduleSpecifier); - case 205: + case 216: + return textSpan(node, node.moduleSpecifier); + case 206: if (ts.getModuleInstanceState(node) !== 1) { return undefined; } - case 201: - case 204: - case 226: - case 157: - case 158: - return textSpan(node); - case 192: - return spanInNode(node.statement); case 202: + case 205: + case 227: + case 158: + case 159: + return textSpan(node); + case 193: + return spanInNode(node.statement); case 203: + case 204: return undefined; case 22: case 1: @@ -25320,10 +25992,10 @@ var ts; case 81: return spanInNextNode(node); default: - if (node.parent.kind === 224 && node.parent.name === node) { + if (node.parent.kind === 225 && node.parent.name === node) { return spanInNode(node.parent.initializer); } - if (node.parent.kind === 160 && node.parent.type === node) { + if (node.parent.kind === 161 && node.parent.type === node) { return spanInNode(node.parent.expression); } if (ts.isFunctionLike(node.parent) && node.parent.type === node) { @@ -25333,12 +26005,12 @@ var ts; } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 187 || - variableDeclaration.parent.parent.kind === 188) { + if (variableDeclaration.parent.parent.kind === 188 || + variableDeclaration.parent.parent.kind === 189) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 180; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 186 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 181; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 187 && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement @@ -25384,7 +26056,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1) || - (functionDeclaration.parent.kind === 201 && functionDeclaration.kind !== 135); + (functionDeclaration.parent.kind === 202 && functionDeclaration.kind !== 136); } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -25404,23 +26076,23 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 205: + case 206: if (ts.getModuleInstanceState(block.parent) !== 1) { return undefined; } - case 185: - case 183: - case 187: - case 188: - return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); case 186: + case 184: + case 188: + case 189: + return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); + case 187: 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 === 199) { + if (forStatement.initializer.kind === 200) { var variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -25439,34 +26111,34 @@ var ts; } function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 204: + case 205: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 201: + case 202: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 207: + case 208: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } return spanInNode(node.parent); } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 206: + case 207: if (ts.getModuleInstanceState(node.parent.parent) !== 1) { return undefined; } - case 204: - case 201: + case 205: + case 202: return textSpan(node); - case 179: + case 180: if (ts.isFunctionBlock(node.parent)) { return textSpan(node); } - case 223: + case 224: return spanInNode(node.parent.statements[node.parent.statements.length - 1]); ; - case 207: + case 208: var caseBlock = node.parent; var lastClause = caseBlock.clauses[caseBlock.clauses.length - 1]; if (lastClause) { @@ -25478,24 +26150,24 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 184) { + if (node.parent.kind === 185) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInCloseParenToken(node) { switch (node.parent.kind) { - case 162: - case 200: case 163: - case 134: - case 133: - case 136: - case 137: + case 201: + case 164: case 135: - case 185: - case 184: + case 134: + case 137: + case 138: + case 136: case 186: + case 185: + case 187: return spanInPreviousNode(node); default: return spanInNode(node.parent); @@ -25503,19 +26175,19 @@ var ts; return spanInNode(node.parent); } function spanInColonToken(node) { - if (ts.isFunctionLike(node.parent) || node.parent.kind === 224) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 225) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 160) { + if (node.parent.kind === 161) { return spanInNode(node.parent.expression); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 184) { + if (node.parent.kind === 185) { return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } return spanInNode(node.parent); @@ -25593,7 +26265,7 @@ var ts; } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 163; + return ts.isFunctionBlock(node) && node.parent.kind !== 164; } var depth = 0; var maxDepth = 20; @@ -25605,23 +26277,23 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 179: + case 180: if (!ts.isFunctionBlock(n)) { var parent_6 = n.parent; var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); - if (parent_6.kind === 184 || - parent_6.kind === 187 || + if (parent_6.kind === 185 || parent_6.kind === 188 || + parent_6.kind === 189 || + parent_6.kind === 187 || + parent_6.kind === 184 || parent_6.kind === 186 || - parent_6.kind === 183 || - parent_6.kind === 185 || - parent_6.kind === 192 || - parent_6.kind === 223) { + parent_6.kind === 193 || + parent_6.kind === 224) { addOutliningSpan(parent_6, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_6.kind === 196) { + if (parent_6.kind === 197) { var tryStatement = parent_6; if (tryStatement.tryBlock === n) { addOutliningSpan(parent_6, openBrace, closeBrace, autoCollapse(n)); @@ -25644,23 +26316,23 @@ var ts; }); break; } - case 206: { + case 207: { var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 201: case 202: - case 204: - case 154: - case 207: { + case 203: + case 205: + case 155: + case 208: { var openBrace = ts.findChildOfKind(n, 14, sourceFile); var closeBrace = ts.findChildOfKind(n, 15, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 153: + case 154: var openBracket = ts.findChildOfKind(n, 18, sourceFile); var closeBracket = ts.findChildOfKind(n, 19, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -25686,10 +26358,10 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_21 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_21); + for (var name_22 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_22); if (declarations) { - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_21); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_22); if (!matches) { continue; } @@ -25700,14 +26372,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_21); + matches = patternMatcher.getMatches(containers, name_22); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_21, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_22, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -25744,7 +26416,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 127) { + else if (declaration.name.kind === 128) { return tryAddComputedPropertyName(declaration.name.expression, containers, true); } else { @@ -25761,7 +26433,7 @@ var ts; } return true; } - if (expression.kind === 155) { + if (expression.kind === 156) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -25772,7 +26444,7 @@ var ts; } function getContainers(declaration) { var containers = []; - if (declaration.name.kind === 127) { + if (declaration.name.kind === 128) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, false)) { return undefined; } @@ -25836,14 +26508,14 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 205: + case 206: do { current = current.parent; - } while (current.kind === 205); - case 201: - case 204: + } while (current.kind === 206); case 202: - case 200: + case 205: + case 203: + case 201: indent++; } current = current.parent; @@ -25854,26 +26526,26 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 180: + case 181: ts.forEach(node.declarationList.declarations, visit); break; - case 150: case 151: + case 152: ts.forEach(node.elements, visit); break; - case 215: + case 216: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 209: + case 210: var importClause = node.importClause; if (importClause) { if (importClause.name) { childNodes.push(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 211) { + if (importClause.namedBindings.kind === 212) { childNodes.push(importClause.namedBindings); } else { @@ -25882,20 +26554,20 @@ var ts; } } break; - case 152: - case 198: + case 153: + case 199: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } - case 201: - case 204: case 202: case 205: - case 200: - case 208: - case 213: - case 217: + case 203: + case 206: + case 201: + case 209: + case 214: + case 218: childNodes.push(node); break; } @@ -25930,17 +26602,17 @@ var ts; for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; switch (node.kind) { - case 201: - case 204: case 202: + case 205: + case 203: topLevelNodes.push(node); break; - case 205: + case 206: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 200: + case 201: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -25951,9 +26623,9 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 200) { - if (functionDeclaration.body && functionDeclaration.body.kind === 179) { - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 200 && !isEmpty(s.name.text); })) { + if (functionDeclaration.kind === 201) { + if (functionDeclaration.body && functionDeclaration.body.kind === 180) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 201 && !isEmpty(s.name.text); })) { return true; } if (!ts.isFunctionBlock(functionDeclaration.parent)) { @@ -26006,7 +26678,7 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 129: + case 130: if (ts.isBindingPattern(node.name)) { break; } @@ -26014,34 +26686,34 @@ var ts; return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 135: case 134: - case 133: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 136: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); case 137: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 140: - return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 226: - return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); case 138: - return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); - case 139: - return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); - case 132: - case 131: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); + case 141: + return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); + case 227: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 200: + case 139: + return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); + case 140: + return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); + case 133: + case 132: + return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); + case 201: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 198: - case 152: + case 199: + case 153: var variableDeclarationNode; - var name_22; - if (node.kind === 152) { - name_22 = node.name; + var name_23; + if (node.kind === 153) { + name_23 = node.name; variableDeclarationNode = node; - while (variableDeclarationNode && variableDeclarationNode.kind !== 198) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 199) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -26049,24 +26721,24 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_22 = node.name; + name_23 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_22), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_22), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_22), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.variableElement); } - case 135: + case 136: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 217: - case 213: - case 208: - case 210: + case 218: + case 214: + case 209: case 211: + case 212: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -26096,17 +26768,17 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 227: + case 228: return createSourceFileItem(node); - case 201: - return createClassItem(node); - case 204: - return createEnumItem(node); case 202: - return createIterfaceItem(node); + return createClassItem(node); case 205: + return createEnumItem(node); + case 203: + return createIterfaceItem(node); + case 206: return createModuleItem(node); - case 200: + case 201: return createFunctionItem(node); } return undefined; @@ -26116,7 +26788,7 @@ var ts; } var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 205) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 206) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -26128,7 +26800,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.body && node.body.kind === 179) { + if (node.body && node.body.kind === 180) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(!node.name ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -26149,7 +26821,7 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 135 && member; + return member.kind === 136 && member; }); var nodes = removeDynamicallyNamedProperties(node); if (constructor) { @@ -26170,19 +26842,19 @@ var ts; } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 127; }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 128; }); } function removeDynamicallyNamedProperties(node) { return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 205) { + while (node.body.kind === 206) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 227 + return node.kind === 228 ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -26673,14 +27345,14 @@ var ts; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function createJavaScriptSignatureHelpItems(argumentInfo) { - if (argumentInfo.invocation.kind !== 157) { + if (argumentInfo.invocation.kind !== 158) { return undefined; } var callExpression = argumentInfo.invocation; var expression = callExpression.expression; var name = expression.kind === 65 ? expression - : expression.kind === 155 + : expression.kind === 156 ? expression.name : undefined; if (!name || !name.text) { @@ -26709,7 +27381,7 @@ var ts; } } function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind === 157 || node.parent.kind === 158) { + if (node.parent.kind === 158 || node.parent.kind === 159) { var callExpression = node.parent; if (node.kind === 24 || node.kind === 16) { @@ -26740,23 +27412,23 @@ var ts; }; } } - else if (node.kind === 10 && node.parent.kind === 159) { + else if (node.kind === 10 && node.parent.kind === 160) { if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, 0); } } - else if (node.kind === 11 && node.parent.parent.kind === 159) { + else if (node.kind === 11 && node.parent.parent.kind === 160) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 171); + ts.Debug.assert(templateExpression.kind === 172); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 176 && node.parent.parent.parent.kind === 159) { + else if (node.parent.kind === 178 && node.parent.parent.parent.kind === 160) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 171); + ts.Debug.assert(templateExpression.kind === 172); if (node.kind === 13 && !ts.isInsideTemplateLiteral(node, position)) { return undefined; } @@ -26820,7 +27492,7 @@ var ts; var template = taggedTemplate.template; var applicableSpanStart = template.getStart(); var applicableSpanEnd = template.getEnd(); - if (template.kind === 171) { + if (template.kind === 172) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); @@ -26829,7 +27501,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 227; n = n.parent) { + for (var n = node; n.kind !== 228; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -27010,39 +27682,39 @@ var ts; return false; } switch (n.kind) { - case 201: case 202: - case 204: - case 154: - case 150: - case 145: - case 179: - case 206: + case 203: + case 205: + case 155: + case 151: + case 146: + case 180: case 207: + case 208: return nodeEndsWith(n, 15, sourceFile); - case 223: + case 224: return isCompletedNode(n.block, sourceFile); - case 158: + case 159: if (!n.arguments) { return true; } - case 157: - case 161: - case 149: + case 158: + case 162: + case 150: return nodeEndsWith(n, 17, sourceFile); - case 142: case 143: + case 144: return isCompletedNode(n.type, sourceFile); - case 135: case 136: case 137: - case 200: - case 162: - case 134: - case 133: - case 139: case 138: + case 201: case 163: + case 135: + case 134: + case 140: + case 139: + case 164: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -27050,61 +27722,61 @@ var ts; return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 17, sourceFile); - case 205: + case 206: return n.body && isCompletedNode(n.body, sourceFile); - case 183: + case 184: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 182: + case 183: return isCompletedNode(n.expression, sourceFile); - case 153: - case 151: - case 156: - case 127: - case 147: + case 154: + case 152: + case 157: + case 128: + case 148: return nodeEndsWith(n, 19, sourceFile); - case 140: + case 141: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 19, sourceFile); - case 220: case 221: + case 222: return false; - case 186: case 187: case 188: - case 185: + case 189: + case 186: return isCompletedNode(n.statement, sourceFile); - case 184: + case 185: var hasWhileKeyword = findChildOfKind(n, 100, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 17, sourceFile); } return isCompletedNode(n.statement, sourceFile); - case 144: + case 145: return isCompletedNode(n.exprName, sourceFile); - case 165: - case 164: case 166: - case 172: + case 165: + case 167: case 173: + case 174: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 159: + case 160: return isCompletedNode(n.template, sourceFile); - case 171: + case 172: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 176: + case 178: return ts.nodeIsPresent(n.literal); - case 167: + case 168: return isCompletedNode(n.operand, sourceFile); - case 169: - return isCompletedNode(n.right, sourceFile); case 170: + return isCompletedNode(n.right, sourceFile); + case 171: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -27147,7 +27819,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 228 && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 229 && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -27253,7 +27925,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 227); + ts.Debug.assert(startNode !== undefined || n.kind === 228); if (children.length) { var candidate = findRightmostChildNodeWithTokens(children, children.length); return candidate && findRightmostToken(candidate); @@ -27290,17 +27962,17 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 141 || node.kind === 157) { + if (node.kind === 142 || node.kind === 158) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 201 || node.kind === 202) { + if (ts.isFunctionLike(node) || node.kind === 202 || node.kind === 203) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 && n.kind <= 125; + return n.kind >= 0 && n.kind <= 126; } ts.isToken = isToken; function isWord(kind) { @@ -27353,7 +28025,7 @@ var ts; var ts; (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 129; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 130; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -27957,12 +28629,12 @@ var ts; this.NoSpaceBetweenReturnAndSemicolon = new formatting.Rule(formatting.RuleDescriptor.create1(90, 22), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); this.SpaceBetweenStatements = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([17, 75, 76, 67]), 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([96, 81]), 14), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([116, 120]), 65), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([116, 121]), 65), 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(114, 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([117, 118]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([69, 115, 77, 78, 79, 116, 102, 85, 103, 117, 106, 108, 120, 109]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([117, 119]), 16), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([69, 115, 77, 78, 79, 116, 102, 85, 103, 117, 118, 106, 108, 121, 109]), 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([79, 102])), 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)); @@ -27976,7 +28648,7 @@ var ts; this.NoSpaceBetweenEmptyInterfaceBraceBrackets = new formatting.Rule(formatting.RuleDescriptor.create1(14, 15), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext, Rules.IsObjectTypeContext), 8)); this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 52), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2)); this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(52, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([65, 78, 73, 69, 109, 108, 106, 107, 116, 120, 18, 35])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([65, 78, 73, 69, 109, 108, 106, 107, 116, 121, 18, 35])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2)); this.HighPriorityCommonRules = [ this.IgnoreBeforeComment, this.IgnoreAfterLineComment, @@ -28050,37 +28722,37 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_23 in o) { - if (o[name_23] === rule) { - return name_23; + for (var name_24 in o) { + if (o[name_24] === rule) { + return name_24; } } throw new Error("Unknown rule"); }; Rules.IsForContext = function (context) { - return context.contextNode.kind === 186; + return context.contextNode.kind === 187; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 169: case 170: + case 171: return true; - case 152: - case 203: - case 208: - case 198: - case 129: - case 226: + case 153: + case 204: + case 209: + case 199: + case 130: + case 227: + case 133: case 132: - case 131: return context.currentTokenSpan.kind === 53 || context.nextTokenSpan.kind === 53; - case 187: - return context.currentTokenSpan.kind === 86 || context.nextTokenSpan.kind === 86; case 188: - return context.currentTokenSpan.kind === 125 || context.nextTokenSpan.kind === 125; + return context.currentTokenSpan.kind === 86 || context.nextTokenSpan.kind === 86; + case 189: + return context.currentTokenSpan.kind === 126 || context.nextTokenSpan.kind === 126; } return false; }; @@ -28088,7 +28760,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 170; + return context.contextNode.kind === 171; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. @@ -28129,26 +28801,26 @@ var ts; return true; } switch (node.kind) { - case 179: + case 180: + case 208: + case 155: case 207: - case 154: - case 206: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 200: + case 201: + case 135: case 134: - case 133: - case 136: case 137: case 138: - case 162: - case 135: + case 139: case 163: - case 202: + case 136: + case 164: + case 203: return true; } return false; @@ -28158,53 +28830,53 @@ var ts; }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 201: case 202: - case 204: - case 145: + case 203: case 205: + case 146: + case 206: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 201: - case 205: - case 204: - case 179: - case 223: + case 202: case 206: - case 193: + case 205: + case 180: + case 224: + case 207: + case 194: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 183: - case 193: - case 186: + case 184: + case 194: case 187: case 188: + case 189: + case 186: + case 197: case 185: - case 196: - case 184: - case 192: - case 223: + case 193: + case 224: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 154; + return context.contextNode.kind === 155; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 157; + return context.contextNode.kind === 158; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 158; + return context.contextNode.kind === 159; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -28225,38 +28897,38 @@ var ts; while (ts.isExpression(node)) { node = node.parent; } - return node.kind === 130; + return node.kind === 131; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 199 && + return context.currentTokenParent.kind === 200 && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind != 2; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 205; + return context.contextNode.kind === 206; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 145; + return context.contextNode.kind === 146; }; Rules.IsTypeArgumentOrParameter = function (token, parent) { if (token.kind !== 24 && token.kind !== 25) { return false; } switch (parent.kind) { - case 141: - case 201: + case 142: case 202: - case 200: - case 162: + case 203: + case 201: case 163: + case 164: + case 135: case 134: - case 133: - case 138: case 139: - case 157: + case 140: case 158: + case 159: return true; default: return false; @@ -28267,7 +28939,7 @@ var ts; Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 99 && context.currentTokenParent.kind === 166; + return context.currentTokenSpan.kind === 99 && context.currentTokenParent.kind === 167; }; return Rules; })(); @@ -28290,7 +28962,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 125 + 1; + this.mapRowLength = 126 + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); var rulesBucketConstructionStateList = new Array(this.map.length); this.FillRules(rules, rulesBucketConstructionStateList); @@ -28467,7 +29139,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0; token <= 125; token++) { + for (var token = 0; token <= 126; token++) { result.push(token); } return result; @@ -28509,9 +29181,9 @@ var ts; }; TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3])); - TokenRange.Keywords = TokenRange.FromRange(66, 125); + TokenRange.Keywords = TokenRange.FromRange(66, 126); TokenRange.BinaryOperators = TokenRange.FromRange(24, 64); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([86, 87, 125]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([86, 87, 126]); TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([38, 39, 47, 46]); TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([7, 65, 16, 18, 14, 93, 88]); TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([65, 16, 93, 88]); @@ -28519,7 +29191,7 @@ var ts; TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([65, 16, 93, 88]); TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([65, 17, 19, 88]); TokenRange.Comments = TokenRange.FromTokens([2, 3]); - TokenRange.TypeNames = TokenRange.FromTokens([65, 119, 121, 113, 122, 99, 112]); + TokenRange.TypeNames = TokenRange.FromTokens([65, 120, 122, 113, 123, 99, 112]); return TokenRange; })(); Shared.TokenRange = TokenRange; @@ -28697,17 +29369,17 @@ var ts; } function isListElement(parent, node) { switch (parent.kind) { - case 201: case 202: + case 203: return ts.rangeContainsRange(parent.members, node); - case 205: - var body = parent.body; - return body && body.kind === 179 && ts.rangeContainsRange(body.statements, node); - case 227: - case 179: case 206: + var body = parent.body; + return body && body.kind === 180 && ts.rangeContainsRange(body.statements, node); + case 228: + case 180: + case 207: return ts.rangeContainsRange(parent.statements, node); - case 223: + case 224: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -28830,9 +29502,9 @@ var ts; if (indentation === -1) { if (isSomeBlock(node.kind)) { if (isSomeBlock(parent.kind) || - parent.kind === 227 || - parent.kind === 220 || - parent.kind === 221) { + parent.kind === 228 || + parent.kind === 221 || + parent.kind === 222) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -28863,18 +29535,18 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 201: return 69; - case 202: return 103; - case 200: return 83; - case 204: return 204; - case 136: return 116; - case 137: return 120; - case 134: + case 202: return 69; + case 203: return 103; + case 201: return 83; + case 205: return 205; + case 137: return 116; + case 138: return 121; + case 135: if (node.asteriskToken) { return 35; } - case 132: - case 129: + case 133: + case 130: return node.name.kind; } } @@ -28981,7 +29653,7 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 130 ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 131 ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; @@ -29270,20 +29942,20 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 179: - case 206: + case 180: + case 207: return true; } return false; } function getOpenTokenForList(node, list) { switch (node.kind) { - case 135: - case 200: - case 162: - case 134: - case 133: + case 136: + case 201: case 163: + case 135: + case 134: + case 164: if (node.typeParameters === list) { return 24; } @@ -29291,8 +29963,8 @@ var ts; return 16; } break; - case 157: case 158: + case 159: if (node.typeArguments === list) { return 24; } @@ -29300,7 +29972,7 @@ var ts; return 16; } break; - case 141: + case 142: if (node.typeArguments === list) { return 24; } @@ -29392,7 +30064,7 @@ var ts; return 0; } var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; - if (precedingToken.kind === 23 && precedingToken.parent.kind !== 169) { + if (precedingToken.kind === 23 && precedingToken.parent.kind !== 170) { var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1) { return actualIndentation; @@ -29482,7 +30154,7 @@ var ts; } function getActualIndentationForNode(current, parent, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 227 || !parentAndChildShareLine); + (parent.kind === 228 || !parentAndChildShareLine); if (!useActualIndentation) { return -1; } @@ -29506,7 +30178,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 183 && parent.elseStatement === child) { + if (parent.kind === 184 && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 76, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -29518,23 +30190,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 141: + case 142: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 154: + case 155: return node.parent.properties; - case 153: + case 154: return node.parent.elements; - case 200: - case 162: + case 201: case 163: + case 164: + case 135: case 134: - case 133: - case 138: - case 139: { + case 139: + case 140: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -29545,8 +30217,8 @@ var ts; } break; } - case 158: - case 157: { + case 159: + case 158: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -29615,28 +30287,28 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 201: case 202: - case 204: - case 153: - case 179: - case 206: + case 203: + case 205: case 154: - case 145: - case 147: - case 207: - case 221: - case 220: - case 161: - case 157: - case 158: case 180: - case 198: - case 214: - case 191: - case 170: + case 207: + case 155: + case 146: + case 148: + case 208: + case 222: + case 221: + case 162: + case 158: + case 159: + case 181: + case 199: + case 215: + case 192: + case 171: + case 152: case 151: - case 150: return true; } return false; @@ -29646,22 +30318,22 @@ var ts; return true; } switch (parent) { - case 184: case 185: - case 187: - case 188: case 186: - case 183: - case 200: - case 162: - case 134: - case 133: - case 138: + case 188: + case 189: + case 187: + case 184: + case 201: case 163: case 135: + case 134: + case 139: + case 164: case 136: case 137: - return child !== 179; + case 138: + return child !== 180; default: return false; } @@ -29671,7 +30343,7 @@ var ts; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); /// -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; @@ -29763,7 +30435,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(228, nodes.pos, nodes.end, 1024, this); + var list = createNode(229, nodes.pos, nodes.end, 1024, this); list._children = []; var pos = nodes.pos; for (var _i = 0; _i < nodes.length; _i++) { @@ -29782,7 +30454,7 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 126) { + if (this.kind >= 127) { scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos = this.pos; @@ -29827,7 +30499,7 @@ var ts; var children = this.getChildren(); for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; - if (child.kind < 126) { + if (child.kind < 127) { return child; } return child.getFirstToken(sourceFile); @@ -29837,7 +30509,7 @@ var ts; var children = this.getChildren(sourceFile); for (var i = children.length - 1; i >= 0; i--) { var child = children[i]; - if (child.kind < 126) { + if (child.kind < 127) { return child; } return child.getLastToken(sourceFile); @@ -29883,7 +30555,7 @@ var ts; ts.forEach(declarations, function (declaration, indexOfDeclaration) { if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); - if (canUseParsedParamTagComments && declaration.kind === 129) { + if (canUseParsedParamTagComments && declaration.kind === 130) { ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedParamJsDocComment) { @@ -29891,13 +30563,13 @@ var ts; } }); } - if (declaration.kind === 205 && declaration.body.kind === 205) { + if (declaration.kind === 206 && declaration.body.kind === 206) { return; } - while (declaration.kind === 205 && declaration.parent.kind === 205) { + while (declaration.kind === 206 && declaration.parent.kind === 206) { declaration = declaration.parent; } - ts.forEach(getJsDocCommentTextRange(declaration.kind === 198 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 199 ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); @@ -30202,9 +30874,9 @@ var ts; if (result_2 !== undefined) { return result_2; } - if (declaration.name.kind === 127) { + if (declaration.name.kind === 128) { var expr = declaration.name.expression; - if (expr.kind === 155) { + if (expr.kind === 156) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -30224,9 +30896,9 @@ var ts; } function visit(node) { switch (node.kind) { - case 200: + case 201: + case 135: case 134: - case 133: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -30243,62 +30915,62 @@ var ts; ts.forEachChild(node, visit); } break; - case 201: case 202: case 203: case 204: case 205: - case 208: - case 217: - case 213: - case 208: - case 210: - case 211: - case 136: - case 137: - case 145: - addDeclaration(node); - case 135: - case 180: - case 199: - case 150: - case 151: case 206: + case 209: + case 218: + case 214: + case 209: + case 211: + case 212: + case 137: + case 138: + case 146: + addDeclaration(node); + case 136: + case 181: + case 200: + case 151: + case 152: + case 207: ts.forEachChild(node, visit); break; - case 179: + case 180: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } break; - case 129: + case 130: if (!(node.flags & 112)) { break; } - case 198: - case 152: + case 199: + case 153: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 226: + case 227: + case 133: case 132: - case 131: addDeclaration(node); break; - case 215: + case 216: if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 209: + case 210: var importClause = node.importClause; if (importClause) { if (importClause.name) { addDeclaration(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 211) { + if (importClause.namedBindings.kind === 212) { addDeclaration(importClause.namedBindings); } else { @@ -30420,7 +31092,8 @@ var ts; ClassificationTypeNames.interfaceName = "interface name"; ClassificationTypeNames.moduleName = "module name"; ClassificationTypeNames.typeParameterName = "type parameter name"; - ClassificationTypeNames.typeAlias = "type alias name"; + ClassificationTypeNames.typeAliasName = "type alias name"; + ClassificationTypeNames.parameterName = "parameter name"; return ClassificationTypeNames; })(); ts.ClassificationTypeNames = ClassificationTypeNames; @@ -30436,14 +31109,14 @@ var ts; return false; } return ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 162) { + if (declaration.kind === 163) { return true; } - if (declaration.kind !== 198 && declaration.kind !== 200) { + if (declaration.kind !== 199 && declaration.kind !== 201) { return false; } for (var parent_7 = declaration.parent; !ts.isFunctionBlock(parent_7); parent_7 = parent_7.parent) { - if (parent_7.kind === 227 || parent_7.kind === 206) { + if (parent_7.kind === 228 || parent_7.kind === 207) { return false; } } @@ -30741,7 +31414,7 @@ var ts; else { if (token === 65) { token = scanner.scan(); - if (token === 124) { + if (token === 125) { token = scanner.scan(); if (token === 8) { recordModuleName(); @@ -30750,7 +31423,7 @@ var ts; } else if (token === 53) { token = scanner.scan(); - if (token === 118) { + if (token === 119) { token = scanner.scan(); if (token === 16) { token = scanner.scan(); @@ -30775,7 +31448,7 @@ var ts; } if (token === 15) { token = scanner.scan(); - if (token === 124) { + if (token === 125) { token = scanner.scan(); if (token === 8) { recordModuleName(); @@ -30789,7 +31462,7 @@ var ts; token = scanner.scan(); if (token === 65) { token = scanner.scan(); - if (token === 124) { + if (token === 125) { token = scanner.scan(); if (token === 8) { recordModuleName(); @@ -30809,7 +31482,7 @@ var ts; } if (token === 15) { token = scanner.scan(); - if (token === 124) { + if (token === 125) { token = scanner.scan(); if (token === 8) { recordModuleName(); @@ -30819,7 +31492,7 @@ var ts; } else if (token === 35) { token = scanner.scan(); - if (token === 124) { + if (token === 125) { token = scanner.scan(); if (token === 8) { recordModuleName(); @@ -30840,7 +31513,7 @@ var ts; ts.preProcessFile = preProcessFile; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 194 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 195 && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -30849,16 +31522,16 @@ var ts; } function isJumpStatementTarget(node) { return node.kind === 65 && - (node.parent.kind === 190 || node.parent.kind === 189) && + (node.parent.kind === 191 || node.parent.kind === 190) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { return node.kind === 65 && - node.parent.kind === 194 && + node.parent.kind === 195 && node.parent.label === node; } function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 194; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 195; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -30869,25 +31542,25 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 126 && node.parent.right === node; + return node.parent.kind === 127 && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 155 && node.parent.name === node; + return node && node.parent && node.parent.kind === 156 && node.parent.name === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 157 && node.parent.expression === node; + return node && node.parent && node.parent.kind === 158 && node.parent.expression === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 158 && node.parent.expression === node; + return node && node.parent && node.parent.kind === 159 && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 205 && node.parent.name === node; + return node.parent.kind === 206 && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { return node.kind === 65 && @@ -30895,22 +31568,22 @@ var ts; } function isNameOfPropertyAssignment(node) { return (node.kind === 65 || node.kind === 8 || node.kind === 7) && - (node.parent.kind === 224 || node.parent.kind === 225) && node.parent.name === node; + (node.parent.kind === 225 || node.parent.kind === 226) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 8 || node.kind === 7) { switch (node.parent.kind) { - case 132: - case 131: - case 224: - case 226: - case 134: case 133: - case 136: + case 132: + case 225: + case 227: + case 135: + case 134: case 137: - case 205: + case 138: + case 206: return node.parent.name === node; - case 156: + case 157: return node.parent.argumentExpression === node; } } @@ -30948,7 +31621,7 @@ var ts; } } var keywordCompletions = []; - for (var i = 66; i <= 125; i++) { + for (var i = 66; i <= 126; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ScriptElementKind.keyword, @@ -30963,17 +31636,17 @@ var ts; return undefined; } switch (node.kind) { - case 227: + case 228: + case 135: case 134: - case 133: - case 200: - case 162: - case 136: - case 137: case 201: + case 163: + case 137: + case 138: case 202: - case 204: + case 203: case 205: + case 206: return node; } } @@ -30981,38 +31654,38 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 205: return ScriptElementKind.moduleElement; - case 201: return ScriptElementKind.classElement; - case 202: return ScriptElementKind.interfaceElement; - case 203: return ScriptElementKind.typeElement; - case 204: return ScriptElementKind.enumElement; - case 198: + case 206: return ScriptElementKind.moduleElement; + case 202: return ScriptElementKind.classElement; + case 203: return ScriptElementKind.interfaceElement; + case 204: return ScriptElementKind.typeElement; + case 205: return ScriptElementKind.enumElement; + case 199: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 200: return ScriptElementKind.functionElement; - case 136: return ScriptElementKind.memberGetAccessorElement; - case 137: return ScriptElementKind.memberSetAccessorElement; + case 201: return ScriptElementKind.functionElement; + case 137: return ScriptElementKind.memberGetAccessorElement; + case 138: return ScriptElementKind.memberSetAccessorElement; + case 135: case 134: - case 133: return ScriptElementKind.memberFunctionElement; + case 133: case 132: - case 131: return ScriptElementKind.memberVariableElement; - case 140: return ScriptElementKind.indexSignatureElement; - case 139: return ScriptElementKind.constructSignatureElement; - case 138: return ScriptElementKind.callSignatureElement; - case 135: return ScriptElementKind.constructorImplementationElement; - case 128: return ScriptElementKind.typeParameterElement; - case 226: return ScriptElementKind.variableElement; - case 129: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 208: - case 213: - case 210: - case 217: + case 141: return ScriptElementKind.indexSignatureElement; + case 140: return ScriptElementKind.constructSignatureElement; + case 139: return ScriptElementKind.callSignatureElement; + case 136: return ScriptElementKind.constructorImplementationElement; + case 129: return ScriptElementKind.typeParameterElement; + case 227: return ScriptElementKind.variableElement; + case 130: return (node.flags & 112) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 209: + case 214: case 211: + case 218: + case 212: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -31154,44 +31827,44 @@ var ts; return false; } switch (node.kind) { - case 208: + case 209: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return true; - case 214: + case 215: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return true; - case 201: + case 202: var classDeclaration = node; if (checkModifiers(classDeclaration.modifiers) || checkTypeParameters(classDeclaration.typeParameters)) { return true; } break; - case 222: + case 223: var heritageClause = node; if (heritageClause.token === 102) { diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return true; } break; - case 202: + case 203: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return true; - case 205: + case 206: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return true; - case 203: + case 204: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return true; - case 134: - case 133: case 135: + case 134: case 136: case 137: - case 162: - case 200: + case 138: case 163: - case 200: + case 201: + case 164: + case 201: var functionDeclaration = node; if (checkModifiers(functionDeclaration.modifiers) || checkTypeParameters(functionDeclaration.typeParameters) || @@ -31199,20 +31872,20 @@ var ts; return true; } break; - case 180: + case 181: var variableStatement = node; if (checkModifiers(variableStatement.modifiers)) { return true; } break; - case 198: + case 199: var variableDeclaration = node; if (checkTypeAnnotation(variableDeclaration.type)) { return true; } break; - case 157: case 158: + case 159: var expression = node; if (expression.typeArguments && expression.typeArguments.length > 0) { var start = expression.typeArguments.pos; @@ -31220,7 +31893,7 @@ var ts; return true; } break; - case 129: + case 130: var parameter = node; if (parameter.modifiers) { var start = parameter.modifiers.pos; @@ -31236,17 +31909,17 @@ var ts; return true; } break; - case 132: + case 133: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); return true; - case 204: + case 205: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return true; - case 160: + case 161: var typeAssertionExpression = node; diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return true; - case 130: + case 131: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.decorators_can_only_be_used_in_a_ts_file)); return true; } @@ -31362,11 +32035,11 @@ var ts; } var node = currentToken; var isRightOfDot = false; - if (contextToken && contextToken.kind === 20 && contextToken.parent.kind === 155) { + if (contextToken && contextToken.kind === 20 && contextToken.parent.kind === 156) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (contextToken && contextToken.kind === 20 && contextToken.parent.kind === 126) { + else if (contextToken && contextToken.kind === 20 && contextToken.parent.kind === 127) { node = contextToken.parent.left; isRightOfDot = true; } @@ -31389,7 +32062,7 @@ var ts; function getTypeScriptMemberSymbols() { isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 65 || node.kind === 126 || node.kind === 155) { + if (node.kind === 65 || node.kind === 127 || node.kind === 156) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol && symbol.flags & 8388608) { symbol = typeChecker.getAliasedSymbol(symbol); @@ -31426,11 +32099,11 @@ var ts; symbols = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties); } } - else if (ts.getAncestor(contextToken, 210)) { + else if (ts.getAncestor(contextToken, 211)) { isMemberCompletion = true; isNewIdentifierLocation = true; if (showCompletionsInImportsClause(contextToken)) { - var importDeclaration = ts.getAncestor(contextToken, 209); + var importDeclaration = ts.getAncestor(contextToken, 210); ts.Debug.assert(importDeclaration !== undefined); var exports_2; if (importDeclaration.moduleSpecifier) { @@ -31475,7 +32148,7 @@ var ts; function showCompletionsInImportsClause(node) { if (node) { if (node.kind === 14 || node.kind === 23) { - return node.parent.kind === 212; + return node.parent.kind === 213; } } return false; @@ -31485,35 +32158,36 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 157 - || containingNodeKind === 135 - || containingNodeKind === 158 - || containingNodeKind === 153 - || containingNodeKind === 169; + return containingNodeKind === 158 + || containingNodeKind === 136 + || containingNodeKind === 159 + || containingNodeKind === 154 + || containingNodeKind === 170; case 16: - return containingNodeKind === 157 - || containingNodeKind === 135 - || containingNodeKind === 158 - || containingNodeKind === 161; + return containingNodeKind === 158 + || containingNodeKind === 136 + || containingNodeKind === 159 + || containingNodeKind === 162; case 18: - return containingNodeKind === 153; + return containingNodeKind === 154; case 117: + case 118: return true; case 20: - return containingNodeKind === 205; + return containingNodeKind === 206; case 14: - return containingNodeKind === 201; + return containingNodeKind === 202; case 53: - return containingNodeKind === 198 - || containingNodeKind === 169; + return containingNodeKind === 199 + || containingNodeKind === 170; case 11: - return containingNodeKind === 171; + return containingNodeKind === 172; case 12: - return containingNodeKind === 176; + return containingNodeKind === 178; case 108: case 106: case 107: - return containingNodeKind === 132; + return containingNodeKind === 133; } switch (previousToken.getText()) { case "public": @@ -31546,7 +32220,7 @@ var ts; switch (previousToken.kind) { case 14: case 23: - if (parent_8 && parent_8.kind === 154) { + if (parent_8 && parent_8.kind === 155) { return parent_8; } break; @@ -31556,16 +32230,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 162: case 163: - case 200: + case 164: + case 201: + case 135: case 134: - case 133: - case 136: case 137: case 138: case 139: case 140: + case 141: return true; } return false; @@ -31575,56 +32249,56 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23: - return containingNodeKind === 198 || - containingNodeKind === 199 || - containingNodeKind === 180 || - containingNodeKind === 204 || - isFunction(containingNodeKind) || - containingNodeKind === 201 || + return containingNodeKind === 199 || containingNodeKind === 200 || + containingNodeKind === 181 || + containingNodeKind === 205 || + isFunction(containingNodeKind) || containingNodeKind === 202 || - containingNodeKind === 151 || - containingNodeKind === 150; + containingNodeKind === 201 || + containingNodeKind === 203 || + containingNodeKind === 152 || + containingNodeKind === 151; case 20: - return containingNodeKind === 151; + return containingNodeKind === 152; case 18: - return containingNodeKind === 151; + return containingNodeKind === 152; case 16: - return containingNodeKind === 223 || + return containingNodeKind === 224 || isFunction(containingNodeKind); case 14: - return containingNodeKind === 204 || - containingNodeKind === 202 || - containingNodeKind === 145 || - containingNodeKind === 150; + return containingNodeKind === 205 || + containingNodeKind === 203 || + containingNodeKind === 146 || + containingNodeKind === 151; case 22: - return containingNodeKind === 131 && + return containingNodeKind === 132 && previousToken.parent && previousToken.parent.parent && - (previousToken.parent.parent.kind === 202 || - previousToken.parent.parent.kind === 145); + (previousToken.parent.parent.kind === 203 || + previousToken.parent.parent.kind === 146); case 24: - return containingNodeKind === 201 || - containingNodeKind === 200 || - containingNodeKind === 202 || + return containingNodeKind === 202 || + containingNodeKind === 201 || + containingNodeKind === 203 || isFunction(containingNodeKind); case 109: - return containingNodeKind === 132; + return containingNodeKind === 133; case 21: - return containingNodeKind === 129 || - containingNodeKind === 135 || + return containingNodeKind === 130 || + containingNodeKind === 136 || (previousToken.parent && previousToken.parent.parent && - previousToken.parent.parent.kind === 151); + previousToken.parent.parent.kind === 152); case 108: case 106: case 107: - return containingNodeKind === 129; + return containingNodeKind === 130; case 69: case 77: case 103: case 83: case 98: case 116: - case 120: + case 121: case 85: case 104: case 70: @@ -31659,7 +32333,7 @@ var ts; return exports; } if (importDeclaration.importClause.namedBindings && - importDeclaration.importClause.namedBindings.kind === 212) { + importDeclaration.importClause.namedBindings.kind === 213) { ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) { var name = el.propertyName || el.name; exisingImports[name.text] = true; @@ -31676,7 +32350,7 @@ var ts; } var existingMemberNames = {}; ts.forEach(existingMembers, function (m) { - if (m.kind !== 224 && m.kind !== 225) { + if (m.kind !== 225 && m.kind !== 226) { return; } if (m.getStart() <= position && position <= m.getEnd()) { @@ -31722,10 +32396,10 @@ var ts; for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; var nameTable = getNameTable(sourceFile); - for (var name_24 in nameTable) { - if (!allNames[name_24]) { - allNames[name_24] = name_24; - var displayName = getCompletionEntryDisplayName(name_24, target, true); + for (var name_25 in nameTable) { + if (!allNames[name_25]) { + allNames[name_25] = name_25; + var displayName = getCompletionEntryDisplayName(name_25, target, true); if (displayName) { var entry = { name: displayName, @@ -31917,14 +32591,14 @@ var ts; var signature; type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 155) { + if (location.parent && location.parent.kind === 156) { var right = location.parent.name; if (right === location || (right && right.getFullWidth() === 0)) { location = location.parent; } } var callExpression; - if (location.kind === 157 || location.kind === 158) { + if (location.kind === 158 || location.kind === 159) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -31936,7 +32610,7 @@ var ts; if (!signature && candidateSignatures.length) { signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 158 || callExpression.expression.kind === 91; + var useConstructSignatures = callExpression.kind === 159 || callExpression.expression.kind === 91; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target || signature)) { signature = allSignatures.length ? allSignatures[0] : undefined; @@ -31984,21 +32658,21 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || - (location.kind === 114 && location.parent.kind === 135)) { + (location.kind === 114 && location.parent.kind === 136)) { var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 135 ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 136 ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 135) { + if (functionDeclaration.kind === 136) { symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 138 && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 139 && !(type.symbol.flags & 2048 || type.symbol.flags & 4096) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -32021,7 +32695,7 @@ var ts; } if (symbolFlags & 524288) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(123)); + displayParts.push(ts.keywordPart(124)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); displayParts.push(ts.spacePart()); @@ -32041,7 +32715,9 @@ var ts; } if (symbolFlags & 1536) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(117)); + var declaration = ts.getDeclarationOfKind(symbol, 206); + var isNamespace = declaration && declaration.name && declaration.name.kind === 65; + displayParts.push(ts.keywordPart(isNamespace ? 118 : 117)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } @@ -32060,13 +32736,13 @@ var ts; writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); } else { - var signatureDeclaration = ts.getDeclarationOfKind(symbol, 128).parent; + var signatureDeclaration = ts.getDeclarationOfKind(symbol, 129).parent; var signature = typeChecker.getSignatureFromDeclaration(signatureDeclaration); - if (signatureDeclaration.kind === 139) { + if (signatureDeclaration.kind === 140) { displayParts.push(ts.keywordPart(88)); displayParts.push(ts.spacePart()); } - else if (signatureDeclaration.kind !== 138 && signatureDeclaration.name) { + else if (signatureDeclaration.kind !== 139 && signatureDeclaration.name) { addFullSymbolName(signatureDeclaration.symbol); } displayParts.push.apply(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32)); @@ -32075,7 +32751,7 @@ var ts; if (symbolFlags & 8) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 226) { + if (declaration.kind === 227) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -32091,13 +32767,13 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 208) { + if (declaration.kind === 209) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); displayParts.push(ts.operatorPart(53)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(118)); + displayParts.push(ts.keywordPart(119)); displayParts.push(ts.punctuationPart(16)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(17)); @@ -32221,8 +32897,8 @@ var ts; if (!symbol) { switch (node.kind) { case 65: - case 155: - case 126: + case 156: + case 127: case 93: case 91: var type = typeChecker.getTypeAtLocation(node); @@ -32295,7 +32971,7 @@ var ts; symbol = typeChecker.getAliasedSymbol(symbol); } } - if (node.parent.kind === 225) { + if (node.parent.kind === 226) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -32323,7 +32999,7 @@ var ts; if (isNewExpressionTarget(location) || location.kind === 114) { if (symbol.flags & 32) { var classDeclaration = symbol.getDeclarations()[0]; - ts.Debug.assert(classDeclaration && classDeclaration.kind === 201); + ts.Debug.assert(classDeclaration && classDeclaration.kind === 202); return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); } } @@ -32339,8 +33015,8 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 135) || - (!selectConstructors && (d.kind === 200 || d.kind === 134 || d.kind === 133))) { + if ((selectConstructors && d.kind === 136) || + (!selectConstructors && (d.kind === 201 || d.kind === 135 || d.kind === 134))) { declarations.push(d); if (d.body) definition = d; @@ -32438,74 +33114,74 @@ var ts; switch (node.kind) { case 84: case 76: - if (hasKind(node.parent, 183)) { + if (hasKind(node.parent, 184)) { return getIfElseOccurrences(node.parent); } break; case 90: - if (hasKind(node.parent, 191)) { + if (hasKind(node.parent, 192)) { return getReturnOccurrences(node.parent); } break; case 94: - if (hasKind(node.parent, 195)) { + if (hasKind(node.parent, 196)) { return getThrowOccurrences(node.parent); } break; case 68: - if (hasKind(parent(parent(node)), 196)) { + if (hasKind(parent(parent(node)), 197)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 96: case 81: - if (hasKind(parent(node), 196)) { + if (hasKind(parent(node), 197)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 92: - if (hasKind(node.parent, 193)) { + if (hasKind(node.parent, 194)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 67: case 73: - if (hasKind(parent(parent(parent(node))), 193)) { + if (hasKind(parent(parent(parent(node))), 194)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 66: case 71: - if (hasKind(node.parent, 190) || hasKind(node.parent, 189)) { + if (hasKind(node.parent, 191) || hasKind(node.parent, 190)) { return getBreakOrContinueStatementOccurences(node.parent); } break; case 82: - if (hasKind(node.parent, 186) || - hasKind(node.parent, 187) || - hasKind(node.parent, 188)) { + if (hasKind(node.parent, 187) || + hasKind(node.parent, 188) || + hasKind(node.parent, 189)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 100: case 75: - if (hasKind(node.parent, 185) || hasKind(node.parent, 184)) { + if (hasKind(node.parent, 186) || hasKind(node.parent, 185)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 114: - if (hasKind(node.parent, 135)) { + if (hasKind(node.parent, 136)) { return getConstructorOccurrences(node.parent); } break; case 116: - case 120: - if (hasKind(node.parent, 136) || hasKind(node.parent, 137)) { + case 121: + if (hasKind(node.parent, 137) || hasKind(node.parent, 138)) { return getGetAndSetOccurrences(node.parent); } default: if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 180)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 181)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -32517,10 +33193,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 195) { + if (node.kind === 196) { statementAccumulator.push(node); } - else if (node.kind === 196) { + else if (node.kind === 197) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -32542,10 +33218,10 @@ var ts; var child = throwStatement; while (child.parent) { var parent_9 = child.parent; - if (ts.isFunctionBlock(parent_9) || parent_9.kind === 227) { + if (ts.isFunctionBlock(parent_9) || parent_9.kind === 228) { return parent_9; } - if (parent_9.kind === 196) { + if (parent_9.kind === 197) { var tryStatement = parent_9; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; @@ -32560,7 +33236,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 190 || node.kind === 189) { + if (node.kind === 191 || node.kind === 190) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -32576,15 +33252,15 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { switch (node_1.kind) { - case 193: - if (statement.kind === 189) { + case 194: + if (statement.kind === 190) { continue; } - case 186: case 187: case 188: + case 189: + case 186: case 185: - case 184: if (!statement.label || isLabeledBy(node_1, statement.label.text)) { return node_1; } @@ -32601,18 +33277,18 @@ var ts; function getModifierOccurrences(modifier, declaration) { var container = declaration.parent; if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 201 || - (declaration.kind === 129 && hasKind(container, 135)))) { + if (!(container.kind === 202 || + (declaration.kind === 130 && hasKind(container, 136)))) { return undefined; } } else if (modifier === 109) { - if (container.kind !== 201) { + if (container.kind !== 202) { return undefined; } } else if (modifier === 78 || modifier === 115) { - if (!(container.kind === 206 || container.kind === 227)) { + if (!(container.kind === 207 || container.kind === 228)) { return undefined; } } @@ -32623,18 +33299,18 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 206: - case 227: + case 207: + case 228: nodes = container.statements; break; - case 135: + case 136: nodes = container.parameters.concat(container.parent.members); break; - case 201: + case 202: nodes = container.members; if (modifierFlag & 112) { var constructor = ts.forEach(container.members, function (member) { - return member.kind === 135 && member; + return member.kind === 136 && member; }); if (constructor) { nodes = nodes.concat(constructor.parameters); @@ -32682,13 +33358,13 @@ var ts; } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 136); tryPushAccessorKeyword(accessorDeclaration.symbol, 137); + tryPushAccessorKeyword(accessorDeclaration.symbol, 138); return ts.map(keywords, getHighlightSpanForNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 116, 120); }); + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 116, 121); }); } } } @@ -32705,7 +33381,7 @@ var ts; function getLoopBreakContinueOccurrences(loopNode) { var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 82, 100, 75)) { - if (loopNode.kind === 184) { + if (loopNode.kind === 185) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 100)) { @@ -32726,13 +33402,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 186: case 187: case 188: - case 184: + case 189: case 185: + case 186: return getLoopBreakContinueOccurrences(owner); - case 193: + case 194: return getSwitchCaseDefaultOccurrences(owner); } } @@ -32782,7 +33458,7 @@ var ts; } function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); - if (!(func && hasKind(func.body, 179))) { + if (!(func && hasKind(func.body, 180))) { return undefined; } var keywords = []; @@ -32796,7 +33472,7 @@ var ts; } function getIfElseOccurrences(ifStatement) { var keywords = []; - while (hasKind(ifStatement.parent, 183) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 184) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } while (ifStatement) { @@ -32807,7 +33483,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 183)) { + if (!hasKind(ifStatement.elseStatement, 184)) { break; } ifStatement = ifStatement.elseStatement; @@ -32965,16 +33641,16 @@ var ts; } function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 213 || location.parent.kind === 217) && + (location.parent.kind === 214 || location.parent.kind === 218) && location.parent.propertyName === location; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 213 || declaration.kind === 217; + return declaration.kind === 214 || declaration.kind === 218; }); } function getDeclaredName(symbol, location) { - var functionExpression = ts.forEach(symbol.declarations, function (d) { return d.kind === 162 ? d : undefined; }); + var functionExpression = ts.forEach(symbol.declarations, function (d) { return d.kind === 163 ? d : undefined; }); var name; if (functionExpression && functionExpression.name) { name = functionExpression.name.text; @@ -32989,7 +33665,7 @@ var ts; if (isImportOrExportSpecifierName(location)) { return location.getText(); } - var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 162 ? d : undefined; }); + var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 163 ? d : undefined; }); var name = functionExpression && functionExpression.name ? functionExpression.name.text : symbol.name; @@ -33007,7 +33683,7 @@ var ts; if (symbol.flags & (4 | 8192)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 201); + return ts.getAncestor(privateDeclaration, 202); } } if (symbol.flags & 8388608) { @@ -33028,7 +33704,7 @@ var ts; if (scope && scope !== container) { return undefined; } - if (container.kind === 227 && !ts.isExternalModule(container)) { + if (container.kind === 228 && !ts.isExternalModule(container)) { return undefined; } scope = container; @@ -33187,13 +33863,13 @@ var ts; } var staticFlag = 128; switch (searchSpaceNode.kind) { - case 132: - case 131: - case 134: case 133: + case 132: case 135: + case 134: case 136: case 137: + case 138: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; @@ -33221,32 +33897,32 @@ var ts; var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, false); var staticFlag = 128; switch (searchSpaceNode.kind) { + case 135: case 134: - case 133: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } + case 133: case 132: - case 131: - case 135: case 136: case 137: + case 138: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; break; - case 227: + case 228: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } - case 200: - case 162: + case 201: + case 163: break; default: return undefined; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 227) { + if (searchSpaceNode.kind === 228) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -33277,25 +33953,25 @@ var ts; } var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { - case 162: - case 200: + case 163: + case 201: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; + case 135: case 134: - case 133: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 201: + case 202: if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 227: - if (container.kind === 227 && !ts.isExternalModule(container)) { + case 228: + if (container.kind === 228 && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -33330,11 +34006,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 | 64)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 201) { + if (declaration.kind === 202) { getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 202) { + else if (declaration.kind === 203) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -33384,17 +34060,17 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_25 = node.text; + var name_26 = node.text; if (contextualType) { if (contextualType.flags & 16384) { - var unionProperty = contextualType.getProperty(name_25); + var unionProperty = contextualType.getProperty(name_26); if (unionProperty) { return [unionProperty]; } else { var result_4 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_25); + var symbol = t.getProperty(name_26); if (symbol) { result_4.push(symbol); } @@ -33403,7 +34079,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_25); + var symbol_1 = contextualType.getProperty(name_26); if (symbol_1) { return [symbol_1]; } @@ -33448,10 +34124,10 @@ var ts; } var parent = node.parent; if (parent) { - if (parent.kind === 168 || parent.kind === 167) { + if (parent.kind === 169 || parent.kind === 168) { return true; } - else if (parent.kind === 169 && parent.left === node) { + else if (parent.kind === 170 && parent.left === node) { var operator = parent.operatorToken.kind; return 53 <= operator && operator <= 64; } @@ -33484,33 +34160,33 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 129: - case 198: - case 152: + case 130: + case 199: + case 153: + case 133: case 132: - case 131: - case 224: case 225: case 226: - case 134: - case 133: + case 227: case 135: + case 134: case 136: case 137: - case 200: - case 162: - case 163: - case 223: - return 1; - case 128: - case 202: - case 203: - case 145: - return 2; + case 138: case 201: + case 163: + case 164: + case 224: + return 1; + case 129: + case 203: case 204: - return 1 | 2; + case 146: + return 2; + case 202: case 205: + return 1 | 2; + case 206: if (node.name.kind === 8) { return 4 | 1; } @@ -33520,14 +34196,14 @@ var ts; else { return 4; } - case 212: case 213: - case 208: - case 209: case 214: + case 209: + case 210: case 215: + case 216: return 1 | 2 | 4; - case 227: + case 228: return 4 | 1; } return 1 | 2 | 4; @@ -33537,7 +34213,7 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 141 || node.parent.kind === 177; + return node.parent.kind === 142 || node.parent.kind === 177; } function isNamespaceReference(node) { return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); @@ -33545,47 +34221,47 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 155) { - while (root.parent && root.parent.kind === 155) { + if (root.parent.kind === 156) { + while (root.parent && root.parent.kind === 156) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 177 && root.parent.parent.kind === 222) { + if (!isLastClause && root.parent.kind === 177 && root.parent.parent.kind === 223) { var decl = root.parent.parent.parent; - return (decl.kind === 201 && root.parent.parent.token === 102) || - (decl.kind === 202 && root.parent.parent.token === 79); + return (decl.kind === 202 && root.parent.parent.token === 102) || + (decl.kind === 203 && root.parent.parent.token === 79); } return false; } function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 126) { - while (root.parent && root.parent.kind === 126) { + if (root.parent.kind === 127) { + while (root.parent && root.parent.kind === 127) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 141 && !isLastClause; + return root.parent.kind === 142 && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 126) { + while (node.parent.kind === 127) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; } function getMeaningFromRightHandSideOfImportEquals(node) { ts.Debug.assert(node.kind === 65); - if (node.parent.kind === 126 && + if (node.parent.kind === 127 && node.parent.right === node && - node.parent.parent.kind === 208) { + node.parent.parent.kind === 209) { return 1 | 2 | 4; } return 4; } function getMeaningFromLocation(node) { - if (node.parent.kind === 214) { + if (node.parent.kind === 215) { return 1 | 2 | 4; } else if (isInRightSideOfImport(node)) { @@ -33619,8 +34295,8 @@ var ts; return; } switch (node.kind) { - case 155: - case 126: + case 156: + case 127: case 8: case 80: case 95: @@ -33638,7 +34314,7 @@ var ts; nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 205 && + if (nodeForStartPos.parent.parent.kind === 206 && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } @@ -33661,41 +34337,49 @@ var ts; return ts.NavigationBar.getNavigationBarItems(sourceFile); } function getSemanticClassifications(fileName, span) { + return convertClassifications(getEncodedSemanticClassifications(fileName, span)); + } + function getEncodedSemanticClassifications(fileName, span) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var typeChecker = program.getTypeChecker(); var result = []; processNode(sourceFile); - return result; + return { spans: result, endOfLineState: 0 }; + function pushClassification(start, length, type) { + result.push(start); + result.push(length); + result.push(type); + } function classifySymbol(symbol, meaningAtPosition) { var flags = symbol.getFlags(); if (flags & 32) { - return ClassificationTypeNames.className; + return 11; } else if (flags & 384) { - return ClassificationTypeNames.enumName; + return 12; } else if (flags & 524288) { - return ClassificationTypeNames.typeAlias; + return 16; } else if (meaningAtPosition & 2) { if (flags & 64) { - return ClassificationTypeNames.interfaceName; + return 13; } else if (flags & 262144) { - return ClassificationTypeNames.typeParameterName; + return 15; } } else if (flags & 1536) { if (meaningAtPosition & 4 || (meaningAtPosition & 1 && hasValueSideModule(symbol))) { - return ClassificationTypeNames.moduleName; + return 14; } } return undefined; function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 205 && ts.getModuleInstanceState(declaration) == 1; + return declaration.kind === 206 && ts.getModuleInstanceState(declaration) == 1; }); } } @@ -33706,10 +34390,7 @@ var ts; if (symbol) { var type = classifySymbol(symbol, getMeaningFromLocation(node)); if (type) { - result.push({ - textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), - classificationType: type - }); + pushClassification(node.getStart(), node.getWidth(), type); } } } @@ -33717,13 +34398,53 @@ var ts; } } } + function getClassificationTypeName(type) { + switch (type) { + case 1: return ClassificationTypeNames.comment; + case 2: return ClassificationTypeNames.identifier; + case 3: return ClassificationTypeNames.keyword; + case 4: return ClassificationTypeNames.numericLiteral; + case 5: return ClassificationTypeNames.operator; + case 6: return ClassificationTypeNames.stringLiteral; + case 8: return ClassificationTypeNames.whiteSpace; + case 9: return ClassificationTypeNames.text; + case 10: return ClassificationTypeNames.punctuation; + case 11: return ClassificationTypeNames.className; + case 12: return ClassificationTypeNames.enumName; + case 13: return ClassificationTypeNames.interfaceName; + case 14: return ClassificationTypeNames.moduleName; + case 15: return ClassificationTypeNames.typeParameterName; + case 16: return ClassificationTypeNames.typeAliasName; + case 17: return ClassificationTypeNames.parameterName; + } + } + function convertClassifications(classifications) { + ts.Debug.assert(classifications.spans.length % 3 === 0); + var dense = classifications.spans; + var result = []; + for (var i = 0, n = dense.length; i < n; i += 3) { + result.push({ + textSpan: ts.createTextSpan(dense[i], dense[i + 1]), + classificationType: getClassificationTypeName(dense[i + 2]) + }); + } + return result; + } function getSyntacticClassifications(fileName, span) { + return convertClassifications(getEncodedSyntacticClassifications(fileName, span)); + } + function getEncodedSyntacticClassifications(fileName, span) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); var triviaScanner = ts.createScanner(2, false, sourceFile.text); var mergeConflictScanner = ts.createScanner(2, false, sourceFile.text); var result = []; processElement(sourceFile); - return result; + return { spans: result, endOfLineState: 0 }; + function pushClassification(start, length, type) { + result.push(start); + result.push(length); + result.push(type); + } function classifyLeadingTrivia(token) { var tokenStart = ts.skipTrivia(sourceFile.text, token.pos, false); if (tokenStart === token.pos) { @@ -33740,20 +34461,14 @@ var ts; return; } if (ts.isComment(kind)) { - result.push({ - textSpan: ts.createTextSpan(start, width), - classificationType: ClassificationTypeNames.comment - }); + pushClassification(start, width, 1); 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 - }); + pushClassification(start, width, 1); continue; } ts.Debug.assert(ch === 61); @@ -33768,10 +34483,7 @@ var ts; break; } } - result.push({ - textSpan: ts.createTextSpanFromBounds(start, i), - classificationType: ClassificationTypeNames.comment - }); + pushClassification(start, i - start, 1); mergeConflictScanner.setTextPos(i); while (mergeConflictScanner.getTextPos() < end) { classifyDisabledCodeToken(); @@ -33783,10 +34495,7 @@ var ts; var end = mergeConflictScanner.getTextPos(); var type = classifyTokenType(tokenKind); if (type) { - result.push({ - textSpan: ts.createTextSpanFromBounds(start, end), - classificationType: type - }); + pushClassification(start, end - start, type); } } function classifyToken(token) { @@ -33794,83 +34503,85 @@ var ts; if (token.getWidth() > 0) { var type = classifyTokenType(token.kind, token); if (type) { - result.push({ - textSpan: ts.createTextSpan(token.getStart(), token.getWidth()), - classificationType: type - }); + pushClassification(token.getStart(), token.getWidth(), type); } } } function classifyTokenType(tokenKind, token) { if (ts.isKeyword(tokenKind)) { - return ClassificationTypeNames.keyword; + return 3; } if (tokenKind === 24 || tokenKind === 25) { if (token && ts.getTypeArgumentOrTypeParameterList(token.parent)) { - return ClassificationTypeNames.punctuation; + return 10; } } if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 53) { - if (token.parent.kind === 198 || - token.parent.kind === 132 || - token.parent.kind === 129) { - return ClassificationTypeNames.operator; + if (token.parent.kind === 199 || + token.parent.kind === 133 || + token.parent.kind === 130) { + return 5; } } - if (token.parent.kind === 169 || - token.parent.kind === 167 || + if (token.parent.kind === 170 || token.parent.kind === 168 || - token.parent.kind === 170) { - return ClassificationTypeNames.operator; + token.parent.kind === 169 || + token.parent.kind === 171) { + return 5; } } - return ClassificationTypeNames.punctuation; + return 10; } else if (tokenKind === 7) { - return ClassificationTypeNames.numericLiteral; + return 4; } else if (tokenKind === 8) { - return ClassificationTypeNames.stringLiteral; + return 6; } else if (tokenKind === 9) { - return ClassificationTypeNames.stringLiteral; + return 6; } else if (ts.isTemplateLiteralKind(tokenKind)) { - return ClassificationTypeNames.stringLiteral; + return 6; } else if (tokenKind === 65) { if (token) { switch (token.parent.kind) { - case 201: - if (token.parent.name === token) { - return ClassificationTypeNames.className; - } - return; - case 128: - if (token.parent.name === token) { - return ClassificationTypeNames.typeParameterName; - } - return; case 202: if (token.parent.name === token) { - return ClassificationTypeNames.interfaceName; + return 11; } return; - case 204: + case 129: if (token.parent.name === token) { - return ClassificationTypeNames.enumName; + return 15; + } + return; + case 203: + if (token.parent.name === token) { + return 13; } return; case 205: if (token.parent.name === token) { - return ClassificationTypeNames.moduleName; + return 12; + } + return; + case 206: + if (token.parent.name === token) { + return 14; + } + return; + case 130: + if (token.parent.name === token) { + return 17; } return; } } - return ClassificationTypeNames.text; + return 9; } } function processElement(element) { @@ -34079,6 +34790,8 @@ var ts; getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics, getSyntacticClassifications: getSyntacticClassifications, getSemanticClassifications: getSemanticClassifications, + getEncodedSyntacticClassifications: getEncodedSyntacticClassifications, + getEncodedSemanticClassifications: getEncodedSemanticClassifications, getCompletionsAtPosition: getCompletionsAtPosition, getCompletionEntryDetails: getCompletionEntryDetails, getSignatureHelpItems: getSignatureHelpItems, @@ -34126,7 +34839,7 @@ var ts; case 8: case 7: if (ts.isDeclarationName(node) || - node.parent.kind === 219 || + node.parent.kind === 220 || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } @@ -34139,7 +34852,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 156 && + node.parent.kind === 157 && node.parent.argumentExpression === node; } function createClassifier() { @@ -34161,7 +34874,7 @@ var ts; function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { if (keyword2 === 116 || - keyword2 === 120 || + keyword2 === 121 || keyword2 === 114 || keyword2 === 109) { return true; @@ -34170,7 +34883,55 @@ var ts; } return true; } + function convertClassifications(classifications, text) { + var entries = []; + var dense = classifications.spans; + var lastEnd = 0; + for (var i = 0, n = dense.length; i < n; i += 3) { + var start = dense[i]; + var length_1 = dense[i + 1]; + var type = dense[i + 2]; + if (lastEnd >= 0) { + var whitespaceLength_1 = start - lastEnd; + if (whitespaceLength_1 > 0) { + entries.push({ length: whitespaceLength_1, classification: TokenClass.Whitespace }); + } + } + entries.push({ length: length_1, classification: convertClassification(type) }); + lastEnd = start + length_1; + } + var whitespaceLength = text.length - lastEnd; + if (whitespaceLength > 0) { + entries.push({ length: whitespaceLength, classification: TokenClass.Whitespace }); + } + return { entries: entries, finalLexState: classifications.endOfLineState }; + } + function convertClassification(type) { + switch (type) { + case 1: return TokenClass.Comment; + case 3: return TokenClass.Keyword; + case 4: return TokenClass.NumberLiteral; + case 5: return TokenClass.Operator; + case 6: return TokenClass.StringLiteral; + case 8: return TokenClass.Whitespace; + case 10: return TokenClass.Punctuation; + case 2: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 9: + case 17: + default: + return TokenClass.Identifier; + } + } function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) { + return convertClassifications(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text); + } + function getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent) { var offset = 0; var token = 0; var lastNonTriviaToken = 0; @@ -34203,8 +34964,8 @@ var ts; } scanner.setText(text); var result = { - finalLexState: 0, - entries: [] + endOfLineState: 0, + spans: [] }; var angleBracketStack = 0; do { @@ -34229,10 +34990,10 @@ var ts; angleBracketStack--; } else if (token === 112 || - token === 121 || - token === 119 || + token === 122 || + token === 120 || token === 113 || - token === 122) { + token === 123) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { token = 65; } @@ -34271,7 +35032,7 @@ var ts; function processToken() { var start = scanner.getTokenPos(); var end = scanner.getTextPos(); - addResult(end - start, classFromKind(token)); + addResult(start, end, classFromKind(token)); if (end >= text.length) { if (token === 8) { var tokenText = scanner.getTokenText(); @@ -34283,7 +35044,7 @@ var ts; } if (numBackslashes & 1) { var quoteChar = tokenText.charCodeAt(0); - result.finalLexState = quoteChar === 34 + result.endOfLineState = quoteChar === 34 ? 3 : 2; } @@ -34291,16 +35052,16 @@ var ts; } else if (token === 3) { if (scanner.isUnterminated()) { - result.finalLexState = 1; + result.endOfLineState = 1; } } else if (ts.isTemplateLiteralKind(token)) { if (scanner.isUnterminated()) { if (token === 13) { - result.finalLexState = 5; + result.endOfLineState = 5; } else if (token === 10) { - result.finalLexState = 4; + result.endOfLineState = 4; } else { ts.Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #" + token); @@ -34308,16 +35069,24 @@ var ts; } } else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 11) { - result.finalLexState = 6; + result.endOfLineState = 6; } } } - function addResult(length, classification) { + function addResult(start, end, classification) { + if (classification === 8) { + return; + } + if (start === 0 && offset > 0) { + start += offset; + } + start -= offset; + end -= offset; + var length = end - start; if (length > 0) { - if (result.entries.length === 0) { - length -= offset; - } - result.entries.push({ length: length, classification: classification }); + result.spans.push(start); + result.spans.push(length); + result.spans.push(classification); } } } @@ -34378,41 +35147,44 @@ var ts; } } function isKeyword(token) { - return token >= 66 && token <= 125; + return token >= 66 && token <= 126; } function classFromKind(token) { if (isKeyword(token)) { - return TokenClass.Keyword; + return 3; } else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { - return TokenClass.Operator; + return 5; } else if (token >= 14 && token <= 64) { - return TokenClass.Punctuation; + return 10; } switch (token) { case 7: - return TokenClass.NumberLiteral; + return 4; case 8: - return TokenClass.StringLiteral; + return 6; case 9: - return TokenClass.RegExpLiteral; + return 7; case 6: case 3: case 2: - return TokenClass.Comment; + return 1; case 5: case 4: - return TokenClass.Whitespace; + return 8; case 65: default: if (ts.isTemplateLiteralKind(token)) { - return TokenClass.StringLiteral; + return 6; } - return TokenClass.Identifier; + return 2; } } - return { getClassificationsForLine: getClassificationsForLine }; + return { + getClassificationsForLine: getClassificationsForLine, + getEncodedLexicalClassifications: getEncodedLexicalClassifications + }; } ts.createClassifier = createClassifier; function getDefaultLibFilePath(options) { @@ -34427,7 +35199,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 227 ? new SourceFileObject() : new NodeObject(); + var proto = kind === 228 ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = 0; proto.end = 0; @@ -36019,7 +36791,7 @@ var ts; return { errorMsg: "tsconfig syntax error" }; } else { - var parsedCommandLine = ts.parseConfigFile(rawConfig, dirPath); + var parsedCommandLine = ts.parseConfigFile(rawConfig, ts.sys, dirPath); if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) { return { errorMsg: "tsconfig option errors" }; } diff --git a/bin/typescript.d.ts b/bin/typescript.d.ts index 00ddd433179..7cf08879eaa 100644 --- a/bin/typescript.d.ts +++ b/bin/typescript.d.ts @@ -140,132 +140,133 @@ declare module "typescript" { DeclareKeyword = 115, GetKeyword = 116, ModuleKeyword = 117, - RequireKeyword = 118, - NumberKeyword = 119, - SetKeyword = 120, - StringKeyword = 121, - SymbolKeyword = 122, - TypeKeyword = 123, - FromKeyword = 124, - OfKeyword = 125, - QualifiedName = 126, - ComputedPropertyName = 127, - TypeParameter = 128, - Parameter = 129, - Decorator = 130, - PropertySignature = 131, - PropertyDeclaration = 132, - MethodSignature = 133, - MethodDeclaration = 134, - Constructor = 135, - GetAccessor = 136, - SetAccessor = 137, - CallSignature = 138, - ConstructSignature = 139, - IndexSignature = 140, - TypeReference = 141, - FunctionType = 142, - ConstructorType = 143, - TypeQuery = 144, - TypeLiteral = 145, - ArrayType = 146, - TupleType = 147, - UnionType = 148, - ParenthesizedType = 149, - ObjectBindingPattern = 150, - ArrayBindingPattern = 151, - BindingElement = 152, - ArrayLiteralExpression = 153, - ObjectLiteralExpression = 154, - PropertyAccessExpression = 155, - ElementAccessExpression = 156, - CallExpression = 157, - NewExpression = 158, - TaggedTemplateExpression = 159, - TypeAssertionExpression = 160, - ParenthesizedExpression = 161, - FunctionExpression = 162, - ArrowFunction = 163, - DeleteExpression = 164, - TypeOfExpression = 165, - VoidExpression = 166, - PrefixUnaryExpression = 167, - PostfixUnaryExpression = 168, - BinaryExpression = 169, - ConditionalExpression = 170, - TemplateExpression = 171, - YieldExpression = 172, - SpreadElementExpression = 173, - ClassExpression = 174, - OmittedExpression = 175, - TemplateSpan = 176, - HeritageClauseElement = 177, - SemicolonClassElement = 178, - Block = 179, - VariableStatement = 180, - EmptyStatement = 181, - ExpressionStatement = 182, - IfStatement = 183, - DoStatement = 184, - WhileStatement = 185, - ForStatement = 186, - ForInStatement = 187, - ForOfStatement = 188, - ContinueStatement = 189, - BreakStatement = 190, - ReturnStatement = 191, - WithStatement = 192, - SwitchStatement = 193, - LabeledStatement = 194, - ThrowStatement = 195, - TryStatement = 196, - DebuggerStatement = 197, - VariableDeclaration = 198, - VariableDeclarationList = 199, - FunctionDeclaration = 200, - ClassDeclaration = 201, - InterfaceDeclaration = 202, - TypeAliasDeclaration = 203, - EnumDeclaration = 204, - ModuleDeclaration = 205, - ModuleBlock = 206, - CaseBlock = 207, - ImportEqualsDeclaration = 208, - ImportDeclaration = 209, - ImportClause = 210, - NamespaceImport = 211, - NamedImports = 212, - ImportSpecifier = 213, - ExportAssignment = 214, - ExportDeclaration = 215, - NamedExports = 216, - ExportSpecifier = 217, - MissingDeclaration = 218, - ExternalModuleReference = 219, - CaseClause = 220, - DefaultClause = 221, - HeritageClause = 222, - CatchClause = 223, - PropertyAssignment = 224, - ShorthandPropertyAssignment = 225, - EnumMember = 226, - SourceFile = 227, - SyntaxList = 228, - Count = 229, + NamespaceKeyword = 118, + RequireKeyword = 119, + NumberKeyword = 120, + SetKeyword = 121, + StringKeyword = 122, + SymbolKeyword = 123, + TypeKeyword = 124, + FromKeyword = 125, + OfKeyword = 126, + QualifiedName = 127, + ComputedPropertyName = 128, + TypeParameter = 129, + Parameter = 130, + Decorator = 131, + PropertySignature = 132, + PropertyDeclaration = 133, + MethodSignature = 134, + MethodDeclaration = 135, + Constructor = 136, + GetAccessor = 137, + SetAccessor = 138, + CallSignature = 139, + ConstructSignature = 140, + IndexSignature = 141, + TypeReference = 142, + FunctionType = 143, + ConstructorType = 144, + TypeQuery = 145, + TypeLiteral = 146, + ArrayType = 147, + TupleType = 148, + UnionType = 149, + ParenthesizedType = 150, + ObjectBindingPattern = 151, + ArrayBindingPattern = 152, + BindingElement = 153, + ArrayLiteralExpression = 154, + ObjectLiteralExpression = 155, + PropertyAccessExpression = 156, + ElementAccessExpression = 157, + CallExpression = 158, + NewExpression = 159, + TaggedTemplateExpression = 160, + TypeAssertionExpression = 161, + ParenthesizedExpression = 162, + FunctionExpression = 163, + ArrowFunction = 164, + DeleteExpression = 165, + TypeOfExpression = 166, + VoidExpression = 167, + PrefixUnaryExpression = 168, + PostfixUnaryExpression = 169, + BinaryExpression = 170, + ConditionalExpression = 171, + TemplateExpression = 172, + YieldExpression = 173, + SpreadElementExpression = 174, + ClassExpression = 175, + OmittedExpression = 176, + ExpressionWithTypeArguments = 177, + TemplateSpan = 178, + SemicolonClassElement = 179, + Block = 180, + VariableStatement = 181, + EmptyStatement = 182, + ExpressionStatement = 183, + IfStatement = 184, + DoStatement = 185, + WhileStatement = 186, + ForStatement = 187, + ForInStatement = 188, + ForOfStatement = 189, + ContinueStatement = 190, + BreakStatement = 191, + ReturnStatement = 192, + WithStatement = 193, + SwitchStatement = 194, + LabeledStatement = 195, + ThrowStatement = 196, + TryStatement = 197, + DebuggerStatement = 198, + VariableDeclaration = 199, + VariableDeclarationList = 200, + FunctionDeclaration = 201, + ClassDeclaration = 202, + InterfaceDeclaration = 203, + TypeAliasDeclaration = 204, + EnumDeclaration = 205, + ModuleDeclaration = 206, + ModuleBlock = 207, + CaseBlock = 208, + ImportEqualsDeclaration = 209, + ImportDeclaration = 210, + ImportClause = 211, + NamespaceImport = 212, + NamedImports = 213, + ImportSpecifier = 214, + ExportAssignment = 215, + ExportDeclaration = 216, + NamedExports = 217, + ExportSpecifier = 218, + MissingDeclaration = 219, + ExternalModuleReference = 220, + CaseClause = 221, + DefaultClause = 222, + HeritageClause = 223, + CatchClause = 224, + PropertyAssignment = 225, + ShorthandPropertyAssignment = 226, + EnumMember = 227, + SourceFile = 228, + SyntaxList = 229, + Count = 230, FirstAssignment = 53, LastAssignment = 64, FirstReservedWord = 66, LastReservedWord = 101, FirstKeyword = 66, - LastKeyword = 125, + LastKeyword = 126, FirstFutureReservedWord = 102, LastFutureReservedWord = 110, - FirstTypeNode = 141, - LastTypeNode = 149, + FirstTypeNode = 142, + LastTypeNode = 150, FirstPunctuation = 14, LastPunctuation = 64, FirstToken = 0, - LastToken = 125, + LastToken = 126, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -274,7 +275,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 64, - FirstNode = 126, + FirstNode = 127, } const enum NodeFlags { Export = 1, @@ -290,7 +291,8 @@ declare module "typescript" { Let = 4096, Const = 8192, OctalLiteral = 16384, - ExportContext = 32768, + Namespace = 32768, + ExportContext = 65536, Modifier = 499, AccessibilityModifier = 112, BlockScoped = 12288, @@ -553,7 +555,7 @@ declare module "typescript" { typeArguments?: NodeArray; arguments: NodeArray; } - interface HeritageClauseElement extends TypeNode { + interface ExpressionWithTypeArguments extends TypeNode { expression: LeftHandSideExpression; typeArguments?: NodeArray; } @@ -672,7 +674,7 @@ declare module "typescript" { } interface HeritageClause extends Node { token: SyntaxKind; - types?: NodeArray; + types?: NodeArray; } interface TypeAliasDeclaration extends Declaration, ModuleElement { name: Identifier; @@ -756,6 +758,9 @@ declare module "typescript" { getSourceFile(fileName: string): SourceFile; getCurrentDirectory(): string; } + interface ParseConfigHost { + readDirectory(rootDir: string, extension: string): string[]; + } interface WriteFileCallback { (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; } @@ -804,6 +809,7 @@ declare module "typescript" { sourceMapFile: string; sourceMapSourceRoot: string; sourceMapSources: string[]; + sourceMapSourcesContent?: string[]; inputSourceFileNames: string[]; sourceMapNames?: string[]; sourceMapMappings: string; @@ -1082,11 +1088,14 @@ declare module "typescript" { diagnostics?: boolean; emitBOM?: boolean; help?: boolean; + inlineSourceMap?: boolean; + inlineSources?: boolean; listFiles?: boolean; locale?: string; mapRoot?: string; module?: ModuleKind; noEmit?: boolean; + noEmitHelpers?: boolean; noEmitOnError?: boolean; noErrorTruncation?: boolean; noImplicitAny?: boolean; @@ -1113,6 +1122,7 @@ declare module "typescript" { CommonJS = 1, AMD = 2, UMD = 3, + System = 4, } interface LineAndCharacter { line: number; @@ -1226,7 +1236,7 @@ declare module "typescript" { const version: string; function findConfigFile(searchPath: string): string; function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; - function getPreEmitDiagnostics(program: Program): Diagnostic[]; + function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile): Diagnostic[]; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; } @@ -1236,14 +1246,26 @@ declare module "typescript" { * Read tsconfig.json file * @param fileName The path to the config file */ - function readConfigFile(fileName: string): any; + function readConfigFile(fileName: string): { + config?: any; + error?: Diagnostic; + }; + /** + * Parse the text of the tsconfig.json file + * @param fileName The path to the config file + * @param jsonText The text of the config file + */ + function parseConfigFileText(fileName: string, jsonText: string): { + config?: any; + error?: Diagnostic; + }; /** * Parse the contents of a config file (tsconfig.json). * @param json The contents of the config file to parse * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; + function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine; } declare module "typescript" { /** The version of the language service API */ @@ -1340,8 +1362,16 @@ declare module "typescript" { getSyntacticDiagnostics(fileName: string): Diagnostic[]; getSemanticDiagnostics(fileName: string): Diagnostic[]; getCompilerOptionsDiagnostics(): Diagnostic[]; + /** + * @deprecated Use getEncodedSyntacticClassifications instead. + */ getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + /** + * @deprecated Use getEncodedSemanticClassifications instead. + */ getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications; + getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications; getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; @@ -1370,6 +1400,10 @@ declare module "typescript" { getSourceFile(fileName: string): SourceFile; dispose(): void; } + interface Classifications { + spans: number[]; + endOfLineState: EndOfLineState; + } interface ClassifiedSpan { textSpan: TextSpan; classificationType: string; @@ -1581,7 +1615,7 @@ declare module "typescript" { text: string; } const enum EndOfLineState { - Start = 0, + None = 0, InMultiLineCommentTrivia = 1, InSingleQuoteStringLiteral = 2, InDoubleQuoteStringLiteral = 3, @@ -1627,8 +1661,10 @@ declare module "typescript" { * classifications which may be incorrectly categorized will be given * back as Identifiers in order to allow the syntactic classifier to * subsume the classification. + * @deprecated Use getLexicalClassifications instead. */ getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; + getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications; } /** * The document registry represents a store of SourceFile objects that can be shared between @@ -1739,7 +1775,27 @@ declare module "typescript" { static interfaceName: string; static moduleName: string; static typeParameterName: string; - static typeAlias: string; + static typeAliasName: string; + static parameterName: string; + } + const enum ClassificationType { + comment = 1, + identifier = 2, + keyword = 3, + numericLiteral = 4, + operator = 5, + stringLiteral = 6, + regularExpressionLiteral = 7, + whiteSpace = 8, + text = 9, + punctuation = 10, + className = 11, + enumName = 12, + interfaceName = 13, + moduleName = 14, + typeParameterName = 15, + typeAliasName = 16, + parameterName = 17, } interface DisplayPartsSymbolWriter extends SymbolWriter { displayParts(): SymbolDisplayPart[]; diff --git a/bin/typescript.js b/bin/typescript.js index fefe3658fb4..588078a9d94 100644 --- a/bin/typescript.js +++ b/bin/typescript.js @@ -145,149 +145,150 @@ var ts; SyntaxKind[SyntaxKind["DeclareKeyword"] = 115] = "DeclareKeyword"; SyntaxKind[SyntaxKind["GetKeyword"] = 116] = "GetKeyword"; SyntaxKind[SyntaxKind["ModuleKeyword"] = 117] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 118] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 119] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 120] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 121] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 122] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 123] = "TypeKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 124] = "FromKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 125] = "OfKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 118] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 119] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 120] = "NumberKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 121] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 122] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 123] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 124] = "TypeKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 125] = "FromKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 126] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 126] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 127] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 127] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 128] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 128] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 129] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 130] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 129] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 130] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 131] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 131] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 132] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 133] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 134] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 135] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 136] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 137] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 138] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 139] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 140] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 132] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 133] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 134] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 135] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 136] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 137] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 138] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 139] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 140] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 141] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypeReference"] = 141] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 142] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 143] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 144] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 145] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 146] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 147] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 148] = "UnionType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 149] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["TypeReference"] = 142] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 143] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 144] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 145] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 146] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 147] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 148] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 149] = "UnionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 150] = "ParenthesizedType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 150] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 151] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 152] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 151] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 152] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 153] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 153] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 154] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 155] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 156] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 157] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 158] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 159] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 160] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 161] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 162] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 163] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 164] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 165] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 166] = "VoidExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 167] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 168] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 169] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 170] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 171] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 172] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElementExpression"] = 173] = "SpreadElementExpression"; - SyntaxKind[SyntaxKind["ClassExpression"] = 174] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 175] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 154] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 155] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 156] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 157] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 158] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 159] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 160] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 161] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 162] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 163] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 164] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 165] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 166] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 167] = "VoidExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 168] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 169] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 170] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 171] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 172] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 173] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElementExpression"] = 174] = "SpreadElementExpression"; + SyntaxKind[SyntaxKind["ClassExpression"] = 175] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 176] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 177] = "ExpressionWithTypeArguments"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 176] = "TemplateSpan"; - SyntaxKind[SyntaxKind["HeritageClauseElement"] = 177] = "HeritageClauseElement"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 178] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 178] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 179] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 179] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 180] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 181] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 182] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 183] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 184] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 185] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 186] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 187] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 188] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 189] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 190] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 191] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 192] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 193] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 194] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 195] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 196] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 197] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 198] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 199] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 200] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 201] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 202] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 203] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 204] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 205] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 206] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 207] = "CaseBlock"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 208] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 209] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 210] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 211] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 212] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 213] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 214] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 215] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 216] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 217] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 218] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 180] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 181] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 182] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 183] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 184] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 185] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 186] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 187] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 188] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 189] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 190] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 191] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 192] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 193] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 194] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 195] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 196] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 197] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 198] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 199] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 200] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 201] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 202] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 203] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 204] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 205] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 206] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 207] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 208] = "CaseBlock"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 209] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 210] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 211] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 212] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 213] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 214] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 215] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 216] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 217] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 218] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 219] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 219] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 220] = "ExternalModuleReference"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 220] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 221] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 222] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 223] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 221] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 222] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 223] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 224] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 224] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 225] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 225] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 226] = "ShorthandPropertyAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 226] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 227] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 227] = "SourceFile"; + SyntaxKind[SyntaxKind["SourceFile"] = 228] = "SourceFile"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 228] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 229] = "SyntaxList"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 229] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 230] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 53] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 64] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstReservedWord"] = 66] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 101] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 66] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 125] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 126] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 102] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 110] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 141] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 149] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 142] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 150] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 14] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 64] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 125] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 126] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 6] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 7] = "FirstLiteralToken"; @@ -296,7 +297,7 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 13] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 24] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 64] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstNode"] = 126] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstNode"] = 127] = "FirstNode"; })(ts.SyntaxKind || (ts.SyntaxKind = {})); var SyntaxKind = ts.SyntaxKind; (function (NodeFlags) { @@ -313,7 +314,8 @@ var ts; NodeFlags[NodeFlags["Let"] = 4096] = "Let"; NodeFlags[NodeFlags["Const"] = 8192] = "Const"; NodeFlags[NodeFlags["OctalLiteral"] = 16384] = "OctalLiteral"; - NodeFlags[NodeFlags["ExportContext"] = 32768] = "ExportContext"; + NodeFlags[NodeFlags["Namespace"] = 32768] = "Namespace"; + NodeFlags[NodeFlags["ExportContext"] = 65536] = "ExportContext"; NodeFlags[NodeFlags["Modifier"] = 499] = "Modifier"; NodeFlags[NodeFlags["AccessibilityModifier"] = 112] = "AccessibilityModifier"; NodeFlags[NodeFlags["BlockScoped"] = 12288] = "BlockScoped"; @@ -542,6 +544,7 @@ var ts; ModuleKind[ModuleKind["CommonJS"] = 1] = "CommonJS"; ModuleKind[ModuleKind["AMD"] = 2] = "AMD"; ModuleKind[ModuleKind["UMD"] = 3] = "UMD"; + ModuleKind[ModuleKind["System"] = 4] = "System"; })(ts.ModuleKind || (ts.ModuleKind = {})); var ModuleKind = ts.ModuleKind; (function (ScriptTarget) { @@ -1695,7 +1698,7 @@ var ts; A_get_accessor_cannot_have_parameters: { code: 1054, category: ts.DiagnosticCategory.Error, key: "A 'get' accessor cannot have parameters." }, Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum member must have initializer." }, - An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An export assignment cannot be used in an internal module." }, + An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An export assignment cannot be used in a namespace." }, Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: ts.DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers." }, Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an import declaration." }, @@ -1756,8 +1759,8 @@ var ts; or_expected: { code: 1144, category: ts.DiagnosticCategory.Error, key: "'{' or ';' expected." }, Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: ts.DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members." }, Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: "Declaration expected." }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Cannot compile external modules unless the '--module' flag is provided." }, + Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: "Import declarations in a namespace cannot reference a module." }, + Cannot_compile_modules_unless_the_module_flag_is_provided: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules unless the '--module' flag is provided." }, File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, var_let_or_const_expected: { code: 1152, category: ts.DiagnosticCategory.Error, key: "'var', 'let' or 'const' expected." }, @@ -1799,9 +1802,9 @@ var ts; The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: ts.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: ts.DiagnosticCategory.Error, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, An_import_declaration_cannot_have_modifiers: { code: 1191, category: ts.DiagnosticCategory.Error, key: "An import declaration cannot have modifiers." }, - External_module_0_has_no_default_export: { code: 1192, category: ts.DiagnosticCategory.Error, key: "External module '{0}' has no default export." }, + Module_0_has_no_default_export: { code: 1192, category: ts.DiagnosticCategory.Error, key: "Module '{0}' has no default export." }, An_export_declaration_cannot_have_modifiers: { code: 1193, category: ts.DiagnosticCategory.Error, key: "An export declaration cannot have modifiers." }, - Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: ts.DiagnosticCategory.Error, key: "Export declarations are not permitted in an internal module." }, + Export_declarations_are_not_permitted_in_a_namespace: { code: 1194, category: ts.DiagnosticCategory.Error, key: "Export declarations are not permitted in a namespace." }, Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: ts.DiagnosticCategory.Error, key: "Catch clause variable name must be an identifier." }, Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: ts.DiagnosticCategory.Error, key: "Catch clause variable cannot have a type annotation." }, Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: ts.DiagnosticCategory.Error, key: "Catch clause variable cannot have an initializer." }, @@ -1810,28 +1813,27 @@ var ts; Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." }, Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." }, Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." }, - Cannot_compile_external_modules_into_amd_commonjs_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher." }, + Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher." }, Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, - Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." }, + Cannot_compile_namespaces_when_the_separateCompilation_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--separateCompilation' flag is provided." }, Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." }, Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: ts.DiagnosticCategory.Error, key: "Invalid use of '{0}'. Class definitions are automatically in strict mode." }, A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" }, Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode" }, Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: ts.DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, - Identifier_expected_0_is_a_reserved_word_in_strict_mode_External_Module_is_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. External Module is automatically in strict mode." }, Type_expected_0_is_a_reserved_word_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode" }, Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, - Type_expected_0_is_a_reserved_word_in_strict_mode_Module_is_automatically_in_strict_mode: { code: 1217, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Module is automatically in strict mode." }, + Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export assignment is not supported when '--module' flag is 'system'." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.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: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, Circular_definition_of_import_alias_0: { code: 2303, category: ts.DiagnosticCategory.Error, key: "Circular definition of import alias '{0}'." }, Cannot_find_name_0: { code: 2304, category: ts.DiagnosticCategory.Error, key: "Cannot find name '{0}'." }, Module_0_has_no_exported_member_1: { code: 2305, category: ts.DiagnosticCategory.Error, key: "Module '{0}' has no exported member '{1}'." }, - File_0_is_not_an_external_module: { code: 2306, category: ts.DiagnosticCategory.Error, key: "File '{0}' is not an external module." }, - Cannot_find_external_module_0: { code: 2307, category: ts.DiagnosticCategory.Error, key: "Cannot find external module '{0}'." }, + File_0_is_not_a_module: { code: 2306, category: ts.DiagnosticCategory.Error, key: "File '{0}' is not a module." }, + Cannot_find_module_0: { code: 2307, category: ts.DiagnosticCategory.Error, key: "Cannot find module '{0}'." }, A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Type '{0}' recursively references itself as a base type." }, @@ -1854,7 +1856,7 @@ var ts; Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: ts.DiagnosticCategory.Error, key: "Types of parameters '{0}' and '{1}' are incompatible." }, Index_signature_is_missing_in_type_0: { code: 2329, category: ts.DiagnosticCategory.Error, key: "Index signature is missing in type '{0}'." }, Index_signatures_are_incompatible: { code: 2330, category: ts.DiagnosticCategory.Error, key: "Index signatures are incompatible." }, - this_cannot_be_referenced_in_a_module_body: { code: 2331, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in a module body." }, + this_cannot_be_referenced_in_a_module_or_namespace_body: { code: 2331, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in a module or namespace body." }, this_cannot_be_referenced_in_current_location: { code: 2332, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in current location." }, this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in constructor arguments." }, this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in a static property initializer." }, @@ -1946,15 +1948,15 @@ var ts; Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: "Interface '{0}' incorrectly extends interface '{1}'." }, Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Ambient external modules cannot be nested in other modules." }, - Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient external module declaration cannot specify relative module name." }, + A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be in a different file from a class or function with which it is merged" }, + A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be located prior to a class or function with which it is merged" }, + Ambient_modules_cannot_be_nested_in_other_modules: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient modules cannot be nested in other modules." }, + Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient module declaration cannot specify relative module name." }, Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module '{0}' is hidden by a local declaration with the same name" }, Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import name cannot be '{0}'" }, - Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." }, + Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: "Import or export declaration in an ambient module declaration cannot reference module through relative module name." }, Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.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: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { code: 2441, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module." }, Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, @@ -2008,8 +2010,8 @@ var ts; Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: ts.DiagnosticCategory.Error, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: ts.DiagnosticCategory.Error, key: "Type '{0}' is not an array type or a string type." }, The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: { code: 2496, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression." }, - External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, - External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." }, + Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: "Module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, + Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: "Module '{0}' uses 'export =' and cannot be used with 'export *'." }, An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." }, @@ -2088,6 +2090,7 @@ var ts; Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot read file '{0}': {1}" }, Unsupported_file_encoding: { code: 5013, category: ts.DiagnosticCategory.Error, key: "Unsupported file encoding." }, + Failed_to_parse_file_0_Colon_1: { code: 5014, category: ts.DiagnosticCategory.Error, key: "Failed to parse file '{0}': {1}." }, Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, @@ -2101,6 +2104,10 @@ var ts; Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { code: 5045, category: ts.DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." }, Option_out_cannot_be_specified_with_option_separateCompilation: { code: 5046, category: ts.DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'separateCompilation'." }, Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, + Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap: { code: 5048, category: ts.DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'." }, + Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5049, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'." }, + Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5050, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'." }, + Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -2112,7 +2119,7 @@ var ts; Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_amd_or_umd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', or 'umd'." }, + Specify_module_code_generation_Colon_commonjs_amd_system_or_umd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print the compiler's version." }, Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile the project in the given directory." }, @@ -2133,7 +2140,7 @@ var ts; Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_or_umd: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', or 'umd'." }, + Argument_for_module_option_must_be_commonjs_amd_system_or_umd: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system' or 'umd'." }, Argument_for_target_option_must_be_ES3_ES5_or_ES6: { code: 6047, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported locale '{0}'." }, @@ -2215,7 +2222,7 @@ var ts; "false": 80 /* FalseKeyword */, "finally": 81 /* FinallyKeyword */, "for": 82 /* ForKeyword */, - "from": 124 /* FromKeyword */, + "from": 125 /* FromKeyword */, "function": 83 /* FunctionKeyword */, "get": 116 /* GetKeyword */, "if": 84 /* IfKeyword */, @@ -2226,33 +2233,34 @@ var ts; "interface": 103 /* InterfaceKeyword */, "let": 104 /* LetKeyword */, "module": 117 /* ModuleKeyword */, + "namespace": 118 /* NamespaceKeyword */, "new": 88 /* NewKeyword */, "null": 89 /* NullKeyword */, - "number": 119 /* NumberKeyword */, + "number": 120 /* NumberKeyword */, "package": 105 /* PackageKeyword */, "private": 106 /* PrivateKeyword */, "protected": 107 /* ProtectedKeyword */, "public": 108 /* PublicKeyword */, - "require": 118 /* RequireKeyword */, + "require": 119 /* RequireKeyword */, "return": 90 /* ReturnKeyword */, - "set": 120 /* SetKeyword */, + "set": 121 /* SetKeyword */, "static": 109 /* StaticKeyword */, - "string": 121 /* StringKeyword */, + "string": 122 /* StringKeyword */, "super": 91 /* SuperKeyword */, "switch": 92 /* SwitchKeyword */, - "symbol": 122 /* SymbolKeyword */, + "symbol": 123 /* SymbolKeyword */, "this": 93 /* ThisKeyword */, "throw": 94 /* ThrowKeyword */, "true": 95 /* TrueKeyword */, "try": 96 /* TryKeyword */, - "type": 123 /* TypeKeyword */, + "type": 124 /* TypeKeyword */, "typeof": 97 /* TypeOfKeyword */, "var": 98 /* VarKeyword */, "void": 99 /* VoidKeyword */, "while": 100 /* WhileKeyword */, "with": 101 /* WithKeyword */, "yield": 110 /* YieldKeyword */, - "of": 125 /* OfKeyword */, + "of": 126 /* OfKeyword */, "{": 14 /* OpenBraceToken */, "}": 15 /* CloseBraceToken */, "(": 16 /* OpenParenToken */, @@ -3570,16 +3578,16 @@ var ts; function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations - if (node.kind === 202 /* InterfaceDeclaration */ || node.kind === 203 /* TypeAliasDeclaration */) { + if (node.kind === 203 /* InterfaceDeclaration */ || node.kind === 204 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 209 /* ImportDeclaration */ || node.kind === 208 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { + else if ((node.kind === 210 /* ImportDeclaration */ || node.kind === 209 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { return 0 /* NonInstantiated */; } - else if (node.kind === 206 /* ModuleBlock */) { + else if (node.kind === 207 /* ModuleBlock */) { var state = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -3598,7 +3606,7 @@ var ts; }); return state; } - else if (node.kind === 205 /* ModuleDeclaration */) { + else if (node.kind === 206 /* ModuleDeclaration */) { return getModuleInstanceState(node.body); } else { @@ -3653,10 +3661,10 @@ var ts; // unless it is a well known Symbol. function getDeclarationName(node) { if (node.name) { - if (node.kind === 205 /* ModuleDeclaration */ && node.name.kind === 8 /* StringLiteral */) { + if (node.kind === 206 /* ModuleDeclaration */ && node.name.kind === 8 /* StringLiteral */) { return '"' + node.name.text + '"'; } - if (node.name.kind === 127 /* ComputedPropertyName */) { + if (node.name.kind === 128 /* ComputedPropertyName */) { var nameExpression = node.name.expression; ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); @@ -3664,22 +3672,22 @@ var ts; return node.name.text; } switch (node.kind) { - case 143 /* ConstructorType */: - case 135 /* Constructor */: + case 144 /* ConstructorType */: + case 136 /* Constructor */: return "__constructor"; - case 142 /* FunctionType */: - case 138 /* CallSignature */: + case 143 /* FunctionType */: + case 139 /* CallSignature */: return "__call"; - case 139 /* ConstructSignature */: + case 140 /* ConstructSignature */: return "__new"; - case 140 /* IndexSignature */: + case 141 /* IndexSignature */: return "__index"; - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: return "__export"; - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: return node.isExportEquals ? "export=" : "default"; - case 200 /* FunctionDeclaration */: - case 201 /* ClassDeclaration */: + case 201 /* FunctionDeclaration */: + case 202 /* ClassDeclaration */: return node.flags & 256 /* Default */ ? "default" : undefined; } } @@ -3714,7 +3722,7 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if ((node.kind === 201 /* ClassDeclaration */ || node.kind === 174 /* ClassExpression */) && symbol.exports) { + if ((node.kind === 202 /* ClassDeclaration */ || node.kind === 175 /* ClassExpression */) && symbol.exports) { // TypeScript 1.0 spec (April 2014): 8.4 // Every class automatically contains a static property member named 'prototype', // the type of which is an instantiation of the class type with type Any supplied as a type argument for each type parameter. @@ -3734,7 +3742,7 @@ var ts; function declareModuleMember(node, symbolKind, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1 /* Export */; if (symbolKind & 8388608 /* Alias */) { - if (node.kind === 217 /* ExportSpecifier */ || (node.kind === 208 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 218 /* ExportSpecifier */ || (node.kind === 209 /* ImportEqualsDeclaration */ && hasExportModifier)) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); } else { @@ -3753,7 +3761,7 @@ var ts; // 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 || container.flags & 32768 /* ExportContext */) { + if (hasExportModifier || container.flags & 65536 /* ExportContext */) { var exportKind = (symbolKind & 107455 /* Value */ ? 1048576 /* ExportValue */ : 0) | (symbolKind & 793056 /* Type */ ? 2097152 /* ExportType */ : 0) | (symbolKind & 1536 /* Namespace */ ? 4194304 /* ExportNamespace */ : 0); @@ -3787,7 +3795,7 @@ var ts; // these cases are: // - node has locals (symbolKind & HasLocals) !== 0 // - node is a source file - setBlockScopeContainer(node, (symbolKind & 255504 /* HasLocals */) === 0 && node.kind !== 227 /* SourceFile */); + setBlockScopeContainer(node, (symbolKind & 255504 /* HasLocals */) === 0 && node.kind !== 228 /* SourceFile */); } ts.forEachChild(node, bind); container = saveContainer; @@ -3802,41 +3810,41 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 227 /* SourceFile */: + case 228 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; } - case 142 /* FunctionType */: - case 143 /* ConstructorType */: - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: - case 140 /* IndexSignature */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: + case 141 /* IndexSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 174 /* ClassExpression */: - case 201 /* ClassDeclaration */: + case 175 /* ClassExpression */: + case 202 /* ClassDeclaration */: if (node.flags & 128 /* Static */) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } - case 145 /* TypeLiteral */: - case 154 /* ObjectLiteralExpression */: - case 202 /* InterfaceDeclaration */: + case 146 /* TypeLiteral */: + case 155 /* ObjectLiteralExpression */: + case 203 /* InterfaceDeclaration */: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } @@ -3851,11 +3859,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 227 /* SourceFile */ ? node : node.body; - if (body.kind === 227 /* SourceFile */ || body.kind === 206 /* ModuleBlock */) { + var body = node.kind === 228 /* SourceFile */ ? node : node.body; + if (body.kind === 228 /* SourceFile */ || body.kind === 207 /* ModuleBlock */) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 215 /* ExportDeclaration */ || stat.kind === 214 /* ExportAssignment */) { + if (stat.kind === 216 /* ExportDeclaration */ || stat.kind === 215 /* ExportAssignment */) { return true; } } @@ -3866,10 +3874,10 @@ var ts; // A declaration source file or ambient module declaration that contains no export declarations (but possibly regular // declarations with export modifiers) is an export context in which declarations are implicitly exported. if (isAmbientContext(node) && !hasExportDeclarations(node)) { - node.flags |= 32768 /* ExportContext */; + node.flags |= 65536 /* ExportContext */; } else { - node.flags &= ~32768 /* ExportContext */; + node.flags &= ~65536 /* ExportContext */; } } function bindModuleDeclaration(node) { @@ -3909,7 +3917,7 @@ var ts; var typeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, 2048 /* TypeLiteral */); typeLiteralSymbol.members = {}; - typeLiteralSymbol.members[node.kind === 142 /* FunctionType */ ? "__call" : "__new"] = symbol; + typeLiteralSymbol.members[node.kind === 143 /* FunctionType */ ? "__call" : "__new"] = symbol; } function bindAnonymousDeclaration(node, symbolKind, name, isBlockScopeContainer) { var symbol = createSymbol(symbolKind, name); @@ -3921,10 +3929,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolKind, symbolExcludes) { switch (blockScopeContainer.kind) { - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 227 /* SourceFile */: + case 228 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; @@ -3948,14 +3956,14 @@ var ts; function bind(node) { node.parent = parent; switch (node.kind) { - case 128 /* TypeParameter */: + case 129 /* TypeParameter */: bindDeclaration(node, 262144 /* TypeParameter */, 530912 /* TypeParameterExcludes */, false); break; - case 129 /* Parameter */: + case 130 /* Parameter */: bindParameter(node); break; - case 198 /* VariableDeclaration */: - case 152 /* BindingElement */: + case 199 /* VariableDeclaration */: + case 153 /* BindingElement */: if (ts.isBindingPattern(node.name)) { bindChildren(node, 0, false); } @@ -3966,72 +3974,72 @@ var ts; bindDeclaration(node, 1 /* FunctionScopedVariable */, 107454 /* FunctionScopedVariableExcludes */, false); } break; - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0), 107455 /* PropertyExcludes */, false); break; - case 224 /* PropertyAssignment */: - case 225 /* ShorthandPropertyAssignment */: + case 225 /* PropertyAssignment */: + case 226 /* ShorthandPropertyAssignment */: bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 107455 /* PropertyExcludes */, false); break; - case 226 /* EnumMember */: + case 227 /* EnumMember */: bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */, false); break; - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: - case 140 /* IndexSignature */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: + case 141 /* IndexSignature */: bindDeclaration(node, 131072 /* Signature */, 0, false); break; - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0), ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */, true); break; - case 200 /* FunctionDeclaration */: + case 201 /* FunctionDeclaration */: bindDeclaration(node, 16 /* Function */, 106927 /* FunctionExcludes */, true); break; - case 135 /* Constructor */: + case 136 /* Constructor */: bindDeclaration(node, 16384 /* Constructor */, 0, true); break; - case 136 /* GetAccessor */: + case 137 /* GetAccessor */: bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */, true); break; - case 137 /* SetAccessor */: + case 138 /* SetAccessor */: bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */, true); break; - case 142 /* FunctionType */: - case 143 /* ConstructorType */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: bindFunctionOrConstructorType(node); break; - case 145 /* TypeLiteral */: + case 146 /* TypeLiteral */: bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type", false); break; - case 154 /* ObjectLiteralExpression */: + case 155 /* ObjectLiteralExpression */: bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object", false); break; - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: bindAnonymousDeclaration(node, 16 /* Function */, "__function", true); break; - case 174 /* ClassExpression */: + case 175 /* ClassExpression */: bindAnonymousDeclaration(node, 32 /* Class */, "__class", false); break; - case 223 /* CatchClause */: + case 224 /* CatchClause */: bindCatchVariableDeclaration(node); break; - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: bindBlockScopedDeclaration(node, 32 /* Class */, 899583 /* ClassExcludes */); break; - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: bindDeclaration(node, 64 /* Interface */, 792992 /* InterfaceExcludes */, false); break; - case 203 /* TypeAliasDeclaration */: + case 204 /* TypeAliasDeclaration */: bindDeclaration(node, 524288 /* TypeAlias */, 793056 /* TypeAliasExcludes */, false); break; - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: if (ts.isConst(node)) { bindDeclaration(node, 128 /* ConstEnum */, 899967 /* ConstEnumExcludes */, false); } @@ -4039,16 +4047,16 @@ var ts; bindDeclaration(node, 256 /* RegularEnum */, 899327 /* RegularEnumExcludes */, false); } break; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: bindModuleDeclaration(node); break; - case 208 /* ImportEqualsDeclaration */: - case 211 /* NamespaceImport */: - case 213 /* ImportSpecifier */: - case 217 /* ExportSpecifier */: + case 209 /* ImportEqualsDeclaration */: + case 212 /* NamespaceImport */: + case 214 /* ImportSpecifier */: + case 218 /* ExportSpecifier */: bindDeclaration(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */, false); break; - case 210 /* ImportClause */: + case 211 /* ImportClause */: if (node.name) { bindDeclaration(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */, false); } @@ -4056,14 +4064,14 @@ var ts; bindChildren(node, 0, false); } break; - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: if (!node.exportClause) { // All export * declarations are collected in an __export symbol declareSymbol(container.symbol.exports, container.symbol, node, 1073741824 /* ExportStar */, 0); } bindChildren(node, 0, false); break; - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: if (node.expression.kind === 65 /* Identifier */) { // An export default clause with an identifier exports all meanings of that identifier declareSymbol(container.symbol.exports, container.symbol, node, 8388608 /* Alias */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); @@ -4074,13 +4082,13 @@ var ts; } bindChildren(node, 0, false); break; - case 227 /* SourceFile */: + case 228 /* SourceFile */: setExportContextFlag(node); if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512 /* ValueModule */, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; } - case 179 /* Block */: + case 180 /* Block */: // do not treat function block a block-scope container // all block-scope locals that reside in this block should go to the function locals. // Otherwise this won't be considered as redeclaration of a block scoped local: @@ -4091,11 +4099,11 @@ var ts; // 'let x' will be placed into the function locals and 'let x' - into the locals of the block bindChildren(node, 0, !ts.isFunctionLike(node.parent)); break; - case 223 /* CatchClause */: - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 207 /* CaseBlock */: + case 224 /* CatchClause */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 208 /* CaseBlock */: bindChildren(node, 0, true); break; default: @@ -4115,8 +4123,8 @@ var ts; // If this is a property-parameter, then also declare the property symbol into the // containing class. if (node.flags & 112 /* AccessibilityModifier */ && - node.parent.kind === 135 /* Constructor */ && - (node.parent.parent.kind === 201 /* ClassDeclaration */ || node.parent.parent.kind === 174 /* ClassExpression */)) { + node.parent.kind === 136 /* Constructor */ && + (node.parent.parent.kind === 202 /* ClassDeclaration */ || node.parent.parent.kind === 175 /* ClassExpression */)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */); } @@ -4206,7 +4214,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 227 /* SourceFile */) { + while (node && node.kind !== 228 /* SourceFile */) { node = node.parent; } return node; @@ -4316,15 +4324,15 @@ var ts; return current; } switch (current.kind) { - case 227 /* SourceFile */: - case 207 /* CaseBlock */: - case 223 /* CatchClause */: - case 205 /* ModuleDeclaration */: - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: + case 228 /* SourceFile */: + case 208 /* CaseBlock */: + case 224 /* CatchClause */: + case 206 /* ModuleDeclaration */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: return current; - case 179 /* Block */: + case 180 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block if (!isFunctionLike(current.parent)) { @@ -4337,9 +4345,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 198 /* VariableDeclaration */ && + declaration.kind === 199 /* VariableDeclaration */ && declaration.parent && - declaration.parent.kind === 223 /* CatchClause */; + declaration.parent.kind === 224 /* CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; // Return display name of an identifier @@ -4378,7 +4386,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 227 /* SourceFile */: + case 228 /* SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -4387,16 +4395,16 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 198 /* VariableDeclaration */: - case 152 /* BindingElement */: - case 201 /* ClassDeclaration */: - case 174 /* ClassExpression */: - case 202 /* InterfaceDeclaration */: - case 205 /* ModuleDeclaration */: - case 204 /* EnumDeclaration */: - case 226 /* EnumMember */: - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: + case 199 /* VariableDeclaration */: + case 153 /* BindingElement */: + case 202 /* ClassDeclaration */: + case 175 /* ClassExpression */: + case 203 /* InterfaceDeclaration */: + case 206 /* ModuleDeclaration */: + case 205 /* EnumDeclaration */: + case 227 /* EnumMember */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: errorNode = node.name; break; } @@ -4420,11 +4428,11 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 204 /* EnumDeclaration */ && isConst(node); + return node.kind === 205 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 152 /* BindingElement */ || isBindingPattern(node))) { + while (node && (node.kind === 153 /* BindingElement */ || isBindingPattern(node))) { node = node.parent; } return node; @@ -4439,14 +4447,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 198 /* VariableDeclaration */) { + if (node.kind === 199 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 199 /* VariableDeclarationList */) { + if (node && node.kind === 200 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 180 /* VariableStatement */) { + if (node && node.kind === 181 /* VariableStatement */) { flags |= node.flags; } return flags; @@ -4461,12 +4469,12 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 182 /* ExpressionStatement */ && node.expression.kind === 8 /* StringLiteral */; + return node.kind === 183 /* ExpressionStatement */ && node.expression.kind === 8 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { // If parameter/type parameter, the prev token trailing comments are part of this node too - if (node.kind === 129 /* Parameter */ || node.kind === 128 /* TypeParameter */) { + if (node.kind === 130 /* Parameter */ || node.kind === 129 /* TypeParameter */) { // e.g. (/** blah */ a, /** blah */ b); // e.g.: ( // /** blah */ a, @@ -4495,23 +4503,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 191 /* ReturnStatement */: + case 192 /* ReturnStatement */: return visitor(node); - case 207 /* CaseBlock */: - case 179 /* Block */: - case 183 /* IfStatement */: - case 184 /* DoStatement */: - case 185 /* WhileStatement */: - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 192 /* WithStatement */: - case 193 /* SwitchStatement */: - case 220 /* CaseClause */: - case 221 /* DefaultClause */: - case 194 /* LabeledStatement */: - case 196 /* TryStatement */: - case 223 /* CatchClause */: + case 208 /* CaseBlock */: + case 180 /* Block */: + case 184 /* IfStatement */: + case 185 /* DoStatement */: + case 186 /* WhileStatement */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 193 /* WithStatement */: + case 194 /* SwitchStatement */: + case 221 /* CaseClause */: + case 222 /* DefaultClause */: + case 195 /* LabeledStatement */: + case 197 /* TryStatement */: + case 224 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -4520,14 +4528,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 152 /* BindingElement */: - case 226 /* EnumMember */: - case 129 /* Parameter */: - case 224 /* PropertyAssignment */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 225 /* ShorthandPropertyAssignment */: - case 198 /* VariableDeclaration */: + case 153 /* BindingElement */: + case 227 /* EnumMember */: + case 130 /* Parameter */: + case 225 /* PropertyAssignment */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 226 /* ShorthandPropertyAssignment */: + case 199 /* VariableDeclaration */: return true; } } @@ -4537,8 +4545,8 @@ var ts; function isAccessor(node) { if (node) { switch (node.kind) { - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: return true; } } @@ -4548,22 +4556,22 @@ var ts; function isFunctionLike(node) { if (node) { switch (node.kind) { - case 135 /* Constructor */: - case 162 /* FunctionExpression */: - case 200 /* FunctionDeclaration */: - case 163 /* ArrowFunction */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: - case 140 /* IndexSignature */: - case 142 /* FunctionType */: - case 143 /* ConstructorType */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: - case 200 /* FunctionDeclaration */: + case 136 /* Constructor */: + case 163 /* FunctionExpression */: + case 201 /* FunctionDeclaration */: + case 164 /* ArrowFunction */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: + case 141 /* IndexSignature */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: + case 201 /* FunctionDeclaration */: return true; } } @@ -4571,11 +4579,11 @@ var ts; } ts.isFunctionLike = isFunctionLike; function isFunctionBlock(node) { - return node && node.kind === 179 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 180 /* Block */ && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 134 /* MethodDeclaration */ && node.parent.kind === 154 /* ObjectLiteralExpression */; + return node && node.kind === 135 /* MethodDeclaration */ && node.parent.kind === 155 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function getContainingFunction(node) { @@ -4594,12 +4602,12 @@ var ts; return undefined; } switch (node.kind) { - case 127 /* ComputedPropertyName */: + case 128 /* ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container // so that we can error on it. - if (node.parent.parent.kind === 201 /* ClassDeclaration */) { + if (node.parent.parent.kind === 202 /* ClassDeclaration */) { return node; } // If this is a computed property, then the parent should not @@ -4609,9 +4617,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 130 /* Decorator */: + case 131 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 129 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 130 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -4622,23 +4630,23 @@ var ts; node = node.parent; } break; - case 163 /* ArrowFunction */: + case 164 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } // Fall through - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 205 /* ModuleDeclaration */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 204 /* EnumDeclaration */: - case 227 /* SourceFile */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 206 /* ModuleDeclaration */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 205 /* EnumDeclaration */: + case 228 /* SourceFile */: return node; } } @@ -4650,12 +4658,12 @@ var ts; if (!node) return node; switch (node.kind) { - case 127 /* ComputedPropertyName */: + case 128 /* ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'super' container. // A computed property name in a class needs to be a super container // so that we can error on it. - if (node.parent.parent.kind === 201 /* ClassDeclaration */) { + if (node.parent.parent.kind === 202 /* ClassDeclaration */) { return node; } // If this is a computed property, then the parent should not @@ -4665,9 +4673,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 130 /* Decorator */: + case 131 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 129 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 130 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -4678,26 +4686,26 @@ var ts; node = node.parent; } break; - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: if (!includeFunctions) { continue; } - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: return node; } } } ts.getSuperContainer = getSuperContainer; function getInvokedExpression(node) { - if (node.kind === 159 /* TaggedTemplateExpression */) { + if (node.kind === 160 /* TaggedTemplateExpression */) { return node.tag; } // Will either be a CallExpression or NewExpression. @@ -4706,44 +4714,44 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: // classes are valid targets return true; - case 132 /* PropertyDeclaration */: + case 133 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return node.parent.kind === 201 /* ClassDeclaration */; - case 129 /* Parameter */: + return node.parent.kind === 202 /* ClassDeclaration */; + case 130 /* Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; - return node.parent.body && node.parent.parent.kind === 201 /* ClassDeclaration */; - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 134 /* MethodDeclaration */: + return node.parent.body && node.parent.parent.kind === 202 /* ClassDeclaration */; + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 135 /* MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. - return node.body && node.parent.kind === 201 /* ClassDeclaration */; + return node.body && node.parent.kind === 202 /* ClassDeclaration */; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: if (node.decorators) { return true; } return false; - case 132 /* PropertyDeclaration */: - case 129 /* Parameter */: + case 133 /* PropertyDeclaration */: + case 130 /* Parameter */: if (node.decorators) { return true; } return false; - case 136 /* GetAccessor */: + case 137 /* GetAccessor */: if (node.body && node.decorators) { return true; } return false; - case 134 /* MethodDeclaration */: - case 137 /* SetAccessor */: + case 135 /* MethodDeclaration */: + case 138 /* SetAccessor */: if (node.body && node.decorators) { return true; } @@ -4754,10 +4762,10 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 134 /* MethodDeclaration */: - case 137 /* SetAccessor */: + case 135 /* MethodDeclaration */: + case 138 /* SetAccessor */: return ts.forEach(node.parameters, nodeIsDecorated); } return false; @@ -4775,37 +4783,37 @@ var ts; case 95 /* TrueKeyword */: case 80 /* FalseKeyword */: case 9 /* RegularExpressionLiteral */: - case 153 /* ArrayLiteralExpression */: - case 154 /* ObjectLiteralExpression */: - case 155 /* PropertyAccessExpression */: - case 156 /* ElementAccessExpression */: - case 157 /* CallExpression */: - case 158 /* NewExpression */: - case 159 /* TaggedTemplateExpression */: - case 160 /* TypeAssertionExpression */: - case 161 /* ParenthesizedExpression */: - case 162 /* FunctionExpression */: - case 174 /* ClassExpression */: - case 163 /* ArrowFunction */: - case 166 /* VoidExpression */: - case 164 /* DeleteExpression */: - case 165 /* TypeOfExpression */: - case 167 /* PrefixUnaryExpression */: - case 168 /* PostfixUnaryExpression */: - case 169 /* BinaryExpression */: - case 170 /* ConditionalExpression */: - case 173 /* SpreadElementExpression */: - case 171 /* TemplateExpression */: + case 154 /* ArrayLiteralExpression */: + case 155 /* ObjectLiteralExpression */: + case 156 /* PropertyAccessExpression */: + case 157 /* ElementAccessExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: + case 160 /* TaggedTemplateExpression */: + case 161 /* TypeAssertionExpression */: + case 162 /* ParenthesizedExpression */: + case 163 /* FunctionExpression */: + case 175 /* ClassExpression */: + case 164 /* ArrowFunction */: + case 167 /* VoidExpression */: + case 165 /* DeleteExpression */: + case 166 /* TypeOfExpression */: + case 168 /* PrefixUnaryExpression */: + case 169 /* PostfixUnaryExpression */: + case 170 /* BinaryExpression */: + case 171 /* ConditionalExpression */: + case 174 /* SpreadElementExpression */: + case 172 /* TemplateExpression */: case 10 /* NoSubstitutionTemplateLiteral */: - case 175 /* OmittedExpression */: + case 176 /* OmittedExpression */: return true; - case 126 /* QualifiedName */: - while (node.parent.kind === 126 /* QualifiedName */) { + case 127 /* QualifiedName */: + while (node.parent.kind === 127 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 144 /* TypeQuery */; + return node.parent.kind === 145 /* TypeQuery */; case 65 /* Identifier */: - if (node.parent.kind === 144 /* TypeQuery */) { + if (node.parent.kind === 145 /* TypeQuery */) { return true; } // fall through @@ -4813,42 +4821,42 @@ var ts; case 8 /* StringLiteral */: var parent_1 = node.parent; switch (parent_1.kind) { - case 198 /* VariableDeclaration */: - case 129 /* Parameter */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 226 /* EnumMember */: - case 224 /* PropertyAssignment */: - case 152 /* BindingElement */: + case 199 /* VariableDeclaration */: + case 130 /* Parameter */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 227 /* EnumMember */: + case 225 /* PropertyAssignment */: + case 153 /* BindingElement */: return parent_1.initializer === node; - case 182 /* ExpressionStatement */: - case 183 /* IfStatement */: - case 184 /* DoStatement */: - case 185 /* WhileStatement */: - case 191 /* ReturnStatement */: - case 192 /* WithStatement */: - case 193 /* SwitchStatement */: - case 220 /* CaseClause */: - case 195 /* ThrowStatement */: - case 193 /* SwitchStatement */: + case 183 /* ExpressionStatement */: + case 184 /* IfStatement */: + case 185 /* DoStatement */: + case 186 /* WhileStatement */: + case 192 /* ReturnStatement */: + case 193 /* WithStatement */: + case 194 /* SwitchStatement */: + case 221 /* CaseClause */: + case 196 /* ThrowStatement */: + case 194 /* SwitchStatement */: return parent_1.expression === node; - case 186 /* ForStatement */: + case 187 /* ForStatement */: var forStatement = parent_1; - return (forStatement.initializer === node && forStatement.initializer.kind !== 199 /* VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 200 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: var forInStatement = parent_1; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 199 /* VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 200 /* VariableDeclarationList */) || forInStatement.expression === node; - case 160 /* TypeAssertionExpression */: + case 161 /* TypeAssertionExpression */: return node === parent_1.expression; - case 176 /* TemplateSpan */: + case 178 /* TemplateSpan */: return node === parent_1.expression; - case 127 /* ComputedPropertyName */: + case 128 /* ComputedPropertyName */: return node === parent_1.expression; - case 130 /* Decorator */: + case 131 /* Decorator */: return true; default: if (isExpression(parent_1)) { @@ -4866,7 +4874,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 208 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 219 /* ExternalModuleReference */; + return node.kind === 209 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 220 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -4875,40 +4883,40 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 208 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 219 /* ExternalModuleReference */; + return node.kind === 209 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 220 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 209 /* ImportDeclaration */) { + if (node.kind === 210 /* ImportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 208 /* ImportEqualsDeclaration */) { + if (node.kind === 209 /* ImportEqualsDeclaration */) { var reference = node.moduleReference; - if (reference.kind === 219 /* ExternalModuleReference */) { + if (reference.kind === 220 /* ExternalModuleReference */) { return reference.expression; } } - if (node.kind === 215 /* ExportDeclaration */) { + if (node.kind === 216 /* ExportDeclaration */) { return node.moduleSpecifier; } } ts.getExternalModuleName = getExternalModuleName; function hasDotDotDotToken(node) { - return node && node.kind === 129 /* Parameter */ && node.dotDotDotToken !== undefined; + return node && node.kind === 130 /* Parameter */ && node.dotDotDotToken !== undefined; } ts.hasDotDotDotToken = hasDotDotDotToken; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 129 /* Parameter */: + case 130 /* Parameter */: return node.questionToken !== undefined; - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: return node.questionToken !== undefined; - case 225 /* ShorthandPropertyAssignment */: - case 224 /* PropertyAssignment */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 226 /* ShorthandPropertyAssignment */: + case 225 /* PropertyAssignment */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: return node.questionToken !== undefined; } } @@ -4932,7 +4940,7 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 151 /* ArrayBindingPattern */ || node.kind === 150 /* ObjectBindingPattern */); + return !!node && (node.kind === 152 /* ArrayBindingPattern */ || node.kind === 151 /* ObjectBindingPattern */); } ts.isBindingPattern = isBindingPattern; function isInAmbientContext(node) { @@ -4947,33 +4955,33 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 163 /* ArrowFunction */: - case 152 /* BindingElement */: - case 201 /* ClassDeclaration */: - case 135 /* Constructor */: - case 204 /* EnumDeclaration */: - case 226 /* EnumMember */: - case 217 /* ExportSpecifier */: - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 136 /* GetAccessor */: - case 210 /* ImportClause */: - case 208 /* ImportEqualsDeclaration */: - case 213 /* ImportSpecifier */: - case 202 /* InterfaceDeclaration */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 205 /* ModuleDeclaration */: - case 211 /* NamespaceImport */: - case 129 /* Parameter */: - case 224 /* PropertyAssignment */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 137 /* SetAccessor */: - case 225 /* ShorthandPropertyAssignment */: - case 203 /* TypeAliasDeclaration */: - case 128 /* TypeParameter */: - case 198 /* VariableDeclaration */: + case 164 /* ArrowFunction */: + case 153 /* BindingElement */: + case 202 /* ClassDeclaration */: + case 136 /* Constructor */: + case 205 /* EnumDeclaration */: + case 227 /* EnumMember */: + case 218 /* ExportSpecifier */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 137 /* GetAccessor */: + case 211 /* ImportClause */: + case 209 /* ImportEqualsDeclaration */: + case 214 /* ImportSpecifier */: + case 203 /* InterfaceDeclaration */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 206 /* ModuleDeclaration */: + case 212 /* NamespaceImport */: + case 130 /* Parameter */: + case 225 /* PropertyAssignment */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 138 /* SetAccessor */: + case 226 /* ShorthandPropertyAssignment */: + case 204 /* TypeAliasDeclaration */: + case 129 /* TypeParameter */: + case 199 /* VariableDeclaration */: return true; } return false; @@ -4981,25 +4989,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 190 /* BreakStatement */: - case 189 /* ContinueStatement */: - case 197 /* DebuggerStatement */: - case 184 /* DoStatement */: - case 182 /* ExpressionStatement */: - case 181 /* EmptyStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 186 /* ForStatement */: - case 183 /* IfStatement */: - case 194 /* LabeledStatement */: - case 191 /* ReturnStatement */: - case 193 /* SwitchStatement */: + case 191 /* BreakStatement */: + case 190 /* ContinueStatement */: + case 198 /* DebuggerStatement */: + case 185 /* DoStatement */: + case 183 /* ExpressionStatement */: + case 182 /* EmptyStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 187 /* ForStatement */: + case 184 /* IfStatement */: + case 195 /* LabeledStatement */: + case 192 /* ReturnStatement */: + case 194 /* SwitchStatement */: case 94 /* ThrowKeyword */: - case 196 /* TryStatement */: - case 180 /* VariableStatement */: - case 185 /* WhileStatement */: - case 192 /* WithStatement */: - case 214 /* ExportAssignment */: + case 197 /* TryStatement */: + case 181 /* VariableStatement */: + case 186 /* WhileStatement */: + case 193 /* WithStatement */: + case 215 /* ExportAssignment */: return true; default: return false; @@ -5008,13 +5016,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 135 /* Constructor */: - case 132 /* PropertyDeclaration */: - case 134 /* MethodDeclaration */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 133 /* MethodSignature */: - case 140 /* IndexSignature */: + case 136 /* Constructor */: + case 133 /* PropertyDeclaration */: + case 135 /* MethodDeclaration */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 134 /* MethodSignature */: + case 141 /* IndexSignature */: return true; default: return false; @@ -5027,7 +5035,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 213 /* ImportSpecifier */ || parent.kind === 217 /* ExportSpecifier */) { + if (parent.kind === 214 /* ImportSpecifier */ || parent.kind === 218 /* ExportSpecifier */) { if (parent.propertyName) { return true; } @@ -5047,12 +5055,12 @@ var ts; // export = ... // export default ... function isAliasSymbolDeclaration(node) { - return node.kind === 208 /* ImportEqualsDeclaration */ || - node.kind === 210 /* ImportClause */ && !!node.name || - node.kind === 211 /* NamespaceImport */ || - node.kind === 213 /* ImportSpecifier */ || - node.kind === 217 /* ExportSpecifier */ || - node.kind === 214 /* ExportAssignment */ && node.expression.kind === 65 /* Identifier */; + return node.kind === 209 /* ImportEqualsDeclaration */ || + node.kind === 211 /* ImportClause */ && !!node.name || + node.kind === 212 /* NamespaceImport */ || + node.kind === 214 /* ImportSpecifier */ || + node.kind === 218 /* ExportSpecifier */ || + node.kind === 215 /* ExportAssignment */ && node.expression.kind === 65 /* Identifier */; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { @@ -5135,7 +5143,7 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 66 /* FirstKeyword */ <= token && token <= 125 /* LastKeyword */; + return 66 /* FirstKeyword */ <= token && token <= 126 /* LastKeyword */; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -5151,7 +5159,7 @@ var ts; */ function hasDynamicName(declaration) { return declaration.name && - declaration.name.kind === 127 /* ComputedPropertyName */ && + declaration.name.kind === 128 /* ComputedPropertyName */ && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; @@ -5161,14 +5169,14 @@ var ts; * where Symbol is literally the word "Symbol", and name is any identifierName */ function isWellKnownSymbolSyntactically(node) { - return node.kind === 155 /* PropertyAccessExpression */ && isESSymbolIdentifier(node.expression); + return node.kind === 156 /* PropertyAccessExpression */ && isESSymbolIdentifier(node.expression); } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { if (name.kind === 65 /* Identifier */ || name.kind === 8 /* StringLiteral */ || name.kind === 7 /* NumericLiteral */) { return name.text; } - if (name.kind === 127 /* ComputedPropertyName */) { + if (name.kind === 128 /* ComputedPropertyName */) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -5205,7 +5213,7 @@ var ts; } ts.isModifier = isModifier; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 205 /* ModuleDeclaration */ || n.kind === 227 /* SourceFile */; + return isFunctionLike(n) || n.kind === 206 /* ModuleDeclaration */ || n.kind === 228 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -5441,7 +5449,7 @@ var ts; ts.getLineOfLocalPosition = getLineOfLocalPosition; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 135 /* Constructor */ && nodeIsPresent(member.body)) { + if (member.kind === 136 /* Constructor */ && nodeIsPresent(member.body)) { return member; } }); @@ -5464,10 +5472,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 136 /* GetAccessor */) { + if (accessor.kind === 137 /* GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 137 /* SetAccessor */) { + else if (accessor.kind === 138 /* SetAccessor */) { setAccessor = accessor; } else { @@ -5476,7 +5484,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 136 /* GetAccessor */ || member.kind === 137 /* SetAccessor */) + if ((member.kind === 137 /* GetAccessor */ || member.kind === 138 /* SetAccessor */) && (member.flags & 128 /* Static */) === (accessor.flags & 128 /* Static */)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -5487,10 +5495,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 136 /* GetAccessor */ && !getAccessor) { + if (member.kind === 137 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 137 /* SetAccessor */ && !setAccessor) { + if (member.kind === 138 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -5638,22 +5646,22 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 155 /* PropertyAccessExpression */: - case 156 /* ElementAccessExpression */: - case 158 /* NewExpression */: - case 157 /* CallExpression */: - case 159 /* TaggedTemplateExpression */: - case 153 /* ArrayLiteralExpression */: - case 161 /* ParenthesizedExpression */: - case 154 /* ObjectLiteralExpression */: - case 174 /* ClassExpression */: - case 162 /* FunctionExpression */: + case 156 /* PropertyAccessExpression */: + case 157 /* ElementAccessExpression */: + case 159 /* NewExpression */: + case 158 /* CallExpression */: + case 160 /* TaggedTemplateExpression */: + case 154 /* ArrayLiteralExpression */: + case 162 /* ParenthesizedExpression */: + case 155 /* ObjectLiteralExpression */: + case 175 /* ClassExpression */: + case 163 /* FunctionExpression */: case 65 /* Identifier */: case 9 /* RegularExpressionLiteral */: case 7 /* NumericLiteral */: case 8 /* StringLiteral */: case 10 /* NoSubstitutionTemplateLiteral */: - case 171 /* TemplateExpression */: + case 172 /* TemplateExpression */: case 80 /* FalseKeyword */: case 89 /* NullKeyword */: case 93 /* ThisKeyword */: @@ -5671,30 +5679,97 @@ var ts; ts.isAssignmentOperator = isAssignmentOperator; // Returns false if this heritage clause element's expression contains something unsupported // (i.e. not a name or dotted name). - function isSupportedHeritageClauseElement(node) { - return isSupportedHeritageClauseElementExpression(node.expression); + function isSupportedExpressionWithTypeArguments(node) { + return isSupportedExpressionWithTypeArgumentsRest(node.expression); } - ts.isSupportedHeritageClauseElement = isSupportedHeritageClauseElement; - function isSupportedHeritageClauseElementExpression(node) { + ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments; + function isSupportedExpressionWithTypeArgumentsRest(node) { if (node.kind === 65 /* Identifier */) { return true; } - else if (node.kind === 155 /* PropertyAccessExpression */) { - return isSupportedHeritageClauseElementExpression(node.expression); + else if (node.kind === 156 /* PropertyAccessExpression */) { + return isSupportedExpressionWithTypeArgumentsRest(node.expression); } else { return false; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 126 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 155 /* PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 127 /* QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 156 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function getLocalSymbolForExportDefault(symbol) { return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 256 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; + /** + * Replace each instance of non-ascii characters by one, two, three, or four escape sequences + * representing the UTF-8 encoding of the character, and return the expanded char code list. + */ + function getExpandedCharCodes(input) { + var output = []; + var length = input.length; + var leadSurrogate = undefined; + for (var i = 0; i < length; i++) { + var charCode = input.charCodeAt(i); + // handel utf8 + if (charCode < 0x80) { + output.push(charCode); + } + else if (charCode < 0x800) { + output.push((charCode >> 6) | 192); + output.push((charCode & 63) | 128); + } + else if (charCode < 0x10000) { + output.push((charCode >> 12) | 224); + output.push(((charCode >> 6) & 63) | 128); + output.push((charCode & 63) | 128); + } + else if (charCode < 0x20000) { + output.push((charCode >> 18) | 240); + output.push(((charCode >> 12) & 63) | 128); + output.push(((charCode >> 6) & 63) | 128); + output.push((charCode & 63) | 128); + } + else { + ts.Debug.assert(false, "Unexpected code point"); + } + } + return output; + } + var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + /** + * Converts a string to a base-64 encoded ASCII string. + */ + function convertToBase64(input) { + var result = ""; + var charCodes = getExpandedCharCodes(input); + var i = 0; + var length = charCodes.length; + var byte1, byte2, byte3, byte4; + while (i < length) { + // Convert every 6-bits in the input 3 character points + // into a base64 digit + byte1 = charCodes[i] >> 2; + byte2 = (charCodes[i] & 3) << 4 | charCodes[i + 1] >> 4; + byte3 = (charCodes[i + 1] & 15) << 2 | charCodes[i + 2] >> 6; + byte4 = charCodes[i + 2] & 63; + // We are out of characters in the input, set the extra + // digits to 64 (padding character). + if (i + 1 >= length) { + byte3 = byte4 = 64; + } + else if (i + 2 >= length) { + byte4 = 64; + } + // Write to the ouput + result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4); + i += 3; + } + return result; + } + ts.convertToBase64 = convertToBase64; })(ts || (ts = {})); var ts; (function (ts) { @@ -5906,7 +5981,7 @@ var ts; /// var ts; (function (ts) { - var nodeConstructors = new Array(229 /* Count */); + var nodeConstructors = new Array(230 /* Count */); /* @internal */ ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -5951,20 +6026,20 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 126 /* QualifiedName */: + case 127 /* QualifiedName */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 128 /* TypeParameter */: + case 129 /* TypeParameter */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 129 /* Parameter */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 224 /* PropertyAssignment */: - case 225 /* ShorthandPropertyAssignment */: - case 198 /* VariableDeclaration */: - case 152 /* BindingElement */: + case 130 /* Parameter */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 225 /* PropertyAssignment */: + case 226 /* ShorthandPropertyAssignment */: + case 199 /* VariableDeclaration */: + case 153 /* BindingElement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -5973,24 +6048,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 142 /* FunctionType */: - case 143 /* ConstructorType */: - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: - case 140 /* IndexSignature */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: + case 141 /* IndexSignature */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 162 /* FunctionExpression */: - case 200 /* FunctionDeclaration */: - case 163 /* ArrowFunction */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 163 /* FunctionExpression */: + case 201 /* FunctionDeclaration */: + case 164 /* ArrowFunction */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -6001,220 +6076,220 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 141 /* TypeReference */: + case 142 /* TypeReference */: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 144 /* TypeQuery */: + case 145 /* TypeQuery */: return visitNode(cbNode, node.exprName); - case 145 /* TypeLiteral */: + case 146 /* TypeLiteral */: return visitNodes(cbNodes, node.members); - case 146 /* ArrayType */: + case 147 /* ArrayType */: return visitNode(cbNode, node.elementType); - case 147 /* TupleType */: + case 148 /* TupleType */: return visitNodes(cbNodes, node.elementTypes); - case 148 /* UnionType */: + case 149 /* UnionType */: return visitNodes(cbNodes, node.types); - case 149 /* ParenthesizedType */: + case 150 /* ParenthesizedType */: return visitNode(cbNode, node.type); - case 150 /* ObjectBindingPattern */: - case 151 /* ArrayBindingPattern */: + case 151 /* ObjectBindingPattern */: + case 152 /* ArrayBindingPattern */: return visitNodes(cbNodes, node.elements); - case 153 /* ArrayLiteralExpression */: + case 154 /* ArrayLiteralExpression */: return visitNodes(cbNodes, node.elements); - case 154 /* ObjectLiteralExpression */: + case 155 /* ObjectLiteralExpression */: return visitNodes(cbNodes, node.properties); - case 155 /* PropertyAccessExpression */: + case 156 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 156 /* ElementAccessExpression */: + case 157 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 157 /* CallExpression */: - case 158 /* NewExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 159 /* TaggedTemplateExpression */: + case 160 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 160 /* TypeAssertionExpression */: + case 161 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 161 /* ParenthesizedExpression */: + case 162 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 164 /* DeleteExpression */: + case 165 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 165 /* TypeOfExpression */: + case 166 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 166 /* VoidExpression */: + case 167 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 167 /* PrefixUnaryExpression */: + case 168 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 172 /* YieldExpression */: + case 173 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 168 /* PostfixUnaryExpression */: + case 169 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 170 /* ConditionalExpression */: + case 171 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 173 /* SpreadElementExpression */: + case 174 /* SpreadElementExpression */: return visitNode(cbNode, node.expression); - case 179 /* Block */: - case 206 /* ModuleBlock */: + case 180 /* Block */: + case 207 /* ModuleBlock */: return visitNodes(cbNodes, node.statements); - case 227 /* SourceFile */: + case 228 /* SourceFile */: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 180 /* VariableStatement */: + case 181 /* VariableStatement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 199 /* VariableDeclarationList */: + case 200 /* VariableDeclarationList */: return visitNodes(cbNodes, node.declarations); - case 182 /* ExpressionStatement */: + case 183 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 183 /* IfStatement */: + case 184 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 184 /* DoStatement */: + case 185 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 185 /* WhileStatement */: + case 186 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 186 /* ForStatement */: + case 187 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 187 /* ForInStatement */: + case 188 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 188 /* ForOfStatement */: + case 189 /* ForOfStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 189 /* ContinueStatement */: - case 190 /* BreakStatement */: + case 190 /* ContinueStatement */: + case 191 /* BreakStatement */: return visitNode(cbNode, node.label); - case 191 /* ReturnStatement */: + case 192 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 192 /* WithStatement */: + case 193 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 193 /* SwitchStatement */: + case 194 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 207 /* CaseBlock */: + case 208 /* CaseBlock */: return visitNodes(cbNodes, node.clauses); - case 220 /* CaseClause */: + case 221 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 221 /* DefaultClause */: + case 222 /* DefaultClause */: return visitNodes(cbNodes, node.statements); - case 194 /* LabeledStatement */: + case 195 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 195 /* ThrowStatement */: + case 196 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 196 /* TryStatement */: + case 197 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 223 /* CatchClause */: + case 224 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 130 /* Decorator */: + case 131 /* Decorator */: return visitNode(cbNode, node.expression); - case 201 /* ClassDeclaration */: - case 174 /* ClassExpression */: + case 202 /* ClassDeclaration */: + case 175 /* ClassExpression */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 203 /* TypeAliasDeclaration */: + case 204 /* TypeAliasDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 226 /* EnumMember */: + case 227 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 210 /* ImportClause */: + case 211 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 211 /* NamespaceImport */: + case 212 /* NamespaceImport */: return visitNode(cbNode, node.name); - case 212 /* NamedImports */: - case 216 /* NamedExports */: + case 213 /* NamedImports */: + case 217 /* NamedExports */: return visitNodes(cbNodes, node.elements); - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 213 /* ImportSpecifier */: - case 217 /* ExportSpecifier */: + case 214 /* ImportSpecifier */: + case 218 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 171 /* TemplateExpression */: + case 172 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 176 /* TemplateSpan */: + case 178 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 127 /* ComputedPropertyName */: + case 128 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 222 /* HeritageClause */: + case 223 /* HeritageClause */: return visitNodes(cbNodes, node.types); - case 177 /* HeritageClauseElement */: + case 177 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 219 /* ExternalModuleReference */: + case 220 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 218 /* MissingDeclaration */: + case 219 /* MissingDeclaration */: return visitNodes(cbNodes, node.decorators); } } @@ -6393,7 +6468,7 @@ var ts; } } function createSourceFile(fileName, languageVersion) { - sourceFile = createNode(227 /* SourceFile */, 0); + sourceFile = createNode(228 /* SourceFile */, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -6735,7 +6810,7 @@ var ts; // ComputedPropertyName[Yield] : // [ AssignmentExpression[In, ?Yield] ] // - var node = createNode(127 /* ComputedPropertyName */); + var node = createNode(128 /* ComputedPropertyName */); parseExpected(18 /* OpenBracketToken */); // We parse any expression (including a comma expression). But the grammar // says that only an assignment expression is allowed, so the grammar checker @@ -7127,14 +7202,14 @@ var ts; function isReusableModuleElement(node) { if (node) { switch (node.kind) { - case 209 /* ImportDeclaration */: - case 208 /* ImportEqualsDeclaration */: - case 215 /* ExportDeclaration */: - case 214 /* ExportAssignment */: - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 205 /* ModuleDeclaration */: - case 204 /* EnumDeclaration */: + case 210 /* ImportDeclaration */: + case 209 /* ImportEqualsDeclaration */: + case 216 /* ExportDeclaration */: + case 215 /* ExportAssignment */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 206 /* ModuleDeclaration */: + case 205 /* EnumDeclaration */: return true; } return isReusableStatement(node); @@ -7144,13 +7219,13 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 135 /* Constructor */: - case 140 /* IndexSignature */: - case 134 /* MethodDeclaration */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 132 /* PropertyDeclaration */: - case 178 /* SemicolonClassElement */: + case 136 /* Constructor */: + case 141 /* IndexSignature */: + case 135 /* MethodDeclaration */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 133 /* PropertyDeclaration */: + case 179 /* SemicolonClassElement */: return true; } } @@ -7159,8 +7234,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 220 /* CaseClause */: - case 221 /* DefaultClause */: + case 221 /* CaseClause */: + case 222 /* DefaultClause */: return true; } } @@ -7169,49 +7244,49 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 200 /* FunctionDeclaration */: - case 180 /* VariableStatement */: - case 179 /* Block */: - case 183 /* IfStatement */: - case 182 /* ExpressionStatement */: - case 195 /* ThrowStatement */: - case 191 /* ReturnStatement */: - case 193 /* SwitchStatement */: - case 190 /* BreakStatement */: - case 189 /* ContinueStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 186 /* ForStatement */: - case 185 /* WhileStatement */: - case 192 /* WithStatement */: - case 181 /* EmptyStatement */: - case 196 /* TryStatement */: - case 194 /* LabeledStatement */: - case 184 /* DoStatement */: - case 197 /* DebuggerStatement */: + case 201 /* FunctionDeclaration */: + case 181 /* VariableStatement */: + case 180 /* Block */: + case 184 /* IfStatement */: + case 183 /* ExpressionStatement */: + case 196 /* ThrowStatement */: + case 192 /* ReturnStatement */: + case 194 /* SwitchStatement */: + case 191 /* BreakStatement */: + case 190 /* ContinueStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 187 /* ForStatement */: + case 186 /* WhileStatement */: + case 193 /* WithStatement */: + case 182 /* EmptyStatement */: + case 197 /* TryStatement */: + case 195 /* LabeledStatement */: + case 185 /* DoStatement */: + case 198 /* DebuggerStatement */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 226 /* EnumMember */; + return node.kind === 227 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 139 /* ConstructSignature */: - case 133 /* MethodSignature */: - case 140 /* IndexSignature */: - case 131 /* PropertySignature */: - case 138 /* CallSignature */: + case 140 /* ConstructSignature */: + case 134 /* MethodSignature */: + case 141 /* IndexSignature */: + case 132 /* PropertySignature */: + case 139 /* CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 198 /* VariableDeclaration */) { + if (node.kind !== 199 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -7232,7 +7307,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 129 /* Parameter */) { + if (node.kind !== 130 /* Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -7344,7 +7419,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(20 /* DotToken */)) { - var node = createNode(126 /* QualifiedName */, entity.pos); + var node = createNode(127 /* QualifiedName */, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -7383,7 +7458,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(171 /* TemplateExpression */); + var template = createNode(172 /* TemplateExpression */); template.head = parseLiteralNode(); ts.Debug.assert(template.head.kind === 11 /* TemplateHead */, "Template head has wrong token kind"); var templateSpans = []; @@ -7396,7 +7471,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(176 /* TemplateSpan */); + var span = createNode(178 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; if (token === 15 /* CloseBraceToken */) { @@ -7437,7 +7512,7 @@ var ts; } // TYPES function parseTypeReference() { - var node = createNode(141 /* TypeReference */); + var node = createNode(142 /* TypeReference */); node.typeName = parseEntityName(false, ts.Diagnostics.Type_expected); if (!scanner.hasPrecedingLineBreak() && token === 24 /* LessThanToken */) { node.typeArguments = parseBracketedList(17 /* TypeArguments */, parseType, 24 /* LessThanToken */, 25 /* GreaterThanToken */); @@ -7445,13 +7520,13 @@ var ts; return finishNode(node); } function parseTypeQuery() { - var node = createNode(144 /* TypeQuery */); + var node = createNode(145 /* TypeQuery */); parseExpected(97 /* TypeOfKeyword */); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(128 /* TypeParameter */); + var node = createNode(129 /* TypeParameter */); node.name = parseIdentifier(); if (parseOptional(79 /* ExtendsKeyword */)) { // It's not uncommon for people to write improper constraints to a generic. If the @@ -7497,7 +7572,7 @@ var ts; } } function parseParameter() { - var node = createNode(129 /* Parameter */); + var node = createNode(130 /* Parameter */); node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(21 /* DotDotDotToken */); @@ -7594,7 +7669,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 139 /* ConstructSignature */) { + if (kind === 140 /* ConstructSignature */) { parseExpected(88 /* NewKeyword */); } fillSignature(51 /* ColonToken */, false, false, node); @@ -7658,7 +7733,7 @@ var ts; return token === 51 /* ColonToken */ || token === 23 /* CommaToken */ || token === 19 /* CloseBracketToken */; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(140 /* IndexSignature */, fullStart); + var node = createNode(141 /* IndexSignature */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.parameters = parseBracketedList(15 /* Parameters */, parseParameter, 18 /* OpenBracketToken */, 19 /* CloseBracketToken */); @@ -7671,7 +7746,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(50 /* QuestionToken */); if (token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */) { - var method = createNode(133 /* MethodSignature */, fullStart); + var method = createNode(134 /* MethodSignature */, fullStart); method.name = name; method.questionToken = questionToken; // Method signatues don't exist in expression contexts. So they have neither @@ -7681,7 +7756,7 @@ var ts; return finishNode(method); } else { - var property = createNode(131 /* PropertySignature */, fullStart); + var property = createNode(132 /* PropertySignature */, fullStart); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -7723,7 +7798,7 @@ var ts; switch (token) { case 16 /* OpenParenToken */: case 24 /* LessThanToken */: - return parseSignatureMember(138 /* CallSignature */); + return parseSignatureMember(139 /* CallSignature */); case 18 /* OpenBracketToken */: // Indexer or computed property return isIndexSignature() @@ -7731,7 +7806,7 @@ var ts; : parsePropertyOrMethodSignature(); case 88 /* NewKeyword */: if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(139 /* ConstructSignature */); + return parseSignatureMember(140 /* ConstructSignature */); } // fall through. case 8 /* StringLiteral */: @@ -7768,7 +7843,7 @@ var ts; return token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */; } function parseTypeLiteral() { - var node = createNode(145 /* TypeLiteral */); + var node = createNode(146 /* TypeLiteral */); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -7784,12 +7859,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(147 /* TupleType */); + var node = createNode(148 /* TupleType */); node.elementTypes = parseBracketedList(18 /* TupleElementTypes */, parseType, 18 /* OpenBracketToken */, 19 /* CloseBracketToken */); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(149 /* ParenthesizedType */); + var node = createNode(150 /* ParenthesizedType */); parseExpected(16 /* OpenParenToken */); node.type = parseType(); parseExpected(17 /* CloseParenToken */); @@ -7797,7 +7872,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 143 /* ConstructorType */) { + if (kind === 144 /* ConstructorType */) { parseExpected(88 /* NewKeyword */); } fillSignature(32 /* EqualsGreaterThanToken */, false, false, node); @@ -7810,10 +7885,10 @@ var ts; function parseNonArrayType() { switch (token) { case 112 /* AnyKeyword */: - case 121 /* StringKeyword */: - case 119 /* NumberKeyword */: + case 122 /* StringKeyword */: + case 120 /* NumberKeyword */: case 113 /* BooleanKeyword */: - case 122 /* SymbolKeyword */: + case 123 /* SymbolKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); @@ -7834,10 +7909,10 @@ var ts; function isStartOfType() { switch (token) { case 112 /* AnyKeyword */: - case 121 /* StringKeyword */: - case 119 /* NumberKeyword */: + case 122 /* StringKeyword */: + case 120 /* NumberKeyword */: case 113 /* BooleanKeyword */: - case 122 /* SymbolKeyword */: + case 123 /* SymbolKeyword */: case 99 /* VoidKeyword */: case 97 /* TypeOfKeyword */: case 14 /* OpenBraceToken */: @@ -7861,7 +7936,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(18 /* OpenBracketToken */)) { parseExpected(19 /* CloseBracketToken */); - var node = createNode(146 /* ArrayType */, type.pos); + var node = createNode(147 /* ArrayType */, type.pos); node.elementType = type; type = finishNode(node); } @@ -7876,7 +7951,7 @@ var ts; types.push(parseArrayTypeOrHigher()); } types.end = getNodeEnd(); - var node = createNode(148 /* UnionType */, type.pos); + var node = createNode(149 /* UnionType */, type.pos); node.types = types; type = finishNode(node); } @@ -7931,10 +8006,10 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(142 /* FunctionType */); + return parseFunctionOrConstructorType(143 /* FunctionType */); } if (token === 88 /* NewKeyword */) { - return parseFunctionOrConstructorType(143 /* ConstructorType */); + return parseFunctionOrConstructorType(144 /* ConstructorType */); } return parseUnionTypeOrHigher(); } @@ -8136,7 +8211,7 @@ var ts; (isIdentifier() || token === 14 /* OpenBraceToken */ || token === 18 /* OpenBracketToken */); } function parseYieldExpression() { - var node = createNode(172 /* YieldExpression */); + var node = createNode(173 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] @@ -8156,8 +8231,8 @@ var ts; } function parseSimpleArrowFunctionExpression(identifier) { ts.Debug.assert(token === 32 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(163 /* ArrowFunction */, identifier.pos); - var parameter = createNode(129 /* Parameter */, identifier.pos); + var node = createNode(164 /* ArrowFunction */, identifier.pos); + var parameter = createNode(130 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; @@ -8275,7 +8350,7 @@ var ts; return parseParenthesizedArrowFunctionExpressionHead(false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(163 /* ArrowFunction */); + var node = createNode(164 /* ArrowFunction */); // Arrow functions are never generators. // // If we're speculatively parsing a signature for a parenthesized arrow function, then @@ -8336,7 +8411,7 @@ var ts; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(170 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(171 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -8349,7 +8424,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 86 /* InKeyword */ || t === 125 /* OfKeyword */; + return t === 86 /* InKeyword */ || t === 126 /* OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -8415,33 +8490,33 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(169 /* BinaryExpression */, left.pos); + var node = createNode(170 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(167 /* PrefixUnaryExpression */); + var node = createNode(168 /* PrefixUnaryExpression */); node.operator = token; nextToken(); node.operand = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(164 /* DeleteExpression */); + var node = createNode(165 /* DeleteExpression */); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(165 /* TypeOfExpression */); + var node = createNode(166 /* TypeOfExpression */); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(166 /* VoidExpression */); + var node = createNode(167 /* VoidExpression */); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); @@ -8471,7 +8546,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token === 38 /* PlusPlusToken */ || token === 39 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(168 /* PostfixUnaryExpression */, expression.pos); + var node = createNode(169 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -8575,14 +8650,14 @@ var ts; } // If we have seen "super" it must be followed by '(' or '.'. // If it wasn't then just try to parse out a '.' and report an error. - var node = createNode(155 /* PropertyAccessExpression */, expression.pos); + var node = createNode(156 /* PropertyAccessExpression */, expression.pos); node.expression = expression; node.dotToken = parseExpectedToken(20 /* DotToken */, false, 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(160 /* TypeAssertionExpression */); + var node = createNode(161 /* TypeAssertionExpression */); parseExpected(24 /* LessThanToken */); node.type = parseType(); parseExpected(25 /* GreaterThanToken */); @@ -8593,7 +8668,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(20 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(155 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(156 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(true); @@ -8602,7 +8677,7 @@ var ts; } // when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName if (!inDecoratorContext() && parseOptional(18 /* OpenBracketToken */)) { - var indexedAccess = createNode(156 /* ElementAccessExpression */, expression.pos); + var indexedAccess = createNode(157 /* ElementAccessExpression */, expression.pos); indexedAccess.expression = expression; // It's not uncommon for a user to write: "new Type[]". // Check for that common pattern and report a better error message. @@ -8618,7 +8693,7 @@ var ts; continue; } if (token === 10 /* NoSubstitutionTemplateLiteral */ || token === 11 /* TemplateHead */) { - var tagExpression = createNode(159 /* TaggedTemplateExpression */, expression.pos); + var tagExpression = createNode(160 /* TaggedTemplateExpression */, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 10 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() @@ -8641,7 +8716,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(157 /* CallExpression */, expression.pos); + var callExpr = createNode(158 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -8649,7 +8724,7 @@ var ts; continue; } else if (token === 16 /* OpenParenToken */) { - var callExpr = createNode(157 /* CallExpression */, expression.pos); + var callExpr = createNode(158 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -8751,28 +8826,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(161 /* ParenthesizedExpression */); + var node = createNode(162 /* ParenthesizedExpression */); parseExpected(16 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(17 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(173 /* SpreadElementExpression */); + var node = createNode(174 /* SpreadElementExpression */); parseExpected(21 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token === 21 /* DotDotDotToken */ ? parseSpreadElement() : - token === 23 /* CommaToken */ ? createNode(175 /* OmittedExpression */) : + token === 23 /* CommaToken */ ? createNode(176 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(153 /* ArrayLiteralExpression */); + var node = createNode(154 /* ArrayLiteralExpression */); parseExpected(18 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) node.flags |= 512 /* MultiLine */; @@ -8782,10 +8857,10 @@ var ts; } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(116 /* GetKeyword */)) { - return parseAccessorDeclaration(136 /* GetAccessor */, fullStart, decorators, modifiers); + return parseAccessorDeclaration(137 /* GetAccessor */, fullStart, decorators, modifiers); } - else if (parseContextualModifier(120 /* SetKeyword */)) { - return parseAccessorDeclaration(137 /* SetAccessor */, fullStart, decorators, modifiers); + else if (parseContextualModifier(121 /* SetKeyword */)) { + return parseAccessorDeclaration(138 /* SetAccessor */, fullStart, decorators, modifiers); } return undefined; } @@ -8808,13 +8883,13 @@ var ts; } // Parse to check if it is short-hand property assignment or normal property assignment if ((token === 23 /* CommaToken */ || token === 15 /* CloseBraceToken */) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(225 /* ShorthandPropertyAssignment */, fullStart); + var shorthandDeclaration = createNode(226 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(224 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(225 /* PropertyAssignment */, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51 /* ColonToken */); @@ -8823,7 +8898,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(154 /* ObjectLiteralExpression */); + var node = createNode(155 /* ObjectLiteralExpression */); parseExpected(14 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.flags |= 512 /* MultiLine */; @@ -8841,7 +8916,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(162 /* FunctionExpression */); + var node = createNode(163 /* FunctionExpression */); parseExpected(83 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(35 /* AsteriskToken */); node.name = node.asteriskToken ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier(); @@ -8856,7 +8931,7 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(158 /* NewExpression */); + var node = createNode(159 /* NewExpression */); parseExpected(88 /* NewKeyword */); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); @@ -8867,7 +8942,7 @@ var ts; } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, checkForStrictMode, diagnosticMessage) { - var node = createNode(179 /* Block */); + var node = createNode(180 /* Block */); if (parseExpected(14 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(2 /* BlockStatements */, checkForStrictMode, parseStatement); parseExpected(15 /* CloseBraceToken */); @@ -8894,12 +8969,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(181 /* EmptyStatement */); + var node = createNode(182 /* EmptyStatement */); parseExpected(22 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(183 /* IfStatement */); + var node = createNode(184 /* IfStatement */); parseExpected(84 /* IfKeyword */); parseExpected(16 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -8909,7 +8984,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(184 /* DoStatement */); + var node = createNode(185 /* DoStatement */); parseExpected(75 /* DoKeyword */); node.statement = parseStatement(); parseExpected(100 /* WhileKeyword */); @@ -8924,7 +8999,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(185 /* WhileStatement */); + var node = createNode(186 /* WhileStatement */); parseExpected(100 /* WhileKeyword */); parseExpected(16 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -8947,21 +9022,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(86 /* InKeyword */)) { - var forInStatement = createNode(187 /* ForInStatement */, pos); + var forInStatement = createNode(188 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(17 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(125 /* OfKeyword */)) { - var forOfStatement = createNode(188 /* ForOfStatement */, pos); + else if (parseOptional(126 /* OfKeyword */)) { + var forOfStatement = createNode(189 /* ForOfStatement */, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(17 /* CloseParenToken */); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(186 /* ForStatement */, pos); + var forStatement = createNode(187 /* ForStatement */, pos); forStatement.initializer = initializer; parseExpected(22 /* SemicolonToken */); if (token !== 22 /* SemicolonToken */ && token !== 17 /* CloseParenToken */) { @@ -8979,7 +9054,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 190 /* BreakStatement */ ? 66 /* BreakKeyword */ : 71 /* ContinueKeyword */); + parseExpected(kind === 191 /* BreakStatement */ ? 66 /* BreakKeyword */ : 71 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -8987,7 +9062,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(191 /* ReturnStatement */); + var node = createNode(192 /* ReturnStatement */); parseExpected(90 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -8996,7 +9071,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(192 /* WithStatement */); + var node = createNode(193 /* WithStatement */); parseExpected(101 /* WithKeyword */); parseExpected(16 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -9005,7 +9080,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(220 /* CaseClause */); + var node = createNode(221 /* CaseClause */); parseExpected(67 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(51 /* ColonToken */); @@ -9013,7 +9088,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(221 /* DefaultClause */); + var node = createNode(222 /* DefaultClause */); parseExpected(73 /* DefaultKeyword */); parseExpected(51 /* ColonToken */); node.statements = parseList(4 /* SwitchClauseStatements */, false, parseStatement); @@ -9023,12 +9098,12 @@ var ts; return token === 67 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(193 /* SwitchStatement */); + var node = createNode(194 /* SwitchStatement */); parseExpected(92 /* SwitchKeyword */); parseExpected(16 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(17 /* CloseParenToken */); - var caseBlock = createNode(207 /* CaseBlock */, scanner.getStartPos()); + var caseBlock = createNode(208 /* CaseBlock */, scanner.getStartPos()); parseExpected(14 /* OpenBraceToken */); caseBlock.clauses = parseList(3 /* SwitchClauses */, false, parseCaseOrDefaultClause); parseExpected(15 /* CloseBraceToken */); @@ -9043,7 +9118,7 @@ var ts; // directly as that might consume an expression on the following line. // We just return 'undefined' in that case. The actual error will be reported in the // grammar walker. - var node = createNode(195 /* ThrowStatement */); + var node = createNode(196 /* ThrowStatement */); parseExpected(94 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); @@ -9051,7 +9126,7 @@ var ts; } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(196 /* TryStatement */); + var node = createNode(197 /* TryStatement */); parseExpected(96 /* TryKeyword */); node.tryBlock = parseBlock(false, false); node.catchClause = token === 68 /* CatchKeyword */ ? parseCatchClause() : undefined; @@ -9064,7 +9139,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(223 /* CatchClause */); + var result = createNode(224 /* CatchClause */); parseExpected(68 /* CatchKeyword */); if (parseExpected(16 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); @@ -9074,7 +9149,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(197 /* DebuggerStatement */); + var node = createNode(198 /* DebuggerStatement */); parseExpected(72 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); @@ -9086,13 +9161,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 65 /* Identifier */ && parseOptional(51 /* ColonToken */)) { - var labeledStatement = createNode(194 /* LabeledStatement */, fullStart); + var labeledStatement = createNode(195 /* LabeledStatement */, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(182 /* ExpressionStatement */, fullStart); + var expressionStatement = createNode(183 /* ExpressionStatement */, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -9150,8 +9225,9 @@ var ts; return !isConstEnum; case 103 /* InterfaceKeyword */: case 117 /* ModuleKeyword */: + case 118 /* NamespaceKeyword */: case 77 /* EnumKeyword */: - case 123 /* TypeKeyword */: + case 124 /* TypeKeyword */: // When followed by an identifier, these do not start a statement but might // instead be following declarations if (isDeclarationStart()) { @@ -9201,9 +9277,9 @@ var ts; case 82 /* ForKeyword */: return parseForOrForInOrForOfStatement(); case 71 /* ContinueKeyword */: - return parseBreakOrContinueStatement(189 /* ContinueStatement */); + return parseBreakOrContinueStatement(190 /* ContinueStatement */); case 66 /* BreakKeyword */: - return parseBreakOrContinueStatement(190 /* BreakStatement */); + return parseBreakOrContinueStatement(191 /* BreakStatement */); case 90 /* ReturnKeyword */: return parseReturnStatement(); case 101 /* WithKeyword */: @@ -9278,16 +9354,16 @@ var ts; // DECLARATIONS function parseArrayBindingElement() { if (token === 23 /* CommaToken */) { - return createNode(175 /* OmittedExpression */); + return createNode(176 /* OmittedExpression */); } - var node = createNode(152 /* BindingElement */); + var node = createNode(153 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(21 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); node.initializer = parseInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(152 /* BindingElement */); + var node = createNode(153 /* BindingElement */); // TODO(andersh): Handle computed properties var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -9303,14 +9379,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(150 /* ObjectBindingPattern */); + var node = createNode(151 /* ObjectBindingPattern */); parseExpected(14 /* OpenBraceToken */); node.elements = parseDelimitedList(10 /* ObjectBindingElements */, parseObjectBindingElement); parseExpected(15 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(151 /* ArrayBindingPattern */); + var node = createNode(152 /* ArrayBindingPattern */); parseExpected(18 /* OpenBracketToken */); node.elements = parseDelimitedList(11 /* ArrayBindingElements */, parseArrayBindingElement); parseExpected(19 /* CloseBracketToken */); @@ -9329,7 +9405,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(198 /* VariableDeclaration */); + var node = createNode(199 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -9338,7 +9414,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(199 /* VariableDeclarationList */); + var node = createNode(200 /* VariableDeclarationList */); switch (token) { case 98 /* VarKeyword */: break; @@ -9361,7 +9437,7 @@ var ts; // So we need to look ahead to determine if 'of' should be treated as a keyword in // this context. // The checker will then give an error that there is an empty declaration list. - if (token === 125 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token === 126 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -9376,7 +9452,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 17 /* CloseParenToken */; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(180 /* VariableStatement */, fullStart); + var node = createNode(181 /* VariableStatement */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -9384,7 +9460,7 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(200 /* FunctionDeclaration */, fullStart); + var node = createNode(201 /* FunctionDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(83 /* FunctionKeyword */); @@ -9395,7 +9471,7 @@ var ts; return finishNode(node); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(135 /* Constructor */, pos); + var node = createNode(136 /* Constructor */, pos); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(114 /* ConstructorKeyword */); @@ -9404,7 +9480,7 @@ var ts; return finishNode(node); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(134 /* MethodDeclaration */, fullStart); + var method = createNode(135 /* MethodDeclaration */, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -9415,7 +9491,7 @@ var ts; return finishNode(method); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(132 /* PropertyDeclaration */, fullStart); + var property = createNode(133 /* PropertyDeclaration */, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -9496,7 +9572,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 120 /* SetKeyword */ || idToken === 116 /* GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 121 /* SetKeyword */ || idToken === 116 /* GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -9530,7 +9606,7 @@ var ts; decorators = []; decorators.pos = scanner.getStartPos(); } - var decorator = createNode(130 /* Decorator */, decoratorStart); + var decorator = createNode(131 /* Decorator */, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -9563,7 +9639,7 @@ var ts; } function parseClassElement() { if (token === 22 /* SemicolonToken */) { - var result = createNode(178 /* SemicolonClassElement */); + var result = createNode(179 /* SemicolonClassElement */); nextToken(); return finishNode(result); } @@ -9601,10 +9677,10 @@ var ts; return parseClassDeclarationOrExpression( /*fullStart:*/ scanner.getStartPos(), /*decorators:*/ undefined, - /*modifiers:*/ undefined, 174 /* ClassExpression */); + /*modifiers:*/ undefined, 175 /* ClassExpression */); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 201 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 202 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { // In ES6 specification, All parts of a ClassDeclaration or a ClassExpression are strict mode code @@ -9649,16 +9725,16 @@ var ts; } function parseHeritageClause() { if (token === 79 /* ExtendsKeyword */ || token === 102 /* ImplementsKeyword */) { - var node = createNode(222 /* HeritageClause */); + var node = createNode(223 /* HeritageClause */); node.token = token; nextToken(); - node.types = parseDelimitedList(8 /* HeritageClauseElement */, parseHeritageClauseElement); + node.types = parseDelimitedList(8 /* HeritageClauseElement */, parseExpressionWithTypeArguments); return finishNode(node); } return undefined; } - function parseHeritageClauseElement() { - var node = createNode(177 /* HeritageClauseElement */); + function parseExpressionWithTypeArguments() { + var node = createNode(177 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); if (token === 24 /* LessThanToken */) { node.typeArguments = parseBracketedList(17 /* TypeArguments */, parseType, 24 /* LessThanToken */, 25 /* GreaterThanToken */); @@ -9672,7 +9748,7 @@ var ts; return parseList(6 /* ClassMembers */, false, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(202 /* InterfaceDeclaration */, fullStart); + var node = createNode(203 /* InterfaceDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(103 /* InterfaceKeyword */); @@ -9683,10 +9759,10 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(203 /* TypeAliasDeclaration */, fullStart); + var node = createNode(204 /* TypeAliasDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(123 /* TypeKeyword */); + parseExpected(124 /* TypeKeyword */); node.name = parseIdentifier(); parseExpected(53 /* EqualsToken */); node.type = parseType(); @@ -9698,13 +9774,13 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNode(226 /* EnumMember */, scanner.getStartPos()); + var node = createNode(227 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(204 /* EnumDeclaration */, fullStart); + var node = createNode(205 /* EnumDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(77 /* EnumKeyword */); @@ -9719,7 +9795,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(206 /* ModuleBlock */, scanner.getStartPos()); + var node = createNode(207 /* ModuleBlock */, scanner.getStartPos()); if (parseExpected(14 /* OpenBraceToken */)) { node.statements = parseList(1 /* ModuleElements */, false, parseModuleElement); parseExpected(15 /* CloseBraceToken */); @@ -9729,19 +9805,19 @@ var ts; } return finishNode(node); } - function parseInternalModuleTail(fullStart, decorators, modifiers, flags) { - var node = createNode(205 /* ModuleDeclaration */, fullStart); + function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { + var node = createNode(206 /* ModuleDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); node.body = parseOptional(20 /* DotToken */) - ? parseInternalModuleTail(getNodePos(), undefined, undefined, 1 /* Export */) + ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1 /* Export */) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(205 /* ModuleDeclaration */, fullStart); + var node = createNode(206 /* ModuleDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(true); @@ -9749,13 +9825,20 @@ var ts; return finishNode(node); } function parseModuleDeclaration(fullStart, decorators, modifiers) { - parseExpected(117 /* ModuleKeyword */); - return token === 8 /* StringLiteral */ - ? parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) - : parseInternalModuleTail(fullStart, decorators, modifiers, modifiers ? modifiers.flags : 0); + var flags = modifiers ? modifiers.flags : 0; + if (parseOptional(118 /* NamespaceKeyword */)) { + flags |= 32768 /* Namespace */; + } + else { + parseExpected(117 /* ModuleKeyword */); + if (token === 8 /* StringLiteral */) { + return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); + } + } + return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); } function isExternalModuleReference() { - return token === 118 /* RequireKeyword */ && + return token === 119 /* RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -9764,7 +9847,7 @@ var ts; function nextTokenIsCommaOrFromKeyword() { nextToken(); return token === 23 /* CommaToken */ || - token === 124 /* FromKeyword */; + token === 125 /* FromKeyword */; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { parseExpected(85 /* ImportKeyword */); @@ -9772,11 +9855,11 @@ var ts; var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 23 /* CommaToken */ && token !== 124 /* FromKeyword */) { + if (token !== 23 /* CommaToken */ && token !== 125 /* FromKeyword */) { // ImportEquals declaration of type: // import x = require("mod"); or // import x = M.x; - var importEqualsDeclaration = createNode(208 /* ImportEqualsDeclaration */, fullStart); + var importEqualsDeclaration = createNode(209 /* ImportEqualsDeclaration */, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -9787,7 +9870,7 @@ var ts; } } // Import statement - var importDeclaration = createNode(209 /* ImportDeclaration */, fullStart); + var importDeclaration = createNode(210 /* ImportDeclaration */, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); // ImportDeclaration: @@ -9797,7 +9880,7 @@ var ts; token === 35 /* AsteriskToken */ || token === 14 /* OpenBraceToken */) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(124 /* FromKeyword */); + parseExpected(125 /* FromKeyword */); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); @@ -9810,7 +9893,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(210 /* ImportClause */, fullStart); + var importClause = createNode(211 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -9820,7 +9903,7 @@ var ts; // parse namespace or named imports if (!importClause.name || parseOptional(23 /* CommaToken */)) { - importClause.namedBindings = token === 35 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(212 /* NamedImports */); + importClause.namedBindings = token === 35 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(213 /* NamedImports */); } return finishNode(importClause); } @@ -9830,8 +9913,8 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(219 /* ExternalModuleReference */); - parseExpected(118 /* RequireKeyword */); + var node = createNode(220 /* ExternalModuleReference */); + parseExpected(119 /* RequireKeyword */); parseExpected(16 /* OpenParenToken */); node.expression = parseModuleSpecifier(); parseExpected(17 /* CloseParenToken */); @@ -9852,7 +9935,7 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(211 /* NamespaceImport */); + var namespaceImport = createNode(212 /* NamespaceImport */); parseExpected(35 /* AsteriskToken */); parseExpected(111 /* AsKeyword */); namespaceImport.name = parseIdentifier(); @@ -9867,14 +9950,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(20 /* ImportOrExportSpecifiers */, kind === 212 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 14 /* OpenBraceToken */, 15 /* CloseBraceToken */); + node.elements = parseBracketedList(20 /* ImportOrExportSpecifiers */, kind === 213 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 14 /* OpenBraceToken */, 15 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(217 /* ExportSpecifier */); + return parseImportOrExportSpecifier(218 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(213 /* ImportSpecifier */); + return parseImportOrExportSpecifier(214 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -9899,23 +9982,23 @@ var ts; else { node.name = identifierName; } - if (kind === 213 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 214 /* ImportSpecifier */ && checkIdentifierIsKeyword) { // Report error identifier expected parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(215 /* ExportDeclaration */, fullStart); + var node = createNode(216 /* ExportDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(35 /* AsteriskToken */)) { - parseExpected(124 /* FromKeyword */); + parseExpected(125 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(216 /* NamedExports */); - if (parseOptional(124 /* FromKeyword */)) { + node.exportClause = parseNamedImportsOrExports(217 /* NamedExports */); + if (parseOptional(125 /* FromKeyword */)) { node.moduleSpecifier = parseModuleSpecifier(); } } @@ -9923,7 +10006,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(214 /* ExportAssignment */, fullStart); + var node = createNode(215 /* ExportAssignment */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(53 /* EqualsToken */)) { @@ -9952,13 +10035,14 @@ var ts; case 69 /* ClassKeyword */: case 103 /* InterfaceKeyword */: case 77 /* EnumKeyword */: - case 123 /* TypeKeyword */: + case 124 /* TypeKeyword */: // Not true keywords so ensure an identifier follows return lookAhead(nextTokenIsIdentifierOrKeyword); case 85 /* ImportKeyword */: // Not true keywords so ensure an identifier follows or is string literal or asterisk or open brace return lookAhead(nextTokenCanFollowImportKeyword); case 117 /* ModuleKeyword */: + case 118 /* NamespaceKeyword */: // Not a true keyword so ensure an identifier or string literal follows return lookAhead(nextTokenIsIdentifierOrKeywordOrStringLiteral); case 78 /* ExportKeyword */: @@ -10029,11 +10113,12 @@ var ts; return parseClassDeclaration(fullStart, decorators, modifiers); case 103 /* InterfaceKeyword */: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 123 /* TypeKeyword */: + case 124 /* TypeKeyword */: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 77 /* EnumKeyword */: return parseEnumDeclaration(fullStart, decorators, modifiers); case 117 /* ModuleKeyword */: + case 118 /* NamespaceKeyword */: return parseModuleDeclaration(fullStart, decorators, modifiers); case 85 /* ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); @@ -10041,7 +10126,7 @@ var ts; if (decorators) { // We reached this point because we encountered an AtToken and assumed a declaration would // follow. For recovery and error reporting purposes, return an incomplete declaration. - var node = createMissingNode(218 /* MissingDeclaration */, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(219 /* MissingDeclaration */, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -10124,10 +10209,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 /* Export */ - || node.kind === 208 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 219 /* ExternalModuleReference */ - || node.kind === 209 /* ImportDeclaration */ - || node.kind === 214 /* ExportAssignment */ - || node.kind === 215 /* ExportDeclaration */ + || node.kind === 209 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 220 /* ExternalModuleReference */ + || node.kind === 210 /* ImportDeclaration */ + || node.kind === 215 /* ExportAssignment */ + || node.kind === 216 /* ExportDeclaration */ ? node : undefined; }); @@ -10905,10 +10990,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 227 /* SourceFile */); + return ts.getAncestor(node, 228 /* SourceFile */); } function isGlobalSourceFile(node) { - return node.kind === 227 /* SourceFile */ && !ts.isExternalModule(node); + return node.kind === 228 /* SourceFile */ && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -10957,18 +11042,18 @@ var ts; } } switch (location.kind) { - case 227 /* SourceFile */: + case 228 /* SourceFile */: if (!ts.isExternalModule(location)) break; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931 /* ModuleMember */)) { - if (result.flags & meaning || !(result.flags & 8388608 /* Alias */ && getDeclarationOfAliasSymbol(result).kind === 217 /* ExportSpecifier */)) { + if (result.flags & meaning || !(result.flags & 8388608 /* Alias */ && getDeclarationOfAliasSymbol(result).kind === 218 /* ExportSpecifier */)) { break loop; } result = undefined; } - else if (location.kind === 227 /* SourceFile */ || - (location.kind === 205 /* ModuleDeclaration */ && location.name.kind === 8 /* StringLiteral */)) { + else if (location.kind === 228 /* SourceFile */ || + (location.kind === 206 /* ModuleDeclaration */ && location.name.kind === 8 /* StringLiteral */)) { result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931 /* ModuleMember */); var localSymbol = ts.getLocalSymbolForExportDefault(result); if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { @@ -10977,20 +11062,20 @@ var ts; result = undefined; } break; - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or // local variables of the constructor. This effectively means that entities from outer scopes // by the same name as a constructor parameter or local variable are inaccessible // in initializer expressions for instance member variables. - if (location.parent.kind === 201 /* ClassDeclaration */ && !(location.flags & 128 /* Static */)) { + if (location.parent.kind === 202 /* ClassDeclaration */ && !(location.flags & 128 /* Static */)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455 /* Value */)) { @@ -11000,8 +11085,8 @@ var ts; } } break; - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056 /* Type */)) { if (lastLocation && lastLocation.flags & 128 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 @@ -11021,9 +11106,9 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 127 /* ComputedPropertyName */: + case 128 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (grandparent.kind === 201 /* ClassDeclaration */ || grandparent.kind === 202 /* InterfaceDeclaration */) { + if (grandparent.kind === 202 /* ClassDeclaration */ || grandparent.kind === 203 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -11031,19 +11116,19 @@ var ts; } } break; - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 200 /* FunctionDeclaration */: - case 163 /* ArrowFunction */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 201 /* FunctionDeclaration */: + case 164 /* ArrowFunction */: if (name === "arguments") { result = argumentsSymbol; break loop; } break; - case 162 /* FunctionExpression */: + case 163 /* FunctionExpression */: if (name === "arguments") { result = argumentsSymbol; break loop; @@ -11054,14 +11139,14 @@ var ts; break loop; } break; - case 174 /* ClassExpression */: + case 175 /* ClassExpression */: var className = location.name; if (className && name === className.text) { result = location.symbol; break loop; } break; - case 130 /* Decorator */: + case 131 /* Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -11070,7 +11155,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 129 /* Parameter */) { + if (location.parent && location.parent.kind === 130 /* Parameter */) { location = location.parent; } // @@ -11126,16 +11211,16 @@ var ts; // for (let x in x) // for (let x of x) // climb up to the variable declaration skipping binding patterns - var variableDeclaration = ts.getAncestor(declaration, 198 /* VariableDeclaration */); + var variableDeclaration = ts.getAncestor(declaration, 199 /* VariableDeclaration */); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 180 /* VariableStatement */ || - variableDeclaration.parent.parent.kind === 186 /* ForStatement */) { + if (variableDeclaration.parent.parent.kind === 181 /* VariableStatement */ || + variableDeclaration.parent.parent.kind === 187 /* ForStatement */) { // variable statement/for statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 188 /* ForOfStatement */ || - variableDeclaration.parent.parent.kind === 187 /* ForInStatement */) { + else if (variableDeclaration.parent.parent.kind === 189 /* ForOfStatement */ || + variableDeclaration.parent.parent.kind === 188 /* ForInStatement */) { // ForIn/ForOf case - use site should not be used in expression part var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); @@ -11162,10 +11247,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 208 /* ImportEqualsDeclaration */) { + if (node.kind === 209 /* ImportEqualsDeclaration */) { return node; } - while (node && node.kind !== 209 /* ImportDeclaration */) { + while (node && node.kind !== 210 /* ImportDeclaration */) { node = node.parent; } return node; @@ -11175,7 +11260,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 219 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 220 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -11185,7 +11270,7 @@ var ts; if (moduleSymbol) { var exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]); if (!exportDefaultSymbol) { - error(node.name, ts.Diagnostics.External_module_0_has_no_default_export, symbolToString(moduleSymbol)); + error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } return exportDefaultSymbol; } @@ -11282,17 +11367,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node); - case 210 /* ImportClause */: + case 211 /* ImportClause */: return getTargetOfImportClause(node); - case 211 /* NamespaceImport */: + case 212 /* NamespaceImport */: return getTargetOfNamespaceImport(node); - case 213 /* ImportSpecifier */: + case 214 /* ImportSpecifier */: return getTargetOfImportSpecifier(node); - case 217 /* ExportSpecifier */: + case 218 /* ExportSpecifier */: return getTargetOfExportSpecifier(node); - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: return getTargetOfExportAssignment(node); } } @@ -11337,11 +11422,11 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 214 /* ExportAssignment */) { + if (node.kind === 215 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 217 /* ExportSpecifier */) { + else if (node.kind === 218 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -11354,7 +11439,7 @@ var ts; // This function is only for imports with entity names function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 208 /* ImportEqualsDeclaration */); + importDeclaration = ts.getAncestor(entityName, 209 /* ImportEqualsDeclaration */); ts.Debug.assert(importDeclaration !== undefined); } // There are three things we might try to look for. In the following examples, @@ -11367,13 +11452,13 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 65 /* Identifier */ || entityName.parent.kind === 126 /* QualifiedName */) { + if (entityName.kind === 65 /* Identifier */ || entityName.parent.kind === 127 /* QualifiedName */) { return resolveEntityName(entityName, 1536 /* Namespace */); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 208 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 209 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */); } } @@ -11392,9 +11477,9 @@ var ts; return undefined; } } - else if (name.kind === 126 /* QualifiedName */ || name.kind === 155 /* PropertyAccessExpression */) { - var left = name.kind === 126 /* QualifiedName */ ? name.left : name.expression; - var right = name.kind === 126 /* QualifiedName */ ? name.right : name.name; + else if (name.kind === 127 /* QualifiedName */ || name.kind === 156 /* PropertyAccessExpression */) { + var left = name.kind === 127 /* QualifiedName */ ? name.left : name.expression; + var right = name.kind === 127 /* QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, 1536 /* Namespace */); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -11451,10 +11536,10 @@ var ts; if (sourceFile.symbol) { return sourceFile.symbol; } - error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_an_external_module, sourceFile.fileName); + error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName); return; } - error(moduleReferenceLiteral, ts.Diagnostics.Cannot_find_external_module_0, moduleName); + error(moduleReferenceLiteral, ts.Diagnostics.Cannot_find_module_0, moduleName); } // An external module with an 'export =' declaration resolves to the target of the 'export =' declaration, // and an external module with no 'export =' declaration resolves to the module itself. @@ -11467,7 +11552,7 @@ var ts; function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression) { var symbol = resolveExternalModuleSymbol(moduleSymbol); if (symbol && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */))) { - error(moduleReferenceExpression, ts.Diagnostics.External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); + error(moduleReferenceExpression, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); symbol = undefined; } return symbol; @@ -11554,7 +11639,7 @@ var ts; var members = node.members; for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; - if (member.kind === 135 /* Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 136 /* Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -11624,17 +11709,17 @@ var ts; } } switch (location_1.kind) { - case 227 /* SourceFile */: + case 228 /* SourceFile */: if (!ts.isExternalModule(location_1)) { break; } - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -11783,8 +11868,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 205 /* ModuleDeclaration */ && declaration.name.kind === 8 /* StringLiteral */) || - (declaration.kind === 227 /* SourceFile */ && ts.isExternalModule(declaration)); + return (declaration.kind === 206 /* ModuleDeclaration */ && declaration.name.kind === 8 /* StringLiteral */) || + (declaration.kind === 228 /* SourceFile */ && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -11820,12 +11905,12 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 144 /* TypeQuery */) { + if (entityName.parent.kind === 145 /* TypeQuery */) { // Typeof value meaning = 107455 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 126 /* QualifiedName */ || entityName.kind === 155 /* PropertyAccessExpression */ || - entityName.parent.kind === 208 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 127 /* QualifiedName */ || entityName.kind === 156 /* PropertyAccessExpression */ || + entityName.parent.kind === 209 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1536 /* Namespace */; @@ -11873,10 +11958,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = type.symbol.declarations[0].parent; - while (node.kind === 149 /* ParenthesizedType */) { + while (node.kind === 150 /* ParenthesizedType */) { node = node.parent; } - if (node.kind === 203 /* TypeAliasDeclaration */) { + if (node.kind === 204 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -12080,7 +12165,7 @@ var ts; var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16 /* Function */) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 227 /* SourceFile */ || declaration.parent.kind === 206 /* ModuleBlock */; + return declaration.parent.kind === 228 /* SourceFile */ || declaration.parent.kind === 207 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -12159,7 +12244,7 @@ var ts; writer.writeParameter(getIndexerParameterName(resolved, 0 /* String */, "x")); writePunctuation(writer, 51 /* ColonToken */); writeSpace(writer); - writeKeyword(writer, 121 /* StringKeyword */); + writeKeyword(writer, 122 /* StringKeyword */); writePunctuation(writer, 19 /* CloseBracketToken */); writePunctuation(writer, 51 /* ColonToken */); writeSpace(writer); @@ -12173,7 +12258,7 @@ var ts; writer.writeParameter(getIndexerParameterName(resolved, 1 /* Number */, "x")); writePunctuation(writer, 51 /* ColonToken */); writeSpace(writer); - writeKeyword(writer, 119 /* NumberKeyword */); + writeKeyword(writer, 120 /* NumberKeyword */); writePunctuation(writer, 19 /* CloseBracketToken */); writePunctuation(writer, 51 /* ColonToken */); writeSpace(writer); @@ -12319,12 +12404,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 205 /* ModuleDeclaration */) { + if (node.kind === 206 /* ModuleDeclaration */) { if (node.name.kind === 8 /* StringLiteral */) { return node; } } - else if (node.kind === 227 /* SourceFile */) { + else if (node.kind === 228 /* SourceFile */) { return ts.isExternalModule(node) ? node : undefined; } } @@ -12373,69 +12458,69 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 152 /* BindingElement */: + case 153 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 198 /* VariableDeclaration */: + case 199 /* VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // Otherwise fall through - case 205 /* ModuleDeclaration */: - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 203 /* TypeAliasDeclaration */: - case 200 /* FunctionDeclaration */: - case 204 /* EnumDeclaration */: - case 208 /* ImportEqualsDeclaration */: + case 206 /* ModuleDeclaration */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 204 /* TypeAliasDeclaration */: + case 201 /* FunctionDeclaration */: + case 205 /* EnumDeclaration */: + case 209 /* ImportEqualsDeclaration */: var parent_2 = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedNodeFlags(node) & 1 /* Export */) && - !(node.kind !== 208 /* ImportEqualsDeclaration */ && parent_2.kind !== 227 /* SourceFile */ && ts.isInAmbientContext(parent_2))) { + !(node.kind !== 209 /* ImportEqualsDeclaration */ && parent_2.kind !== 228 /* SourceFile */ && ts.isInAmbientContext(parent_2))) { return isGlobalSourceFile(parent_2); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent_2); - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: if (node.flags & (32 /* Private */ | 64 /* Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so let it fall into next case statement - case 135 /* Constructor */: - case 139 /* ConstructSignature */: - case 138 /* CallSignature */: - case 140 /* IndexSignature */: - case 129 /* Parameter */: - case 206 /* ModuleBlock */: - case 142 /* FunctionType */: - case 143 /* ConstructorType */: - case 145 /* TypeLiteral */: - case 141 /* TypeReference */: - case 146 /* ArrayType */: - case 147 /* TupleType */: - case 148 /* UnionType */: - case 149 /* ParenthesizedType */: + case 136 /* Constructor */: + case 140 /* ConstructSignature */: + case 139 /* CallSignature */: + case 141 /* IndexSignature */: + case 130 /* Parameter */: + case 207 /* ModuleBlock */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: + case 146 /* TypeLiteral */: + case 142 /* TypeReference */: + case 147 /* ArrayType */: + case 148 /* TupleType */: + case 149 /* UnionType */: + case 150 /* ParenthesizedType */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 210 /* ImportClause */: - case 211 /* NamespaceImport */: - case 213 /* ImportSpecifier */: + case 211 /* ImportClause */: + case 212 /* NamespaceImport */: + case 214 /* ImportSpecifier */: return false; // Type parameters are always visible - case 128 /* TypeParameter */: + case 129 /* TypeParameter */: // Source file is always visible - case 227 /* SourceFile */: + case 228 /* SourceFile */: return true; // Export assignements do not create name bindings outside the module - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -12451,10 +12536,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 214 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 215 /* ExportAssignment */) { exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 217 /* ExportSpecifier */) { + else if (node.parent.kind === 218 /* ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent); } var result = []; @@ -12480,7 +12565,7 @@ var ts; } } function getRootDeclaration(node) { - while (node.kind === 152 /* BindingElement */) { + while (node.kind === 153 /* BindingElement */) { node = node.parent.parent; } return node; @@ -12489,7 +12574,7 @@ var ts; node = getRootDeclaration(node); // Parent chain: // VaribleDeclaration -> VariableDeclarationList -> VariableStatement -> 'Declaration Container' - return node.kind === 198 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; + return node.kind === 199 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { // TypeScript 1.0 spec (April 2014): 8.4 @@ -12522,7 +12607,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 150 /* ObjectBindingPattern */) { + if (pattern.kind === 151 /* ObjectBindingPattern */) { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) var name_5 = declaration.propertyName || declaration.name; // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, @@ -12569,10 +12654,10 @@ var ts; // Return the inferred type for a variable, parameter, or property declaration function getTypeForVariableLikeDeclaration(declaration) { // A variable declared in a for..in statement is always of type any - if (declaration.parent.parent.kind === 187 /* ForInStatement */) { + if (declaration.parent.parent.kind === 188 /* ForInStatement */) { return anyType; } - if (declaration.parent.parent.kind === 188 /* ForOfStatement */) { + if (declaration.parent.parent.kind === 189 /* ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -12586,11 +12671,11 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 129 /* Parameter */) { + if (declaration.kind === 130 /* Parameter */) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 137 /* SetAccessor */ && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 136 /* GetAccessor */); + if (func.kind === 138 /* SetAccessor */ && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 137 /* GetAccessor */); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -12606,7 +12691,7 @@ var ts; return checkExpressionCached(declaration.initializer); } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 225 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 226 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } // No type specified and nothing can be inferred @@ -12641,7 +12726,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 175 /* OmittedExpression */ || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 176 /* OmittedExpression */ || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -12664,7 +12749,7 @@ var ts; // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. function getTypeFromBindingPattern(pattern) { - return pattern.kind === 150 /* ObjectBindingPattern */ + return pattern.kind === 151 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); } @@ -12686,7 +12771,7 @@ var ts; // During a normal type check we'll never get to here with a property assignment (the check of the containing // object literal uses a different path). We exclude widening only so that language services and type verification // tools see the actual type. - return declaration.kind !== 224 /* PropertyAssignment */ ? getWidenedType(type) : type; + return declaration.kind !== 225 /* PropertyAssignment */ ? getWidenedType(type) : type; } // If no type was specified and nothing could be inferred, and if the declaration specifies a binding pattern, use // the type implied by the binding pattern @@ -12698,7 +12783,7 @@ var ts; // Report implicit any errors unless this is a private property within an ambient declaration if (reportErrors && compilerOptions.noImplicitAny) { var root = getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 129 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 130 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -12713,11 +12798,11 @@ var ts; } // Handle catch clause variables var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 223 /* CatchClause */) { + if (declaration.parent.kind === 224 /* CatchClause */) { return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 214 /* ExportAssignment */) { + if (declaration.kind === 215 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } // Handle variable, parameter or property @@ -12743,7 +12828,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 136 /* GetAccessor */) { + if (accessor.kind === 137 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -12762,8 +12847,8 @@ var ts; links = links || getSymbolLinks(symbol); if (!links.type) { links.type = resolvingType; - var getter = ts.getDeclarationOfKind(symbol, 136 /* GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 137 /* SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 138 /* SetAccessor */); var type; // First try to see if the user specified a return type on the get-accessor. var getterReturnType = getAnnotatedAccessorType(getter); @@ -12796,7 +12881,7 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 136 /* GetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */); 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)); } } @@ -12866,7 +12951,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 202 /* InterfaceDeclaration */ || node.kind === 201 /* ClassDeclaration */) { + if (node.kind === 203 /* InterfaceDeclaration */ || node.kind === 202 /* ClassDeclaration */) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -12900,10 +12985,10 @@ var ts; } function resolveBaseTypesOfClass(type) { type.baseTypes = []; - var declaration = ts.getDeclarationOfKind(type.symbol, 201 /* ClassDeclaration */); + var declaration = ts.getDeclarationOfKind(type.symbol, 202 /* ClassDeclaration */); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(declaration); if (baseTypeNode) { - var baseType = getTypeFromHeritageClauseElement(baseTypeNode); + var baseType = getTypeFromTypeNode(baseTypeNode); if (baseType !== unknownType) { if (getTargetType(baseType).flags & 1024 /* Class */) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -12923,10 +13008,10 @@ var ts; type.baseTypes = []; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 202 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 203 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; - var baseType = getTypeFromHeritageClauseElement(node); + var baseType = getTypeFromTypeNode(node); if (baseType !== unknownType) { if (getTargetType(baseType).flags & (1024 /* Class */ | 2048 /* Interface */)) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -12965,7 +13050,7 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = ts.getDeclarationOfKind(symbol, 203 /* TypeAliasDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */); var type = getTypeFromTypeNode(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; @@ -12973,7 +13058,7 @@ var ts; } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 203 /* TypeAliasDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */); error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; @@ -12992,7 +13077,7 @@ var ts; if (!links.declaredType) { var type = createType(512 /* TypeParameter */); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 128 /* TypeParameter */).constraint) { + if (!ts.getDeclarationOfKind(symbol, 129 /* TypeParameter */).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -13461,7 +13546,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 135 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 136 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; @@ -13492,8 +13577,8 @@ var ts; else { // TypeScript 1.0 spec (April 2014): // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. - if (declaration.kind === 136 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 137 /* SetAccessor */); + if (declaration.kind === 137 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 138 /* SetAccessor */); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { @@ -13511,19 +13596,19 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 142 /* FunctionType */: - case 143 /* ConstructorType */: - case 200 /* FunctionDeclaration */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 135 /* Constructor */: - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: - case 140 /* IndexSignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: + case 201 /* FunctionDeclaration */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 136 /* Constructor */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: + case 141 /* IndexSignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: // Don't include signature if node is the implementation of an overloaded function. A node is considered // an implementation node if it has a body and the previous node is of the same kind and immediately // precedes the implementation node (i.e. has the same parent and ends where the implementation starts). @@ -13600,7 +13685,7 @@ var ts; // object type literal or interface (using the new keyword). Each way of declaring a constructor // will result in a different declaration kind. if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 135 /* Constructor */ || signature.declaration.kind === 139 /* ConstructSignature */; + var isConstructor = signature.declaration.kind === 136 /* Constructor */ || signature.declaration.kind === 140 /* ConstructSignature */; var type = createObjectType(32768 /* Anonymous */ | 65536 /* FromSignature */); type.members = emptySymbols; type.properties = emptyArray; @@ -13614,7 +13699,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 119 /* NumberKeyword */ : 121 /* StringKeyword */; + var syntaxKind = kind === 1 /* Number */ ? 120 /* NumberKeyword */ : 122 /* StringKeyword */; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; @@ -13644,7 +13729,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 128 /* TypeParameter */).constraint); + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 129 /* TypeParameter */).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -13700,13 +13785,13 @@ var ts; currentNode = currentNode.parent; } // if last step was made from the type parameter this means that path has started somewhere in constraint which is illegal - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 128 /* TypeParameter */; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 129 /* TypeParameter */; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 141 /* TypeReference */ && n.typeName.kind === 65 /* Identifier */) { + if (n.kind === 142 /* TypeReference */ && n.typeName.kind === 65 /* Identifier */) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056 /* Type */, undefined, undefined); @@ -13732,20 +13817,14 @@ var ts; check(typeParameter.constraint); } } - function getTypeFromTypeReference(node) { - return getTypeFromTypeReferenceOrHeritageClauseElement(node); - } - function getTypeFromHeritageClauseElement(node) { - return getTypeFromTypeReferenceOrHeritageClauseElement(node); - } - function getTypeFromTypeReferenceOrHeritageClauseElement(node) { + function getTypeFromTypeReferenceOrExpressionWithTypeArguments(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var type; // We don't currently support heritage clauses with complex expressions in them. // For these cases, we just set the type to be the unknownType. - if (node.kind !== 177 /* HeritageClauseElement */ || ts.isSupportedHeritageClauseElement(node)) { - var typeNameOrExpression = node.kind === 141 /* TypeReference */ + if (node.kind !== 177 /* ExpressionWithTypeArguments */ || ts.isSupportedExpressionWithTypeArguments(node)) { + var typeNameOrExpression = node.kind === 142 /* TypeReference */ ? node.typeName : node.expression; var symbol = resolveEntityName(typeNameOrExpression, 793056 /* Type */); @@ -13799,9 +13878,9 @@ var ts; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 204 /* EnumDeclaration */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 205 /* EnumDeclaration */: return declaration; } } @@ -13999,40 +14078,40 @@ var ts; switch (node.kind) { case 112 /* AnyKeyword */: return anyType; - case 121 /* StringKeyword */: + case 122 /* StringKeyword */: return stringType; - case 119 /* NumberKeyword */: + case 120 /* NumberKeyword */: return numberType; case 113 /* BooleanKeyword */: return booleanType; - case 122 /* SymbolKeyword */: + case 123 /* SymbolKeyword */: return esSymbolType; case 99 /* VoidKeyword */: return voidType; case 8 /* StringLiteral */: return getTypeFromStringLiteral(node); - case 141 /* TypeReference */: - return getTypeFromTypeReference(node); - case 177 /* HeritageClauseElement */: - return getTypeFromHeritageClauseElement(node); - case 144 /* TypeQuery */: + case 142 /* TypeReference */: + return getTypeFromTypeReferenceOrExpressionWithTypeArguments(node); + case 177 /* ExpressionWithTypeArguments */: + return getTypeFromTypeReferenceOrExpressionWithTypeArguments(node); + case 145 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 146 /* ArrayType */: + case 147 /* ArrayType */: return getTypeFromArrayTypeNode(node); - case 147 /* TupleType */: + case 148 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 148 /* UnionType */: + case 149 /* UnionType */: return getTypeFromUnionTypeNode(node); - case 149 /* ParenthesizedType */: + case 150 /* ParenthesizedType */: return getTypeFromTypeNode(node.type); - case 142 /* FunctionType */: - case 143 /* ConstructorType */: - case 145 /* TypeLiteral */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: + case 146 /* TypeLiteral */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode case 65 /* Identifier */: - case 126 /* QualifiedName */: + case 127 /* QualifiedName */: var symbol = getSymbolInfo(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: @@ -14190,27 +14269,27 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 134 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 135 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: return isContextSensitiveFunctionLikeDeclaration(node); - case 154 /* ObjectLiteralExpression */: + case 155 /* ObjectLiteralExpression */: return ts.forEach(node.properties, isContextSensitive); - case 153 /* ArrayLiteralExpression */: + case 154 /* ArrayLiteralExpression */: return ts.forEach(node.elements, isContextSensitive); - case 170 /* ConditionalExpression */: + case 171 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: return node.operatorToken.kind === 49 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 224 /* PropertyAssignment */: + case 225 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: return isContextSensitiveFunctionLikeDeclaration(node); - case 161 /* ParenthesizedExpression */: + case 162 /* ParenthesizedExpression */: return isContextSensitive(node.expression); } return false; @@ -15046,22 +15125,22 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 129 /* Parameter */: + case 130 /* Parameter */: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 200 /* FunctionDeclaration */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 201 /* FunctionDeclaration */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -15330,10 +15409,10 @@ var ts; // The expression is restricted to a single identifier or a sequence of identifiers separated by periods while (node) { switch (node.kind) { - case 144 /* TypeQuery */: + case 145 /* TypeQuery */: return true; case 65 /* Identifier */: - case 126 /* QualifiedName */: + case 127 /* QualifiedName */: node = node.parent; continue; default: @@ -15381,7 +15460,7 @@ var ts; function isAssignedInBinaryExpression(node) { if (node.operatorToken.kind >= 53 /* FirstAssignment */ && node.operatorToken.kind <= 64 /* LastAssignment */) { var n = node.left; - while (n.kind === 161 /* ParenthesizedExpression */) { + while (n.kind === 162 /* ParenthesizedExpression */) { n = n.expression; } if (n.kind === 65 /* Identifier */ && getResolvedSymbol(n) === symbol) { @@ -15398,46 +15477,46 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: return isAssignedInBinaryExpression(node); - case 198 /* VariableDeclaration */: - case 152 /* BindingElement */: + case 199 /* VariableDeclaration */: + case 153 /* BindingElement */: return isAssignedInVariableDeclaration(node); - case 150 /* ObjectBindingPattern */: - case 151 /* ArrayBindingPattern */: - case 153 /* ArrayLiteralExpression */: - case 154 /* ObjectLiteralExpression */: - case 155 /* PropertyAccessExpression */: - case 156 /* ElementAccessExpression */: - case 157 /* CallExpression */: - case 158 /* NewExpression */: - case 160 /* TypeAssertionExpression */: - case 161 /* ParenthesizedExpression */: - case 167 /* PrefixUnaryExpression */: - case 164 /* DeleteExpression */: - case 165 /* TypeOfExpression */: - case 166 /* VoidExpression */: - case 168 /* PostfixUnaryExpression */: - case 170 /* ConditionalExpression */: - case 173 /* SpreadElementExpression */: - case 179 /* Block */: - case 180 /* VariableStatement */: - case 182 /* ExpressionStatement */: - case 183 /* IfStatement */: - case 184 /* DoStatement */: - case 185 /* WhileStatement */: - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 191 /* ReturnStatement */: - case 192 /* WithStatement */: - case 193 /* SwitchStatement */: - case 220 /* CaseClause */: - case 221 /* DefaultClause */: - case 194 /* LabeledStatement */: - case 195 /* ThrowStatement */: - case 196 /* TryStatement */: - case 223 /* CatchClause */: + case 151 /* ObjectBindingPattern */: + case 152 /* ArrayBindingPattern */: + case 154 /* ArrayLiteralExpression */: + case 155 /* ObjectLiteralExpression */: + case 156 /* PropertyAccessExpression */: + case 157 /* ElementAccessExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: + case 161 /* TypeAssertionExpression */: + case 162 /* ParenthesizedExpression */: + case 168 /* PrefixUnaryExpression */: + case 165 /* DeleteExpression */: + case 166 /* TypeOfExpression */: + case 167 /* VoidExpression */: + case 169 /* PostfixUnaryExpression */: + case 171 /* ConditionalExpression */: + case 174 /* SpreadElementExpression */: + case 180 /* Block */: + case 181 /* VariableStatement */: + case 183 /* ExpressionStatement */: + case 184 /* IfStatement */: + case 185 /* DoStatement */: + case 186 /* WhileStatement */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 192 /* ReturnStatement */: + case 193 /* WithStatement */: + case 194 /* SwitchStatement */: + case 221 /* CaseClause */: + case 222 /* DefaultClause */: + case 195 /* LabeledStatement */: + case 196 /* ThrowStatement */: + case 197 /* TryStatement */: + case 224 /* CatchClause */: return ts.forEachChild(node, isAssignedIn); } return false; @@ -15489,19 +15568,19 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 183 /* IfStatement */: + case 184 /* IfStatement */: // In a branch of an if statement, narrow based on controlling expression if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } break; - case 170 /* ConditionalExpression */: + case 171 /* ConditionalExpression */: // In a branch of a conditional expression, narrow based on controlling condition if (child !== node.condition) { narrowedType = narrowType(type, node.condition, child === node.whenTrue); } break; - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: // In the right operand of an && or ||, narrow based on left operand if (child === node.right) { if (node.operatorToken.kind === 48 /* AmpersandAmpersandToken */) { @@ -15512,14 +15591,14 @@ var ts; } } break; - case 227 /* SourceFile */: - case 205 /* ModuleDeclaration */: - case 200 /* FunctionDeclaration */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 135 /* Constructor */: + case 228 /* SourceFile */: + case 206 /* ModuleDeclaration */: + case 201 /* FunctionDeclaration */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 136 /* Constructor */: // Stop at the first containing function or module declaration break loop; } @@ -15535,7 +15614,7 @@ var ts; return type; function narrowTypeByEquality(type, expr, assumeTrue) { // Check that we have 'typeof ' on the left and string literal on the right - if (expr.left.kind !== 165 /* TypeOfExpression */ || expr.right.kind !== 8 /* StringLiteral */) { + if (expr.left.kind !== 166 /* TypeOfExpression */ || expr.right.kind !== 8 /* StringLiteral */) { return type; } var left = expr.left; @@ -15628,9 +15707,9 @@ var ts; // will be a subtype or the same type as the argument. function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 161 /* ParenthesizedExpression */: + case 162 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: var operator = expr.operatorToken.kind; if (operator === 30 /* EqualsEqualsEqualsToken */ || operator === 31 /* ExclamationEqualsEqualsToken */) { return narrowTypeByEquality(type, expr, assumeTrue); @@ -15645,7 +15724,7 @@ var ts; return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 167 /* PrefixUnaryExpression */: + case 168 /* PrefixUnaryExpression */: if (expr.operator === 46 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -15662,7 +15741,7 @@ var ts; // will be bound to non-arrow function that contain this arrow function. This results in inconsistent behavior. // 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 && ts.getContainingFunction(node).kind === 163 /* ArrowFunction */ && languageVersion < 2 /* ES6 */) { + if (symbol === argumentsSymbol && ts.getContainingFunction(node).kind === 164 /* ArrowFunction */ && languageVersion < 2 /* ES6 */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } if (symbol.flags & 8388608 /* Alias */ && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) { @@ -15686,7 +15765,7 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 /* ES6 */ || (symbol.flags & 2 /* BlockScopedVariable */) === 0 || - symbol.valueDeclaration.parent.kind === 223 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 224 /* CatchClause */) { return; } // - check if binding is used in some function @@ -15695,12 +15774,12 @@ var ts; // nesting structure: // (variable declaration or binding element) -> variable declaration list -> container var container = symbol.valueDeclaration; - while (container.kind !== 199 /* VariableDeclarationList */) { + while (container.kind !== 200 /* VariableDeclarationList */) { container = container.parent; } // get the parent of variable declaration list container = container.parent; - if (container.kind === 180 /* VariableStatement */) { + if (container.kind === 181 /* VariableStatement */) { // if parent is variable statement - get its parent container = container.parent; } @@ -15719,9 +15798,9 @@ var ts; } } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 201 /* ClassDeclaration */ ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 202 /* ClassDeclaration */ ? container.parent : undefined; getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 132 /* PropertyDeclaration */ || container.kind === 135 /* Constructor */) { + if (container.kind === 133 /* PropertyDeclaration */ || container.kind === 136 /* Constructor */) { getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } else { @@ -15734,39 +15813,39 @@ var ts; var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 163 /* ArrowFunction */) { + if (container.kind === 164 /* ArrowFunction */) { container = ts.getThisContainer(container, false); // When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code needToCaptureLexicalThis = (languageVersion < 2 /* ES6 */); } switch (container.kind) { - case 205 /* ModuleDeclaration */: - error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); + case 206 /* ModuleDeclaration */: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 135 /* Constructor */: + case 136 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: if (container.flags & 128 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 127 /* ComputedPropertyName */: + case 128 /* ComputedPropertyName */: 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 === 201 /* ClassDeclaration */ ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 202 /* ClassDeclaration */ ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -15775,15 +15854,15 @@ var ts; } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 129 /* Parameter */) { + if (n.kind === 130 /* Parameter */) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 157 /* CallExpression */ && node.parent.expression === node; - var enclosingClass = ts.getAncestor(node, 201 /* ClassDeclaration */); + var isCallExpression = node.parent.kind === 158 /* CallExpression */ && node.parent.expression === node; + var enclosingClass = ts.getAncestor(node, 202 /* ClassDeclaration */); var baseClass; if (enclosingClass && ts.getClassExtendsHeritageClauseElement(enclosingClass)) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); @@ -15801,7 +15880,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - canUseSuperExpression = container.kind === 135 /* Constructor */; + canUseSuperExpression = container.kind === 136 /* Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -15810,28 +15889,28 @@ var ts; // - In a static member function or static member accessor // super property access might appear in arrow functions with arbitrary deep nesting needToCaptureLexicalThis = false; - while (container && container.kind === 163 /* ArrowFunction */) { + while (container && container.kind === 164 /* ArrowFunction */) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2 /* ES6 */; } // topmost container must be something that is directly nested in the class declaration - if (container && container.parent && container.parent.kind === 201 /* ClassDeclaration */) { + if (container && container.parent && container.parent.kind === 202 /* ClassDeclaration */) { if (container.flags & 128 /* Static */) { canUseSuperExpression = - container.kind === 134 /* MethodDeclaration */ || - container.kind === 133 /* MethodSignature */ || - container.kind === 136 /* GetAccessor */ || - container.kind === 137 /* SetAccessor */; + container.kind === 135 /* MethodDeclaration */ || + container.kind === 134 /* MethodSignature */ || + container.kind === 137 /* GetAccessor */ || + container.kind === 138 /* SetAccessor */; } else { canUseSuperExpression = - container.kind === 134 /* MethodDeclaration */ || - container.kind === 133 /* MethodSignature */ || - container.kind === 136 /* GetAccessor */ || - container.kind === 137 /* SetAccessor */ || - container.kind === 132 /* PropertyDeclaration */ || - container.kind === 131 /* PropertySignature */ || - container.kind === 135 /* Constructor */; + container.kind === 135 /* MethodDeclaration */ || + container.kind === 134 /* MethodSignature */ || + container.kind === 137 /* GetAccessor */ || + container.kind === 138 /* SetAccessor */ || + container.kind === 133 /* PropertyDeclaration */ || + container.kind === 132 /* PropertySignature */ || + container.kind === 136 /* Constructor */; } } } @@ -15845,7 +15924,7 @@ var ts; getNodeLinks(node).flags |= 16 /* SuperInstance */; returnType = baseClass; } - if (container.kind === 135 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 136 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); returnType = unknownType; @@ -15859,7 +15938,7 @@ var ts; return returnType; } } - if (container && container.kind === 127 /* ComputedPropertyName */) { + if (container && container.kind === 128 /* ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { @@ -15904,7 +15983,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 129 /* Parameter */) { + if (declaration.kind === 130 /* Parameter */) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -15921,7 +16000,7 @@ var ts; if (func) { // If the containing function has a return type annotation, is a constructor, or is a get accessor whose // corresponding set accessor has a type annotation, return statements in the function are contextually typed - if (func.type || func.kind === 135 /* Constructor */ || func.kind === 136 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 137 /* SetAccessor */))) { + if (func.type || func.kind === 136 /* Constructor */ || func.kind === 137 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 138 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(func)); } // Otherwise, if the containing function is contextually typed by a function type with exactly one call signature @@ -15944,7 +16023,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 159 /* TaggedTemplateExpression */) { + if (template.parent.kind === 160 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -16075,32 +16154,32 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 198 /* VariableDeclaration */: - case 129 /* Parameter */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 152 /* BindingElement */: + case 199 /* VariableDeclaration */: + case 130 /* Parameter */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 153 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 163 /* ArrowFunction */: - case 191 /* ReturnStatement */: + case 164 /* ArrowFunction */: + case 192 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 157 /* CallExpression */: - case 158 /* NewExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 160 /* TypeAssertionExpression */: + case 161 /* TypeAssertionExpression */: return getTypeFromTypeNode(parent.type); - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 224 /* PropertyAssignment */: + case 225 /* PropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 153 /* ArrayLiteralExpression */: + case 154 /* ArrayLiteralExpression */: return getContextualTypeForElementExpression(node); - case 170 /* ConditionalExpression */: + case 171 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 176 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 171 /* TemplateExpression */); + case 178 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 172 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 161 /* ParenthesizedExpression */: + case 162 /* ParenthesizedExpression */: return getContextualType(parent); } return undefined; @@ -16117,7 +16196,7 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 162 /* FunctionExpression */ || node.kind === 163 /* ArrowFunction */; + return node.kind === 163 /* FunctionExpression */ || node.kind === 164 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions and arrow functions are contextually typed. @@ -16129,7 +16208,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 134 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 135 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); @@ -16185,13 +16264,13 @@ var ts; // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ p: a}] = xxx'. function isAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 169 /* BinaryExpression */ && parent.operatorToken.kind === 53 /* EqualsToken */ && parent.left === node) { + if (parent.kind === 170 /* BinaryExpression */ && parent.operatorToken.kind === 53 /* EqualsToken */ && parent.left === node) { return true; } - if (parent.kind === 224 /* PropertyAssignment */) { + if (parent.kind === 225 /* PropertyAssignment */) { return isAssignmentTarget(parent.parent); } - if (parent.kind === 153 /* ArrayLiteralExpression */) { + if (parent.kind === 154 /* ArrayLiteralExpression */) { return isAssignmentTarget(parent); } return false; @@ -16216,7 +16295,7 @@ var ts; var inDestructuringPattern = isAssignmentTarget(node); for (var _i = 0; _i < elements.length; _i++) { var e = elements[_i]; - if (inDestructuringPattern && e.kind === 173 /* SpreadElementExpression */) { + if (inDestructuringPattern && e.kind === 174 /* SpreadElementExpression */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -16240,7 +16319,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 173 /* SpreadElementExpression */; + hasSpreadElement = hasSpreadElement || e.kind === 174 /* SpreadElementExpression */; } if (!hasSpreadElement) { var contextualType = getContextualType(node); @@ -16251,7 +16330,7 @@ var ts; return createArrayType(getUnionType(elementTypes)); } function isNumericName(name) { - return name.kind === 127 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 128 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { // It seems odd to consider an expression of type Any to result in a numeric name, @@ -16307,18 +16386,18 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 224 /* PropertyAssignment */ || - memberDecl.kind === 225 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 225 /* PropertyAssignment */ || + memberDecl.kind === 226 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 224 /* PropertyAssignment */) { + if (memberDecl.kind === 225 /* PropertyAssignment */) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 134 /* MethodDeclaration */) { + else if (memberDecl.kind === 135 /* MethodDeclaration */) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 225 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 226 /* ShorthandPropertyAssignment */); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; @@ -16338,7 +16417,7 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 136 /* GetAccessor */ || memberDecl.kind === 137 /* SetAccessor */); + ts.Debug.assert(memberDecl.kind === 137 /* GetAccessor */ || memberDecl.kind === 138 /* SetAccessor */); checkAccessorDeclaration(memberDecl); } if (!ts.hasDynamicName(memberDecl)) { @@ -16377,7 +16456,7 @@ var ts; // If a symbol is a synthesized symbol with no value declaration, we assume it is a property. Example of this are the synthesized // '.prototype' property as well as synthesized tuple index properties. function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 132 /* PropertyDeclaration */; + return s.valueDeclaration ? s.valueDeclaration.kind : 133 /* PropertyDeclaration */; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 16 /* Public */ | 128 /* Static */ : 0; @@ -16390,7 +16469,7 @@ var ts; } // Property is known to be private or protected at this point // Get the declaring and enclosing class instance types - var enclosingClassDeclaration = ts.getAncestor(node, 201 /* ClassDeclaration */); + var enclosingClassDeclaration = ts.getAncestor(node, 202 /* ClassDeclaration */); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); // Private property is accessible if declaring and enclosing class are the same @@ -16451,7 +16530,7 @@ var ts; // - In a static member function or static member accessor // where this references the constructor function object of a derived class, // a super property access is permitted and must specify a public static member function of the base class. - if (left.kind === 91 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 134 /* MethodDeclaration */) { + if (left.kind === 91 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 135 /* MethodDeclaration */) { error(right, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); } else { @@ -16463,14 +16542,14 @@ var ts; return anyType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 155 /* PropertyAccessExpression */ + var left = node.kind === 156 /* PropertyAccessExpression */ ? 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 /* Class */) { - if (left.kind === 91 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 134 /* MethodDeclaration */) { + if (left.kind === 91 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 135 /* MethodDeclaration */) { return false; } else { @@ -16486,7 +16565,7 @@ var ts; // Grammar checking if (!node.argumentExpression) { var sourceFile = getSourceFile(node); - if (node.parent.kind === 158 /* NewExpression */ && node.parent.expression === node) { + if (node.parent.kind === 159 /* NewExpression */ && 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); @@ -16615,7 +16694,7 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 159 /* TaggedTemplateExpression */) { + if (node.kind === 160 /* TaggedTemplateExpression */) { checkExpression(node.template); } else { @@ -16683,7 +16762,7 @@ var ts; } function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { - if (args[i].kind === 173 /* SpreadElementExpression */) { + if (args[i].kind === 174 /* SpreadElementExpression */) { return i; } } @@ -16693,13 +16772,13 @@ var ts; var adjustedArgCount; // Apparent number of arguments we will have in this call var typeArguments; // Type arguments (undefined if none) var callIsIncomplete; // In incomplete call we want to be lenient when we have too few arguments - if (node.kind === 159 /* TaggedTemplateExpression */) { + if (node.kind === 160 /* TaggedTemplateExpression */) { var tagExpression = node; // Even if the call is incomplete, we'll have a missing expression as our last argument, // so we can say the count is just the arg list length adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 171 /* TemplateExpression */) { + if (tagExpression.template.kind === 172 /* TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var templateExpression = tagExpression.template; @@ -16720,7 +16799,7 @@ var ts; var callExpression = node; if (!callExpression.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(callExpression.kind === 158 /* NewExpression */); + ts.Debug.assert(callExpression.kind === 159 /* NewExpression */); return signature.minArgumentCount === 0; } // For IDE scenarios we may have an incomplete call, so a trailing comma is tantamount to adding another argument. @@ -16797,10 +16876,10 @@ var ts; // wildcards for all context sensitive function expressions. for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 175 /* OmittedExpression */) { + if (arg.kind !== 176 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = void 0; - if (i === 0 && args[i].parent.kind === 159 /* TaggedTemplateExpression */) { + if (i === 0 && args[i].parent.kind === 160 /* TaggedTemplateExpression */) { argType = globalTemplateStringsArrayType; } else { @@ -16847,12 +16926,12 @@ 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 !== 175 /* OmittedExpression */) { + if (arg.kind !== 176 /* OmittedExpression */) { // Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter) var paramType = getTypeAtPosition(signature, i); // A tagged template expression provides a special first argument, and string literals get string literal types // unless we're reporting errors - var argType = i === 0 && node.kind === 159 /* TaggedTemplateExpression */ + var argType = i === 0 && node.kind === 160 /* TaggedTemplateExpression */ ? globalTemplateStringsArrayType : arg.kind === 8 /* StringLiteral */ && !reportErrors ? getStringLiteralType(arg) @@ -16874,10 +16953,10 @@ var ts; */ function getEffectiveCallArguments(node) { var args; - if (node.kind === 159 /* TaggedTemplateExpression */) { + if (node.kind === 160 /* TaggedTemplateExpression */) { var template = node.template; args = [template]; - if (template.kind === 171 /* TemplateExpression */) { + if (template.kind === 172 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); @@ -16900,7 +16979,7 @@ var ts; */ function getEffectiveTypeArguments(callExpression) { if (callExpression.expression.kind === 91 /* SuperKeyword */) { - var containingClass = ts.getAncestor(callExpression, 201 /* ClassDeclaration */); + var containingClass = ts.getAncestor(callExpression, 202 /* ClassDeclaration */); var baseClassTypeNode = containingClass && ts.getClassExtendsHeritageClauseElement(containingClass); return baseClassTypeNode && baseClassTypeNode.typeArguments; } @@ -16910,7 +16989,7 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray) { - var isTaggedTemplate = node.kind === 159 /* TaggedTemplateExpression */; + var isTaggedTemplate = node.kind === 160 /* TaggedTemplateExpression */; var typeArguments; if (!isTaggedTemplate) { typeArguments = getEffectiveTypeArguments(node); @@ -17223,13 +17302,13 @@ var ts; // to correctly fill the candidatesOutArray. if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 157 /* CallExpression */) { + if (node.kind === 158 /* CallExpression */) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 158 /* NewExpression */) { + else if (node.kind === 159 /* NewExpression */) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 159 /* TaggedTemplateExpression */) { + else if (node.kind === 160 /* TaggedTemplateExpression */) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } else { @@ -17245,12 +17324,12 @@ var ts; if (node.expression.kind === 91 /* SuperKeyword */) { return voidType; } - if (node.kind === 158 /* NewExpression */) { + if (node.kind === 159 /* NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 135 /* Constructor */ && - declaration.kind !== 139 /* ConstructSignature */ && - declaration.kind !== 143 /* ConstructorType */) { + declaration.kind !== 136 /* Constructor */ && + declaration.kind !== 140 /* ConstructSignature */ && + declaration.kind !== 144 /* ConstructorType */) { // When resolved signature is a call signature (and not a construct signature) the result type is any if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); @@ -17298,7 +17377,7 @@ var ts; return unknownType; } var type; - if (func.body.kind !== 179 /* Block */) { + if (func.body.kind !== 180 /* Block */) { type = checkExpressionCached(func.body, contextualMapper); } else { @@ -17340,7 +17419,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 195 /* ThrowStatement */); + return (body.statements.length === 1) && (body.statements[0].kind === 196 /* ThrowStatement */); } // TypeScript Specification 1.0 (6.3) - July 2014 // An explicitly typed function whose return type isn't the Void or the Any type @@ -17355,7 +17434,7 @@ var ts; return; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. - if (ts.nodeIsMissing(func.body) || func.body.kind !== 179 /* Block */) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 180 /* Block */) { return; } var bodyBlock = func.body; @@ -17373,10 +17452,10 @@ 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 !== 134 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 135 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); // Grammar checking var hasGrammarError = checkGrammarDeclarationNameInStrictMode(node) || checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 162 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 163 /* FunctionExpression */) { checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); } // The identityMapper object is used to indicate that function expressions are wildcards @@ -17409,19 +17488,19 @@ var ts; checkSignatureDeclaration(node); } } - if (produceDiagnostics && node.kind !== 134 /* MethodDeclaration */ && node.kind !== 133 /* MethodSignature */) { + if (produceDiagnostics && node.kind !== 135 /* MethodDeclaration */ && node.kind !== 134 /* MethodSignature */) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 134 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 135 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); if (node.type && !node.asteriskToken) { checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); } if (node.body) { - if (node.body.kind === 179 /* Block */) { + if (node.body.kind === 180 /* Block */) { checkSourceElement(node.body); } else { @@ -17463,17 +17542,17 @@ var ts; // An identifier expression that references any other kind of entity is classified as a value(and therefore cannot be the target of an assignment). return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3 /* Variable */) !== 0; } - case 155 /* PropertyAccessExpression */: { + case 156 /* PropertyAccessExpression */: { var symbol = findSymbol(n); // TypeScript 1.0 spec (April 2014): 4.10 // A property access expression is always classified as a reference. // NOTE (not in spec): assignment to enum members should not be allowed return !symbol || symbol === unknownSymbol || (symbol.flags & ~8 /* EnumMember */) !== 0; } - case 156 /* ElementAccessExpression */: + case 157 /* ElementAccessExpression */: // old compiler doesn't check indexed assess return true; - case 161 /* ParenthesizedExpression */: + case 162 /* ParenthesizedExpression */: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -17482,11 +17561,11 @@ var ts; function isConstVariableReference(n) { switch (n.kind) { case 65 /* Identifier */: - case 155 /* PropertyAccessExpression */: { + case 156 /* PropertyAccessExpression */: { var symbol = findSymbol(n); return symbol && (symbol.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192 /* Const */) !== 0; } - case 156 /* ElementAccessExpression */: { + case 157 /* ElementAccessExpression */: { var index = n.argumentExpression; var symbol = findSymbol(n.expression); if (symbol && index && index.kind === 8 /* StringLiteral */) { @@ -17496,7 +17575,7 @@ var ts; } return false; } - case 161 /* ParenthesizedExpression */: + case 162 /* ParenthesizedExpression */: return isConstVariableReference(n.expression); default: return false; @@ -17647,7 +17726,7 @@ var ts; var properties = node.properties; for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 224 /* PropertyAssignment */ || p.kind === 225 /* ShorthandPropertyAssignment */) { + if (p.kind === 225 /* PropertyAssignment */ || p.kind === 226 /* ShorthandPropertyAssignment */) { // TODO(andersh): Computed property support var name_8 = p.name; var type = sourceType.flags & 1 /* Any */ ? sourceType : @@ -17675,8 +17754,8 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 175 /* OmittedExpression */) { - if (e.kind !== 173 /* SpreadElementExpression */) { + if (e.kind !== 176 /* OmittedExpression */) { + if (e.kind !== 174 /* SpreadElementExpression */) { var propName = "" + i; var type = sourceType.flags & 1 /* Any */ ? sourceType : isTupleLikeType(sourceType) @@ -17700,7 +17779,7 @@ var ts; } else { var restExpression = e.expression; - if (restExpression.kind === 169 /* BinaryExpression */ && restExpression.operatorToken.kind === 53 /* EqualsToken */) { + if (restExpression.kind === 170 /* BinaryExpression */ && restExpression.operatorToken.kind === 53 /* EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -17713,14 +17792,14 @@ var ts; return sourceType; } function checkDestructuringAssignment(target, sourceType, contextualMapper) { - if (target.kind === 169 /* BinaryExpression */ && target.operatorToken.kind === 53 /* EqualsToken */) { + if (target.kind === 170 /* BinaryExpression */ && target.operatorToken.kind === 53 /* EqualsToken */) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 154 /* ObjectLiteralExpression */) { + if (target.kind === 155 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 153 /* ArrayLiteralExpression */) { + if (target.kind === 154 /* ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -17740,7 +17819,7 @@ var ts; checkGrammarEvalOrArgumentsInStrictMode(node, node.left); } var operator = node.operatorToken.kind; - if (operator === 53 /* EqualsToken */ && (node.left.kind === 154 /* ObjectLiteralExpression */ || node.left.kind === 153 /* ArrayLiteralExpression */)) { + if (operator === 53 /* EqualsToken */ && (node.left.kind === 155 /* ObjectLiteralExpression */ || node.left.kind === 154 /* ArrayLiteralExpression */)) { return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); } var leftType = checkExpression(node.left, contextualMapper); @@ -17952,7 +18031,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 127 /* ComputedPropertyName */) { + if (node.name.kind === 128 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); @@ -17963,7 +18042,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 127 /* ComputedPropertyName */) { + if (node.name.kind === 128 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -17997,7 +18076,7 @@ var ts; // contextually typed function and arrow expressions in the initial phase. function checkExpressionOrQualifiedName(node, contextualMapper) { var type; - if (node.kind == 126 /* QualifiedName */) { + if (node.kind == 127 /* QualifiedName */) { type = checkQualifiedName(node); } else { @@ -18009,9 +18088,9 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 155 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 156 /* ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 65 /* Identifier */ || node.kind === 126 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 156 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 157 /* ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 65 /* Identifier */ || node.kind === 127 /* QualifiedName */) && 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); } @@ -18038,54 +18117,54 @@ var ts; return booleanType; case 7 /* NumericLiteral */: return checkNumericLiteral(node); - case 171 /* TemplateExpression */: + case 172 /* TemplateExpression */: return checkTemplateExpression(node); case 8 /* StringLiteral */: case 10 /* NoSubstitutionTemplateLiteral */: return stringType; case 9 /* RegularExpressionLiteral */: return globalRegExpType; - case 153 /* ArrayLiteralExpression */: + case 154 /* ArrayLiteralExpression */: return checkArrayLiteral(node, contextualMapper); - case 154 /* ObjectLiteralExpression */: + case 155 /* ObjectLiteralExpression */: return checkObjectLiteral(node, contextualMapper); - case 155 /* PropertyAccessExpression */: + case 156 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 156 /* ElementAccessExpression */: + case 157 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 157 /* CallExpression */: - case 158 /* NewExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: return checkCallExpression(node); - case 159 /* TaggedTemplateExpression */: + case 160 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 160 /* TypeAssertionExpression */: + case 161 /* TypeAssertionExpression */: return checkTypeAssertion(node); - case 161 /* ParenthesizedExpression */: + case 162 /* ParenthesizedExpression */: return checkExpression(node.expression, contextualMapper); - case 174 /* ClassExpression */: + case 175 /* ClassExpression */: return checkClassExpression(node); - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 165 /* TypeOfExpression */: + case 166 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 164 /* DeleteExpression */: + case 165 /* DeleteExpression */: return checkDeleteExpression(node); - case 166 /* VoidExpression */: + case 167 /* VoidExpression */: return checkVoidExpression(node); - case 167 /* PrefixUnaryExpression */: + case 168 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 168 /* PostfixUnaryExpression */: + case 169 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 170 /* ConditionalExpression */: + case 171 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); - case 173 /* SpreadElementExpression */: + case 174 /* SpreadElementExpression */: return checkSpreadElementExpression(node, contextualMapper); - case 175 /* OmittedExpression */: + case 176 /* OmittedExpression */: return undefinedType; - case 172 /* YieldExpression */: + case 173 /* YieldExpression */: checkYieldExpression(node); return unknownType; } @@ -18118,7 +18197,7 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 112 /* AccessibilityModifier */) { func = ts.getContainingFunction(node); - if (!(func.kind === 135 /* Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 136 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -18133,12 +18212,12 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 140 /* IndexSignature */) { + if (node.kind === 141 /* IndexSignature */) { checkGrammarIndexSignature(node); } - else if (node.kind === 142 /* FunctionType */ || node.kind === 200 /* FunctionDeclaration */ || node.kind === 143 /* ConstructorType */ || - node.kind === 138 /* CallSignature */ || node.kind === 135 /* Constructor */ || - node.kind === 139 /* ConstructSignature */) { + else if (node.kind === 143 /* FunctionType */ || node.kind === 201 /* FunctionDeclaration */ || node.kind === 144 /* ConstructorType */ || + node.kind === 139 /* CallSignature */ || node.kind === 136 /* Constructor */ || + node.kind === 140 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -18150,10 +18229,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 139 /* ConstructSignature */: + case 140 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 138 /* CallSignature */: + case 139 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -18162,7 +18241,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 202 /* InterfaceDeclaration */) { + if (node.kind === 203 /* InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -18182,7 +18261,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 121 /* StringKeyword */: + case 122 /* StringKeyword */: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -18190,7 +18269,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 119 /* NumberKeyword */: + case 120 /* NumberKeyword */: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -18234,17 +18313,17 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 157 /* CallExpression */ && n.expression.kind === 91 /* SuperKeyword */; + return n.kind === 158 /* CallExpression */ && n.expression.kind === 91 /* SuperKeyword */; } function containsSuperCall(n) { if (isSuperCallExpression(n)) { return true; } switch (n.kind) { - case 162 /* FunctionExpression */: - case 200 /* FunctionDeclaration */: - case 163 /* ArrowFunction */: - case 154 /* ObjectLiteralExpression */: return false; + case 163 /* FunctionExpression */: + case 201 /* FunctionDeclaration */: + case 164 /* ArrowFunction */: + case 155 /* ObjectLiteralExpression */: return false; default: return ts.forEachChild(n, containsSuperCall); } } @@ -18252,12 +18331,12 @@ var ts; if (n.kind === 93 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 162 /* FunctionExpression */ && n.kind !== 200 /* FunctionDeclaration */) { + else if (n.kind !== 163 /* FunctionExpression */ && n.kind !== 201 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 132 /* PropertyDeclaration */ && + return n.kind === 133 /* PropertyDeclaration */ && !(n.flags & 128 /* Static */) && !!n.initializer; } @@ -18274,7 +18353,7 @@ var ts; ts.forEach(node.parameters, function (p) { return p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 182 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 183 /* ExpressionStatement */ || !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 { @@ -18292,7 +18371,7 @@ var ts; if (produceDiagnostics) { // Grammar checking accessors checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 136 /* GetAccessor */) { + if (node.kind === 137 /* GetAccessor */) { 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); } @@ -18300,7 +18379,7 @@ var ts; if (!ts.hasDynamicName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. - var otherKind = node.kind === 136 /* GetAccessor */ ? 137 /* SetAccessor */ : 136 /* GetAccessor */; + var otherKind = node.kind === 137 /* GetAccessor */ ? 138 /* SetAccessor */ : 137 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 112 /* AccessibilityModifier */) !== (otherAccessor.flags & 112 /* AccessibilityModifier */))) { @@ -18326,16 +18405,16 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeReferenceInStrictMode(node.typeName); - return checkTypeReferenceOrHeritageClauseElement(node); + return checkTypeReferenceOrExpressionWithTypeArguments(node); } - function checkHeritageClauseElement(node) { - checkGrammarHeritageClauseElementInStrictMode(node.expression); - return checkTypeReferenceOrHeritageClauseElement(node); + function checkExpressionWithTypeArguments(node) { + checkGrammarExpressionWithTypeArgumentsInStrictMode(node.expression); + return checkTypeReferenceOrExpressionWithTypeArguments(node); } - function checkTypeReferenceOrHeritageClauseElement(node) { + function checkTypeReferenceOrExpressionWithTypeArguments(node) { // Grammar checking checkGrammarTypeArguments(node, node.typeArguments); - var type = getTypeFromTypeReferenceOrHeritageClauseElement(node); + var type = getTypeFromTypeReferenceOrExpressionWithTypeArguments(node); if (type !== unknownType && node.typeArguments) { // Do type argument local checks only if referenced type is successfully resolved var len = node.typeArguments.length; @@ -18397,9 +18476,9 @@ var ts; var signaturesToCheck; // Unnamed (call\construct) signatures in interfaces are inherited and not shadowed so examining just node symbol won't give complete answer. // Use declaring type to obtain full list of signatures. - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 202 /* InterfaceDeclaration */) { - ts.Debug.assert(signatureDeclarationNode.kind === 138 /* CallSignature */ || signatureDeclarationNode.kind === 139 /* ConstructSignature */); - var signatureKind = signatureDeclarationNode.kind === 138 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 203 /* InterfaceDeclaration */) { + ts.Debug.assert(signatureDeclarationNode.kind === 139 /* CallSignature */ || signatureDeclarationNode.kind === 140 /* ConstructSignature */); + var signatureKind = signatureDeclarationNode.kind === 139 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -18417,7 +18496,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 202 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 203 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported flags |= 1 /* Export */; @@ -18500,7 +18579,7 @@ var ts; // TODO(jfreeman): These are methods, so handle computed name case if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { // the only situation when this is possible (same kind\same name but different symbol) - mixed static and instance class members - ts.Debug.assert(node.kind === 134 /* MethodDeclaration */ || node.kind === 133 /* MethodSignature */); + ts.Debug.assert(node.kind === 135 /* MethodDeclaration */ || node.kind === 134 /* MethodSignature */); ts.Debug.assert((node.flags & 128 /* Static */) !== (subsequentNode.flags & 128 /* Static */)); var diagnostic = node.flags & 128 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode_1, diagnostic); @@ -18529,7 +18608,7 @@ var ts; var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 202 /* InterfaceDeclaration */ || node.parent.kind === 145 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 203 /* InterfaceDeclaration */ || node.parent.kind === 146 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -18540,7 +18619,7 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if (node.kind === 200 /* FunctionDeclaration */ || node.kind === 134 /* MethodDeclaration */ || node.kind === 133 /* MethodSignature */ || node.kind === 135 /* Constructor */) { + if (node.kind === 201 /* FunctionDeclaration */ || node.kind === 135 /* MethodDeclaration */ || node.kind === 134 /* MethodSignature */ || node.kind === 136 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -18663,16 +18742,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: return 2097152 /* ExportType */; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: return d.name.kind === 8 /* StringLiteral */ || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */ : 4194304 /* ExportNamespace */; - case 201 /* ClassDeclaration */: - case 204 /* EnumDeclaration */: + case 202 /* ClassDeclaration */: + case 205 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -18687,23 +18766,23 @@ var ts; var expression = node.expression; var exprType = checkExpression(expression); switch (node.parent.kind) { - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); var classDecoratorType = instantiateSingleCallFunctionType(getGlobalClassDecoratorType(), [classConstructorType]); checkTypeAssignableTo(exprType, classDecoratorType, node); break; - case 132 /* PropertyDeclaration */: + case 133 /* PropertyDeclaration */: checkTypeAssignableTo(exprType, getGlobalPropertyDecoratorType(), node); break; - case 134 /* MethodDeclaration */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 135 /* MethodDeclaration */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: var methodType = getTypeOfNode(node.parent); var methodDecoratorType = instantiateSingleCallFunctionType(getGlobalMethodDecoratorType(), [methodType]); checkTypeAssignableTo(exprType, methodDecoratorType, node); break; - case 129 /* Parameter */: + case 130 /* Parameter */: checkTypeAssignableTo(exprType, getGlobalParameterDecoratorType(), node); break; } @@ -18713,7 +18792,7 @@ var ts; // When we are emitting type metadata for decorators, we need to try to check the type // as if it were an expression so that we can emit the type in a value position when we // serialize the type metadata. - if (node && node.kind === 141 /* TypeReference */) { + if (node && node.kind === 142 /* TypeReference */) { var type = getTypeFromTypeNode(node); var shouldCheckIfUnknownType = type === unknownType && compilerOptions.separateCompilation; if (!type || (!shouldCheckIfUnknownType && type.flags & (1048703 /* Intrinsic */ | 132 /* NumberLike */ | 258 /* StringLike */))) { @@ -18730,19 +18809,19 @@ var ts; */ function checkTypeAnnotationAsExpression(node) { switch (node.kind) { - case 132 /* PropertyDeclaration */: + case 133 /* PropertyDeclaration */: checkTypeNodeAsExpression(node.type); break; - case 129 /* Parameter */: + case 130 /* Parameter */: checkTypeNodeAsExpression(node.type); break; - case 134 /* MethodDeclaration */: + case 135 /* MethodDeclaration */: checkTypeNodeAsExpression(node.type); break; - case 136 /* GetAccessor */: + case 137 /* GetAccessor */: checkTypeNodeAsExpression(node.type); break; - case 137 /* SetAccessor */: + case 138 /* SetAccessor */: checkTypeNodeAsExpression(getSetAccessorTypeAnnotationNode(node)); break; } @@ -18768,25 +18847,25 @@ var ts; if (compilerOptions.emitDecoratorMetadata) { // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 134 /* MethodDeclaration */: + case 135 /* MethodDeclaration */: checkParameterTypeAnnotationsAsExpressions(node); // fall-through - case 137 /* SetAccessor */: - case 136 /* GetAccessor */: - case 132 /* PropertyDeclaration */: - case 129 /* Parameter */: + case 138 /* SetAccessor */: + case 137 /* GetAccessor */: + case 133 /* PropertyDeclaration */: + case 130 /* Parameter */: checkTypeAnnotationAsExpression(node); break; } } emitDecorate = true; - if (node.kind === 129 /* Parameter */) { + if (node.kind === 130 /* Parameter */) { emitParam = true; } ts.forEach(node.decorators, checkDecorator); @@ -18809,7 +18888,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 127 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 128 /* ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -18845,11 +18924,11 @@ var ts; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 179 /* Block */) { + if (node.kind === 180 /* Block */) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 206 /* ModuleBlock */) { + if (ts.isFunctionBlock(node) || node.kind === 207 /* ModuleBlock */) { checkFunctionExpressionBodies(node); } } @@ -18868,12 +18947,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 132 /* PropertyDeclaration */ || - node.kind === 131 /* PropertySignature */ || - node.kind === 134 /* MethodDeclaration */ || - node.kind === 133 /* MethodSignature */ || - node.kind === 136 /* GetAccessor */ || - node.kind === 137 /* SetAccessor */) { + if (node.kind === 133 /* PropertyDeclaration */ || + node.kind === 132 /* PropertySignature */ || + node.kind === 135 /* MethodDeclaration */ || + node.kind === 134 /* MethodSignature */ || + node.kind === 137 /* GetAccessor */ || + node.kind === 138 /* SetAccessor */) { // it is ok to have member named '_super' or '_this' - member access is always qualified return false; } @@ -18882,7 +18961,7 @@ var ts; return false; } var root = getRootDeclaration(node); - if (root.kind === 129 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 130 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; } @@ -18915,7 +18994,7 @@ var ts; return; } // bubble up and find containing type - var enclosingClass = ts.getAncestor(node, 201 /* ClassDeclaration */); + var enclosingClass = ts.getAncestor(node, 202 /* ClassDeclaration */); // if containing type was not found or it is ambient - exit (no codegen) if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; @@ -18935,14 +19014,14 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 205 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 206 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 227 /* SourceFile */ && ts.isExternalModule(parent)) { + if (parent.kind === 228 /* SourceFile */ && ts.isExternalModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords - 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)); + error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } function checkVarDeclaredNamesNotShadowed(node) { @@ -18975,7 +19054,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 198 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 199 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -18985,17 +19064,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 199 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 180 /* VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 200 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 181 /* VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 179 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 206 /* ModuleBlock */ || - container.kind === 205 /* ModuleDeclaration */ || - container.kind === 227 /* SourceFile */); + (container.kind === 180 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 207 /* ModuleBlock */ || + container.kind === 206 /* ModuleDeclaration */ || + container.kind === 228 /* SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -19009,14 +19088,14 @@ var ts; } } function isParameterDeclaration(node) { - while (node.kind === 152 /* BindingElement */) { + while (node.kind === 153 /* BindingElement */) { node = node.parent.parent; } - return node.kind === 129 /* Parameter */; + return node.kind === 130 /* Parameter */; } // Check that a parameter initializer contains no references to parameters declared to the right of itself function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind !== 129 /* Parameter */) { + if (getRootDeclaration(node).kind !== 130 /* Parameter */) { return; } var func = ts.getContainingFunction(node); @@ -19027,7 +19106,7 @@ var ts; // check FunctionLikeDeclaration.locals (stores parameters\function local variable) // if it contains entry with a specified name and if this entry matches the resolved symbol if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455 /* Value */) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 129 /* Parameter */) { + if (referencedSymbol.valueDeclaration.kind === 130 /* Parameter */) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -19054,7 +19133,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 127 /* ComputedPropertyName */) { + if (node.name.kind === 128 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); @@ -19065,7 +19144,7 @@ var ts; ts.forEach(node.name.elements, checkSourceElement); } // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body - if (node.initializer && getRootDeclaration(node).kind === 129 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && getRootDeclaration(node).kind === 130 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -19097,10 +19176,10 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); } } - if (node.kind !== 132 /* PropertyDeclaration */ && node.kind !== 131 /* PropertySignature */) { + if (node.kind !== 133 /* PropertyDeclaration */ && node.kind !== 132 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 198 /* VariableDeclaration */ || node.kind === 152 /* BindingElement */) { + if (node.kind === 199 /* VariableDeclaration */ || node.kind === 153 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -19130,7 +19209,7 @@ var ts; } function inBlockOrObjectLiteralExpression(node) { while (node) { - if (node.kind === 179 /* Block */ || node.kind === 154 /* ObjectLiteralExpression */) { + if (node.kind === 180 /* Block */ || node.kind === 155 /* ObjectLiteralExpression */) { return true; } node = node.parent; @@ -19163,12 +19242,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind == 199 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind == 200 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 199 /* VariableDeclarationList */) { + if (node.initializer.kind === 200 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -19188,14 +19267,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 199 /* VariableDeclarationList */) { + if (node.initializer.kind === 200 /* VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); // There may be a destructuring assignment on the left side - if (varExpr.kind === 153 /* ArrayLiteralExpression */ || varExpr.kind === 154 /* ObjectLiteralExpression */) { + if (varExpr.kind === 154 /* ArrayLiteralExpression */ || varExpr.kind === 155 /* ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -19224,7 +19303,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 199 /* VariableDeclarationList */) { + if (node.initializer.kind === 200 /* VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -19238,7 +19317,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 153 /* ArrayLiteralExpression */ || varExpr.kind === 154 /* ObjectLiteralExpression */) { + if (varExpr.kind === 154 /* ArrayLiteralExpression */ || varExpr.kind === 155 /* ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!allConstituentTypesHaveKind(leftType, 1 /* Any */ | 258 /* StringLike */)) { @@ -19438,7 +19517,7 @@ var ts; // TODO: Check that target label is valid } function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 136 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 137 /* SetAccessor */))); + return !!(node.kind === 137 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 138 /* SetAccessor */))); } function checkReturnStatement(node) { // Grammar checking @@ -19453,11 +19532,11 @@ var ts; if (func) { var returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); var exprType = checkExpressionCached(node.expression); - if (func.kind === 137 /* SetAccessor */) { + if (func.kind === 138 /* SetAccessor */) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } else { - if (func.kind === 135 /* Constructor */) { + if (func.kind === 136 /* Constructor */) { if (!isTypeAssignableTo(exprType, returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -19487,7 +19566,7 @@ var ts; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 221 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 222 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -19499,7 +19578,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 220 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 221 /* CaseClause */) { var caseClause = clause; // TypeScript 1.0 spec (April 2014):5.9 // In a 'switch' statement, each 'case' expression must be of a type that is assignable to or from the type of the 'switch' expression. @@ -19520,7 +19599,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 194 /* LabeledStatement */ && current.label.text === node.label.text) { + if (current.kind === 195 /* LabeledStatement */ && 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; @@ -19590,7 +19669,7 @@ var ts; checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */); checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */); }); - if (type.flags & 1024 /* Class */ && type.symbol.valueDeclaration.kind === 201 /* ClassDeclaration */) { + if (type.flags & 1024 /* Class */ && type.symbol.valueDeclaration.kind === 202 /* ClassDeclaration */) { var classDeclaration = type.symbol.valueDeclaration; for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; @@ -19628,7 +19707,7 @@ var ts; // perform property check if property or indexer is declared in 'type' // this allows to rule out cases when both property and indexer are inherited from the base class var errorNode; - if (prop.valueDeclaration.name.kind === 127 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 128 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -19686,7 +19765,7 @@ var ts; function checkClassDeclaration(node) { checkGrammarDeclarationNameInStrictMode(node); // Grammar checking - if (node.parent.kind !== 206 /* ModuleBlock */ && node.parent.kind !== 227 /* SourceFile */) { + if (node.parent.kind !== 207 /* ModuleBlock */ && node.parent.kind !== 228 /* SourceFile */) { grammarErrorOnNode(node, ts.Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration); } if (!node.name && !(node.flags & 256 /* Default */)) { @@ -19706,11 +19785,11 @@ var ts; var staticType = getTypeOfSymbol(symbol); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - if (!ts.isSupportedHeritageClauseElement(baseTypeNode)) { + if (!ts.isSupportedExpressionWithTypeArguments(baseTypeNode)) { error(baseTypeNode.expression, ts.Diagnostics.Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses); } emitExtends = emitExtends || !ts.isInAmbientContext(node); - checkHeritageClauseElement(baseTypeNode); + checkExpressionWithTypeArguments(baseTypeNode); } var baseTypes = getBaseTypes(type); if (baseTypes.length) { @@ -19732,12 +19811,12 @@ var ts; var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { ts.forEach(implementedTypeNodes, function (typeRefNode) { - if (!ts.isSupportedHeritageClauseElement(typeRefNode)) { + if (!ts.isSupportedExpressionWithTypeArguments(typeRefNode)) { error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); } - checkHeritageClauseElement(typeRefNode); + checkExpressionWithTypeArguments(typeRefNode); if (produceDiagnostics) { - var t = getTypeFromHeritageClauseElement(typeRefNode); + var t = getTypeFromTypeNode(typeRefNode); if (t !== unknownType) { var declaredType = (t.flags & 4096 /* Reference */) ? t.target : t; if (declaredType.flags & (1024 /* Class */ | 2048 /* Interface */)) { @@ -19823,7 +19902,7 @@ var ts; } } function isAccessor(kind) { - return kind === 136 /* GetAccessor */ || kind === 137 /* SetAccessor */; + return kind === 137 /* GetAccessor */ || kind === 138 /* SetAccessor */; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -19893,7 +19972,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 202 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 203 /* InterfaceDeclaration */); 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); @@ -19912,10 +19991,10 @@ var ts; } } ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) { - if (!ts.isSupportedHeritageClauseElement(heritageElement)) { + if (!ts.isSupportedExpressionWithTypeArguments(heritageElement)) { error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); } - checkHeritageClauseElement(heritageElement); + checkExpressionWithTypeArguments(heritageElement); }); ts.forEach(node.members, checkSourceElement); if (produceDiagnostics) { @@ -19937,7 +20016,7 @@ var ts; var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); ts.forEach(node.members, function (member) { - if (member.name.kind !== 127 /* ComputedPropertyName */ && isNumericLiteralName(member.name.text)) { + if (member.name.kind !== 128 /* ComputedPropertyName */ && isNumericLiteralName(member.name.text)) { error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); } var initializer = member.initializer; @@ -19977,7 +20056,7 @@ var ts; return evalConstant(initializer); function evalConstant(e) { switch (e.kind) { - case 167 /* PrefixUnaryExpression */: + case 168 /* PrefixUnaryExpression */: var value = evalConstant(e.operand); if (value === undefined) { return undefined; @@ -19988,7 +20067,7 @@ var ts; case 47 /* TildeToken */: return ~value; } return undefined; - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -20013,11 +20092,11 @@ var ts; return undefined; case 7 /* NumericLiteral */: return +e.text; - case 161 /* ParenthesizedExpression */: + case 162 /* ParenthesizedExpression */: return evalConstant(e.expression); case 65 /* Identifier */: - case 156 /* ElementAccessExpression */: - case 155 /* PropertyAccessExpression */: + case 157 /* ElementAccessExpression */: + case 156 /* PropertyAccessExpression */: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType; @@ -20030,7 +20109,7 @@ var ts; } else { var expression; - if (e.kind === 156 /* ElementAccessExpression */) { + if (e.kind === 157 /* ElementAccessExpression */) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8 /* StringLiteral */) { return undefined; @@ -20048,7 +20127,7 @@ var ts; if (current.kind === 65 /* Identifier */) { break; } - else if (current.kind === 155 /* PropertyAccessExpression */) { + else if (current.kind === 156 /* PropertyAccessExpression */) { current = current.expression; } else { @@ -20117,7 +20196,7 @@ var ts; var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 204 /* EnumDeclaration */) { + if (declaration.kind !== 205 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -20140,8 +20219,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 201 /* ClassDeclaration */ || - (declaration.kind === 200 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 202 /* ClassDeclaration */ || + (declaration.kind === 201 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -20181,15 +20260,15 @@ var ts; var firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (firstNonAmbientClassOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(firstNonAmbientClassOrFunc)) { - error(node.name, ts.Diagnostics.A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged); + error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged); } else if (node.pos < firstNonAmbientClassOrFunc.pos) { - error(node.name, ts.Diagnostics.A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); + error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 201 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 202 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */; @@ -20198,10 +20277,10 @@ var ts; // Checks for ambient external modules. if (node.name.kind === 8 /* StringLiteral */) { if (!isGlobalSourceFile(node.parent)) { - error(node.name, ts.Diagnostics.Ambient_external_modules_cannot_be_nested_in_other_modules); + error(node.name, ts.Diagnostics.Ambient_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); + error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); } } } @@ -20209,10 +20288,10 @@ var ts; } function getFirstIdentifier(node) { while (true) { - if (node.kind === 126 /* QualifiedName */) { + if (node.kind === 127 /* QualifiedName */) { node = node.left; } - else if (node.kind === 155 /* PropertyAccessExpression */) { + else if (node.kind === 156 /* PropertyAccessExpression */) { node = node.expression; } else { @@ -20228,11 +20307,11 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 206 /* ModuleBlock */ && node.parent.parent.name.kind === 8 /* StringLiteral */; - if (node.parent.kind !== 227 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 215 /* ExportDeclaration */ ? - ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : - ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + var inAmbientExternalModule = node.parent.kind === 207 /* ModuleBlock */ && node.parent.parent.name.kind === 8 /* StringLiteral */; + if (node.parent.kind !== 228 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 216 /* ExportDeclaration */ ? + ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : + ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; } if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { @@ -20240,7 +20319,7 @@ var ts; // 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, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); + error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); return false; } return true; @@ -20253,7 +20332,7 @@ var ts; (symbol.flags & 793056 /* Type */ ? 793056 /* Type */ : 0) | (symbol.flags & 1536 /* Namespace */ ? 1536 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 217 /* ExportSpecifier */ ? + var message = node.kind === 218 /* ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -20276,7 +20355,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 211 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 212 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -20325,16 +20404,16 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 206 /* ModuleBlock */ && node.parent.parent.name.kind === 8 /* StringLiteral */; - if (node.parent.kind !== 227 /* SourceFile */ && !inAmbientExternalModule) { - error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module); + var inAmbientExternalModule = node.parent.kind === 207 /* ModuleBlock */ && node.parent.parent.name.kind === 8 /* StringLiteral */; + if (node.parent.kind !== 228 /* SourceFile */ && !inAmbientExternalModule) { + error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } else { // export * from "foo" var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); if (moduleSymbol && moduleSymbol.exports["export="]) { - error(node.moduleSpecifier, ts.Diagnostics.External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); + error(node.moduleSpecifier, ts.Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); } } } @@ -20346,9 +20425,9 @@ var ts; } } function checkExportAssignment(node) { - var container = node.parent.kind === 227 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 205 /* ModuleDeclaration */ && container.name.kind === 65 /* Identifier */) { - error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); + var container = node.parent.kind === 228 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 206 /* ModuleDeclaration */ && container.name.kind === 65 /* Identifier */) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } // Grammar checking @@ -20362,16 +20441,22 @@ var ts; checkExpressionCached(node.expression); } checkExternalModuleExports(container); - if (node.isExportEquals && languageVersion >= 2 /* ES6 */) { - // export assignment is deprecated in es6 or above - grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead); + if (node.isExportEquals && !ts.isInAmbientContext(node)) { + if (languageVersion >= 2 /* ES6 */) { + // export assignment is deprecated in es6 or above + grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead); + } + else if (compilerOptions.module === 4 /* System */) { + // system modules does not support export assignment + grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); + } } } function getModuleStatements(node) { - if (node.kind === 227 /* SourceFile */) { + if (node.kind === 228 /* SourceFile */) { return node.statements; } - if (node.kind === 205 /* ModuleDeclaration */ && node.body.kind === 206 /* ModuleBlock */) { + if (node.kind === 206 /* ModuleDeclaration */ && node.body.kind === 207 /* ModuleBlock */) { return node.body.statements; } return emptyArray; @@ -20400,107 +20485,107 @@ var ts; if (!node) return; switch (node.kind) { - case 128 /* TypeParameter */: + case 129 /* TypeParameter */: return checkTypeParameter(node); - case 129 /* Parameter */: + case 130 /* Parameter */: return checkParameter(node); - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: return checkPropertyDeclaration(node); - case 142 /* FunctionType */: - case 143 /* ConstructorType */: - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: return checkSignatureDeclaration(node); - case 140 /* IndexSignature */: + case 141 /* IndexSignature */: return checkSignatureDeclaration(node); - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: return checkMethodDeclaration(node); - case 135 /* Constructor */: + case 136 /* Constructor */: return checkConstructorDeclaration(node); - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: return checkAccessorDeclaration(node); - case 141 /* TypeReference */: + case 142 /* TypeReference */: return checkTypeReferenceNode(node); - case 144 /* TypeQuery */: + case 145 /* TypeQuery */: return checkTypeQuery(node); - case 145 /* TypeLiteral */: + case 146 /* TypeLiteral */: return checkTypeLiteral(node); - case 146 /* ArrayType */: + case 147 /* ArrayType */: return checkArrayType(node); - case 147 /* TupleType */: + case 148 /* TupleType */: return checkTupleType(node); - case 148 /* UnionType */: + case 149 /* UnionType */: return checkUnionType(node); - case 149 /* ParenthesizedType */: + case 150 /* ParenthesizedType */: return checkSourceElement(node.type); - case 200 /* FunctionDeclaration */: + case 201 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 179 /* Block */: - case 206 /* ModuleBlock */: + case 180 /* Block */: + case 207 /* ModuleBlock */: return checkBlock(node); - case 180 /* VariableStatement */: + case 181 /* VariableStatement */: return checkVariableStatement(node); - case 182 /* ExpressionStatement */: + case 183 /* ExpressionStatement */: return checkExpressionStatement(node); - case 183 /* IfStatement */: + case 184 /* IfStatement */: return checkIfStatement(node); - case 184 /* DoStatement */: + case 185 /* DoStatement */: return checkDoStatement(node); - case 185 /* WhileStatement */: + case 186 /* WhileStatement */: return checkWhileStatement(node); - case 186 /* ForStatement */: + case 187 /* ForStatement */: return checkForStatement(node); - case 187 /* ForInStatement */: + case 188 /* ForInStatement */: return checkForInStatement(node); - case 188 /* ForOfStatement */: + case 189 /* ForOfStatement */: return checkForOfStatement(node); - case 189 /* ContinueStatement */: - case 190 /* BreakStatement */: + case 190 /* ContinueStatement */: + case 191 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 191 /* ReturnStatement */: + case 192 /* ReturnStatement */: return checkReturnStatement(node); - case 192 /* WithStatement */: + case 193 /* WithStatement */: return checkWithStatement(node); - case 193 /* SwitchStatement */: + case 194 /* SwitchStatement */: return checkSwitchStatement(node); - case 194 /* LabeledStatement */: + case 195 /* LabeledStatement */: return checkLabeledStatement(node); - case 195 /* ThrowStatement */: + case 196 /* ThrowStatement */: return checkThrowStatement(node); - case 196 /* TryStatement */: + case 197 /* TryStatement */: return checkTryStatement(node); - case 198 /* VariableDeclaration */: + case 199 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 152 /* BindingElement */: + case 153 /* BindingElement */: return checkBindingElement(node); - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: return checkClassDeclaration(node); - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 203 /* TypeAliasDeclaration */: + case 204 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: return checkImportDeclaration(node); - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: return checkExportDeclaration(node); - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: return checkExportAssignment(node); - case 181 /* EmptyStatement */: + case 182 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 197 /* DebuggerStatement */: + case 198 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 218 /* MissingDeclaration */: + case 219 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -20515,81 +20600,81 @@ var ts; // Delaying the type check of the body ensures foo has been assigned a type. function checkFunctionExpressionBodies(node) { switch (node.kind) { - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: ts.forEach(node.parameters, checkFunctionExpressionBodies); checkFunctionExpressionOrObjectLiteralMethodBody(node); break; - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: ts.forEach(node.parameters, checkFunctionExpressionBodies); if (ts.isObjectLiteralMethod(node)) { checkFunctionExpressionOrObjectLiteralMethodBody(node); } break; - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 200 /* FunctionDeclaration */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 201 /* FunctionDeclaration */: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 192 /* WithStatement */: + case 193 /* WithStatement */: checkFunctionExpressionBodies(node.expression); break; - case 129 /* Parameter */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 150 /* ObjectBindingPattern */: - case 151 /* ArrayBindingPattern */: - case 152 /* BindingElement */: - case 153 /* ArrayLiteralExpression */: - case 154 /* ObjectLiteralExpression */: - case 224 /* PropertyAssignment */: - case 155 /* PropertyAccessExpression */: - case 156 /* ElementAccessExpression */: - case 157 /* CallExpression */: - case 158 /* NewExpression */: - case 159 /* TaggedTemplateExpression */: - case 171 /* TemplateExpression */: - case 176 /* TemplateSpan */: - case 160 /* TypeAssertionExpression */: - case 161 /* ParenthesizedExpression */: - case 165 /* TypeOfExpression */: - case 166 /* VoidExpression */: - case 164 /* DeleteExpression */: - case 167 /* PrefixUnaryExpression */: - case 168 /* PostfixUnaryExpression */: - case 169 /* BinaryExpression */: - case 170 /* ConditionalExpression */: - case 173 /* SpreadElementExpression */: - case 179 /* Block */: - case 206 /* ModuleBlock */: - case 180 /* VariableStatement */: - case 182 /* ExpressionStatement */: - case 183 /* IfStatement */: - case 184 /* DoStatement */: - case 185 /* WhileStatement */: - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 189 /* ContinueStatement */: - case 190 /* BreakStatement */: - case 191 /* ReturnStatement */: - case 193 /* SwitchStatement */: - case 207 /* CaseBlock */: - case 220 /* CaseClause */: - case 221 /* DefaultClause */: - case 194 /* LabeledStatement */: - case 195 /* ThrowStatement */: - case 196 /* TryStatement */: - case 223 /* CatchClause */: - case 198 /* VariableDeclaration */: - case 199 /* VariableDeclarationList */: - case 201 /* ClassDeclaration */: - case 204 /* EnumDeclaration */: - case 226 /* EnumMember */: - case 214 /* ExportAssignment */: - case 227 /* SourceFile */: + case 130 /* Parameter */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 151 /* ObjectBindingPattern */: + case 152 /* ArrayBindingPattern */: + case 153 /* BindingElement */: + case 154 /* ArrayLiteralExpression */: + case 155 /* ObjectLiteralExpression */: + case 225 /* PropertyAssignment */: + case 156 /* PropertyAccessExpression */: + case 157 /* ElementAccessExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: + case 160 /* TaggedTemplateExpression */: + case 172 /* TemplateExpression */: + case 178 /* TemplateSpan */: + case 161 /* TypeAssertionExpression */: + case 162 /* ParenthesizedExpression */: + case 166 /* TypeOfExpression */: + case 167 /* VoidExpression */: + case 165 /* DeleteExpression */: + case 168 /* PrefixUnaryExpression */: + case 169 /* PostfixUnaryExpression */: + case 170 /* BinaryExpression */: + case 171 /* ConditionalExpression */: + case 174 /* SpreadElementExpression */: + case 180 /* Block */: + case 207 /* ModuleBlock */: + case 181 /* VariableStatement */: + case 183 /* ExpressionStatement */: + case 184 /* IfStatement */: + case 185 /* DoStatement */: + case 186 /* WhileStatement */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 190 /* ContinueStatement */: + case 191 /* BreakStatement */: + case 192 /* ReturnStatement */: + case 194 /* SwitchStatement */: + case 208 /* CaseBlock */: + case 221 /* CaseClause */: + case 222 /* DefaultClause */: + case 195 /* LabeledStatement */: + case 196 /* ThrowStatement */: + case 197 /* TryStatement */: + case 224 /* CatchClause */: + case 199 /* VariableDeclaration */: + case 200 /* VariableDeclarationList */: + case 202 /* ClassDeclaration */: + case 205 /* EnumDeclaration */: + case 227 /* EnumMember */: + case 215 /* ExportAssignment */: + case 228 /* SourceFile */: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -20652,7 +20737,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 192 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 193 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -20675,23 +20760,23 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 227 /* SourceFile */: + case 228 /* SourceFile */: if (!ts.isExternalModule(location)) { break; } - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: if (!(memberFlags & 128 /* Static */)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056 /* Type */); } break; - case 162 /* FunctionExpression */: + case 163 /* FunctionExpression */: if (location.name) { copySymbol(location.symbol, meaning); } @@ -20729,22 +20814,22 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 227 /* SourceFile */: + case 228 /* SourceFile */: if (!ts.isExternalModule(location)) break; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: if (!(memberFlags & 128 /* Static */)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056 /* Type */); } break; - case 162 /* FunctionExpression */: + case 163 /* FunctionExpression */: if (location.name) { copySymbol(location.symbol, meaning); } @@ -20763,64 +20848,64 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 128 /* TypeParameter */: - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 203 /* TypeAliasDeclaration */: - case 204 /* EnumDeclaration */: + case 129 /* TypeParameter */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 204 /* TypeAliasDeclaration */: + case 205 /* EnumDeclaration */: return true; } } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 126 /* QualifiedName */) { + while (node.parent && node.parent.kind === 127 /* QualifiedName */) { node = node.parent; } - return node.parent && node.parent.kind === 141 /* TypeReference */; + return node.parent && node.parent.kind === 142 /* TypeReference */; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 155 /* PropertyAccessExpression */) { + while (node.parent && node.parent.kind === 156 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent && node.parent.kind === 177 /* HeritageClauseElement */; + return node.parent && node.parent.kind === 177 /* ExpressionWithTypeArguments */; } function isTypeNode(node) { - if (141 /* FirstTypeNode */ <= node.kind && node.kind <= 149 /* LastTypeNode */) { + if (142 /* FirstTypeNode */ <= node.kind && node.kind <= 150 /* LastTypeNode */) { return true; } switch (node.kind) { case 112 /* AnyKeyword */: - case 119 /* NumberKeyword */: - case 121 /* StringKeyword */: + case 120 /* NumberKeyword */: + case 122 /* StringKeyword */: case 113 /* BooleanKeyword */: - case 122 /* SymbolKeyword */: + case 123 /* SymbolKeyword */: return true; case 99 /* VoidKeyword */: - return node.parent.kind !== 166 /* VoidExpression */; + return node.parent.kind !== 167 /* VoidExpression */; case 8 /* StringLiteral */: // Specialized signatures can have string literals as their parameters' type names - return node.parent.kind === 129 /* Parameter */; - case 177 /* HeritageClauseElement */: + return node.parent.kind === 130 /* Parameter */; + case 177 /* ExpressionWithTypeArguments */: return true; // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container case 65 /* Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 126 /* QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 127 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 155 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 156 /* PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // fall through - case 126 /* QualifiedName */: - case 155 /* PropertyAccessExpression */: + case 127 /* QualifiedName */: + case 156 /* PropertyAccessExpression */: // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 65 /* Identifier */ || node.kind === 126 /* QualifiedName */ || node.kind === 155 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + ts.Debug.assert(node.kind === 65 /* Identifier */ || node.kind === 127 /* QualifiedName */ || node.kind === 156 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); var parent_5 = node.parent; - if (parent_5.kind === 144 /* TypeQuery */) { + if (parent_5.kind === 145 /* TypeQuery */) { return false; } // Do not recursively call isTypeNode on the parent. In the example: @@ -20829,38 +20914,38 @@ var ts; // // Calling isTypeNode would consider the qualified name A.B a type node. Only C or // A.B.C is a type node. - if (141 /* FirstTypeNode */ <= parent_5.kind && parent_5.kind <= 149 /* LastTypeNode */) { + if (142 /* FirstTypeNode */ <= parent_5.kind && parent_5.kind <= 150 /* LastTypeNode */) { return true; } switch (parent_5.kind) { - case 177 /* HeritageClauseElement */: + case 177 /* ExpressionWithTypeArguments */: return true; - case 128 /* TypeParameter */: + case 129 /* TypeParameter */: return node === parent_5.constraint; - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 129 /* Parameter */: - case 198 /* VariableDeclaration */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 130 /* Parameter */: + case 199 /* VariableDeclaration */: return node === parent_5.type; - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: - case 135 /* Constructor */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: + case 136 /* Constructor */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: return node === parent_5.type; - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: - case 140 /* IndexSignature */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: + case 141 /* IndexSignature */: return node === parent_5.type; - case 160 /* TypeAssertionExpression */: + case 161 /* TypeAssertionExpression */: return node === parent_5.type; - case 157 /* CallExpression */: - case 158 /* NewExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: return parent_5.typeArguments && ts.indexOf(parent_5.typeArguments, node) >= 0; - case 159 /* TaggedTemplateExpression */: + case 160 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -20868,13 +20953,13 @@ var ts; return false; } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 126 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 127 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 208 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 209 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 214 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 215 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -20886,11 +20971,11 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 214 /* ExportAssignment */) { + if (entityName.parent.kind === 215 /* ExportAssignment */) { return resolveEntityName(entityName, /*all meanings*/ 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */); } - if (entityName.kind !== 155 /* PropertyAccessExpression */) { + if (entityName.kind !== 156 /* PropertyAccessExpression */) { if (isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); @@ -20900,7 +20985,7 @@ var ts; entityName = entityName.parent; } if (isHeritageClauseElementIdentifier(entityName)) { - var meaning = entityName.parent.kind === 177 /* HeritageClauseElement */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = entityName.parent.kind === 177 /* ExpressionWithTypeArguments */ ? 793056 /* Type */ : 1536 /* Namespace */; meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } @@ -20915,14 +21000,14 @@ var ts; var meaning = 107455 /* Value */ | 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 155 /* PropertyAccessExpression */) { + else if (entityName.kind === 156 /* PropertyAccessExpression */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 126 /* QualifiedName */) { + else if (entityName.kind === 127 /* QualifiedName */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -20931,7 +21016,7 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 141 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = entityName.parent.kind === 142 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. meaning |= 8388608 /* Alias */; @@ -20950,14 +21035,14 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 65 /* Identifier */ && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 214 /* ExportAssignment */ + return node.parent.kind === 215 /* ExportAssignment */ ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } switch (node.kind) { case 65 /* Identifier */: - case 155 /* PropertyAccessExpression */: - case 126 /* QualifiedName */: + case 156 /* PropertyAccessExpression */: + case 127 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 93 /* ThisKeyword */: case 91 /* SuperKeyword */: @@ -20966,7 +21051,7 @@ var ts; case 114 /* ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 135 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 136 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -20975,14 +21060,14 @@ var ts; var moduleName; if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 209 /* ImportDeclaration */ || node.parent.kind === 215 /* ExportDeclaration */) && + ((node.parent.kind === 210 /* ImportDeclaration */ || node.parent.kind === 216 /* ExportDeclaration */) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } // Intentional fall-through case 7 /* NumericLiteral */: // index access - if (node.parent.kind == 156 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { + if (node.parent.kind == 157 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -20999,7 +21084,7 @@ var ts; // The function returns a value symbol of an identifier in the short-hand property assignment. // This is necessary as an identifier in short-hand property assignment can contains two meaning: // property name and property value. - if (location && location.kind === 225 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 226 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 107455 /* Value */); } return undefined; @@ -21079,7 +21164,7 @@ var ts; } // Emitter support function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 227 /* SourceFile */; + return symbol.flags & 512 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 228 /* SourceFile */; } function getAliasNameSubstitution(symbol, getGeneratedNameForNode) { // If this is es6 or higher, just use the name of the export @@ -21089,7 +21174,7 @@ var ts; } var node = getDeclarationOfAliasSymbol(symbol); if (node) { - if (node.kind === 210 /* ImportClause */) { + if (node.kind === 211 /* ImportClause */) { var defaultKeyword; if (languageVersion === 0 /* ES3 */) { defaultKeyword = "[\"default\"]"; @@ -21099,7 +21184,7 @@ var ts; } return getGeneratedNameForNode(node.parent) + defaultKeyword; } - if (node.kind === 213 /* ImportSpecifier */) { + if (node.kind === 214 /* ImportSpecifier */) { var moduleName = getGeneratedNameForNode(node.parent.parent.parent); var propertyName = node.propertyName || node.name; return moduleName + "." + ts.unescapeIdentifier(propertyName.text); @@ -21108,9 +21193,11 @@ var ts; } function getExportNameSubstitution(symbol, location, getGeneratedNameForNode) { if (isExternalModuleSymbol(symbol.parent)) { - // If this is es6 or higher, just use the name of the export + // 1. If this is es6 or higher, just use the name of the export // no need to qualify it. - if (languageVersion >= 2 /* ES6 */) { + // 2. export mechanism for System modules is different from CJS\AMD + // and it does not need qualifications for exports + if (languageVersion >= 2 /* ES6 */ || compilerOptions.module === 4 /* System */) { return undefined; } return "exports." + ts.unescapeIdentifier(symbol.name); @@ -21118,7 +21205,7 @@ var ts; var node = location; var containerSymbol = getParentOfSymbol(symbol); while (node) { - if ((node.kind === 205 /* ModuleDeclaration */ || node.kind === 204 /* EnumDeclaration */) && getSymbolOfNode(node) === containerSymbol) { + if ((node.kind === 206 /* ModuleDeclaration */ || node.kind === 205 /* EnumDeclaration */) && getSymbolOfNode(node) === containerSymbol) { return getGeneratedNameForNode(node) + "." + ts.unescapeIdentifier(symbol.name); } node = node.parent; @@ -21147,22 +21234,22 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 208 /* ImportEqualsDeclaration */: - case 210 /* ImportClause */: - case 211 /* NamespaceImport */: - case 213 /* ImportSpecifier */: - case 217 /* ExportSpecifier */: + case 209 /* ImportEqualsDeclaration */: + case 211 /* ImportClause */: + case 212 /* NamespaceImport */: + case 214 /* ImportSpecifier */: + case 218 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: return node.expression && node.expression.kind === 65 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 227 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 228 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -21220,7 +21307,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 226 /* EnumMember */) { + if (node.kind === 227 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -21265,7 +21352,7 @@ var ts; // * The serialized type of a TypeReference with a value declaration is its entity name. // * The serialized type of a TypeReference with a call or construct signature is "Function". // * The serialized type of any other type is "Object". - var type = getTypeFromTypeReference(node); + var type = getTypeFromTypeNode(node); if (type.flags & 16 /* Void */) { return "void 0"; } @@ -21313,26 +21400,26 @@ var ts; switch (node.kind) { case 99 /* VoidKeyword */: return "void 0"; - case 149 /* ParenthesizedType */: + case 150 /* ParenthesizedType */: return serializeTypeNode(node.type, getGeneratedNameForNode); - case 142 /* FunctionType */: - case 143 /* ConstructorType */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: return "Function"; - case 146 /* ArrayType */: - case 147 /* TupleType */: + case 147 /* ArrayType */: + case 148 /* TupleType */: return "Array"; case 113 /* BooleanKeyword */: return "Boolean"; - case 121 /* StringKeyword */: + case 122 /* StringKeyword */: case 8 /* StringLiteral */: return "String"; - case 119 /* NumberKeyword */: + case 120 /* NumberKeyword */: return "Number"; - case 141 /* TypeReference */: + case 142 /* TypeReference */: return serializeTypeReferenceNode(node, getGeneratedNameForNode); - case 144 /* TypeQuery */: - case 145 /* TypeLiteral */: - case 148 /* UnionType */: + case 145 /* TypeQuery */: + case 146 /* TypeLiteral */: + case 149 /* UnionType */: case 112 /* AnyKeyword */: break; default: @@ -21355,11 +21442,11 @@ var ts; // // For rules on serializing type annotations, see `serializeTypeNode`. switch (node.kind) { - case 201 /* ClassDeclaration */: return "Function"; - case 132 /* PropertyDeclaration */: return serializeTypeNode(node.type, getGeneratedNameForNode); - case 129 /* Parameter */: return serializeTypeNode(node.type, getGeneratedNameForNode); - case 136 /* GetAccessor */: return serializeTypeNode(node.type, getGeneratedNameForNode); - case 137 /* SetAccessor */: return serializeTypeNode(getSetAccessorTypeAnnotationNode(node), getGeneratedNameForNode); + case 202 /* ClassDeclaration */: return "Function"; + case 133 /* PropertyDeclaration */: return serializeTypeNode(node.type, getGeneratedNameForNode); + case 130 /* Parameter */: return serializeTypeNode(node.type, getGeneratedNameForNode); + case 137 /* GetAccessor */: return serializeTypeNode(node.type, getGeneratedNameForNode); + case 138 /* SetAccessor */: return serializeTypeNode(getSetAccessorTypeAnnotationNode(node), getGeneratedNameForNode); } if (ts.isFunctionLike(node)) { return "Function"; @@ -21376,7 +21463,7 @@ var ts; // For the rules on serializing the type of each parameter declaration, see `serializeTypeOfDeclaration`. if (node) { var valueDeclaration; - if (node.kind === 201 /* ClassDeclaration */) { + if (node.kind === 202 /* ClassDeclaration */) { valueDeclaration = ts.getFirstConstructorWithBody(node); } else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { @@ -21391,10 +21478,10 @@ var ts; for (var i = 0; i < parameterCount; i++) { if (parameters[i].dotDotDotToken) { var parameterType = parameters[i].type; - if (parameterType.kind === 146 /* ArrayType */) { + if (parameterType.kind === 147 /* ArrayType */) { parameterType = parameterType.elementType; } - else if (parameterType.kind === 141 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + else if (parameterType.kind === 142 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { parameterType = parameterType.typeArguments[0]; } else { @@ -21442,15 +21529,21 @@ var ts; ts.Debug.assert(!ts.nodeIsSynthesized(location), "resolvesToSomeValue called with a synthesized location"); return !!resolveName(location, name, 107455 /* Value */, undefined, undefined); } + function getReferencedValueDeclaration(reference) { + ts.Debug.assert(!ts.nodeIsSynthesized(reference)); + var symbol = getNodeLinks(reference).resolvedSymbol || + resolveName(reference, reference.text, 107455 /* Value */ | 8388608 /* Alias */, undefined, undefined); + return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration; + } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 152 /* BindingElement */ || (n.parent.kind === 198 /* VariableDeclaration */ && n.parent.name === n); + var isVariableDeclarationOrBindingElement = n.parent.kind === 153 /* BindingElement */ || (n.parent.kind === 199 /* VariableDeclaration */ && n.parent.name === n); var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 /* Value */ | 8388608 /* Alias */, undefined, undefined); var isLetOrConst = symbol && (symbol.flags & 2 /* BlockScopedVariable */) && - symbol.valueDeclaration.parent.kind !== 223 /* CatchClause */; + symbol.valueDeclaration.parent.kind !== 224 /* CatchClause */; if (isLetOrConst) { // side-effect of calling this method: // assign id to symbol if it was not yet set @@ -21489,6 +21582,7 @@ var ts; resolvesToSomeValue: resolvesToSomeValue, collectLinkedAliases: collectLinkedAliases, getBlockScopedVariableId: getBlockScopedVariableId, + getReferencedValueDeclaration: getReferencedValueDeclaration, serializeTypeOfNode: serializeTypeOfNode, serializeParameterTypesOfNode: serializeParameterTypesOfNode, serializeReturnTypeOfNode: serializeReturnTypeOfNode @@ -21545,12 +21639,12 @@ var ts; function isReservedWordInStrictMode(node) { // Check that originalKeywordKind is less than LastFutureReservedWord to see if an Identifier is a strict-mode reserved word return (node.parserContextFlags & 1 /* StrictMode */) && - (node.originalKeywordKind >= 102 /* FirstFutureReservedWord */ && node.originalKeywordKind <= 110 /* LastFutureReservedWord */); + (102 /* FirstFutureReservedWord */ <= node.originalKeywordKind && node.originalKeywordKind <= 110 /* LastFutureReservedWord */); } function reportStrictModeGrammarErrorInClassDeclaration(identifier, message, arg0, arg1, arg2) { // We are checking if this name is inside class declaration or class expression (which are under class definitions inside ES6 spec.) // if so, we would like to give more explicit invalid usage error. - if (ts.getAncestor(identifier, 201 /* ClassDeclaration */) || ts.getAncestor(identifier, 174 /* ClassExpression */)) { + if (ts.getAncestor(identifier, 202 /* ClassDeclaration */) || ts.getAncestor(identifier, 175 /* ClassExpression */)) { return grammarErrorOnNode(identifier, message, arg0); } return false; @@ -21561,19 +21655,19 @@ var ts; var impotClause = node.importClause; if (impotClause.namedBindings) { var nameBindings = impotClause.namedBindings; - if (nameBindings.kind === 211 /* NamespaceImport */) { + if (nameBindings.kind === 212 /* NamespaceImport */) { var name_11 = nameBindings.name; - if (name_11.originalKeywordKind) { + if (isReservedWordInStrictMode(name_11)) { var nameText = ts.declarationNameToString(name_11); return grammarErrorOnNode(name_11, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); } } - else if (nameBindings.kind === 212 /* NamedImports */) { + else if (nameBindings.kind === 213 /* NamedImports */) { var reportError = false; for (var _i = 0, _a = nameBindings.elements; _i < _a.length; _i++) { var element = _a[_i]; var name_12 = element.name; - if (name_12.originalKeywordKind) { + if (isReservedWordInStrictMode(name_12)) { var nameText = ts.declarationNameToString(name_12); reportError = reportError || grammarErrorOnNode(name_12, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); } @@ -21589,23 +21683,23 @@ var ts; if (name && name.kind === 65 /* Identifier */ && isReservedWordInStrictMode(name)) { var nameText = ts.declarationNameToString(name); switch (node.kind) { - case 129 /* Parameter */: - case 198 /* VariableDeclaration */: - case 200 /* FunctionDeclaration */: - case 128 /* TypeParameter */: - case 152 /* BindingElement */: - case 202 /* InterfaceDeclaration */: - case 203 /* TypeAliasDeclaration */: - case 204 /* EnumDeclaration */: + case 130 /* Parameter */: + case 199 /* VariableDeclaration */: + case 201 /* FunctionDeclaration */: + case 129 /* TypeParameter */: + case 153 /* BindingElement */: + case 203 /* InterfaceDeclaration */: + case 204 /* TypeAliasDeclaration */: + case 205 /* EnumDeclaration */: return checkGrammarIdentifierInStrictMode(name); - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: // Report an error if the class declaration uses strict-mode reserved word. return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode, nameText); - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: // Report an error if the module declaration uses strict-mode reserved word. // TODO(yuisu): fix this when having external module in strict mode return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: // TODO(yuisu): fix this when having external module in strict mode return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); } @@ -21621,7 +21715,7 @@ var ts; if (typeName.kind === 65 /* Identifier */) { checkGrammarTypeNameInStrictMode(typeName); } - else if (typeName.kind === 126 /* QualifiedName */) { + else if (typeName.kind === 127 /* QualifiedName */) { // Walk from right to left and report a possible error at each Identifier in QualifiedName // Example: // x1: public.private.package // error at public and private @@ -21635,18 +21729,18 @@ var ts; // public // error at public // public.private.package // error at public // B.private.B // no error - function checkGrammarHeritageClauseElementInStrictMode(expression) { + function checkGrammarExpressionWithTypeArgumentsInStrictMode(expression) { // Example: // class C extends public // error at public if (expression && expression.kind === 65 /* Identifier */) { return checkGrammarIdentifierInStrictMode(expression); } - else if (expression && expression.kind === 155 /* PropertyAccessExpression */) { + else if (expression && expression.kind === 156 /* PropertyAccessExpression */) { // Walk from left to right in PropertyAccessExpression until we are at the left most expression // in PropertyAccessExpression. According to grammar production of MemberExpression, // the left component expression is a PrimaryExpression (i.e. Identifier) while the other // component after dots can be IdentifierName. - checkGrammarHeritageClauseElementInStrictMode(expression.expression); + checkGrammarExpressionWithTypeArgumentsInStrictMode(expression.expression); } } // The function takes an identifier itself or an expression which has SyntaxKind.Identifier. @@ -21683,7 +21777,7 @@ var ts; else if (languageVersion < 1 /* ES5 */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher); } - else if (node.kind === 136 /* GetAccessor */ || node.kind === 137 /* SetAccessor */) { + else if (node.kind === 137 /* GetAccessor */ || node.kind === 138 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -21693,26 +21787,26 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 135 /* Constructor */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 140 /* IndexSignature */: - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 205 /* ModuleDeclaration */: - case 204 /* EnumDeclaration */: - case 180 /* VariableStatement */: - case 200 /* FunctionDeclaration */: - case 203 /* TypeAliasDeclaration */: - case 209 /* ImportDeclaration */: - case 208 /* ImportEqualsDeclaration */: - case 215 /* ExportDeclaration */: - case 214 /* ExportAssignment */: - case 129 /* Parameter */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 136 /* Constructor */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 141 /* IndexSignature */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 206 /* ModuleDeclaration */: + case 205 /* EnumDeclaration */: + case 181 /* VariableStatement */: + case 201 /* FunctionDeclaration */: + case 204 /* TypeAliasDeclaration */: + case 210 /* ImportDeclaration */: + case 209 /* ImportEqualsDeclaration */: + case 216 /* ExportDeclaration */: + case 215 /* ExportAssignment */: + case 130 /* Parameter */: break; default: return false; @@ -21746,7 +21840,7 @@ var ts; else if (flags & 128 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (node.parent.kind === 206 /* ModuleBlock */ || node.parent.kind === 227 /* SourceFile */) { + else if (node.parent.kind === 207 /* ModuleBlock */ || node.parent.kind === 228 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -21755,10 +21849,10 @@ var ts; if (flags & 128 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 206 /* ModuleBlock */ || node.parent.kind === 227 /* SourceFile */) { + else if (node.parent.kind === 207 /* ModuleBlock */ || node.parent.kind === 228 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } - else if (node.kind === 129 /* Parameter */) { + else if (node.kind === 130 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } flags |= 128 /* Static */; @@ -21771,10 +21865,10 @@ var ts; else if (flags & 2 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (node.parent.kind === 201 /* ClassDeclaration */) { + else if (node.parent.kind === 202 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 129 /* Parameter */) { + else if (node.kind === 130 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* Export */; @@ -21783,13 +21877,13 @@ var ts; if (flags & 2 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (node.parent.kind === 201 /* ClassDeclaration */) { + else if (node.parent.kind === 202 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 129 /* Parameter */) { + else if (node.kind === 130 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 206 /* ModuleBlock */) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 207 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; @@ -21797,7 +21891,7 @@ var ts; break; } } - if (node.kind === 135 /* Constructor */) { + if (node.kind === 136 /* Constructor */) { if (flags & 128 /* Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -21808,13 +21902,13 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if ((node.kind === 209 /* ImportDeclaration */ || node.kind === 208 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 210 /* ImportDeclaration */ || node.kind === 209 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 202 /* InterfaceDeclaration */ && flags & 2 /* Ambient */) { + else if (node.kind === 203 /* InterfaceDeclaration */ && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } - else if (node.kind === 129 /* Parameter */ && (flags & 112 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 130 /* Parameter */ && (flags & 112 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } } @@ -21878,7 +21972,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 163 /* ArrowFunction */) { + if (node.kind === 164 /* ArrowFunction */) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -21913,7 +22007,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 121 /* StringKeyword */ && parameter.type.kind !== 119 /* NumberKeyword */) { + if (parameter.type.kind !== 122 /* StringKeyword */ && parameter.type.kind !== 120 /* NumberKeyword */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -21946,7 +22040,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0; _i < arguments.length; _i++) { var arg = arguments[_i]; - if (arg.kind === 175 /* OmittedExpression */) { + if (arg.kind === 176 /* OmittedExpression */) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -22020,11 +22114,11 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 127 /* ComputedPropertyName */) { + if (node.kind !== 128 /* ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 169 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 23 /* CommaToken */) { + if (computedPropertyName.expression.kind === 170 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 23 /* CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } @@ -22052,8 +22146,8 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_13 = prop.name; - if (prop.kind === 175 /* OmittedExpression */ || - name_13.kind === 127 /* ComputedPropertyName */) { + if (prop.kind === 176 /* OmittedExpression */ || + name_13.kind === 128 /* ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name_13); continue; @@ -22067,7 +22161,7 @@ var ts; // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; - if (prop.kind === 224 /* PropertyAssignment */ || prop.kind === 225 /* ShorthandPropertyAssignment */) { + if (prop.kind === 225 /* PropertyAssignment */ || prop.kind === 226 /* ShorthandPropertyAssignment */) { // Grammar checking for computedPropertName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_13.kind === 7 /* NumericLiteral */) { @@ -22075,13 +22169,13 @@ var ts; } currentKind = Property; } - else if (prop.kind === 134 /* MethodDeclaration */) { + else if (prop.kind === 135 /* MethodDeclaration */) { currentKind = Property; } - else if (prop.kind === 136 /* GetAccessor */) { + else if (prop.kind === 137 /* GetAccessor */) { currentKind = GetAccessor; } - else if (prop.kind === 137 /* SetAccessor */) { + else if (prop.kind === 138 /* SetAccessor */) { currentKind = SetAccesor; } else { @@ -22115,24 +22209,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 199 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 200 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 187 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 188 /* ForInStatement */ ? 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 === 187 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 188 /* ForInStatement */ ? 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 === 187 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 188 /* ForInStatement */ ? 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); @@ -22155,10 +22249,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 136 /* GetAccessor */ && accessor.parameters.length) { + else if (kind === 137 /* GetAccessor */ && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 137 /* SetAccessor */) { + else if (kind === 138 /* SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -22183,7 +22277,7 @@ var ts; } } function checkGrammarForNonSymbolComputedProperty(node, message) { - if (node.kind === 127 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(node.expression)) { + if (node.kind === 128 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(node.expression)) { return grammarErrorOnNode(node, message); } } @@ -22193,7 +22287,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 154 /* ObjectLiteralExpression */) { + if (node.parent.kind === 155 /* ObjectLiteralExpression */) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -22201,7 +22295,7 @@ var ts; return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } - if (node.parent.kind === 201 /* ClassDeclaration */) { + if (node.parent.kind === 202 /* ClassDeclaration */) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -22217,22 +22311,22 @@ var ts; 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 === 202 /* InterfaceDeclaration */) { + else if (node.parent.kind === 203 /* InterfaceDeclaration */) { 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 === 145 /* TypeLiteral */) { + else if (node.parent.kind === 146 /* TypeLiteral */) { 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 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 184 /* DoStatement */: - case 185 /* WhileStatement */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 185 /* DoStatement */: + case 186 /* WhileStatement */: return true; - case 194 /* LabeledStatement */: + case 195 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -22244,11 +22338,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 194 /* LabeledStatement */: + case 195 /* LabeledStatement */: if (node.label && current.label.text === node.label.text) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 189 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 190 /* ContinueStatement */ && !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); @@ -22256,8 +22350,8 @@ var ts; return false; } break; - case 193 /* SwitchStatement */: - if (node.kind === 190 /* BreakStatement */ && !node.label) { + case 194 /* SwitchStatement */: + if (node.kind === 191 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -22272,13 +22366,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 190 /* BreakStatement */ + var message = node.kind === 191 /* BreakStatement */ ? 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 === 190 /* BreakStatement */ + var message = node.kind === 191 /* BreakStatement */ ? 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); @@ -22290,7 +22384,7 @@ var ts; if (node !== elements[elements.length - 1]) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 151 /* ArrayBindingPattern */ || node.name.kind === 150 /* ObjectBindingPattern */) { + if (node.name.kind === 152 /* ArrayBindingPattern */ || node.name.kind === 151 /* ObjectBindingPattern */) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -22303,7 +22397,7 @@ var ts; return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 187 /* ForInStatement */ && node.parent.parent.kind !== 188 /* ForOfStatement */) { + if (node.parent.parent.kind !== 188 /* ForInStatement */ && node.parent.parent.kind !== 189 /* ForOfStatement */) { if (ts.isInAmbientContext(node)) { if (node.initializer) { // Error on equals token which immediate precedes the initializer @@ -22340,7 +22434,7 @@ var ts; var elements = name.elements; for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; - if (element.kind !== 175 /* OmittedExpression */) { + if (element.kind !== 176 /* OmittedExpression */) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -22357,15 +22451,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 183 /* IfStatement */: - case 184 /* DoStatement */: - case 185 /* WhileStatement */: - case 192 /* WithStatement */: - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: + case 184 /* IfStatement */: + case 185 /* DoStatement */: + case 186 /* WhileStatement */: + case 193 /* WithStatement */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: return false; - case 194 /* LabeledStatement */: + case 195 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -22381,7 +22475,7 @@ var ts; } } function isIntegerLiteral(expression) { - if (expression.kind === 167 /* PrefixUnaryExpression */) { + if (expression.kind === 168 /* PrefixUnaryExpression */) { var unaryExpression = expression; if (unaryExpression.operator === 33 /* PlusToken */ || unaryExpression.operator === 34 /* MinusToken */) { expression = unaryExpression.operand; @@ -22410,7 +22504,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 127 /* ComputedPropertyName */) { + if (node.name.kind === 128 /* ComputedPropertyName */) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } else if (inAmbientContext) { @@ -22483,18 +22577,18 @@ var ts; } } function checkGrammarProperty(node) { - if (node.parent.kind === 201 /* ClassDeclaration */) { + if (node.parent.kind === 202 /* ClassDeclaration */) { 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 === 202 /* InterfaceDeclaration */) { + else if (node.parent.kind === 203 /* InterfaceDeclaration */) { 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 === 145 /* TypeLiteral */) { + else if (node.parent.kind === 146 /* TypeLiteral */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -22514,11 +22608,11 @@ var ts; // export_opt ExternalImportDeclaration // export_opt AmbientDeclaration // - if (node.kind === 202 /* InterfaceDeclaration */ || - node.kind === 209 /* ImportDeclaration */ || - node.kind === 208 /* ImportEqualsDeclaration */ || - node.kind === 215 /* ExportDeclaration */ || - node.kind === 214 /* ExportAssignment */ || + if (node.kind === 203 /* InterfaceDeclaration */ || + node.kind === 210 /* ImportDeclaration */ || + node.kind === 209 /* ImportEqualsDeclaration */ || + node.kind === 216 /* ExportDeclaration */ || + node.kind === 215 /* ExportAssignment */ || (node.flags & 2 /* Ambient */) || (node.flags & (1 /* Export */ | 256 /* Default */))) { return false; @@ -22528,7 +22622,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 180 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 181 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -22554,7 +22648,7 @@ var ts; // to prevent noisyness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 179 /* Block */ || node.parent.kind === 206 /* ModuleBlock */ || node.parent.kind === 227 /* SourceFile */) { + if (node.parent.kind === 180 /* Block */ || node.parent.kind === 207 /* ModuleBlock */ || node.parent.kind === 228 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -22644,7 +22738,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 209 /* ImportDeclaration */); + ts.Debug.assert(aliasEmitInfo.node.kind === 210 /* ImportDeclaration */); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -22720,10 +22814,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 198 /* VariableDeclaration */) { + if (declaration.kind === 199 /* VariableDeclaration */) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 212 /* NamedImports */ || declaration.kind === 213 /* ImportSpecifier */ || declaration.kind === 210 /* ImportClause */) { + else if (declaration.kind === 213 /* NamedImports */ || declaration.kind === 214 /* ImportSpecifier */ || declaration.kind === 211 /* ImportClause */) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -22741,7 +22835,7 @@ var ts; // 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 (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 209 /* ImportDeclaration */) { + if (moduleElementEmitInfo.node.kind === 210 /* ImportDeclaration */) { // we have to create asynchronous output only after we have collected complete information // because it is possible to enable multiple bindings as asynchronously visible moduleElementEmitInfo.isVisible = true; @@ -22751,12 +22845,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 205 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 206 /* ModuleDeclaration */) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 205 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 206 /* ModuleDeclaration */) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -22849,41 +22943,41 @@ var ts; function emitType(type) { switch (type.kind) { case 112 /* AnyKeyword */: - case 121 /* StringKeyword */: - case 119 /* NumberKeyword */: + case 122 /* StringKeyword */: + case 120 /* NumberKeyword */: case 113 /* BooleanKeyword */: - case 122 /* SymbolKeyword */: + case 123 /* SymbolKeyword */: case 99 /* VoidKeyword */: case 8 /* StringLiteral */: return writeTextOfNode(currentSourceFile, type); - case 177 /* HeritageClauseElement */: - return emitHeritageClauseElement(type); - case 141 /* TypeReference */: + case 177 /* ExpressionWithTypeArguments */: + return emitExpressionWithTypeArguments(type); + case 142 /* TypeReference */: return emitTypeReference(type); - case 144 /* TypeQuery */: + case 145 /* TypeQuery */: return emitTypeQuery(type); - case 146 /* ArrayType */: + case 147 /* ArrayType */: return emitArrayType(type); - case 147 /* TupleType */: + case 148 /* TupleType */: return emitTupleType(type); - case 148 /* UnionType */: + case 149 /* UnionType */: return emitUnionType(type); - case 149 /* ParenthesizedType */: + case 150 /* ParenthesizedType */: return emitParenType(type); - case 142 /* FunctionType */: - case 143 /* ConstructorType */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: return emitSignatureDeclarationWithJsDocComments(type); - case 145 /* TypeLiteral */: + case 146 /* TypeLiteral */: return emitTypeLiteral(type); case 65 /* Identifier */: return emitEntityName(type); - case 126 /* QualifiedName */: + case 127 /* QualifiedName */: return emitEntityName(type); } function emitEntityName(entityName) { var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration - entityName.parent.kind === 208 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); + entityName.parent.kind === 209 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -22891,17 +22985,17 @@ var ts; writeTextOfNode(currentSourceFile, entityName); } else { - var left = entityName.kind === 126 /* QualifiedName */ ? entityName.left : entityName.expression; - var right = entityName.kind === 126 /* QualifiedName */ ? entityName.right : entityName.name; + var left = entityName.kind === 127 /* QualifiedName */ ? entityName.left : entityName.expression; + var right = entityName.kind === 127 /* QualifiedName */ ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentSourceFile, right); } } } - function emitHeritageClauseElement(node) { - if (ts.isSupportedHeritageClauseElement(node)) { - ts.Debug.assert(node.expression.kind === 65 /* Identifier */ || node.expression.kind === 155 /* PropertyAccessExpression */); + function emitExpressionWithTypeArguments(node) { + if (ts.isSupportedExpressionWithTypeArguments(node)) { + ts.Debug.assert(node.expression.kind === 65 /* Identifier */ || node.expression.kind === 156 /* PropertyAccessExpression */); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -23013,10 +23107,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 208 /* ImportEqualsDeclaration */ || - (node.parent.kind === 227 /* SourceFile */ && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 209 /* ImportEqualsDeclaration */ || + (node.parent.kind === 228 /* SourceFile */ && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 227 /* SourceFile */) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 228 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -23026,7 +23120,7 @@ var ts; }); } else { - if (node.kind === 209 /* ImportDeclaration */) { + if (node.kind === 210 /* ImportDeclaration */) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -23044,23 +23138,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 200 /* FunctionDeclaration */: + case 201 /* FunctionDeclaration */: return writeFunctionDeclaration(node); - case 180 /* VariableStatement */: + case 181 /* VariableStatement */: return writeVariableStatement(node); - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: return writeInterfaceDeclaration(node); - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: return writeClassDeclaration(node); - case 203 /* TypeAliasDeclaration */: + case 204 /* TypeAliasDeclaration */: return writeTypeAliasDeclaration(node); - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: return writeEnumDeclaration(node); - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: return writeModuleDeclaration(node); - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: return writeImportEqualsDeclaration(node); - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -23076,7 +23170,7 @@ var ts; if (node.flags & 256 /* Default */) { write("default "); } - else if (node.kind !== 202 /* InterfaceDeclaration */) { + else if (node.kind !== 203 /* InterfaceDeclaration */) { write("declare "); } } @@ -23122,7 +23216,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 211 /* NamespaceImport */) { + if (namedBindings.kind === 212 /* NamespaceImport */) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -23150,7 +23244,7 @@ var ts; // If the default binding was emitted, write the separated write(", "); } - if (node.importClause.namedBindings.kind === 211 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 212 /* NamespaceImport */) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -23203,7 +23297,7 @@ var ts; emitModuleElementDeclarationFlags(node); write("module "); writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 206 /* ModuleBlock */) { + while (node.body.kind !== 207 /* ModuleBlock */) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -23264,7 +23358,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 134 /* MethodDeclaration */ && (node.parent.flags & 32 /* Private */); + return node.parent.kind === 135 /* MethodDeclaration */ && (node.parent.flags & 32 /* Private */); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -23275,15 +23369,15 @@ var ts; // If there is constraint present and this is not a type parameter of the private method emit the constraint if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 142 /* FunctionType */ || - node.parent.kind === 143 /* ConstructorType */ || - (node.parent.parent && node.parent.parent.kind === 145 /* TypeLiteral */)) { - ts.Debug.assert(node.parent.kind === 134 /* MethodDeclaration */ || - node.parent.kind === 133 /* MethodSignature */ || - node.parent.kind === 142 /* FunctionType */ || - node.parent.kind === 143 /* ConstructorType */ || - node.parent.kind === 138 /* CallSignature */ || - node.parent.kind === 139 /* ConstructSignature */); + if (node.parent.kind === 143 /* FunctionType */ || + node.parent.kind === 144 /* ConstructorType */ || + (node.parent.parent && node.parent.parent.kind === 146 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 135 /* MethodDeclaration */ || + node.parent.kind === 134 /* MethodSignature */ || + node.parent.kind === 143 /* FunctionType */ || + node.parent.kind === 144 /* ConstructorType */ || + node.parent.kind === 139 /* CallSignature */ || + node.parent.kind === 140 /* ConstructSignature */); emitType(node.constraint); } else { @@ -23294,31 +23388,31 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 139 /* ConstructSignature */: + case 140 /* ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 138 /* CallSignature */: + case 139 /* CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: if (node.parent.flags & 128 /* Static */) { 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 === 201 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 202 /* ClassDeclaration */) { 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 200 /* FunctionDeclaration */: + case 201 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -23343,13 +23437,13 @@ var ts; emitCommaList(typeReferences, emitTypeOfTypeReference); } function emitTypeOfTypeReference(node) { - if (ts.isSupportedHeritageClauseElement(node)) { + if (ts.isSupportedExpressionWithTypeArguments(node)) { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 201 /* ClassDeclaration */) { + if (node.parent.parent.kind === 202 /* ClassDeclaration */) { // Class or Interface implemented/extended is inaccessible diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : @@ -23430,7 +23524,7 @@ var ts; function emitVariableDeclaration(node) { // If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted // so there is no check needed to see if declaration is visible - if (node.kind !== 198 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 199 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -23440,10 +23534,10 @@ var ts; // what we want, namely the name expression enclosed in brackets. writeTextOfNode(currentSourceFile, node.name); // If optional property emit ? - if ((node.kind === 132 /* PropertyDeclaration */ || node.kind === 131 /* PropertySignature */) && ts.hasQuestionToken(node)) { + if ((node.kind === 133 /* PropertyDeclaration */ || node.kind === 132 /* PropertySignature */) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 132 /* PropertyDeclaration */ || node.kind === 131 /* PropertySignature */) && node.parent.kind === 145 /* TypeLiteral */) { + if ((node.kind === 133 /* PropertyDeclaration */ || node.kind === 132 /* PropertySignature */) && node.parent.kind === 146 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 32 /* Private */)) { @@ -23452,14 +23546,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 198 /* VariableDeclaration */) { + if (node.kind === 199 /* VariableDeclaration */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? 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 === 132 /* PropertyDeclaration */ || node.kind === 131 /* PropertySignature */) { + else if (node.kind === 133 /* PropertyDeclaration */ || node.kind === 132 /* PropertySignature */) { // TODO(jfreeman): Deal with computed properties in error reporting. if (node.flags & 128 /* Static */) { return symbolAccesibilityResult.errorModuleName ? @@ -23468,7 +23562,7 @@ var ts; 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 === 201 /* ClassDeclaration */) { + else if (node.parent.kind === 202 /* ClassDeclaration */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23500,7 +23594,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 175 /* OmittedExpression */) { + if (element.kind !== 176 /* OmittedExpression */) { elements.push(element); } } @@ -23570,7 +23664,7 @@ var ts; var type = getTypeAnnotationFromAccessor(node); if (!type) { // couldn't get type for the first accessor, try the another one - var anotherAccessor = node.kind === 136 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 137 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -23583,7 +23677,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 136 /* GetAccessor */ + return accessor.kind === 137 /* GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -23592,7 +23686,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 137 /* SetAccessor */) { + if (accessorWithTypeAnnotation.kind === 138 /* SetAccessor */) { // Setters have to have type named and cannot infer it so, the type should always be named if (accessorWithTypeAnnotation.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? @@ -23642,17 +23736,17 @@ var ts; // so no need to verify if the declaration is visible if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 200 /* FunctionDeclaration */) { + if (node.kind === 201 /* FunctionDeclaration */) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 134 /* MethodDeclaration */) { + else if (node.kind === 135 /* MethodDeclaration */) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 200 /* FunctionDeclaration */) { + if (node.kind === 201 /* FunctionDeclaration */) { write("function "); writeTextOfNode(currentSourceFile, node.name); } - else if (node.kind === 135 /* Constructor */) { + else if (node.kind === 136 /* Constructor */) { write("constructor"); } else { @@ -23670,11 +23764,11 @@ var ts; } function emitSignatureDeclaration(node) { // Construct signature or constructor type write new Signature - if (node.kind === 139 /* ConstructSignature */ || node.kind === 143 /* ConstructorType */) { + if (node.kind === 140 /* ConstructSignature */ || node.kind === 144 /* ConstructorType */) { write("new "); } emitTypeParameters(node.typeParameters); - if (node.kind === 140 /* IndexSignature */) { + if (node.kind === 141 /* IndexSignature */) { write("["); } else { @@ -23684,22 +23778,22 @@ var ts; enclosingDeclaration = node; // Parameters emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 140 /* IndexSignature */) { + if (node.kind === 141 /* IndexSignature */) { write("]"); } else { write(")"); } // If this is not a constructor and is not private, emit the return type - var isFunctionTypeOrConstructorType = node.kind === 142 /* FunctionType */ || node.kind === 143 /* ConstructorType */; - if (isFunctionTypeOrConstructorType || node.parent.kind === 145 /* TypeLiteral */) { + var isFunctionTypeOrConstructorType = node.kind === 143 /* FunctionType */ || node.kind === 144 /* ConstructorType */; + if (isFunctionTypeOrConstructorType || node.parent.kind === 146 /* TypeLiteral */) { // Emit type literal signature return type only if specified if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 135 /* Constructor */ && !(node.flags & 32 /* Private */)) { + else if (node.kind !== 136 /* Constructor */ && !(node.flags & 32 /* Private */)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -23710,26 +23804,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 139 /* ConstructSignature */: + case 140 /* ConstructSignature */: // Interfaces cannot have return types that cannot be named 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 138 /* CallSignature */: + case 139 /* CallSignature */: // Interfaces cannot have return types that cannot be named 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 140 /* IndexSignature */: + case 141 /* IndexSignature */: // Interfaces cannot have return types that cannot be named 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 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -23737,7 +23831,7 @@ var ts; 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 === 201 /* ClassDeclaration */) { + else if (node.parent.kind === 202 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -23751,7 +23845,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 200 /* FunctionDeclaration */: + case 201 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -23786,9 +23880,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 142 /* FunctionType */ || - node.parent.kind === 143 /* ConstructorType */ || - node.parent.parent.kind === 145 /* TypeLiteral */) { + if (node.parent.kind === 143 /* FunctionType */ || + node.parent.kind === 144 /* ConstructorType */ || + node.parent.parent.kind === 146 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32 /* Private */)) { @@ -23804,24 +23898,24 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { - case 135 /* Constructor */: + case 136 /* Constructor */: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? 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; - case 139 /* ConstructSignature */: + case 140 /* ConstructSignature */: // Interfaces cannot have parameter types that cannot be named return 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; - case 138 /* CallSignature */: + case 139 /* CallSignature */: // Interfaces cannot have parameter types that cannot be named return 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; - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: if (node.parent.flags & 128 /* Static */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -23829,7 +23923,7 @@ var ts; 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 === 201 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 202 /* ClassDeclaration */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23842,7 +23936,7 @@ var ts; 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; } - case 200 /* FunctionDeclaration */: + case 201 /* FunctionDeclaration */: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23854,12 +23948,12 @@ var ts; } function emitBindingPattern(bindingPattern) { // We have to explicitly emit square bracket and bracket because these tokens are not store inside the node. - if (bindingPattern.kind === 150 /* ObjectBindingPattern */) { + if (bindingPattern.kind === 151 /* ObjectBindingPattern */) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 151 /* ArrayBindingPattern */) { + else if (bindingPattern.kind === 152 /* ArrayBindingPattern */) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -23878,7 +23972,7 @@ var ts; typeName: bindingElement.name } : undefined; } - if (bindingElement.kind === 175 /* OmittedExpression */) { + if (bindingElement.kind === 176 /* OmittedExpression */) { // If bindingElement is an omittedExpression (i.e. containing elision), // we will emit blank space (although this may differ from users' original code, // it allows emitSeparatedList to write separator appropriately) @@ -23887,7 +23981,7 @@ var ts; // emit : function foo([ , x, , ]) {} write(" "); } - else if (bindingElement.kind === 152 /* BindingElement */) { + else if (bindingElement.kind === 153 /* BindingElement */) { if (bindingElement.propertyName) { // bindingElement has propertyName property in the following case: // { y: [a,b,c] ...} -> bindingPattern will have a property called propertyName for "y" @@ -23928,40 +24022,40 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 200 /* FunctionDeclaration */: - case 205 /* ModuleDeclaration */: - case 208 /* ImportEqualsDeclaration */: - case 202 /* InterfaceDeclaration */: - case 201 /* ClassDeclaration */: - case 203 /* TypeAliasDeclaration */: - case 204 /* EnumDeclaration */: + case 201 /* FunctionDeclaration */: + case 206 /* ModuleDeclaration */: + case 209 /* ImportEqualsDeclaration */: + case 203 /* InterfaceDeclaration */: + case 202 /* ClassDeclaration */: + case 204 /* TypeAliasDeclaration */: + case 205 /* EnumDeclaration */: return emitModuleElement(node, isModuleElementVisible(node)); - case 180 /* VariableStatement */: + case 181 /* VariableStatement */: return emitModuleElement(node, isVariableStatementVisible(node)); - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: // Import declaration without import clause is visible, otherwise it is not visible return emitModuleElement(node, !node.importClause); - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: return emitExportDeclaration(node); - case 135 /* Constructor */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 136 /* Constructor */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: return writeFunctionDeclaration(node); - case 139 /* ConstructSignature */: - case 138 /* CallSignature */: - case 140 /* IndexSignature */: + case 140 /* ConstructSignature */: + case 139 /* CallSignature */: + case 141 /* IndexSignature */: return emitSignatureDeclarationWithJsDocComments(node); - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: return emitAccessorDeclaration(node); - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: return emitPropertyDeclaration(node); - case 226 /* EnumMember */: + case 227 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: return emitExportAssignment(node); - case 227 /* SourceFile */: + case 228 /* SourceFile */: return emitSourceFile(node); } } @@ -24018,21 +24112,20 @@ var ts; TempFlags[TempFlags["Auto"] = 0] = "Auto"; TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask"; TempFlags[TempFlags["_i"] = 268435456] = "_i"; - TempFlags[TempFlags["_n"] = 536870912] = "_n"; })(TempFlags || (TempFlags = {})); // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature function emitFiles(resolver, host, targetSourceFile) { // emit output for the __extends helper function - var extendsHelper = "\nvar __extends = this.__extends || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n __.prototype = b.prototype;\n d.prototype = new __();\n};"; + var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n __.prototype = b.prototype;\n d.prototype = new __();\n};"; // emit output for the __decorate helper function - var decorateHelper = "\nif (typeof __decorate !== \"function\") __decorate = function (decorators, target, key, desc) {\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") return Reflect.decorate(decorators, target, key, desc);\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; + var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") return Reflect.decorate(decorators, target, key, desc);\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; // emit output for the __metadata helper function - var metadataHelper = "\nif (typeof __metadata !== \"function\") __metadata = function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; + var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; // emit output for the __param helper function - var paramHelper = "\nif (typeof __param !== \"function\") __param = function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; + var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0 /* ES3 */; - var sourceMapDataList = compilerOptions.sourceMap ? [] : undefined; + var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; var diagnostics = []; var newLine = host.getNewLine(); if (targetSourceFile === undefined) { @@ -24090,6 +24183,13 @@ var ts; var increaseIndent = writer.increaseIndent; var decreaseIndent = writer.decreaseIndent; var currentSourceFile; + // name of an exporter function if file is a System external module + // System.register([...], function () {...}) + // exporting in System modules looks like: + // export var x; ... x = 1 + // => + // var x;... exporter("x", x = 1) + var exportFunctionForFile; var generatedNameSet = {}; var nodeToGeneratedName = []; var blockScopedVariableToGeneratedName; @@ -24129,7 +24229,7 @@ var ts; var scopeEmitEnd = function () { }; /** Sourcemap data that will get encoded */ var sourceMapData; - if (compilerOptions.sourceMap) { + if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { initializeEmitterWithSourceMaps(); } if (root) { @@ -24148,6 +24248,7 @@ var ts; return; function emitSourceFile(sourceFile) { currentSourceFile = sourceFile; + exportFunctionForFile = undefined; emit(sourceFile); } function isUniqueName(name) { @@ -24234,25 +24335,25 @@ var ts; } function generateNameForNode(node) { switch (node.kind) { - case 200 /* FunctionDeclaration */: - case 201 /* ClassDeclaration */: - case 174 /* ClassExpression */: + case 201 /* FunctionDeclaration */: + case 202 /* ClassDeclaration */: + case 175 /* ClassExpression */: generateNameForFunctionOrClassDeclaration(node); break; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: generateNameForModuleOrEnum(node); generateNameForNode(node.body); break; - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: generateNameForModuleOrEnum(node); break; - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: generateNameForImportDeclaration(node); break; - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: generateNameForExportDeclaration(node); break; - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: generateNameForExportAssignment(node); break; } @@ -24408,6 +24509,12 @@ var ts; sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; // The one that can be used from program to get the actual source file sourceMapData.inputSourceFileNames.push(node.fileName); + if (compilerOptions.inlineSources) { + if (!sourceMapData.sourceMapSourcesContent) { + sourceMapData.sourceMapSourcesContent = []; + } + sourceMapData.sourceMapSourcesContent.push(node.text); + } } function recordScopeNameOfNode(node, scopeName) { function recordScopeNameIndex(scopeNameIndex) { @@ -24422,7 +24529,7 @@ var ts; // unless it is a computed property. Then it is shown with brackets, // but the brackets are included in the name. var name_17 = node.name; - if (!name_17 || name_17.kind !== 127 /* ComputedPropertyName */) { + if (!name_17 || name_17.kind !== 128 /* ComputedPropertyName */) { scopeName = "." + scopeName; } scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; @@ -24440,20 +24547,20 @@ var ts; // The scope was already given a name use it recordScopeNameStart(scopeName); } - else if (node.kind === 200 /* FunctionDeclaration */ || - node.kind === 162 /* FunctionExpression */ || - node.kind === 134 /* MethodDeclaration */ || - node.kind === 133 /* MethodSignature */ || - node.kind === 136 /* GetAccessor */ || - node.kind === 137 /* SetAccessor */ || - node.kind === 205 /* ModuleDeclaration */ || - node.kind === 201 /* ClassDeclaration */ || - node.kind === 204 /* EnumDeclaration */) { + else if (node.kind === 201 /* FunctionDeclaration */ || + node.kind === 163 /* FunctionExpression */ || + node.kind === 135 /* MethodDeclaration */ || + node.kind === 134 /* MethodSignature */ || + node.kind === 137 /* GetAccessor */ || + node.kind === 138 /* SetAccessor */ || + node.kind === 206 /* ModuleDeclaration */ || + node.kind === 202 /* ClassDeclaration */ || + node.kind === 205 /* EnumDeclaration */) { // Declaration and has associated name use it if (node.name) { var name_18 = node.name; // For computed property names, the text will include the brackets - scopeName = name_18.kind === 127 /* ComputedPropertyName */ + scopeName = name_18.kind === 128 /* ComputedPropertyName */ ? ts.getTextOfNode(name_18) : node.name.text; } @@ -24473,18 +24580,22 @@ var ts; ts.writeCommentRange(currentSourceFile, writer, comment, newLine); recordSourceMapSpan(comment.end); } - function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings) { + function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { if (typeof JSON !== "undefined") { - return JSON.stringify({ + var map_1 = { version: version, file: file, sourceRoot: sourceRoot, sources: sources, names: names, mappings: mappings - }); + }; + if (sourcesContent !== undefined) { + map_1.sourcesContent = sourcesContent; + } + return JSON.stringify(map_1); } - return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\"}"; + return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; function serializeStringArray(list) { var output = ""; for (var i = 0, n = list.length; i < n; i++) { @@ -24497,12 +24608,22 @@ var ts; } } function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { - // Write source map file encodeLastRecordedSourceMapSpan(); - ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings), false); + var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); sourceMapDataList.push(sourceMapData); + var sourceMapUrl; + if (compilerOptions.inlineSourceMap) { + // Encode the sourceMap into the sourceMap url + var base64SourceMapText = ts.convertToBase64(sourceMapText); + sourceMapUrl = "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText; + } + else { + // Write source map file + ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, false); + sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; + } // Write sourcemap url to the js file and write the js file - writeJavaScriptFile(emitOutput + "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL, writeByteOrderMark); + writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); } // Initialize source map data var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); @@ -24515,6 +24636,7 @@ var ts; inputSourceFileNames: [], sourceMapNames: [], sourceMapMappings: "", + sourceMapSourcesContent: undefined, sourceMapDecodedMappings: [] }; // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the @@ -24548,7 +24670,7 @@ var ts; if (ts.nodeIsSynthesized(node)) { return emitNodeWithoutSourceMap(node, false); } - if (node.kind != 227 /* SourceFile */) { + if (node.kind != 228 /* SourceFile */) { recordEmitNodeStartSpan(node); emitNodeWithoutSourceMap(node, allowGeneratedIdentifiers); recordEmitNodeEndSpan(node); @@ -24722,7 +24844,7 @@ var ts; } function emitLiteral(node) { var text = getLiteralText(node); - if (compilerOptions.sourceMap && (node.kind === 8 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { + if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 8 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } else if (languageVersion < 2 /* ES6 */ && isBinaryOrOctalIntegerLiteral(node, text)) { @@ -24811,10 +24933,10 @@ var ts; write("("); emit(tempVariable); // Now we emit the expressions - if (node.template.kind === 171 /* TemplateExpression */) { + if (node.template.kind === 172 /* TemplateExpression */) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 169 /* BinaryExpression */ + var needsParens = templateSpan.expression.kind === 170 /* BinaryExpression */ && templateSpan.expression.operatorToken.kind === 23 /* CommaToken */; emitParenthesizedIf(templateSpan.expression, needsParens); }); @@ -24849,7 +24971,7 @@ var ts; // ("abc" + 1) << (2 + "") // rather than // "abc" + (1 << 2) + "" - var needsParens = templateSpan.expression.kind !== 161 /* ParenthesizedExpression */ + var needsParens = templateSpan.expression.kind !== 162 /* ParenthesizedExpression */ && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; if (i > 0 || headEmitted) { // If this is the first span and the head was not emitted, then this templateSpan's @@ -24891,11 +25013,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 157 /* CallExpression */: - case 158 /* NewExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: return parent.expression === template; - case 159 /* TaggedTemplateExpression */: - case 161 /* ParenthesizedExpression */: + case 160 /* TaggedTemplateExpression */: + case 162 /* ParenthesizedExpression */: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1 /* LessThan */; @@ -24916,7 +25038,7 @@ var ts; // 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 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: switch (expression.operatorToken.kind) { case 35 /* AsteriskToken */: case 36 /* SlashToken */: @@ -24928,8 +25050,8 @@ var ts; default: return -1 /* LessThan */; } - case 172 /* YieldExpression */: - case 170 /* ConditionalExpression */: + case 173 /* YieldExpression */: + case 171 /* ConditionalExpression */: return -1 /* LessThan */; default: return 1 /* GreaterThan */; @@ -24944,11 +25066,11 @@ var ts; // 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) { - ts.Debug.assert(node.kind !== 152 /* BindingElement */); + ts.Debug.assert(node.kind !== 153 /* BindingElement */); if (node.kind === 8 /* StringLiteral */) { emitLiteral(node); } - else if (node.kind === 127 /* ComputedPropertyName */) { + else if (node.kind === 128 /* ComputedPropertyName */) { // if this is a decorated computed property, we will need to capture the result // of the property expression so that we can apply decorators later. This is to ensure // we don't introduce unintended side effects: @@ -24992,36 +25114,36 @@ var ts; function isNotExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 129 /* Parameter */: - case 198 /* VariableDeclaration */: - case 152 /* BindingElement */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 224 /* PropertyAssignment */: - case 225 /* ShorthandPropertyAssignment */: - case 226 /* EnumMember */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 200 /* FunctionDeclaration */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 162 /* FunctionExpression */: - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 204 /* EnumDeclaration */: - case 205 /* ModuleDeclaration */: - case 208 /* ImportEqualsDeclaration */: - case 210 /* ImportClause */: - case 211 /* NamespaceImport */: + case 130 /* Parameter */: + case 199 /* VariableDeclaration */: + case 153 /* BindingElement */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 225 /* PropertyAssignment */: + case 226 /* ShorthandPropertyAssignment */: + case 227 /* EnumMember */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 201 /* FunctionDeclaration */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 163 /* FunctionExpression */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 205 /* EnumDeclaration */: + case 206 /* ModuleDeclaration */: + case 209 /* ImportEqualsDeclaration */: + case 211 /* ImportClause */: + case 212 /* NamespaceImport */: return parent.name === node; - case 213 /* ImportSpecifier */: - case 217 /* ExportSpecifier */: + case 214 /* ImportSpecifier */: + case 218 /* ExportSpecifier */: return parent.name === node || parent.propertyName === node; - case 190 /* BreakStatement */: - case 189 /* ContinueStatement */: - case 214 /* ExportAssignment */: + case 191 /* BreakStatement */: + case 190 /* ContinueStatement */: + case 215 /* ExportAssignment */: return false; - case 194 /* LabeledStatement */: + case 195 /* LabeledStatement */: return node.parent.label === node; } } @@ -25129,11 +25251,11 @@ var ts; function needsParenthesisForPropertyAccessOrInvocation(node) { switch (node.kind) { case 65 /* Identifier */: - case 153 /* ArrayLiteralExpression */: - case 155 /* PropertyAccessExpression */: - case 156 /* ElementAccessExpression */: - case 157 /* CallExpression */: - case 161 /* ParenthesizedExpression */: + case 154 /* ArrayLiteralExpression */: + case 156 /* PropertyAccessExpression */: + case 157 /* ElementAccessExpression */: + case 158 /* CallExpression */: + case 162 /* ParenthesizedExpression */: // This list is not exhaustive and only includes those cases that are relevant // to the check in emitArrayLiteral. More cases can be added as needed. return false; @@ -25153,14 +25275,14 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 173 /* SpreadElementExpression */) { + if (e.kind === 174 /* SpreadElementExpression */) { e = e.expression; emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; } else { var i = pos; - while (i < length && elements[i].kind !== 173 /* SpreadElementExpression */) { + while (i < length && elements[i].kind !== 174 /* SpreadElementExpression */) { i++; } write("["); @@ -25181,7 +25303,7 @@ var ts; } } function isSpreadElementExpression(node) { - return node.kind === 173 /* SpreadElementExpression */; + return node.kind === 174 /* SpreadElementExpression */; } function emitArrayLiteral(node) { var elements = node.elements; @@ -25251,7 +25373,7 @@ var ts; writeComma(); var property = properties[i]; emitStart(property); - if (property.kind === 136 /* GetAccessor */ || property.kind === 137 /* SetAccessor */) { + if (property.kind === 137 /* GetAccessor */ || property.kind === 138 /* SetAccessor */) { // TODO (drosen): Reconcile with 'emitMemberFunctions'. var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property !== accessors.firstAccessor) { @@ -25303,13 +25425,13 @@ var ts; emitMemberAccessForPropertyName(property.name); emitEnd(property.name); write(" = "); - if (property.kind === 224 /* PropertyAssignment */) { + if (property.kind === 225 /* PropertyAssignment */) { emit(property.initializer); } - else if (property.kind === 225 /* ShorthandPropertyAssignment */) { + else if (property.kind === 226 /* ShorthandPropertyAssignment */) { emitExpressionIdentifier(property.name); } - else if (property.kind === 134 /* MethodDeclaration */) { + else if (property.kind === 135 /* MethodDeclaration */) { emitFunctionDeclaration(property); } else { @@ -25343,7 +25465,7 @@ var ts; // 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 === 127 /* ComputedPropertyName */) { + if (properties[i].name.kind === 128 /* ComputedPropertyName */) { numInitialNonComputedProperties = i; break; } @@ -25359,21 +25481,21 @@ var ts; emitObjectLiteralBody(node, properties.length); } function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(169 /* BinaryExpression */, startsOnNewLine); + var result = ts.createSynthesizedNode(170 /* BinaryExpression */, startsOnNewLine); result.operatorToken = ts.createSynthesizedNode(operator); result.left = left; result.right = right; return result; } function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(155 /* PropertyAccessExpression */); + var result = ts.createSynthesizedNode(156 /* PropertyAccessExpression */); result.expression = parenthesizeForAccess(expression); result.dotToken = ts.createSynthesizedNode(20 /* DotToken */); result.name = name; return result; } function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(156 /* ElementAccessExpression */); + var result = ts.createSynthesizedNode(157 /* ElementAccessExpression */); result.expression = parenthesizeForAccess(expression); result.argumentExpression = argumentExpression; return result; @@ -25387,10 +25509,10 @@ var ts; // NumberLiteral // 1.x -> not the same as (1).x // - if (ts.isLeftHandSideExpression(expr) && expr.kind !== 158 /* NewExpression */ && expr.kind !== 7 /* NumericLiteral */) { + if (ts.isLeftHandSideExpression(expr) && expr.kind !== 159 /* NewExpression */ && expr.kind !== 7 /* NumericLiteral */) { return expr; } - var node = ts.createSynthesizedNode(161 /* ParenthesizedExpression */); + var node = ts.createSynthesizedNode(162 /* ParenthesizedExpression */); node.expression = expr; return node; } @@ -25454,7 +25576,7 @@ var ts; if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 155 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 156 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; @@ -25506,10 +25628,10 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 173 /* SpreadElementExpression */; }); + return ts.forEach(elements, function (e) { return e.kind === 174 /* SpreadElementExpression */; }); } function skipParentheses(node) { - while (node.kind === 161 /* ParenthesizedExpression */ || node.kind === 160 /* TypeAssertionExpression */) { + while (node.kind === 162 /* ParenthesizedExpression */ || node.kind === 161 /* TypeAssertionExpression */) { node = node.expression; } return node; @@ -25530,13 +25652,13 @@ var ts; function emitCallWithSpread(node) { var target; var expr = skipParentheses(node.expression); - if (expr.kind === 155 /* PropertyAccessExpression */) { + if (expr.kind === 156 /* PropertyAccessExpression */) { // Target will be emitted as "this" argument target = emitCallTarget(expr.expression); write("."); emit(expr.name); } - else if (expr.kind === 156 /* ElementAccessExpression */) { + else if (expr.kind === 157 /* ElementAccessExpression */) { // Target will be emitted as "this" argument target = emitCallTarget(expr.expression); write("["); @@ -25581,7 +25703,7 @@ var ts; } else { emit(node.expression); - superCall = node.expression.kind === 155 /* PropertyAccessExpression */ && node.expression.expression.kind === 91 /* SuperKeyword */; + superCall = node.expression.kind === 156 /* PropertyAccessExpression */ && node.expression.expression.kind === 91 /* SuperKeyword */; } if (superCall && languageVersion < 2 /* ES6 */) { write(".call("); @@ -25618,12 +25740,12 @@ var ts; } } function emitParenExpression(node) { - if (!node.parent || node.parent.kind !== 163 /* ArrowFunction */) { - if (node.expression.kind === 160 /* TypeAssertionExpression */) { + if (!node.parent || node.parent.kind !== 164 /* ArrowFunction */) { + if (node.expression.kind === 161 /* TypeAssertionExpression */) { var operand = node.expression.expression; // Make sure we consider all nested cast expressions, e.g.: // (-A).x; - while (operand.kind == 160 /* TypeAssertionExpression */) { + while (operand.kind == 161 /* TypeAssertionExpression */) { operand = operand.expression; } // We have an expression of the form: (SubExpr) @@ -25634,14 +25756,14 @@ var ts; // (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() // (function foo() { })() should be emitted as an IIF (function foo(){})() and not declaration function foo(){} () - if (operand.kind !== 167 /* PrefixUnaryExpression */ && - operand.kind !== 166 /* VoidExpression */ && - operand.kind !== 165 /* TypeOfExpression */ && - operand.kind !== 164 /* DeleteExpression */ && - operand.kind !== 168 /* PostfixUnaryExpression */ && - operand.kind !== 158 /* NewExpression */ && - !(operand.kind === 157 /* CallExpression */ && node.parent.kind === 158 /* NewExpression */) && - !(operand.kind === 162 /* FunctionExpression */ && node.parent.kind === 157 /* CallExpression */)) { + if (operand.kind !== 168 /* PrefixUnaryExpression */ && + operand.kind !== 167 /* VoidExpression */ && + operand.kind !== 166 /* TypeOfExpression */ && + operand.kind !== 165 /* DeleteExpression */ && + operand.kind !== 169 /* PostfixUnaryExpression */ && + operand.kind !== 159 /* NewExpression */ && + !(operand.kind === 158 /* CallExpression */ && node.parent.kind === 159 /* NewExpression */) && + !(operand.kind === 163 /* FunctionExpression */ && node.parent.kind === 158 /* CallExpression */)) { emit(operand); return; } @@ -25666,7 +25788,27 @@ var ts; write(" "); emit(node.expression); } + function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { + if (!isCurrentFileSystemExternalModule() || node.kind !== 65 /* Identifier */ || ts.nodeIsSynthesized(node)) { + return false; + } + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 199 /* VariableDeclaration */ || node.parent.kind === 153 /* BindingElement */); + var targetDeclaration = isVariableDeclarationOrBindingElement + ? node.parent + : resolver.getReferencedValueDeclaration(node); + return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, true); + } function emitPrefixUnaryExpression(node) { + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + // emit + // ++x + // as + // exports('x', ++x) + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + } write(ts.tokenToString(node.operator)); // In some cases, we need to emit a space between the operator and the operand. One obvious case // is when the operator is an identifier, like delete or typeof. We also need to do this for plus @@ -25680,7 +25822,7 @@ var ts; // the resulting expression a prefix increment operation. And in the second, it will make the resulting // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. - if (node.operand.kind === 167 /* PrefixUnaryExpression */) { + if (node.operand.kind === 168 /* PrefixUnaryExpression */) { var operand = node.operand; if (node.operator === 33 /* PlusToken */ && (operand.operator === 33 /* PlusToken */ || operand.operator === 38 /* PlusPlusToken */)) { write(" "); @@ -25690,23 +25832,87 @@ var ts; } } emit(node.operand); + if (exportChanged) { + write(")"); + } } function emitPostfixUnaryExpression(node) { - emit(node.operand); - write(ts.tokenToString(node.operator)); + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + // export function returns the value that was passes as the second argument + // however for postfix unary expressions result value should be the value before modification. + // emit 'x++' as '(export('x', ++x) - 1)' and 'x--' as '(export('x', --x) + 1)' + write("(" + exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + write(ts.tokenToString(node.operator)); + emit(node.operand); + if (node.operator === 38 /* PlusPlusToken */) { + write(") - 1)"); + } + else { + write(") + 1)"); + } + } + else { + emit(node.operand); + write(ts.tokenToString(node.operator)); + } + } + function shouldHoistDeclarationInSystemJsModule(node) { + return isSourceFileLevelDeclarationInSystemJsModule(node, false); + } + /* + * Checks if given node is a source file level declaration (not nested in module/function). + * If 'isExported' is true - then declaration must also be exported. + * This function is used in two cases: + * - check if node is a exported source file level value to determine + * if we should also export the value after its it changed + * - check if node is a source level declaration to emit it differently, + * i.e non-exported variable statement 'var x = 1' is hoisted so + * we we emit variable statement 'var' should be dropped. + */ + function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) { + if (!node || languageVersion >= 2 /* ES6 */ || !isCurrentFileSystemExternalModule()) { + return false; + } + var current = node; + while (current) { + if (current.kind === 228 /* SourceFile */) { + return !isExported || ((ts.getCombinedNodeFlags(node) & 1 /* Export */) !== 0); + } + else if (ts.isFunctionLike(current) || current.kind === 207 /* ModuleBlock */) { + return false; + } + else { + current = current.parent; + } + } } function emitBinaryExpression(node) { if (languageVersion < 2 /* ES6 */ && node.operatorToken.kind === 53 /* EqualsToken */ && - (node.left.kind === 154 /* ObjectLiteralExpression */ || node.left.kind === 153 /* ArrayLiteralExpression */)) { - emitDestructuring(node, node.parent.kind === 182 /* ExpressionStatement */); + (node.left.kind === 155 /* ObjectLiteralExpression */ || node.left.kind === 154 /* ArrayLiteralExpression */)) { + emitDestructuring(node, node.parent.kind === 183 /* ExpressionStatement */); } else { + var exportChanged = node.operatorToken.kind >= 53 /* FirstAssignment */ && + node.operatorToken.kind <= 64 /* LastAssignment */ && + isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); + if (exportChanged) { + // emit assignment 'x y' as 'exports("x", x y)' + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.left); + write("\", "); + } emit(node.left); var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 23 /* CommaToken */ ? " " : undefined); write(ts.tokenToString(node.operatorToken.kind)); var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); emit(node.right); decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); + if (exportChanged) { + write(")"); + } } } function synthesizedNodeStartsOnNewLine(node) { @@ -25738,7 +25944,7 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 179 /* Block */) { + if (node && node.kind === 180 /* Block */) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } @@ -25753,12 +25959,12 @@ var ts; emitToken(14 /* OpenBraceToken */, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 206 /* ModuleBlock */) { - ts.Debug.assert(node.parent.kind === 205 /* ModuleDeclaration */); + if (node.kind === 207 /* ModuleBlock */) { + ts.Debug.assert(node.parent.kind === 206 /* ModuleDeclaration */); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 206 /* ModuleBlock */) { + if (node.kind === 207 /* ModuleBlock */) { emitTempDeclarations(true); } decreaseIndent(); @@ -25767,7 +25973,7 @@ var ts; scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 179 /* Block */) { + if (node.kind === 180 /* Block */) { write(" "); emit(node); } @@ -25779,7 +25985,7 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, node.expression.kind === 163 /* ArrowFunction */); + emitParenthesizedIf(node.expression, node.expression.kind === 164 /* ArrowFunction */); write(";"); } function emitIfStatement(node) { @@ -25792,7 +25998,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(76 /* ElseKeyword */, node.thenStatement.end); - if (node.elseStatement.kind === 183 /* IfStatement */) { + if (node.elseStatement.kind === 184 /* IfStatement */) { write(" "); emit(node.elseStatement); } @@ -25804,7 +26010,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 179 /* Block */) { + if (node.statement.kind === 180 /* Block */) { write(" "); } else { @@ -25820,7 +26026,15 @@ var ts; write(")"); emitEmbeddedStatement(node.statement); } - function emitStartOfVariableDeclarationList(decl, startPos) { + /* Returns true if start of variable declaration list was emitted. + * Return false if nothing was written - this can happen for source file level variable declarations + * in system modules - such variable declarations are hoisted. + */ + function tryEmitStartOfVariableDeclarationList(decl, startPos) { + if (shouldHoistVariable(decl, true)) { + // variables in variable declaration list were already hoisted + return false; + } var tokenKind = 98 /* VarKeyword */; if (decl && languageVersion >= 2 /* ES6 */) { if (ts.isLet(decl)) { @@ -25832,28 +26046,53 @@ var ts; } if (startPos !== undefined) { emitToken(tokenKind, startPos); + write(" "); } else { switch (tokenKind) { case 98 /* VarKeyword */: - return write("var "); + write("var "); + break; case 104 /* LetKeyword */: - return write("let "); + write("let "); + break; case 70 /* ConstKeyword */: - return write("const "); + write("const "); + break; } } + return true; + } + function emitVariableDeclarationListSkippingUninitializedEntries(list) { + var started = false; + for (var _a = 0, _b = list.declarations; _a < _b.length; _a++) { + var decl = _b[_a]; + if (!decl.initializer) { + continue; + } + if (!started) { + started = true; + } + else { + write(", "); + } + emit(decl); + } + return started; } function emitForStatement(node) { var endPos = emitToken(82 /* ForKeyword */, node.pos); write(" "); endPos = emitToken(16 /* OpenParenToken */, endPos); - if (node.initializer && node.initializer.kind === 199 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 200 /* VariableDeclarationList */) { var variableDeclarationList = node.initializer; - var declarations = variableDeclarationList.declarations; - emitStartOfVariableDeclarationList(declarations[0], endPos); - write(" "); - emitCommaList(declarations); + var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + if (startIsEmitted) { + emitCommaList(variableDeclarationList.declarations); + } + else { + emitVariableDeclarationListSkippingUninitializedEntries(variableDeclarationList); + } } else if (node.initializer) { emit(node.initializer); @@ -25866,25 +26105,23 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 /* ES6 */ && node.kind === 188 /* ForOfStatement */) { + if (languageVersion < 2 /* ES6 */ && node.kind === 189 /* ForOfStatement */) { return emitDownLevelForOfStatement(node); } var endPos = emitToken(82 /* ForKeyword */, node.pos); write(" "); endPos = emitToken(16 /* OpenParenToken */, endPos); - if (node.initializer.kind === 199 /* VariableDeclarationList */) { + if (node.initializer.kind === 200 /* VariableDeclarationList */) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { - var decl = variableDeclarationList.declarations[0]; - emitStartOfVariableDeclarationList(decl, endPos); - write(" "); - emit(decl); + tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + emit(variableDeclarationList.declarations[0]); } } else { emit(node.initializer); } - if (node.kind === 187 /* ForInStatement */) { + if (node.kind === 188 /* ForInStatement */) { write(" in "); } else { @@ -25969,7 +26206,7 @@ var ts; // let v = _a[_i]; var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 199 /* VariableDeclarationList */) { + if (node.initializer.kind === 200 /* VariableDeclarationList */) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -25999,7 +26236,7 @@ var ts; // Initializer is an expression. Emit the expression in the body, so that it's // evaluated on every iteration. var assignmentExpression = createBinaryExpression(node.initializer, 53 /* EqualsToken */, rhsIterationValue, false); - if (node.initializer.kind === 153 /* ArrayLiteralExpression */ || node.initializer.kind === 154 /* ObjectLiteralExpression */) { + if (node.initializer.kind === 154 /* ArrayLiteralExpression */ || node.initializer.kind === 155 /* ObjectLiteralExpression */) { // This is a destructuring pattern, so call emitDestructuring instead of emit. Calling emit will not work, because it will cause // the BinaryExpression to be passed in instead of the expression statement, which will cause emitDestructuring to crash. emitDestructuring(assignmentExpression, true, undefined); @@ -26010,7 +26247,7 @@ var ts; } emitEnd(node.initializer); write(";"); - if (node.statement.kind === 179 /* Block */) { + if (node.statement.kind === 180 /* Block */) { emitLines(node.statement.statements); } else { @@ -26022,7 +26259,7 @@ var ts; write("}"); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 190 /* BreakStatement */ ? 66 /* BreakKeyword */ : 71 /* ContinueKeyword */, node.pos); + emitToken(node.kind === 191 /* BreakStatement */ ? 66 /* BreakKeyword */ : 71 /* ContinueKeyword */, node.pos); emitOptional(" ", node.label); write(";"); } @@ -26067,7 +26304,7 @@ var ts; ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 220 /* CaseClause */) { + if (node.kind === 221 /* CaseClause */) { write("case "); emit(node.expression); write(":"); @@ -26122,7 +26359,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 205 /* ModuleDeclaration */); + } while (node && node.kind !== 206 /* ModuleDeclaration */); return node; } function emitContainingModuleName(node) { @@ -26137,7 +26374,7 @@ var ts; write(getGeneratedNameForNode(container)); write("."); } - else if (languageVersion < 2 /* ES6 */) { + else if (languageVersion < 2 /* ES6 */ && compilerOptions.module !== 4 /* System */) { write("exports."); } } @@ -26147,7 +26384,7 @@ var ts; function createVoidZero() { var zero = ts.createSynthesizedNode(7 /* NumericLiteral */); zero.text = "0"; - var result = ts.createSynthesizedNode(166 /* VoidExpression */); + var result = ts.createSynthesizedNode(167 /* VoidExpression */); result.expression = zero; return result; } @@ -26155,19 +26392,35 @@ var ts; if (node.flags & 1 /* Export */) { writeLine(); emitStart(node); - if (node.flags & 256 /* Default */) { - if (languageVersion === 0 /* ES3 */) { - write("exports[\"default\"]"); + if (compilerOptions.module === 4 /* System */) { + // emit export default as + // export("default", ) + write(exportFunctionForFile + "(\""); + if (node.flags & 256 /* Default */) { + write("default"); } else { - write("exports.default"); + emitNodeWithoutSourceMap(node.name); } + write("\", "); + emitDeclarationName(node); + write(")"); } else { - emitModuleMemberName(node); + if (node.flags & 256 /* Default */) { + if (languageVersion === 0 /* ES3 */) { + write("exports[\"default\"]"); + } + else { + write("exports.default"); + } + } + else { + emitModuleMemberName(node); + } + write(" = "); + emitDeclarationName(node); } - write(" = "); - emitDeclarationName(node); emitEnd(node); write(";"); } @@ -26177,13 +26430,24 @@ var ts; for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { var specifier = _b[_a]; writeLine(); - emitStart(specifier.name); - emitContainingModuleName(specifier); - write("."); - emitNodeWithoutSourceMap(specifier.name); - emitEnd(specifier.name); - write(" = "); - emitExpressionIdentifier(name); + if (compilerOptions.module === 4 /* System */) { + emitStart(specifier.name); + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(specifier.name); + write("\", "); + emitExpressionIdentifier(name); + write(")"); + emitEnd(specifier.name); + } + else { + emitStart(specifier.name); + emitContainingModuleName(specifier); + write("."); + emitNodeWithoutSourceMap(specifier.name); + emitEnd(specifier.name); + write(" = "); + emitExpressionIdentifier(name); + } write(";"); } } @@ -26192,8 +26456,18 @@ var ts; var emitCount = 0; // An exported declaration is actually emitted as an assignment (to a property on the module object), so // temporary variables in an exported declaration need to have real declarations elsewhere - var isDeclaration = (root.kind === 198 /* VariableDeclaration */ && !(ts.getCombinedNodeFlags(root) & 1 /* Export */)) || root.kind === 129 /* Parameter */; - if (root.kind === 169 /* BinaryExpression */) { + // Also temporary variables should be explicitly allocated for source level declarations when module target is system + // because actual variable declarations are hoisted + var canDefineTempVariablesInPlace = false; + if (root.kind === 199 /* VariableDeclaration */) { + var isExported = ts.getCombinedNodeFlags(root) & 1 /* Export */; + var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); + canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; + } + else if (root.kind === 130 /* Parameter */) { + canDefineTempVariablesInPlace = true; + } + if (root.kind === 170 /* BinaryExpression */) { emitAssignmentExpression(root); } else { @@ -26205,7 +26479,14 @@ var ts; write(", "); } renameNonTopLevelLetAndConst(name); - if (name.parent && (name.parent.kind === 198 /* VariableDeclaration */ || name.parent.kind === 152 /* BindingElement */)) { + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 199 /* VariableDeclaration */ || name.parent.kind === 153 /* BindingElement */); + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(name); + write("\", "); + } + if (isVariableDeclarationOrBindingElement) { emitModuleMemberName(name.parent); } else { @@ -26213,11 +26494,14 @@ var ts; } write(" = "); emit(value); + if (exportChanged) { + write(")"); + } } function ensureIdentifier(expr) { if (expr.kind !== 65 /* Identifier */) { var identifier = createTempVariable(0 /* Auto */); - if (!isDeclaration) { + if (!canDefineTempVariablesInPlace) { recordTempDeclaration(identifier); } emitAssignment(identifier, expr); @@ -26230,14 +26514,14 @@ var ts; // we need to generate a temporary variable value = ensureIdentifier(value); // Return the expression 'value === void 0 ? defaultValue : value' - var equals = ts.createSynthesizedNode(169 /* BinaryExpression */); + var equals = ts.createSynthesizedNode(170 /* BinaryExpression */); equals.left = value; equals.operatorToken = ts.createSynthesizedNode(30 /* EqualsEqualsEqualsToken */); equals.right = createVoidZero(); return createConditionalExpression(equals, defaultValue, value); } function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(170 /* ConditionalExpression */); + var cond = ts.createSynthesizedNode(171 /* ConditionalExpression */); cond.condition = condition; cond.questionToken = ts.createSynthesizedNode(50 /* QuestionToken */); cond.whenTrue = whenTrue; @@ -26257,7 +26541,7 @@ var ts; return createPropertyAccessExpression(object, propName); } function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(157 /* CallExpression */); + var call = ts.createSynthesizedNode(158 /* CallExpression */); var sliceIdentifier = ts.createSynthesizedNode(65 /* Identifier */); sliceIdentifier.text = "slice"; call.expression = createPropertyAccessExpression(value, sliceIdentifier); @@ -26274,7 +26558,7 @@ var ts; } for (var _a = 0; _a < properties.length; _a++) { var p = properties[_a]; - if (p.kind === 224 /* PropertyAssignment */ || p.kind === 225 /* ShorthandPropertyAssignment */) { + if (p.kind === 225 /* PropertyAssignment */ || p.kind === 226 /* ShorthandPropertyAssignment */) { // TODO(andersh): Computed property support var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccessForDestructuringProperty(value, propName)); @@ -26290,8 +26574,8 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 175 /* OmittedExpression */) { - if (e.kind !== 173 /* SpreadElementExpression */) { + if (e.kind !== 176 /* OmittedExpression */) { + if (e.kind !== 174 /* SpreadElementExpression */) { emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); } else if (i === elements.length - 1) { @@ -26301,14 +26585,14 @@ var ts; } } function emitDestructuringAssignment(target, value) { - if (target.kind === 169 /* BinaryExpression */ && target.operatorToken.kind === 53 /* EqualsToken */) { + if (target.kind === 170 /* BinaryExpression */ && target.operatorToken.kind === 53 /* EqualsToken */) { value = createDefaultValueCheck(value, target.right); target = target.left; } - if (target.kind === 154 /* ObjectLiteralExpression */) { + if (target.kind === 155 /* ObjectLiteralExpression */) { emitObjectLiteralAssignment(target, value); } - else if (target.kind === 153 /* ArrayLiteralExpression */) { + else if (target.kind === 154 /* ArrayLiteralExpression */) { emitArrayLiteralAssignment(target, value); } else { @@ -26322,14 +26606,14 @@ var ts; emitDestructuringAssignment(target, value); } else { - if (root.parent.kind !== 161 /* ParenthesizedExpression */) { + if (root.parent.kind !== 162 /* ParenthesizedExpression */) { write("("); } value = ensureIdentifier(value); emitDestructuringAssignment(target, value); write(", "); emit(value); - if (root.parent.kind !== 161 /* ParenthesizedExpression */) { + if (root.parent.kind !== 162 /* ParenthesizedExpression */) { write(")"); } } @@ -26353,12 +26637,12 @@ var ts; } for (var i = 0; i < elements.length; i++) { var element = elements[i]; - if (pattern.kind === 150 /* ObjectBindingPattern */) { + if (pattern.kind === 151 /* ObjectBindingPattern */) { // Rewrite element to a declaration with an initializer that fetches property var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); } - else if (element.kind !== 175 /* OmittedExpression */) { + else if (element.kind !== 176 /* OmittedExpression */) { if (!element.dotDotDotToken) { // Rewrite element to a declaration that accesses array element at index i emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); @@ -26386,7 +26670,6 @@ var ts; } else { renameNonTopLevelLetAndConst(node.name); - emitModuleMemberName(node); var initializer = node.initializer; if (!initializer && languageVersion < 2 /* ES6 */) { // downlevel emit for non-initialized let bindings defined in loops @@ -26399,16 +26682,26 @@ var ts; (getCombinedFlagsForIdentifier(node.name) & 4096 /* Let */); // NOTE: default initialization should not be added to let bindings in for-in\for-of statements if (isUninitializedLet && - node.parent.parent.kind !== 187 /* ForInStatement */ && - node.parent.parent.kind !== 188 /* ForOfStatement */) { + node.parent.parent.kind !== 188 /* ForInStatement */ && + node.parent.parent.kind !== 189 /* ForOfStatement */) { initializer = createVoidZero(); } } + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.name); + write("\", "); + } + emitModuleMemberName(node); emitOptional(" = ", initializer); + if (exportChanged) { + write(")"); + } } } function emitExportVariableAssignments(node) { - if (node.kind === 175 /* OmittedExpression */) { + if (node.kind === 176 /* OmittedExpression */) { return; } var name = node.name; @@ -26420,7 +26713,7 @@ var ts; } } function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 198 /* VariableDeclaration */ && node.parent.kind !== 152 /* BindingElement */)) { + if (!node.parent || (node.parent.kind !== 199 /* VariableDeclaration */ && node.parent.kind !== 153 /* BindingElement */)) { return 0; } return ts.getCombinedNodeFlags(node.parent); @@ -26435,7 +26728,7 @@ var ts; if (languageVersion >= 2 /* ES6 */ || ts.nodeIsSynthesized(node) || node.kind !== 65 /* Identifier */ || - (node.parent.kind !== 198 /* VariableDeclaration */ && node.parent.kind !== 152 /* BindingElement */)) { + (node.parent.kind !== 199 /* VariableDeclaration */ && node.parent.kind !== 153 /* BindingElement */)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); @@ -26444,17 +26737,17 @@ var ts; return; } // here it is known that node is a block scoped variable - var list = ts.getAncestor(node, 199 /* VariableDeclarationList */); - if (list.parent.kind === 180 /* VariableStatement */) { - var isSourceFileLevelBinding = list.parent.parent.kind === 227 /* SourceFile */; - var isModuleLevelBinding = list.parent.parent.kind === 206 /* ModuleBlock */; - var isFunctionLevelBinding = list.parent.parent.kind === 179 /* Block */ && ts.isFunctionLike(list.parent.parent.parent); + var list = ts.getAncestor(node, 200 /* VariableDeclarationList */); + if (list.parent.kind === 181 /* VariableStatement */) { + var isSourceFileLevelBinding = list.parent.parent.kind === 228 /* SourceFile */; + var isModuleLevelBinding = list.parent.parent.kind === 207 /* ModuleBlock */; + var isFunctionLevelBinding = list.parent.parent.kind === 180 /* Block */ && ts.isFunctionLike(list.parent.parent.parent); if (isSourceFileLevelBinding || isModuleLevelBinding || isFunctionLevelBinding) { return; } } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === 227 /* SourceFile */ + var parent = blockScopeContainer.kind === 228 /* SourceFile */ ? blockScopeContainer : blockScopeContainer.parent; if (resolver.resolvesToSomeValue(parent, node.text)) { @@ -26469,19 +26762,28 @@ var ts; function isES6ExportedDeclaration(node) { return !!(node.flags & 1 /* Export */) && languageVersion >= 2 /* ES6 */ && - node.parent.kind === 227 /* SourceFile */; + node.parent.kind === 228 /* SourceFile */; } function emitVariableStatement(node) { + var startIsEmitted = true; if (!(node.flags & 1 /* Export */)) { - emitStartOfVariableDeclarationList(node.declarationList); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); } else if (isES6ExportedDeclaration(node)) { // Exported ES6 module member write("export "); - emitStartOfVariableDeclarationList(node.declarationList); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } + if (startIsEmitted) { + emitCommaList(node.declarationList.declarations); + write(";"); + } + else { + var atLeastOneItem = emitVariableDeclarationListSkippingUninitializedEntries(node.declarationList); + if (atLeastOneItem) { + write(";"); + } } - emitCommaList(node.declarationList.declarations); - write(";"); if (languageVersion < 2 /* ES6 */ && node.parent === currentSourceFile) { ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); } @@ -26585,12 +26887,12 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 136 /* GetAccessor */ ? "get " : "set "); + write(node.kind === 137 /* GetAccessor */ ? "get " : "set "); emit(node.name, false); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 163 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; + return node.kind === 164 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; } function emitDeclarationName(node) { if (node.name) { @@ -26601,11 +26903,11 @@ var ts; } } function shouldEmitFunctionName(node) { - if (node.kind === 162 /* FunctionExpression */) { + if (node.kind === 163 /* FunctionExpression */) { // Emit name if one is present return !!node.name; } - if (node.kind === 200 /* FunctionDeclaration */) { + if (node.kind === 201 /* FunctionDeclaration */) { // Emit name if one is present, or emit generated name in down-level case (for export default case) return !!node.name || languageVersion < 2 /* ES6 */; } @@ -26614,7 +26916,7 @@ var ts; if (ts.nodeIsMissing(node.body)) { return emitOnlyPinnedOrTripleSlashComments(node); } - if (node.kind !== 134 /* MethodDeclaration */ && node.kind !== 133 /* MethodSignature */) { + if (node.kind !== 135 /* MethodDeclaration */ && node.kind !== 134 /* MethodSignature */) { // Methods will emit the comments as part of emitting method declaration emitLeadingComments(node); } @@ -26637,10 +26939,10 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (languageVersion < 2 /* ES6 */ && node.kind === 200 /* FunctionDeclaration */ && node.parent === currentSourceFile && node.name) { + if (languageVersion < 2 /* ES6 */ && node.kind === 201 /* FunctionDeclaration */ && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } - if (node.kind !== 134 /* MethodDeclaration */ && node.kind !== 133 /* MethodSignature */) { + if (node.kind !== 135 /* MethodDeclaration */ && node.kind !== 134 /* MethodSignature */) { emitTrailingComments(node); } } @@ -26691,7 +26993,7 @@ var ts; // in that case. write(" { }"); } - else if (node.body.kind === 179 /* Block */) { + else if (node.body.kind === 180 /* Block */) { emitBlockFunctionBody(node, node.body); } else { @@ -26722,10 +27024,10 @@ var ts; write(" "); // Unwrap all type assertions. var current = body; - while (current.kind === 160 /* TypeAssertionExpression */) { + while (current.kind === 161 /* TypeAssertionExpression */) { current = current.expression; } - emitParenthesizedIf(body, current.kind === 154 /* ObjectLiteralExpression */); + emitParenthesizedIf(body, current.kind === 155 /* ObjectLiteralExpression */); } function emitDownLevelExpressionFunctionBody(node, body) { write(" {"); @@ -26801,9 +27103,9 @@ var ts; function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 182 /* ExpressionStatement */) { + if (statement && statement.kind === 183 /* ExpressionStatement */) { var expr = statement.expression; - if (expr && expr.kind === 157 /* CallExpression */) { + if (expr && expr.kind === 158 /* CallExpression */) { var func = expr.expression; if (func && func.kind === 91 /* SuperKeyword */) { return statement; @@ -26835,7 +27137,7 @@ var ts; emitNodeWithoutSourceMap(memberName); write("]"); } - else if (memberName.kind === 127 /* ComputedPropertyName */) { + else if (memberName.kind === 128 /* ComputedPropertyName */) { emitComputedPropertyName(memberName); } else { @@ -26847,7 +27149,7 @@ var ts; var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 132 /* PropertyDeclaration */ && static === ((member.flags & 128 /* Static */) !== 0) && member.initializer) { + if (member.kind === 133 /* PropertyDeclaration */ && static === ((member.flags & 128 /* Static */) !== 0) && member.initializer) { properties.push(member); } } @@ -26887,11 +27189,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 178 /* SemicolonClassElement */) { + if (member.kind === 179 /* SemicolonClassElement */) { writeLine(); write(";"); } - else if (member.kind === 134 /* MethodDeclaration */ || node.kind === 133 /* MethodSignature */) { + else if (member.kind === 135 /* MethodDeclaration */ || node.kind === 134 /* MethodSignature */) { if (!member.body) { return emitOnlyPinnedOrTripleSlashComments(member); } @@ -26910,7 +27212,7 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 136 /* GetAccessor */ || member.kind === 137 /* SetAccessor */) { + else if (member.kind === 137 /* GetAccessor */ || member.kind === 138 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); @@ -26960,22 +27262,22 @@ var ts; function emitMemberFunctionsForES6AndHigher(node) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.kind === 134 /* MethodDeclaration */ || node.kind === 133 /* MethodSignature */) && !member.body) { + if ((member.kind === 135 /* MethodDeclaration */ || node.kind === 134 /* MethodSignature */) && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - else if (member.kind === 134 /* MethodDeclaration */ || - member.kind === 136 /* GetAccessor */ || - member.kind === 137 /* SetAccessor */) { + else if (member.kind === 135 /* MethodDeclaration */ || + member.kind === 137 /* GetAccessor */ || + member.kind === 138 /* SetAccessor */) { writeLine(); emitLeadingComments(member); emitStart(member); if (member.flags & 128 /* Static */) { write("static "); } - if (member.kind === 136 /* GetAccessor */) { + if (member.kind === 137 /* GetAccessor */) { write("get "); } - else if (member.kind === 137 /* SetAccessor */) { + else if (member.kind === 138 /* SetAccessor */) { write("set "); } if (member.asteriskToken) { @@ -26986,7 +27288,7 @@ var ts; emitEnd(member); emitTrailingComments(member); } - else if (member.kind === 178 /* SemicolonClassElement */) { + else if (member.kind === 179 /* SemicolonClassElement */) { writeLine(); write(";"); } @@ -27011,11 +27313,11 @@ var ts; var hasInstancePropertyWithInitializer = false; // Emit the constructor overload pinned comments ts.forEach(node.members, function (member) { - if (member.kind === 135 /* Constructor */ && !member.body) { + if (member.kind === 136 /* Constructor */ && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } // Check if there is any non-static property assignment - if (member.kind === 132 /* PropertyDeclaration */ && member.initializer && (member.flags & 128 /* Static */) === 0) { + if (member.kind === 133 /* PropertyDeclaration */ && member.initializer && (member.flags & 128 /* Static */) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -27123,7 +27425,7 @@ var ts; } function emitClassLikeDeclarationForES6AndHigher(node) { var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 201 /* ClassDeclaration */) { + if (node.kind === 202 /* ClassDeclaration */) { if (thisNodeIsDecorated) { // To preserve the correct runtime semantics when decorators are applied to the class, // the emit needs to follow one of the following rules: @@ -27203,7 +27505,7 @@ var ts; // This keeps the expression as an expression, while ensuring that the static parts // of it have been initialized by the time it is used. var staticProperties = getInitializedProperties(node, true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 174 /* ClassExpression */; + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 175 /* ClassExpression */; var tempVariable; if (isClassExpressionWithStaticProperties) { tempVariable = createAndRecordTempVariable(0 /* Auto */); @@ -27295,8 +27597,11 @@ var ts; } } function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 201 /* ClassDeclaration */) { - write("var "); + if (node.kind === 202 /* ClassDeclaration */) { + // source file level classes in system modules are hoisted so 'var's for them are already defined + if (!shouldHoistDeclarationInSystemJsModule(node)) { + write("var "); + } emitDeclarationName(node); write(" = "); } @@ -27351,11 +27656,11 @@ var ts; emit(baseTypeNode.expression); } write(")"); - if (node.kind === 201 /* ClassDeclaration */) { + if (node.kind === 202 /* ClassDeclaration */) { write(";"); } emitEnd(node); - if (node.kind === 201 /* ClassDeclaration */) { + if (node.kind === 202 /* ClassDeclaration */) { emitExportMemberAssignment(node); } if (languageVersion < 2 /* ES6 */ && node.parent === currentSourceFile && node.name) { @@ -27447,7 +27752,7 @@ var ts; else { decorators = member.decorators; // we only decorate the parameters here if this is a method - if (member.kind === 134 /* MethodDeclaration */) { + if (member.kind === 135 /* MethodDeclaration */) { functionLikeMember = member; } } @@ -27485,7 +27790,7 @@ var ts; // writeLine(); emitStart(member); - if (member.kind !== 132 /* PropertyDeclaration */) { + if (member.kind !== 133 /* PropertyDeclaration */) { write("Object.defineProperty("); emitStart(member.name); emitClassMemberPrefix(node, member); @@ -27515,7 +27820,7 @@ var ts; write(", "); emitExpressionForPropertyName(member.name); emitEnd(member.name); - if (member.kind !== 132 /* PropertyDeclaration */) { + if (member.kind !== 133 /* PropertyDeclaration */) { write(", Object.getOwnPropertyDescriptor("); emitStart(member.name); emitClassMemberPrefix(node, member); @@ -27557,10 +27862,10 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 134 /* MethodDeclaration */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 132 /* PropertyDeclaration */: + case 135 /* MethodDeclaration */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 133 /* PropertyDeclaration */: return true; } return false; @@ -27570,7 +27875,7 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 134 /* MethodDeclaration */: + case 135 /* MethodDeclaration */: return true; } return false; @@ -27580,9 +27885,9 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 201 /* ClassDeclaration */: - case 134 /* MethodDeclaration */: - case 137 /* SetAccessor */: + case 202 /* ClassDeclaration */: + case 135 /* MethodDeclaration */: + case 138 /* SetAccessor */: return true; } return false; @@ -27745,7 +28050,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 205 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 206 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -27762,7 +28067,9 @@ var ts; if (!shouldEmit) { return emitOnlyPinnedOrTripleSlashComments(node); } - if (!isModuleMergedWithES6Class(node)) { + var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); + var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); + if (emitVarForModule) { emitStart(node); if (isES6ExportedDeclaration(node)) { write("export "); @@ -27779,7 +28086,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 206 /* ModuleBlock */) { + if (node.body.kind === 207 /* ModuleBlock */) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; tempFlags = 0; @@ -27813,6 +28120,14 @@ var ts; write(" = {}));"); emitEnd(node); if (!isES6ExportedDeclaration(node) && node.name.kind === 65 /* Identifier */ && node.parent === currentSourceFile) { + if (compilerOptions.module === 4 /* System */ && (node.flags & 1 /* Export */)) { + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(")"); + } emitExportMemberAssignments(node.name); } } @@ -27829,16 +28144,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 208 /* ImportEqualsDeclaration */) { + if (node.kind === 209 /* ImportEqualsDeclaration */) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 211 /* NamespaceImport */) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 212 /* NamespaceImport */) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 209 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; + return node.kind === 210 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -27866,7 +28181,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 211 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 212 /* NamespaceImport */) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -27892,7 +28207,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 208 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; + var isExportedImport = node.kind === 209 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (compilerOptions.module !== 2 /* AMD */) { emitLeadingComments(node); @@ -27911,7 +28226,7 @@ var ts; // import { x, y } from "foo" // import d, * as x from "foo" // import d, { x, y } from "foo" - var isNakedImport = 209 /* ImportDeclaration */ && !node.importClause; + var isNakedImport = 210 /* ImportDeclaration */ && !node.importClause; if (!isNakedImport) { write("var "); write(getGeneratedNameForNode(node)); @@ -27979,6 +28294,7 @@ var ts; } } function emitExportDeclaration(node) { + ts.Debug.assert(compilerOptions.module !== 4 /* System */); if (languageVersion < 2 /* ES6 */) { if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { emitStart(node); @@ -28074,8 +28390,8 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 200 /* FunctionDeclaration */ && - expression.kind !== 201 /* ClassDeclaration */) { + if (expression.kind !== 201 /* FunctionDeclaration */ && + expression.kind !== 202 /* ClassDeclaration */) { write(";"); } emitEnd(node); @@ -28083,14 +28399,21 @@ var ts; else { writeLine(); emitStart(node); - emitContainingModuleName(node); - if (languageVersion === 0 /* ES3 */) { - write("[\"default\"] = "); + if (compilerOptions.module === 4 /* System */) { + write(exportFunctionForFile + "(\"default\","); + emit(node.expression); + write(")"); } else { - write(".default = "); + emitContainingModuleName(node); + if (languageVersion === 0 /* ES3 */) { + write("[\"default\"] = "); + } + else { + write(".default = "); + } + emit(node.expression); } - emit(node.expression); write(";"); emitEnd(node); } @@ -28104,7 +28427,7 @@ var ts; for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, true)) { // import "mod" @@ -28114,13 +28437,13 @@ var ts; externalImports.push(node); } break; - case 208 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 219 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { + case 209 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 220 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { // import x = require("mod") where x is referenced externalImports.push(node); } break; - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -28141,7 +28464,7 @@ var ts; } } break; - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; @@ -28162,6 +28485,476 @@ var ts; write("}"); } } + function getLocalNameForExternalImport(importNode) { + var namespaceDeclaration = getNamespaceDeclarationNode(importNode); + if (namespaceDeclaration && !isDefaultImport(importNode)) { + return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); + } + else { + return getGeneratedNameForNode(importNode); + } + } + function getExternalModuleNameText(importNode) { + var moduleName = ts.getExternalModuleName(importNode); + if (moduleName.kind === 8 /* StringLiteral */) { + return getLiteralText(moduleName); + } + return undefined; + } + function emitVariableDeclarationsForImports() { + if (externalImports.length === 0) { + return; + } + writeLine(); + var started = false; + for (var _a = 0; _a < externalImports.length; _a++) { + var importNode = externalImports[_a]; + // do not create variable declaration for exports and imports that lack import clause + var skipNode = importNode.kind === 216 /* ExportDeclaration */ || + (importNode.kind === 210 /* ImportDeclaration */ && !importNode.importClause); + if (skipNode) { + continue; + } + if (!started) { + write("var "); + started = true; + } + else { + write(", "); + } + write(getLocalNameForExternalImport(importNode)); + } + if (started) { + write(";"); + } + } + function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations) { + // when resolving exports local exported entries/indirect exported entries in the module + // should always win over entries with similar names that were added via star exports + // to support this we store names of local/indirect exported entries in a set. + // this set is used to filter names brought by star expors. + if (!hasExportStars) { + // local names set is needed only in presence of star exports + return undefined; + } + // local names set should only be added if we have anything exported + if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { + // no exported declarations (export var ...) or export specifiers (export {x}) + // check if we have any non star export declarations. + var hasExportDeclarationWithExportClause = false; + for (var _a = 0; _a < externalImports.length; _a++) { + var externalImport = externalImports[_a]; + if (externalImport.kind === 216 /* ExportDeclaration */ && externalImport.exportClause) { + hasExportDeclarationWithExportClause = true; + break; + } + } + if (!hasExportDeclarationWithExportClause) { + // we still need to emit exportStar helper + return emitExportStarFunction(undefined); + } + } + var exportedNamesStorageRef = makeUniqueName("exportedNames"); + writeLine(); + write("var " + exportedNamesStorageRef + " = {"); + increaseIndent(); + var started = false; + if (exportedDeclarations) { + for (var i = 0; i < exportedDeclarations.length; ++i) { + // write name of exported declaration, i.e 'export var x...' + writeExportedName(exportedDeclarations[i]); + } + } + if (exportSpecifiers) { + for (var n in exportSpecifiers) { + for (var _b = 0, _c = exportSpecifiers[n]; _b < _c.length; _b++) { + var specifier = _c[_b]; + // write name of export specified, i.e. 'export {x}' + writeExportedName(specifier.name); + } + } + } + for (var _d = 0; _d < externalImports.length; _d++) { + var externalImport = externalImports[_d]; + if (externalImport.kind !== 216 /* ExportDeclaration */) { + continue; + } + var exportDecl = externalImport; + if (!exportDecl.exportClause) { + // export * from ... + continue; + } + for (var _e = 0, _f = exportDecl.exportClause.elements; _e < _f.length; _e++) { + var element = _f[_e]; + // write name of indirectly exported entry, i.e. 'export {x} from ...' + writeExportedName(element.name || element.propertyName); + } + } + decreaseIndent(); + writeLine(); + write("};"); + return emitExportStarFunction(exportedNamesStorageRef); + function emitExportStarFunction(localNames) { + var exportStarFunction = makeUniqueName("exportStar"); + writeLine(); + // define an export star helper function + write("function " + exportStarFunction + "(m) {"); + increaseIndent(); + writeLine(); + write("for(var n in m) {"); + increaseIndent(); + writeLine(); + write("if (n !== \"default\""); + if (localNames) { + write("&& !" + localNames + ".hasOwnProperty(n)"); + } + write(") " + exportFunctionForFile + "(n, m[n]);"); + decreaseIndent(); + writeLine(); + write("}"); + decreaseIndent(); + writeLine(); + write("}"); + return exportStarFunction; + } + function writeExportedName(node) { + // do not record default exports + // they are local to module and never overwritten (explicitly skipped) by star export + if (node.kind !== 65 /* Identifier */ && node.flags & 256 /* Default */) { + return; + } + if (started) { + write(","); + } + else { + started = true; + } + writeLine(); + write("'"); + if (node.kind === 65 /* Identifier */) { + emitNodeWithoutSourceMap(node); + } + else { + emitDeclarationName(node); + } + write("': true"); + } + } + function processTopLevelVariableAndFunctionDeclarations(node) { + // per ES6 spec: + // 15.2.1.16.4 ModuleDeclarationInstantiation() Concrete Method + // - var declarations are initialized to undefined - 14.a.ii + // - function/generator declarations are instantiated - 16.a.iv + // this means that after module is instantiated but before its evaluation + // exported functions are already accessible at import sites + // in theory we should hoist only exported functions and its dependencies + // in practice to simplify things we'll hoist all source level functions and variable declaration + // including variables declarations for module and class declarations + var hoistedVars; + var hoistedFunctionDeclarations; + var exportedDeclarations; + visit(node); + if (hoistedVars) { + writeLine(); + write("var "); + for (var i = 0; i < hoistedVars.length; ++i) { + var local = hoistedVars[i]; + if (i !== 0) { + write(", "); + } + if (local.kind === 202 /* ClassDeclaration */ || local.kind === 206 /* ModuleDeclaration */) { + emitDeclarationName(local); + } + else { + emit(local); + } + var flags = ts.getCombinedNodeFlags(local.kind === 65 /* Identifier */ ? local.parent : local); + if (flags & 1 /* Export */) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(local); + } + } + write(";"); + } + if (hoistedFunctionDeclarations) { + for (var _a = 0; _a < hoistedFunctionDeclarations.length; _a++) { + var f = hoistedFunctionDeclarations[_a]; + writeLine(); + emit(f); + if (f.flags & 1 /* Export */) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(f); + } + } + } + return exportedDeclarations; + function visit(node) { + if (node.kind === 201 /* FunctionDeclaration */) { + if (!hoistedFunctionDeclarations) { + hoistedFunctionDeclarations = []; + } + hoistedFunctionDeclarations.push(node); + return; + } + if (node.kind === 202 /* ClassDeclaration */) { + // TODO: rename block scoped classes + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + return; + } + if (node.kind === 206 /* ModuleDeclaration */ && shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + return; + } + if (node.kind === 199 /* VariableDeclaration */ || node.kind === 153 /* BindingElement */) { + if (shouldHoistVariable(node, false)) { + var name_21 = node.name; + if (name_21.kind === 65 /* Identifier */) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(name_21); + } + else { + ts.forEachChild(name_21, visit); + } + } + return; + } + if (ts.isBindingPattern(node)) { + ts.forEach(node.elements, visit); + return; + } + if (!ts.isDeclaration(node)) { + ts.forEachChild(node, visit); + } + } + } + function shouldHoistVariable(node, checkIfSourceFileLevelDecl) { + if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { + return false; + } + // hoist variable if + // - it is not block scoped + // - it is top level block scoped + // if block scoped variables are nested in some another block then + // no other functions can use them except ones that are defined at least in the same block + return (ts.getCombinedNodeFlags(node) & 12288 /* BlockScoped */) === 0 || + ts.getEnclosingBlockScopeContainer(node).kind === 228 /* SourceFile */; + } + function isCurrentFileSystemExternalModule() { + return compilerOptions.module === 4 /* System */ && ts.isExternalModule(currentSourceFile); + } + function emitSystemModuleBody(node, startIndex) { + // shape of the body in system modules: + // function (exports) { + // + // + // + // return { + // setters: [ + // + // ], + // execute: function() { + // + // } + // } + // + // } + // I.e: + // import {x} from 'file1' + // var y = 1; + // export function foo() { return y + x(); } + // console.log(y); + // will be transformed to + // function(exports) { + // var file1; // local alias + // var y; + // function foo() { return y + file1.x(); } + // exports("foo", foo); + // return { + // setters: [ + // function(v) { file1 = v } + // ], + // execute(): function() { + // y = 1; + // console.log(y); + // } + // }; + // } + emitVariableDeclarationsForImports(); + writeLine(); + var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); + var exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations); + writeLine(); + write("return {"); + increaseIndent(); + writeLine(); + emitSetters(exportStarFunction); + writeLine(); + emitExecute(node, startIndex); + emitTempDeclarations(true); + decreaseIndent(); + writeLine(); + write("}"); // return + } + function emitSetters(exportStarFunction) { + write("setters:["); + for (var i = 0; i < externalImports.length; ++i) { + if (i !== 0) { + write(","); + } + writeLine(); + increaseIndent(); + var importNode = externalImports[i]; + var importVariableName = getLocalNameForExternalImport(importNode) || ""; + var parameterName = "_" + importVariableName; + write("function (" + parameterName + ") {"); + switch (importNode.kind) { + case 210 /* ImportDeclaration */: + if (!importNode.importClause) { + // 'import "..."' case + // module is imported only for side-effects, setter body will be empty + break; + } + // fall-through + case 209 /* ImportEqualsDeclaration */: + ts.Debug.assert(importVariableName !== ""); + increaseIndent(); + writeLine(); + // save import into the local + write(importVariableName + " = " + parameterName + ";"); + writeLine(); + var defaultName = importNode.kind === 210 /* ImportDeclaration */ + ? importNode.importClause.name + : importNode.name; + if (defaultName) { + // emit re-export for imported default name + // import n1 from 'foo1' + // import n2 = require('foo2') + // export {n1} + // export {n2} + emitExportMemberAssignments(defaultName); + writeLine(); + } + if (importNode.kind === 210 /* ImportDeclaration */ && + importNode.importClause.namedBindings) { + var namedBindings = importNode.importClause.namedBindings; + if (namedBindings.kind === 212 /* NamespaceImport */) { + // emit re-export for namespace + // import * as n from 'foo' + // export {n} + emitExportMemberAssignments(namedBindings.name); + writeLine(); + } + else { + // emit re-exports for named imports + // import {a, b} from 'foo' + // export {a, b as c} + for (var _a = 0, _b = namedBindings.elements; _a < _b.length; _a++) { + var element = _b[_a]; + emitExportMemberAssignments(element.name || element.propertyName); + writeLine(); + } + } + } + decreaseIndent(); + break; + case 216 /* ExportDeclaration */: + ts.Debug.assert(importVariableName !== ""); + increaseIndent(); + if (importNode.exportClause) { + // export {a, b as c} from 'foo' + // emit as: + // exports('a', _foo["a"]) + // exports('c', _foo["b"]) + for (var _c = 0, _d = importNode.exportClause.elements; _c < _d.length; _c++) { + var e = _d[_c]; + writeLine(); + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(e.name); + write("\", " + parameterName + "[\""); + emitNodeWithoutSourceMap(e.propertyName || e.name); + write("\"]);"); + } + } + else { + writeLine(); + // export * from 'foo' + // emit as: + // exportStar(_foo); + write(exportStarFunction + "(" + parameterName + ");"); + } + writeLine(); + decreaseIndent(); + break; + } + write("}"); + decreaseIndent(); + } + write("],"); + } + function emitExecute(node, startIndex) { + write("execute: function() {"); + increaseIndent(); + writeLine(); + for (var i = startIndex; i < node.statements.length; ++i) { + var statement = node.statements[i]; + // - imports/exports are not emitted for system modules + // - function declarations are not emitted because they were already hoisted + switch (statement.kind) { + case 216 /* ExportDeclaration */: + case 210 /* ImportDeclaration */: + case 209 /* ImportEqualsDeclaration */: + case 201 /* FunctionDeclaration */: + continue; + } + writeLine(); + emit(statement); + } + decreaseIndent(); + writeLine(); + write("}"); // execute + } + function emitSystemModule(node, startIndex) { + collectExternalModuleInfo(node); + // System modules has the following shape + // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */}) + // 'exports' here is a function 'exports(name: string, value: T): T' that is used to publish exported values. + // 'exports' returns its 'value' argument so in most cases expressions + // that mutate exported values can be rewritten as: + // expr -> exports('name', expr). + // The only exception in this rule is postfix unary operators, + // see comment to 'emitPostfixUnaryExpression' for more details + ts.Debug.assert(!exportFunctionForFile); + // make sure that name of 'exports' function does not conflict with existing identifiers + exportFunctionForFile = makeUniqueName("exports"); + write("System.register(["); + for (var i = 0; i < externalImports.length; ++i) { + var text = getExternalModuleNameText(externalImports[i]); + if (i !== 0) { + write(", "); + } + write(text); + } + write("], function(" + exportFunctionForFile + ") {"); + writeLine(); + increaseIndent(); + emitCaptureThisForNodeIfNecessary(node); + emitSystemModuleBody(node, startIndex); + decreaseIndent(); + writeLine(); + write("});"); + } function emitAMDDependencies(node, includeNonAmdDependencies) { // An AMD define function has the following shape: // define(id?, dependencies?, factory); @@ -28178,8 +28971,8 @@ var ts; // factory function. var unaliasedModuleNames = []; // names of modules with no corresponding parameters in // factory function. - var importAliasNames = []; // names of the parameters in the factory function; these - // parameters need to match the indexes of the corresponding + var importAliasNames = []; // names of the parameters in the factory function; these + // parameters need to match the indexes of the corresponding // module names in aliasedModuleNames. // Fill in amd-dependency tags for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { @@ -28195,20 +28988,9 @@ var ts; for (var _c = 0; _c < externalImports.length; _c++) { var importNode = externalImports[_c]; // Find the name of the external module - var externalModuleName = ""; - var moduleName = ts.getExternalModuleName(importNode); - if (moduleName.kind === 8 /* StringLiteral */) { - externalModuleName = getLiteralText(moduleName); - } + var externalModuleName = getExternalModuleNameText(importNode); // Find the name of the module alias, if there is one - var importAliasName = void 0; - var namespaceDeclaration = getNamespaceDeclarationNode(importNode); - if (namespaceDeclaration && !isDefaultImport(importNode)) { - importAliasName = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); - } - else { - importAliasName = getGeneratedNameForNode(importNode); - } + var importAliasName = getLocalNameForExternalImport(importNode); if (includeNonAmdDependencies && importAliasName) { aliasedModuleNames.push(externalModuleName); importAliasNames.push(importAliasName); @@ -28327,30 +29109,36 @@ var ts; emitDetachedComments(node); // emit prologue directives prior to __extends var startIndex = emitDirectivePrologues(node.statements, false); - // Only Emit __extends function when target ES5. - // For target ES6 and above, we can emit classDeclaration as is. - if ((languageVersion < 2 /* ES6 */) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8 /* EmitExtends */)) { - writeLines(extendsHelper); - extendsEmitted = true; - } - if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 512 /* EmitDecorate */) { - writeLines(decorateHelper); - if (compilerOptions.emitDecoratorMetadata) { - writeLines(metadataHelper); + // Only emit helpers if the user did not say otherwise. + if (!compilerOptions.noEmitHelpers) { + // Only Emit __extends function when target ES5. + // For target ES6 and above, we can emit classDeclaration as is. + if ((languageVersion < 2 /* ES6 */) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8 /* EmitExtends */)) { + writeLines(extendsHelper); + extendsEmitted = true; + } + if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 512 /* EmitDecorate */) { + writeLines(decorateHelper); + if (compilerOptions.emitDecoratorMetadata) { + writeLines(metadataHelper); + } + decorateEmitted = true; + } + if (!paramEmitted && resolver.getNodeCheckFlags(node) & 1024 /* EmitParam */) { + writeLines(paramHelper); + paramEmitted = true; } - decorateEmitted = true; } - if (!paramEmitted && resolver.getNodeCheckFlags(node) & 1024 /* EmitParam */) { - writeLines(paramHelper); - paramEmitted = true; - } - if (ts.isExternalModule(node)) { + if (ts.isExternalModule(node) || compilerOptions.separateCompilation) { if (languageVersion >= 2 /* ES6 */) { emitES6Module(node, startIndex); } else if (compilerOptions.module === 2 /* AMD */) { emitAMDModule(node, startIndex); } + else if (compilerOptions.module === 4 /* System */) { + emitSystemModule(node, startIndex); + } else if (compilerOptions.module === 3 /* UMD */) { emitUMDModule(node, startIndex); } @@ -28389,18 +29177,18 @@ var ts; switch (node.kind) { // All of these entities are emitted in a specialized fashion. As such, we allow // the specialized methods for each to handle the comments on the nodes. - case 202 /* InterfaceDeclaration */: - case 200 /* FunctionDeclaration */: - case 209 /* ImportDeclaration */: - case 208 /* ImportEqualsDeclaration */: - case 203 /* TypeAliasDeclaration */: - case 214 /* ExportAssignment */: + case 203 /* InterfaceDeclaration */: + case 201 /* FunctionDeclaration */: + case 210 /* ImportDeclaration */: + case 209 /* ImportEqualsDeclaration */: + case 204 /* TypeAliasDeclaration */: + case 215 /* ExportAssignment */: return false; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: // Only emit the leading/trailing comments for a module if we're actually // emitting the module as well. return shouldEmitModuleDeclaration(node); - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: // Only emit the leading/trailing comments for an enum if we're actually // emitting the module as well. return shouldEmitEnumDeclaration(node); @@ -28409,9 +29197,9 @@ var ts; // then we don't want to emit comments when we emit the body. It will have already // been taken care of when we emitted the 'return' statement for the function // expression body. - if (node.kind !== 179 /* Block */ && + if (node.kind !== 180 /* Block */ && node.parent && - node.parent.kind === 163 /* ArrowFunction */ && + node.parent.kind === 164 /* ArrowFunction */ && node.parent.body === node && compilerOptions.target <= 1 /* ES5 */) { return false; @@ -28425,13 +29213,13 @@ var ts; switch (node.kind) { case 65 /* Identifier */: return emitIdentifier(node, allowGeneratedIdentifiers); - case 129 /* Parameter */: + case 130 /* Parameter */: return emitParameter(node); - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: return emitMethod(node); - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: return emitAccessor(node); case 93 /* ThisKeyword */: return emitThis(node); @@ -28451,131 +29239,131 @@ var ts; case 12 /* TemplateMiddle */: case 13 /* TemplateTail */: return emitLiteral(node); - case 171 /* TemplateExpression */: + case 172 /* TemplateExpression */: return emitTemplateExpression(node); - case 176 /* TemplateSpan */: + case 178 /* TemplateSpan */: return emitTemplateSpan(node); - case 126 /* QualifiedName */: + case 127 /* QualifiedName */: return emitQualifiedName(node); - case 150 /* ObjectBindingPattern */: + case 151 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 151 /* ArrayBindingPattern */: + case 152 /* ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 152 /* BindingElement */: + case 153 /* BindingElement */: return emitBindingElement(node); - case 153 /* ArrayLiteralExpression */: + case 154 /* ArrayLiteralExpression */: return emitArrayLiteral(node); - case 154 /* ObjectLiteralExpression */: + case 155 /* ObjectLiteralExpression */: return emitObjectLiteral(node); - case 224 /* PropertyAssignment */: + case 225 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 225 /* ShorthandPropertyAssignment */: + case 226 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 127 /* ComputedPropertyName */: + case 128 /* ComputedPropertyName */: return emitComputedPropertyName(node); - case 155 /* PropertyAccessExpression */: + case 156 /* PropertyAccessExpression */: return emitPropertyAccess(node); - case 156 /* ElementAccessExpression */: + case 157 /* ElementAccessExpression */: return emitIndexedAccess(node); - case 157 /* CallExpression */: + case 158 /* CallExpression */: return emitCallExpression(node); - case 158 /* NewExpression */: + case 159 /* NewExpression */: return emitNewExpression(node); - case 159 /* TaggedTemplateExpression */: + case 160 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 160 /* TypeAssertionExpression */: + case 161 /* TypeAssertionExpression */: return emit(node.expression); - case 161 /* ParenthesizedExpression */: + case 162 /* ParenthesizedExpression */: return emitParenExpression(node); - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: return emitFunctionDeclaration(node); - case 164 /* DeleteExpression */: + case 165 /* DeleteExpression */: return emitDeleteExpression(node); - case 165 /* TypeOfExpression */: + case 166 /* TypeOfExpression */: return emitTypeOfExpression(node); - case 166 /* VoidExpression */: + case 167 /* VoidExpression */: return emitVoidExpression(node); - case 167 /* PrefixUnaryExpression */: + case 168 /* PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 168 /* PostfixUnaryExpression */: + case 169 /* PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: return emitBinaryExpression(node); - case 170 /* ConditionalExpression */: + case 171 /* ConditionalExpression */: return emitConditionalExpression(node); - case 173 /* SpreadElementExpression */: + case 174 /* SpreadElementExpression */: return emitSpreadElementExpression(node); - case 172 /* YieldExpression */: + case 173 /* YieldExpression */: return emitYieldExpression(node); - case 175 /* OmittedExpression */: + case 176 /* OmittedExpression */: return; - case 179 /* Block */: - case 206 /* ModuleBlock */: + case 180 /* Block */: + case 207 /* ModuleBlock */: return emitBlock(node); - case 180 /* VariableStatement */: + case 181 /* VariableStatement */: return emitVariableStatement(node); - case 181 /* EmptyStatement */: + case 182 /* EmptyStatement */: return write(";"); - case 182 /* ExpressionStatement */: + case 183 /* ExpressionStatement */: return emitExpressionStatement(node); - case 183 /* IfStatement */: + case 184 /* IfStatement */: return emitIfStatement(node); - case 184 /* DoStatement */: + case 185 /* DoStatement */: return emitDoStatement(node); - case 185 /* WhileStatement */: + case 186 /* WhileStatement */: return emitWhileStatement(node); - case 186 /* ForStatement */: + case 187 /* ForStatement */: return emitForStatement(node); - case 188 /* ForOfStatement */: - case 187 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 188 /* ForInStatement */: return emitForInOrForOfStatement(node); - case 189 /* ContinueStatement */: - case 190 /* BreakStatement */: + case 190 /* ContinueStatement */: + case 191 /* BreakStatement */: return emitBreakOrContinueStatement(node); - case 191 /* ReturnStatement */: + case 192 /* ReturnStatement */: return emitReturnStatement(node); - case 192 /* WithStatement */: + case 193 /* WithStatement */: return emitWithStatement(node); - case 193 /* SwitchStatement */: + case 194 /* SwitchStatement */: return emitSwitchStatement(node); - case 220 /* CaseClause */: - case 221 /* DefaultClause */: + case 221 /* CaseClause */: + case 222 /* DefaultClause */: return emitCaseOrDefaultClause(node); - case 194 /* LabeledStatement */: + case 195 /* LabeledStatement */: return emitLabelledStatement(node); - case 195 /* ThrowStatement */: + case 196 /* ThrowStatement */: return emitThrowStatement(node); - case 196 /* TryStatement */: + case 197 /* TryStatement */: return emitTryStatement(node); - case 223 /* CatchClause */: + case 224 /* CatchClause */: return emitCatchClause(node); - case 197 /* DebuggerStatement */: + case 198 /* DebuggerStatement */: return emitDebuggerStatement(node); - case 198 /* VariableDeclaration */: + case 199 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 174 /* ClassExpression */: + case 175 /* ClassExpression */: return emitClassExpression(node); - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: return emitClassDeclaration(node); - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 226 /* EnumMember */: + case 227 /* EnumMember */: return emitEnumMember(node); - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: return emitImportDeclaration(node); - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: return emitExportDeclaration(node); - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: return emitExportAssignment(node); - case 227 /* SourceFile */: + case 228 /* SourceFile */: return emitSourceFileNode(node); } } @@ -28607,7 +29395,7 @@ var ts; function getLeadingCommentsToEmit(node) { // Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments if (node.parent) { - if (node.parent.kind === 227 /* SourceFile */ || node.pos !== node.parent.pos) { + if (node.parent.kind === 228 /* SourceFile */ || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { // get comments without detached comments return getLeadingCommentsWithoutDetachedComments(); @@ -28622,7 +29410,7 @@ var ts; function getTrailingCommentsToEmit(node) { // Emit the trailing comments only if the parent's pos doesn't match because parent should take care of emitting these comments if (node.parent) { - if (node.parent.kind === 227 /* SourceFile */ || node.end !== node.parent.end) { + if (node.parent.kind === 228 /* SourceFile */ || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); } } @@ -28817,10 +29605,10 @@ var ts; }; } ts.createCompilerHost = createCompilerHost; - function getPreEmitDiagnostics(program) { - var diagnostics = program.getSyntacticDiagnostics().concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics()); + function getPreEmitDiagnostics(program, sourceFile) { + var diagnostics = program.getSyntacticDiagnostics(sourceFile).concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics(sourceFile)); if (program.getCompilerOptions().declaration) { - diagnostics.concat(program.getDeclarationDiagnostics()); + diagnostics.concat(program.getDeclarationDiagnostics(sourceFile)); } return ts.sortAndDeduplicateDiagnostics(diagnostics); } @@ -29068,7 +29856,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 209 /* ImportDeclaration */ || node.kind === 208 /* ImportEqualsDeclaration */ || node.kind === 215 /* ExportDeclaration */) { + if (node.kind === 210 /* ImportDeclaration */ || node.kind === 209 /* ImportEqualsDeclaration */ || node.kind === 216 /* ExportDeclaration */) { var moduleNameExpr = ts.getExternalModuleName(node); if (moduleNameExpr && moduleNameExpr.kind === 8 /* StringLiteral */) { var moduleNameText = moduleNameExpr.text; @@ -29088,7 +29876,7 @@ var ts; } } } - else if (node.kind === 205 /* ModuleDeclaration */ && node.name.kind === 8 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { + else if (node.kind === 206 /* ModuleDeclaration */ && node.name.kind === 8 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { // TypeScript 1.0 spec (April 2014): 12.1.6 // An AmbientExternalModuleDeclaration declares an external module. // This type of declaration is permitted only in the global module. @@ -29183,6 +29971,22 @@ var ts; diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_out_cannot_be_specified_with_option_separateCompilation)); } } + if (options.inlineSourceMap) { + if (options.sourceMap) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap)); + } + if (options.mapRoot) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap)); + } + if (options.sourceRoot) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap)); + } + } + if (options.inlineSources) { + if (!options.sourceMap && !options.inlineSourceMap) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); + } + } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { @@ -29202,17 +30006,17 @@ var ts; var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); if (firstNonExternalModuleSourceFile) { var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided)); + diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_separateCompilation_flag_is_provided)); } } else if (firstExternalModuleSourceFile && languageVersion < 2 /* ES6 */ && !options.module) { // We cannot use createDiagnosticFromNode because nodes do not have parents yet var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); } // Cannot specify module gen target when in es6 or above if (options.module && languageVersion >= 2 /* ES6 */) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_external_modules_into_amd_commonjs_or_umd_when_targeting_ES6_or_higher)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); } // there has to be common source directory if user specified --outdir || --sourceRoot // if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted @@ -29279,6 +30083,14 @@ var ts; type: "boolean", description: ts.Diagnostics.Print_this_message }, + { + name: "inlineSourceMap", + type: "boolean" + }, + { + name: "inlineSources", + type: "boolean" + }, { name: "listFiles", type: "boolean" @@ -29300,17 +30112,22 @@ var ts; type: { "commonjs": 1 /* CommonJS */, "amd": 2 /* AMD */, + "system": 4 /* System */, "umd": 3 /* UMD */ }, - description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_or_umd, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_or_umd, paramType: ts.Diagnostics.KIND, - error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_or_umd + error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd }, { name: "noEmit", type: "boolean", description: ts.Diagnostics.Do_not_emit_outputs }, + { + name: "noEmitHelpers", + type: "boolean" + }, { name: "noEmitOnError", type: "boolean", @@ -29531,19 +30348,34 @@ var ts; function readConfigFile(fileName) { try { var text = ts.sys.readFile(fileName); - return /\S/.test(text) ? JSON.parse(text) : {}; } catch (e) { + return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) }; } + return parseConfigFileText(fileName, text); } ts.readConfigFile = readConfigFile; + /** + * Parse the text of the tsconfig.json file + * @param fileName The path to the config file + * @param jsonText The text of the config file + */ + function parseConfigFileText(fileName, jsonText) { + try { + return { config: /\S/.test(jsonText) ? JSON.parse(jsonText) : {} }; + } + catch (e) { + return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; + } + } + ts.parseConfigFileText = parseConfigFileText; /** * Parse the contents of a config file (tsconfig.json). * @param json The contents of the config file to parse * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - function parseConfigFile(json, basePath) { + function parseConfigFile(json, host, basePath) { var errors = []; return { options: getCompilerOptions(), @@ -29599,7 +30431,7 @@ var ts; } } else { - var sysFiles = ts.sys.readDirectory(basePath, ".ts"); + var sysFiles = host.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")) { @@ -29684,7 +30516,7 @@ var ts; } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 163 /* ArrowFunction */; + return ts.isFunctionBlock(node) && node.parent.kind !== 164 /* ArrowFunction */; } var depth = 0; var maxDepth = 20; @@ -29696,7 +30528,7 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 179 /* Block */: + case 180 /* Block */: if (!ts.isFunctionBlock(n)) { var parent_6 = n.parent; var openBrace = ts.findChildOfKind(n, 14 /* OpenBraceToken */, sourceFile); @@ -29704,18 +30536,18 @@ var ts; // Check if the block is standalone, or 'attached' to some parent statement. // If the latter, we want to collaps the block, but consider its hint span // to be the entire span of the parent. - if (parent_6.kind === 184 /* DoStatement */ || - parent_6.kind === 187 /* ForInStatement */ || - parent_6.kind === 188 /* ForOfStatement */ || - parent_6.kind === 186 /* ForStatement */ || - parent_6.kind === 183 /* IfStatement */ || - parent_6.kind === 185 /* WhileStatement */ || - parent_6.kind === 192 /* WithStatement */ || - parent_6.kind === 223 /* CatchClause */) { + if (parent_6.kind === 185 /* DoStatement */ || + parent_6.kind === 188 /* ForInStatement */ || + parent_6.kind === 189 /* ForOfStatement */ || + parent_6.kind === 187 /* ForStatement */ || + parent_6.kind === 184 /* IfStatement */ || + parent_6.kind === 186 /* WhileStatement */ || + parent_6.kind === 193 /* WithStatement */ || + parent_6.kind === 224 /* CatchClause */) { addOutliningSpan(parent_6, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_6.kind === 196 /* TryStatement */) { + if (parent_6.kind === 197 /* TryStatement */) { // Could be the try-block, or the finally-block. var tryStatement = parent_6; if (tryStatement.tryBlock === n) { @@ -29742,23 +30574,23 @@ var ts; break; } // Fallthrough. - case 206 /* ModuleBlock */: { + case 207 /* ModuleBlock */: { var openBrace = ts.findChildOfKind(n, 14 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 15 /* CloseBraceToken */, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 204 /* EnumDeclaration */: - case 154 /* ObjectLiteralExpression */: - case 207 /* CaseBlock */: { + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 205 /* EnumDeclaration */: + case 155 /* ObjectLiteralExpression */: + case 208 /* CaseBlock */: { var openBrace = ts.findChildOfKind(n, 14 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 15 /* CloseBraceToken */, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 153 /* ArrayLiteralExpression */: + case 154 /* ArrayLiteralExpression */: var openBracket = ts.findChildOfKind(n, 18 /* OpenBracketToken */, sourceFile); var closeBracket = ts.findChildOfKind(n, 19 /* CloseBracketToken */, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -29786,12 +30618,12 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_21 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_21); + for (var name_22 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_22); if (declarations) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_21); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_22); if (!matches) { continue; } @@ -29804,14 +30636,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_21); + matches = patternMatcher.getMatches(containers, name_22); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_21, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_22, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -29849,7 +30681,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 127 /* ComputedPropertyName */) { + else if (declaration.name.kind === 128 /* ComputedPropertyName */) { return tryAddComputedPropertyName(declaration.name.expression, containers, true); } else { @@ -29870,7 +30702,7 @@ var ts; } return true; } - if (expression.kind === 155 /* PropertyAccessExpression */) { + if (expression.kind === 156 /* PropertyAccessExpression */) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -29883,7 +30715,7 @@ var ts; var containers = []; // First, if we started with a computed property name, then add all but the last // portion into the container array. - if (declaration.name.kind === 127 /* ComputedPropertyName */) { + if (declaration.name.kind === 128 /* ComputedPropertyName */) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, false)) { return undefined; } @@ -29959,17 +30791,17 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: // If we have a module declared as A.B.C, it is more "intuitive" // to say it only has a single layer of depth do { current = current.parent; - } while (current.kind === 205 /* ModuleDeclaration */); + } while (current.kind === 206 /* ModuleDeclaration */); // fall through - case 201 /* ClassDeclaration */: - case 204 /* EnumDeclaration */: - case 202 /* InterfaceDeclaration */: - case 200 /* FunctionDeclaration */: + case 202 /* ClassDeclaration */: + case 205 /* EnumDeclaration */: + case 203 /* InterfaceDeclaration */: + case 201 /* FunctionDeclaration */: indent++; } current = current.parent; @@ -29980,21 +30812,21 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 180 /* VariableStatement */: + case 181 /* VariableStatement */: ts.forEach(node.declarationList.declarations, visit); break; - case 150 /* ObjectBindingPattern */: - case 151 /* ArrayBindingPattern */: + case 151 /* ObjectBindingPattern */: + case 152 /* ArrayBindingPattern */: ts.forEach(node.elements, visit); break; - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -30006,7 +30838,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 211 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 212 /* NamespaceImport */) { childNodes.push(importClause.namedBindings); } else { @@ -30015,21 +30847,21 @@ var ts; } } break; - case 152 /* BindingElement */: - case 198 /* VariableDeclaration */: + case 153 /* BindingElement */: + case 199 /* VariableDeclaration */: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } // Fall through - case 201 /* ClassDeclaration */: - case 204 /* EnumDeclaration */: - case 202 /* InterfaceDeclaration */: - case 205 /* ModuleDeclaration */: - case 200 /* FunctionDeclaration */: - case 208 /* ImportEqualsDeclaration */: - case 213 /* ImportSpecifier */: - case 217 /* ExportSpecifier */: + case 202 /* ClassDeclaration */: + case 205 /* EnumDeclaration */: + case 203 /* InterfaceDeclaration */: + case 206 /* ModuleDeclaration */: + case 201 /* FunctionDeclaration */: + case 209 /* ImportEqualsDeclaration */: + case 214 /* ImportSpecifier */: + case 218 /* ExportSpecifier */: childNodes.push(node); break; } @@ -30077,17 +30909,17 @@ var ts; for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; switch (node.kind) { - case 201 /* ClassDeclaration */: - case 204 /* EnumDeclaration */: - case 202 /* InterfaceDeclaration */: + case 202 /* ClassDeclaration */: + case 205 /* EnumDeclaration */: + case 203 /* InterfaceDeclaration */: topLevelNodes.push(node); break; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 200 /* FunctionDeclaration */: + case 201 /* FunctionDeclaration */: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -30098,12 +30930,12 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 200 /* FunctionDeclaration */) { + if (functionDeclaration.kind === 201 /* FunctionDeclaration */) { // A function declaration is 'top level' if it contains any function declarations // within it. - if (functionDeclaration.body && functionDeclaration.body.kind === 179 /* Block */) { + if (functionDeclaration.body && functionDeclaration.body.kind === 180 /* Block */) { // Proper function declarations can only have identifier names - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 200 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 201 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { return true; } // Or if it is not parented by another function. i.e all functions @@ -30163,7 +30995,7 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 129 /* Parameter */: + case 130 /* Parameter */: if (ts.isBindingPattern(node.name)) { break; } @@ -30171,36 +31003,36 @@ var ts; return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 136 /* GetAccessor */: + case 137 /* GetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); - case 137 /* SetAccessor */: + case 138 /* SetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 140 /* IndexSignature */: + case 141 /* IndexSignature */: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 226 /* EnumMember */: + case 227 /* EnumMember */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 138 /* CallSignature */: + case 139 /* CallSignature */: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); - case 139 /* ConstructSignature */: + case 140 /* ConstructSignature */: return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 200 /* FunctionDeclaration */: + case 201 /* FunctionDeclaration */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 198 /* VariableDeclaration */: - case 152 /* BindingElement */: + case 199 /* VariableDeclaration */: + case 153 /* BindingElement */: var variableDeclarationNode; - var name_22; - if (node.kind === 152 /* BindingElement */) { - name_22 = node.name; + var name_23; + if (node.kind === 153 /* BindingElement */) { + name_23 = node.name; variableDeclarationNode = node; // binding elements are added only for variable declarations // bubble up to the containing variable declaration - while (variableDeclarationNode && variableDeclarationNode.kind !== 198 /* VariableDeclaration */) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 199 /* VariableDeclaration */) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -30208,24 +31040,24 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_22 = node.name; + name_23 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_22), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_22), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_22), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.variableElement); } - case 135 /* Constructor */: + case 136 /* Constructor */: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 217 /* ExportSpecifier */: - case 213 /* ImportSpecifier */: - case 208 /* ImportEqualsDeclaration */: - case 210 /* ImportClause */: - case 211 /* NamespaceImport */: + case 218 /* ExportSpecifier */: + case 214 /* ImportSpecifier */: + case 209 /* ImportEqualsDeclaration */: + case 211 /* ImportClause */: + case 212 /* NamespaceImport */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -30255,17 +31087,17 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 227 /* SourceFile */: + case 228 /* SourceFile */: return createSourceFileItem(node); - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: return createClassItem(node); - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: return createEnumItem(node); - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: return createIterfaceItem(node); - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: return createModuleItem(node); - case 200 /* FunctionDeclaration */: + case 201 /* FunctionDeclaration */: return createFunctionItem(node); } return undefined; @@ -30277,7 +31109,7 @@ var ts; // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 205 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 206 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -30289,7 +31121,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.body && node.body.kind === 179 /* Block */) { + if (node.body && node.body.kind === 180 /* Block */) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(!node.name ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -30310,7 +31142,7 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 135 /* Constructor */ && member; + return member.kind === 136 /* Constructor */ && member; }); // Add the constructor parameters in as children of the class (for property parameters). // Note that *all non-binding pattern named* parameters will be added to the nodes array, but parameters that @@ -30334,7 +31166,7 @@ var ts; } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 127 /* ComputedPropertyName */; }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 128 /* ComputedPropertyName */; }); } /** * Like removeComputedProperties, but retains the properties with well known symbol names @@ -30343,13 +31175,13 @@ var ts; return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 205 /* ModuleDeclaration */) { + while (node.body.kind === 206 /* ModuleDeclaration */) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 227 /* SourceFile */ + return node.kind === 228 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -31144,7 +31976,7 @@ var ts; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function createJavaScriptSignatureHelpItems(argumentInfo) { - if (argumentInfo.invocation.kind !== 157 /* CallExpression */) { + if (argumentInfo.invocation.kind !== 158 /* CallExpression */) { return undefined; } // See if we can find some symbol with the call expression name that has call signatures. @@ -31152,7 +31984,7 @@ var ts; var expression = callExpression.expression; var name = expression.kind === 65 /* Identifier */ ? expression - : expression.kind === 155 /* PropertyAccessExpression */ + : expression.kind === 156 /* PropertyAccessExpression */ ? expression.name : undefined; if (!name || !name.text) { @@ -31185,7 +32017,7 @@ var ts; * in the argument of an invocation; returns undefined otherwise. */ function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind === 157 /* CallExpression */ || node.parent.kind === 158 /* NewExpression */) { + if (node.parent.kind === 158 /* CallExpression */ || node.parent.kind === 159 /* NewExpression */) { var callExpression = node.parent; // There are 3 cases to handle: // 1. The token introduces a list, and should begin a sig help session @@ -31238,25 +32070,25 @@ var ts; }; } } - else if (node.kind === 10 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 159 /* TaggedTemplateExpression */) { + else if (node.kind === 10 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 160 /* TaggedTemplateExpression */) { // Check if we're actually inside the template; // otherwise we'll fall out and return undefined. if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, 0); } } - else if (node.kind === 11 /* TemplateHead */ && node.parent.parent.kind === 159 /* TaggedTemplateExpression */) { + else if (node.kind === 11 /* TemplateHead */ && node.parent.parent.kind === 160 /* TaggedTemplateExpression */) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 171 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 172 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 176 /* TemplateSpan */ && node.parent.parent.parent.kind === 159 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 178 /* TemplateSpan */ && node.parent.parent.parent.kind === 160 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 171 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 172 /* TemplateExpression */); // If we're just after a template tail, don't show signature help. if (node.kind === 13 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { return undefined; @@ -31374,7 +32206,7 @@ var ts; // // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 171 /* TemplateExpression */) { + if (template.kind === 172 /* TemplateExpression */) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); @@ -31383,7 +32215,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 227 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 228 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -31584,40 +32416,40 @@ var ts; return false; } switch (n.kind) { - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 204 /* EnumDeclaration */: - case 154 /* ObjectLiteralExpression */: - case 150 /* ObjectBindingPattern */: - case 145 /* TypeLiteral */: - case 179 /* Block */: - case 206 /* ModuleBlock */: - case 207 /* CaseBlock */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 205 /* EnumDeclaration */: + case 155 /* ObjectLiteralExpression */: + case 151 /* ObjectBindingPattern */: + case 146 /* TypeLiteral */: + case 180 /* Block */: + case 207 /* ModuleBlock */: + case 208 /* CaseBlock */: return nodeEndsWith(n, 15 /* CloseBraceToken */, sourceFile); - case 223 /* CatchClause */: + case 224 /* CatchClause */: return isCompletedNode(n.block, sourceFile); - case 158 /* NewExpression */: + case 159 /* NewExpression */: if (!n.arguments) { return true; } // fall through - case 157 /* CallExpression */: - case 161 /* ParenthesizedExpression */: - case 149 /* ParenthesizedType */: + case 158 /* CallExpression */: + case 162 /* ParenthesizedExpression */: + case 150 /* ParenthesizedType */: return nodeEndsWith(n, 17 /* CloseParenToken */, sourceFile); - case 142 /* FunctionType */: - case 143 /* ConstructorType */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 139 /* ConstructSignature */: - case 138 /* CallSignature */: - case 163 /* ArrowFunction */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 140 /* ConstructSignature */: + case 139 /* CallSignature */: + case 164 /* ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -31627,63 +32459,63 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 17 /* CloseParenToken */, sourceFile); - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 183 /* IfStatement */: + case 184 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 182 /* ExpressionStatement */: + case 183 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile); - case 153 /* ArrayLiteralExpression */: - case 151 /* ArrayBindingPattern */: - case 156 /* ElementAccessExpression */: - case 127 /* ComputedPropertyName */: - case 147 /* TupleType */: + case 154 /* ArrayLiteralExpression */: + case 152 /* ArrayBindingPattern */: + case 157 /* ElementAccessExpression */: + case 128 /* ComputedPropertyName */: + case 148 /* TupleType */: return nodeEndsWith(n, 19 /* CloseBracketToken */, sourceFile); - case 140 /* IndexSignature */: + case 141 /* IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 19 /* CloseBracketToken */, sourceFile); - case 220 /* CaseClause */: - case 221 /* DefaultClause */: + case 221 /* CaseClause */: + case 222 /* DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicitly always consider them non-completed return false; - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 185 /* WhileStatement */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 186 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 184 /* DoStatement */: + case 185 /* DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; var hasWhileKeyword = findChildOfKind(n, 100 /* WhileKeyword */, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 17 /* CloseParenToken */, sourceFile); } return isCompletedNode(n.statement, sourceFile); - case 144 /* TypeQuery */: + case 145 /* TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 165 /* TypeOfExpression */: - case 164 /* DeleteExpression */: - case 166 /* VoidExpression */: - case 172 /* YieldExpression */: - case 173 /* SpreadElementExpression */: + case 166 /* TypeOfExpression */: + case 165 /* DeleteExpression */: + case 167 /* VoidExpression */: + case 173 /* YieldExpression */: + case 174 /* SpreadElementExpression */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 159 /* TaggedTemplateExpression */: + case 160 /* TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 171 /* TemplateExpression */: + case 172 /* TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 176 /* TemplateSpan */: + case 178 /* TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 167 /* PrefixUnaryExpression */: + case 168 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 170 /* ConditionalExpression */: + case 171 /* ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -31739,7 +32571,7 @@ var ts; // for the position of the relevant node (or comma). var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { // find syntax list that covers the span of the node - if (c.kind === 228 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 229 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -31873,7 +32705,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 227 /* SourceFile */); + ts.Debug.assert(startNode !== undefined || n.kind === 228 /* SourceFile */); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -31917,17 +32749,17 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 141 /* TypeReference */ || node.kind === 157 /* CallExpression */) { + if (node.kind === 142 /* TypeReference */ || node.kind === 158 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 201 /* ClassDeclaration */ || node.kind === 202 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 202 /* ClassDeclaration */ || node.kind === 203 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 /* FirstToken */ && n.kind <= 125 /* LastToken */; + return n.kind >= 0 /* FirstToken */ && n.kind <= 126 /* LastToken */; } ts.isToken = isToken; function isWord(kind) { @@ -31982,7 +32814,7 @@ var ts; var ts; (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 129 /* Parameter */; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 130 /* Parameter */; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -32684,7 +33516,7 @@ var ts; this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([96 /* TryKeyword */, 81 /* FinallyKeyword */]), 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // get x() {} // set x(val) {} - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([116 /* GetKeyword */, 120 /* SetKeyword */]), 65 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([116 /* GetKeyword */, 121 /* SetKeyword */]), 65 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. 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 /* Space */)); 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 /* Space */)); @@ -32692,9 +33524,9 @@ var ts; // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(114 /* ConstructorKeyword */, 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Use of module as a function call. e.g.: import m2 = module("m2"); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([117 /* ModuleKeyword */, 118 /* RequireKeyword */]), 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([117 /* ModuleKeyword */, 119 /* RequireKeyword */]), 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([69 /* ClassKeyword */, 115 /* DeclareKeyword */, 77 /* EnumKeyword */, 78 /* ExportKeyword */, 79 /* ExtendsKeyword */, 116 /* GetKeyword */, 102 /* ImplementsKeyword */, 85 /* ImportKeyword */, 103 /* InterfaceKeyword */, 117 /* ModuleKeyword */, 106 /* PrivateKeyword */, 108 /* PublicKeyword */, 120 /* SetKeyword */, 109 /* StaticKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([69 /* ClassKeyword */, 115 /* DeclareKeyword */, 77 /* EnumKeyword */, 78 /* ExportKeyword */, 79 /* ExtendsKeyword */, 116 /* GetKeyword */, 102 /* ImplementsKeyword */, 85 /* ImportKeyword */, 103 /* InterfaceKeyword */, 117 /* ModuleKeyword */, 118 /* NamespaceKeyword */, 106 /* PrivateKeyword */, 108 /* PublicKeyword */, 121 /* SetKeyword */, 109 /* StaticKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([79 /* ExtendsKeyword */, 102 /* ImplementsKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(8 /* StringLiteral */, 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); @@ -32714,7 +33546,7 @@ var ts; // decorators this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 52 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(52 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([65 /* Identifier */, 78 /* ExportKeyword */, 73 /* DefaultKeyword */, 69 /* ClassKeyword */, 109 /* StaticKeyword */, 108 /* PublicKeyword */, 106 /* PrivateKeyword */, 107 /* ProtectedKeyword */, 116 /* GetKeyword */, 120 /* SetKeyword */, 18 /* OpenBracketToken */, 35 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([65 /* Identifier */, 78 /* ExportKeyword */, 73 /* DefaultKeyword */, 69 /* ClassKeyword */, 109 /* StaticKeyword */, 108 /* PublicKeyword */, 106 /* PrivateKeyword */, 107 /* ProtectedKeyword */, 116 /* GetKeyword */, 121 /* SetKeyword */, 18 /* OpenBracketToken */, 35 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = [ @@ -32804,9 +33636,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_23 in o) { - if (o[name_23] === rule) { - return name_23; + for (var name_24 in o) { + if (o[name_24] === rule) { + return name_24; } } throw new Error("Unknown rule"); @@ -32815,36 +33647,36 @@ var ts; /// Contexts /// Rules.IsForContext = function (context) { - return context.contextNode.kind === 186 /* ForStatement */; + return context.contextNode.kind === 187 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 169 /* BinaryExpression */: - case 170 /* ConditionalExpression */: + case 170 /* BinaryExpression */: + case 171 /* ConditionalExpression */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 152 /* BindingElement */: + case 153 /* BindingElement */: // equals in type X = ... - case 203 /* TypeAliasDeclaration */: + case 204 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 198 /* VariableDeclaration */: + case 199 /* VariableDeclaration */: // equal in p = 0; - case 129 /* Parameter */: - case 226 /* EnumMember */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 130 /* Parameter */: + case 227 /* EnumMember */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: return context.currentTokenSpan.kind === 53 /* EqualsToken */ || context.nextTokenSpan.kind === 53 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 187 /* ForInStatement */: + case 188 /* ForInStatement */: return context.currentTokenSpan.kind === 86 /* InKeyword */ || context.nextTokenSpan.kind === 86 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 188 /* ForOfStatement */: - return context.currentTokenSpan.kind === 125 /* OfKeyword */ || context.nextTokenSpan.kind === 125 /* OfKeyword */; + case 189 /* ForOfStatement */: + return context.currentTokenSpan.kind === 126 /* OfKeyword */ || context.nextTokenSpan.kind === 126 /* OfKeyword */; } return false; }; @@ -32852,7 +33684,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 170 /* ConditionalExpression */; + return context.contextNode.kind === 171 /* ConditionalExpression */; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. @@ -32896,31 +33728,31 @@ var ts; return true; } switch (node.kind) { - case 179 /* Block */: - case 207 /* CaseBlock */: - case 154 /* ObjectLiteralExpression */: - case 206 /* ModuleBlock */: + case 180 /* Block */: + case 208 /* CaseBlock */: + case 155 /* ObjectLiteralExpression */: + case 207 /* ModuleBlock */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 200 /* FunctionDeclaration */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 201 /* FunctionDeclaration */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: //case SyntaxKind.MemberFunctionDeclaration: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: ///case SyntaxKind.MethodSignature: - case 138 /* CallSignature */: - case 162 /* FunctionExpression */: - case 135 /* Constructor */: - case 163 /* ArrowFunction */: + case 139 /* CallSignature */: + case 163 /* FunctionExpression */: + case 136 /* Constructor */: + case 164 /* ArrowFunction */: //case SyntaxKind.ConstructorDeclaration: //case SyntaxKind.SimpleArrowFunctionExpression: //case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: return true; } return false; @@ -32930,55 +33762,55 @@ var ts; }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 204 /* EnumDeclaration */: - case 145 /* TypeLiteral */: - case 205 /* ModuleDeclaration */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 205 /* EnumDeclaration */: + case 146 /* TypeLiteral */: + case 206 /* ModuleDeclaration */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 201 /* ClassDeclaration */: - case 205 /* ModuleDeclaration */: - case 204 /* EnumDeclaration */: - case 179 /* Block */: - case 223 /* CatchClause */: - case 206 /* ModuleBlock */: - case 193 /* SwitchStatement */: + case 202 /* ClassDeclaration */: + case 206 /* ModuleDeclaration */: + case 205 /* EnumDeclaration */: + case 180 /* Block */: + case 224 /* CatchClause */: + case 207 /* ModuleBlock */: + case 194 /* SwitchStatement */: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 183 /* IfStatement */: - case 193 /* SwitchStatement */: - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 185 /* WhileStatement */: - case 196 /* TryStatement */: - case 184 /* DoStatement */: - case 192 /* WithStatement */: + case 184 /* IfStatement */: + case 194 /* SwitchStatement */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 186 /* WhileStatement */: + case 197 /* TryStatement */: + case 185 /* DoStatement */: + case 193 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 223 /* CatchClause */: + case 224 /* CatchClause */: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 154 /* ObjectLiteralExpression */; + return context.contextNode.kind === 155 /* ObjectLiteralExpression */; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 157 /* CallExpression */; + return context.contextNode.kind === 158 /* CallExpression */; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 158 /* NewExpression */; + return context.contextNode.kind === 159 /* NewExpression */; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -32999,38 +33831,38 @@ var ts; while (ts.isExpression(node)) { node = node.parent; } - return node.kind === 130 /* Decorator */; + return node.kind === 131 /* Decorator */; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 199 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 200 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind != 2 /* FormatOnEnter */; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 205 /* ModuleDeclaration */; + return context.contextNode.kind === 206 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 145 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 146 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; }; Rules.IsTypeArgumentOrParameter = function (token, parent) { if (token.kind !== 24 /* LessThanToken */ && token.kind !== 25 /* GreaterThanToken */) { return false; } switch (parent.kind) { - case 141 /* TypeReference */: - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: - case 157 /* CallExpression */: - case 158 /* NewExpression */: + case 142 /* TypeReference */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: return true; default: return false; @@ -33041,7 +33873,7 @@ var ts; Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 99 /* VoidKeyword */ && context.currentTokenParent.kind === 166 /* VoidExpression */; + return context.currentTokenSpan.kind === 99 /* VoidKeyword */ && context.currentTokenParent.kind === 167 /* VoidExpression */; }; return Rules; })(); @@ -33065,7 +33897,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 125 /* LastToken */ + 1; + this.mapRowLength = 126 /* LastToken */ + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); //new Array(this.mapRowLength * this.mapRowLength); // This array is used only during construction of the rulesbucket in the map var rulesBucketConstructionStateList = new Array(this.map.length); //new Array(this.map.length); @@ -33260,7 +34092,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0 /* FirstToken */; token <= 125 /* LastToken */; token++) { + for (var token = 0 /* FirstToken */; token <= 126 /* LastToken */; token++) { result.push(token); } return result; @@ -33302,9 +34134,9 @@ var ts; }; TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */])); - TokenRange.Keywords = TokenRange.FromRange(66 /* FirstKeyword */, 125 /* LastKeyword */); + TokenRange.Keywords = TokenRange.FromRange(66 /* FirstKeyword */, 126 /* LastKeyword */); TokenRange.BinaryOperators = TokenRange.FromRange(24 /* FirstBinaryOperator */, 64 /* LastBinaryOperator */); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([86 /* InKeyword */, 87 /* InstanceOfKeyword */, 125 /* OfKeyword */]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([86 /* InKeyword */, 87 /* InstanceOfKeyword */, 126 /* OfKeyword */]); TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([38 /* PlusPlusToken */, 39 /* MinusMinusToken */, 47 /* TildeToken */, 46 /* ExclamationToken */]); TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([7 /* NumericLiteral */, 65 /* Identifier */, 16 /* OpenParenToken */, 18 /* OpenBracketToken */, 14 /* OpenBraceToken */, 93 /* ThisKeyword */, 88 /* NewKeyword */]); TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([65 /* Identifier */, 16 /* OpenParenToken */, 93 /* ThisKeyword */, 88 /* NewKeyword */]); @@ -33312,7 +34144,7 @@ var ts; TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([65 /* Identifier */, 16 /* OpenParenToken */, 93 /* ThisKeyword */, 88 /* NewKeyword */]); TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([65 /* Identifier */, 17 /* CloseParenToken */, 19 /* CloseBracketToken */, 88 /* NewKeyword */]); TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]); - TokenRange.TypeNames = TokenRange.FromTokens([65 /* Identifier */, 119 /* NumberKeyword */, 121 /* StringKeyword */, 113 /* BooleanKeyword */, 122 /* SymbolKeyword */, 99 /* VoidKeyword */, 112 /* AnyKeyword */]); + TokenRange.TypeNames = TokenRange.FromTokens([65 /* Identifier */, 120 /* NumberKeyword */, 122 /* StringKeyword */, 113 /* BooleanKeyword */, 123 /* SymbolKeyword */, 99 /* VoidKeyword */, 112 /* AnyKeyword */]); return TokenRange; })(); Shared.TokenRange = TokenRange; @@ -33515,17 +34347,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 179 /* Block */ && ts.rangeContainsRange(body.statements, node); - case 227 /* SourceFile */: - case 179 /* Block */: - case 206 /* ModuleBlock */: + return body && body.kind === 180 /* Block */ && ts.rangeContainsRange(body.statements, node); + case 228 /* SourceFile */: + case 180 /* Block */: + case 207 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 223 /* CatchClause */: + case 224 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -33696,9 +34528,9 @@ var ts; // - source file // - switch\default clauses if (isSomeBlock(parent.kind) || - parent.kind === 227 /* SourceFile */ || - parent.kind === 220 /* CaseClause */ || - parent.kind === 221 /* DefaultClause */) { + parent.kind === 228 /* SourceFile */ || + parent.kind === 221 /* CaseClause */ || + parent.kind === 222 /* DefaultClause */) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -33732,19 +34564,19 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 201 /* ClassDeclaration */: return 69 /* ClassKeyword */; - case 202 /* InterfaceDeclaration */: return 103 /* InterfaceKeyword */; - case 200 /* FunctionDeclaration */: return 83 /* FunctionKeyword */; - case 204 /* EnumDeclaration */: return 204 /* EnumDeclaration */; - case 136 /* GetAccessor */: return 116 /* GetKeyword */; - case 137 /* SetAccessor */: return 120 /* SetKeyword */; - case 134 /* MethodDeclaration */: + case 202 /* ClassDeclaration */: return 69 /* ClassKeyword */; + case 203 /* InterfaceDeclaration */: return 103 /* InterfaceKeyword */; + case 201 /* FunctionDeclaration */: return 83 /* FunctionKeyword */; + case 205 /* EnumDeclaration */: return 205 /* EnumDeclaration */; + case 137 /* GetAccessor */: return 116 /* GetKeyword */; + case 138 /* SetAccessor */: return 121 /* SetKeyword */; + case 135 /* MethodDeclaration */: if (node.asteriskToken) { return 35 /* AsteriskToken */; } // fall-through - case 132 /* PropertyDeclaration */: - case 129 /* Parameter */: + case 133 /* PropertyDeclaration */: + case 130 /* Parameter */: return node.name.kind; } } @@ -33877,7 +34709,7 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 130 /* Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 131 /* Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; @@ -34199,20 +35031,20 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 179 /* Block */: - case 206 /* ModuleBlock */: + case 180 /* Block */: + case 207 /* ModuleBlock */: return true; } return false; } function getOpenTokenForList(node, list) { switch (node.kind) { - case 135 /* Constructor */: - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 163 /* ArrowFunction */: + case 136 /* Constructor */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 164 /* ArrowFunction */: if (node.typeParameters === list) { return 24 /* LessThanToken */; } @@ -34220,8 +35052,8 @@ var ts; return 16 /* OpenParenToken */; } break; - case 157 /* CallExpression */: - case 158 /* NewExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: if (node.typeArguments === list) { return 24 /* LessThanToken */; } @@ -34229,7 +35061,7 @@ var ts; return 16 /* OpenParenToken */; } break; - case 141 /* TypeReference */: + case 142 /* TypeReference */: if (node.typeArguments === list) { return 24 /* LessThanToken */; } @@ -34328,7 +35160,7 @@ var ts; return 0; } var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; - if (precedingToken.kind === 23 /* CommaToken */ && precedingToken.parent.kind !== 169 /* BinaryExpression */) { + if (precedingToken.kind === 23 /* CommaToken */ && precedingToken.parent.kind !== 170 /* BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Unknown */) { @@ -34439,7 +35271,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 227 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 228 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -34472,7 +35304,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 183 /* IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 184 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 76 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -34484,23 +35316,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 141 /* TypeReference */: + case 142 /* TypeReference */: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 154 /* ObjectLiteralExpression */: + case 155 /* ObjectLiteralExpression */: return node.parent.properties; - case 153 /* ArrayLiteralExpression */: + case 154 /* ArrayLiteralExpression */: return node.parent.elements; - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: { + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -34511,8 +35343,8 @@ var ts; } break; } - case 158 /* NewExpression */: - case 157 /* CallExpression */: { + case 159 /* NewExpression */: + case 158 /* CallExpression */: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -34591,28 +35423,28 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 204 /* EnumDeclaration */: - case 153 /* ArrayLiteralExpression */: - case 179 /* Block */: - case 206 /* ModuleBlock */: - case 154 /* ObjectLiteralExpression */: - case 145 /* TypeLiteral */: - case 147 /* TupleType */: - case 207 /* CaseBlock */: - case 221 /* DefaultClause */: - case 220 /* CaseClause */: - case 161 /* ParenthesizedExpression */: - case 157 /* CallExpression */: - case 158 /* NewExpression */: - case 180 /* VariableStatement */: - case 198 /* VariableDeclaration */: - case 214 /* ExportAssignment */: - case 191 /* ReturnStatement */: - case 170 /* ConditionalExpression */: - case 151 /* ArrayBindingPattern */: - case 150 /* ObjectBindingPattern */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 205 /* EnumDeclaration */: + case 154 /* ArrayLiteralExpression */: + case 180 /* Block */: + case 207 /* ModuleBlock */: + case 155 /* ObjectLiteralExpression */: + case 146 /* TypeLiteral */: + case 148 /* TupleType */: + case 208 /* CaseBlock */: + case 222 /* DefaultClause */: + case 221 /* CaseClause */: + case 162 /* ParenthesizedExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: + case 181 /* VariableStatement */: + case 199 /* VariableDeclaration */: + case 215 /* ExportAssignment */: + case 192 /* ReturnStatement */: + case 171 /* ConditionalExpression */: + case 152 /* ArrayBindingPattern */: + case 151 /* ObjectBindingPattern */: return true; } return false; @@ -34622,22 +35454,22 @@ var ts; return true; } switch (parent) { - case 184 /* DoStatement */: - case 185 /* WhileStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 186 /* ForStatement */: - case 183 /* IfStatement */: - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 138 /* CallSignature */: - case 163 /* ArrowFunction */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - return child !== 179 /* Block */; + case 185 /* DoStatement */: + case 186 /* WhileStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 187 /* ForStatement */: + case 184 /* IfStatement */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 139 /* CallSignature */: + case 164 /* ArrowFunction */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + return child !== 180 /* Block */; default: return false; } @@ -34647,7 +35479,7 @@ var ts; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); /// -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; @@ -34742,7 +35574,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(228 /* SyntaxList */, nodes.pos, nodes.end, 1024 /* Synthetic */, this); + var list = createNode(229 /* SyntaxList */, nodes.pos, nodes.end, 1024 /* Synthetic */, this); list._children = []; var pos = nodes.pos; for (var _i = 0; _i < nodes.length; _i++) { @@ -34761,7 +35593,7 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 126 /* FirstNode */) { + if (this.kind >= 127 /* FirstNode */) { scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos = this.pos; @@ -34806,7 +35638,7 @@ var ts; var children = this.getChildren(); for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; - if (child.kind < 126 /* FirstNode */) { + if (child.kind < 127 /* FirstNode */) { return child; } return child.getFirstToken(sourceFile); @@ -34816,7 +35648,7 @@ var ts; var children = this.getChildren(sourceFile); for (var i = children.length - 1; i >= 0; i--) { var child = children[i]; - if (child.kind < 126 /* FirstNode */) { + if (child.kind < 127 /* FirstNode */) { return child; } return child.getLastToken(sourceFile); @@ -34869,7 +35701,7 @@ var ts; if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); // If it is parameter - try and get the jsDoc comment with @param tag from function declaration's jsDoc comments - if (canUseParsedParamTagComments && declaration.kind === 129 /* Parameter */) { + if (canUseParsedParamTagComments && declaration.kind === 130 /* Parameter */) { ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedParamJsDocComment) { @@ -34878,15 +35710,15 @@ var ts; }); } // If this is left side of dotted module declaration, there is no doc comments associated with this node - if (declaration.kind === 205 /* ModuleDeclaration */ && declaration.body.kind === 205 /* ModuleDeclaration */) { + if (declaration.kind === 206 /* ModuleDeclaration */ && declaration.body.kind === 206 /* ModuleDeclaration */) { return; } // If this is dotted module name, get the doc comments from the parent - while (declaration.kind === 205 /* ModuleDeclaration */ && declaration.parent.kind === 205 /* ModuleDeclaration */) { + while (declaration.kind === 206 /* ModuleDeclaration */ && declaration.parent.kind === 206 /* ModuleDeclaration */) { declaration = declaration.parent; } // Get the cleaned js doc comment text from the declaration - ts.forEach(getJsDocCommentTextRange(declaration.kind === 198 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 199 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); @@ -35225,9 +36057,9 @@ var ts; if (result_2 !== undefined) { return result_2; } - if (declaration.name.kind === 127 /* ComputedPropertyName */) { + if (declaration.name.kind === 128 /* ComputedPropertyName */) { var expr = declaration.name.expression; - if (expr.kind === 155 /* PropertyAccessExpression */) { + if (expr.kind === 156 /* PropertyAccessExpression */) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -35247,9 +36079,9 @@ var ts; } function visit(node) { switch (node.kind) { - case 200 /* FunctionDeclaration */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 201 /* FunctionDeclaration */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -35269,60 +36101,60 @@ var ts; ts.forEachChild(node, visit); } break; - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 203 /* TypeAliasDeclaration */: - case 204 /* EnumDeclaration */: - case 205 /* ModuleDeclaration */: - case 208 /* ImportEqualsDeclaration */: - case 217 /* ExportSpecifier */: - case 213 /* ImportSpecifier */: - case 208 /* ImportEqualsDeclaration */: - case 210 /* ImportClause */: - case 211 /* NamespaceImport */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 145 /* TypeLiteral */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 204 /* TypeAliasDeclaration */: + case 205 /* EnumDeclaration */: + case 206 /* ModuleDeclaration */: + case 209 /* ImportEqualsDeclaration */: + case 218 /* ExportSpecifier */: + case 214 /* ImportSpecifier */: + case 209 /* ImportEqualsDeclaration */: + case 211 /* ImportClause */: + case 212 /* NamespaceImport */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 146 /* TypeLiteral */: addDeclaration(node); // fall through - case 135 /* Constructor */: - case 180 /* VariableStatement */: - case 199 /* VariableDeclarationList */: - case 150 /* ObjectBindingPattern */: - case 151 /* ArrayBindingPattern */: - case 206 /* ModuleBlock */: + case 136 /* Constructor */: + case 181 /* VariableStatement */: + case 200 /* VariableDeclarationList */: + case 151 /* ObjectBindingPattern */: + case 152 /* ArrayBindingPattern */: + case 207 /* ModuleBlock */: ts.forEachChild(node, visit); break; - case 179 /* Block */: + case 180 /* Block */: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } break; - case 129 /* Parameter */: + case 130 /* Parameter */: // Only consider properties defined as constructor parameters if (!(node.flags & 112 /* AccessibilityModifier */)) { break; } // fall through - case 198 /* VariableDeclaration */: - case 152 /* BindingElement */: + case 199 /* VariableDeclaration */: + case 153 /* BindingElement */: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 226 /* EnumMember */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 227 /* EnumMember */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: addDeclaration(node); break; - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -35334,7 +36166,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 211 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 212 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -35393,7 +36225,7 @@ var ts; })(ts.OutputFileType || (ts.OutputFileType = {})); var OutputFileType = ts.OutputFileType; (function (EndOfLineState) { - EndOfLineState[EndOfLineState["Start"] = 0] = "Start"; + EndOfLineState[EndOfLineState["None"] = 0] = "None"; EndOfLineState[EndOfLineState["InMultiLineCommentTrivia"] = 1] = "InMultiLineCommentTrivia"; EndOfLineState[EndOfLineState["InSingleQuoteStringLiteral"] = 2] = "InSingleQuoteStringLiteral"; EndOfLineState[EndOfLineState["InDoubleQuoteStringLiteral"] = 3] = "InDoubleQuoteStringLiteral"; @@ -35495,10 +36327,31 @@ var ts; ClassificationTypeNames.interfaceName = "interface name"; ClassificationTypeNames.moduleName = "module name"; ClassificationTypeNames.typeParameterName = "type parameter name"; - ClassificationTypeNames.typeAlias = "type alias name"; + ClassificationTypeNames.typeAliasName = "type alias name"; + ClassificationTypeNames.parameterName = "parameter name"; return ClassificationTypeNames; })(); ts.ClassificationTypeNames = ClassificationTypeNames; + (function (ClassificationType) { + ClassificationType[ClassificationType["comment"] = 1] = "comment"; + ClassificationType[ClassificationType["identifier"] = 2] = "identifier"; + ClassificationType[ClassificationType["keyword"] = 3] = "keyword"; + ClassificationType[ClassificationType["numericLiteral"] = 4] = "numericLiteral"; + ClassificationType[ClassificationType["operator"] = 5] = "operator"; + ClassificationType[ClassificationType["stringLiteral"] = 6] = "stringLiteral"; + ClassificationType[ClassificationType["regularExpressionLiteral"] = 7] = "regularExpressionLiteral"; + ClassificationType[ClassificationType["whiteSpace"] = 8] = "whiteSpace"; + ClassificationType[ClassificationType["text"] = 9] = "text"; + ClassificationType[ClassificationType["punctuation"] = 10] = "punctuation"; + ClassificationType[ClassificationType["className"] = 11] = "className"; + ClassificationType[ClassificationType["enumName"] = 12] = "enumName"; + ClassificationType[ClassificationType["interfaceName"] = 13] = "interfaceName"; + ClassificationType[ClassificationType["moduleName"] = 14] = "moduleName"; + ClassificationType[ClassificationType["typeParameterName"] = 15] = "typeParameterName"; + ClassificationType[ClassificationType["typeAliasName"] = 16] = "typeAliasName"; + ClassificationType[ClassificationType["parameterName"] = 17] = "parameterName"; + })(ts.ClassificationType || (ts.ClassificationType = {})); + var ClassificationType = ts.ClassificationType; function displayPartsToString(displayParts) { if (displayParts) { return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join(""); @@ -35512,16 +36365,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 162 /* FunctionExpression */) { + if (declaration.kind === 163 /* FunctionExpression */) { return true; } - if (declaration.kind !== 198 /* VariableDeclaration */ && declaration.kind !== 200 /* FunctionDeclaration */) { + if (declaration.kind !== 199 /* VariableDeclaration */ && declaration.kind !== 201 /* FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable for (var parent_7 = declaration.parent; !ts.isFunctionBlock(parent_7); parent_7 = parent_7.parent) { // Reached source file or module block - if (parent_7.kind === 227 /* SourceFile */ || parent_7.kind === 206 /* ModuleBlock */) { + if (parent_7.kind === 228 /* SourceFile */ || parent_7.kind === 207 /* ModuleBlock */) { return false; } } @@ -35873,7 +36726,7 @@ var ts; else { if (token === 65 /* Identifier */) { token = scanner.scan(); - if (token === 124 /* FromKeyword */) { + if (token === 125 /* FromKeyword */) { token = scanner.scan(); if (token === 8 /* StringLiteral */) { // import d from "mod"; @@ -35883,7 +36736,7 @@ var ts; } else if (token === 53 /* EqualsToken */) { token = scanner.scan(); - if (token === 118 /* RequireKeyword */) { + if (token === 119 /* RequireKeyword */) { token = scanner.scan(); if (token === 16 /* OpenParenToken */) { token = scanner.scan(); @@ -35912,7 +36765,7 @@ var ts; } if (token === 15 /* CloseBraceToken */) { token = scanner.scan(); - if (token === 124 /* FromKeyword */) { + if (token === 125 /* FromKeyword */) { token = scanner.scan(); if (token === 8 /* StringLiteral */) { // import {a as A} from "mod"; @@ -35928,7 +36781,7 @@ var ts; token = scanner.scan(); if (token === 65 /* Identifier */) { token = scanner.scan(); - if (token === 124 /* FromKeyword */) { + if (token === 125 /* FromKeyword */) { token = scanner.scan(); if (token === 8 /* StringLiteral */) { // import * as NS from "mod" @@ -35951,7 +36804,7 @@ var ts; } if (token === 15 /* CloseBraceToken */) { token = scanner.scan(); - if (token === 124 /* FromKeyword */) { + if (token === 125 /* FromKeyword */) { token = scanner.scan(); if (token === 8 /* StringLiteral */) { // export {a as A} from "mod"; @@ -35963,7 +36816,7 @@ var ts; } else if (token === 35 /* AsteriskToken */) { token = scanner.scan(); - if (token === 124 /* FromKeyword */) { + if (token === 125 /* FromKeyword */) { token = scanner.scan(); if (token === 8 /* StringLiteral */) { // export * from "mod" @@ -35986,7 +36839,7 @@ var ts; /// Helpers function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 194 /* LabeledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 195 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -35995,12 +36848,12 @@ var ts; } function isJumpStatementTarget(node) { return node.kind === 65 /* Identifier */ && - (node.parent.kind === 190 /* BreakStatement */ || node.parent.kind === 189 /* ContinueStatement */) && + (node.parent.kind === 191 /* BreakStatement */ || node.parent.kind === 190 /* ContinueStatement */) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { return node.kind === 65 /* Identifier */ && - node.parent.kind === 194 /* LabeledStatement */ && + node.parent.kind === 195 /* LabeledStatement */ && node.parent.label === node; } /** @@ -36008,7 +36861,7 @@ var ts; * Note: 'node' cannot be a SourceFile. */ function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 194 /* LabeledStatement */; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 195 /* LabeledStatement */; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -36019,25 +36872,25 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 126 /* QualifiedName */ && node.parent.right === node; + return node.parent.kind === 127 /* QualifiedName */ && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 155 /* PropertyAccessExpression */ && node.parent.name === node; + return node && node.parent && node.parent.kind === 156 /* PropertyAccessExpression */ && node.parent.name === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 157 /* CallExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 158 /* CallExpression */ && node.parent.expression === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 158 /* NewExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 159 /* NewExpression */ && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 205 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 206 /* ModuleDeclaration */ && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { return node.kind === 65 /* Identifier */ && @@ -36046,22 +36899,22 @@ var ts; /** Returns true if node is a name of an object literal property, e.g. "a" in x = { "a": 1 } */ function isNameOfPropertyAssignment(node) { return (node.kind === 65 /* Identifier */ || node.kind === 8 /* StringLiteral */ || node.kind === 7 /* NumericLiteral */) && - (node.parent.kind === 224 /* PropertyAssignment */ || node.parent.kind === 225 /* ShorthandPropertyAssignment */) && node.parent.name === node; + (node.parent.kind === 225 /* PropertyAssignment */ || node.parent.kind === 226 /* ShorthandPropertyAssignment */) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 8 /* StringLiteral */ || node.kind === 7 /* NumericLiteral */) { switch (node.parent.kind) { - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 224 /* PropertyAssignment */: - case 226 /* EnumMember */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 205 /* ModuleDeclaration */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 225 /* PropertyAssignment */: + case 227 /* EnumMember */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 206 /* ModuleDeclaration */: return node.parent.name === node; - case 156 /* ElementAccessExpression */: + case 157 /* ElementAccessExpression */: return node.parent.argumentExpression === node; } } @@ -36120,7 +36973,7 @@ var ts; })(BreakContinueSearchType || (BreakContinueSearchType = {})); // A cache of completion entries for keywords, these do not change between sessions var keywordCompletions = []; - for (var i = 66 /* FirstKeyword */; i <= 125 /* LastKeyword */; i++) { + for (var i = 66 /* FirstKeyword */; i <= 126 /* LastKeyword */; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ScriptElementKind.keyword, @@ -36135,17 +36988,17 @@ var ts; return undefined; } switch (node.kind) { - case 227 /* SourceFile */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 204 /* EnumDeclaration */: - case 205 /* ModuleDeclaration */: + case 228 /* SourceFile */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 205 /* EnumDeclaration */: + case 206 /* ModuleDeclaration */: return node; } } @@ -36153,38 +37006,38 @@ var ts; ts.getContainerNode = getContainerNode; /* @internal */ function getNodeKind(node) { switch (node.kind) { - case 205 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; - case 201 /* ClassDeclaration */: return ScriptElementKind.classElement; - case 202 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; - case 203 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; - case 204 /* EnumDeclaration */: return ScriptElementKind.enumElement; - case 198 /* VariableDeclaration */: + case 206 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; + case 202 /* ClassDeclaration */: return ScriptElementKind.classElement; + case 203 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; + case 204 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; + case 205 /* EnumDeclaration */: return ScriptElementKind.enumElement; + case 199 /* VariableDeclaration */: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 200 /* FunctionDeclaration */: return ScriptElementKind.functionElement; - case 136 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; - case 137 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 201 /* FunctionDeclaration */: return ScriptElementKind.functionElement; + case 137 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; + case 138 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: return ScriptElementKind.memberFunctionElement; - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: return ScriptElementKind.memberVariableElement; - case 140 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; - case 139 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; - case 138 /* CallSignature */: return ScriptElementKind.callSignatureElement; - case 135 /* Constructor */: return ScriptElementKind.constructorImplementationElement; - case 128 /* TypeParameter */: return ScriptElementKind.typeParameterElement; - case 226 /* EnumMember */: return ScriptElementKind.variableElement; - case 129 /* Parameter */: return (node.flags & 112 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 208 /* ImportEqualsDeclaration */: - case 213 /* ImportSpecifier */: - case 210 /* ImportClause */: - case 217 /* ExportSpecifier */: - case 211 /* NamespaceImport */: + case 141 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; + case 140 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; + case 139 /* CallSignature */: return ScriptElementKind.callSignatureElement; + case 136 /* Constructor */: return ScriptElementKind.constructorImplementationElement; + case 129 /* TypeParameter */: return ScriptElementKind.typeParameterElement; + case 227 /* EnumMember */: return ScriptElementKind.variableElement; + case 130 /* Parameter */: return (node.flags & 112 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 209 /* ImportEqualsDeclaration */: + case 214 /* ImportSpecifier */: + case 211 /* ImportClause */: + case 218 /* ExportSpecifier */: + case 212 /* NamespaceImport */: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -36385,44 +37238,44 @@ var ts; return false; } switch (node.kind) { - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return true; - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return true; - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: var classDeclaration = node; if (checkModifiers(classDeclaration.modifiers) || checkTypeParameters(classDeclaration.typeParameters)) { return true; } break; - case 222 /* HeritageClause */: + case 223 /* HeritageClause */: var heritageClause = node; if (heritageClause.token === 102 /* ImplementsKeyword */) { diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return true; } break; - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return true; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return true; - case 203 /* TypeAliasDeclaration */: + case 204 /* TypeAliasDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return true; - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 162 /* FunctionExpression */: - case 200 /* FunctionDeclaration */: - case 163 /* ArrowFunction */: - case 200 /* FunctionDeclaration */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 163 /* FunctionExpression */: + case 201 /* FunctionDeclaration */: + case 164 /* ArrowFunction */: + case 201 /* FunctionDeclaration */: var functionDeclaration = node; if (checkModifiers(functionDeclaration.modifiers) || checkTypeParameters(functionDeclaration.typeParameters) || @@ -36430,20 +37283,20 @@ var ts; return true; } break; - case 180 /* VariableStatement */: + case 181 /* VariableStatement */: var variableStatement = node; if (checkModifiers(variableStatement.modifiers)) { return true; } break; - case 198 /* VariableDeclaration */: + case 199 /* VariableDeclaration */: var variableDeclaration = node; if (checkTypeAnnotation(variableDeclaration.type)) { return true; } break; - case 157 /* CallExpression */: - case 158 /* NewExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: var expression = node; if (expression.typeArguments && expression.typeArguments.length > 0) { var start = expression.typeArguments.pos; @@ -36451,7 +37304,7 @@ var ts; return true; } break; - case 129 /* Parameter */: + case 130 /* Parameter */: var parameter = node; if (parameter.modifiers) { var start = parameter.modifiers.pos; @@ -36467,17 +37320,17 @@ var ts; return true; } break; - case 132 /* PropertyDeclaration */: + case 133 /* PropertyDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); return true; - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return true; - case 160 /* TypeAssertionExpression */: + case 161 /* TypeAssertionExpression */: var typeAssertionExpression = node; diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return true; - case 130 /* Decorator */: + case 131 /* Decorator */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.decorators_can_only_be_used_in_a_ts_file)); return true; } @@ -36610,11 +37463,11 @@ var ts; // visible symbols in the scope, and the node is the current location. var node = currentToken; var isRightOfDot = false; - if (contextToken && contextToken.kind === 20 /* DotToken */ && contextToken.parent.kind === 155 /* PropertyAccessExpression */) { + if (contextToken && contextToken.kind === 20 /* DotToken */ && contextToken.parent.kind === 156 /* PropertyAccessExpression */) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (contextToken && contextToken.kind === 20 /* DotToken */ && contextToken.parent.kind === 126 /* QualifiedName */) { + else if (contextToken && contextToken.kind === 20 /* DotToken */ && contextToken.parent.kind === 127 /* QualifiedName */) { node = contextToken.parent.left; isRightOfDot = true; } @@ -36641,7 +37494,7 @@ var ts; // Right of dot member completion list isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 65 /* Identifier */ || node.kind === 126 /* QualifiedName */ || node.kind === 155 /* PropertyAccessExpression */) { + if (node.kind === 65 /* Identifier */ || node.kind === 127 /* QualifiedName */ || node.kind === 156 /* PropertyAccessExpression */) { var symbol = typeChecker.getSymbolAtLocation(node); // This is an alias, follow what it aliases if (symbol && symbol.flags & 8388608 /* Alias */) { @@ -36683,13 +37536,13 @@ var ts; symbols = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties); } } - else if (ts.getAncestor(contextToken, 210 /* ImportClause */)) { + else if (ts.getAncestor(contextToken, 211 /* ImportClause */)) { // cursor is in import clause // try to show exported member for imported module isMemberCompletion = true; isNewIdentifierLocation = true; if (showCompletionsInImportsClause(contextToken)) { - var importDeclaration = ts.getAncestor(contextToken, 209 /* ImportDeclaration */); + var importDeclaration = ts.getAncestor(contextToken, 210 /* ImportDeclaration */); ts.Debug.assert(importDeclaration !== undefined); var exports; if (importDeclaration.moduleSpecifier) { @@ -36768,7 +37621,7 @@ var ts; // import {| // import {a,| if (node.kind === 14 /* OpenBraceToken */ || node.kind === 23 /* CommaToken */) { - return node.parent.kind === 212 /* NamedImports */; + return node.parent.kind === 213 /* NamedImports */; } } return false; @@ -36778,35 +37631,36 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23 /* CommaToken */: - return containingNodeKind === 157 /* CallExpression */ // func( a, | - || containingNodeKind === 135 /* Constructor */ // constructor( a, | public, protected, private keywords are allowed here, so show completion - || containingNodeKind === 158 /* NewExpression */ // new C(a, | - || containingNodeKind === 153 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 169 /* BinaryExpression */; // let x = (a, | + return containingNodeKind === 158 /* CallExpression */ // func( a, | + || containingNodeKind === 136 /* Constructor */ // constructor( a, | public, protected, private keywords are allowed here, so show completion + || containingNodeKind === 159 /* NewExpression */ // new C(a, | + || containingNodeKind === 154 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 170 /* BinaryExpression */; // let x = (a, | case 16 /* OpenParenToken */: - return containingNodeKind === 157 /* CallExpression */ // func( | - || containingNodeKind === 135 /* Constructor */ // constructor( | - || containingNodeKind === 158 /* NewExpression */ // new C(a| - || containingNodeKind === 161 /* ParenthesizedExpression */; // let x = (a| + return containingNodeKind === 158 /* CallExpression */ // func( | + || containingNodeKind === 136 /* Constructor */ // constructor( | + || containingNodeKind === 159 /* NewExpression */ // new C(a| + || containingNodeKind === 162 /* ParenthesizedExpression */; // let x = (a| case 18 /* OpenBracketToken */: - return containingNodeKind === 153 /* ArrayLiteralExpression */; // [ | - case 117 /* ModuleKeyword */: + return containingNodeKind === 154 /* ArrayLiteralExpression */; // [ | + case 117 /* ModuleKeyword */: // module | + case 118 /* NamespaceKeyword */: return true; case 20 /* DotToken */: - return containingNodeKind === 205 /* ModuleDeclaration */; // module A.| + return containingNodeKind === 206 /* ModuleDeclaration */; // module A.| case 14 /* OpenBraceToken */: - return containingNodeKind === 201 /* ClassDeclaration */; // class A{ | + return containingNodeKind === 202 /* ClassDeclaration */; // class A{ | case 53 /* EqualsToken */: - return containingNodeKind === 198 /* VariableDeclaration */ // let x = a| - || containingNodeKind === 169 /* BinaryExpression */; // x = a| + return containingNodeKind === 199 /* VariableDeclaration */ // let x = a| + || containingNodeKind === 170 /* BinaryExpression */; // x = a| case 11 /* TemplateHead */: - return containingNodeKind === 171 /* TemplateExpression */; // `aa ${| + return containingNodeKind === 172 /* TemplateExpression */; // `aa ${| case 12 /* TemplateMiddle */: - return containingNodeKind === 176 /* TemplateSpan */; // `aa ${10} dd ${| + return containingNodeKind === 178 /* TemplateSpan */; // `aa ${10} dd ${| case 108 /* PublicKeyword */: case 106 /* PrivateKeyword */: case 107 /* ProtectedKeyword */: - return containingNodeKind === 132 /* PropertyDeclaration */; // class A{ public | + return containingNodeKind === 133 /* PropertyDeclaration */; // class A{ public | } // Previous token may have been a keyword that was converted to an identifier. switch (previousToken.getText()) { @@ -36842,7 +37696,7 @@ var ts; switch (previousToken.kind) { case 14 /* OpenBraceToken */: // let x = { | case 23 /* CommaToken */: - if (parent_8 && parent_8.kind === 154 /* ObjectLiteralExpression */) { + if (parent_8 && parent_8.kind === 155 /* ObjectLiteralExpression */) { return parent_8; } break; @@ -36852,16 +37706,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: - case 200 /* FunctionDeclaration */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: - case 140 /* IndexSignature */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: + case 201 /* FunctionDeclaration */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: + case 141 /* IndexSignature */: return true; } return false; @@ -36871,56 +37725,56 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23 /* CommaToken */: - return containingNodeKind === 198 /* VariableDeclaration */ || - containingNodeKind === 199 /* VariableDeclarationList */ || - containingNodeKind === 180 /* VariableStatement */ || - containingNodeKind === 204 /* EnumDeclaration */ || + return containingNodeKind === 199 /* VariableDeclaration */ || + containingNodeKind === 200 /* VariableDeclarationList */ || + containingNodeKind === 181 /* VariableStatement */ || + containingNodeKind === 205 /* EnumDeclaration */ || isFunction(containingNodeKind) || - containingNodeKind === 201 /* ClassDeclaration */ || - containingNodeKind === 200 /* FunctionDeclaration */ || - containingNodeKind === 202 /* InterfaceDeclaration */ || - containingNodeKind === 151 /* ArrayBindingPattern */ || - containingNodeKind === 150 /* ObjectBindingPattern */; // function func({ x, y| + containingNodeKind === 202 /* ClassDeclaration */ || + containingNodeKind === 201 /* FunctionDeclaration */ || + containingNodeKind === 203 /* InterfaceDeclaration */ || + containingNodeKind === 152 /* ArrayBindingPattern */ || + containingNodeKind === 151 /* ObjectBindingPattern */; // function func({ x, y| case 20 /* DotToken */: - return containingNodeKind === 151 /* ArrayBindingPattern */; // var [.| + return containingNodeKind === 152 /* ArrayBindingPattern */; // var [.| case 18 /* OpenBracketToken */: - return containingNodeKind === 151 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 152 /* ArrayBindingPattern */; // var [x| case 16 /* OpenParenToken */: - return containingNodeKind === 223 /* CatchClause */ || + return containingNodeKind === 224 /* CatchClause */ || isFunction(containingNodeKind); case 14 /* OpenBraceToken */: - return containingNodeKind === 204 /* EnumDeclaration */ || - containingNodeKind === 202 /* InterfaceDeclaration */ || - containingNodeKind === 145 /* TypeLiteral */ || - containingNodeKind === 150 /* ObjectBindingPattern */; // function func({ x| + return containingNodeKind === 205 /* EnumDeclaration */ || + containingNodeKind === 203 /* InterfaceDeclaration */ || + containingNodeKind === 146 /* TypeLiteral */ || + containingNodeKind === 151 /* ObjectBindingPattern */; // function func({ x| case 22 /* SemicolonToken */: - return containingNodeKind === 131 /* PropertySignature */ && + return containingNodeKind === 132 /* PropertySignature */ && previousToken.parent && previousToken.parent.parent && - (previousToken.parent.parent.kind === 202 /* InterfaceDeclaration */ || - previousToken.parent.parent.kind === 145 /* TypeLiteral */); // let x : { a; | + (previousToken.parent.parent.kind === 203 /* InterfaceDeclaration */ || + previousToken.parent.parent.kind === 146 /* TypeLiteral */); // let x : { a; | case 24 /* LessThanToken */: - return containingNodeKind === 201 /* ClassDeclaration */ || - containingNodeKind === 200 /* FunctionDeclaration */ || - containingNodeKind === 202 /* InterfaceDeclaration */ || + return containingNodeKind === 202 /* ClassDeclaration */ || + containingNodeKind === 201 /* FunctionDeclaration */ || + containingNodeKind === 203 /* InterfaceDeclaration */ || isFunction(containingNodeKind); case 109 /* StaticKeyword */: - return containingNodeKind === 132 /* PropertyDeclaration */; + return containingNodeKind === 133 /* PropertyDeclaration */; case 21 /* DotDotDotToken */: - return containingNodeKind === 129 /* Parameter */ || - containingNodeKind === 135 /* Constructor */ || + return containingNodeKind === 130 /* Parameter */ || + containingNodeKind === 136 /* Constructor */ || (previousToken.parent && previousToken.parent.parent && - previousToken.parent.parent.kind === 151 /* ArrayBindingPattern */); // var [ ...z| + previousToken.parent.parent.kind === 152 /* ArrayBindingPattern */); // var [ ...z| case 108 /* PublicKeyword */: case 106 /* PrivateKeyword */: case 107 /* ProtectedKeyword */: - return containingNodeKind === 129 /* Parameter */; + return containingNodeKind === 130 /* Parameter */; case 69 /* ClassKeyword */: case 77 /* EnumKeyword */: case 103 /* InterfaceKeyword */: case 83 /* FunctionKeyword */: case 98 /* VarKeyword */: case 116 /* GetKeyword */: - case 120 /* SetKeyword */: + case 121 /* SetKeyword */: case 85 /* ImportKeyword */: case 104 /* LetKeyword */: case 70 /* ConstKeyword */: @@ -36956,7 +37810,7 @@ var ts; return exports; } if (importDeclaration.importClause.namedBindings && - importDeclaration.importClause.namedBindings.kind === 212 /* NamedImports */) { + importDeclaration.importClause.namedBindings.kind === 213 /* NamedImports */) { ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) { var name = el.propertyName || el.name; exisingImports[name.text] = true; @@ -36973,7 +37827,7 @@ var ts; } var existingMemberNames = {}; ts.forEach(existingMembers, function (m) { - if (m.kind !== 224 /* PropertyAssignment */ && m.kind !== 225 /* ShorthandPropertyAssignment */) { + if (m.kind !== 225 /* PropertyAssignment */ && m.kind !== 226 /* ShorthandPropertyAssignment */) { // Ignore omitted expressions for missing members in the object literal return; } @@ -37023,10 +37877,10 @@ var ts; for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; var nameTable = getNameTable(sourceFile); - for (var name_24 in nameTable) { - if (!allNames[name_24]) { - allNames[name_24] = name_24; - var displayName = getCompletionEntryDisplayName(name_24, target, true); + for (var name_25 in nameTable) { + if (!allNames[name_25]) { + allNames[name_25] = name_25; + var displayName = getCompletionEntryDisplayName(name_25, target, true); if (displayName) { var entry = { name: displayName, @@ -37241,7 +38095,7 @@ var ts; var signature; type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 155 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 156 /* PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -37250,7 +38104,7 @@ var ts; } // try get the call/construct signature from the type if it matches var callExpression; - if (location.kind === 157 /* CallExpression */ || location.kind === 158 /* NewExpression */) { + if (location.kind === 158 /* CallExpression */ || location.kind === 159 /* NewExpression */) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -37263,7 +38117,7 @@ var ts; // Use the first candidate: signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 158 /* NewExpression */ || callExpression.expression.kind === 91 /* SuperKeyword */; + var useConstructSignatures = callExpression.kind === 159 /* NewExpression */ || callExpression.expression.kind === 91 /* SuperKeyword */; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target || signature)) { // Get the first signature if there @@ -37315,24 +38169,24 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) || - (location.kind === 114 /* ConstructorKeyword */ && location.parent.kind === 135 /* Constructor */)) { + (location.kind === 114 /* ConstructorKeyword */ && location.parent.kind === 136 /* Constructor */)) { // get the signature from the declaration and write it var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 135 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 136 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 135 /* Constructor */) { + if (functionDeclaration.kind === 136 /* Constructor */) { // show (constructor) Type(...) signature symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 138 /* CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 139 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -37355,7 +38209,7 @@ var ts; } if (symbolFlags & 524288 /* TypeAlias */) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(123 /* TypeKeyword */)); + displayParts.push(ts.keywordPart(124 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); displayParts.push(ts.spacePart()); @@ -37375,7 +38229,9 @@ var ts; } if (symbolFlags & 1536 /* Module */) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(117 /* ModuleKeyword */)); + var declaration = ts.getDeclarationOfKind(symbol, 206 /* ModuleDeclaration */); + var isNamespace = declaration && declaration.name && declaration.name.kind === 65 /* Identifier */; + displayParts.push(ts.keywordPart(isNamespace ? 118 /* NamespaceKeyword */ : 117 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } @@ -37396,13 +38252,13 @@ var ts; } else { // Method/function type parameter - var signatureDeclaration = ts.getDeclarationOfKind(symbol, 128 /* TypeParameter */).parent; + var signatureDeclaration = ts.getDeclarationOfKind(symbol, 129 /* TypeParameter */).parent; var signature = typeChecker.getSignatureFromDeclaration(signatureDeclaration); - if (signatureDeclaration.kind === 139 /* ConstructSignature */) { + if (signatureDeclaration.kind === 140 /* ConstructSignature */) { displayParts.push(ts.keywordPart(88 /* NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (signatureDeclaration.kind !== 138 /* CallSignature */ && signatureDeclaration.name) { + else if (signatureDeclaration.kind !== 139 /* CallSignature */ && signatureDeclaration.name) { addFullSymbolName(signatureDeclaration.symbol); } displayParts.push.apply(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); @@ -37411,7 +38267,7 @@ var ts; if (symbolFlags & 8 /* EnumMember */) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 226 /* EnumMember */) { + if (declaration.kind === 227 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -37427,13 +38283,13 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 208 /* ImportEqualsDeclaration */) { + if (declaration.kind === 209 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); displayParts.push(ts.operatorPart(53 /* EqualsToken */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(118 /* RequireKeyword */)); + displayParts.push(ts.keywordPart(119 /* RequireKeyword */)); displayParts.push(ts.punctuationPart(16 /* OpenParenToken */)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(17 /* CloseParenToken */)); @@ -37560,8 +38416,8 @@ var ts; // Try getting just type at this position and show switch (node.kind) { case 65 /* Identifier */: - case 155 /* PropertyAccessExpression */: - case 126 /* QualifiedName */: + case 156 /* PropertyAccessExpression */: + case 127 /* QualifiedName */: case 93 /* ThisKeyword */: case 91 /* SuperKeyword */: // For the identifiers/this/super etc get the type at position @@ -37649,7 +38505,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 225 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 226 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -37680,7 +38536,7 @@ var ts; if (isNewExpressionTarget(location) || location.kind === 114 /* ConstructorKeyword */) { if (symbol.flags & 32 /* Class */) { var classDeclaration = symbol.getDeclarations()[0]; - ts.Debug.assert(classDeclaration && classDeclaration.kind === 201 /* ClassDeclaration */); + ts.Debug.assert(classDeclaration && classDeclaration.kind === 202 /* ClassDeclaration */); return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); } } @@ -37696,8 +38552,8 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 135 /* Constructor */) || - (!selectConstructors && (d.kind === 200 /* FunctionDeclaration */ || d.kind === 134 /* MethodDeclaration */ || d.kind === 133 /* MethodSignature */))) { + if ((selectConstructors && d.kind === 136 /* Constructor */) || + (!selectConstructors && (d.kind === 201 /* FunctionDeclaration */ || d.kind === 135 /* MethodDeclaration */ || d.kind === 134 /* MethodSignature */))) { declarations.push(d); if (d.body) definition = d; @@ -37799,74 +38655,74 @@ var ts; switch (node.kind) { case 84 /* IfKeyword */: case 76 /* ElseKeyword */: - if (hasKind(node.parent, 183 /* IfStatement */)) { + if (hasKind(node.parent, 184 /* IfStatement */)) { return getIfElseOccurrences(node.parent); } break; case 90 /* ReturnKeyword */: - if (hasKind(node.parent, 191 /* ReturnStatement */)) { + if (hasKind(node.parent, 192 /* ReturnStatement */)) { return getReturnOccurrences(node.parent); } break; case 94 /* ThrowKeyword */: - if (hasKind(node.parent, 195 /* ThrowStatement */)) { + if (hasKind(node.parent, 196 /* ThrowStatement */)) { return getThrowOccurrences(node.parent); } break; case 68 /* CatchKeyword */: - if (hasKind(parent(parent(node)), 196 /* TryStatement */)) { + if (hasKind(parent(parent(node)), 197 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 96 /* TryKeyword */: case 81 /* FinallyKeyword */: - if (hasKind(parent(node), 196 /* TryStatement */)) { + if (hasKind(parent(node), 197 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 92 /* SwitchKeyword */: - if (hasKind(node.parent, 193 /* SwitchStatement */)) { + if (hasKind(node.parent, 194 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 67 /* CaseKeyword */: case 73 /* DefaultKeyword */: - if (hasKind(parent(parent(parent(node))), 193 /* SwitchStatement */)) { + if (hasKind(parent(parent(parent(node))), 194 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 66 /* BreakKeyword */: case 71 /* ContinueKeyword */: - if (hasKind(node.parent, 190 /* BreakStatement */) || hasKind(node.parent, 189 /* ContinueStatement */)) { + if (hasKind(node.parent, 191 /* BreakStatement */) || hasKind(node.parent, 190 /* ContinueStatement */)) { return getBreakOrContinueStatementOccurences(node.parent); } break; case 82 /* ForKeyword */: - if (hasKind(node.parent, 186 /* ForStatement */) || - hasKind(node.parent, 187 /* ForInStatement */) || - hasKind(node.parent, 188 /* ForOfStatement */)) { + if (hasKind(node.parent, 187 /* ForStatement */) || + hasKind(node.parent, 188 /* ForInStatement */) || + hasKind(node.parent, 189 /* ForOfStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 100 /* WhileKeyword */: case 75 /* DoKeyword */: - if (hasKind(node.parent, 185 /* WhileStatement */) || hasKind(node.parent, 184 /* DoStatement */)) { + if (hasKind(node.parent, 186 /* WhileStatement */) || hasKind(node.parent, 185 /* DoStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 114 /* ConstructorKeyword */: - if (hasKind(node.parent, 135 /* Constructor */)) { + if (hasKind(node.parent, 136 /* Constructor */)) { return getConstructorOccurrences(node.parent); } break; case 116 /* GetKeyword */: - case 120 /* SetKeyword */: - if (hasKind(node.parent, 136 /* GetAccessor */) || hasKind(node.parent, 137 /* SetAccessor */)) { + case 121 /* SetKeyword */: + if (hasKind(node.parent, 137 /* GetAccessor */) || hasKind(node.parent, 138 /* SetAccessor */)) { return getGetAndSetOccurrences(node.parent); } default: if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 180 /* VariableStatement */)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 181 /* VariableStatement */)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -37882,10 +38738,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 195 /* ThrowStatement */) { + if (node.kind === 196 /* ThrowStatement */) { statementAccumulator.push(node); } - else if (node.kind === 196 /* TryStatement */) { + else if (node.kind === 197 /* TryStatement */) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -37914,12 +38770,12 @@ var ts; var child = throwStatement; while (child.parent) { var parent_9 = child.parent; - if (ts.isFunctionBlock(parent_9) || parent_9.kind === 227 /* SourceFile */) { + if (ts.isFunctionBlock(parent_9) || parent_9.kind === 228 /* SourceFile */) { return parent_9; } // A throw-statement is only owned by a try-statement if the try-statement has // a catch clause, and if the throw-statement occurs within the try block. - if (parent_9.kind === 196 /* TryStatement */) { + if (parent_9.kind === 197 /* TryStatement */) { var tryStatement = parent_9; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; @@ -37934,7 +38790,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 190 /* BreakStatement */ || node.kind === 189 /* ContinueStatement */) { + if (node.kind === 191 /* BreakStatement */ || node.kind === 190 /* ContinueStatement */) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -37950,16 +38806,16 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { switch (node_1.kind) { - case 193 /* SwitchStatement */: - if (statement.kind === 189 /* ContinueStatement */) { + case 194 /* SwitchStatement */: + if (statement.kind === 190 /* ContinueStatement */) { continue; } // Fall through. - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 185 /* WhileStatement */: - case 184 /* DoStatement */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 186 /* WhileStatement */: + case 185 /* DoStatement */: if (!statement.label || isLabeledBy(node_1, statement.label.text)) { return node_1; } @@ -37978,18 +38834,18 @@ var ts; var container = declaration.parent; // Make sure we only highlight the keyword when it makes sense to do so. if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 201 /* ClassDeclaration */ || - (declaration.kind === 129 /* Parameter */ && hasKind(container, 135 /* Constructor */)))) { + if (!(container.kind === 202 /* ClassDeclaration */ || + (declaration.kind === 130 /* Parameter */ && hasKind(container, 136 /* Constructor */)))) { return undefined; } } else if (modifier === 109 /* StaticKeyword */) { - if (container.kind !== 201 /* ClassDeclaration */) { + if (container.kind !== 202 /* ClassDeclaration */) { return undefined; } } else if (modifier === 78 /* ExportKeyword */ || modifier === 115 /* DeclareKeyword */) { - if (!(container.kind === 206 /* ModuleBlock */ || container.kind === 227 /* SourceFile */)) { + if (!(container.kind === 207 /* ModuleBlock */ || container.kind === 228 /* SourceFile */)) { return undefined; } } @@ -38001,20 +38857,20 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 206 /* ModuleBlock */: - case 227 /* SourceFile */: + case 207 /* ModuleBlock */: + case 228 /* SourceFile */: nodes = container.statements; break; - case 135 /* Constructor */: + case 136 /* Constructor */: nodes = container.parameters.concat(container.parent.members); break; - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. if (modifierFlag & 112 /* AccessibilityModifier */) { var constructor = ts.forEach(container.members, function (member) { - return member.kind === 135 /* Constructor */ && member; + return member.kind === 136 /* Constructor */ && member; }); if (constructor) { nodes = nodes.concat(constructor.parameters); @@ -38062,13 +38918,13 @@ var ts; } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 136 /* GetAccessor */); - tryPushAccessorKeyword(accessorDeclaration.symbol, 137 /* SetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 137 /* GetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 138 /* SetAccessor */); return ts.map(keywords, getHighlightSpanForNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 116 /* GetKeyword */, 120 /* SetKeyword */); }); + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 116 /* GetKeyword */, 121 /* SetKeyword */); }); } } } @@ -38086,7 +38942,7 @@ var ts; var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 82 /* ForKeyword */, 100 /* WhileKeyword */, 75 /* DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 184 /* DoStatement */) { + if (loopNode.kind === 185 /* DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 100 /* WhileKeyword */)) { @@ -38107,13 +38963,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 184 /* DoStatement */: - case 185 /* WhileStatement */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 185 /* DoStatement */: + case 186 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 193 /* SwitchStatement */: + case 194 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -38167,7 +39023,7 @@ var ts; function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); // If we didn't find a containing function with a block body, bail out. - if (!(func && hasKind(func.body, 179 /* Block */))) { + if (!(func && hasKind(func.body, 180 /* Block */))) { return undefined; } var keywords = []; @@ -38183,7 +39039,7 @@ var ts; function getIfElseOccurrences(ifStatement) { var keywords = []; // Traverse upwards through all parent if-statements linked by their else-branches. - while (hasKind(ifStatement.parent, 183 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 184 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. @@ -38196,7 +39052,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 183 /* IfStatement */)) { + if (!hasKind(ifStatement.elseStatement, 184 /* IfStatement */)) { break; } ifStatement = ifStatement.elseStatement; @@ -38375,17 +39231,17 @@ var ts; } function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 213 /* ImportSpecifier */ || location.parent.kind === 217 /* ExportSpecifier */) && + (location.parent.kind === 214 /* ImportSpecifier */ || location.parent.kind === 218 /* ExportSpecifier */) && location.parent.propertyName === location; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608 /* Alias */) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 213 /* ImportSpecifier */ || declaration.kind === 217 /* ExportSpecifier */; + return declaration.kind === 214 /* ImportSpecifier */ || declaration.kind === 218 /* ExportSpecifier */; }); } function getDeclaredName(symbol, location) { // Special case for function expressions, whose names are solely local to their bodies. - var functionExpression = ts.forEach(symbol.declarations, function (d) { return d.kind === 162 /* FunctionExpression */ ? d : undefined; }); + var functionExpression = ts.forEach(symbol.declarations, function (d) { return d.kind === 163 /* FunctionExpression */ ? d : undefined; }); // When a name gets interned into a SourceFile's 'identifiers' Map, // its name is escaped and stored in the same way its symbol name/identifier // name should be stored. Function expressions, however, are a special case, @@ -38412,7 +39268,7 @@ var ts; return location.getText(); } // Special case for function expressions, whose names are solely local to their bodies. - var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 162 /* FunctionExpression */ ? d : undefined; }); + var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 163 /* FunctionExpression */ ? d : undefined; }); // When a name gets interned into a SourceFile's 'identifiers' Map, // its name is escaped and stored in the same way its symbol name/identifier // name should be stored. Function expressions, however, are a special case, @@ -38436,7 +39292,7 @@ var ts; if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32 /* Private */) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 201 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 202 /* ClassDeclaration */); } } // If the symbol is an import we would like to find it if we are looking for what it imports. @@ -38462,7 +39318,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (container.kind === 227 /* SourceFile */ && !ts.isExternalModule(container)) { + if (container.kind === 228 /* SourceFile */ && !ts.isExternalModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -38650,13 +39506,13 @@ var ts; // Whether 'super' occurs in a static context within a class. var staticFlag = 128 /* Static */; switch (searchSpaceNode.kind) { - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -38688,27 +39544,27 @@ var ts; // Whether 'this' occurs in a static context within a class. var staticFlag = 128 /* Static */; switch (searchSpaceNode.kind) { - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } // fall through - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 227 /* SourceFile */: + case 228 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } // Fall through - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. @@ -38717,7 +39573,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 227 /* SourceFile */) { + if (searchSpaceNode.kind === 228 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -38748,27 +39604,27 @@ var ts; } var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { - case 162 /* FunctionExpression */: - case 200 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 201 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128 /* Static */) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 227 /* SourceFile */: - if (container.kind === 227 /* SourceFile */ && !ts.isExternalModule(container)) { + case 228 /* SourceFile */: + if (container.kind === 228 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -38822,11 +39678,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 /* Class */ | 64 /* Interface */)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 201 /* ClassDeclaration */) { + if (declaration.kind === 202 /* ClassDeclaration */) { getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 202 /* InterfaceDeclaration */) { + else if (declaration.kind === 203 /* InterfaceDeclaration */) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -38887,19 +39743,19 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_25 = node.text; + var name_26 = node.text; if (contextualType) { if (contextualType.flags & 16384 /* Union */) { // This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types) // if not, search the constituent types for the property - var unionProperty = contextualType.getProperty(name_25); + var unionProperty = contextualType.getProperty(name_26); if (unionProperty) { return [unionProperty]; } else { var result_4 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_25); + var symbol = t.getProperty(name_26); if (symbol) { result_4.push(symbol); } @@ -38908,7 +39764,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_25); + var symbol_1 = contextualType.getProperty(name_26); if (symbol_1) { return [symbol_1]; } @@ -38966,10 +39822,10 @@ var ts; } var parent = node.parent; if (parent) { - if (parent.kind === 168 /* PostfixUnaryExpression */ || parent.kind === 167 /* PrefixUnaryExpression */) { + if (parent.kind === 169 /* PostfixUnaryExpression */ || parent.kind === 168 /* PrefixUnaryExpression */) { return true; } - else if (parent.kind === 169 /* BinaryExpression */ && parent.left === node) { + else if (parent.kind === 170 /* BinaryExpression */ && parent.left === node) { var operator = parent.operatorToken.kind; return 53 /* FirstAssignment */ <= operator && operator <= 64 /* LastAssignment */; } @@ -39003,33 +39859,33 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 129 /* Parameter */: - case 198 /* VariableDeclaration */: - case 152 /* BindingElement */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 224 /* PropertyAssignment */: - case 225 /* ShorthandPropertyAssignment */: - case 226 /* EnumMember */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: - case 223 /* CatchClause */: + case 130 /* Parameter */: + case 199 /* VariableDeclaration */: + case 153 /* BindingElement */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 225 /* PropertyAssignment */: + case 226 /* ShorthandPropertyAssignment */: + case 227 /* EnumMember */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: + case 224 /* CatchClause */: return 1 /* Value */; - case 128 /* TypeParameter */: - case 202 /* InterfaceDeclaration */: - case 203 /* TypeAliasDeclaration */: - case 145 /* TypeLiteral */: + case 129 /* TypeParameter */: + case 203 /* InterfaceDeclaration */: + case 204 /* TypeAliasDeclaration */: + case 146 /* TypeLiteral */: return 2 /* Type */; - case 201 /* ClassDeclaration */: - case 204 /* EnumDeclaration */: + case 202 /* ClassDeclaration */: + case 205 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: if (node.name.kind === 8 /* StringLiteral */) { return 4 /* Namespace */ | 1 /* Value */; } @@ -39039,15 +39895,15 @@ var ts; else { return 4 /* Namespace */; } - case 212 /* NamedImports */: - case 213 /* ImportSpecifier */: - case 208 /* ImportEqualsDeclaration */: - case 209 /* ImportDeclaration */: - case 214 /* ExportAssignment */: - case 215 /* ExportDeclaration */: + case 213 /* NamedImports */: + case 214 /* ImportSpecifier */: + case 209 /* ImportEqualsDeclaration */: + case 210 /* ImportDeclaration */: + case 215 /* ExportAssignment */: + case 216 /* ExportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; // An external module can be a Value - case 227 /* SourceFile */: + case 228 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; @@ -39057,7 +39913,7 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 141 /* TypeReference */ || node.parent.kind === 177 /* HeritageClauseElement */; + return node.parent.kind === 142 /* TypeReference */ || node.parent.kind === 177 /* ExpressionWithTypeArguments */; } function isNamespaceReference(node) { return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); @@ -39065,32 +39921,32 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 155 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 155 /* PropertyAccessExpression */) { + if (root.parent.kind === 156 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 156 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 177 /* HeritageClauseElement */ && root.parent.parent.kind === 222 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 177 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 223 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 201 /* ClassDeclaration */ && root.parent.parent.token === 102 /* ImplementsKeyword */) || - (decl.kind === 202 /* InterfaceDeclaration */ && root.parent.parent.token === 79 /* ExtendsKeyword */); + return (decl.kind === 202 /* ClassDeclaration */ && root.parent.parent.token === 102 /* ImplementsKeyword */) || + (decl.kind === 203 /* InterfaceDeclaration */ && root.parent.parent.token === 79 /* ExtendsKeyword */); } return false; } function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 126 /* QualifiedName */) { - while (root.parent && root.parent.kind === 126 /* QualifiedName */) { + if (root.parent.kind === 127 /* QualifiedName */) { + while (root.parent && root.parent.kind === 127 /* QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 141 /* TypeReference */ && !isLastClause; + return root.parent.kind === 142 /* TypeReference */ && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 126 /* QualifiedName */) { + while (node.parent.kind === 127 /* QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -39100,15 +39956,15 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (node.parent.kind === 126 /* QualifiedName */ && + if (node.parent.kind === 127 /* QualifiedName */ && node.parent.right === node && - node.parent.parent.kind === 208 /* ImportEqualsDeclaration */) { + node.parent.parent.kind === 209 /* ImportEqualsDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; } function getMeaningFromLocation(node) { - if (node.parent.kind === 214 /* ExportAssignment */) { + if (node.parent.kind === 215 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -39148,8 +40004,8 @@ var ts; return; } switch (node.kind) { - case 155 /* PropertyAccessExpression */: - case 126 /* QualifiedName */: + case 156 /* PropertyAccessExpression */: + case 127 /* QualifiedName */: case 8 /* StringLiteral */: case 80 /* FalseKeyword */: case 95 /* TrueKeyword */: @@ -39172,7 +40028,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 205 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 206 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -39199,29 +40055,37 @@ var ts; return ts.NavigationBar.getNavigationBarItems(sourceFile); } function getSemanticClassifications(fileName, span) { + return convertClassifications(getEncodedSemanticClassifications(fileName, span)); + } + function getEncodedSemanticClassifications(fileName, span) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var typeChecker = program.getTypeChecker(); var result = []; processNode(sourceFile); - return result; + return { spans: result, endOfLineState: 0 /* None */ }; + function pushClassification(start, length, type) { + result.push(start); + result.push(length); + result.push(type); + } function classifySymbol(symbol, meaningAtPosition) { var flags = symbol.getFlags(); if (flags & 32 /* Class */) { - return ClassificationTypeNames.className; + return 11 /* className */; } else if (flags & 384 /* Enum */) { - return ClassificationTypeNames.enumName; + return 12 /* enumName */; } else if (flags & 524288 /* TypeAlias */) { - return ClassificationTypeNames.typeAlias; + return 16 /* typeAliasName */; } else if (meaningAtPosition & 2 /* Type */) { if (flags & 64 /* Interface */) { - return ClassificationTypeNames.interfaceName; + return 13 /* interfaceName */; } else if (flags & 262144 /* TypeParameter */) { - return ClassificationTypeNames.typeParameterName; + return 15 /* typeParameterName */; } } else if (flags & 1536 /* Module */) { @@ -39230,7 +40094,7 @@ var ts; // - There exists a module declaration which actually impacts the value side. if (meaningAtPosition & 4 /* Namespace */ || (meaningAtPosition & 1 /* Value */ && hasValueSideModule(symbol))) { - return ClassificationTypeNames.moduleName; + return 14 /* moduleName */; } } return undefined; @@ -39239,7 +40103,7 @@ var ts; */ function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 205 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) == 1 /* Instantiated */; + return declaration.kind === 206 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) == 1 /* Instantiated */; }); } } @@ -39251,10 +40115,7 @@ var ts; if (symbol) { var type = classifySymbol(symbol, getMeaningFromLocation(node)); if (type) { - result.push({ - textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), - classificationType: type - }); + pushClassification(node.getStart(), node.getWidth(), type); } } } @@ -39262,7 +40123,42 @@ var ts; } } } + function getClassificationTypeName(type) { + switch (type) { + case 1 /* comment */: return ClassificationTypeNames.comment; + case 2 /* identifier */: return ClassificationTypeNames.identifier; + case 3 /* keyword */: return ClassificationTypeNames.keyword; + case 4 /* numericLiteral */: return ClassificationTypeNames.numericLiteral; + case 5 /* operator */: return ClassificationTypeNames.operator; + case 6 /* stringLiteral */: return ClassificationTypeNames.stringLiteral; + case 8 /* whiteSpace */: return ClassificationTypeNames.whiteSpace; + case 9 /* text */: return ClassificationTypeNames.text; + case 10 /* punctuation */: return ClassificationTypeNames.punctuation; + case 11 /* className */: return ClassificationTypeNames.className; + case 12 /* enumName */: return ClassificationTypeNames.enumName; + case 13 /* interfaceName */: return ClassificationTypeNames.interfaceName; + case 14 /* moduleName */: return ClassificationTypeNames.moduleName; + case 15 /* typeParameterName */: return ClassificationTypeNames.typeParameterName; + case 16 /* typeAliasName */: return ClassificationTypeNames.typeAliasName; + case 17 /* parameterName */: return ClassificationTypeNames.parameterName; + } + } + function convertClassifications(classifications) { + ts.Debug.assert(classifications.spans.length % 3 === 0); + var dense = classifications.spans; + var result = []; + for (var i = 0, n = dense.length; i < n; i += 3) { + result.push({ + textSpan: ts.createTextSpan(dense[i], dense[i + 1]), + classificationType: getClassificationTypeName(dense[i + 2]) + }); + } + return result; + } function getSyntacticClassifications(fileName, span) { + return convertClassifications(getEncodedSyntacticClassifications(fileName, span)); + } + function getEncodedSyntacticClassifications(fileName, span) { // doesn't use compiler - no need to synchronize with host var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); // Make a scanner we can get trivia from. @@ -39270,7 +40166,12 @@ var ts; var mergeConflictScanner = ts.createScanner(2 /* Latest */, false, sourceFile.text); var result = []; processElement(sourceFile); - return result; + return { spans: result, endOfLineState: 0 /* None */ }; + function pushClassification(start, length, type) { + result.push(start); + result.push(length); + result.push(type); + } function classifyLeadingTrivia(token) { var tokenStart = ts.skipTrivia(sourceFile.text, token.pos, false); if (tokenStart === token.pos) { @@ -39289,10 +40190,7 @@ var ts; } if (ts.isComment(kind)) { // Simple comment. Just add as is. - result.push({ - textSpan: ts.createTextSpan(start, width), - classificationType: ClassificationTypeNames.comment - }); + pushClassification(start, width, 1 /* comment */); continue; } if (kind === 6 /* ConflictMarkerTrivia */) { @@ -39301,10 +40199,7 @@ var ts; // for the <<<<<<< and >>>>>>> markers, we just add them in as comments // in the classification stream. if (ch === 60 /* lessThan */ || ch === 62 /* greaterThan */) { - result.push({ - textSpan: ts.createTextSpan(start, width), - classificationType: ClassificationTypeNames.comment - }); + pushClassification(start, width, 1 /* comment */); continue; } // for the ======== add a comment for the first line, and then lex all @@ -39323,10 +40218,7 @@ var ts; break; } } - result.push({ - textSpan: ts.createTextSpanFromBounds(start, i), - classificationType: ClassificationTypeNames.comment - }); + pushClassification(start, i - start, 1 /* comment */); mergeConflictScanner.setTextPos(i); while (mergeConflictScanner.getTextPos() < end) { classifyDisabledCodeToken(); @@ -39338,10 +40230,7 @@ var ts; var end = mergeConflictScanner.getTextPos(); var type = classifyTokenType(tokenKind); if (type) { - result.push({ - textSpan: ts.createTextSpanFromBounds(start, end), - classificationType: type - }); + pushClassification(start, end - start, type); } } function classifyToken(token) { @@ -39349,10 +40238,7 @@ var ts; if (token.getWidth() > 0) { var type = classifyTokenType(token.kind, token); if (type) { - result.push({ - textSpan: ts.createTextSpan(token.getStart(), token.getWidth()), - classificationType: type - }); + pushClassification(token.getStart(), token.getWidth(), type); } } } @@ -39361,7 +40247,7 @@ var ts; // classify based on that instead. function classifyTokenType(tokenKind, token) { if (ts.isKeyword(tokenKind)) { - return ClassificationTypeNames.keyword; + return 3 /* keyword */; } // Special case < and > If they appear in a generic context they are punctuation, // not operators. @@ -39369,73 +40255,78 @@ var ts; // If the node owning the token has a type argument list or type parameter list, then // we can effectively assume that a '<' and '>' belong to those lists. if (token && ts.getTypeArgumentOrTypeParameterList(token.parent)) { - return ClassificationTypeNames.punctuation; + return 10 /* punctuation */; } } if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 53 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 198 /* VariableDeclaration */ || - token.parent.kind === 132 /* PropertyDeclaration */ || - token.parent.kind === 129 /* Parameter */) { - return ClassificationTypeNames.operator; + if (token.parent.kind === 199 /* VariableDeclaration */ || + token.parent.kind === 133 /* PropertyDeclaration */ || + token.parent.kind === 130 /* Parameter */) { + return 5 /* operator */; } } - if (token.parent.kind === 169 /* BinaryExpression */ || - token.parent.kind === 167 /* PrefixUnaryExpression */ || - token.parent.kind === 168 /* PostfixUnaryExpression */ || - token.parent.kind === 170 /* ConditionalExpression */) { - return ClassificationTypeNames.operator; + if (token.parent.kind === 170 /* BinaryExpression */ || + token.parent.kind === 168 /* PrefixUnaryExpression */ || + token.parent.kind === 169 /* PostfixUnaryExpression */ || + token.parent.kind === 171 /* ConditionalExpression */) { + return 5 /* operator */; } } - return ClassificationTypeNames.punctuation; + return 10 /* punctuation */; } else if (tokenKind === 7 /* NumericLiteral */) { - return ClassificationTypeNames.numericLiteral; + return 4 /* numericLiteral */; } else if (tokenKind === 8 /* StringLiteral */) { - return ClassificationTypeNames.stringLiteral; + return 6 /* stringLiteral */; } else if (tokenKind === 9 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. - return ClassificationTypeNames.stringLiteral; + return 6 /* stringLiteral */; } else if (ts.isTemplateLiteralKind(tokenKind)) { // TODO (drosen): we should *also* get another classification type for these literals. - return ClassificationTypeNames.stringLiteral; + return 6 /* stringLiteral */; } else if (tokenKind === 65 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: if (token.parent.name === token) { - return ClassificationTypeNames.className; + return 11 /* className */; } return; - case 128 /* TypeParameter */: + case 129 /* TypeParameter */: if (token.parent.name === token) { - return ClassificationTypeNames.typeParameterName; + return 15 /* typeParameterName */; } return; - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: if (token.parent.name === token) { - return ClassificationTypeNames.interfaceName; + return 13 /* interfaceName */; } return; - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: if (token.parent.name === token) { - return ClassificationTypeNames.enumName; + return 12 /* enumName */; } return; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: if (token.parent.name === token) { - return ClassificationTypeNames.moduleName; + return 14 /* moduleName */; + } + return; + case 130 /* Parameter */: + if (token.parent.name === token) { + return 17 /* parameterName */; } return; } } - return ClassificationTypeNames.text; + return 9 /* text */; } } function processElement(element) { @@ -39715,6 +40606,8 @@ var ts; getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics, getSyntacticClassifications: getSyntacticClassifications, getSemanticClassifications: getSemanticClassifications, + getEncodedSyntacticClassifications: getEncodedSyntacticClassifications, + getEncodedSemanticClassifications: getEncodedSemanticClassifications, getCompletionsAtPosition: getCompletionsAtPosition, getCompletionEntryDetails: getCompletionEntryDetails, getSignatureHelpItems: getSignatureHelpItems, @@ -39767,7 +40660,7 @@ var ts; // then we want 'something' to be in the name table. Similarly, if we have // "a['propname']" then we want to store "propname" in the name table. if (ts.isDeclarationName(node) || - node.parent.kind === 219 /* ExternalModuleReference */ || + node.parent.kind === 220 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } @@ -39780,7 +40673,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 156 /* ElementAccessExpression */ && + node.parent.kind === 157 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } /// Classifier @@ -39828,7 +40721,7 @@ var ts; function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { if (keyword2 === 116 /* GetKeyword */ || - keyword2 === 120 /* SetKeyword */ || + keyword2 === 121 /* SetKeyword */ || keyword2 === 114 /* ConstructorKeyword */ || keyword2 === 109 /* StaticKeyword */) { // Allow things like "public get", "public constructor" and "public static". @@ -39843,9 +40736,58 @@ var ts; // if there are more cases we want the classifier to be better at. return true; } + function convertClassifications(classifications, text) { + var entries = []; + var dense = classifications.spans; + var lastEnd = 0; + for (var i = 0, n = dense.length; i < n; i += 3) { + var start = dense[i]; + var length_1 = dense[i + 1]; + var type = dense[i + 2]; + // Make a whitespace entry between the last item and this one. + if (lastEnd >= 0) { + var whitespaceLength_1 = start - lastEnd; + if (whitespaceLength_1 > 0) { + entries.push({ length: whitespaceLength_1, classification: TokenClass.Whitespace }); + } + } + entries.push({ length: length_1, classification: convertClassification(type) }); + lastEnd = start + length_1; + } + var whitespaceLength = text.length - lastEnd; + if (whitespaceLength > 0) { + entries.push({ length: whitespaceLength, classification: TokenClass.Whitespace }); + } + return { entries: entries, finalLexState: classifications.endOfLineState }; + } + function convertClassification(type) { + switch (type) { + case 1 /* comment */: return TokenClass.Comment; + case 3 /* keyword */: return TokenClass.Keyword; + case 4 /* numericLiteral */: return TokenClass.NumberLiteral; + case 5 /* operator */: return TokenClass.Operator; + case 6 /* stringLiteral */: return TokenClass.StringLiteral; + case 8 /* whiteSpace */: return TokenClass.Whitespace; + case 10 /* punctuation */: return TokenClass.Punctuation; + case 2 /* identifier */: + case 11 /* className */: + case 12 /* enumName */: + case 13 /* interfaceName */: + case 14 /* moduleName */: + case 15 /* typeParameterName */: + case 16 /* typeAliasName */: + case 9 /* text */: + case 17 /* parameterName */: + default: + return TokenClass.Identifier; + } + } + function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) { + return convertClassifications(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text); + } // If there is a syntactic classifier ('syntacticClassifierAbsent' is false), // we will be more conservative in order to avoid conflicting with the syntactic classifier. - function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) { + function getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent) { var offset = 0; var token = 0 /* Unknown */; var lastNonTriviaToken = 0 /* Unknown */; @@ -39885,8 +40827,8 @@ var ts; } scanner.setText(text); var result = { - finalLexState: 0 /* Start */, - entries: [] + endOfLineState: 0 /* None */, + spans: [] }; // We can run into an unfortunate interaction between the lexical and syntactic classifier // when the user is typing something generic. Consider the case where the user types: @@ -39938,10 +40880,10 @@ var ts; angleBracketStack--; } else if (token === 112 /* AnyKeyword */ || - token === 121 /* StringKeyword */ || - token === 119 /* NumberKeyword */ || + token === 122 /* StringKeyword */ || + token === 120 /* NumberKeyword */ || token === 113 /* BooleanKeyword */ || - token === 122 /* SymbolKeyword */) { + token === 123 /* SymbolKeyword */) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, @@ -39988,7 +40930,7 @@ var ts; function processToken() { var start = scanner.getTokenPos(); var end = scanner.getTextPos(); - addResult(end - start, classFromKind(token)); + addResult(start, end, classFromKind(token)); if (end >= text.length) { if (token === 8 /* StringLiteral */) { // Check to see if we finished up on a multiline string literal. @@ -40002,7 +40944,7 @@ var ts; // If we have an odd number of backslashes, then the multiline string is unclosed if (numBackslashes & 1) { var quoteChar = tokenText.charCodeAt(0); - result.finalLexState = quoteChar === 34 /* doubleQuote */ + result.endOfLineState = quoteChar === 34 /* doubleQuote */ ? 3 /* InDoubleQuoteStringLiteral */ : 2 /* InSingleQuoteStringLiteral */; } @@ -40011,16 +40953,16 @@ var ts; else if (token === 3 /* MultiLineCommentTrivia */) { // Check to see if the multiline comment was unclosed. if (scanner.isUnterminated()) { - result.finalLexState = 1 /* InMultiLineCommentTrivia */; + result.endOfLineState = 1 /* InMultiLineCommentTrivia */; } } else if (ts.isTemplateLiteralKind(token)) { if (scanner.isUnterminated()) { if (token === 13 /* TemplateTail */) { - result.finalLexState = 5 /* InTemplateMiddleOrTail */; + result.endOfLineState = 5 /* InTemplateMiddleOrTail */; } else if (token === 10 /* NoSubstitutionTemplateLiteral */) { - result.finalLexState = 4 /* InTemplateHeadOrNoSubstitutionTemplate */; + result.endOfLineState = 4 /* InTemplateHeadOrNoSubstitutionTemplate */; } else { ts.Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #" + token); @@ -40028,18 +40970,30 @@ var ts; } } else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 11 /* TemplateHead */) { - result.finalLexState = 6 /* InTemplateSubstitutionPosition */; + result.endOfLineState = 6 /* InTemplateSubstitutionPosition */; } } } - function addResult(length, classification) { + function addResult(start, end, classification) { + if (classification === 8 /* whiteSpace */) { + // Don't bother with whitespace classifications. They're not needed. + return; + } + if (start === 0 && offset > 0) { + // We're classifying the first token, and this was a case where we prepended + // text. We should consider the start of this token to be at the start of + // the original text. + start += offset; + } + // All our tokens are in relation to the augmented text. Move them back to be + // relative to the original text. + start -= offset; + end -= offset; + var length = end - start; if (length > 0) { - // If this is the first classification we're adding to the list, then remove any - // offset we have if we were continuing a construct from the previous line. - if (result.entries.length === 0) { - length -= offset; - } - result.entries.push({ length: length, classification: classification }); + result.spans.push(start); + result.spans.push(length); + result.spans.push(classification); } } } @@ -40100,41 +41054,44 @@ var ts; } } function isKeyword(token) { - return token >= 66 /* FirstKeyword */ && token <= 125 /* LastKeyword */; + return token >= 66 /* FirstKeyword */ && token <= 126 /* LastKeyword */; } function classFromKind(token) { if (isKeyword(token)) { - return TokenClass.Keyword; + return 3 /* keyword */; } else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { - return TokenClass.Operator; + return 5 /* operator */; } else if (token >= 14 /* FirstPunctuation */ && token <= 64 /* LastPunctuation */) { - return TokenClass.Punctuation; + return 10 /* punctuation */; } switch (token) { case 7 /* NumericLiteral */: - return TokenClass.NumberLiteral; + return 4 /* numericLiteral */; case 8 /* StringLiteral */: - return TokenClass.StringLiteral; + return 6 /* stringLiteral */; case 9 /* RegularExpressionLiteral */: - return TokenClass.RegExpLiteral; + return 7 /* regularExpressionLiteral */; case 6 /* ConflictMarkerTrivia */: case 3 /* MultiLineCommentTrivia */: case 2 /* SingleLineCommentTrivia */: - return TokenClass.Comment; + return 1 /* comment */; case 5 /* WhitespaceTrivia */: case 4 /* NewLineTrivia */: - return TokenClass.Whitespace; + return 8 /* whiteSpace */; case 65 /* Identifier */: default: if (ts.isTemplateLiteralKind(token)) { - return TokenClass.StringLiteral; + return 6 /* stringLiteral */; } - return TokenClass.Identifier; + return 2 /* identifier */; } } - return { getClassificationsForLine: getClassificationsForLine }; + return { + getClassificationsForLine: getClassificationsForLine, + getEncodedLexicalClassifications: getEncodedLexicalClassifications + }; } ts.createClassifier = createClassifier; /** @@ -40155,7 +41112,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 227 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); + var proto = kind === 228 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = 0; proto.end = 0; @@ -40225,125 +41182,125 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 184 /* DoStatement */) { + if (node.parent.kind === 185 /* DoStatement */) { // Set span as if on while keyword return spanInPreviousNode(node); } - if (node.parent.kind === 186 /* ForStatement */) { + if (node.parent.kind === 187 /* ForStatement */) { // For now lets set the span on this expression, fix it later return textSpan(node); } - if (node.parent.kind === 169 /* BinaryExpression */ && node.parent.operatorToken.kind === 23 /* CommaToken */) { + if (node.parent.kind === 170 /* BinaryExpression */ && node.parent.operatorToken.kind === 23 /* CommaToken */) { // if this is comma expression, the breakpoint is possible in this expression return textSpan(node); } - if (node.parent.kind == 163 /* ArrowFunction */ && node.parent.body == node) { + if (node.parent.kind == 164 /* ArrowFunction */ && node.parent.body == node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); } } switch (node.kind) { - case 180 /* VariableStatement */: + case 181 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 198 /* VariableDeclaration */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 199 /* VariableDeclaration */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: return spanInVariableDeclaration(node); - case 129 /* Parameter */: + case 130 /* Parameter */: return spanInParameterDeclaration(node); - case 200 /* FunctionDeclaration */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 135 /* Constructor */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 201 /* FunctionDeclaration */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 136 /* Constructor */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 179 /* Block */: + case 180 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // Fall through - case 206 /* ModuleBlock */: + case 207 /* ModuleBlock */: return spanInBlock(node); - case 223 /* CatchClause */: + case 224 /* CatchClause */: return spanInBlock(node.block); - case 182 /* ExpressionStatement */: + case 183 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 191 /* ReturnStatement */: + case 192 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 185 /* WhileStatement */: + case 186 /* WhileStatement */: // Span on while(...) return textSpan(node, ts.findNextToken(node.expression, node)); - case 184 /* DoStatement */: + case 185 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 197 /* DebuggerStatement */: + case 198 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 183 /* IfStatement */: + case 184 /* IfStatement */: // set on if(..) span return textSpan(node, ts.findNextToken(node.expression, node)); - case 194 /* LabeledStatement */: + case 195 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 190 /* BreakStatement */: - case 189 /* ContinueStatement */: + case 191 /* BreakStatement */: + case 190 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 186 /* ForStatement */: + case 187 /* ForStatement */: return spanInForStatement(node); - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: // span on for (a in ...) return textSpan(node, ts.findNextToken(node.expression, node)); - case 193 /* SwitchStatement */: + case 194 /* SwitchStatement */: // span on switch(...) return textSpan(node, ts.findNextToken(node.expression, node)); - case 220 /* CaseClause */: - case 221 /* DefaultClause */: + case 221 /* CaseClause */: + case 222 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 196 /* TryStatement */: + case 197 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 195 /* ThrowStatement */: + case 196 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 201 /* ClassDeclaration */: - case 204 /* EnumDeclaration */: - case 226 /* EnumMember */: - case 157 /* CallExpression */: - case 158 /* NewExpression */: + case 202 /* ClassDeclaration */: + case 205 /* EnumDeclaration */: + case 227 /* EnumMember */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: // span on complete node return textSpan(node); - case 192 /* WithStatement */: + case 193 /* WithStatement */: // span in statement return spanInNode(node.statement); // No breakpoint in interface, type alias - case 202 /* InterfaceDeclaration */: - case 203 /* TypeAliasDeclaration */: + case 203 /* InterfaceDeclaration */: + case 204 /* TypeAliasDeclaration */: return undefined; // Tokens: case 22 /* SemicolonToken */: @@ -40373,11 +41330,11 @@ var ts; return spanInNextNode(node); default: // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 224 /* PropertyAssignment */ && node.parent.name === node) { + if (node.parent.kind === 225 /* PropertyAssignment */ && node.parent.name === node) { return spanInNode(node.parent.initializer); } // Breakpoint in type assertion goes to its operand - if (node.parent.kind === 160 /* TypeAssertionExpression */ && node.parent.type === node) { + if (node.parent.kind === 161 /* TypeAssertionExpression */ && node.parent.type === node) { return spanInNode(node.parent.expression); } // return type of function go to previous token @@ -40390,12 +41347,12 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 187 /* ForInStatement */ || - variableDeclaration.parent.parent.kind === 188 /* ForOfStatement */) { + if (variableDeclaration.parent.parent.kind === 188 /* ForInStatement */ || + variableDeclaration.parent.parent.kind === 189 /* ForOfStatement */) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 180 /* VariableStatement */; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 186 /* ForStatement */ && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 181 /* VariableStatement */; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 187 /* ForStatement */ && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement @@ -40449,7 +41406,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1 /* Export */) || - (functionDeclaration.parent.kind === 201 /* ClassDeclaration */ && functionDeclaration.kind !== 135 /* Constructor */); + (functionDeclaration.parent.kind === 202 /* ClassDeclaration */ && functionDeclaration.kind !== 136 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -40472,18 +41429,18 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement - case 185 /* WhileStatement */: - case 183 /* IfStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: + case 186 /* WhileStatement */: + case 184 /* IfStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 186 /* ForStatement */: + case 187 /* ForStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement @@ -40491,7 +41448,7 @@ var ts; } function spanInForStatement(forStatement) { if (forStatement.initializer) { - if (forStatement.initializer.kind === 199 /* VariableDeclarationList */) { + if (forStatement.initializer.kind === 200 /* VariableDeclarationList */) { var variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -40511,13 +41468,13 @@ var ts; // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 207 /* CaseBlock */: + case 208 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -40525,25 +41482,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 206 /* ModuleBlock */: + case 207 /* ModuleBlock */: // If this is not instantiated module block no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 204 /* EnumDeclaration */: - case 201 /* ClassDeclaration */: + case 205 /* EnumDeclaration */: + case 202 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 179 /* Block */: + case 180 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // fall through. - case 223 /* CatchClause */: + case 224 /* CatchClause */: return spanInNode(node.parent.statements[node.parent.statements.length - 1]); ; - case 207 /* CaseBlock */: + case 208 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = caseBlock.clauses[caseBlock.clauses.length - 1]; @@ -40557,7 +41514,7 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 184 /* DoStatement */) { + if (node.parent.kind === 185 /* DoStatement */) { // Go to while keyword and do action instead return spanInPreviousNode(node); } @@ -40567,17 +41524,17 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 162 /* FunctionExpression */: - case 200 /* FunctionDeclaration */: - case 163 /* ArrowFunction */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 135 /* Constructor */: - case 185 /* WhileStatement */: - case 184 /* DoStatement */: - case 186 /* ForStatement */: + case 163 /* FunctionExpression */: + case 201 /* FunctionDeclaration */: + case 164 /* ArrowFunction */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 136 /* Constructor */: + case 186 /* WhileStatement */: + case 185 /* DoStatement */: + case 187 /* ForStatement */: return spanInPreviousNode(node); // Default to parent node default: @@ -40588,19 +41545,19 @@ var ts; } function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration - if (ts.isFunctionLike(node.parent) || node.parent.kind === 224 /* PropertyAssignment */) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 225 /* PropertyAssignment */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 160 /* TypeAssertionExpression */) { + if (node.parent.kind === 161 /* TypeAssertionExpression */) { return spanInNode(node.parent.expression); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 184 /* DoStatement */) { + if (node.parent.kind === 185 /* DoStatement */) { // Set span on while expression return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } @@ -40633,7 +41590,9 @@ var debugObjectHost = this; var ts; (function (ts) { function logInternalError(logger, err) { - logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message); + if (logger) { + logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message); + } } var ScriptSnapshotShimAdapter = (function () { function ScriptSnapshotShimAdapter(scriptSnapshotShim) { @@ -40726,24 +41685,39 @@ var ts; return LanguageServiceShimHostAdapter; })(); ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter; - function simpleForwardCall(logger, actionDescription, action) { - logger.log(actionDescription); - var start = Date.now(); + var CoreServicesShimHostAdapter = (function () { + function CoreServicesShimHostAdapter(shimHost) { + this.shimHost = shimHost; + } + CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension) { + var encoded = this.shimHost.readDirectory(rootDir, extension); + return JSON.parse(encoded); + }; + return CoreServicesShimHostAdapter; + })(); + ts.CoreServicesShimHostAdapter = CoreServicesShimHostAdapter; + function simpleForwardCall(logger, actionDescription, action, noPerfLogging) { + if (!noPerfLogging) { + 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) + "..."; + if (!noPerfLogging) { + 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) + "'"); } - logger.log(" result.length=" + str.length + ", result='" + JSON.stringify(str) + "'"); } return result; } - function forwardJSONCall(logger, actionDescription, action) { + function forwardJSONCall(logger, actionDescription, action, noPerfLogging) { try { - var result = simpleForwardCall(logger, actionDescription, action); + var result = simpleForwardCall(logger, actionDescription, action, noPerfLogging); return JSON.stringify({ result: result }); } catch (err) { @@ -40788,7 +41762,7 @@ var ts; this.logger = this.host; } LanguageServiceShimObject.prototype.forwardJSONCall = function (actionDescription, action) { - return forwardJSONCall(this.logger, actionDescription, action); + return forwardJSONCall(this.logger, actionDescription, action, false); }; /// DISPOSE /** @@ -40841,6 +41815,22 @@ var ts; return classifications; }); }; + LanguageServiceShimObject.prototype.getEncodedSyntacticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { + // directly serialize the spans out to a string. This is much faster to decode + // on the managed side versus a full JSON array. + return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); + }); + }; + LanguageServiceShimObject.prototype.getEncodedSemanticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { + // directly serialize the spans out to a string. This is much faster to decode + // on the managed side versus a full JSON array. + return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); + }); + }; LanguageServiceShimObject.prototype.getNewLine = function () { return this.host.getNewLine ? this.host.getNewLine() : "\r\n"; }; @@ -41060,12 +42050,21 @@ var ts; }; return LanguageServiceShimObject; })(ShimBase); + function convertClassifications(classifications) { + return { spans: classifications.spans.join(","), endOfLineState: classifications.endOfLineState }; + } var ClassifierShimObject = (function (_super) { __extends(ClassifierShimObject, _super); - function ClassifierShimObject(factory) { + function ClassifierShimObject(factory, logger) { _super.call(this, factory); + this.logger = logger; this.classifier = ts.createClassifier(); } + ClassifierShimObject.prototype.getEncodedLexicalClassifications = function (text, lexState, syntacticClassifierAbsent) { + var _this = this; + return forwardJSONCall(this.logger, "getEncodedLexicalClassifications", function () { return convertClassifications(_this.classifier.getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent)); }, + /*noPerfLogging:*/ true); + }; /// COLORIZATION ClassifierShimObject.prototype.getClassificationsForLine = function (text, lexState, classifyKeywordsInGenerics) { var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics); @@ -41082,12 +42081,13 @@ var ts; })(ShimBase); var CoreServicesShimObject = (function (_super) { __extends(CoreServicesShimObject, _super); - function CoreServicesShimObject(factory, logger) { + function CoreServicesShimObject(factory, logger, host) { _super.call(this, factory); this.logger = logger; + this.host = host; } CoreServicesShimObject.prototype.forwardJSONCall = function (actionDescription, action) { - return forwardJSONCall(this.logger, actionDescription, action); + return forwardJSONCall(this.logger, actionDescription, action, false); }; CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { @@ -41114,6 +42114,26 @@ var ts; return convertResult; }); }; + CoreServicesShimObject.prototype.getTSConfigFileInfo = function (fileName, sourceTextSnapshot) { + var _this = this; + return this.forwardJSONCall("getTSConfigFileInfo('" + fileName + "')", function () { + var text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()); + var result = ts.parseConfigFileText(fileName, text); + if (result.error) { + return { + options: {}, + files: [], + errors: [realizeDiagnostic(result.error, '\r\n')] + }; + } + var configFile = ts.parseConfigFile(result.config, _this.host, ts.getDirectoryPath(ts.normalizeSlashes(fileName))); + return { + options: configFile.options, + files: configFile.fileNames, + errors: realizeDiagnostics(configFile.errors, '\r\n') + }; + }); + }; CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () { return this.forwardJSONCall("getDefaultCompilationSettings()", function () { return ts.getDefaultCompilerOptions(); @@ -41145,19 +42165,20 @@ var ts; }; TypeScriptServicesFactory.prototype.createClassifierShim = function (logger) { try { - return new ClassifierShimObject(this); + return new ClassifierShimObject(this, logger); } catch (err) { logInternalError(logger, err); throw err; } }; - TypeScriptServicesFactory.prototype.createCoreServicesShim = function (logger) { + TypeScriptServicesFactory.prototype.createCoreServicesShim = function (host) { try { - return new CoreServicesShimObject(this, logger); + var adapter = new CoreServicesShimHostAdapter(host); + return new CoreServicesShimObject(this, host, adapter); } catch (err) { - logInternalError(logger, err); + logInternalError(host, err); throw err; } }; diff --git a/bin/typescriptServices.d.ts b/bin/typescriptServices.d.ts index d946fdcfe30..92427e18f24 100644 --- a/bin/typescriptServices.d.ts +++ b/bin/typescriptServices.d.ts @@ -140,132 +140,133 @@ declare module ts { DeclareKeyword = 115, GetKeyword = 116, ModuleKeyword = 117, - RequireKeyword = 118, - NumberKeyword = 119, - SetKeyword = 120, - StringKeyword = 121, - SymbolKeyword = 122, - TypeKeyword = 123, - FromKeyword = 124, - OfKeyword = 125, - QualifiedName = 126, - ComputedPropertyName = 127, - TypeParameter = 128, - Parameter = 129, - Decorator = 130, - PropertySignature = 131, - PropertyDeclaration = 132, - MethodSignature = 133, - MethodDeclaration = 134, - Constructor = 135, - GetAccessor = 136, - SetAccessor = 137, - CallSignature = 138, - ConstructSignature = 139, - IndexSignature = 140, - TypeReference = 141, - FunctionType = 142, - ConstructorType = 143, - TypeQuery = 144, - TypeLiteral = 145, - ArrayType = 146, - TupleType = 147, - UnionType = 148, - ParenthesizedType = 149, - ObjectBindingPattern = 150, - ArrayBindingPattern = 151, - BindingElement = 152, - ArrayLiteralExpression = 153, - ObjectLiteralExpression = 154, - PropertyAccessExpression = 155, - ElementAccessExpression = 156, - CallExpression = 157, - NewExpression = 158, - TaggedTemplateExpression = 159, - TypeAssertionExpression = 160, - ParenthesizedExpression = 161, - FunctionExpression = 162, - ArrowFunction = 163, - DeleteExpression = 164, - TypeOfExpression = 165, - VoidExpression = 166, - PrefixUnaryExpression = 167, - PostfixUnaryExpression = 168, - BinaryExpression = 169, - ConditionalExpression = 170, - TemplateExpression = 171, - YieldExpression = 172, - SpreadElementExpression = 173, - ClassExpression = 174, - OmittedExpression = 175, - TemplateSpan = 176, - HeritageClauseElement = 177, - SemicolonClassElement = 178, - Block = 179, - VariableStatement = 180, - EmptyStatement = 181, - ExpressionStatement = 182, - IfStatement = 183, - DoStatement = 184, - WhileStatement = 185, - ForStatement = 186, - ForInStatement = 187, - ForOfStatement = 188, - ContinueStatement = 189, - BreakStatement = 190, - ReturnStatement = 191, - WithStatement = 192, - SwitchStatement = 193, - LabeledStatement = 194, - ThrowStatement = 195, - TryStatement = 196, - DebuggerStatement = 197, - VariableDeclaration = 198, - VariableDeclarationList = 199, - FunctionDeclaration = 200, - ClassDeclaration = 201, - InterfaceDeclaration = 202, - TypeAliasDeclaration = 203, - EnumDeclaration = 204, - ModuleDeclaration = 205, - ModuleBlock = 206, - CaseBlock = 207, - ImportEqualsDeclaration = 208, - ImportDeclaration = 209, - ImportClause = 210, - NamespaceImport = 211, - NamedImports = 212, - ImportSpecifier = 213, - ExportAssignment = 214, - ExportDeclaration = 215, - NamedExports = 216, - ExportSpecifier = 217, - MissingDeclaration = 218, - ExternalModuleReference = 219, - CaseClause = 220, - DefaultClause = 221, - HeritageClause = 222, - CatchClause = 223, - PropertyAssignment = 224, - ShorthandPropertyAssignment = 225, - EnumMember = 226, - SourceFile = 227, - SyntaxList = 228, - Count = 229, + NamespaceKeyword = 118, + RequireKeyword = 119, + NumberKeyword = 120, + SetKeyword = 121, + StringKeyword = 122, + SymbolKeyword = 123, + TypeKeyword = 124, + FromKeyword = 125, + OfKeyword = 126, + QualifiedName = 127, + ComputedPropertyName = 128, + TypeParameter = 129, + Parameter = 130, + Decorator = 131, + PropertySignature = 132, + PropertyDeclaration = 133, + MethodSignature = 134, + MethodDeclaration = 135, + Constructor = 136, + GetAccessor = 137, + SetAccessor = 138, + CallSignature = 139, + ConstructSignature = 140, + IndexSignature = 141, + TypeReference = 142, + FunctionType = 143, + ConstructorType = 144, + TypeQuery = 145, + TypeLiteral = 146, + ArrayType = 147, + TupleType = 148, + UnionType = 149, + ParenthesizedType = 150, + ObjectBindingPattern = 151, + ArrayBindingPattern = 152, + BindingElement = 153, + ArrayLiteralExpression = 154, + ObjectLiteralExpression = 155, + PropertyAccessExpression = 156, + ElementAccessExpression = 157, + CallExpression = 158, + NewExpression = 159, + TaggedTemplateExpression = 160, + TypeAssertionExpression = 161, + ParenthesizedExpression = 162, + FunctionExpression = 163, + ArrowFunction = 164, + DeleteExpression = 165, + TypeOfExpression = 166, + VoidExpression = 167, + PrefixUnaryExpression = 168, + PostfixUnaryExpression = 169, + BinaryExpression = 170, + ConditionalExpression = 171, + TemplateExpression = 172, + YieldExpression = 173, + SpreadElementExpression = 174, + ClassExpression = 175, + OmittedExpression = 176, + ExpressionWithTypeArguments = 177, + TemplateSpan = 178, + SemicolonClassElement = 179, + Block = 180, + VariableStatement = 181, + EmptyStatement = 182, + ExpressionStatement = 183, + IfStatement = 184, + DoStatement = 185, + WhileStatement = 186, + ForStatement = 187, + ForInStatement = 188, + ForOfStatement = 189, + ContinueStatement = 190, + BreakStatement = 191, + ReturnStatement = 192, + WithStatement = 193, + SwitchStatement = 194, + LabeledStatement = 195, + ThrowStatement = 196, + TryStatement = 197, + DebuggerStatement = 198, + VariableDeclaration = 199, + VariableDeclarationList = 200, + FunctionDeclaration = 201, + ClassDeclaration = 202, + InterfaceDeclaration = 203, + TypeAliasDeclaration = 204, + EnumDeclaration = 205, + ModuleDeclaration = 206, + ModuleBlock = 207, + CaseBlock = 208, + ImportEqualsDeclaration = 209, + ImportDeclaration = 210, + ImportClause = 211, + NamespaceImport = 212, + NamedImports = 213, + ImportSpecifier = 214, + ExportAssignment = 215, + ExportDeclaration = 216, + NamedExports = 217, + ExportSpecifier = 218, + MissingDeclaration = 219, + ExternalModuleReference = 220, + CaseClause = 221, + DefaultClause = 222, + HeritageClause = 223, + CatchClause = 224, + PropertyAssignment = 225, + ShorthandPropertyAssignment = 226, + EnumMember = 227, + SourceFile = 228, + SyntaxList = 229, + Count = 230, FirstAssignment = 53, LastAssignment = 64, FirstReservedWord = 66, LastReservedWord = 101, FirstKeyword = 66, - LastKeyword = 125, + LastKeyword = 126, FirstFutureReservedWord = 102, LastFutureReservedWord = 110, - FirstTypeNode = 141, - LastTypeNode = 149, + FirstTypeNode = 142, + LastTypeNode = 150, FirstPunctuation = 14, LastPunctuation = 64, FirstToken = 0, - LastToken = 125, + LastToken = 126, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -274,7 +275,7 @@ declare module ts { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 64, - FirstNode = 126, + FirstNode = 127, } const enum NodeFlags { Export = 1, @@ -290,7 +291,8 @@ declare module ts { Let = 4096, Const = 8192, OctalLiteral = 16384, - ExportContext = 32768, + Namespace = 32768, + ExportContext = 65536, Modifier = 499, AccessibilityModifier = 112, BlockScoped = 12288, @@ -553,7 +555,7 @@ declare module ts { typeArguments?: NodeArray; arguments: NodeArray; } - interface HeritageClauseElement extends TypeNode { + interface ExpressionWithTypeArguments extends TypeNode { expression: LeftHandSideExpression; typeArguments?: NodeArray; } @@ -672,7 +674,7 @@ declare module ts { } interface HeritageClause extends Node { token: SyntaxKind; - types?: NodeArray; + types?: NodeArray; } interface TypeAliasDeclaration extends Declaration, ModuleElement { name: Identifier; @@ -756,6 +758,9 @@ declare module ts { getSourceFile(fileName: string): SourceFile; getCurrentDirectory(): string; } + interface ParseConfigHost { + readDirectory(rootDir: string, extension: string): string[]; + } interface WriteFileCallback { (fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void; } @@ -804,6 +809,7 @@ declare module ts { sourceMapFile: string; sourceMapSourceRoot: string; sourceMapSources: string[]; + sourceMapSourcesContent?: string[]; inputSourceFileNames: string[]; sourceMapNames?: string[]; sourceMapMappings: string; @@ -1082,11 +1088,14 @@ declare module ts { diagnostics?: boolean; emitBOM?: boolean; help?: boolean; + inlineSourceMap?: boolean; + inlineSources?: boolean; listFiles?: boolean; locale?: string; mapRoot?: string; module?: ModuleKind; noEmit?: boolean; + noEmitHelpers?: boolean; noEmitOnError?: boolean; noErrorTruncation?: boolean; noImplicitAny?: boolean; @@ -1113,6 +1122,7 @@ declare module ts { CommonJS = 1, AMD = 2, UMD = 3, + System = 4, } interface LineAndCharacter { line: number; @@ -1226,7 +1236,7 @@ declare module ts { const version: string; function findConfigFile(searchPath: string): string; function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost; - function getPreEmitDiagnostics(program: Program): Diagnostic[]; + function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile): Diagnostic[]; function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string; function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program; } @@ -1236,14 +1246,26 @@ declare module ts { * Read tsconfig.json file * @param fileName The path to the config file */ - function readConfigFile(fileName: string): any; + function readConfigFile(fileName: string): { + config?: any; + error?: Diagnostic; + }; + /** + * Parse the text of the tsconfig.json file + * @param fileName The path to the config file + * @param jsonText The text of the config file + */ + function parseConfigFileText(fileName: string, jsonText: string): { + config?: any; + error?: Diagnostic; + }; /** * Parse the contents of a config file (tsconfig.json). * @param json The contents of the config file to parse * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - function parseConfigFile(json: any, basePath?: string): ParsedCommandLine; + function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine; } declare module ts { /** The version of the language service API */ @@ -1340,8 +1362,16 @@ declare module ts { getSyntacticDiagnostics(fileName: string): Diagnostic[]; getSemanticDiagnostics(fileName: string): Diagnostic[]; getCompilerOptionsDiagnostics(): Diagnostic[]; + /** + * @deprecated Use getEncodedSyntacticClassifications instead. + */ getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + /** + * @deprecated Use getEncodedSemanticClassifications instead. + */ getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications; + getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications; getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; getQuickInfoAtPosition(fileName: string, position: number): QuickInfo; @@ -1370,6 +1400,10 @@ declare module ts { getSourceFile(fileName: string): SourceFile; dispose(): void; } + interface Classifications { + spans: number[]; + endOfLineState: EndOfLineState; + } interface ClassifiedSpan { textSpan: TextSpan; classificationType: string; @@ -1581,7 +1615,7 @@ declare module ts { text: string; } const enum EndOfLineState { - Start = 0, + None = 0, InMultiLineCommentTrivia = 1, InSingleQuoteStringLiteral = 2, InDoubleQuoteStringLiteral = 3, @@ -1627,8 +1661,10 @@ declare module ts { * classifications which may be incorrectly categorized will be given * back as Identifiers in order to allow the syntactic classifier to * subsume the classification. + * @deprecated Use getLexicalClassifications instead. */ getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; + getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications; } /** * The document registry represents a store of SourceFile objects that can be shared between @@ -1739,7 +1775,27 @@ declare module ts { static interfaceName: string; static moduleName: string; static typeParameterName: string; - static typeAlias: string; + static typeAliasName: string; + static parameterName: string; + } + const enum ClassificationType { + comment = 1, + identifier = 2, + keyword = 3, + numericLiteral = 4, + operator = 5, + stringLiteral = 6, + regularExpressionLiteral = 7, + whiteSpace = 8, + text = 9, + punctuation = 10, + className = 11, + enumName = 12, + interfaceName = 13, + moduleName = 14, + typeParameterName = 15, + typeAliasName = 16, + parameterName = 17, } interface DisplayPartsSymbolWriter extends SymbolWriter { displayParts(): SymbolDisplayPart[]; diff --git a/bin/typescriptServices.js b/bin/typescriptServices.js index fefe3658fb4..588078a9d94 100644 --- a/bin/typescriptServices.js +++ b/bin/typescriptServices.js @@ -145,149 +145,150 @@ var ts; SyntaxKind[SyntaxKind["DeclareKeyword"] = 115] = "DeclareKeyword"; SyntaxKind[SyntaxKind["GetKeyword"] = 116] = "GetKeyword"; SyntaxKind[SyntaxKind["ModuleKeyword"] = 117] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 118] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 119] = "NumberKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 120] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 121] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 122] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 123] = "TypeKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 124] = "FromKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 125] = "OfKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 118] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 119] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 120] = "NumberKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 121] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 122] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 123] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 124] = "TypeKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 125] = "FromKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 126] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 126] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 127] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 127] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 128] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 128] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 129] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 130] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 129] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 130] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 131] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 131] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 132] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 133] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 134] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 135] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 136] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 137] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 138] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 139] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 140] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 132] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 133] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 134] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 135] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 136] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 137] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 138] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 139] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 140] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 141] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypeReference"] = 141] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 142] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 143] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 144] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 145] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 146] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 147] = "TupleType"; - SyntaxKind[SyntaxKind["UnionType"] = 148] = "UnionType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 149] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["TypeReference"] = 142] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 143] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 144] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 145] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 146] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 147] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 148] = "TupleType"; + SyntaxKind[SyntaxKind["UnionType"] = 149] = "UnionType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 150] = "ParenthesizedType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 150] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 151] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 152] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 151] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 152] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 153] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 153] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 154] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 155] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 156] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 157] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 158] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 159] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 160] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 161] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 162] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 163] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 164] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 165] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 166] = "VoidExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 167] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 168] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 169] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 170] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 171] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 172] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElementExpression"] = 173] = "SpreadElementExpression"; - SyntaxKind[SyntaxKind["ClassExpression"] = 174] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 175] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 154] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 155] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 156] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 157] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 158] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 159] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 160] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 161] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 162] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 163] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 164] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 165] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 166] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 167] = "VoidExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 168] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 169] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 170] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 171] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 172] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 173] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElementExpression"] = 174] = "SpreadElementExpression"; + SyntaxKind[SyntaxKind["ClassExpression"] = 175] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 176] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 177] = "ExpressionWithTypeArguments"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 176] = "TemplateSpan"; - SyntaxKind[SyntaxKind["HeritageClauseElement"] = 177] = "HeritageClauseElement"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 178] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 178] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 179] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 179] = "Block"; - SyntaxKind[SyntaxKind["VariableStatement"] = 180] = "VariableStatement"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 181] = "EmptyStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 182] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 183] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 184] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 185] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 186] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 187] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 188] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 189] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 190] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 191] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 192] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 193] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 194] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 195] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 196] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 197] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 198] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 199] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 200] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 201] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 202] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 203] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 204] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 205] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 206] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 207] = "CaseBlock"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 208] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 209] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 210] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 211] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 212] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 213] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 214] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 215] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 216] = "NamedExports"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 217] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 218] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 180] = "Block"; + SyntaxKind[SyntaxKind["VariableStatement"] = 181] = "VariableStatement"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 182] = "EmptyStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 183] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 184] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 185] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 186] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 187] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 188] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 189] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 190] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 191] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 192] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 193] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 194] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 195] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 196] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 197] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 198] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 199] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 200] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 201] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 202] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 203] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 204] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 205] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 206] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 207] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 208] = "CaseBlock"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 209] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 210] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 211] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 212] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 213] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 214] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 215] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 216] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 217] = "NamedExports"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 218] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 219] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 219] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 220] = "ExternalModuleReference"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 220] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 221] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 222] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 223] = "CatchClause"; + SyntaxKind[SyntaxKind["CaseClause"] = 221] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 222] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 223] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 224] = "CatchClause"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 224] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 225] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 225] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 226] = "ShorthandPropertyAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 226] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 227] = "EnumMember"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 227] = "SourceFile"; + SyntaxKind[SyntaxKind["SourceFile"] = 228] = "SourceFile"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 228] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 229] = "SyntaxList"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 229] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 230] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 53] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 64] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstReservedWord"] = 66] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 101] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 66] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 125] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 126] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 102] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 110] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 141] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 149] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 142] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 150] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 14] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 64] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 125] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 126] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 6] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 7] = "FirstLiteralToken"; @@ -296,7 +297,7 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 13] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 24] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 64] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstNode"] = 126] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstNode"] = 127] = "FirstNode"; })(ts.SyntaxKind || (ts.SyntaxKind = {})); var SyntaxKind = ts.SyntaxKind; (function (NodeFlags) { @@ -313,7 +314,8 @@ var ts; NodeFlags[NodeFlags["Let"] = 4096] = "Let"; NodeFlags[NodeFlags["Const"] = 8192] = "Const"; NodeFlags[NodeFlags["OctalLiteral"] = 16384] = "OctalLiteral"; - NodeFlags[NodeFlags["ExportContext"] = 32768] = "ExportContext"; + NodeFlags[NodeFlags["Namespace"] = 32768] = "Namespace"; + NodeFlags[NodeFlags["ExportContext"] = 65536] = "ExportContext"; NodeFlags[NodeFlags["Modifier"] = 499] = "Modifier"; NodeFlags[NodeFlags["AccessibilityModifier"] = 112] = "AccessibilityModifier"; NodeFlags[NodeFlags["BlockScoped"] = 12288] = "BlockScoped"; @@ -542,6 +544,7 @@ var ts; ModuleKind[ModuleKind["CommonJS"] = 1] = "CommonJS"; ModuleKind[ModuleKind["AMD"] = 2] = "AMD"; ModuleKind[ModuleKind["UMD"] = 3] = "UMD"; + ModuleKind[ModuleKind["System"] = 4] = "System"; })(ts.ModuleKind || (ts.ModuleKind = {})); var ModuleKind = ts.ModuleKind; (function (ScriptTarget) { @@ -1695,7 +1698,7 @@ var ts; A_get_accessor_cannot_have_parameters: { code: 1054, category: ts.DiagnosticCategory.Error, key: "A 'get' accessor cannot have parameters." }, Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: "Accessors are only available when targeting ECMAScript 5 and higher." }, Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum member must have initializer." }, - An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An export assignment cannot be used in an internal module." }, + An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An export assignment cannot be used in a namespace." }, Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: ts.DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers." }, Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: "Unexpected token. A constructor, method, accessor, or property was expected." }, A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an import declaration." }, @@ -1756,8 +1759,8 @@ var ts; or_expected: { code: 1144, category: ts.DiagnosticCategory.Error, key: "'{' or ';' expected." }, Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: ts.DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members." }, Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: "Declaration expected." }, - Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Cannot compile external modules unless the '--module' flag is provided." }, + Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: "Import declarations in a namespace cannot reference a module." }, + Cannot_compile_modules_unless_the_module_flag_is_provided: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules unless the '--module' flag is provided." }, File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array()' instead." }, var_let_or_const_expected: { code: 1152, category: ts.DiagnosticCategory.Error, key: "'var', 'let' or 'const' expected." }, @@ -1799,9 +1802,9 @@ var ts; The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: ts.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: ts.DiagnosticCategory.Error, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, An_import_declaration_cannot_have_modifiers: { code: 1191, category: ts.DiagnosticCategory.Error, key: "An import declaration cannot have modifiers." }, - External_module_0_has_no_default_export: { code: 1192, category: ts.DiagnosticCategory.Error, key: "External module '{0}' has no default export." }, + Module_0_has_no_default_export: { code: 1192, category: ts.DiagnosticCategory.Error, key: "Module '{0}' has no default export." }, An_export_declaration_cannot_have_modifiers: { code: 1193, category: ts.DiagnosticCategory.Error, key: "An export declaration cannot have modifiers." }, - Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: ts.DiagnosticCategory.Error, key: "Export declarations are not permitted in an internal module." }, + Export_declarations_are_not_permitted_in_a_namespace: { code: 1194, category: ts.DiagnosticCategory.Error, key: "Export declarations are not permitted in a namespace." }, Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: ts.DiagnosticCategory.Error, key: "Catch clause variable name must be an identifier." }, Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: ts.DiagnosticCategory.Error, key: "Catch clause variable cannot have a type annotation." }, Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: ts.DiagnosticCategory.Error, key: "Catch clause variable cannot have an initializer." }, @@ -1810,28 +1813,27 @@ var ts; Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." }, Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." }, Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." }, - Cannot_compile_external_modules_into_amd_commonjs_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile external modules into 'amd', 'commonjs' or 'umd' when targeting 'ES6' or higher." }, + Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: ts.DiagnosticCategory.Error, key: "Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher." }, Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: ts.DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." }, Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators are not valid here." }, Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." }, - Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." }, + Cannot_compile_namespaces_when_the_separateCompilation_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--separateCompilation' flag is provided." }, Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." }, Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: ts.DiagnosticCategory.Error, key: "Invalid use of '{0}'. Class definitions are automatically in strict mode." }, A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" }, Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode" }, Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: ts.DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, - Identifier_expected_0_is_a_reserved_word_in_strict_mode_External_Module_is_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. External Module is automatically in strict mode." }, Type_expected_0_is_a_reserved_word_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode" }, Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, - Type_expected_0_is_a_reserved_word_in_strict_mode_Module_is_automatically_in_strict_mode: { code: 1217, category: ts.DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Module is automatically in strict mode." }, + Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export assignment is not supported when '--module' flag is 'system'." }, Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.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: ts.DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, Circular_definition_of_import_alias_0: { code: 2303, category: ts.DiagnosticCategory.Error, key: "Circular definition of import alias '{0}'." }, Cannot_find_name_0: { code: 2304, category: ts.DiagnosticCategory.Error, key: "Cannot find name '{0}'." }, Module_0_has_no_exported_member_1: { code: 2305, category: ts.DiagnosticCategory.Error, key: "Module '{0}' has no exported member '{1}'." }, - File_0_is_not_an_external_module: { code: 2306, category: ts.DiagnosticCategory.Error, key: "File '{0}' is not an external module." }, - Cannot_find_external_module_0: { code: 2307, category: ts.DiagnosticCategory.Error, key: "Cannot find external module '{0}'." }, + File_0_is_not_a_module: { code: 2306, category: ts.DiagnosticCategory.Error, key: "File '{0}' is not a module." }, + Cannot_find_module_0: { code: 2307, category: ts.DiagnosticCategory.Error, key: "Cannot find module '{0}'." }, A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Type '{0}' recursively references itself as a base type." }, @@ -1854,7 +1856,7 @@ var ts; Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: ts.DiagnosticCategory.Error, key: "Types of parameters '{0}' and '{1}' are incompatible." }, Index_signature_is_missing_in_type_0: { code: 2329, category: ts.DiagnosticCategory.Error, key: "Index signature is missing in type '{0}'." }, Index_signatures_are_incompatible: { code: 2330, category: ts.DiagnosticCategory.Error, key: "Index signatures are incompatible." }, - this_cannot_be_referenced_in_a_module_body: { code: 2331, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in a module body." }, + this_cannot_be_referenced_in_a_module_or_namespace_body: { code: 2331, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in a module or namespace body." }, this_cannot_be_referenced_in_current_location: { code: 2332, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in current location." }, this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in constructor arguments." }, this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: ts.DiagnosticCategory.Error, key: "'this' cannot be referenced in a static property initializer." }, @@ -1946,15 +1948,15 @@ var ts; Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: "Interface '{0}' incorrectly extends interface '{1}'." }, Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Ambient external modules cannot be nested in other modules." }, - Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient external module declaration cannot specify relative module name." }, + A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be in a different file from a class or function with which it is merged" }, + A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A namespace declaration cannot be located prior to a class or function with which it is merged" }, + Ambient_modules_cannot_be_nested_in_other_modules: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient modules cannot be nested in other modules." }, + Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient module declaration cannot specify relative module name." }, Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module '{0}' is hidden by a local declaration with the same name" }, Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import name cannot be '{0}'" }, - Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." }, + Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: "Import or export declaration in an ambient module declaration cannot reference module through relative module name." }, Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.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: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." }, + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { code: 2441, category: ts.DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module." }, Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, @@ -2008,8 +2010,8 @@ var ts; Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: ts.DiagnosticCategory.Error, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: ts.DiagnosticCategory.Error, key: "Type '{0}' is not an array type or a string type." }, The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: { code: 2496, category: ts.DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression." }, - External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, - External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." }, + Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: "Module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, + Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: "Module '{0}' uses 'export =' and cannot be used with 'export *'." }, An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." }, A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." }, A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." }, @@ -2088,6 +2090,7 @@ var ts; Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot read file '{0}': {1}" }, Unsupported_file_encoding: { code: 5013, category: ts.DiagnosticCategory.Error, key: "Unsupported file encoding." }, + Failed_to_parse_file_0_Colon_1: { code: 5014, category: ts.DiagnosticCategory.Error, key: "Failed to parse file '{0}': {1}." }, Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, @@ -2101,6 +2104,10 @@ var ts; Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { code: 5045, category: ts.DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." }, Option_out_cannot_be_specified_with_option_separateCompilation: { code: 5046, category: ts.DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'separateCompilation'." }, Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." }, + Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap: { code: 5048, category: ts.DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'inlineSourceMap'." }, + Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5049, category: ts.DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified with option 'inlineSourceMap'." }, + Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap: { code: 5050, category: ts.DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified with option 'inlineSourceMap'." }, + Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option 'inlineSources' can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, @@ -2112,7 +2119,7 @@ var ts; Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do not emit comments to output." }, Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do not emit outputs." }, Specify_ECMAScript_target_version_Colon_ES3_default_ES5_or_ES6_experimental: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)" }, - Specify_module_code_generation_Colon_commonjs_amd_or_umd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', or 'umd'." }, + Specify_module_code_generation_Colon_commonjs_amd_system_or_umd: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'" }, Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print the compiler's version." }, Compile_the_project_in_the_given_directory: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile the project in the given directory." }, @@ -2133,7 +2140,7 @@ var ts; Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." }, Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated quoted string in response file '{0}'." }, - Argument_for_module_option_must_be_commonjs_amd_or_umd: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', or 'umd'." }, + Argument_for_module_option_must_be_commonjs_amd_system_or_umd: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument for '--module' option must be 'commonjs', 'amd', 'system' or 'umd'." }, Argument_for_target_option_must_be_ES3_ES5_or_ES6: { code: 6047, category: ts.DiagnosticCategory.Error, 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: ts.DiagnosticCategory.Error, key: "Locale must be of the form or -. For example '{0}' or '{1}'." }, Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported locale '{0}'." }, @@ -2215,7 +2222,7 @@ var ts; "false": 80 /* FalseKeyword */, "finally": 81 /* FinallyKeyword */, "for": 82 /* ForKeyword */, - "from": 124 /* FromKeyword */, + "from": 125 /* FromKeyword */, "function": 83 /* FunctionKeyword */, "get": 116 /* GetKeyword */, "if": 84 /* IfKeyword */, @@ -2226,33 +2233,34 @@ var ts; "interface": 103 /* InterfaceKeyword */, "let": 104 /* LetKeyword */, "module": 117 /* ModuleKeyword */, + "namespace": 118 /* NamespaceKeyword */, "new": 88 /* NewKeyword */, "null": 89 /* NullKeyword */, - "number": 119 /* NumberKeyword */, + "number": 120 /* NumberKeyword */, "package": 105 /* PackageKeyword */, "private": 106 /* PrivateKeyword */, "protected": 107 /* ProtectedKeyword */, "public": 108 /* PublicKeyword */, - "require": 118 /* RequireKeyword */, + "require": 119 /* RequireKeyword */, "return": 90 /* ReturnKeyword */, - "set": 120 /* SetKeyword */, + "set": 121 /* SetKeyword */, "static": 109 /* StaticKeyword */, - "string": 121 /* StringKeyword */, + "string": 122 /* StringKeyword */, "super": 91 /* SuperKeyword */, "switch": 92 /* SwitchKeyword */, - "symbol": 122 /* SymbolKeyword */, + "symbol": 123 /* SymbolKeyword */, "this": 93 /* ThisKeyword */, "throw": 94 /* ThrowKeyword */, "true": 95 /* TrueKeyword */, "try": 96 /* TryKeyword */, - "type": 123 /* TypeKeyword */, + "type": 124 /* TypeKeyword */, "typeof": 97 /* TypeOfKeyword */, "var": 98 /* VarKeyword */, "void": 99 /* VoidKeyword */, "while": 100 /* WhileKeyword */, "with": 101 /* WithKeyword */, "yield": 110 /* YieldKeyword */, - "of": 125 /* OfKeyword */, + "of": 126 /* OfKeyword */, "{": 14 /* OpenBraceToken */, "}": 15 /* CloseBraceToken */, "(": 16 /* OpenParenToken */, @@ -3570,16 +3578,16 @@ var ts; function getModuleInstanceState(node) { // A module is uninstantiated if it contains only // 1. interface declarations, type alias declarations - if (node.kind === 202 /* InterfaceDeclaration */ || node.kind === 203 /* TypeAliasDeclaration */) { + if (node.kind === 203 /* InterfaceDeclaration */ || node.kind === 204 /* TypeAliasDeclaration */) { return 0 /* NonInstantiated */; } else if (ts.isConstEnumDeclaration(node)) { return 2 /* ConstEnumOnly */; } - else if ((node.kind === 209 /* ImportDeclaration */ || node.kind === 208 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { + else if ((node.kind === 210 /* ImportDeclaration */ || node.kind === 209 /* ImportEqualsDeclaration */) && !(node.flags & 1 /* Export */)) { return 0 /* NonInstantiated */; } - else if (node.kind === 206 /* ModuleBlock */) { + else if (node.kind === 207 /* ModuleBlock */) { var state = 0 /* NonInstantiated */; ts.forEachChild(node, function (n) { switch (getModuleInstanceState(n)) { @@ -3598,7 +3606,7 @@ var ts; }); return state; } - else if (node.kind === 205 /* ModuleDeclaration */) { + else if (node.kind === 206 /* ModuleDeclaration */) { return getModuleInstanceState(node.body); } else { @@ -3653,10 +3661,10 @@ var ts; // unless it is a well known Symbol. function getDeclarationName(node) { if (node.name) { - if (node.kind === 205 /* ModuleDeclaration */ && node.name.kind === 8 /* StringLiteral */) { + if (node.kind === 206 /* ModuleDeclaration */ && node.name.kind === 8 /* StringLiteral */) { return '"' + node.name.text + '"'; } - if (node.name.kind === 127 /* ComputedPropertyName */) { + if (node.name.kind === 128 /* ComputedPropertyName */) { var nameExpression = node.name.expression; ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); @@ -3664,22 +3672,22 @@ var ts; return node.name.text; } switch (node.kind) { - case 143 /* ConstructorType */: - case 135 /* Constructor */: + case 144 /* ConstructorType */: + case 136 /* Constructor */: return "__constructor"; - case 142 /* FunctionType */: - case 138 /* CallSignature */: + case 143 /* FunctionType */: + case 139 /* CallSignature */: return "__call"; - case 139 /* ConstructSignature */: + case 140 /* ConstructSignature */: return "__new"; - case 140 /* IndexSignature */: + case 141 /* IndexSignature */: return "__index"; - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: return "__export"; - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: return node.isExportEquals ? "export=" : "default"; - case 200 /* FunctionDeclaration */: - case 201 /* ClassDeclaration */: + case 201 /* FunctionDeclaration */: + case 202 /* ClassDeclaration */: return node.flags & 256 /* Default */ ? "default" : undefined; } } @@ -3714,7 +3722,7 @@ var ts; } addDeclarationToSymbol(symbol, node, includes); symbol.parent = parent; - if ((node.kind === 201 /* ClassDeclaration */ || node.kind === 174 /* ClassExpression */) && symbol.exports) { + if ((node.kind === 202 /* ClassDeclaration */ || node.kind === 175 /* ClassExpression */) && symbol.exports) { // TypeScript 1.0 spec (April 2014): 8.4 // Every class automatically contains a static property member named 'prototype', // the type of which is an instantiation of the class type with type Any supplied as a type argument for each type parameter. @@ -3734,7 +3742,7 @@ var ts; function declareModuleMember(node, symbolKind, symbolExcludes) { var hasExportModifier = ts.getCombinedNodeFlags(node) & 1 /* Export */; if (symbolKind & 8388608 /* Alias */) { - if (node.kind === 217 /* ExportSpecifier */ || (node.kind === 208 /* ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 218 /* ExportSpecifier */ || (node.kind === 209 /* ImportEqualsDeclaration */ && hasExportModifier)) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); } else { @@ -3753,7 +3761,7 @@ var ts; // 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 || container.flags & 32768 /* ExportContext */) { + if (hasExportModifier || container.flags & 65536 /* ExportContext */) { var exportKind = (symbolKind & 107455 /* Value */ ? 1048576 /* ExportValue */ : 0) | (symbolKind & 793056 /* Type */ ? 2097152 /* ExportType */ : 0) | (symbolKind & 1536 /* Namespace */ ? 4194304 /* ExportNamespace */ : 0); @@ -3787,7 +3795,7 @@ var ts; // these cases are: // - node has locals (symbolKind & HasLocals) !== 0 // - node is a source file - setBlockScopeContainer(node, (symbolKind & 255504 /* HasLocals */) === 0 && node.kind !== 227 /* SourceFile */); + setBlockScopeContainer(node, (symbolKind & 255504 /* HasLocals */) === 0 && node.kind !== 228 /* SourceFile */); } ts.forEachChild(node, bind); container = saveContainer; @@ -3802,41 +3810,41 @@ var ts; } function bindDeclaration(node, symbolKind, symbolExcludes, isBlockScopeContainer) { switch (container.kind) { - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 227 /* SourceFile */: + case 228 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; } - case 142 /* FunctionType */: - case 143 /* ConstructorType */: - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: - case 140 /* IndexSignature */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: + case 141 /* IndexSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes); break; - case 174 /* ClassExpression */: - case 201 /* ClassDeclaration */: + case 175 /* ClassExpression */: + case 202 /* ClassDeclaration */: if (node.flags & 128 /* Static */) { declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } - case 145 /* TypeLiteral */: - case 154 /* ObjectLiteralExpression */: - case 202 /* InterfaceDeclaration */: + case 146 /* TypeLiteral */: + case 155 /* ObjectLiteralExpression */: + case 203 /* InterfaceDeclaration */: declareSymbol(container.symbol.members, container.symbol, node, symbolKind, symbolExcludes); break; - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes); break; } @@ -3851,11 +3859,11 @@ var ts; return false; } function hasExportDeclarations(node) { - var body = node.kind === 227 /* SourceFile */ ? node : node.body; - if (body.kind === 227 /* SourceFile */ || body.kind === 206 /* ModuleBlock */) { + var body = node.kind === 228 /* SourceFile */ ? node : node.body; + if (body.kind === 228 /* SourceFile */ || body.kind === 207 /* ModuleBlock */) { for (var _i = 0, _a = body.statements; _i < _a.length; _i++) { var stat = _a[_i]; - if (stat.kind === 215 /* ExportDeclaration */ || stat.kind === 214 /* ExportAssignment */) { + if (stat.kind === 216 /* ExportDeclaration */ || stat.kind === 215 /* ExportAssignment */) { return true; } } @@ -3866,10 +3874,10 @@ var ts; // A declaration source file or ambient module declaration that contains no export declarations (but possibly regular // declarations with export modifiers) is an export context in which declarations are implicitly exported. if (isAmbientContext(node) && !hasExportDeclarations(node)) { - node.flags |= 32768 /* ExportContext */; + node.flags |= 65536 /* ExportContext */; } else { - node.flags &= ~32768 /* ExportContext */; + node.flags &= ~65536 /* ExportContext */; } } function bindModuleDeclaration(node) { @@ -3909,7 +3917,7 @@ var ts; var typeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, 2048 /* TypeLiteral */); typeLiteralSymbol.members = {}; - typeLiteralSymbol.members[node.kind === 142 /* FunctionType */ ? "__call" : "__new"] = symbol; + typeLiteralSymbol.members[node.kind === 143 /* FunctionType */ ? "__call" : "__new"] = symbol; } function bindAnonymousDeclaration(node, symbolKind, name, isBlockScopeContainer) { var symbol = createSymbol(symbolKind, name); @@ -3921,10 +3929,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolKind, symbolExcludes) { switch (blockScopeContainer.kind) { - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: declareModuleMember(node, symbolKind, symbolExcludes); break; - case 227 /* SourceFile */: + case 228 /* SourceFile */: if (ts.isExternalModule(container)) { declareModuleMember(node, symbolKind, symbolExcludes); break; @@ -3948,14 +3956,14 @@ var ts; function bind(node) { node.parent = parent; switch (node.kind) { - case 128 /* TypeParameter */: + case 129 /* TypeParameter */: bindDeclaration(node, 262144 /* TypeParameter */, 530912 /* TypeParameterExcludes */, false); break; - case 129 /* Parameter */: + case 130 /* Parameter */: bindParameter(node); break; - case 198 /* VariableDeclaration */: - case 152 /* BindingElement */: + case 199 /* VariableDeclaration */: + case 153 /* BindingElement */: if (ts.isBindingPattern(node.name)) { bindChildren(node, 0, false); } @@ -3966,72 +3974,72 @@ var ts; bindDeclaration(node, 1 /* FunctionScopedVariable */, 107454 /* FunctionScopedVariableExcludes */, false); } break; - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: bindPropertyOrMethodOrAccessor(node, 4 /* Property */ | (node.questionToken ? 536870912 /* Optional */ : 0), 107455 /* PropertyExcludes */, false); break; - case 224 /* PropertyAssignment */: - case 225 /* ShorthandPropertyAssignment */: + case 225 /* PropertyAssignment */: + case 226 /* ShorthandPropertyAssignment */: bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 107455 /* PropertyExcludes */, false); break; - case 226 /* EnumMember */: + case 227 /* EnumMember */: bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 107455 /* EnumMemberExcludes */, false); break; - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: - case 140 /* IndexSignature */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: + case 141 /* IndexSignature */: bindDeclaration(node, 131072 /* Signature */, 0, false); break; - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 536870912 /* Optional */ : 0), ts.isObjectLiteralMethod(node) ? 107455 /* PropertyExcludes */ : 99263 /* MethodExcludes */, true); break; - case 200 /* FunctionDeclaration */: + case 201 /* FunctionDeclaration */: bindDeclaration(node, 16 /* Function */, 106927 /* FunctionExcludes */, true); break; - case 135 /* Constructor */: + case 136 /* Constructor */: bindDeclaration(node, 16384 /* Constructor */, 0, true); break; - case 136 /* GetAccessor */: + case 137 /* GetAccessor */: bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 41919 /* GetAccessorExcludes */, true); break; - case 137 /* SetAccessor */: + case 138 /* SetAccessor */: bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 74687 /* SetAccessorExcludes */, true); break; - case 142 /* FunctionType */: - case 143 /* ConstructorType */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: bindFunctionOrConstructorType(node); break; - case 145 /* TypeLiteral */: + case 146 /* TypeLiteral */: bindAnonymousDeclaration(node, 2048 /* TypeLiteral */, "__type", false); break; - case 154 /* ObjectLiteralExpression */: + case 155 /* ObjectLiteralExpression */: bindAnonymousDeclaration(node, 4096 /* ObjectLiteral */, "__object", false); break; - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: bindAnonymousDeclaration(node, 16 /* Function */, "__function", true); break; - case 174 /* ClassExpression */: + case 175 /* ClassExpression */: bindAnonymousDeclaration(node, 32 /* Class */, "__class", false); break; - case 223 /* CatchClause */: + case 224 /* CatchClause */: bindCatchVariableDeclaration(node); break; - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: bindBlockScopedDeclaration(node, 32 /* Class */, 899583 /* ClassExcludes */); break; - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: bindDeclaration(node, 64 /* Interface */, 792992 /* InterfaceExcludes */, false); break; - case 203 /* TypeAliasDeclaration */: + case 204 /* TypeAliasDeclaration */: bindDeclaration(node, 524288 /* TypeAlias */, 793056 /* TypeAliasExcludes */, false); break; - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: if (ts.isConst(node)) { bindDeclaration(node, 128 /* ConstEnum */, 899967 /* ConstEnumExcludes */, false); } @@ -4039,16 +4047,16 @@ var ts; bindDeclaration(node, 256 /* RegularEnum */, 899327 /* RegularEnumExcludes */, false); } break; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: bindModuleDeclaration(node); break; - case 208 /* ImportEqualsDeclaration */: - case 211 /* NamespaceImport */: - case 213 /* ImportSpecifier */: - case 217 /* ExportSpecifier */: + case 209 /* ImportEqualsDeclaration */: + case 212 /* NamespaceImport */: + case 214 /* ImportSpecifier */: + case 218 /* ExportSpecifier */: bindDeclaration(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */, false); break; - case 210 /* ImportClause */: + case 211 /* ImportClause */: if (node.name) { bindDeclaration(node, 8388608 /* Alias */, 8388608 /* AliasExcludes */, false); } @@ -4056,14 +4064,14 @@ var ts; bindChildren(node, 0, false); } break; - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: if (!node.exportClause) { // All export * declarations are collected in an __export symbol declareSymbol(container.symbol.exports, container.symbol, node, 1073741824 /* ExportStar */, 0); } bindChildren(node, 0, false); break; - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: if (node.expression.kind === 65 /* Identifier */) { // An export default clause with an identifier exports all meanings of that identifier declareSymbol(container.symbol.exports, container.symbol, node, 8388608 /* Alias */, 107455 /* PropertyExcludes */ | 8388608 /* AliasExcludes */); @@ -4074,13 +4082,13 @@ var ts; } bindChildren(node, 0, false); break; - case 227 /* SourceFile */: + case 228 /* SourceFile */: setExportContextFlag(node); if (ts.isExternalModule(node)) { bindAnonymousDeclaration(node, 512 /* ValueModule */, '"' + ts.removeFileExtension(node.fileName) + '"', true); break; } - case 179 /* Block */: + case 180 /* Block */: // do not treat function block a block-scope container // all block-scope locals that reside in this block should go to the function locals. // Otherwise this won't be considered as redeclaration of a block scoped local: @@ -4091,11 +4099,11 @@ var ts; // 'let x' will be placed into the function locals and 'let x' - into the locals of the block bindChildren(node, 0, !ts.isFunctionLike(node.parent)); break; - case 223 /* CatchClause */: - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 207 /* CaseBlock */: + case 224 /* CatchClause */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 208 /* CaseBlock */: bindChildren(node, 0, true); break; default: @@ -4115,8 +4123,8 @@ var ts; // If this is a property-parameter, then also declare the property symbol into the // containing class. if (node.flags & 112 /* AccessibilityModifier */ && - node.parent.kind === 135 /* Constructor */ && - (node.parent.parent.kind === 201 /* ClassDeclaration */ || node.parent.parent.kind === 174 /* ClassExpression */)) { + node.parent.kind === 136 /* Constructor */ && + (node.parent.parent.kind === 202 /* ClassDeclaration */ || node.parent.parent.kind === 175 /* ClassExpression */)) { var classDeclaration = node.parent.parent; declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 /* Property */, 107455 /* PropertyExcludes */); } @@ -4206,7 +4214,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 227 /* SourceFile */) { + while (node && node.kind !== 228 /* SourceFile */) { node = node.parent; } return node; @@ -4316,15 +4324,15 @@ var ts; return current; } switch (current.kind) { - case 227 /* SourceFile */: - case 207 /* CaseBlock */: - case 223 /* CatchClause */: - case 205 /* ModuleDeclaration */: - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: + case 228 /* SourceFile */: + case 208 /* CaseBlock */: + case 224 /* CatchClause */: + case 206 /* ModuleDeclaration */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: return current; - case 179 /* Block */: + case 180 /* Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block if (!isFunctionLike(current.parent)) { @@ -4337,9 +4345,9 @@ var ts; ts.getEnclosingBlockScopeContainer = getEnclosingBlockScopeContainer; function isCatchClauseVariableDeclaration(declaration) { return declaration && - declaration.kind === 198 /* VariableDeclaration */ && + declaration.kind === 199 /* VariableDeclaration */ && declaration.parent && - declaration.parent.kind === 223 /* CatchClause */; + declaration.parent.kind === 224 /* CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; // Return display name of an identifier @@ -4378,7 +4386,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 227 /* SourceFile */: + case 228 /* SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -4387,16 +4395,16 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 198 /* VariableDeclaration */: - case 152 /* BindingElement */: - case 201 /* ClassDeclaration */: - case 174 /* ClassExpression */: - case 202 /* InterfaceDeclaration */: - case 205 /* ModuleDeclaration */: - case 204 /* EnumDeclaration */: - case 226 /* EnumMember */: - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: + case 199 /* VariableDeclaration */: + case 153 /* BindingElement */: + case 202 /* ClassDeclaration */: + case 175 /* ClassExpression */: + case 203 /* InterfaceDeclaration */: + case 206 /* ModuleDeclaration */: + case 205 /* EnumDeclaration */: + case 227 /* EnumMember */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: errorNode = node.name; break; } @@ -4420,11 +4428,11 @@ var ts; } ts.isDeclarationFile = isDeclarationFile; function isConstEnumDeclaration(node) { - return node.kind === 204 /* EnumDeclaration */ && isConst(node); + return node.kind === 205 /* EnumDeclaration */ && isConst(node); } ts.isConstEnumDeclaration = isConstEnumDeclaration; function walkUpBindingElementsAndPatterns(node) { - while (node && (node.kind === 152 /* BindingElement */ || isBindingPattern(node))) { + while (node && (node.kind === 153 /* BindingElement */ || isBindingPattern(node))) { node = node.parent; } return node; @@ -4439,14 +4447,14 @@ var ts; function getCombinedNodeFlags(node) { node = walkUpBindingElementsAndPatterns(node); var flags = node.flags; - if (node.kind === 198 /* VariableDeclaration */) { + if (node.kind === 199 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 199 /* VariableDeclarationList */) { + if (node && node.kind === 200 /* VariableDeclarationList */) { flags |= node.flags; node = node.parent; } - if (node && node.kind === 180 /* VariableStatement */) { + if (node && node.kind === 181 /* VariableStatement */) { flags |= node.flags; } return flags; @@ -4461,12 +4469,12 @@ var ts; } ts.isLet = isLet; function isPrologueDirective(node) { - return node.kind === 182 /* ExpressionStatement */ && node.expression.kind === 8 /* StringLiteral */; + return node.kind === 183 /* ExpressionStatement */ && node.expression.kind === 8 /* StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { // If parameter/type parameter, the prev token trailing comments are part of this node too - if (node.kind === 129 /* Parameter */ || node.kind === 128 /* TypeParameter */) { + if (node.kind === 130 /* Parameter */ || node.kind === 129 /* TypeParameter */) { // e.g. (/** blah */ a, /** blah */ b); // e.g.: ( // /** blah */ a, @@ -4495,23 +4503,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 191 /* ReturnStatement */: + case 192 /* ReturnStatement */: return visitor(node); - case 207 /* CaseBlock */: - case 179 /* Block */: - case 183 /* IfStatement */: - case 184 /* DoStatement */: - case 185 /* WhileStatement */: - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 192 /* WithStatement */: - case 193 /* SwitchStatement */: - case 220 /* CaseClause */: - case 221 /* DefaultClause */: - case 194 /* LabeledStatement */: - case 196 /* TryStatement */: - case 223 /* CatchClause */: + case 208 /* CaseBlock */: + case 180 /* Block */: + case 184 /* IfStatement */: + case 185 /* DoStatement */: + case 186 /* WhileStatement */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 193 /* WithStatement */: + case 194 /* SwitchStatement */: + case 221 /* CaseClause */: + case 222 /* DefaultClause */: + case 195 /* LabeledStatement */: + case 197 /* TryStatement */: + case 224 /* CatchClause */: return ts.forEachChild(node, traverse); } } @@ -4520,14 +4528,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 152 /* BindingElement */: - case 226 /* EnumMember */: - case 129 /* Parameter */: - case 224 /* PropertyAssignment */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 225 /* ShorthandPropertyAssignment */: - case 198 /* VariableDeclaration */: + case 153 /* BindingElement */: + case 227 /* EnumMember */: + case 130 /* Parameter */: + case 225 /* PropertyAssignment */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 226 /* ShorthandPropertyAssignment */: + case 199 /* VariableDeclaration */: return true; } } @@ -4537,8 +4545,8 @@ var ts; function isAccessor(node) { if (node) { switch (node.kind) { - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: return true; } } @@ -4548,22 +4556,22 @@ var ts; function isFunctionLike(node) { if (node) { switch (node.kind) { - case 135 /* Constructor */: - case 162 /* FunctionExpression */: - case 200 /* FunctionDeclaration */: - case 163 /* ArrowFunction */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: - case 140 /* IndexSignature */: - case 142 /* FunctionType */: - case 143 /* ConstructorType */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: - case 200 /* FunctionDeclaration */: + case 136 /* Constructor */: + case 163 /* FunctionExpression */: + case 201 /* FunctionDeclaration */: + case 164 /* ArrowFunction */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: + case 141 /* IndexSignature */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: + case 201 /* FunctionDeclaration */: return true; } } @@ -4571,11 +4579,11 @@ var ts; } ts.isFunctionLike = isFunctionLike; function isFunctionBlock(node) { - return node && node.kind === 179 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 180 /* Block */ && isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 134 /* MethodDeclaration */ && node.parent.kind === 154 /* ObjectLiteralExpression */; + return node && node.kind === 135 /* MethodDeclaration */ && node.parent.kind === 155 /* ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function getContainingFunction(node) { @@ -4594,12 +4602,12 @@ var ts; return undefined; } switch (node.kind) { - case 127 /* ComputedPropertyName */: + case 128 /* ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container // so that we can error on it. - if (node.parent.parent.kind === 201 /* ClassDeclaration */) { + if (node.parent.parent.kind === 202 /* ClassDeclaration */) { return node; } // If this is a computed property, then the parent should not @@ -4609,9 +4617,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 130 /* Decorator */: + case 131 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 129 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 130 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -4622,23 +4630,23 @@ var ts; node = node.parent; } break; - case 163 /* ArrowFunction */: + case 164 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } // Fall through - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 205 /* ModuleDeclaration */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 204 /* EnumDeclaration */: - case 227 /* SourceFile */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 206 /* ModuleDeclaration */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 205 /* EnumDeclaration */: + case 228 /* SourceFile */: return node; } } @@ -4650,12 +4658,12 @@ var ts; if (!node) return node; switch (node.kind) { - case 127 /* ComputedPropertyName */: + case 128 /* ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'super' container. // A computed property name in a class needs to be a super container // so that we can error on it. - if (node.parent.parent.kind === 201 /* ClassDeclaration */) { + if (node.parent.parent.kind === 202 /* ClassDeclaration */) { return node; } // If this is a computed property, then the parent should not @@ -4665,9 +4673,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 130 /* Decorator */: + case 131 /* Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 129 /* Parameter */ && isClassElement(node.parent.parent)) { + if (node.parent.kind === 130 /* Parameter */ && isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -4678,26 +4686,26 @@ var ts; node = node.parent; } break; - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: if (!includeFunctions) { continue; } - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: return node; } } } ts.getSuperContainer = getSuperContainer; function getInvokedExpression(node) { - if (node.kind === 159 /* TaggedTemplateExpression */) { + if (node.kind === 160 /* TaggedTemplateExpression */) { return node.tag; } // Will either be a CallExpression or NewExpression. @@ -4706,44 +4714,44 @@ var ts; ts.getInvokedExpression = getInvokedExpression; function nodeCanBeDecorated(node) { switch (node.kind) { - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: // classes are valid targets return true; - case 132 /* PropertyDeclaration */: + case 133 /* PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return node.parent.kind === 201 /* ClassDeclaration */; - case 129 /* Parameter */: + return node.parent.kind === 202 /* ClassDeclaration */; + case 130 /* Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; - return node.parent.body && node.parent.parent.kind === 201 /* ClassDeclaration */; - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 134 /* MethodDeclaration */: + return node.parent.body && node.parent.parent.kind === 202 /* ClassDeclaration */; + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 135 /* MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. - return node.body && node.parent.kind === 201 /* ClassDeclaration */; + return node.body && node.parent.kind === 202 /* ClassDeclaration */; } return false; } ts.nodeCanBeDecorated = nodeCanBeDecorated; function nodeIsDecorated(node) { switch (node.kind) { - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: if (node.decorators) { return true; } return false; - case 132 /* PropertyDeclaration */: - case 129 /* Parameter */: + case 133 /* PropertyDeclaration */: + case 130 /* Parameter */: if (node.decorators) { return true; } return false; - case 136 /* GetAccessor */: + case 137 /* GetAccessor */: if (node.body && node.decorators) { return true; } return false; - case 134 /* MethodDeclaration */: - case 137 /* SetAccessor */: + case 135 /* MethodDeclaration */: + case 138 /* SetAccessor */: if (node.body && node.decorators) { return true; } @@ -4754,10 +4762,10 @@ var ts; ts.nodeIsDecorated = nodeIsDecorated; function childIsDecorated(node) { switch (node.kind) { - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: return ts.forEach(node.members, nodeOrChildIsDecorated); - case 134 /* MethodDeclaration */: - case 137 /* SetAccessor */: + case 135 /* MethodDeclaration */: + case 138 /* SetAccessor */: return ts.forEach(node.parameters, nodeIsDecorated); } return false; @@ -4775,37 +4783,37 @@ var ts; case 95 /* TrueKeyword */: case 80 /* FalseKeyword */: case 9 /* RegularExpressionLiteral */: - case 153 /* ArrayLiteralExpression */: - case 154 /* ObjectLiteralExpression */: - case 155 /* PropertyAccessExpression */: - case 156 /* ElementAccessExpression */: - case 157 /* CallExpression */: - case 158 /* NewExpression */: - case 159 /* TaggedTemplateExpression */: - case 160 /* TypeAssertionExpression */: - case 161 /* ParenthesizedExpression */: - case 162 /* FunctionExpression */: - case 174 /* ClassExpression */: - case 163 /* ArrowFunction */: - case 166 /* VoidExpression */: - case 164 /* DeleteExpression */: - case 165 /* TypeOfExpression */: - case 167 /* PrefixUnaryExpression */: - case 168 /* PostfixUnaryExpression */: - case 169 /* BinaryExpression */: - case 170 /* ConditionalExpression */: - case 173 /* SpreadElementExpression */: - case 171 /* TemplateExpression */: + case 154 /* ArrayLiteralExpression */: + case 155 /* ObjectLiteralExpression */: + case 156 /* PropertyAccessExpression */: + case 157 /* ElementAccessExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: + case 160 /* TaggedTemplateExpression */: + case 161 /* TypeAssertionExpression */: + case 162 /* ParenthesizedExpression */: + case 163 /* FunctionExpression */: + case 175 /* ClassExpression */: + case 164 /* ArrowFunction */: + case 167 /* VoidExpression */: + case 165 /* DeleteExpression */: + case 166 /* TypeOfExpression */: + case 168 /* PrefixUnaryExpression */: + case 169 /* PostfixUnaryExpression */: + case 170 /* BinaryExpression */: + case 171 /* ConditionalExpression */: + case 174 /* SpreadElementExpression */: + case 172 /* TemplateExpression */: case 10 /* NoSubstitutionTemplateLiteral */: - case 175 /* OmittedExpression */: + case 176 /* OmittedExpression */: return true; - case 126 /* QualifiedName */: - while (node.parent.kind === 126 /* QualifiedName */) { + case 127 /* QualifiedName */: + while (node.parent.kind === 127 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 144 /* TypeQuery */; + return node.parent.kind === 145 /* TypeQuery */; case 65 /* Identifier */: - if (node.parent.kind === 144 /* TypeQuery */) { + if (node.parent.kind === 145 /* TypeQuery */) { return true; } // fall through @@ -4813,42 +4821,42 @@ var ts; case 8 /* StringLiteral */: var parent_1 = node.parent; switch (parent_1.kind) { - case 198 /* VariableDeclaration */: - case 129 /* Parameter */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 226 /* EnumMember */: - case 224 /* PropertyAssignment */: - case 152 /* BindingElement */: + case 199 /* VariableDeclaration */: + case 130 /* Parameter */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 227 /* EnumMember */: + case 225 /* PropertyAssignment */: + case 153 /* BindingElement */: return parent_1.initializer === node; - case 182 /* ExpressionStatement */: - case 183 /* IfStatement */: - case 184 /* DoStatement */: - case 185 /* WhileStatement */: - case 191 /* ReturnStatement */: - case 192 /* WithStatement */: - case 193 /* SwitchStatement */: - case 220 /* CaseClause */: - case 195 /* ThrowStatement */: - case 193 /* SwitchStatement */: + case 183 /* ExpressionStatement */: + case 184 /* IfStatement */: + case 185 /* DoStatement */: + case 186 /* WhileStatement */: + case 192 /* ReturnStatement */: + case 193 /* WithStatement */: + case 194 /* SwitchStatement */: + case 221 /* CaseClause */: + case 196 /* ThrowStatement */: + case 194 /* SwitchStatement */: return parent_1.expression === node; - case 186 /* ForStatement */: + case 187 /* ForStatement */: var forStatement = parent_1; - return (forStatement.initializer === node && forStatement.initializer.kind !== 199 /* VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 200 /* VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: var forInStatement = parent_1; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 199 /* VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 200 /* VariableDeclarationList */) || forInStatement.expression === node; - case 160 /* TypeAssertionExpression */: + case 161 /* TypeAssertionExpression */: return node === parent_1.expression; - case 176 /* TemplateSpan */: + case 178 /* TemplateSpan */: return node === parent_1.expression; - case 127 /* ComputedPropertyName */: + case 128 /* ComputedPropertyName */: return node === parent_1.expression; - case 130 /* Decorator */: + case 131 /* Decorator */: return true; default: if (isExpression(parent_1)) { @@ -4866,7 +4874,7 @@ var ts; } ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 208 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 219 /* ExternalModuleReference */; + return node.kind === 209 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 220 /* ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -4875,40 +4883,40 @@ var ts; } ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 208 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 219 /* ExternalModuleReference */; + return node.kind === 209 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 220 /* ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function getExternalModuleName(node) { - if (node.kind === 209 /* ImportDeclaration */) { + if (node.kind === 210 /* ImportDeclaration */) { return node.moduleSpecifier; } - if (node.kind === 208 /* ImportEqualsDeclaration */) { + if (node.kind === 209 /* ImportEqualsDeclaration */) { var reference = node.moduleReference; - if (reference.kind === 219 /* ExternalModuleReference */) { + if (reference.kind === 220 /* ExternalModuleReference */) { return reference.expression; } } - if (node.kind === 215 /* ExportDeclaration */) { + if (node.kind === 216 /* ExportDeclaration */) { return node.moduleSpecifier; } } ts.getExternalModuleName = getExternalModuleName; function hasDotDotDotToken(node) { - return node && node.kind === 129 /* Parameter */ && node.dotDotDotToken !== undefined; + return node && node.kind === 130 /* Parameter */ && node.dotDotDotToken !== undefined; } ts.hasDotDotDotToken = hasDotDotDotToken; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 129 /* Parameter */: + case 130 /* Parameter */: return node.questionToken !== undefined; - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: return node.questionToken !== undefined; - case 225 /* ShorthandPropertyAssignment */: - case 224 /* PropertyAssignment */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 226 /* ShorthandPropertyAssignment */: + case 225 /* PropertyAssignment */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: return node.questionToken !== undefined; } } @@ -4932,7 +4940,7 @@ var ts; } ts.isTemplateLiteralKind = isTemplateLiteralKind; function isBindingPattern(node) { - return !!node && (node.kind === 151 /* ArrayBindingPattern */ || node.kind === 150 /* ObjectBindingPattern */); + return !!node && (node.kind === 152 /* ArrayBindingPattern */ || node.kind === 151 /* ObjectBindingPattern */); } ts.isBindingPattern = isBindingPattern; function isInAmbientContext(node) { @@ -4947,33 +4955,33 @@ var ts; ts.isInAmbientContext = isInAmbientContext; function isDeclaration(node) { switch (node.kind) { - case 163 /* ArrowFunction */: - case 152 /* BindingElement */: - case 201 /* ClassDeclaration */: - case 135 /* Constructor */: - case 204 /* EnumDeclaration */: - case 226 /* EnumMember */: - case 217 /* ExportSpecifier */: - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 136 /* GetAccessor */: - case 210 /* ImportClause */: - case 208 /* ImportEqualsDeclaration */: - case 213 /* ImportSpecifier */: - case 202 /* InterfaceDeclaration */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 205 /* ModuleDeclaration */: - case 211 /* NamespaceImport */: - case 129 /* Parameter */: - case 224 /* PropertyAssignment */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 137 /* SetAccessor */: - case 225 /* ShorthandPropertyAssignment */: - case 203 /* TypeAliasDeclaration */: - case 128 /* TypeParameter */: - case 198 /* VariableDeclaration */: + case 164 /* ArrowFunction */: + case 153 /* BindingElement */: + case 202 /* ClassDeclaration */: + case 136 /* Constructor */: + case 205 /* EnumDeclaration */: + case 227 /* EnumMember */: + case 218 /* ExportSpecifier */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 137 /* GetAccessor */: + case 211 /* ImportClause */: + case 209 /* ImportEqualsDeclaration */: + case 214 /* ImportSpecifier */: + case 203 /* InterfaceDeclaration */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 206 /* ModuleDeclaration */: + case 212 /* NamespaceImport */: + case 130 /* Parameter */: + case 225 /* PropertyAssignment */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 138 /* SetAccessor */: + case 226 /* ShorthandPropertyAssignment */: + case 204 /* TypeAliasDeclaration */: + case 129 /* TypeParameter */: + case 199 /* VariableDeclaration */: return true; } return false; @@ -4981,25 +4989,25 @@ var ts; ts.isDeclaration = isDeclaration; function isStatement(n) { switch (n.kind) { - case 190 /* BreakStatement */: - case 189 /* ContinueStatement */: - case 197 /* DebuggerStatement */: - case 184 /* DoStatement */: - case 182 /* ExpressionStatement */: - case 181 /* EmptyStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 186 /* ForStatement */: - case 183 /* IfStatement */: - case 194 /* LabeledStatement */: - case 191 /* ReturnStatement */: - case 193 /* SwitchStatement */: + case 191 /* BreakStatement */: + case 190 /* ContinueStatement */: + case 198 /* DebuggerStatement */: + case 185 /* DoStatement */: + case 183 /* ExpressionStatement */: + case 182 /* EmptyStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 187 /* ForStatement */: + case 184 /* IfStatement */: + case 195 /* LabeledStatement */: + case 192 /* ReturnStatement */: + case 194 /* SwitchStatement */: case 94 /* ThrowKeyword */: - case 196 /* TryStatement */: - case 180 /* VariableStatement */: - case 185 /* WhileStatement */: - case 192 /* WithStatement */: - case 214 /* ExportAssignment */: + case 197 /* TryStatement */: + case 181 /* VariableStatement */: + case 186 /* WhileStatement */: + case 193 /* WithStatement */: + case 215 /* ExportAssignment */: return true; default: return false; @@ -5008,13 +5016,13 @@ var ts; ts.isStatement = isStatement; function isClassElement(n) { switch (n.kind) { - case 135 /* Constructor */: - case 132 /* PropertyDeclaration */: - case 134 /* MethodDeclaration */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 133 /* MethodSignature */: - case 140 /* IndexSignature */: + case 136 /* Constructor */: + case 133 /* PropertyDeclaration */: + case 135 /* MethodDeclaration */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 134 /* MethodSignature */: + case 141 /* IndexSignature */: return true; default: return false; @@ -5027,7 +5035,7 @@ var ts; return false; } var parent = name.parent; - if (parent.kind === 213 /* ImportSpecifier */ || parent.kind === 217 /* ExportSpecifier */) { + if (parent.kind === 214 /* ImportSpecifier */ || parent.kind === 218 /* ExportSpecifier */) { if (parent.propertyName) { return true; } @@ -5047,12 +5055,12 @@ var ts; // export = ... // export default ... function isAliasSymbolDeclaration(node) { - return node.kind === 208 /* ImportEqualsDeclaration */ || - node.kind === 210 /* ImportClause */ && !!node.name || - node.kind === 211 /* NamespaceImport */ || - node.kind === 213 /* ImportSpecifier */ || - node.kind === 217 /* ExportSpecifier */ || - node.kind === 214 /* ExportAssignment */ && node.expression.kind === 65 /* Identifier */; + return node.kind === 209 /* ImportEqualsDeclaration */ || + node.kind === 211 /* ImportClause */ && !!node.name || + node.kind === 212 /* NamespaceImport */ || + node.kind === 214 /* ImportSpecifier */ || + node.kind === 218 /* ExportSpecifier */ || + node.kind === 215 /* ExportAssignment */ && node.expression.kind === 65 /* Identifier */; } ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getClassExtendsHeritageClauseElement(node) { @@ -5135,7 +5143,7 @@ var ts; } ts.getFileReferenceFromReferencePath = getFileReferenceFromReferencePath; function isKeyword(token) { - return 66 /* FirstKeyword */ <= token && token <= 125 /* LastKeyword */; + return 66 /* FirstKeyword */ <= token && token <= 126 /* LastKeyword */; } ts.isKeyword = isKeyword; function isTrivia(token) { @@ -5151,7 +5159,7 @@ var ts; */ function hasDynamicName(declaration) { return declaration.name && - declaration.name.kind === 127 /* ComputedPropertyName */ && + declaration.name.kind === 128 /* ComputedPropertyName */ && !isWellKnownSymbolSyntactically(declaration.name.expression); } ts.hasDynamicName = hasDynamicName; @@ -5161,14 +5169,14 @@ var ts; * where Symbol is literally the word "Symbol", and name is any identifierName */ function isWellKnownSymbolSyntactically(node) { - return node.kind === 155 /* PropertyAccessExpression */ && isESSymbolIdentifier(node.expression); + return node.kind === 156 /* PropertyAccessExpression */ && isESSymbolIdentifier(node.expression); } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { if (name.kind === 65 /* Identifier */ || name.kind === 8 /* StringLiteral */ || name.kind === 7 /* NumericLiteral */) { return name.text; } - if (name.kind === 127 /* ComputedPropertyName */) { + if (name.kind === 128 /* ComputedPropertyName */) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { var rightHandSideName = nameExpression.name.text; @@ -5205,7 +5213,7 @@ var ts; } ts.isModifier = isModifier; function nodeStartsNewLexicalEnvironment(n) { - return isFunctionLike(n) || n.kind === 205 /* ModuleDeclaration */ || n.kind === 227 /* SourceFile */; + return isFunctionLike(n) || n.kind === 206 /* ModuleDeclaration */ || n.kind === 228 /* SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(node) { @@ -5441,7 +5449,7 @@ var ts; ts.getLineOfLocalPosition = getLineOfLocalPosition; function getFirstConstructorWithBody(node) { return ts.forEach(node.members, function (member) { - if (member.kind === 135 /* Constructor */ && nodeIsPresent(member.body)) { + if (member.kind === 136 /* Constructor */ && nodeIsPresent(member.body)) { return member; } }); @@ -5464,10 +5472,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 136 /* GetAccessor */) { + if (accessor.kind === 137 /* GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 137 /* SetAccessor */) { + else if (accessor.kind === 138 /* SetAccessor */) { setAccessor = accessor; } else { @@ -5476,7 +5484,7 @@ var ts; } else { ts.forEach(declarations, function (member) { - if ((member.kind === 136 /* GetAccessor */ || member.kind === 137 /* SetAccessor */) + if ((member.kind === 137 /* GetAccessor */ || member.kind === 138 /* SetAccessor */) && (member.flags & 128 /* Static */) === (accessor.flags & 128 /* Static */)) { var memberName = getPropertyNameForPropertyNameNode(member.name); var accessorName = getPropertyNameForPropertyNameNode(accessor.name); @@ -5487,10 +5495,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 136 /* GetAccessor */ && !getAccessor) { + if (member.kind === 137 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 137 /* SetAccessor */ && !setAccessor) { + if (member.kind === 138 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -5638,22 +5646,22 @@ var ts; function isLeftHandSideExpression(expr) { if (expr) { switch (expr.kind) { - case 155 /* PropertyAccessExpression */: - case 156 /* ElementAccessExpression */: - case 158 /* NewExpression */: - case 157 /* CallExpression */: - case 159 /* TaggedTemplateExpression */: - case 153 /* ArrayLiteralExpression */: - case 161 /* ParenthesizedExpression */: - case 154 /* ObjectLiteralExpression */: - case 174 /* ClassExpression */: - case 162 /* FunctionExpression */: + case 156 /* PropertyAccessExpression */: + case 157 /* ElementAccessExpression */: + case 159 /* NewExpression */: + case 158 /* CallExpression */: + case 160 /* TaggedTemplateExpression */: + case 154 /* ArrayLiteralExpression */: + case 162 /* ParenthesizedExpression */: + case 155 /* ObjectLiteralExpression */: + case 175 /* ClassExpression */: + case 163 /* FunctionExpression */: case 65 /* Identifier */: case 9 /* RegularExpressionLiteral */: case 7 /* NumericLiteral */: case 8 /* StringLiteral */: case 10 /* NoSubstitutionTemplateLiteral */: - case 171 /* TemplateExpression */: + case 172 /* TemplateExpression */: case 80 /* FalseKeyword */: case 89 /* NullKeyword */: case 93 /* ThisKeyword */: @@ -5671,30 +5679,97 @@ var ts; ts.isAssignmentOperator = isAssignmentOperator; // Returns false if this heritage clause element's expression contains something unsupported // (i.e. not a name or dotted name). - function isSupportedHeritageClauseElement(node) { - return isSupportedHeritageClauseElementExpression(node.expression); + function isSupportedExpressionWithTypeArguments(node) { + return isSupportedExpressionWithTypeArgumentsRest(node.expression); } - ts.isSupportedHeritageClauseElement = isSupportedHeritageClauseElement; - function isSupportedHeritageClauseElementExpression(node) { + ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments; + function isSupportedExpressionWithTypeArgumentsRest(node) { if (node.kind === 65 /* Identifier */) { return true; } - else if (node.kind === 155 /* PropertyAccessExpression */) { - return isSupportedHeritageClauseElementExpression(node.expression); + else if (node.kind === 156 /* PropertyAccessExpression */) { + return isSupportedExpressionWithTypeArgumentsRest(node.expression); } else { return false; } } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 126 /* QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 155 /* PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 127 /* QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 156 /* PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function getLocalSymbolForExportDefault(symbol) { return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & 256 /* Default */) ? symbol.valueDeclaration.localSymbol : undefined; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; + /** + * Replace each instance of non-ascii characters by one, two, three, or four escape sequences + * representing the UTF-8 encoding of the character, and return the expanded char code list. + */ + function getExpandedCharCodes(input) { + var output = []; + var length = input.length; + var leadSurrogate = undefined; + for (var i = 0; i < length; i++) { + var charCode = input.charCodeAt(i); + // handel utf8 + if (charCode < 0x80) { + output.push(charCode); + } + else if (charCode < 0x800) { + output.push((charCode >> 6) | 192); + output.push((charCode & 63) | 128); + } + else if (charCode < 0x10000) { + output.push((charCode >> 12) | 224); + output.push(((charCode >> 6) & 63) | 128); + output.push((charCode & 63) | 128); + } + else if (charCode < 0x20000) { + output.push((charCode >> 18) | 240); + output.push(((charCode >> 12) & 63) | 128); + output.push(((charCode >> 6) & 63) | 128); + output.push((charCode & 63) | 128); + } + else { + ts.Debug.assert(false, "Unexpected code point"); + } + } + return output; + } + var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + /** + * Converts a string to a base-64 encoded ASCII string. + */ + function convertToBase64(input) { + var result = ""; + var charCodes = getExpandedCharCodes(input); + var i = 0; + var length = charCodes.length; + var byte1, byte2, byte3, byte4; + while (i < length) { + // Convert every 6-bits in the input 3 character points + // into a base64 digit + byte1 = charCodes[i] >> 2; + byte2 = (charCodes[i] & 3) << 4 | charCodes[i + 1] >> 4; + byte3 = (charCodes[i + 1] & 15) << 2 | charCodes[i + 2] >> 6; + byte4 = charCodes[i + 2] & 63; + // We are out of characters in the input, set the extra + // digits to 64 (padding character). + if (i + 1 >= length) { + byte3 = byte4 = 64; + } + else if (i + 2 >= length) { + byte4 = 64; + } + // Write to the ouput + result += base64Digits.charAt(byte1) + base64Digits.charAt(byte2) + base64Digits.charAt(byte3) + base64Digits.charAt(byte4); + i += 3; + } + return result; + } + ts.convertToBase64 = convertToBase64; })(ts || (ts = {})); var ts; (function (ts) { @@ -5906,7 +5981,7 @@ var ts; /// var ts; (function (ts) { - var nodeConstructors = new Array(229 /* Count */); + var nodeConstructors = new Array(230 /* Count */); /* @internal */ ts.parseTime = 0; function getNodeConstructor(kind) { return nodeConstructors[kind] || (nodeConstructors[kind] = ts.objectAllocator.getNodeConstructor(kind)); @@ -5951,20 +6026,20 @@ var ts; var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; var cbNodes = cbNodeArray || cbNode; switch (node.kind) { - case 126 /* QualifiedName */: + case 127 /* QualifiedName */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.right); - case 128 /* TypeParameter */: + case 129 /* TypeParameter */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.constraint) || visitNode(cbNode, node.expression); - case 129 /* Parameter */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 224 /* PropertyAssignment */: - case 225 /* ShorthandPropertyAssignment */: - case 198 /* VariableDeclaration */: - case 152 /* BindingElement */: + case 130 /* Parameter */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 225 /* PropertyAssignment */: + case 226 /* ShorthandPropertyAssignment */: + case 199 /* VariableDeclaration */: + case 153 /* BindingElement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || @@ -5973,24 +6048,24 @@ var ts; visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.type) || visitNode(cbNode, node.initializer); - case 142 /* FunctionType */: - case 143 /* ConstructorType */: - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: - case 140 /* IndexSignature */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: + case 141 /* IndexSignature */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.parameters) || visitNode(cbNode, node.type); - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 162 /* FunctionExpression */: - case 200 /* FunctionDeclaration */: - case 163 /* ArrowFunction */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 163 /* FunctionExpression */: + case 201 /* FunctionDeclaration */: + case 164 /* ArrowFunction */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || @@ -6001,220 +6076,220 @@ var ts; visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); - case 141 /* TypeReference */: + case 142 /* TypeReference */: return visitNode(cbNode, node.typeName) || visitNodes(cbNodes, node.typeArguments); - case 144 /* TypeQuery */: + case 145 /* TypeQuery */: return visitNode(cbNode, node.exprName); - case 145 /* TypeLiteral */: + case 146 /* TypeLiteral */: return visitNodes(cbNodes, node.members); - case 146 /* ArrayType */: + case 147 /* ArrayType */: return visitNode(cbNode, node.elementType); - case 147 /* TupleType */: + case 148 /* TupleType */: return visitNodes(cbNodes, node.elementTypes); - case 148 /* UnionType */: + case 149 /* UnionType */: return visitNodes(cbNodes, node.types); - case 149 /* ParenthesizedType */: + case 150 /* ParenthesizedType */: return visitNode(cbNode, node.type); - case 150 /* ObjectBindingPattern */: - case 151 /* ArrayBindingPattern */: + case 151 /* ObjectBindingPattern */: + case 152 /* ArrayBindingPattern */: return visitNodes(cbNodes, node.elements); - case 153 /* ArrayLiteralExpression */: + case 154 /* ArrayLiteralExpression */: return visitNodes(cbNodes, node.elements); - case 154 /* ObjectLiteralExpression */: + case 155 /* ObjectLiteralExpression */: return visitNodes(cbNodes, node.properties); - case 155 /* PropertyAccessExpression */: + case 156 /* PropertyAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.dotToken) || visitNode(cbNode, node.name); - case 156 /* ElementAccessExpression */: + case 157 /* ElementAccessExpression */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.argumentExpression); - case 157 /* CallExpression */: - case 158 /* NewExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments) || visitNodes(cbNodes, node.arguments); - case 159 /* TaggedTemplateExpression */: + case 160 /* TaggedTemplateExpression */: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); - case 160 /* TypeAssertionExpression */: + case 161 /* TypeAssertionExpression */: return visitNode(cbNode, node.type) || visitNode(cbNode, node.expression); - case 161 /* ParenthesizedExpression */: + case 162 /* ParenthesizedExpression */: return visitNode(cbNode, node.expression); - case 164 /* DeleteExpression */: + case 165 /* DeleteExpression */: return visitNode(cbNode, node.expression); - case 165 /* TypeOfExpression */: + case 166 /* TypeOfExpression */: return visitNode(cbNode, node.expression); - case 166 /* VoidExpression */: + case 167 /* VoidExpression */: return visitNode(cbNode, node.expression); - case 167 /* PrefixUnaryExpression */: + case 168 /* PrefixUnaryExpression */: return visitNode(cbNode, node.operand); - case 172 /* YieldExpression */: + case 173 /* YieldExpression */: return visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.expression); - case 168 /* PostfixUnaryExpression */: + case 169 /* PostfixUnaryExpression */: return visitNode(cbNode, node.operand); - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: return visitNode(cbNode, node.left) || visitNode(cbNode, node.operatorToken) || visitNode(cbNode, node.right); - case 170 /* ConditionalExpression */: + case 171 /* ConditionalExpression */: return visitNode(cbNode, node.condition) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.whenTrue) || visitNode(cbNode, node.colonToken) || visitNode(cbNode, node.whenFalse); - case 173 /* SpreadElementExpression */: + case 174 /* SpreadElementExpression */: return visitNode(cbNode, node.expression); - case 179 /* Block */: - case 206 /* ModuleBlock */: + case 180 /* Block */: + case 207 /* ModuleBlock */: return visitNodes(cbNodes, node.statements); - case 227 /* SourceFile */: + case 228 /* SourceFile */: return visitNodes(cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); - case 180 /* VariableStatement */: + case 181 /* VariableStatement */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); - case 199 /* VariableDeclarationList */: + case 200 /* VariableDeclarationList */: return visitNodes(cbNodes, node.declarations); - case 182 /* ExpressionStatement */: + case 183 /* ExpressionStatement */: return visitNode(cbNode, node.expression); - case 183 /* IfStatement */: + case 184 /* IfStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.thenStatement) || visitNode(cbNode, node.elseStatement); - case 184 /* DoStatement */: + case 185 /* DoStatement */: return visitNode(cbNode, node.statement) || visitNode(cbNode, node.expression); - case 185 /* WhileStatement */: + case 186 /* WhileStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 186 /* ForStatement */: + case 187 /* ForStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.condition) || visitNode(cbNode, node.incrementor) || visitNode(cbNode, node.statement); - case 187 /* ForInStatement */: + case 188 /* ForInStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 188 /* ForOfStatement */: + case 189 /* ForOfStatement */: return visitNode(cbNode, node.initializer) || visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 189 /* ContinueStatement */: - case 190 /* BreakStatement */: + case 190 /* ContinueStatement */: + case 191 /* BreakStatement */: return visitNode(cbNode, node.label); - case 191 /* ReturnStatement */: + case 192 /* ReturnStatement */: return visitNode(cbNode, node.expression); - case 192 /* WithStatement */: + case 193 /* WithStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.statement); - case 193 /* SwitchStatement */: + case 194 /* SwitchStatement */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); - case 207 /* CaseBlock */: + case 208 /* CaseBlock */: return visitNodes(cbNodes, node.clauses); - case 220 /* CaseClause */: + case 221 /* CaseClause */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.statements); - case 221 /* DefaultClause */: + case 222 /* DefaultClause */: return visitNodes(cbNodes, node.statements); - case 194 /* LabeledStatement */: + case 195 /* LabeledStatement */: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); - case 195 /* ThrowStatement */: + case 196 /* ThrowStatement */: return visitNode(cbNode, node.expression); - case 196 /* TryStatement */: + case 197 /* TryStatement */: return visitNode(cbNode, node.tryBlock) || visitNode(cbNode, node.catchClause) || visitNode(cbNode, node.finallyBlock); - case 223 /* CatchClause */: + case 224 /* CatchClause */: return visitNode(cbNode, node.variableDeclaration) || visitNode(cbNode, node.block); - case 130 /* Decorator */: + case 131 /* Decorator */: return visitNode(cbNode, node.expression); - case 201 /* ClassDeclaration */: - case 174 /* ClassExpression */: + case 202 /* ClassDeclaration */: + case 175 /* ClassExpression */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.typeParameters) || visitNodes(cbNodes, node.heritageClauses) || visitNodes(cbNodes, node.members); - case 203 /* TypeAliasDeclaration */: + case 204 /* TypeAliasDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.type); - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNodes(cbNodes, node.members); - case 226 /* EnumMember */: + case 227 /* EnumMember */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); - case 210 /* ImportClause */: + case 211 /* ImportClause */: return visitNode(cbNode, node.name) || visitNode(cbNode, node.namedBindings); - case 211 /* NamespaceImport */: + case 212 /* NamespaceImport */: return visitNode(cbNode, node.name); - case 212 /* NamedImports */: - case 216 /* NamedExports */: + case 213 /* NamedImports */: + case 217 /* NamedExports */: return visitNodes(cbNodes, node.elements); - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); - case 213 /* ImportSpecifier */: - case 217 /* ExportSpecifier */: + case 214 /* ImportSpecifier */: + case 218 /* ExportSpecifier */: return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: return visitNodes(cbNodes, node.decorators) || visitNodes(cbNodes, node.modifiers) || visitNode(cbNode, node.expression); - case 171 /* TemplateExpression */: + case 172 /* TemplateExpression */: return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); - case 176 /* TemplateSpan */: + case 178 /* TemplateSpan */: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); - case 127 /* ComputedPropertyName */: + case 128 /* ComputedPropertyName */: return visitNode(cbNode, node.expression); - case 222 /* HeritageClause */: + case 223 /* HeritageClause */: return visitNodes(cbNodes, node.types); - case 177 /* HeritageClauseElement */: + case 177 /* ExpressionWithTypeArguments */: return visitNode(cbNode, node.expression) || visitNodes(cbNodes, node.typeArguments); - case 219 /* ExternalModuleReference */: + case 220 /* ExternalModuleReference */: return visitNode(cbNode, node.expression); - case 218 /* MissingDeclaration */: + case 219 /* MissingDeclaration */: return visitNodes(cbNodes, node.decorators); } } @@ -6393,7 +6468,7 @@ var ts; } } function createSourceFile(fileName, languageVersion) { - sourceFile = createNode(227 /* SourceFile */, 0); + sourceFile = createNode(228 /* SourceFile */, 0); sourceFile.pos = 0; sourceFile.end = sourceText.length; sourceFile.text = sourceText; @@ -6735,7 +6810,7 @@ var ts; // ComputedPropertyName[Yield] : // [ AssignmentExpression[In, ?Yield] ] // - var node = createNode(127 /* ComputedPropertyName */); + var node = createNode(128 /* ComputedPropertyName */); parseExpected(18 /* OpenBracketToken */); // We parse any expression (including a comma expression). But the grammar // says that only an assignment expression is allowed, so the grammar checker @@ -7127,14 +7202,14 @@ var ts; function isReusableModuleElement(node) { if (node) { switch (node.kind) { - case 209 /* ImportDeclaration */: - case 208 /* ImportEqualsDeclaration */: - case 215 /* ExportDeclaration */: - case 214 /* ExportAssignment */: - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 205 /* ModuleDeclaration */: - case 204 /* EnumDeclaration */: + case 210 /* ImportDeclaration */: + case 209 /* ImportEqualsDeclaration */: + case 216 /* ExportDeclaration */: + case 215 /* ExportAssignment */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 206 /* ModuleDeclaration */: + case 205 /* EnumDeclaration */: return true; } return isReusableStatement(node); @@ -7144,13 +7219,13 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 135 /* Constructor */: - case 140 /* IndexSignature */: - case 134 /* MethodDeclaration */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 132 /* PropertyDeclaration */: - case 178 /* SemicolonClassElement */: + case 136 /* Constructor */: + case 141 /* IndexSignature */: + case 135 /* MethodDeclaration */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 133 /* PropertyDeclaration */: + case 179 /* SemicolonClassElement */: return true; } } @@ -7159,8 +7234,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 220 /* CaseClause */: - case 221 /* DefaultClause */: + case 221 /* CaseClause */: + case 222 /* DefaultClause */: return true; } } @@ -7169,49 +7244,49 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 200 /* FunctionDeclaration */: - case 180 /* VariableStatement */: - case 179 /* Block */: - case 183 /* IfStatement */: - case 182 /* ExpressionStatement */: - case 195 /* ThrowStatement */: - case 191 /* ReturnStatement */: - case 193 /* SwitchStatement */: - case 190 /* BreakStatement */: - case 189 /* ContinueStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 186 /* ForStatement */: - case 185 /* WhileStatement */: - case 192 /* WithStatement */: - case 181 /* EmptyStatement */: - case 196 /* TryStatement */: - case 194 /* LabeledStatement */: - case 184 /* DoStatement */: - case 197 /* DebuggerStatement */: + case 201 /* FunctionDeclaration */: + case 181 /* VariableStatement */: + case 180 /* Block */: + case 184 /* IfStatement */: + case 183 /* ExpressionStatement */: + case 196 /* ThrowStatement */: + case 192 /* ReturnStatement */: + case 194 /* SwitchStatement */: + case 191 /* BreakStatement */: + case 190 /* ContinueStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 187 /* ForStatement */: + case 186 /* WhileStatement */: + case 193 /* WithStatement */: + case 182 /* EmptyStatement */: + case 197 /* TryStatement */: + case 195 /* LabeledStatement */: + case 185 /* DoStatement */: + case 198 /* DebuggerStatement */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 226 /* EnumMember */; + return node.kind === 227 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 139 /* ConstructSignature */: - case 133 /* MethodSignature */: - case 140 /* IndexSignature */: - case 131 /* PropertySignature */: - case 138 /* CallSignature */: + case 140 /* ConstructSignature */: + case 134 /* MethodSignature */: + case 141 /* IndexSignature */: + case 132 /* PropertySignature */: + case 139 /* CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 198 /* VariableDeclaration */) { + if (node.kind !== 199 /* VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -7232,7 +7307,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 129 /* Parameter */) { + if (node.kind !== 130 /* Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -7344,7 +7419,7 @@ var ts; function parseEntityName(allowReservedWords, diagnosticMessage) { var entity = parseIdentifier(diagnosticMessage); while (parseOptional(20 /* DotToken */)) { - var node = createNode(126 /* QualifiedName */, entity.pos); + var node = createNode(127 /* QualifiedName */, entity.pos); node.left = entity; node.right = parseRightSideOfDot(allowReservedWords); entity = finishNode(node); @@ -7383,7 +7458,7 @@ var ts; return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } function parseTemplateExpression() { - var template = createNode(171 /* TemplateExpression */); + var template = createNode(172 /* TemplateExpression */); template.head = parseLiteralNode(); ts.Debug.assert(template.head.kind === 11 /* TemplateHead */, "Template head has wrong token kind"); var templateSpans = []; @@ -7396,7 +7471,7 @@ var ts; return finishNode(template); } function parseTemplateSpan() { - var span = createNode(176 /* TemplateSpan */); + var span = createNode(178 /* TemplateSpan */); span.expression = allowInAnd(parseExpression); var literal; if (token === 15 /* CloseBraceToken */) { @@ -7437,7 +7512,7 @@ var ts; } // TYPES function parseTypeReference() { - var node = createNode(141 /* TypeReference */); + var node = createNode(142 /* TypeReference */); node.typeName = parseEntityName(false, ts.Diagnostics.Type_expected); if (!scanner.hasPrecedingLineBreak() && token === 24 /* LessThanToken */) { node.typeArguments = parseBracketedList(17 /* TypeArguments */, parseType, 24 /* LessThanToken */, 25 /* GreaterThanToken */); @@ -7445,13 +7520,13 @@ var ts; return finishNode(node); } function parseTypeQuery() { - var node = createNode(144 /* TypeQuery */); + var node = createNode(145 /* TypeQuery */); parseExpected(97 /* TypeOfKeyword */); node.exprName = parseEntityName(true); return finishNode(node); } function parseTypeParameter() { - var node = createNode(128 /* TypeParameter */); + var node = createNode(129 /* TypeParameter */); node.name = parseIdentifier(); if (parseOptional(79 /* ExtendsKeyword */)) { // It's not uncommon for people to write improper constraints to a generic. If the @@ -7497,7 +7572,7 @@ var ts; } } function parseParameter() { - var node = createNode(129 /* Parameter */); + var node = createNode(130 /* Parameter */); node.decorators = parseDecorators(); setModifiers(node, parseModifiers()); node.dotDotDotToken = parseOptionalToken(21 /* DotDotDotToken */); @@ -7594,7 +7669,7 @@ var ts; } function parseSignatureMember(kind) { var node = createNode(kind); - if (kind === 139 /* ConstructSignature */) { + if (kind === 140 /* ConstructSignature */) { parseExpected(88 /* NewKeyword */); } fillSignature(51 /* ColonToken */, false, false, node); @@ -7658,7 +7733,7 @@ var ts; return token === 51 /* ColonToken */ || token === 23 /* CommaToken */ || token === 19 /* CloseBracketToken */; } function parseIndexSignatureDeclaration(fullStart, decorators, modifiers) { - var node = createNode(140 /* IndexSignature */, fullStart); + var node = createNode(141 /* IndexSignature */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.parameters = parseBracketedList(15 /* Parameters */, parseParameter, 18 /* OpenBracketToken */, 19 /* CloseBracketToken */); @@ -7671,7 +7746,7 @@ var ts; var name = parsePropertyName(); var questionToken = parseOptionalToken(50 /* QuestionToken */); if (token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */) { - var method = createNode(133 /* MethodSignature */, fullStart); + var method = createNode(134 /* MethodSignature */, fullStart); method.name = name; method.questionToken = questionToken; // Method signatues don't exist in expression contexts. So they have neither @@ -7681,7 +7756,7 @@ var ts; return finishNode(method); } else { - var property = createNode(131 /* PropertySignature */, fullStart); + var property = createNode(132 /* PropertySignature */, fullStart); property.name = name; property.questionToken = questionToken; property.type = parseTypeAnnotation(); @@ -7723,7 +7798,7 @@ var ts; switch (token) { case 16 /* OpenParenToken */: case 24 /* LessThanToken */: - return parseSignatureMember(138 /* CallSignature */); + return parseSignatureMember(139 /* CallSignature */); case 18 /* OpenBracketToken */: // Indexer or computed property return isIndexSignature() @@ -7731,7 +7806,7 @@ var ts; : parsePropertyOrMethodSignature(); case 88 /* NewKeyword */: if (lookAhead(isStartOfConstructSignature)) { - return parseSignatureMember(139 /* ConstructSignature */); + return parseSignatureMember(140 /* ConstructSignature */); } // fall through. case 8 /* StringLiteral */: @@ -7768,7 +7843,7 @@ var ts; return token === 16 /* OpenParenToken */ || token === 24 /* LessThanToken */; } function parseTypeLiteral() { - var node = createNode(145 /* TypeLiteral */); + var node = createNode(146 /* TypeLiteral */); node.members = parseObjectTypeMembers(); return finishNode(node); } @@ -7784,12 +7859,12 @@ var ts; return members; } function parseTupleType() { - var node = createNode(147 /* TupleType */); + var node = createNode(148 /* TupleType */); node.elementTypes = parseBracketedList(18 /* TupleElementTypes */, parseType, 18 /* OpenBracketToken */, 19 /* CloseBracketToken */); return finishNode(node); } function parseParenthesizedType() { - var node = createNode(149 /* ParenthesizedType */); + var node = createNode(150 /* ParenthesizedType */); parseExpected(16 /* OpenParenToken */); node.type = parseType(); parseExpected(17 /* CloseParenToken */); @@ -7797,7 +7872,7 @@ var ts; } function parseFunctionOrConstructorType(kind) { var node = createNode(kind); - if (kind === 143 /* ConstructorType */) { + if (kind === 144 /* ConstructorType */) { parseExpected(88 /* NewKeyword */); } fillSignature(32 /* EqualsGreaterThanToken */, false, false, node); @@ -7810,10 +7885,10 @@ var ts; function parseNonArrayType() { switch (token) { case 112 /* AnyKeyword */: - case 121 /* StringKeyword */: - case 119 /* NumberKeyword */: + case 122 /* StringKeyword */: + case 120 /* NumberKeyword */: case 113 /* BooleanKeyword */: - case 122 /* SymbolKeyword */: + case 123 /* SymbolKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); @@ -7834,10 +7909,10 @@ var ts; function isStartOfType() { switch (token) { case 112 /* AnyKeyword */: - case 121 /* StringKeyword */: - case 119 /* NumberKeyword */: + case 122 /* StringKeyword */: + case 120 /* NumberKeyword */: case 113 /* BooleanKeyword */: - case 122 /* SymbolKeyword */: + case 123 /* SymbolKeyword */: case 99 /* VoidKeyword */: case 97 /* TypeOfKeyword */: case 14 /* OpenBraceToken */: @@ -7861,7 +7936,7 @@ var ts; var type = parseNonArrayType(); while (!scanner.hasPrecedingLineBreak() && parseOptional(18 /* OpenBracketToken */)) { parseExpected(19 /* CloseBracketToken */); - var node = createNode(146 /* ArrayType */, type.pos); + var node = createNode(147 /* ArrayType */, type.pos); node.elementType = type; type = finishNode(node); } @@ -7876,7 +7951,7 @@ var ts; types.push(parseArrayTypeOrHigher()); } types.end = getNodeEnd(); - var node = createNode(148 /* UnionType */, type.pos); + var node = createNode(149 /* UnionType */, type.pos); node.types = types; type = finishNode(node); } @@ -7931,10 +8006,10 @@ var ts; } function parseTypeWorker() { if (isStartOfFunctionType()) { - return parseFunctionOrConstructorType(142 /* FunctionType */); + return parseFunctionOrConstructorType(143 /* FunctionType */); } if (token === 88 /* NewKeyword */) { - return parseFunctionOrConstructorType(143 /* ConstructorType */); + return parseFunctionOrConstructorType(144 /* ConstructorType */); } return parseUnionTypeOrHigher(); } @@ -8136,7 +8211,7 @@ var ts; (isIdentifier() || token === 14 /* OpenBraceToken */ || token === 18 /* OpenBracketToken */); } function parseYieldExpression() { - var node = createNode(172 /* YieldExpression */); + var node = createNode(173 /* YieldExpression */); // YieldExpression[In] : // yield // yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield] @@ -8156,8 +8231,8 @@ var ts; } function parseSimpleArrowFunctionExpression(identifier) { ts.Debug.assert(token === 32 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); - var node = createNode(163 /* ArrowFunction */, identifier.pos); - var parameter = createNode(129 /* Parameter */, identifier.pos); + var node = createNode(164 /* ArrowFunction */, identifier.pos); + var parameter = createNode(130 /* Parameter */, identifier.pos); parameter.name = identifier; finishNode(parameter); node.parameters = [parameter]; @@ -8275,7 +8350,7 @@ var ts; return parseParenthesizedArrowFunctionExpressionHead(false); } function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { - var node = createNode(163 /* ArrowFunction */); + var node = createNode(164 /* ArrowFunction */); // Arrow functions are never generators. // // If we're speculatively parsing a signature for a parenthesized arrow function, then @@ -8336,7 +8411,7 @@ var ts; } // Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and // we do not that for the 'whenFalse' part. - var node = createNode(170 /* ConditionalExpression */, leftOperand.pos); + var node = createNode(171 /* ConditionalExpression */, leftOperand.pos); node.condition = leftOperand; node.questionToken = questionToken; node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher); @@ -8349,7 +8424,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand); } function isInOrOfKeyword(t) { - return t === 86 /* InKeyword */ || t === 125 /* OfKeyword */; + return t === 86 /* InKeyword */ || t === 126 /* OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand) { while (true) { @@ -8415,33 +8490,33 @@ var ts; return -1; } function makeBinaryExpression(left, operatorToken, right) { - var node = createNode(169 /* BinaryExpression */, left.pos); + var node = createNode(170 /* BinaryExpression */, left.pos); node.left = left; node.operatorToken = operatorToken; node.right = right; return finishNode(node); } function parsePrefixUnaryExpression() { - var node = createNode(167 /* PrefixUnaryExpression */); + var node = createNode(168 /* PrefixUnaryExpression */); node.operator = token; nextToken(); node.operand = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseDeleteExpression() { - var node = createNode(164 /* DeleteExpression */); + var node = createNode(165 /* DeleteExpression */); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseTypeOfExpression() { - var node = createNode(165 /* TypeOfExpression */); + var node = createNode(166 /* TypeOfExpression */); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); } function parseVoidExpression() { - var node = createNode(166 /* VoidExpression */); + var node = createNode(167 /* VoidExpression */); nextToken(); node.expression = parseUnaryExpressionOrHigher(); return finishNode(node); @@ -8471,7 +8546,7 @@ var ts; var expression = parseLeftHandSideExpressionOrHigher(); ts.Debug.assert(ts.isLeftHandSideExpression(expression)); if ((token === 38 /* PlusPlusToken */ || token === 39 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) { - var node = createNode(168 /* PostfixUnaryExpression */, expression.pos); + var node = createNode(169 /* PostfixUnaryExpression */, expression.pos); node.operand = expression; node.operator = token; nextToken(); @@ -8575,14 +8650,14 @@ var ts; } // If we have seen "super" it must be followed by '(' or '.'. // If it wasn't then just try to parse out a '.' and report an error. - var node = createNode(155 /* PropertyAccessExpression */, expression.pos); + var node = createNode(156 /* PropertyAccessExpression */, expression.pos); node.expression = expression; node.dotToken = parseExpectedToken(20 /* DotToken */, false, 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(160 /* TypeAssertionExpression */); + var node = createNode(161 /* TypeAssertionExpression */); parseExpected(24 /* LessThanToken */); node.type = parseType(); parseExpected(25 /* GreaterThanToken */); @@ -8593,7 +8668,7 @@ var ts; while (true) { var dotToken = parseOptionalToken(20 /* DotToken */); if (dotToken) { - var propertyAccess = createNode(155 /* PropertyAccessExpression */, expression.pos); + var propertyAccess = createNode(156 /* PropertyAccessExpression */, expression.pos); propertyAccess.expression = expression; propertyAccess.dotToken = dotToken; propertyAccess.name = parseRightSideOfDot(true); @@ -8602,7 +8677,7 @@ var ts; } // when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName if (!inDecoratorContext() && parseOptional(18 /* OpenBracketToken */)) { - var indexedAccess = createNode(156 /* ElementAccessExpression */, expression.pos); + var indexedAccess = createNode(157 /* ElementAccessExpression */, expression.pos); indexedAccess.expression = expression; // It's not uncommon for a user to write: "new Type[]". // Check for that common pattern and report a better error message. @@ -8618,7 +8693,7 @@ var ts; continue; } if (token === 10 /* NoSubstitutionTemplateLiteral */ || token === 11 /* TemplateHead */) { - var tagExpression = createNode(159 /* TaggedTemplateExpression */, expression.pos); + var tagExpression = createNode(160 /* TaggedTemplateExpression */, expression.pos); tagExpression.tag = expression; tagExpression.template = token === 10 /* NoSubstitutionTemplateLiteral */ ? parseLiteralNode() @@ -8641,7 +8716,7 @@ var ts; if (!typeArguments) { return expression; } - var callExpr = createNode(157 /* CallExpression */, expression.pos); + var callExpr = createNode(158 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.typeArguments = typeArguments; callExpr.arguments = parseArgumentList(); @@ -8649,7 +8724,7 @@ var ts; continue; } else if (token === 16 /* OpenParenToken */) { - var callExpr = createNode(157 /* CallExpression */, expression.pos); + var callExpr = createNode(158 /* CallExpression */, expression.pos); callExpr.expression = expression; callExpr.arguments = parseArgumentList(); expression = finishNode(callExpr); @@ -8751,28 +8826,28 @@ var ts; return parseIdentifier(ts.Diagnostics.Expression_expected); } function parseParenthesizedExpression() { - var node = createNode(161 /* ParenthesizedExpression */); + var node = createNode(162 /* ParenthesizedExpression */); parseExpected(16 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(17 /* CloseParenToken */); return finishNode(node); } function parseSpreadElement() { - var node = createNode(173 /* SpreadElementExpression */); + var node = createNode(174 /* SpreadElementExpression */); parseExpected(21 /* DotDotDotToken */); node.expression = parseAssignmentExpressionOrHigher(); return finishNode(node); } function parseArgumentOrArrayLiteralElement() { return token === 21 /* DotDotDotToken */ ? parseSpreadElement() : - token === 23 /* CommaToken */ ? createNode(175 /* OmittedExpression */) : + token === 23 /* CommaToken */ ? createNode(176 /* OmittedExpression */) : parseAssignmentExpressionOrHigher(); } function parseArgumentExpression() { return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement); } function parseArrayLiteralExpression() { - var node = createNode(153 /* ArrayLiteralExpression */); + var node = createNode(154 /* ArrayLiteralExpression */); parseExpected(18 /* OpenBracketToken */); if (scanner.hasPrecedingLineBreak()) node.flags |= 512 /* MultiLine */; @@ -8782,10 +8857,10 @@ var ts; } function tryParseAccessorDeclaration(fullStart, decorators, modifiers) { if (parseContextualModifier(116 /* GetKeyword */)) { - return parseAccessorDeclaration(136 /* GetAccessor */, fullStart, decorators, modifiers); + return parseAccessorDeclaration(137 /* GetAccessor */, fullStart, decorators, modifiers); } - else if (parseContextualModifier(120 /* SetKeyword */)) { - return parseAccessorDeclaration(137 /* SetAccessor */, fullStart, decorators, modifiers); + else if (parseContextualModifier(121 /* SetKeyword */)) { + return parseAccessorDeclaration(138 /* SetAccessor */, fullStart, decorators, modifiers); } return undefined; } @@ -8808,13 +8883,13 @@ var ts; } // Parse to check if it is short-hand property assignment or normal property assignment if ((token === 23 /* CommaToken */ || token === 15 /* CloseBraceToken */) && tokenIsIdentifier) { - var shorthandDeclaration = createNode(225 /* ShorthandPropertyAssignment */, fullStart); + var shorthandDeclaration = createNode(226 /* ShorthandPropertyAssignment */, fullStart); shorthandDeclaration.name = propertyName; shorthandDeclaration.questionToken = questionToken; return finishNode(shorthandDeclaration); } else { - var propertyAssignment = createNode(224 /* PropertyAssignment */, fullStart); + var propertyAssignment = createNode(225 /* PropertyAssignment */, fullStart); propertyAssignment.name = propertyName; propertyAssignment.questionToken = questionToken; parseExpected(51 /* ColonToken */); @@ -8823,7 +8898,7 @@ var ts; } } function parseObjectLiteralExpression() { - var node = createNode(154 /* ObjectLiteralExpression */); + var node = createNode(155 /* ObjectLiteralExpression */); parseExpected(14 /* OpenBraceToken */); if (scanner.hasPrecedingLineBreak()) { node.flags |= 512 /* MultiLine */; @@ -8841,7 +8916,7 @@ var ts; if (saveDecoratorContext) { setDecoratorContext(false); } - var node = createNode(162 /* FunctionExpression */); + var node = createNode(163 /* FunctionExpression */); parseExpected(83 /* FunctionKeyword */); node.asteriskToken = parseOptionalToken(35 /* AsteriskToken */); node.name = node.asteriskToken ? doInYieldContext(parseOptionalIdentifier) : parseOptionalIdentifier(); @@ -8856,7 +8931,7 @@ var ts; return isIdentifier() ? parseIdentifier() : undefined; } function parseNewExpression() { - var node = createNode(158 /* NewExpression */); + var node = createNode(159 /* NewExpression */); parseExpected(88 /* NewKeyword */); node.expression = parseMemberExpressionOrHigher(); node.typeArguments = tryParse(parseTypeArgumentsInExpression); @@ -8867,7 +8942,7 @@ var ts; } // STATEMENTS function parseBlock(ignoreMissingOpenBrace, checkForStrictMode, diagnosticMessage) { - var node = createNode(179 /* Block */); + var node = createNode(180 /* Block */); if (parseExpected(14 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) { node.statements = parseList(2 /* BlockStatements */, checkForStrictMode, parseStatement); parseExpected(15 /* CloseBraceToken */); @@ -8894,12 +8969,12 @@ var ts; return block; } function parseEmptyStatement() { - var node = createNode(181 /* EmptyStatement */); + var node = createNode(182 /* EmptyStatement */); parseExpected(22 /* SemicolonToken */); return finishNode(node); } function parseIfStatement() { - var node = createNode(183 /* IfStatement */); + var node = createNode(184 /* IfStatement */); parseExpected(84 /* IfKeyword */); parseExpected(16 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -8909,7 +8984,7 @@ var ts; return finishNode(node); } function parseDoStatement() { - var node = createNode(184 /* DoStatement */); + var node = createNode(185 /* DoStatement */); parseExpected(75 /* DoKeyword */); node.statement = parseStatement(); parseExpected(100 /* WhileKeyword */); @@ -8924,7 +8999,7 @@ var ts; return finishNode(node); } function parseWhileStatement() { - var node = createNode(185 /* WhileStatement */); + var node = createNode(186 /* WhileStatement */); parseExpected(100 /* WhileKeyword */); parseExpected(16 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -8947,21 +9022,21 @@ var ts; } var forOrForInOrForOfStatement; if (parseOptional(86 /* InKeyword */)) { - var forInStatement = createNode(187 /* ForInStatement */, pos); + var forInStatement = createNode(188 /* ForInStatement */, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(17 /* CloseParenToken */); forOrForInOrForOfStatement = forInStatement; } - else if (parseOptional(125 /* OfKeyword */)) { - var forOfStatement = createNode(188 /* ForOfStatement */, pos); + else if (parseOptional(126 /* OfKeyword */)) { + var forOfStatement = createNode(189 /* ForOfStatement */, pos); forOfStatement.initializer = initializer; forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); parseExpected(17 /* CloseParenToken */); forOrForInOrForOfStatement = forOfStatement; } else { - var forStatement = createNode(186 /* ForStatement */, pos); + var forStatement = createNode(187 /* ForStatement */, pos); forStatement.initializer = initializer; parseExpected(22 /* SemicolonToken */); if (token !== 22 /* SemicolonToken */ && token !== 17 /* CloseParenToken */) { @@ -8979,7 +9054,7 @@ var ts; } function parseBreakOrContinueStatement(kind) { var node = createNode(kind); - parseExpected(kind === 190 /* BreakStatement */ ? 66 /* BreakKeyword */ : 71 /* ContinueKeyword */); + parseExpected(kind === 191 /* BreakStatement */ ? 66 /* BreakKeyword */ : 71 /* ContinueKeyword */); if (!canParseSemicolon()) { node.label = parseIdentifier(); } @@ -8987,7 +9062,7 @@ var ts; return finishNode(node); } function parseReturnStatement() { - var node = createNode(191 /* ReturnStatement */); + var node = createNode(192 /* ReturnStatement */); parseExpected(90 /* ReturnKeyword */); if (!canParseSemicolon()) { node.expression = allowInAnd(parseExpression); @@ -8996,7 +9071,7 @@ var ts; return finishNode(node); } function parseWithStatement() { - var node = createNode(192 /* WithStatement */); + var node = createNode(193 /* WithStatement */); parseExpected(101 /* WithKeyword */); parseExpected(16 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); @@ -9005,7 +9080,7 @@ var ts; return finishNode(node); } function parseCaseClause() { - var node = createNode(220 /* CaseClause */); + var node = createNode(221 /* CaseClause */); parseExpected(67 /* CaseKeyword */); node.expression = allowInAnd(parseExpression); parseExpected(51 /* ColonToken */); @@ -9013,7 +9088,7 @@ var ts; return finishNode(node); } function parseDefaultClause() { - var node = createNode(221 /* DefaultClause */); + var node = createNode(222 /* DefaultClause */); parseExpected(73 /* DefaultKeyword */); parseExpected(51 /* ColonToken */); node.statements = parseList(4 /* SwitchClauseStatements */, false, parseStatement); @@ -9023,12 +9098,12 @@ var ts; return token === 67 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseSwitchStatement() { - var node = createNode(193 /* SwitchStatement */); + var node = createNode(194 /* SwitchStatement */); parseExpected(92 /* SwitchKeyword */); parseExpected(16 /* OpenParenToken */); node.expression = allowInAnd(parseExpression); parseExpected(17 /* CloseParenToken */); - var caseBlock = createNode(207 /* CaseBlock */, scanner.getStartPos()); + var caseBlock = createNode(208 /* CaseBlock */, scanner.getStartPos()); parseExpected(14 /* OpenBraceToken */); caseBlock.clauses = parseList(3 /* SwitchClauses */, false, parseCaseOrDefaultClause); parseExpected(15 /* CloseBraceToken */); @@ -9043,7 +9118,7 @@ var ts; // directly as that might consume an expression on the following line. // We just return 'undefined' in that case. The actual error will be reported in the // grammar walker. - var node = createNode(195 /* ThrowStatement */); + var node = createNode(196 /* ThrowStatement */); parseExpected(94 /* ThrowKeyword */); node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression); parseSemicolon(); @@ -9051,7 +9126,7 @@ var ts; } // TODO: Review for error recovery function parseTryStatement() { - var node = createNode(196 /* TryStatement */); + var node = createNode(197 /* TryStatement */); parseExpected(96 /* TryKeyword */); node.tryBlock = parseBlock(false, false); node.catchClause = token === 68 /* CatchKeyword */ ? parseCatchClause() : undefined; @@ -9064,7 +9139,7 @@ var ts; return finishNode(node); } function parseCatchClause() { - var result = createNode(223 /* CatchClause */); + var result = createNode(224 /* CatchClause */); parseExpected(68 /* CatchKeyword */); if (parseExpected(16 /* OpenParenToken */)) { result.variableDeclaration = parseVariableDeclaration(); @@ -9074,7 +9149,7 @@ var ts; return finishNode(result); } function parseDebuggerStatement() { - var node = createNode(197 /* DebuggerStatement */); + var node = createNode(198 /* DebuggerStatement */); parseExpected(72 /* DebuggerKeyword */); parseSemicolon(); return finishNode(node); @@ -9086,13 +9161,13 @@ var ts; var fullStart = scanner.getStartPos(); var expression = allowInAnd(parseExpression); if (expression.kind === 65 /* Identifier */ && parseOptional(51 /* ColonToken */)) { - var labeledStatement = createNode(194 /* LabeledStatement */, fullStart); + var labeledStatement = createNode(195 /* LabeledStatement */, fullStart); labeledStatement.label = expression; labeledStatement.statement = parseStatement(); return finishNode(labeledStatement); } else { - var expressionStatement = createNode(182 /* ExpressionStatement */, fullStart); + var expressionStatement = createNode(183 /* ExpressionStatement */, fullStart); expressionStatement.expression = expression; parseSemicolon(); return finishNode(expressionStatement); @@ -9150,8 +9225,9 @@ var ts; return !isConstEnum; case 103 /* InterfaceKeyword */: case 117 /* ModuleKeyword */: + case 118 /* NamespaceKeyword */: case 77 /* EnumKeyword */: - case 123 /* TypeKeyword */: + case 124 /* TypeKeyword */: // When followed by an identifier, these do not start a statement but might // instead be following declarations if (isDeclarationStart()) { @@ -9201,9 +9277,9 @@ var ts; case 82 /* ForKeyword */: return parseForOrForInOrForOfStatement(); case 71 /* ContinueKeyword */: - return parseBreakOrContinueStatement(189 /* ContinueStatement */); + return parseBreakOrContinueStatement(190 /* ContinueStatement */); case 66 /* BreakKeyword */: - return parseBreakOrContinueStatement(190 /* BreakStatement */); + return parseBreakOrContinueStatement(191 /* BreakStatement */); case 90 /* ReturnKeyword */: return parseReturnStatement(); case 101 /* WithKeyword */: @@ -9278,16 +9354,16 @@ var ts; // DECLARATIONS function parseArrayBindingElement() { if (token === 23 /* CommaToken */) { - return createNode(175 /* OmittedExpression */); + return createNode(176 /* OmittedExpression */); } - var node = createNode(152 /* BindingElement */); + var node = createNode(153 /* BindingElement */); node.dotDotDotToken = parseOptionalToken(21 /* DotDotDotToken */); node.name = parseIdentifierOrPattern(); node.initializer = parseInitializer(false); return finishNode(node); } function parseObjectBindingElement() { - var node = createNode(152 /* BindingElement */); + var node = createNode(153 /* BindingElement */); // TODO(andersh): Handle computed properties var tokenIsIdentifier = isIdentifier(); var propertyName = parsePropertyName(); @@ -9303,14 +9379,14 @@ var ts; return finishNode(node); } function parseObjectBindingPattern() { - var node = createNode(150 /* ObjectBindingPattern */); + var node = createNode(151 /* ObjectBindingPattern */); parseExpected(14 /* OpenBraceToken */); node.elements = parseDelimitedList(10 /* ObjectBindingElements */, parseObjectBindingElement); parseExpected(15 /* CloseBraceToken */); return finishNode(node); } function parseArrayBindingPattern() { - var node = createNode(151 /* ArrayBindingPattern */); + var node = createNode(152 /* ArrayBindingPattern */); parseExpected(18 /* OpenBracketToken */); node.elements = parseDelimitedList(11 /* ArrayBindingElements */, parseArrayBindingElement); parseExpected(19 /* CloseBracketToken */); @@ -9329,7 +9405,7 @@ var ts; return parseIdentifier(); } function parseVariableDeclaration() { - var node = createNode(198 /* VariableDeclaration */); + var node = createNode(199 /* VariableDeclaration */); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token)) { @@ -9338,7 +9414,7 @@ var ts; return finishNode(node); } function parseVariableDeclarationList(inForStatementInitializer) { - var node = createNode(199 /* VariableDeclarationList */); + var node = createNode(200 /* VariableDeclarationList */); switch (token) { case 98 /* VarKeyword */: break; @@ -9361,7 +9437,7 @@ var ts; // So we need to look ahead to determine if 'of' should be treated as a keyword in // this context. // The checker will then give an error that there is an empty declaration list. - if (token === 125 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token === 126 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { node.declarations = createMissingList(); } else { @@ -9376,7 +9452,7 @@ var ts; return nextTokenIsIdentifier() && nextToken() === 17 /* CloseParenToken */; } function parseVariableStatement(fullStart, decorators, modifiers) { - var node = createNode(180 /* VariableStatement */, fullStart); + var node = createNode(181 /* VariableStatement */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.declarationList = parseVariableDeclarationList(false); @@ -9384,7 +9460,7 @@ var ts; return finishNode(node); } function parseFunctionDeclaration(fullStart, decorators, modifiers) { - var node = createNode(200 /* FunctionDeclaration */, fullStart); + var node = createNode(201 /* FunctionDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(83 /* FunctionKeyword */); @@ -9395,7 +9471,7 @@ var ts; return finishNode(node); } function parseConstructorDeclaration(pos, decorators, modifiers) { - var node = createNode(135 /* Constructor */, pos); + var node = createNode(136 /* Constructor */, pos); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(114 /* ConstructorKeyword */); @@ -9404,7 +9480,7 @@ var ts; return finishNode(node); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { - var method = createNode(134 /* MethodDeclaration */, fullStart); + var method = createNode(135 /* MethodDeclaration */, fullStart); method.decorators = decorators; setModifiers(method, modifiers); method.asteriskToken = asteriskToken; @@ -9415,7 +9491,7 @@ var ts; return finishNode(method); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { - var property = createNode(132 /* PropertyDeclaration */, fullStart); + var property = createNode(133 /* PropertyDeclaration */, fullStart); property.decorators = decorators; setModifiers(property, modifiers); property.name = name; @@ -9496,7 +9572,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 120 /* SetKeyword */ || idToken === 116 /* GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 121 /* SetKeyword */ || idToken === 116 /* GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -9530,7 +9606,7 @@ var ts; decorators = []; decorators.pos = scanner.getStartPos(); } - var decorator = createNode(130 /* Decorator */, decoratorStart); + var decorator = createNode(131 /* Decorator */, decoratorStart); decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher); decorators.push(finishNode(decorator)); } @@ -9563,7 +9639,7 @@ var ts; } function parseClassElement() { if (token === 22 /* SemicolonToken */) { - var result = createNode(178 /* SemicolonClassElement */); + var result = createNode(179 /* SemicolonClassElement */); nextToken(); return finishNode(result); } @@ -9601,10 +9677,10 @@ var ts; return parseClassDeclarationOrExpression( /*fullStart:*/ scanner.getStartPos(), /*decorators:*/ undefined, - /*modifiers:*/ undefined, 174 /* ClassExpression */); + /*modifiers:*/ undefined, 175 /* ClassExpression */); } function parseClassDeclaration(fullStart, decorators, modifiers) { - return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 201 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(fullStart, decorators, modifiers, 202 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(fullStart, decorators, modifiers, kind) { // In ES6 specification, All parts of a ClassDeclaration or a ClassExpression are strict mode code @@ -9649,16 +9725,16 @@ var ts; } function parseHeritageClause() { if (token === 79 /* ExtendsKeyword */ || token === 102 /* ImplementsKeyword */) { - var node = createNode(222 /* HeritageClause */); + var node = createNode(223 /* HeritageClause */); node.token = token; nextToken(); - node.types = parseDelimitedList(8 /* HeritageClauseElement */, parseHeritageClauseElement); + node.types = parseDelimitedList(8 /* HeritageClauseElement */, parseExpressionWithTypeArguments); return finishNode(node); } return undefined; } - function parseHeritageClauseElement() { - var node = createNode(177 /* HeritageClauseElement */); + function parseExpressionWithTypeArguments() { + var node = createNode(177 /* ExpressionWithTypeArguments */); node.expression = parseLeftHandSideExpressionOrHigher(); if (token === 24 /* LessThanToken */) { node.typeArguments = parseBracketedList(17 /* TypeArguments */, parseType, 24 /* LessThanToken */, 25 /* GreaterThanToken */); @@ -9672,7 +9748,7 @@ var ts; return parseList(6 /* ClassMembers */, false, parseClassElement); } function parseInterfaceDeclaration(fullStart, decorators, modifiers) { - var node = createNode(202 /* InterfaceDeclaration */, fullStart); + var node = createNode(203 /* InterfaceDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(103 /* InterfaceKeyword */); @@ -9683,10 +9759,10 @@ var ts; return finishNode(node); } function parseTypeAliasDeclaration(fullStart, decorators, modifiers) { - var node = createNode(203 /* TypeAliasDeclaration */, fullStart); + var node = createNode(204 /* TypeAliasDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); - parseExpected(123 /* TypeKeyword */); + parseExpected(124 /* TypeKeyword */); node.name = parseIdentifier(); parseExpected(53 /* EqualsToken */); node.type = parseType(); @@ -9698,13 +9774,13 @@ var ts; // ConstantEnumMemberSection, which starts at the beginning of an enum declaration // or any time an integer literal initializer is encountered. function parseEnumMember() { - var node = createNode(226 /* EnumMember */, scanner.getStartPos()); + var node = createNode(227 /* EnumMember */, scanner.getStartPos()); node.name = parsePropertyName(); node.initializer = allowInAnd(parseNonParameterInitializer); return finishNode(node); } function parseEnumDeclaration(fullStart, decorators, modifiers) { - var node = createNode(204 /* EnumDeclaration */, fullStart); + var node = createNode(205 /* EnumDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); parseExpected(77 /* EnumKeyword */); @@ -9719,7 +9795,7 @@ var ts; return finishNode(node); } function parseModuleBlock() { - var node = createNode(206 /* ModuleBlock */, scanner.getStartPos()); + var node = createNode(207 /* ModuleBlock */, scanner.getStartPos()); if (parseExpected(14 /* OpenBraceToken */)) { node.statements = parseList(1 /* ModuleElements */, false, parseModuleElement); parseExpected(15 /* CloseBraceToken */); @@ -9729,19 +9805,19 @@ var ts; } return finishNode(node); } - function parseInternalModuleTail(fullStart, decorators, modifiers, flags) { - var node = createNode(205 /* ModuleDeclaration */, fullStart); + function parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags) { + var node = createNode(206 /* ModuleDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.flags |= flags; node.name = parseIdentifier(); node.body = parseOptional(20 /* DotToken */) - ? parseInternalModuleTail(getNodePos(), undefined, undefined, 1 /* Export */) + ? parseModuleOrNamespaceDeclaration(getNodePos(), undefined, undefined, 1 /* Export */) : parseModuleBlock(); return finishNode(node); } function parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) { - var node = createNode(205 /* ModuleDeclaration */, fullStart); + var node = createNode(206 /* ModuleDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); node.name = parseLiteralNode(true); @@ -9749,13 +9825,20 @@ var ts; return finishNode(node); } function parseModuleDeclaration(fullStart, decorators, modifiers) { - parseExpected(117 /* ModuleKeyword */); - return token === 8 /* StringLiteral */ - ? parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers) - : parseInternalModuleTail(fullStart, decorators, modifiers, modifiers ? modifiers.flags : 0); + var flags = modifiers ? modifiers.flags : 0; + if (parseOptional(118 /* NamespaceKeyword */)) { + flags |= 32768 /* Namespace */; + } + else { + parseExpected(117 /* ModuleKeyword */); + if (token === 8 /* StringLiteral */) { + return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers); + } + } + return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags); } function isExternalModuleReference() { - return token === 118 /* RequireKeyword */ && + return token === 119 /* RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -9764,7 +9847,7 @@ var ts; function nextTokenIsCommaOrFromKeyword() { nextToken(); return token === 23 /* CommaToken */ || - token === 124 /* FromKeyword */; + token === 125 /* FromKeyword */; } function parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers) { parseExpected(85 /* ImportKeyword */); @@ -9772,11 +9855,11 @@ var ts; var identifier; if (isIdentifier()) { identifier = parseIdentifier(); - if (token !== 23 /* CommaToken */ && token !== 124 /* FromKeyword */) { + if (token !== 23 /* CommaToken */ && token !== 125 /* FromKeyword */) { // ImportEquals declaration of type: // import x = require("mod"); or // import x = M.x; - var importEqualsDeclaration = createNode(208 /* ImportEqualsDeclaration */, fullStart); + var importEqualsDeclaration = createNode(209 /* ImportEqualsDeclaration */, fullStart); importEqualsDeclaration.decorators = decorators; setModifiers(importEqualsDeclaration, modifiers); importEqualsDeclaration.name = identifier; @@ -9787,7 +9870,7 @@ var ts; } } // Import statement - var importDeclaration = createNode(209 /* ImportDeclaration */, fullStart); + var importDeclaration = createNode(210 /* ImportDeclaration */, fullStart); importDeclaration.decorators = decorators; setModifiers(importDeclaration, modifiers); // ImportDeclaration: @@ -9797,7 +9880,7 @@ var ts; token === 35 /* AsteriskToken */ || token === 14 /* OpenBraceToken */) { importDeclaration.importClause = parseImportClause(identifier, afterImportPos); - parseExpected(124 /* FromKeyword */); + parseExpected(125 /* FromKeyword */); } importDeclaration.moduleSpecifier = parseModuleSpecifier(); parseSemicolon(); @@ -9810,7 +9893,7 @@ var ts; // NamedImports // ImportedDefaultBinding, NameSpaceImport // ImportedDefaultBinding, NamedImports - var importClause = createNode(210 /* ImportClause */, fullStart); + var importClause = createNode(211 /* ImportClause */, fullStart); if (identifier) { // ImportedDefaultBinding: // ImportedBinding @@ -9820,7 +9903,7 @@ var ts; // parse namespace or named imports if (!importClause.name || parseOptional(23 /* CommaToken */)) { - importClause.namedBindings = token === 35 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(212 /* NamedImports */); + importClause.namedBindings = token === 35 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(213 /* NamedImports */); } return finishNode(importClause); } @@ -9830,8 +9913,8 @@ var ts; : parseEntityName(false); } function parseExternalModuleReference() { - var node = createNode(219 /* ExternalModuleReference */); - parseExpected(118 /* RequireKeyword */); + var node = createNode(220 /* ExternalModuleReference */); + parseExpected(119 /* RequireKeyword */); parseExpected(16 /* OpenParenToken */); node.expression = parseModuleSpecifier(); parseExpected(17 /* CloseParenToken */); @@ -9852,7 +9935,7 @@ var ts; function parseNamespaceImport() { // NameSpaceImport: // * as ImportedBinding - var namespaceImport = createNode(211 /* NamespaceImport */); + var namespaceImport = createNode(212 /* NamespaceImport */); parseExpected(35 /* AsteriskToken */); parseExpected(111 /* AsKeyword */); namespaceImport.name = parseIdentifier(); @@ -9867,14 +9950,14 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - node.elements = parseBracketedList(20 /* ImportOrExportSpecifiers */, kind === 212 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 14 /* OpenBraceToken */, 15 /* CloseBraceToken */); + node.elements = parseBracketedList(20 /* ImportOrExportSpecifiers */, kind === 213 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 14 /* OpenBraceToken */, 15 /* CloseBraceToken */); return finishNode(node); } function parseExportSpecifier() { - return parseImportOrExportSpecifier(217 /* ExportSpecifier */); + return parseImportOrExportSpecifier(218 /* ExportSpecifier */); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(213 /* ImportSpecifier */); + return parseImportOrExportSpecifier(214 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var node = createNode(kind); @@ -9899,23 +9982,23 @@ var ts; else { node.name = identifierName; } - if (kind === 213 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 214 /* ImportSpecifier */ && checkIdentifierIsKeyword) { // Report error identifier expected parseErrorAtPosition(checkIdentifierStart, checkIdentifierEnd - checkIdentifierStart, ts.Diagnostics.Identifier_expected); } return finishNode(node); } function parseExportDeclaration(fullStart, decorators, modifiers) { - var node = createNode(215 /* ExportDeclaration */, fullStart); + var node = createNode(216 /* ExportDeclaration */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(35 /* AsteriskToken */)) { - parseExpected(124 /* FromKeyword */); + parseExpected(125 /* FromKeyword */); node.moduleSpecifier = parseModuleSpecifier(); } else { - node.exportClause = parseNamedImportsOrExports(216 /* NamedExports */); - if (parseOptional(124 /* FromKeyword */)) { + node.exportClause = parseNamedImportsOrExports(217 /* NamedExports */); + if (parseOptional(125 /* FromKeyword */)) { node.moduleSpecifier = parseModuleSpecifier(); } } @@ -9923,7 +10006,7 @@ var ts; return finishNode(node); } function parseExportAssignment(fullStart, decorators, modifiers) { - var node = createNode(214 /* ExportAssignment */, fullStart); + var node = createNode(215 /* ExportAssignment */, fullStart); node.decorators = decorators; setModifiers(node, modifiers); if (parseOptional(53 /* EqualsToken */)) { @@ -9952,13 +10035,14 @@ var ts; case 69 /* ClassKeyword */: case 103 /* InterfaceKeyword */: case 77 /* EnumKeyword */: - case 123 /* TypeKeyword */: + case 124 /* TypeKeyword */: // Not true keywords so ensure an identifier follows return lookAhead(nextTokenIsIdentifierOrKeyword); case 85 /* ImportKeyword */: // Not true keywords so ensure an identifier follows or is string literal or asterisk or open brace return lookAhead(nextTokenCanFollowImportKeyword); case 117 /* ModuleKeyword */: + case 118 /* NamespaceKeyword */: // Not a true keyword so ensure an identifier or string literal follows return lookAhead(nextTokenIsIdentifierOrKeywordOrStringLiteral); case 78 /* ExportKeyword */: @@ -10029,11 +10113,12 @@ var ts; return parseClassDeclaration(fullStart, decorators, modifiers); case 103 /* InterfaceKeyword */: return parseInterfaceDeclaration(fullStart, decorators, modifiers); - case 123 /* TypeKeyword */: + case 124 /* TypeKeyword */: return parseTypeAliasDeclaration(fullStart, decorators, modifiers); case 77 /* EnumKeyword */: return parseEnumDeclaration(fullStart, decorators, modifiers); case 117 /* ModuleKeyword */: + case 118 /* NamespaceKeyword */: return parseModuleDeclaration(fullStart, decorators, modifiers); case 85 /* ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers); @@ -10041,7 +10126,7 @@ var ts; if (decorators) { // We reached this point because we encountered an AtToken and assumed a declaration would // follow. For recovery and error reporting purposes, return an incomplete declaration. - var node = createMissingNode(218 /* MissingDeclaration */, true, ts.Diagnostics.Declaration_expected); + var node = createMissingNode(219 /* MissingDeclaration */, true, ts.Diagnostics.Declaration_expected); node.pos = fullStart; node.decorators = decorators; setModifiers(node, modifiers); @@ -10124,10 +10209,10 @@ var ts; function setExternalModuleIndicator(sourceFile) { sourceFile.externalModuleIndicator = ts.forEach(sourceFile.statements, function (node) { return node.flags & 1 /* Export */ - || node.kind === 208 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 219 /* ExternalModuleReference */ - || node.kind === 209 /* ImportDeclaration */ - || node.kind === 214 /* ExportAssignment */ - || node.kind === 215 /* ExportDeclaration */ + || node.kind === 209 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 220 /* ExternalModuleReference */ + || node.kind === 210 /* ImportDeclaration */ + || node.kind === 215 /* ExportAssignment */ + || node.kind === 216 /* ExportDeclaration */ ? node : undefined; }); @@ -10905,10 +10990,10 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = {}); } function getSourceFile(node) { - return ts.getAncestor(node, 227 /* SourceFile */); + return ts.getAncestor(node, 228 /* SourceFile */); } function isGlobalSourceFile(node) { - return node.kind === 227 /* SourceFile */ && !ts.isExternalModule(node); + return node.kind === 228 /* SourceFile */ && !ts.isExternalModule(node); } function getSymbol(symbols, name, meaning) { if (meaning && ts.hasProperty(symbols, name)) { @@ -10957,18 +11042,18 @@ var ts; } } switch (location.kind) { - case 227 /* SourceFile */: + case 228 /* SourceFile */: if (!ts.isExternalModule(location)) break; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8914931 /* ModuleMember */)) { - if (result.flags & meaning || !(result.flags & 8388608 /* Alias */ && getDeclarationOfAliasSymbol(result).kind === 217 /* ExportSpecifier */)) { + if (result.flags & meaning || !(result.flags & 8388608 /* Alias */ && getDeclarationOfAliasSymbol(result).kind === 218 /* ExportSpecifier */)) { break loop; } result = undefined; } - else if (location.kind === 227 /* SourceFile */ || - (location.kind === 205 /* ModuleDeclaration */ && location.name.kind === 8 /* StringLiteral */)) { + else if (location.kind === 228 /* SourceFile */ || + (location.kind === 206 /* ModuleDeclaration */ && location.name.kind === 8 /* StringLiteral */)) { result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & 8914931 /* ModuleMember */); var localSymbol = ts.getLocalSymbolForExportDefault(result); if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) { @@ -10977,20 +11062,20 @@ var ts; result = undefined; } break; - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) { break loop; } break; - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or // local variables of the constructor. This effectively means that entities from outer scopes // by the same name as a constructor parameter or local variable are inaccessible // in initializer expressions for instance member variables. - if (location.parent.kind === 201 /* ClassDeclaration */ && !(location.flags & 128 /* Static */)) { + if (location.parent.kind === 202 /* ClassDeclaration */ && !(location.flags & 128 /* Static */)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (getSymbol(ctor.locals, name, meaning & 107455 /* Value */)) { @@ -11000,8 +11085,8 @@ var ts; } } break; - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: if (result = getSymbol(getSymbolOfNode(location).members, name, meaning & 793056 /* Type */)) { if (lastLocation && lastLocation.flags & 128 /* Static */) { // TypeScript 1.0 spec (April 2014): 3.4.1 @@ -11021,9 +11106,9 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 127 /* ComputedPropertyName */: + case 128 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (grandparent.kind === 201 /* ClassDeclaration */ || grandparent.kind === 202 /* InterfaceDeclaration */) { + if (grandparent.kind === 202 /* ClassDeclaration */ || grandparent.kind === 203 /* InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = getSymbol(getSymbolOfNode(grandparent).members, name, meaning & 793056 /* Type */)) { error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -11031,19 +11116,19 @@ var ts; } } break; - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 200 /* FunctionDeclaration */: - case 163 /* ArrowFunction */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 201 /* FunctionDeclaration */: + case 164 /* ArrowFunction */: if (name === "arguments") { result = argumentsSymbol; break loop; } break; - case 162 /* FunctionExpression */: + case 163 /* FunctionExpression */: if (name === "arguments") { result = argumentsSymbol; break loop; @@ -11054,14 +11139,14 @@ var ts; break loop; } break; - case 174 /* ClassExpression */: + case 175 /* ClassExpression */: var className = location.name; if (className && name === className.text) { result = location.symbol; break loop; } break; - case 130 /* Decorator */: + case 131 /* Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -11070,7 +11155,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 129 /* Parameter */) { + if (location.parent && location.parent.kind === 130 /* Parameter */) { location = location.parent; } // @@ -11126,16 +11211,16 @@ var ts; // for (let x in x) // for (let x of x) // climb up to the variable declaration skipping binding patterns - var variableDeclaration = ts.getAncestor(declaration, 198 /* VariableDeclaration */); + var variableDeclaration = ts.getAncestor(declaration, 199 /* VariableDeclaration */); var container = ts.getEnclosingBlockScopeContainer(variableDeclaration); - if (variableDeclaration.parent.parent.kind === 180 /* VariableStatement */ || - variableDeclaration.parent.parent.kind === 186 /* ForStatement */) { + if (variableDeclaration.parent.parent.kind === 181 /* VariableStatement */ || + variableDeclaration.parent.parent.kind === 187 /* ForStatement */) { // variable statement/for statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, variableDeclaration, container); } - else if (variableDeclaration.parent.parent.kind === 188 /* ForOfStatement */ || - variableDeclaration.parent.parent.kind === 187 /* ForInStatement */) { + else if (variableDeclaration.parent.parent.kind === 189 /* ForOfStatement */ || + variableDeclaration.parent.parent.kind === 188 /* ForInStatement */) { // ForIn/ForOf case - use site should not be used in expression part var expression = variableDeclaration.parent.parent.expression; isUsedBeforeDeclaration = isSameScopeDescendentOf(errorLocation, expression, container); @@ -11162,10 +11247,10 @@ var ts; } function getAnyImportSyntax(node) { if (ts.isAliasSymbolDeclaration(node)) { - if (node.kind === 208 /* ImportEqualsDeclaration */) { + if (node.kind === 209 /* ImportEqualsDeclaration */) { return node; } - while (node && node.kind !== 209 /* ImportDeclaration */) { + while (node && node.kind !== 210 /* ImportDeclaration */) { node = node.parent; } return node; @@ -11175,7 +11260,7 @@ var ts; return ts.forEach(symbol.declarations, function (d) { return ts.isAliasSymbolDeclaration(d) ? d : undefined; }); } function getTargetOfImportEqualsDeclaration(node) { - if (node.moduleReference.kind === 219 /* ExternalModuleReference */) { + if (node.moduleReference.kind === 220 /* ExternalModuleReference */) { return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node))); } return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, node); @@ -11185,7 +11270,7 @@ var ts; if (moduleSymbol) { var exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]); if (!exportDefaultSymbol) { - error(node.name, ts.Diagnostics.External_module_0_has_no_default_export, symbolToString(moduleSymbol)); + error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol)); } return exportDefaultSymbol; } @@ -11282,17 +11367,17 @@ var ts; } function getTargetOfAliasDeclaration(node) { switch (node.kind) { - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: return getTargetOfImportEqualsDeclaration(node); - case 210 /* ImportClause */: + case 211 /* ImportClause */: return getTargetOfImportClause(node); - case 211 /* NamespaceImport */: + case 212 /* NamespaceImport */: return getTargetOfNamespaceImport(node); - case 213 /* ImportSpecifier */: + case 214 /* ImportSpecifier */: return getTargetOfImportSpecifier(node); - case 217 /* ExportSpecifier */: + case 218 /* ExportSpecifier */: return getTargetOfExportSpecifier(node); - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: return getTargetOfExportAssignment(node); } } @@ -11337,11 +11422,11 @@ var ts; if (!links.referenced) { links.referenced = true; var node = getDeclarationOfAliasSymbol(symbol); - if (node.kind === 214 /* ExportAssignment */) { + if (node.kind === 215 /* ExportAssignment */) { // export default checkExpressionCached(node.expression); } - else if (node.kind === 217 /* ExportSpecifier */) { + else if (node.kind === 218 /* ExportSpecifier */) { // export { } or export { as foo } checkExpressionCached(node.propertyName || node.name); } @@ -11354,7 +11439,7 @@ var ts; // This function is only for imports with entity names function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, importDeclaration) { if (!importDeclaration) { - importDeclaration = ts.getAncestor(entityName, 208 /* ImportEqualsDeclaration */); + importDeclaration = ts.getAncestor(entityName, 209 /* ImportEqualsDeclaration */); ts.Debug.assert(importDeclaration !== undefined); } // There are three things we might try to look for. In the following examples, @@ -11367,13 +11452,13 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 65 /* Identifier */ || entityName.parent.kind === 126 /* QualifiedName */) { + if (entityName.kind === 65 /* Identifier */ || entityName.parent.kind === 127 /* QualifiedName */) { return resolveEntityName(entityName, 1536 /* Namespace */); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 208 /* ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 209 /* ImportEqualsDeclaration */); return resolveEntityName(entityName, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */); } } @@ -11392,9 +11477,9 @@ var ts; return undefined; } } - else if (name.kind === 126 /* QualifiedName */ || name.kind === 155 /* PropertyAccessExpression */) { - var left = name.kind === 126 /* QualifiedName */ ? name.left : name.expression; - var right = name.kind === 126 /* QualifiedName */ ? name.right : name.name; + else if (name.kind === 127 /* QualifiedName */ || name.kind === 156 /* PropertyAccessExpression */) { + var left = name.kind === 127 /* QualifiedName */ ? name.left : name.expression; + var right = name.kind === 127 /* QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, 1536 /* Namespace */); if (!namespace || namespace === unknownSymbol || ts.nodeIsMissing(right)) { return undefined; @@ -11451,10 +11536,10 @@ var ts; if (sourceFile.symbol) { return sourceFile.symbol; } - error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_an_external_module, sourceFile.fileName); + error(moduleReferenceLiteral, ts.Diagnostics.File_0_is_not_a_module, sourceFile.fileName); return; } - error(moduleReferenceLiteral, ts.Diagnostics.Cannot_find_external_module_0, moduleName); + error(moduleReferenceLiteral, ts.Diagnostics.Cannot_find_module_0, moduleName); } // An external module with an 'export =' declaration resolves to the target of the 'export =' declaration, // and an external module with no 'export =' declaration resolves to the module itself. @@ -11467,7 +11552,7 @@ var ts; function resolveESModuleSymbol(moduleSymbol, moduleReferenceExpression) { var symbol = resolveExternalModuleSymbol(moduleSymbol); if (symbol && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */))) { - error(moduleReferenceExpression, ts.Diagnostics.External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); + error(moduleReferenceExpression, ts.Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol)); symbol = undefined; } return symbol; @@ -11554,7 +11639,7 @@ var ts; var members = node.members; for (var _i = 0; _i < members.length; _i++) { var member = members[_i]; - if (member.kind === 135 /* Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 136 /* Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -11624,17 +11709,17 @@ var ts; } } switch (location_1.kind) { - case 227 /* SourceFile */: + case 228 /* SourceFile */: if (!ts.isExternalModule(location_1)) { break; } - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: if (result = callback(getSymbolOfNode(location_1).exports)) { return result; } break; - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: if (result = callback(getSymbolOfNode(location_1).members)) { return result; } @@ -11783,8 +11868,8 @@ var ts; } } function hasExternalModuleSymbol(declaration) { - return (declaration.kind === 205 /* ModuleDeclaration */ && declaration.name.kind === 8 /* StringLiteral */) || - (declaration.kind === 227 /* SourceFile */ && ts.isExternalModule(declaration)); + return (declaration.kind === 206 /* ModuleDeclaration */ && declaration.name.kind === 8 /* StringLiteral */) || + (declaration.kind === 228 /* SourceFile */ && ts.isExternalModule(declaration)); } function hasVisibleDeclarations(symbol) { var aliasesToMakeVisible; @@ -11820,12 +11905,12 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 144 /* TypeQuery */) { + if (entityName.parent.kind === 145 /* TypeQuery */) { // Typeof value meaning = 107455 /* Value */ | 1048576 /* ExportValue */; } - else if (entityName.kind === 126 /* QualifiedName */ || entityName.kind === 155 /* PropertyAccessExpression */ || - entityName.parent.kind === 208 /* ImportEqualsDeclaration */) { + else if (entityName.kind === 127 /* QualifiedName */ || entityName.kind === 156 /* PropertyAccessExpression */ || + entityName.parent.kind === 209 /* ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1536 /* Namespace */; @@ -11873,10 +11958,10 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) { var node = type.symbol.declarations[0].parent; - while (node.kind === 149 /* ParenthesizedType */) { + while (node.kind === 150 /* ParenthesizedType */) { node = node.parent; } - if (node.kind === 203 /* TypeAliasDeclaration */) { + if (node.kind === 204 /* TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -12080,7 +12165,7 @@ var ts; var isNonLocalFunctionSymbol = !!(type.symbol.flags & 16 /* Function */) && (type.symbol.parent || ts.forEach(type.symbol.declarations, function (declaration) { - return declaration.parent.kind === 227 /* SourceFile */ || declaration.parent.kind === 206 /* ModuleBlock */; + return declaration.parent.kind === 228 /* SourceFile */ || declaration.parent.kind === 207 /* ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -12159,7 +12244,7 @@ var ts; writer.writeParameter(getIndexerParameterName(resolved, 0 /* String */, "x")); writePunctuation(writer, 51 /* ColonToken */); writeSpace(writer); - writeKeyword(writer, 121 /* StringKeyword */); + writeKeyword(writer, 122 /* StringKeyword */); writePunctuation(writer, 19 /* CloseBracketToken */); writePunctuation(writer, 51 /* ColonToken */); writeSpace(writer); @@ -12173,7 +12258,7 @@ var ts; writer.writeParameter(getIndexerParameterName(resolved, 1 /* Number */, "x")); writePunctuation(writer, 51 /* ColonToken */); writeSpace(writer); - writeKeyword(writer, 119 /* NumberKeyword */); + writeKeyword(writer, 120 /* NumberKeyword */); writePunctuation(writer, 19 /* CloseBracketToken */); writePunctuation(writer, 51 /* ColonToken */); writeSpace(writer); @@ -12319,12 +12404,12 @@ var ts; function isDeclarationVisible(node) { function getContainingExternalModule(node) { for (; node; node = node.parent) { - if (node.kind === 205 /* ModuleDeclaration */) { + if (node.kind === 206 /* ModuleDeclaration */) { if (node.name.kind === 8 /* StringLiteral */) { return node; } } - else if (node.kind === 227 /* SourceFile */) { + else if (node.kind === 228 /* SourceFile */) { return ts.isExternalModule(node) ? node : undefined; } } @@ -12373,69 +12458,69 @@ var ts; } function determineIfDeclarationIsVisible() { switch (node.kind) { - case 152 /* BindingElement */: + case 153 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 198 /* VariableDeclaration */: + case 199 /* VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // Otherwise fall through - case 205 /* ModuleDeclaration */: - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 203 /* TypeAliasDeclaration */: - case 200 /* FunctionDeclaration */: - case 204 /* EnumDeclaration */: - case 208 /* ImportEqualsDeclaration */: + case 206 /* ModuleDeclaration */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 204 /* TypeAliasDeclaration */: + case 201 /* FunctionDeclaration */: + case 205 /* EnumDeclaration */: + case 209 /* ImportEqualsDeclaration */: var parent_2 = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedNodeFlags(node) & 1 /* Export */) && - !(node.kind !== 208 /* ImportEqualsDeclaration */ && parent_2.kind !== 227 /* SourceFile */ && ts.isInAmbientContext(parent_2))) { + !(node.kind !== 209 /* ImportEqualsDeclaration */ && parent_2.kind !== 228 /* SourceFile */ && ts.isInAmbientContext(parent_2))) { return isGlobalSourceFile(parent_2); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent_2); - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: if (node.flags & (32 /* Private */ | 64 /* Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so let it fall into next case statement - case 135 /* Constructor */: - case 139 /* ConstructSignature */: - case 138 /* CallSignature */: - case 140 /* IndexSignature */: - case 129 /* Parameter */: - case 206 /* ModuleBlock */: - case 142 /* FunctionType */: - case 143 /* ConstructorType */: - case 145 /* TypeLiteral */: - case 141 /* TypeReference */: - case 146 /* ArrayType */: - case 147 /* TupleType */: - case 148 /* UnionType */: - case 149 /* ParenthesizedType */: + case 136 /* Constructor */: + case 140 /* ConstructSignature */: + case 139 /* CallSignature */: + case 141 /* IndexSignature */: + case 130 /* Parameter */: + case 207 /* ModuleBlock */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: + case 146 /* TypeLiteral */: + case 142 /* TypeReference */: + case 147 /* ArrayType */: + case 148 /* TupleType */: + case 149 /* UnionType */: + case 150 /* ParenthesizedType */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 210 /* ImportClause */: - case 211 /* NamespaceImport */: - case 213 /* ImportSpecifier */: + case 211 /* ImportClause */: + case 212 /* NamespaceImport */: + case 214 /* ImportSpecifier */: return false; // Type parameters are always visible - case 128 /* TypeParameter */: + case 129 /* TypeParameter */: // Source file is always visible - case 227 /* SourceFile */: + case 228 /* SourceFile */: return true; // Export assignements do not create name bindings outside the module - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: return false; default: ts.Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind); @@ -12451,10 +12536,10 @@ var ts; } function collectLinkedAliases(node) { var exportSymbol; - if (node.parent && node.parent.kind === 214 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 215 /* ExportAssignment */) { exportSymbol = resolveName(node.parent, node.text, 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */, ts.Diagnostics.Cannot_find_name_0, node); } - else if (node.parent.kind === 217 /* ExportSpecifier */) { + else if (node.parent.kind === 218 /* ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent); } var result = []; @@ -12480,7 +12565,7 @@ var ts; } } function getRootDeclaration(node) { - while (node.kind === 152 /* BindingElement */) { + while (node.kind === 153 /* BindingElement */) { node = node.parent.parent; } return node; @@ -12489,7 +12574,7 @@ var ts; node = getRootDeclaration(node); // Parent chain: // VaribleDeclaration -> VariableDeclarationList -> VariableStatement -> 'Declaration Container' - return node.kind === 198 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; + return node.kind === 199 /* VariableDeclaration */ ? node.parent.parent.parent : node.parent; } function getTypeOfPrototypeProperty(prototype) { // TypeScript 1.0 spec (April 2014): 8.4 @@ -12522,7 +12607,7 @@ var ts; return parentType; } var type; - if (pattern.kind === 150 /* ObjectBindingPattern */) { + if (pattern.kind === 151 /* ObjectBindingPattern */) { // Use explicitly specified property name ({ p: xxx } form), or otherwise the implied name ({ p } form) var name_5 = declaration.propertyName || declaration.name; // Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature, @@ -12569,10 +12654,10 @@ var ts; // Return the inferred type for a variable, parameter, or property declaration function getTypeForVariableLikeDeclaration(declaration) { // A variable declared in a for..in statement is always of type any - if (declaration.parent.parent.kind === 187 /* ForInStatement */) { + if (declaration.parent.parent.kind === 188 /* ForInStatement */) { return anyType; } - if (declaration.parent.parent.kind === 188 /* ForOfStatement */) { + if (declaration.parent.parent.kind === 189 /* ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -12586,11 +12671,11 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 129 /* Parameter */) { + if (declaration.kind === 130 /* Parameter */) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 137 /* SetAccessor */ && !ts.hasDynamicName(func)) { - var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 136 /* GetAccessor */); + if (func.kind === 138 /* SetAccessor */ && !ts.hasDynamicName(func)) { + var getter = ts.getDeclarationOfKind(declaration.parent.symbol, 137 /* GetAccessor */); if (getter) { return getReturnTypeOfSignature(getSignatureFromDeclaration(getter)); } @@ -12606,7 +12691,7 @@ var ts; return checkExpressionCached(declaration.initializer); } // If it is a short-hand property assignment, use the type of the identifier - if (declaration.kind === 225 /* ShorthandPropertyAssignment */) { + if (declaration.kind === 226 /* ShorthandPropertyAssignment */) { return checkIdentifier(declaration.name); } // No type specified and nothing can be inferred @@ -12641,7 +12726,7 @@ var ts; var hasSpreadElement = false; var elementTypes = []; ts.forEach(pattern.elements, function (e) { - elementTypes.push(e.kind === 175 /* OmittedExpression */ || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); + elementTypes.push(e.kind === 176 /* OmittedExpression */ || e.dotDotDotToken ? anyType : getTypeFromBindingElement(e)); if (e.dotDotDotToken) { hasSpreadElement = true; } @@ -12664,7 +12749,7 @@ var ts; // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. function getTypeFromBindingPattern(pattern) { - return pattern.kind === 150 /* ObjectBindingPattern */ + return pattern.kind === 151 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern) : getTypeFromArrayBindingPattern(pattern); } @@ -12686,7 +12771,7 @@ var ts; // During a normal type check we'll never get to here with a property assignment (the check of the containing // object literal uses a different path). We exclude widening only so that language services and type verification // tools see the actual type. - return declaration.kind !== 224 /* PropertyAssignment */ ? getWidenedType(type) : type; + return declaration.kind !== 225 /* PropertyAssignment */ ? getWidenedType(type) : type; } // If no type was specified and nothing could be inferred, and if the declaration specifies a binding pattern, use // the type implied by the binding pattern @@ -12698,7 +12783,7 @@ var ts; // Report implicit any errors unless this is a private property within an ambient declaration if (reportErrors && compilerOptions.noImplicitAny) { var root = getRootDeclaration(declaration); - if (!isPrivateWithinAmbient(root) && !(root.kind === 129 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { + if (!isPrivateWithinAmbient(root) && !(root.kind === 130 /* Parameter */ && isPrivateWithinAmbient(root.parent))) { reportImplicitAnyError(declaration, type); } } @@ -12713,11 +12798,11 @@ var ts; } // Handle catch clause variables var declaration = symbol.valueDeclaration; - if (declaration.parent.kind === 223 /* CatchClause */) { + if (declaration.parent.kind === 224 /* CatchClause */) { return links.type = anyType; } // Handle export default expressions - if (declaration.kind === 214 /* ExportAssignment */) { + if (declaration.kind === 215 /* ExportAssignment */) { return links.type = checkExpression(declaration.expression); } // Handle variable, parameter or property @@ -12743,7 +12828,7 @@ var ts; } function getAnnotatedAccessorType(accessor) { if (accessor) { - if (accessor.kind === 136 /* GetAccessor */) { + if (accessor.kind === 137 /* GetAccessor */) { return accessor.type && getTypeFromTypeNode(accessor.type); } else { @@ -12762,8 +12847,8 @@ var ts; links = links || getSymbolLinks(symbol); if (!links.type) { links.type = resolvingType; - var getter = ts.getDeclarationOfKind(symbol, 136 /* GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 137 /* SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 138 /* SetAccessor */); var type; // First try to see if the user specified a return type on the get-accessor. var getterReturnType = getAnnotatedAccessorType(getter); @@ -12796,7 +12881,7 @@ var ts; else if (links.type === resolvingType) { links.type = anyType; if (compilerOptions.noImplicitAny) { - var getter = ts.getDeclarationOfKind(symbol, 136 /* GetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 137 /* GetAccessor */); 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)); } } @@ -12866,7 +12951,7 @@ var ts; function getTypeParametersOfClassOrInterface(symbol) { var result; ts.forEach(symbol.declarations, function (node) { - if (node.kind === 202 /* InterfaceDeclaration */ || node.kind === 201 /* ClassDeclaration */) { + if (node.kind === 203 /* InterfaceDeclaration */ || node.kind === 202 /* ClassDeclaration */) { var declaration = node; if (declaration.typeParameters && declaration.typeParameters.length) { ts.forEach(declaration.typeParameters, function (node) { @@ -12900,10 +12985,10 @@ var ts; } function resolveBaseTypesOfClass(type) { type.baseTypes = []; - var declaration = ts.getDeclarationOfKind(type.symbol, 201 /* ClassDeclaration */); + var declaration = ts.getDeclarationOfKind(type.symbol, 202 /* ClassDeclaration */); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(declaration); if (baseTypeNode) { - var baseType = getTypeFromHeritageClauseElement(baseTypeNode); + var baseType = getTypeFromTypeNode(baseTypeNode); if (baseType !== unknownType) { if (getTargetType(baseType).flags & 1024 /* Class */) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -12923,10 +13008,10 @@ var ts; type.baseTypes = []; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 202 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 203 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; - var baseType = getTypeFromHeritageClauseElement(node); + var baseType = getTypeFromTypeNode(node); if (baseType !== unknownType) { if (getTargetType(baseType).flags & (1024 /* Class */ | 2048 /* Interface */)) { if (type !== baseType && !hasBaseType(baseType, type)) { @@ -12965,7 +13050,7 @@ var ts; var links = getSymbolLinks(symbol); if (!links.declaredType) { links.declaredType = resolvingType; - var declaration = ts.getDeclarationOfKind(symbol, 203 /* TypeAliasDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */); var type = getTypeFromTypeNode(declaration.type); if (links.declaredType === resolvingType) { links.declaredType = type; @@ -12973,7 +13058,7 @@ var ts; } else if (links.declaredType === resolvingType) { links.declaredType = unknownType; - var declaration = ts.getDeclarationOfKind(symbol, 203 /* TypeAliasDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 204 /* TypeAliasDeclaration */); error(declaration.name, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } return links.declaredType; @@ -12992,7 +13077,7 @@ var ts; if (!links.declaredType) { var type = createType(512 /* TypeParameter */); type.symbol = symbol; - if (!ts.getDeclarationOfKind(symbol, 128 /* TypeParameter */).constraint) { + if (!ts.getDeclarationOfKind(symbol, 129 /* TypeParameter */).constraint) { type.constraint = noConstraintType; } links.declaredType = type; @@ -13461,7 +13546,7 @@ var ts; function getSignatureFromDeclaration(declaration) { var links = getNodeLinks(declaration); if (!links.resolvedSignature) { - var classType = declaration.kind === 135 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; + var classType = declaration.kind === 136 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(declaration.parent.symbol) : undefined; var typeParameters = classType ? classType.typeParameters : declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) : undefined; var parameters = []; @@ -13492,8 +13577,8 @@ var ts; else { // TypeScript 1.0 spec (April 2014): // If only one accessor includes a type annotation, the other behaves as if it had the same type annotation. - if (declaration.kind === 136 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { - var setter = ts.getDeclarationOfKind(declaration.symbol, 137 /* SetAccessor */); + if (declaration.kind === 137 /* GetAccessor */ && !ts.hasDynamicName(declaration)) { + var setter = ts.getDeclarationOfKind(declaration.symbol, 138 /* SetAccessor */); returnType = getAnnotatedAccessorType(setter); } if (!returnType && ts.nodeIsMissing(declaration.body)) { @@ -13511,19 +13596,19 @@ var ts; for (var i = 0, len = symbol.declarations.length; i < len; i++) { var node = symbol.declarations[i]; switch (node.kind) { - case 142 /* FunctionType */: - case 143 /* ConstructorType */: - case 200 /* FunctionDeclaration */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 135 /* Constructor */: - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: - case 140 /* IndexSignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: + case 201 /* FunctionDeclaration */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 136 /* Constructor */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: + case 141 /* IndexSignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: // Don't include signature if node is the implementation of an overloaded function. A node is considered // an implementation node if it has a body and the previous node is of the same kind and immediately // precedes the implementation node (i.e. has the same parent and ends where the implementation starts). @@ -13600,7 +13685,7 @@ var ts; // object type literal or interface (using the new keyword). Each way of declaring a constructor // will result in a different declaration kind. if (!signature.isolatedSignatureType) { - var isConstructor = signature.declaration.kind === 135 /* Constructor */ || signature.declaration.kind === 139 /* ConstructSignature */; + var isConstructor = signature.declaration.kind === 136 /* Constructor */ || signature.declaration.kind === 140 /* ConstructSignature */; var type = createObjectType(32768 /* Anonymous */ | 65536 /* FromSignature */); type.members = emptySymbols; type.properties = emptyArray; @@ -13614,7 +13699,7 @@ var ts; return symbol.members["__index"]; } function getIndexDeclarationOfSymbol(symbol, kind) { - var syntaxKind = kind === 1 /* Number */ ? 119 /* NumberKeyword */ : 121 /* StringKeyword */; + var syntaxKind = kind === 1 /* Number */ ? 120 /* NumberKeyword */ : 122 /* StringKeyword */; var indexSymbol = getIndexSymbol(symbol); if (indexSymbol) { var len = indexSymbol.declarations.length; @@ -13644,7 +13729,7 @@ var ts; type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType; } else { - type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 128 /* TypeParameter */).constraint); + type.constraint = getTypeFromTypeNode(ts.getDeclarationOfKind(type.symbol, 129 /* TypeParameter */).constraint); } } return type.constraint === noConstraintType ? undefined : type.constraint; @@ -13700,13 +13785,13 @@ var ts; currentNode = currentNode.parent; } // if last step was made from the type parameter this means that path has started somewhere in constraint which is illegal - links.isIllegalTypeReferenceInConstraint = currentNode.kind === 128 /* TypeParameter */; + links.isIllegalTypeReferenceInConstraint = currentNode.kind === 129 /* TypeParameter */; return links.isIllegalTypeReferenceInConstraint; } function checkTypeParameterHasIllegalReferencesInConstraint(typeParameter) { var typeParameterSymbol; function check(n) { - if (n.kind === 141 /* TypeReference */ && n.typeName.kind === 65 /* Identifier */) { + if (n.kind === 142 /* TypeReference */ && n.typeName.kind === 65 /* Identifier */) { var links = getNodeLinks(n); if (links.isIllegalTypeReferenceInConstraint === undefined) { var symbol = resolveName(typeParameter, n.typeName.text, 793056 /* Type */, undefined, undefined); @@ -13732,20 +13817,14 @@ var ts; check(typeParameter.constraint); } } - function getTypeFromTypeReference(node) { - return getTypeFromTypeReferenceOrHeritageClauseElement(node); - } - function getTypeFromHeritageClauseElement(node) { - return getTypeFromTypeReferenceOrHeritageClauseElement(node); - } - function getTypeFromTypeReferenceOrHeritageClauseElement(node) { + function getTypeFromTypeReferenceOrExpressionWithTypeArguments(node) { var links = getNodeLinks(node); if (!links.resolvedType) { var type; // We don't currently support heritage clauses with complex expressions in them. // For these cases, we just set the type to be the unknownType. - if (node.kind !== 177 /* HeritageClauseElement */ || ts.isSupportedHeritageClauseElement(node)) { - var typeNameOrExpression = node.kind === 141 /* TypeReference */ + if (node.kind !== 177 /* ExpressionWithTypeArguments */ || ts.isSupportedExpressionWithTypeArguments(node)) { + var typeNameOrExpression = node.kind === 142 /* TypeReference */ ? node.typeName : node.expression; var symbol = resolveEntityName(typeNameOrExpression, 793056 /* Type */); @@ -13799,9 +13878,9 @@ var ts; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; switch (declaration.kind) { - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 204 /* EnumDeclaration */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 205 /* EnumDeclaration */: return declaration; } } @@ -13999,40 +14078,40 @@ var ts; switch (node.kind) { case 112 /* AnyKeyword */: return anyType; - case 121 /* StringKeyword */: + case 122 /* StringKeyword */: return stringType; - case 119 /* NumberKeyword */: + case 120 /* NumberKeyword */: return numberType; case 113 /* BooleanKeyword */: return booleanType; - case 122 /* SymbolKeyword */: + case 123 /* SymbolKeyword */: return esSymbolType; case 99 /* VoidKeyword */: return voidType; case 8 /* StringLiteral */: return getTypeFromStringLiteral(node); - case 141 /* TypeReference */: - return getTypeFromTypeReference(node); - case 177 /* HeritageClauseElement */: - return getTypeFromHeritageClauseElement(node); - case 144 /* TypeQuery */: + case 142 /* TypeReference */: + return getTypeFromTypeReferenceOrExpressionWithTypeArguments(node); + case 177 /* ExpressionWithTypeArguments */: + return getTypeFromTypeReferenceOrExpressionWithTypeArguments(node); + case 145 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 146 /* ArrayType */: + case 147 /* ArrayType */: return getTypeFromArrayTypeNode(node); - case 147 /* TupleType */: + case 148 /* TupleType */: return getTypeFromTupleTypeNode(node); - case 148 /* UnionType */: + case 149 /* UnionType */: return getTypeFromUnionTypeNode(node); - case 149 /* ParenthesizedType */: + case 150 /* ParenthesizedType */: return getTypeFromTypeNode(node.type); - case 142 /* FunctionType */: - case 143 /* ConstructorType */: - case 145 /* TypeLiteral */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: + case 146 /* TypeLiteral */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); // This function assumes that an identifier or qualified name is a type expression // Callers should first ensure this by calling isTypeNode case 65 /* Identifier */: - case 126 /* QualifiedName */: + case 127 /* QualifiedName */: var symbol = getSymbolInfo(node); return symbol && getDeclaredTypeOfSymbol(symbol); default: @@ -14190,27 +14269,27 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 134 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 135 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: return isContextSensitiveFunctionLikeDeclaration(node); - case 154 /* ObjectLiteralExpression */: + case 155 /* ObjectLiteralExpression */: return ts.forEach(node.properties, isContextSensitive); - case 153 /* ArrayLiteralExpression */: + case 154 /* ArrayLiteralExpression */: return ts.forEach(node.elements, isContextSensitive); - case 170 /* ConditionalExpression */: + case 171 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: return node.operatorToken.kind === 49 /* BarBarToken */ && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 224 /* PropertyAssignment */: + case 225 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: return isContextSensitiveFunctionLikeDeclaration(node); - case 161 /* ParenthesizedExpression */: + case 162 /* ParenthesizedExpression */: return isContextSensitive(node.expression); } return false; @@ -15046,22 +15125,22 @@ var ts; var typeAsString = typeToString(getWidenedType(type)); var diagnostic; switch (declaration.kind) { - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: diagnostic = ts.Diagnostics.Member_0_implicitly_has_an_1_type; break; - case 129 /* Parameter */: + case 130 /* Parameter */: diagnostic = declaration.dotDotDotToken ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type; break; - case 200 /* FunctionDeclaration */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 201 /* FunctionDeclaration */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: if (!declaration.name) { error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; @@ -15330,10 +15409,10 @@ var ts; // The expression is restricted to a single identifier or a sequence of identifiers separated by periods while (node) { switch (node.kind) { - case 144 /* TypeQuery */: + case 145 /* TypeQuery */: return true; case 65 /* Identifier */: - case 126 /* QualifiedName */: + case 127 /* QualifiedName */: node = node.parent; continue; default: @@ -15381,7 +15460,7 @@ var ts; function isAssignedInBinaryExpression(node) { if (node.operatorToken.kind >= 53 /* FirstAssignment */ && node.operatorToken.kind <= 64 /* LastAssignment */) { var n = node.left; - while (n.kind === 161 /* ParenthesizedExpression */) { + while (n.kind === 162 /* ParenthesizedExpression */) { n = n.expression; } if (n.kind === 65 /* Identifier */ && getResolvedSymbol(n) === symbol) { @@ -15398,46 +15477,46 @@ var ts; } function isAssignedIn(node) { switch (node.kind) { - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: return isAssignedInBinaryExpression(node); - case 198 /* VariableDeclaration */: - case 152 /* BindingElement */: + case 199 /* VariableDeclaration */: + case 153 /* BindingElement */: return isAssignedInVariableDeclaration(node); - case 150 /* ObjectBindingPattern */: - case 151 /* ArrayBindingPattern */: - case 153 /* ArrayLiteralExpression */: - case 154 /* ObjectLiteralExpression */: - case 155 /* PropertyAccessExpression */: - case 156 /* ElementAccessExpression */: - case 157 /* CallExpression */: - case 158 /* NewExpression */: - case 160 /* TypeAssertionExpression */: - case 161 /* ParenthesizedExpression */: - case 167 /* PrefixUnaryExpression */: - case 164 /* DeleteExpression */: - case 165 /* TypeOfExpression */: - case 166 /* VoidExpression */: - case 168 /* PostfixUnaryExpression */: - case 170 /* ConditionalExpression */: - case 173 /* SpreadElementExpression */: - case 179 /* Block */: - case 180 /* VariableStatement */: - case 182 /* ExpressionStatement */: - case 183 /* IfStatement */: - case 184 /* DoStatement */: - case 185 /* WhileStatement */: - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 191 /* ReturnStatement */: - case 192 /* WithStatement */: - case 193 /* SwitchStatement */: - case 220 /* CaseClause */: - case 221 /* DefaultClause */: - case 194 /* LabeledStatement */: - case 195 /* ThrowStatement */: - case 196 /* TryStatement */: - case 223 /* CatchClause */: + case 151 /* ObjectBindingPattern */: + case 152 /* ArrayBindingPattern */: + case 154 /* ArrayLiteralExpression */: + case 155 /* ObjectLiteralExpression */: + case 156 /* PropertyAccessExpression */: + case 157 /* ElementAccessExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: + case 161 /* TypeAssertionExpression */: + case 162 /* ParenthesizedExpression */: + case 168 /* PrefixUnaryExpression */: + case 165 /* DeleteExpression */: + case 166 /* TypeOfExpression */: + case 167 /* VoidExpression */: + case 169 /* PostfixUnaryExpression */: + case 171 /* ConditionalExpression */: + case 174 /* SpreadElementExpression */: + case 180 /* Block */: + case 181 /* VariableStatement */: + case 183 /* ExpressionStatement */: + case 184 /* IfStatement */: + case 185 /* DoStatement */: + case 186 /* WhileStatement */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 192 /* ReturnStatement */: + case 193 /* WithStatement */: + case 194 /* SwitchStatement */: + case 221 /* CaseClause */: + case 222 /* DefaultClause */: + case 195 /* LabeledStatement */: + case 196 /* ThrowStatement */: + case 197 /* TryStatement */: + case 224 /* CatchClause */: return ts.forEachChild(node, isAssignedIn); } return false; @@ -15489,19 +15568,19 @@ var ts; node = node.parent; var narrowedType = type; switch (node.kind) { - case 183 /* IfStatement */: + case 184 /* IfStatement */: // In a branch of an if statement, narrow based on controlling expression if (child !== node.expression) { narrowedType = narrowType(type, node.expression, child === node.thenStatement); } break; - case 170 /* ConditionalExpression */: + case 171 /* ConditionalExpression */: // In a branch of a conditional expression, narrow based on controlling condition if (child !== node.condition) { narrowedType = narrowType(type, node.condition, child === node.whenTrue); } break; - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: // In the right operand of an && or ||, narrow based on left operand if (child === node.right) { if (node.operatorToken.kind === 48 /* AmpersandAmpersandToken */) { @@ -15512,14 +15591,14 @@ var ts; } } break; - case 227 /* SourceFile */: - case 205 /* ModuleDeclaration */: - case 200 /* FunctionDeclaration */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 135 /* Constructor */: + case 228 /* SourceFile */: + case 206 /* ModuleDeclaration */: + case 201 /* FunctionDeclaration */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 136 /* Constructor */: // Stop at the first containing function or module declaration break loop; } @@ -15535,7 +15614,7 @@ var ts; return type; function narrowTypeByEquality(type, expr, assumeTrue) { // Check that we have 'typeof ' on the left and string literal on the right - if (expr.left.kind !== 165 /* TypeOfExpression */ || expr.right.kind !== 8 /* StringLiteral */) { + if (expr.left.kind !== 166 /* TypeOfExpression */ || expr.right.kind !== 8 /* StringLiteral */) { return type; } var left = expr.left; @@ -15628,9 +15707,9 @@ var ts; // will be a subtype or the same type as the argument. function narrowType(type, expr, assumeTrue) { switch (expr.kind) { - case 161 /* ParenthesizedExpression */: + case 162 /* ParenthesizedExpression */: return narrowType(type, expr.expression, assumeTrue); - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: var operator = expr.operatorToken.kind; if (operator === 30 /* EqualsEqualsEqualsToken */ || operator === 31 /* ExclamationEqualsEqualsToken */) { return narrowTypeByEquality(type, expr, assumeTrue); @@ -15645,7 +15724,7 @@ var ts; return narrowTypeByInstanceof(type, expr, assumeTrue); } break; - case 167 /* PrefixUnaryExpression */: + case 168 /* PrefixUnaryExpression */: if (expr.operator === 46 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -15662,7 +15741,7 @@ var ts; // will be bound to non-arrow function that contain this arrow function. This results in inconsistent behavior. // 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 && ts.getContainingFunction(node).kind === 163 /* ArrowFunction */ && languageVersion < 2 /* ES6 */) { + if (symbol === argumentsSymbol && ts.getContainingFunction(node).kind === 164 /* ArrowFunction */ && languageVersion < 2 /* ES6 */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } if (symbol.flags & 8388608 /* Alias */ && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(symbol))) { @@ -15686,7 +15765,7 @@ var ts; function checkBlockScopedBindingCapturedInLoop(node, symbol) { if (languageVersion >= 2 /* ES6 */ || (symbol.flags & 2 /* BlockScopedVariable */) === 0 || - symbol.valueDeclaration.parent.kind === 223 /* CatchClause */) { + symbol.valueDeclaration.parent.kind === 224 /* CatchClause */) { return; } // - check if binding is used in some function @@ -15695,12 +15774,12 @@ var ts; // nesting structure: // (variable declaration or binding element) -> variable declaration list -> container var container = symbol.valueDeclaration; - while (container.kind !== 199 /* VariableDeclarationList */) { + while (container.kind !== 200 /* VariableDeclarationList */) { container = container.parent; } // get the parent of variable declaration list container = container.parent; - if (container.kind === 180 /* VariableStatement */) { + if (container.kind === 181 /* VariableStatement */) { // if parent is variable statement - get its parent container = container.parent; } @@ -15719,9 +15798,9 @@ var ts; } } function captureLexicalThis(node, container) { - var classNode = container.parent && container.parent.kind === 201 /* ClassDeclaration */ ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 202 /* ClassDeclaration */ ? container.parent : undefined; getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 132 /* PropertyDeclaration */ || container.kind === 135 /* Constructor */) { + if (container.kind === 133 /* PropertyDeclaration */ || container.kind === 136 /* Constructor */) { getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } else { @@ -15734,39 +15813,39 @@ var ts; var container = ts.getThisContainer(node, true); var needToCaptureLexicalThis = false; // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 163 /* ArrowFunction */) { + if (container.kind === 164 /* ArrowFunction */) { container = ts.getThisContainer(container, false); // When targeting es6, arrow function lexically bind "this" so we do not need to do the work of binding "this" in emitted code needToCaptureLexicalThis = (languageVersion < 2 /* ES6 */); } switch (container.kind) { - case 205 /* ModuleDeclaration */: - error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_body); + case 206 /* ModuleDeclaration */: + error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 135 /* Constructor */: + case 136 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: if (container.flags & 128 /* Static */) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; - case 127 /* ComputedPropertyName */: + case 128 /* ComputedPropertyName */: 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 === 201 /* ClassDeclaration */ ? container.parent : undefined; + var classNode = container.parent && container.parent.kind === 202 /* ClassDeclaration */ ? container.parent : undefined; if (classNode) { var symbol = getSymbolOfNode(classNode); return container.flags & 128 /* Static */ ? getTypeOfSymbol(symbol) : getDeclaredTypeOfSymbol(symbol); @@ -15775,15 +15854,15 @@ var ts; } function isInConstructorArgumentInitializer(node, constructorDecl) { for (var n = node; n && n !== constructorDecl; n = n.parent) { - if (n.kind === 129 /* Parameter */) { + if (n.kind === 130 /* Parameter */) { return true; } } return false; } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 157 /* CallExpression */ && node.parent.expression === node; - var enclosingClass = ts.getAncestor(node, 201 /* ClassDeclaration */); + var isCallExpression = node.parent.kind === 158 /* CallExpression */ && node.parent.expression === node; + var enclosingClass = ts.getAncestor(node, 202 /* ClassDeclaration */); var baseClass; if (enclosingClass && ts.getClassExtendsHeritageClauseElement(enclosingClass)) { var classType = getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass)); @@ -15801,7 +15880,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - canUseSuperExpression = container.kind === 135 /* Constructor */; + canUseSuperExpression = container.kind === 136 /* Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -15810,28 +15889,28 @@ var ts; // - In a static member function or static member accessor // super property access might appear in arrow functions with arbitrary deep nesting needToCaptureLexicalThis = false; - while (container && container.kind === 163 /* ArrowFunction */) { + while (container && container.kind === 164 /* ArrowFunction */) { container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2 /* ES6 */; } // topmost container must be something that is directly nested in the class declaration - if (container && container.parent && container.parent.kind === 201 /* ClassDeclaration */) { + if (container && container.parent && container.parent.kind === 202 /* ClassDeclaration */) { if (container.flags & 128 /* Static */) { canUseSuperExpression = - container.kind === 134 /* MethodDeclaration */ || - container.kind === 133 /* MethodSignature */ || - container.kind === 136 /* GetAccessor */ || - container.kind === 137 /* SetAccessor */; + container.kind === 135 /* MethodDeclaration */ || + container.kind === 134 /* MethodSignature */ || + container.kind === 137 /* GetAccessor */ || + container.kind === 138 /* SetAccessor */; } else { canUseSuperExpression = - container.kind === 134 /* MethodDeclaration */ || - container.kind === 133 /* MethodSignature */ || - container.kind === 136 /* GetAccessor */ || - container.kind === 137 /* SetAccessor */ || - container.kind === 132 /* PropertyDeclaration */ || - container.kind === 131 /* PropertySignature */ || - container.kind === 135 /* Constructor */; + container.kind === 135 /* MethodDeclaration */ || + container.kind === 134 /* MethodSignature */ || + container.kind === 137 /* GetAccessor */ || + container.kind === 138 /* SetAccessor */ || + container.kind === 133 /* PropertyDeclaration */ || + container.kind === 132 /* PropertySignature */ || + container.kind === 136 /* Constructor */; } } } @@ -15845,7 +15924,7 @@ var ts; getNodeLinks(node).flags |= 16 /* SuperInstance */; returnType = baseClass; } - if (container.kind === 135 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 136 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); returnType = unknownType; @@ -15859,7 +15938,7 @@ var ts; return returnType; } } - if (container && container.kind === 127 /* ComputedPropertyName */) { + if (container && container.kind === 128 /* ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { @@ -15904,7 +15983,7 @@ var ts; if (declaration.type) { return getTypeFromTypeNode(declaration.type); } - if (declaration.kind === 129 /* Parameter */) { + if (declaration.kind === 130 /* Parameter */) { var type = getContextuallyTypedParameterType(declaration); if (type) { return type; @@ -15921,7 +16000,7 @@ var ts; if (func) { // If the containing function has a return type annotation, is a constructor, or is a get accessor whose // corresponding set accessor has a type annotation, return statements in the function are contextually typed - if (func.type || func.kind === 135 /* Constructor */ || func.kind === 136 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 137 /* SetAccessor */))) { + if (func.type || func.kind === 136 /* Constructor */ || func.kind === 137 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(func.symbol, 138 /* SetAccessor */))) { return getReturnTypeOfSignature(getSignatureFromDeclaration(func)); } // Otherwise, if the containing function is contextually typed by a function type with exactly one call signature @@ -15944,7 +16023,7 @@ var ts; return undefined; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 159 /* TaggedTemplateExpression */) { + if (template.parent.kind === 160 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -16075,32 +16154,32 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 198 /* VariableDeclaration */: - case 129 /* Parameter */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 152 /* BindingElement */: + case 199 /* VariableDeclaration */: + case 130 /* Parameter */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 153 /* BindingElement */: return getContextualTypeForInitializerExpression(node); - case 163 /* ArrowFunction */: - case 191 /* ReturnStatement */: + case 164 /* ArrowFunction */: + case 192 /* ReturnStatement */: return getContextualTypeForReturnExpression(node); - case 157 /* CallExpression */: - case 158 /* NewExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: return getContextualTypeForArgument(parent, node); - case 160 /* TypeAssertionExpression */: + case 161 /* TypeAssertionExpression */: return getTypeFromTypeNode(parent.type); - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node); - case 224 /* PropertyAssignment */: + case 225 /* PropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent); - case 153 /* ArrayLiteralExpression */: + case 154 /* ArrayLiteralExpression */: return getContextualTypeForElementExpression(node); - case 170 /* ConditionalExpression */: + case 171 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node); - case 176 /* TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 171 /* TemplateExpression */); + case 178 /* TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 172 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 161 /* ParenthesizedExpression */: + case 162 /* ParenthesizedExpression */: return getContextualType(parent); } return undefined; @@ -16117,7 +16196,7 @@ var ts; } } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 162 /* FunctionExpression */ || node.kind === 163 /* ArrowFunction */; + return node.kind === 163 /* FunctionExpression */ || node.kind === 164 /* ArrowFunction */; } function getContextualSignatureForFunctionLikeDeclaration(node) { // Only function expressions and arrow functions are contextually typed. @@ -16129,7 +16208,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 134 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 135 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var type = ts.isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node) : getContextualType(node); @@ -16185,13 +16264,13 @@ var ts; // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ p: a}] = xxx'. function isAssignmentTarget(node) { var parent = node.parent; - if (parent.kind === 169 /* BinaryExpression */ && parent.operatorToken.kind === 53 /* EqualsToken */ && parent.left === node) { + if (parent.kind === 170 /* BinaryExpression */ && parent.operatorToken.kind === 53 /* EqualsToken */ && parent.left === node) { return true; } - if (parent.kind === 224 /* PropertyAssignment */) { + if (parent.kind === 225 /* PropertyAssignment */) { return isAssignmentTarget(parent.parent); } - if (parent.kind === 153 /* ArrayLiteralExpression */) { + if (parent.kind === 154 /* ArrayLiteralExpression */) { return isAssignmentTarget(parent); } return false; @@ -16216,7 +16295,7 @@ var ts; var inDestructuringPattern = isAssignmentTarget(node); for (var _i = 0; _i < elements.length; _i++) { var e = elements[_i]; - if (inDestructuringPattern && e.kind === 173 /* SpreadElementExpression */) { + if (inDestructuringPattern && e.kind === 174 /* SpreadElementExpression */) { // Given the following situation: // var c: {}; // [...c] = ["", 0]; @@ -16240,7 +16319,7 @@ var ts; var type = checkExpression(e, contextualMapper); elementTypes.push(type); } - hasSpreadElement = hasSpreadElement || e.kind === 173 /* SpreadElementExpression */; + hasSpreadElement = hasSpreadElement || e.kind === 174 /* SpreadElementExpression */; } if (!hasSpreadElement) { var contextualType = getContextualType(node); @@ -16251,7 +16330,7 @@ var ts; return createArrayType(getUnionType(elementTypes)); } function isNumericName(name) { - return name.kind === 127 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); + return name.kind === 128 /* ComputedPropertyName */ ? isNumericComputedName(name) : isNumericLiteralName(name.text); } function isNumericComputedName(name) { // It seems odd to consider an expression of type Any to result in a numeric name, @@ -16307,18 +16386,18 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var memberDecl = _a[_i]; var member = memberDecl.symbol; - if (memberDecl.kind === 224 /* PropertyAssignment */ || - memberDecl.kind === 225 /* ShorthandPropertyAssignment */ || + if (memberDecl.kind === 225 /* PropertyAssignment */ || + memberDecl.kind === 226 /* ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { var type = void 0; - if (memberDecl.kind === 224 /* PropertyAssignment */) { + if (memberDecl.kind === 225 /* PropertyAssignment */) { type = checkPropertyAssignment(memberDecl, contextualMapper); } - else if (memberDecl.kind === 134 /* MethodDeclaration */) { + else if (memberDecl.kind === 135 /* MethodDeclaration */) { type = checkObjectLiteralMethod(memberDecl, contextualMapper); } else { - ts.Debug.assert(memberDecl.kind === 225 /* ShorthandPropertyAssignment */); + ts.Debug.assert(memberDecl.kind === 226 /* ShorthandPropertyAssignment */); type = checkExpression(memberDecl.name, contextualMapper); } typeFlags |= type.flags; @@ -16338,7 +16417,7 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 136 /* GetAccessor */ || memberDecl.kind === 137 /* SetAccessor */); + ts.Debug.assert(memberDecl.kind === 137 /* GetAccessor */ || memberDecl.kind === 138 /* SetAccessor */); checkAccessorDeclaration(memberDecl); } if (!ts.hasDynamicName(memberDecl)) { @@ -16377,7 +16456,7 @@ var ts; // If a symbol is a synthesized symbol with no value declaration, we assume it is a property. Example of this are the synthesized // '.prototype' property as well as synthesized tuple index properties. function getDeclarationKindFromSymbol(s) { - return s.valueDeclaration ? s.valueDeclaration.kind : 132 /* PropertyDeclaration */; + return s.valueDeclaration ? s.valueDeclaration.kind : 133 /* PropertyDeclaration */; } function getDeclarationFlagsFromSymbol(s) { return s.valueDeclaration ? ts.getCombinedNodeFlags(s.valueDeclaration) : s.flags & 134217728 /* Prototype */ ? 16 /* Public */ | 128 /* Static */ : 0; @@ -16390,7 +16469,7 @@ var ts; } // Property is known to be private or protected at this point // Get the declaring and enclosing class instance types - var enclosingClassDeclaration = ts.getAncestor(node, 201 /* ClassDeclaration */); + var enclosingClassDeclaration = ts.getAncestor(node, 202 /* ClassDeclaration */); var enclosingClass = enclosingClassDeclaration ? getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClassDeclaration)) : undefined; var declaringClass = getDeclaredTypeOfSymbol(prop.parent); // Private property is accessible if declaring and enclosing class are the same @@ -16451,7 +16530,7 @@ var ts; // - In a static member function or static member accessor // where this references the constructor function object of a derived class, // a super property access is permitted and must specify a public static member function of the base class. - if (left.kind === 91 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 134 /* MethodDeclaration */) { + if (left.kind === 91 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 135 /* MethodDeclaration */) { error(right, ts.Diagnostics.Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword); } else { @@ -16463,14 +16542,14 @@ var ts; return anyType; } function isValidPropertyAccess(node, propertyName) { - var left = node.kind === 155 /* PropertyAccessExpression */ + var left = node.kind === 156 /* PropertyAccessExpression */ ? 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 /* Class */) { - if (left.kind === 91 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 134 /* MethodDeclaration */) { + if (left.kind === 91 /* SuperKeyword */ && getDeclarationKindFromSymbol(prop) !== 135 /* MethodDeclaration */) { return false; } else { @@ -16486,7 +16565,7 @@ var ts; // Grammar checking if (!node.argumentExpression) { var sourceFile = getSourceFile(node); - if (node.parent.kind === 158 /* NewExpression */ && node.parent.expression === node) { + if (node.parent.kind === 159 /* NewExpression */ && 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); @@ -16615,7 +16694,7 @@ var ts; return true; } function resolveUntypedCall(node) { - if (node.kind === 159 /* TaggedTemplateExpression */) { + if (node.kind === 160 /* TaggedTemplateExpression */) { checkExpression(node.template); } else { @@ -16683,7 +16762,7 @@ var ts; } function getSpreadArgumentIndex(args) { for (var i = 0; i < args.length; i++) { - if (args[i].kind === 173 /* SpreadElementExpression */) { + if (args[i].kind === 174 /* SpreadElementExpression */) { return i; } } @@ -16693,13 +16772,13 @@ var ts; var adjustedArgCount; // Apparent number of arguments we will have in this call var typeArguments; // Type arguments (undefined if none) var callIsIncomplete; // In incomplete call we want to be lenient when we have too few arguments - if (node.kind === 159 /* TaggedTemplateExpression */) { + if (node.kind === 160 /* TaggedTemplateExpression */) { var tagExpression = node; // Even if the call is incomplete, we'll have a missing expression as our last argument, // so we can say the count is just the arg list length adjustedArgCount = args.length; typeArguments = undefined; - if (tagExpression.template.kind === 171 /* TemplateExpression */) { + if (tagExpression.template.kind === 172 /* TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var templateExpression = tagExpression.template; @@ -16720,7 +16799,7 @@ var ts; var callExpression = node; if (!callExpression.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(callExpression.kind === 158 /* NewExpression */); + ts.Debug.assert(callExpression.kind === 159 /* NewExpression */); return signature.minArgumentCount === 0; } // For IDE scenarios we may have an incomplete call, so a trailing comma is tantamount to adding another argument. @@ -16797,10 +16876,10 @@ var ts; // wildcards for all context sensitive function expressions. for (var i = 0; i < args.length; i++) { var arg = args[i]; - if (arg.kind !== 175 /* OmittedExpression */) { + if (arg.kind !== 176 /* OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = void 0; - if (i === 0 && args[i].parent.kind === 159 /* TaggedTemplateExpression */) { + if (i === 0 && args[i].parent.kind === 160 /* TaggedTemplateExpression */) { argType = globalTemplateStringsArrayType; } else { @@ -16847,12 +16926,12 @@ 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 !== 175 /* OmittedExpression */) { + if (arg.kind !== 176 /* OmittedExpression */) { // Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter) var paramType = getTypeAtPosition(signature, i); // A tagged template expression provides a special first argument, and string literals get string literal types // unless we're reporting errors - var argType = i === 0 && node.kind === 159 /* TaggedTemplateExpression */ + var argType = i === 0 && node.kind === 160 /* TaggedTemplateExpression */ ? globalTemplateStringsArrayType : arg.kind === 8 /* StringLiteral */ && !reportErrors ? getStringLiteralType(arg) @@ -16874,10 +16953,10 @@ var ts; */ function getEffectiveCallArguments(node) { var args; - if (node.kind === 159 /* TaggedTemplateExpression */) { + if (node.kind === 160 /* TaggedTemplateExpression */) { var template = node.template; args = [template]; - if (template.kind === 171 /* TemplateExpression */) { + if (template.kind === 172 /* TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args.push(span.expression); }); @@ -16900,7 +16979,7 @@ var ts; */ function getEffectiveTypeArguments(callExpression) { if (callExpression.expression.kind === 91 /* SuperKeyword */) { - var containingClass = ts.getAncestor(callExpression, 201 /* ClassDeclaration */); + var containingClass = ts.getAncestor(callExpression, 202 /* ClassDeclaration */); var baseClassTypeNode = containingClass && ts.getClassExtendsHeritageClauseElement(containingClass); return baseClassTypeNode && baseClassTypeNode.typeArguments; } @@ -16910,7 +16989,7 @@ var ts; } } function resolveCall(node, signatures, candidatesOutArray) { - var isTaggedTemplate = node.kind === 159 /* TaggedTemplateExpression */; + var isTaggedTemplate = node.kind === 160 /* TaggedTemplateExpression */; var typeArguments; if (!isTaggedTemplate) { typeArguments = getEffectiveTypeArguments(node); @@ -17223,13 +17302,13 @@ var ts; // to correctly fill the candidatesOutArray. if (!links.resolvedSignature || candidatesOutArray) { links.resolvedSignature = anySignature; - if (node.kind === 157 /* CallExpression */) { + if (node.kind === 158 /* CallExpression */) { links.resolvedSignature = resolveCallExpression(node, candidatesOutArray); } - else if (node.kind === 158 /* NewExpression */) { + else if (node.kind === 159 /* NewExpression */) { links.resolvedSignature = resolveNewExpression(node, candidatesOutArray); } - else if (node.kind === 159 /* TaggedTemplateExpression */) { + else if (node.kind === 160 /* TaggedTemplateExpression */) { links.resolvedSignature = resolveTaggedTemplateExpression(node, candidatesOutArray); } else { @@ -17245,12 +17324,12 @@ var ts; if (node.expression.kind === 91 /* SuperKeyword */) { return voidType; } - if (node.kind === 158 /* NewExpression */) { + if (node.kind === 159 /* NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 135 /* Constructor */ && - declaration.kind !== 139 /* ConstructSignature */ && - declaration.kind !== 143 /* ConstructorType */) { + declaration.kind !== 136 /* Constructor */ && + declaration.kind !== 140 /* ConstructSignature */ && + declaration.kind !== 144 /* ConstructorType */) { // When resolved signature is a call signature (and not a construct signature) the result type is any if (compilerOptions.noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); @@ -17298,7 +17377,7 @@ var ts; return unknownType; } var type; - if (func.body.kind !== 179 /* Block */) { + if (func.body.kind !== 180 /* Block */) { type = checkExpressionCached(func.body, contextualMapper); } else { @@ -17340,7 +17419,7 @@ var ts; }); } function bodyContainsSingleThrowStatement(body) { - return (body.statements.length === 1) && (body.statements[0].kind === 195 /* ThrowStatement */); + return (body.statements.length === 1) && (body.statements[0].kind === 196 /* ThrowStatement */); } // TypeScript Specification 1.0 (6.3) - July 2014 // An explicitly typed function whose return type isn't the Void or the Any type @@ -17355,7 +17434,7 @@ var ts; return; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. - if (ts.nodeIsMissing(func.body) || func.body.kind !== 179 /* Block */) { + if (ts.nodeIsMissing(func.body) || func.body.kind !== 180 /* Block */) { return; } var bodyBlock = func.body; @@ -17373,10 +17452,10 @@ 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 !== 134 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 135 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); // Grammar checking var hasGrammarError = checkGrammarDeclarationNameInStrictMode(node) || checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 162 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 163 /* FunctionExpression */) { checkGrammarFunctionName(node.name) || checkGrammarForGenerator(node); } // The identityMapper object is used to indicate that function expressions are wildcards @@ -17409,19 +17488,19 @@ var ts; checkSignatureDeclaration(node); } } - if (produceDiagnostics && node.kind !== 134 /* MethodDeclaration */ && node.kind !== 133 /* MethodSignature */) { + if (produceDiagnostics && node.kind !== 135 /* MethodDeclaration */ && node.kind !== 134 /* MethodSignature */) { checkCollisionWithCapturedSuperVariable(node, node.name); checkCollisionWithCapturedThisVariable(node, node.name); } return type; } function checkFunctionExpressionOrObjectLiteralMethodBody(node) { - ts.Debug.assert(node.kind !== 134 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 135 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node)); if (node.type && !node.asteriskToken) { checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type)); } if (node.body) { - if (node.body.kind === 179 /* Block */) { + if (node.body.kind === 180 /* Block */) { checkSourceElement(node.body); } else { @@ -17463,17 +17542,17 @@ var ts; // An identifier expression that references any other kind of entity is classified as a value(and therefore cannot be the target of an assignment). return !symbol || symbol === unknownSymbol || symbol === argumentsSymbol || (symbol.flags & 3 /* Variable */) !== 0; } - case 155 /* PropertyAccessExpression */: { + case 156 /* PropertyAccessExpression */: { var symbol = findSymbol(n); // TypeScript 1.0 spec (April 2014): 4.10 // A property access expression is always classified as a reference. // NOTE (not in spec): assignment to enum members should not be allowed return !symbol || symbol === unknownSymbol || (symbol.flags & ~8 /* EnumMember */) !== 0; } - case 156 /* ElementAccessExpression */: + case 157 /* ElementAccessExpression */: // old compiler doesn't check indexed assess return true; - case 161 /* ParenthesizedExpression */: + case 162 /* ParenthesizedExpression */: return isReferenceOrErrorExpression(n.expression); default: return false; @@ -17482,11 +17561,11 @@ var ts; function isConstVariableReference(n) { switch (n.kind) { case 65 /* Identifier */: - case 155 /* PropertyAccessExpression */: { + case 156 /* PropertyAccessExpression */: { var symbol = findSymbol(n); return symbol && (symbol.flags & 3 /* Variable */) !== 0 && (getDeclarationFlagsFromSymbol(symbol) & 8192 /* Const */) !== 0; } - case 156 /* ElementAccessExpression */: { + case 157 /* ElementAccessExpression */: { var index = n.argumentExpression; var symbol = findSymbol(n.expression); if (symbol && index && index.kind === 8 /* StringLiteral */) { @@ -17496,7 +17575,7 @@ var ts; } return false; } - case 161 /* ParenthesizedExpression */: + case 162 /* ParenthesizedExpression */: return isConstVariableReference(n.expression); default: return false; @@ -17647,7 +17726,7 @@ var ts; var properties = node.properties; for (var _i = 0; _i < properties.length; _i++) { var p = properties[_i]; - if (p.kind === 224 /* PropertyAssignment */ || p.kind === 225 /* ShorthandPropertyAssignment */) { + if (p.kind === 225 /* PropertyAssignment */ || p.kind === 226 /* ShorthandPropertyAssignment */) { // TODO(andersh): Computed property support var name_8 = p.name; var type = sourceType.flags & 1 /* Any */ ? sourceType : @@ -17675,8 +17754,8 @@ var ts; var elements = node.elements; for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 175 /* OmittedExpression */) { - if (e.kind !== 173 /* SpreadElementExpression */) { + if (e.kind !== 176 /* OmittedExpression */) { + if (e.kind !== 174 /* SpreadElementExpression */) { var propName = "" + i; var type = sourceType.flags & 1 /* Any */ ? sourceType : isTupleLikeType(sourceType) @@ -17700,7 +17779,7 @@ var ts; } else { var restExpression = e.expression; - if (restExpression.kind === 169 /* BinaryExpression */ && restExpression.operatorToken.kind === 53 /* EqualsToken */) { + if (restExpression.kind === 170 /* BinaryExpression */ && restExpression.operatorToken.kind === 53 /* EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -17713,14 +17792,14 @@ var ts; return sourceType; } function checkDestructuringAssignment(target, sourceType, contextualMapper) { - if (target.kind === 169 /* BinaryExpression */ && target.operatorToken.kind === 53 /* EqualsToken */) { + if (target.kind === 170 /* BinaryExpression */ && target.operatorToken.kind === 53 /* EqualsToken */) { checkBinaryExpression(target, contextualMapper); target = target.left; } - if (target.kind === 154 /* ObjectLiteralExpression */) { + if (target.kind === 155 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, contextualMapper); } - if (target.kind === 153 /* ArrayLiteralExpression */) { + if (target.kind === 154 /* ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, contextualMapper); } return checkReferenceAssignment(target, sourceType, contextualMapper); @@ -17740,7 +17819,7 @@ var ts; checkGrammarEvalOrArgumentsInStrictMode(node, node.left); } var operator = node.operatorToken.kind; - if (operator === 53 /* EqualsToken */ && (node.left.kind === 154 /* ObjectLiteralExpression */ || node.left.kind === 153 /* ArrayLiteralExpression */)) { + if (operator === 53 /* EqualsToken */ && (node.left.kind === 155 /* ObjectLiteralExpression */ || node.left.kind === 154 /* ArrayLiteralExpression */)) { return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); } var leftType = checkExpression(node.left, contextualMapper); @@ -17952,7 +18031,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 127 /* ComputedPropertyName */) { + if (node.name.kind === 128 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpression(node.initializer, contextualMapper); @@ -17963,7 +18042,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 127 /* ComputedPropertyName */) { + if (node.name.kind === 128 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); @@ -17997,7 +18076,7 @@ var ts; // contextually typed function and arrow expressions in the initial phase. function checkExpressionOrQualifiedName(node, contextualMapper) { var type; - if (node.kind == 126 /* QualifiedName */) { + if (node.kind == 127 /* QualifiedName */) { type = checkQualifiedName(node); } else { @@ -18009,9 +18088,9 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 155 /* PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 156 /* ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 65 /* Identifier */ || node.kind === 126 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node)); + var ok = (node.parent.kind === 156 /* PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 157 /* ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 65 /* Identifier */ || node.kind === 127 /* QualifiedName */) && 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); } @@ -18038,54 +18117,54 @@ var ts; return booleanType; case 7 /* NumericLiteral */: return checkNumericLiteral(node); - case 171 /* TemplateExpression */: + case 172 /* TemplateExpression */: return checkTemplateExpression(node); case 8 /* StringLiteral */: case 10 /* NoSubstitutionTemplateLiteral */: return stringType; case 9 /* RegularExpressionLiteral */: return globalRegExpType; - case 153 /* ArrayLiteralExpression */: + case 154 /* ArrayLiteralExpression */: return checkArrayLiteral(node, contextualMapper); - case 154 /* ObjectLiteralExpression */: + case 155 /* ObjectLiteralExpression */: return checkObjectLiteral(node, contextualMapper); - case 155 /* PropertyAccessExpression */: + case 156 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node); - case 156 /* ElementAccessExpression */: + case 157 /* ElementAccessExpression */: return checkIndexedAccess(node); - case 157 /* CallExpression */: - case 158 /* NewExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: return checkCallExpression(node); - case 159 /* TaggedTemplateExpression */: + case 160 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 160 /* TypeAssertionExpression */: + case 161 /* TypeAssertionExpression */: return checkTypeAssertion(node); - case 161 /* ParenthesizedExpression */: + case 162 /* ParenthesizedExpression */: return checkExpression(node.expression, contextualMapper); - case 174 /* ClassExpression */: + case 175 /* ClassExpression */: return checkClassExpression(node); - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, contextualMapper); - case 165 /* TypeOfExpression */: + case 166 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 164 /* DeleteExpression */: + case 165 /* DeleteExpression */: return checkDeleteExpression(node); - case 166 /* VoidExpression */: + case 167 /* VoidExpression */: return checkVoidExpression(node); - case 167 /* PrefixUnaryExpression */: + case 168 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 168 /* PostfixUnaryExpression */: + case 169 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: return checkBinaryExpression(node, contextualMapper); - case 170 /* ConditionalExpression */: + case 171 /* ConditionalExpression */: return checkConditionalExpression(node, contextualMapper); - case 173 /* SpreadElementExpression */: + case 174 /* SpreadElementExpression */: return checkSpreadElementExpression(node, contextualMapper); - case 175 /* OmittedExpression */: + case 176 /* OmittedExpression */: return undefinedType; - case 172 /* YieldExpression */: + case 173 /* YieldExpression */: checkYieldExpression(node); return unknownType; } @@ -18118,7 +18197,7 @@ var ts; var func = ts.getContainingFunction(node); if (node.flags & 112 /* AccessibilityModifier */) { func = ts.getContainingFunction(node); - if (!(func.kind === 135 /* Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 136 /* Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } } @@ -18133,12 +18212,12 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 140 /* IndexSignature */) { + if (node.kind === 141 /* IndexSignature */) { checkGrammarIndexSignature(node); } - else if (node.kind === 142 /* FunctionType */ || node.kind === 200 /* FunctionDeclaration */ || node.kind === 143 /* ConstructorType */ || - node.kind === 138 /* CallSignature */ || node.kind === 135 /* Constructor */ || - node.kind === 139 /* ConstructSignature */) { + else if (node.kind === 143 /* FunctionType */ || node.kind === 201 /* FunctionDeclaration */ || node.kind === 144 /* ConstructorType */ || + node.kind === 139 /* CallSignature */ || node.kind === 136 /* Constructor */ || + node.kind === 140 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } checkTypeParameters(node.typeParameters); @@ -18150,10 +18229,10 @@ var ts; checkCollisionWithArgumentsInGeneratedCode(node); if (compilerOptions.noImplicitAny && !node.type) { switch (node.kind) { - case 139 /* ConstructSignature */: + case 140 /* ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 138 /* CallSignature */: + case 139 /* CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -18162,7 +18241,7 @@ var ts; checkSpecializedSignatureDeclaration(node); } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 202 /* InterfaceDeclaration */) { + if (node.kind === 203 /* InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -18182,7 +18261,7 @@ var ts; var declaration = decl; if (declaration.parameters.length === 1 && declaration.parameters[0].type) { switch (declaration.parameters[0].type.kind) { - case 121 /* StringKeyword */: + case 122 /* StringKeyword */: if (!seenStringIndexer) { seenStringIndexer = true; } @@ -18190,7 +18269,7 @@ var ts; error(declaration, ts.Diagnostics.Duplicate_string_index_signature); } break; - case 119 /* NumberKeyword */: + case 120 /* NumberKeyword */: if (!seenNumericIndexer) { seenNumericIndexer = true; } @@ -18234,17 +18313,17 @@ var ts; return; } function isSuperCallExpression(n) { - return n.kind === 157 /* CallExpression */ && n.expression.kind === 91 /* SuperKeyword */; + return n.kind === 158 /* CallExpression */ && n.expression.kind === 91 /* SuperKeyword */; } function containsSuperCall(n) { if (isSuperCallExpression(n)) { return true; } switch (n.kind) { - case 162 /* FunctionExpression */: - case 200 /* FunctionDeclaration */: - case 163 /* ArrowFunction */: - case 154 /* ObjectLiteralExpression */: return false; + case 163 /* FunctionExpression */: + case 201 /* FunctionDeclaration */: + case 164 /* ArrowFunction */: + case 155 /* ObjectLiteralExpression */: return false; default: return ts.forEachChild(n, containsSuperCall); } } @@ -18252,12 +18331,12 @@ var ts; if (n.kind === 93 /* ThisKeyword */) { error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); } - else if (n.kind !== 162 /* FunctionExpression */ && n.kind !== 200 /* FunctionDeclaration */) { + else if (n.kind !== 163 /* FunctionExpression */ && n.kind !== 201 /* FunctionDeclaration */) { ts.forEachChild(n, markThisReferencesAsErrors); } } function isInstancePropertyWithInitializer(n) { - return n.kind === 132 /* PropertyDeclaration */ && + return n.kind === 133 /* PropertyDeclaration */ && !(n.flags & 128 /* Static */) && !!n.initializer; } @@ -18274,7 +18353,7 @@ var ts; ts.forEach(node.parameters, function (p) { return p.flags & (16 /* Public */ | 32 /* Private */ | 64 /* Protected */); }); if (superCallShouldBeFirst) { var statements = node.body.statements; - if (!statements.length || statements[0].kind !== 182 /* ExpressionStatement */ || !isSuperCallExpression(statements[0].expression)) { + if (!statements.length || statements[0].kind !== 183 /* ExpressionStatement */ || !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 { @@ -18292,7 +18371,7 @@ var ts; if (produceDiagnostics) { // Grammar checking accessors checkGrammarFunctionLikeDeclaration(node) || checkGrammarAccessor(node) || checkGrammarComputedPropertyName(node.name); - if (node.kind === 136 /* GetAccessor */) { + if (node.kind === 137 /* GetAccessor */) { 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); } @@ -18300,7 +18379,7 @@ var ts; if (!ts.hasDynamicName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. - var otherKind = node.kind === 136 /* GetAccessor */ ? 137 /* SetAccessor */ : 136 /* GetAccessor */; + var otherKind = node.kind === 137 /* GetAccessor */ ? 138 /* SetAccessor */ : 137 /* GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { if (((node.flags & 112 /* AccessibilityModifier */) !== (otherAccessor.flags & 112 /* AccessibilityModifier */))) { @@ -18326,16 +18405,16 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeReferenceInStrictMode(node.typeName); - return checkTypeReferenceOrHeritageClauseElement(node); + return checkTypeReferenceOrExpressionWithTypeArguments(node); } - function checkHeritageClauseElement(node) { - checkGrammarHeritageClauseElementInStrictMode(node.expression); - return checkTypeReferenceOrHeritageClauseElement(node); + function checkExpressionWithTypeArguments(node) { + checkGrammarExpressionWithTypeArgumentsInStrictMode(node.expression); + return checkTypeReferenceOrExpressionWithTypeArguments(node); } - function checkTypeReferenceOrHeritageClauseElement(node) { + function checkTypeReferenceOrExpressionWithTypeArguments(node) { // Grammar checking checkGrammarTypeArguments(node, node.typeArguments); - var type = getTypeFromTypeReferenceOrHeritageClauseElement(node); + var type = getTypeFromTypeReferenceOrExpressionWithTypeArguments(node); if (type !== unknownType && node.typeArguments) { // Do type argument local checks only if referenced type is successfully resolved var len = node.typeArguments.length; @@ -18397,9 +18476,9 @@ var ts; var signaturesToCheck; // Unnamed (call\construct) signatures in interfaces are inherited and not shadowed so examining just node symbol won't give complete answer. // Use declaring type to obtain full list of signatures. - if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 202 /* InterfaceDeclaration */) { - ts.Debug.assert(signatureDeclarationNode.kind === 138 /* CallSignature */ || signatureDeclarationNode.kind === 139 /* ConstructSignature */); - var signatureKind = signatureDeclarationNode.kind === 138 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; + if (!signatureDeclarationNode.name && signatureDeclarationNode.parent && signatureDeclarationNode.parent.kind === 203 /* InterfaceDeclaration */) { + ts.Debug.assert(signatureDeclarationNode.kind === 139 /* CallSignature */ || signatureDeclarationNode.kind === 140 /* ConstructSignature */); + var signatureKind = signatureDeclarationNode.kind === 139 /* CallSignature */ ? 0 /* Call */ : 1 /* Construct */; var containingSymbol = getSymbolOfNode(signatureDeclarationNode.parent); var containingType = getDeclaredTypeOfSymbol(containingSymbol); signaturesToCheck = getSignaturesOfType(containingType, signatureKind); @@ -18417,7 +18496,7 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedNodeFlags(n); - if (n.parent.kind !== 202 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { + if (n.parent.kind !== 203 /* InterfaceDeclaration */ && ts.isInAmbientContext(n)) { if (!(flags & 2 /* Ambient */)) { // It is nested in an ambient context, which means it is automatically exported flags |= 1 /* Export */; @@ -18500,7 +18579,7 @@ var ts; // TODO(jfreeman): These are methods, so handle computed name case if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { // the only situation when this is possible (same kind\same name but different symbol) - mixed static and instance class members - ts.Debug.assert(node.kind === 134 /* MethodDeclaration */ || node.kind === 133 /* MethodSignature */); + ts.Debug.assert(node.kind === 135 /* MethodDeclaration */ || node.kind === 134 /* MethodSignature */); ts.Debug.assert((node.flags & 128 /* Static */) !== (subsequentNode.flags & 128 /* Static */)); var diagnostic = node.flags & 128 /* Static */ ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode_1, diagnostic); @@ -18529,7 +18608,7 @@ var ts; var current = declarations[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); - var inAmbientContextOrInterface = node.parent.kind === 202 /* InterfaceDeclaration */ || node.parent.kind === 145 /* TypeLiteral */ || inAmbientContext; + var inAmbientContextOrInterface = node.parent.kind === 203 /* InterfaceDeclaration */ || node.parent.kind === 146 /* TypeLiteral */ || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -18540,7 +18619,7 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if (node.kind === 200 /* FunctionDeclaration */ || node.kind === 134 /* MethodDeclaration */ || node.kind === 133 /* MethodSignature */ || node.kind === 135 /* Constructor */) { + if (node.kind === 201 /* FunctionDeclaration */ || node.kind === 135 /* MethodDeclaration */ || node.kind === 134 /* MethodSignature */ || node.kind === 136 /* Constructor */) { var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; allNodeFlags &= currentNodeFlags; @@ -18663,16 +18742,16 @@ var ts; } function getDeclarationSpaces(d) { switch (d.kind) { - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: return 2097152 /* ExportType */; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: return d.name.kind === 8 /* StringLiteral */ || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4194304 /* ExportNamespace */ | 1048576 /* ExportValue */ : 4194304 /* ExportNamespace */; - case 201 /* ClassDeclaration */: - case 204 /* EnumDeclaration */: + case 202 /* ClassDeclaration */: + case 205 /* EnumDeclaration */: return 2097152 /* ExportType */ | 1048576 /* ExportValue */; - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: var result = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result |= getDeclarationSpaces(d); }); @@ -18687,23 +18766,23 @@ var ts; var expression = node.expression; var exprType = checkExpression(expression); switch (node.parent.kind) { - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); var classDecoratorType = instantiateSingleCallFunctionType(getGlobalClassDecoratorType(), [classConstructorType]); checkTypeAssignableTo(exprType, classDecoratorType, node); break; - case 132 /* PropertyDeclaration */: + case 133 /* PropertyDeclaration */: checkTypeAssignableTo(exprType, getGlobalPropertyDecoratorType(), node); break; - case 134 /* MethodDeclaration */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 135 /* MethodDeclaration */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: var methodType = getTypeOfNode(node.parent); var methodDecoratorType = instantiateSingleCallFunctionType(getGlobalMethodDecoratorType(), [methodType]); checkTypeAssignableTo(exprType, methodDecoratorType, node); break; - case 129 /* Parameter */: + case 130 /* Parameter */: checkTypeAssignableTo(exprType, getGlobalParameterDecoratorType(), node); break; } @@ -18713,7 +18792,7 @@ var ts; // When we are emitting type metadata for decorators, we need to try to check the type // as if it were an expression so that we can emit the type in a value position when we // serialize the type metadata. - if (node && node.kind === 141 /* TypeReference */) { + if (node && node.kind === 142 /* TypeReference */) { var type = getTypeFromTypeNode(node); var shouldCheckIfUnknownType = type === unknownType && compilerOptions.separateCompilation; if (!type || (!shouldCheckIfUnknownType && type.flags & (1048703 /* Intrinsic */ | 132 /* NumberLike */ | 258 /* StringLike */))) { @@ -18730,19 +18809,19 @@ var ts; */ function checkTypeAnnotationAsExpression(node) { switch (node.kind) { - case 132 /* PropertyDeclaration */: + case 133 /* PropertyDeclaration */: checkTypeNodeAsExpression(node.type); break; - case 129 /* Parameter */: + case 130 /* Parameter */: checkTypeNodeAsExpression(node.type); break; - case 134 /* MethodDeclaration */: + case 135 /* MethodDeclaration */: checkTypeNodeAsExpression(node.type); break; - case 136 /* GetAccessor */: + case 137 /* GetAccessor */: checkTypeNodeAsExpression(node.type); break; - case 137 /* SetAccessor */: + case 138 /* SetAccessor */: checkTypeNodeAsExpression(getSetAccessorTypeAnnotationNode(node)); break; } @@ -18768,25 +18847,25 @@ var ts; if (compilerOptions.emitDecoratorMetadata) { // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { checkParameterTypeAnnotationsAsExpressions(constructor); } break; - case 134 /* MethodDeclaration */: + case 135 /* MethodDeclaration */: checkParameterTypeAnnotationsAsExpressions(node); // fall-through - case 137 /* SetAccessor */: - case 136 /* GetAccessor */: - case 132 /* PropertyDeclaration */: - case 129 /* Parameter */: + case 138 /* SetAccessor */: + case 137 /* GetAccessor */: + case 133 /* PropertyDeclaration */: + case 130 /* Parameter */: checkTypeAnnotationAsExpression(node); break; } } emitDecorate = true; - if (node.kind === 129 /* Parameter */) { + if (node.kind === 130 /* Parameter */) { emitParam = true; } ts.forEach(node.decorators, checkDecorator); @@ -18809,7 +18888,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 127 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 128 /* ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -18845,11 +18924,11 @@ var ts; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 179 /* Block */) { + if (node.kind === 180 /* Block */) { checkGrammarStatementInAmbientContext(node); } ts.forEach(node.statements, checkSourceElement); - if (ts.isFunctionBlock(node) || node.kind === 206 /* ModuleBlock */) { + if (ts.isFunctionBlock(node) || node.kind === 207 /* ModuleBlock */) { checkFunctionExpressionBodies(node); } } @@ -18868,12 +18947,12 @@ var ts; if (!(identifier && identifier.text === name)) { return false; } - if (node.kind === 132 /* PropertyDeclaration */ || - node.kind === 131 /* PropertySignature */ || - node.kind === 134 /* MethodDeclaration */ || - node.kind === 133 /* MethodSignature */ || - node.kind === 136 /* GetAccessor */ || - node.kind === 137 /* SetAccessor */) { + if (node.kind === 133 /* PropertyDeclaration */ || + node.kind === 132 /* PropertySignature */ || + node.kind === 135 /* MethodDeclaration */ || + node.kind === 134 /* MethodSignature */ || + node.kind === 137 /* GetAccessor */ || + node.kind === 138 /* SetAccessor */) { // it is ok to have member named '_super' or '_this' - member access is always qualified return false; } @@ -18882,7 +18961,7 @@ var ts; return false; } var root = getRootDeclaration(node); - if (root.kind === 129 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { + if (root.kind === 130 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) { // just an overload - no codegen impact return false; } @@ -18915,7 +18994,7 @@ var ts; return; } // bubble up and find containing type - var enclosingClass = ts.getAncestor(node, 201 /* ClassDeclaration */); + var enclosingClass = ts.getAncestor(node, 202 /* ClassDeclaration */); // if containing type was not found or it is ambient - exit (no codegen) if (!enclosingClass || ts.isInAmbientContext(enclosingClass)) { return; @@ -18935,14 +19014,14 @@ var ts; return; } // Uninstantiated modules shouldnt do this check - if (node.kind === 205 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { + if (node.kind === 206 /* ModuleDeclaration */ && ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 227 /* SourceFile */ && ts.isExternalModule(parent)) { + if (parent.kind === 228 /* SourceFile */ && ts.isExternalModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords - 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)); + error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } function checkVarDeclaredNamesNotShadowed(node) { @@ -18975,7 +19054,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 198 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 199 /* VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -18985,17 +19064,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationFlagsFromSymbol(localDeclarationSymbol) & 12288 /* BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 199 /* VariableDeclarationList */); - var container = varDeclList.parent.kind === 180 /* VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 200 /* VariableDeclarationList */); + var container = varDeclList.parent.kind === 181 /* VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 179 /* Block */ && ts.isFunctionLike(container.parent) || - container.kind === 206 /* ModuleBlock */ || - container.kind === 205 /* ModuleDeclaration */ || - container.kind === 227 /* SourceFile */); + (container.kind === 180 /* Block */ && ts.isFunctionLike(container.parent) || + container.kind === 207 /* ModuleBlock */ || + container.kind === 206 /* ModuleDeclaration */ || + container.kind === 228 /* SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -19009,14 +19088,14 @@ var ts; } } function isParameterDeclaration(node) { - while (node.kind === 152 /* BindingElement */) { + while (node.kind === 153 /* BindingElement */) { node = node.parent.parent; } - return node.kind === 129 /* Parameter */; + return node.kind === 130 /* Parameter */; } // Check that a parameter initializer contains no references to parameters declared to the right of itself function checkParameterInitializer(node) { - if (getRootDeclaration(node).kind !== 129 /* Parameter */) { + if (getRootDeclaration(node).kind !== 130 /* Parameter */) { return; } var func = ts.getContainingFunction(node); @@ -19027,7 +19106,7 @@ var ts; // check FunctionLikeDeclaration.locals (stores parameters\function local variable) // if it contains entry with a specified name and if this entry matches the resolved symbol if (referencedSymbol && referencedSymbol !== unknownSymbol && getSymbol(func.locals, referencedSymbol.name, 107455 /* Value */) === referencedSymbol) { - if (referencedSymbol.valueDeclaration.kind === 129 /* Parameter */) { + if (referencedSymbol.valueDeclaration.kind === 130 /* Parameter */) { if (referencedSymbol.valueDeclaration === node) { error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name)); return; @@ -19054,7 +19133,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 127 /* ComputedPropertyName */) { + if (node.name.kind === 128 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); @@ -19065,7 +19144,7 @@ var ts; ts.forEach(node.name.elements, checkSourceElement); } // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body - if (node.initializer && getRootDeclaration(node).kind === 129 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { + if (node.initializer && getRootDeclaration(node).kind === 130 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) { error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation); return; } @@ -19097,10 +19176,10 @@ var ts; checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, undefined); } } - if (node.kind !== 132 /* PropertyDeclaration */ && node.kind !== 131 /* PropertySignature */) { + if (node.kind !== 133 /* PropertyDeclaration */ && node.kind !== 132 /* PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 198 /* VariableDeclaration */ || node.kind === 152 /* BindingElement */) { + if (node.kind === 199 /* VariableDeclaration */ || node.kind === 153 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionWithCapturedSuperVariable(node, node.name); @@ -19130,7 +19209,7 @@ var ts; } function inBlockOrObjectLiteralExpression(node) { while (node) { - if (node.kind === 179 /* Block */ || node.kind === 154 /* ObjectLiteralExpression */) { + if (node.kind === 180 /* Block */ || node.kind === 155 /* ObjectLiteralExpression */) { return true; } node = node.parent; @@ -19163,12 +19242,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind == 199 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind == 200 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 199 /* VariableDeclarationList */) { + if (node.initializer.kind === 200 /* VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -19188,14 +19267,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 199 /* VariableDeclarationList */) { + if (node.initializer.kind === 200 /* VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node.expression); // There may be a destructuring assignment on the left side - if (varExpr.kind === 153 /* ArrayLiteralExpression */ || varExpr.kind === 154 /* ObjectLiteralExpression */) { + if (varExpr.kind === 154 /* ArrayLiteralExpression */ || varExpr.kind === 155 /* ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -19224,7 +19303,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 199 /* VariableDeclarationList */) { + if (node.initializer.kind === 200 /* VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -19238,7 +19317,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 153 /* ArrayLiteralExpression */ || varExpr.kind === 154 /* ObjectLiteralExpression */) { + if (varExpr.kind === 154 /* ArrayLiteralExpression */ || varExpr.kind === 155 /* ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!allConstituentTypesHaveKind(leftType, 1 /* Any */ | 258 /* StringLike */)) { @@ -19438,7 +19517,7 @@ var ts; // TODO: Check that target label is valid } function isGetAccessorWithAnnotatatedSetAccessor(node) { - return !!(node.kind === 136 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 137 /* SetAccessor */))); + return !!(node.kind === 137 /* GetAccessor */ && getSetAccessorTypeAnnotationNode(ts.getDeclarationOfKind(node.symbol, 138 /* SetAccessor */))); } function checkReturnStatement(node) { // Grammar checking @@ -19453,11 +19532,11 @@ var ts; if (func) { var returnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); var exprType = checkExpressionCached(node.expression); - if (func.kind === 137 /* SetAccessor */) { + if (func.kind === 138 /* SetAccessor */) { error(node.expression, ts.Diagnostics.Setters_cannot_return_a_value); } else { - if (func.kind === 135 /* Constructor */) { + if (func.kind === 136 /* Constructor */) { if (!isTypeAssignableTo(exprType, returnType)) { error(node.expression, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -19487,7 +19566,7 @@ var ts; var expressionType = checkExpression(node.expression); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 221 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 222 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -19499,7 +19578,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (produceDiagnostics && clause.kind === 220 /* CaseClause */) { + if (produceDiagnostics && clause.kind === 221 /* CaseClause */) { var caseClause = clause; // TypeScript 1.0 spec (April 2014):5.9 // In a 'switch' statement, each 'case' expression must be of a type that is assignable to or from the type of the 'switch' expression. @@ -19520,7 +19599,7 @@ var ts; if (ts.isFunctionLike(current)) { break; } - if (current.kind === 194 /* LabeledStatement */ && current.label.text === node.label.text) { + if (current.kind === 195 /* LabeledStatement */ && 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; @@ -19590,7 +19669,7 @@ var ts; checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */); checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */); }); - if (type.flags & 1024 /* Class */ && type.symbol.valueDeclaration.kind === 201 /* ClassDeclaration */) { + if (type.flags & 1024 /* Class */ && type.symbol.valueDeclaration.kind === 202 /* ClassDeclaration */) { var classDeclaration = type.symbol.valueDeclaration; for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; @@ -19628,7 +19707,7 @@ var ts; // perform property check if property or indexer is declared in 'type' // this allows to rule out cases when both property and indexer are inherited from the base class var errorNode; - if (prop.valueDeclaration.name.kind === 127 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { + if (prop.valueDeclaration.name.kind === 128 /* ComputedPropertyName */ || prop.parent === containingType.symbol) { errorNode = prop.valueDeclaration; } else if (indexDeclaration) { @@ -19686,7 +19765,7 @@ var ts; function checkClassDeclaration(node) { checkGrammarDeclarationNameInStrictMode(node); // Grammar checking - if (node.parent.kind !== 206 /* ModuleBlock */ && node.parent.kind !== 227 /* SourceFile */) { + if (node.parent.kind !== 207 /* ModuleBlock */ && node.parent.kind !== 228 /* SourceFile */) { grammarErrorOnNode(node, ts.Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration); } if (!node.name && !(node.flags & 256 /* Default */)) { @@ -19706,11 +19785,11 @@ var ts; var staticType = getTypeOfSymbol(symbol); var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - if (!ts.isSupportedHeritageClauseElement(baseTypeNode)) { + if (!ts.isSupportedExpressionWithTypeArguments(baseTypeNode)) { error(baseTypeNode.expression, ts.Diagnostics.Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses); } emitExtends = emitExtends || !ts.isInAmbientContext(node); - checkHeritageClauseElement(baseTypeNode); + checkExpressionWithTypeArguments(baseTypeNode); } var baseTypes = getBaseTypes(type); if (baseTypes.length) { @@ -19732,12 +19811,12 @@ var ts; var implementedTypeNodes = ts.getClassImplementsHeritageClauseElements(node); if (implementedTypeNodes) { ts.forEach(implementedTypeNodes, function (typeRefNode) { - if (!ts.isSupportedHeritageClauseElement(typeRefNode)) { + if (!ts.isSupportedExpressionWithTypeArguments(typeRefNode)) { error(typeRefNode.expression, ts.Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments); } - checkHeritageClauseElement(typeRefNode); + checkExpressionWithTypeArguments(typeRefNode); if (produceDiagnostics) { - var t = getTypeFromHeritageClauseElement(typeRefNode); + var t = getTypeFromTypeNode(typeRefNode); if (t !== unknownType) { var declaredType = (t.flags & 4096 /* Reference */) ? t.target : t; if (declaredType.flags & (1024 /* Class */ | 2048 /* Interface */)) { @@ -19823,7 +19902,7 @@ var ts; } } function isAccessor(kind) { - return kind === 136 /* GetAccessor */ || kind === 137 /* SetAccessor */; + return kind === 137 /* GetAccessor */ || kind === 138 /* SetAccessor */; } function areTypeParametersIdentical(list1, list2) { if (!list1 && !list2) { @@ -19893,7 +19972,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Interface_name_cannot_be_0); checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 202 /* InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 203 /* InterfaceDeclaration */); 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); @@ -19912,10 +19991,10 @@ var ts; } } ts.forEach(ts.getInterfaceBaseTypeNodes(node), function (heritageElement) { - if (!ts.isSupportedHeritageClauseElement(heritageElement)) { + if (!ts.isSupportedExpressionWithTypeArguments(heritageElement)) { error(heritageElement.expression, ts.Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments); } - checkHeritageClauseElement(heritageElement); + checkExpressionWithTypeArguments(heritageElement); }); ts.forEach(node.members, checkSourceElement); if (produceDiagnostics) { @@ -19937,7 +20016,7 @@ var ts; var ambient = ts.isInAmbientContext(node); var enumIsConst = ts.isConst(node); ts.forEach(node.members, function (member) { - if (member.name.kind !== 127 /* ComputedPropertyName */ && isNumericLiteralName(member.name.text)) { + if (member.name.kind !== 128 /* ComputedPropertyName */ && isNumericLiteralName(member.name.text)) { error(member.name, ts.Diagnostics.An_enum_member_cannot_have_a_numeric_name); } var initializer = member.initializer; @@ -19977,7 +20056,7 @@ var ts; return evalConstant(initializer); function evalConstant(e) { switch (e.kind) { - case 167 /* PrefixUnaryExpression */: + case 168 /* PrefixUnaryExpression */: var value = evalConstant(e.operand); if (value === undefined) { return undefined; @@ -19988,7 +20067,7 @@ var ts; case 47 /* TildeToken */: return ~value; } return undefined; - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: var left = evalConstant(e.left); if (left === undefined) { return undefined; @@ -20013,11 +20092,11 @@ var ts; return undefined; case 7 /* NumericLiteral */: return +e.text; - case 161 /* ParenthesizedExpression */: + case 162 /* ParenthesizedExpression */: return evalConstant(e.expression); case 65 /* Identifier */: - case 156 /* ElementAccessExpression */: - case 155 /* PropertyAccessExpression */: + case 157 /* ElementAccessExpression */: + case 156 /* PropertyAccessExpression */: var member = initializer.parent; var currentType = getTypeOfSymbol(getSymbolOfNode(member.parent)); var enumType; @@ -20030,7 +20109,7 @@ var ts; } else { var expression; - if (e.kind === 156 /* ElementAccessExpression */) { + if (e.kind === 157 /* ElementAccessExpression */) { if (e.argumentExpression === undefined || e.argumentExpression.kind !== 8 /* StringLiteral */) { return undefined; @@ -20048,7 +20127,7 @@ var ts; if (current.kind === 65 /* Identifier */) { break; } - else if (current.kind === 155 /* PropertyAccessExpression */) { + else if (current.kind === 156 /* PropertyAccessExpression */) { current = current.expression; } else { @@ -20117,7 +20196,7 @@ var ts; var seenEnumMissingInitialInitializer = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 204 /* EnumDeclaration */) { + if (declaration.kind !== 205 /* EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -20140,8 +20219,8 @@ var ts; var declarations = symbol.declarations; for (var _i = 0; _i < declarations.length; _i++) { var declaration = declarations[_i]; - if ((declaration.kind === 201 /* ClassDeclaration */ || - (declaration.kind === 200 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 202 /* ClassDeclaration */ || + (declaration.kind === 201 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { return declaration; } @@ -20181,15 +20260,15 @@ var ts; var firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (firstNonAmbientClassOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(firstNonAmbientClassOrFunc)) { - error(node.name, ts.Diagnostics.A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged); + error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged); } else if (node.pos < firstNonAmbientClassOrFunc.pos) { - error(node.name, ts.Diagnostics.A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); + error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 201 /* ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 202 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */; @@ -20198,10 +20277,10 @@ var ts; // Checks for ambient external modules. if (node.name.kind === 8 /* StringLiteral */) { if (!isGlobalSourceFile(node.parent)) { - error(node.name, ts.Diagnostics.Ambient_external_modules_cannot_be_nested_in_other_modules); + error(node.name, ts.Diagnostics.Ambient_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); + error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); } } } @@ -20209,10 +20288,10 @@ var ts; } function getFirstIdentifier(node) { while (true) { - if (node.kind === 126 /* QualifiedName */) { + if (node.kind === 127 /* QualifiedName */) { node = node.left; } - else if (node.kind === 155 /* PropertyAccessExpression */) { + else if (node.kind === 156 /* PropertyAccessExpression */) { node = node.expression; } else { @@ -20228,11 +20307,11 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 206 /* ModuleBlock */ && node.parent.parent.name.kind === 8 /* StringLiteral */; - if (node.parent.kind !== 227 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 215 /* ExportDeclaration */ ? - ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module : - ts.Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module); + var inAmbientExternalModule = node.parent.kind === 207 /* ModuleBlock */ && node.parent.parent.name.kind === 8 /* StringLiteral */; + if (node.parent.kind !== 228 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 216 /* ExportDeclaration */ ? + ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : + ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; } if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { @@ -20240,7 +20319,7 @@ var ts; // 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, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name); + error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); return false; } return true; @@ -20253,7 +20332,7 @@ var ts; (symbol.flags & 793056 /* Type */ ? 793056 /* Type */ : 0) | (symbol.flags & 1536 /* Namespace */ ? 1536 /* Namespace */ : 0); if (target.flags & excludedMeanings) { - var message = node.kind === 217 /* ExportSpecifier */ ? + var message = node.kind === 218 /* ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -20276,7 +20355,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 211 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 212 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); } else { @@ -20325,16 +20404,16 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 206 /* ModuleBlock */ && node.parent.parent.name.kind === 8 /* StringLiteral */; - if (node.parent.kind !== 227 /* SourceFile */ && !inAmbientExternalModule) { - error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module); + var inAmbientExternalModule = node.parent.kind === 207 /* ModuleBlock */ && node.parent.parent.name.kind === 8 /* StringLiteral */; + if (node.parent.kind !== 228 /* SourceFile */ && !inAmbientExternalModule) { + error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } else { // export * from "foo" var moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier); if (moduleSymbol && moduleSymbol.exports["export="]) { - error(node.moduleSpecifier, ts.Diagnostics.External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); + error(node.moduleSpecifier, ts.Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol)); } } } @@ -20346,9 +20425,9 @@ var ts; } } function checkExportAssignment(node) { - var container = node.parent.kind === 227 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 205 /* ModuleDeclaration */ && container.name.kind === 65 /* Identifier */) { - error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module); + var container = node.parent.kind === 228 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 206 /* ModuleDeclaration */ && container.name.kind === 65 /* Identifier */) { + error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); return; } // Grammar checking @@ -20362,16 +20441,22 @@ var ts; checkExpressionCached(node.expression); } checkExternalModuleExports(container); - if (node.isExportEquals && languageVersion >= 2 /* ES6 */) { - // export assignment is deprecated in es6 or above - grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead); + if (node.isExportEquals && !ts.isInAmbientContext(node)) { + if (languageVersion >= 2 /* ES6 */) { + // export assignment is deprecated in es6 or above + grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead); + } + else if (compilerOptions.module === 4 /* System */) { + // system modules does not support export assignment + grammarErrorOnNode(node, ts.Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system); + } } } function getModuleStatements(node) { - if (node.kind === 227 /* SourceFile */) { + if (node.kind === 228 /* SourceFile */) { return node.statements; } - if (node.kind === 205 /* ModuleDeclaration */ && node.body.kind === 206 /* ModuleBlock */) { + if (node.kind === 206 /* ModuleDeclaration */ && node.body.kind === 207 /* ModuleBlock */) { return node.body.statements; } return emptyArray; @@ -20400,107 +20485,107 @@ var ts; if (!node) return; switch (node.kind) { - case 128 /* TypeParameter */: + case 129 /* TypeParameter */: return checkTypeParameter(node); - case 129 /* Parameter */: + case 130 /* Parameter */: return checkParameter(node); - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: return checkPropertyDeclaration(node); - case 142 /* FunctionType */: - case 143 /* ConstructorType */: - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: return checkSignatureDeclaration(node); - case 140 /* IndexSignature */: + case 141 /* IndexSignature */: return checkSignatureDeclaration(node); - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: return checkMethodDeclaration(node); - case 135 /* Constructor */: + case 136 /* Constructor */: return checkConstructorDeclaration(node); - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: return checkAccessorDeclaration(node); - case 141 /* TypeReference */: + case 142 /* TypeReference */: return checkTypeReferenceNode(node); - case 144 /* TypeQuery */: + case 145 /* TypeQuery */: return checkTypeQuery(node); - case 145 /* TypeLiteral */: + case 146 /* TypeLiteral */: return checkTypeLiteral(node); - case 146 /* ArrayType */: + case 147 /* ArrayType */: return checkArrayType(node); - case 147 /* TupleType */: + case 148 /* TupleType */: return checkTupleType(node); - case 148 /* UnionType */: + case 149 /* UnionType */: return checkUnionType(node); - case 149 /* ParenthesizedType */: + case 150 /* ParenthesizedType */: return checkSourceElement(node.type); - case 200 /* FunctionDeclaration */: + case 201 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 179 /* Block */: - case 206 /* ModuleBlock */: + case 180 /* Block */: + case 207 /* ModuleBlock */: return checkBlock(node); - case 180 /* VariableStatement */: + case 181 /* VariableStatement */: return checkVariableStatement(node); - case 182 /* ExpressionStatement */: + case 183 /* ExpressionStatement */: return checkExpressionStatement(node); - case 183 /* IfStatement */: + case 184 /* IfStatement */: return checkIfStatement(node); - case 184 /* DoStatement */: + case 185 /* DoStatement */: return checkDoStatement(node); - case 185 /* WhileStatement */: + case 186 /* WhileStatement */: return checkWhileStatement(node); - case 186 /* ForStatement */: + case 187 /* ForStatement */: return checkForStatement(node); - case 187 /* ForInStatement */: + case 188 /* ForInStatement */: return checkForInStatement(node); - case 188 /* ForOfStatement */: + case 189 /* ForOfStatement */: return checkForOfStatement(node); - case 189 /* ContinueStatement */: - case 190 /* BreakStatement */: + case 190 /* ContinueStatement */: + case 191 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 191 /* ReturnStatement */: + case 192 /* ReturnStatement */: return checkReturnStatement(node); - case 192 /* WithStatement */: + case 193 /* WithStatement */: return checkWithStatement(node); - case 193 /* SwitchStatement */: + case 194 /* SwitchStatement */: return checkSwitchStatement(node); - case 194 /* LabeledStatement */: + case 195 /* LabeledStatement */: return checkLabeledStatement(node); - case 195 /* ThrowStatement */: + case 196 /* ThrowStatement */: return checkThrowStatement(node); - case 196 /* TryStatement */: + case 197 /* TryStatement */: return checkTryStatement(node); - case 198 /* VariableDeclaration */: + case 199 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 152 /* BindingElement */: + case 153 /* BindingElement */: return checkBindingElement(node); - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: return checkClassDeclaration(node); - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 203 /* TypeAliasDeclaration */: + case 204 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: return checkImportDeclaration(node); - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: return checkExportDeclaration(node); - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: return checkExportAssignment(node); - case 181 /* EmptyStatement */: + case 182 /* EmptyStatement */: checkGrammarStatementInAmbientContext(node); return; - case 197 /* DebuggerStatement */: + case 198 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 218 /* MissingDeclaration */: + case 219 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -20515,81 +20600,81 @@ var ts; // Delaying the type check of the body ensures foo has been assigned a type. function checkFunctionExpressionBodies(node) { switch (node.kind) { - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: ts.forEach(node.parameters, checkFunctionExpressionBodies); checkFunctionExpressionOrObjectLiteralMethodBody(node); break; - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: ts.forEach(node.parameters, checkFunctionExpressionBodies); if (ts.isObjectLiteralMethod(node)) { checkFunctionExpressionOrObjectLiteralMethodBody(node); } break; - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 200 /* FunctionDeclaration */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 201 /* FunctionDeclaration */: ts.forEach(node.parameters, checkFunctionExpressionBodies); break; - case 192 /* WithStatement */: + case 193 /* WithStatement */: checkFunctionExpressionBodies(node.expression); break; - case 129 /* Parameter */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 150 /* ObjectBindingPattern */: - case 151 /* ArrayBindingPattern */: - case 152 /* BindingElement */: - case 153 /* ArrayLiteralExpression */: - case 154 /* ObjectLiteralExpression */: - case 224 /* PropertyAssignment */: - case 155 /* PropertyAccessExpression */: - case 156 /* ElementAccessExpression */: - case 157 /* CallExpression */: - case 158 /* NewExpression */: - case 159 /* TaggedTemplateExpression */: - case 171 /* TemplateExpression */: - case 176 /* TemplateSpan */: - case 160 /* TypeAssertionExpression */: - case 161 /* ParenthesizedExpression */: - case 165 /* TypeOfExpression */: - case 166 /* VoidExpression */: - case 164 /* DeleteExpression */: - case 167 /* PrefixUnaryExpression */: - case 168 /* PostfixUnaryExpression */: - case 169 /* BinaryExpression */: - case 170 /* ConditionalExpression */: - case 173 /* SpreadElementExpression */: - case 179 /* Block */: - case 206 /* ModuleBlock */: - case 180 /* VariableStatement */: - case 182 /* ExpressionStatement */: - case 183 /* IfStatement */: - case 184 /* DoStatement */: - case 185 /* WhileStatement */: - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 189 /* ContinueStatement */: - case 190 /* BreakStatement */: - case 191 /* ReturnStatement */: - case 193 /* SwitchStatement */: - case 207 /* CaseBlock */: - case 220 /* CaseClause */: - case 221 /* DefaultClause */: - case 194 /* LabeledStatement */: - case 195 /* ThrowStatement */: - case 196 /* TryStatement */: - case 223 /* CatchClause */: - case 198 /* VariableDeclaration */: - case 199 /* VariableDeclarationList */: - case 201 /* ClassDeclaration */: - case 204 /* EnumDeclaration */: - case 226 /* EnumMember */: - case 214 /* ExportAssignment */: - case 227 /* SourceFile */: + case 130 /* Parameter */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 151 /* ObjectBindingPattern */: + case 152 /* ArrayBindingPattern */: + case 153 /* BindingElement */: + case 154 /* ArrayLiteralExpression */: + case 155 /* ObjectLiteralExpression */: + case 225 /* PropertyAssignment */: + case 156 /* PropertyAccessExpression */: + case 157 /* ElementAccessExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: + case 160 /* TaggedTemplateExpression */: + case 172 /* TemplateExpression */: + case 178 /* TemplateSpan */: + case 161 /* TypeAssertionExpression */: + case 162 /* ParenthesizedExpression */: + case 166 /* TypeOfExpression */: + case 167 /* VoidExpression */: + case 165 /* DeleteExpression */: + case 168 /* PrefixUnaryExpression */: + case 169 /* PostfixUnaryExpression */: + case 170 /* BinaryExpression */: + case 171 /* ConditionalExpression */: + case 174 /* SpreadElementExpression */: + case 180 /* Block */: + case 207 /* ModuleBlock */: + case 181 /* VariableStatement */: + case 183 /* ExpressionStatement */: + case 184 /* IfStatement */: + case 185 /* DoStatement */: + case 186 /* WhileStatement */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 190 /* ContinueStatement */: + case 191 /* BreakStatement */: + case 192 /* ReturnStatement */: + case 194 /* SwitchStatement */: + case 208 /* CaseBlock */: + case 221 /* CaseClause */: + case 222 /* DefaultClause */: + case 195 /* LabeledStatement */: + case 196 /* ThrowStatement */: + case 197 /* TryStatement */: + case 224 /* CatchClause */: + case 199 /* VariableDeclaration */: + case 200 /* VariableDeclarationList */: + case 202 /* ClassDeclaration */: + case 205 /* EnumDeclaration */: + case 227 /* EnumMember */: + case 215 /* ExportAssignment */: + case 228 /* SourceFile */: ts.forEachChild(node, checkFunctionExpressionBodies); break; } @@ -20652,7 +20737,7 @@ var ts; function isInsideWithStatementBody(node) { if (node) { while (node.parent) { - if (node.parent.kind === 192 /* WithStatement */ && node.parent.statement === node) { + if (node.parent.kind === 193 /* WithStatement */ && node.parent.statement === node) { return true; } node = node.parent; @@ -20675,23 +20760,23 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 227 /* SourceFile */: + case 228 /* SourceFile */: if (!ts.isExternalModule(location)) { break; } - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: if (!(memberFlags & 128 /* Static */)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056 /* Type */); } break; - case 162 /* FunctionExpression */: + case 163 /* FunctionExpression */: if (location.name) { copySymbol(location.symbol, meaning); } @@ -20729,22 +20814,22 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 227 /* SourceFile */: + case 228 /* SourceFile */: if (!ts.isExternalModule(location)) break; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8914931 /* ModuleMember */); break; - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */); break; - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: if (!(memberFlags & 128 /* Static */)) { copySymbols(getSymbolOfNode(location).members, meaning & 793056 /* Type */); } break; - case 162 /* FunctionExpression */: + case 163 /* FunctionExpression */: if (location.name) { copySymbol(location.symbol, meaning); } @@ -20763,64 +20848,64 @@ var ts; } function isTypeDeclaration(node) { switch (node.kind) { - case 128 /* TypeParameter */: - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 203 /* TypeAliasDeclaration */: - case 204 /* EnumDeclaration */: + case 129 /* TypeParameter */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 204 /* TypeAliasDeclaration */: + case 205 /* EnumDeclaration */: return true; } } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 126 /* QualifiedName */) { + while (node.parent && node.parent.kind === 127 /* QualifiedName */) { node = node.parent; } - return node.parent && node.parent.kind === 141 /* TypeReference */; + return node.parent && node.parent.kind === 142 /* TypeReference */; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; - while (node.parent && node.parent.kind === 155 /* PropertyAccessExpression */) { + while (node.parent && node.parent.kind === 156 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent && node.parent.kind === 177 /* HeritageClauseElement */; + return node.parent && node.parent.kind === 177 /* ExpressionWithTypeArguments */; } function isTypeNode(node) { - if (141 /* FirstTypeNode */ <= node.kind && node.kind <= 149 /* LastTypeNode */) { + if (142 /* FirstTypeNode */ <= node.kind && node.kind <= 150 /* LastTypeNode */) { return true; } switch (node.kind) { case 112 /* AnyKeyword */: - case 119 /* NumberKeyword */: - case 121 /* StringKeyword */: + case 120 /* NumberKeyword */: + case 122 /* StringKeyword */: case 113 /* BooleanKeyword */: - case 122 /* SymbolKeyword */: + case 123 /* SymbolKeyword */: return true; case 99 /* VoidKeyword */: - return node.parent.kind !== 166 /* VoidExpression */; + return node.parent.kind !== 167 /* VoidExpression */; case 8 /* StringLiteral */: // Specialized signatures can have string literals as their parameters' type names - return node.parent.kind === 129 /* Parameter */; - case 177 /* HeritageClauseElement */: + return node.parent.kind === 130 /* Parameter */; + case 177 /* ExpressionWithTypeArguments */: return true; // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container case 65 /* Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 126 /* QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 127 /* QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 155 /* PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 156 /* PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // fall through - case 126 /* QualifiedName */: - case 155 /* PropertyAccessExpression */: + case 127 /* QualifiedName */: + case 156 /* PropertyAccessExpression */: // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 65 /* Identifier */ || node.kind === 126 /* QualifiedName */ || node.kind === 155 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); + ts.Debug.assert(node.kind === 65 /* Identifier */ || node.kind === 127 /* QualifiedName */ || node.kind === 156 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'."); var parent_5 = node.parent; - if (parent_5.kind === 144 /* TypeQuery */) { + if (parent_5.kind === 145 /* TypeQuery */) { return false; } // Do not recursively call isTypeNode on the parent. In the example: @@ -20829,38 +20914,38 @@ var ts; // // Calling isTypeNode would consider the qualified name A.B a type node. Only C or // A.B.C is a type node. - if (141 /* FirstTypeNode */ <= parent_5.kind && parent_5.kind <= 149 /* LastTypeNode */) { + if (142 /* FirstTypeNode */ <= parent_5.kind && parent_5.kind <= 150 /* LastTypeNode */) { return true; } switch (parent_5.kind) { - case 177 /* HeritageClauseElement */: + case 177 /* ExpressionWithTypeArguments */: return true; - case 128 /* TypeParameter */: + case 129 /* TypeParameter */: return node === parent_5.constraint; - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 129 /* Parameter */: - case 198 /* VariableDeclaration */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 130 /* Parameter */: + case 199 /* VariableDeclaration */: return node === parent_5.type; - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: - case 135 /* Constructor */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: + case 136 /* Constructor */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: return node === parent_5.type; - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: - case 140 /* IndexSignature */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: + case 141 /* IndexSignature */: return node === parent_5.type; - case 160 /* TypeAssertionExpression */: + case 161 /* TypeAssertionExpression */: return node === parent_5.type; - case 157 /* CallExpression */: - case 158 /* NewExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: return parent_5.typeArguments && ts.indexOf(parent_5.typeArguments, node) >= 0; - case 159 /* TaggedTemplateExpression */: + case 160 /* TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -20868,13 +20953,13 @@ var ts; return false; } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 126 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 127 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 208 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 209 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide && nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 214 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 215 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide && nodeOnRightSide.parent; } return undefined; @@ -20886,11 +20971,11 @@ var ts; if (ts.isDeclarationName(entityName)) { return getSymbolOfNode(entityName.parent); } - if (entityName.parent.kind === 214 /* ExportAssignment */) { + if (entityName.parent.kind === 215 /* ExportAssignment */) { return resolveEntityName(entityName, /*all meanings*/ 107455 /* Value */ | 793056 /* Type */ | 1536 /* Namespace */ | 8388608 /* Alias */); } - if (entityName.kind !== 155 /* PropertyAccessExpression */) { + if (entityName.kind !== 156 /* PropertyAccessExpression */) { if (isInRightSideOfImportOrExportAssignment(entityName)) { // Since we already checked for ExportAssignment, this really could only be an Import return getSymbolOfPartOfRightHandSideOfImportEquals(entityName); @@ -20900,7 +20985,7 @@ var ts; entityName = entityName.parent; } if (isHeritageClauseElementIdentifier(entityName)) { - var meaning = entityName.parent.kind === 177 /* HeritageClauseElement */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = entityName.parent.kind === 177 /* ExpressionWithTypeArguments */ ? 793056 /* Type */ : 1536 /* Namespace */; meaning |= 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } @@ -20915,14 +21000,14 @@ var ts; var meaning = 107455 /* Value */ | 8388608 /* Alias */; return resolveEntityName(entityName, meaning); } - else if (entityName.kind === 155 /* PropertyAccessExpression */) { + else if (entityName.kind === 156 /* PropertyAccessExpression */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkPropertyAccessExpression(entityName); } return getNodeLinks(entityName).resolvedSymbol; } - else if (entityName.kind === 126 /* QualifiedName */) { + else if (entityName.kind === 127 /* QualifiedName */) { var symbol = getNodeLinks(entityName).resolvedSymbol; if (!symbol) { checkQualifiedName(entityName); @@ -20931,7 +21016,7 @@ var ts; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = entityName.parent.kind === 141 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; + var meaning = entityName.parent.kind === 142 /* TypeReference */ ? 793056 /* Type */ : 1536 /* Namespace */; // Include aliases in the meaning, this ensures that we do not follow aliases to where they point and instead // return the alias symbol. meaning |= 8388608 /* Alias */; @@ -20950,14 +21035,14 @@ var ts; return getSymbolOfNode(node.parent); } if (node.kind === 65 /* Identifier */ && isInRightSideOfImportOrExportAssignment(node)) { - return node.parent.kind === 214 /* ExportAssignment */ + return node.parent.kind === 215 /* ExportAssignment */ ? getSymbolOfEntityNameOrPropertyAccessExpression(node) : getSymbolOfPartOfRightHandSideOfImportEquals(node); } switch (node.kind) { case 65 /* Identifier */: - case 155 /* PropertyAccessExpression */: - case 126 /* QualifiedName */: + case 156 /* PropertyAccessExpression */: + case 127 /* QualifiedName */: return getSymbolOfEntityNameOrPropertyAccessExpression(node); case 93 /* ThisKeyword */: case 91 /* SuperKeyword */: @@ -20966,7 +21051,7 @@ var ts; case 114 /* ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 135 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 136 /* Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -20975,14 +21060,14 @@ var ts; var moduleName; if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 209 /* ImportDeclaration */ || node.parent.kind === 215 /* ExportDeclaration */) && + ((node.parent.kind === 210 /* ImportDeclaration */ || node.parent.kind === 216 /* ExportDeclaration */) && node.parent.moduleSpecifier === node)) { return resolveExternalModuleName(node, node); } // Intentional fall-through case 7 /* NumericLiteral */: // index access - if (node.parent.kind == 156 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { + if (node.parent.kind == 157 /* ElementAccessExpression */ && node.parent.argumentExpression === node) { var objectType = checkExpression(node.parent.expression); if (objectType === unknownType) return undefined; @@ -20999,7 +21084,7 @@ var ts; // The function returns a value symbol of an identifier in the short-hand property assignment. // This is necessary as an identifier in short-hand property assignment can contains two meaning: // property name and property value. - if (location && location.kind === 225 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 226 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 107455 /* Value */); } return undefined; @@ -21079,7 +21164,7 @@ var ts; } // Emitter support function isExternalModuleSymbol(symbol) { - return symbol.flags & 512 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 227 /* SourceFile */; + return symbol.flags & 512 /* ValueModule */ && symbol.declarations.length === 1 && symbol.declarations[0].kind === 228 /* SourceFile */; } function getAliasNameSubstitution(symbol, getGeneratedNameForNode) { // If this is es6 or higher, just use the name of the export @@ -21089,7 +21174,7 @@ var ts; } var node = getDeclarationOfAliasSymbol(symbol); if (node) { - if (node.kind === 210 /* ImportClause */) { + if (node.kind === 211 /* ImportClause */) { var defaultKeyword; if (languageVersion === 0 /* ES3 */) { defaultKeyword = "[\"default\"]"; @@ -21099,7 +21184,7 @@ var ts; } return getGeneratedNameForNode(node.parent) + defaultKeyword; } - if (node.kind === 213 /* ImportSpecifier */) { + if (node.kind === 214 /* ImportSpecifier */) { var moduleName = getGeneratedNameForNode(node.parent.parent.parent); var propertyName = node.propertyName || node.name; return moduleName + "." + ts.unescapeIdentifier(propertyName.text); @@ -21108,9 +21193,11 @@ var ts; } function getExportNameSubstitution(symbol, location, getGeneratedNameForNode) { if (isExternalModuleSymbol(symbol.parent)) { - // If this is es6 or higher, just use the name of the export + // 1. If this is es6 or higher, just use the name of the export // no need to qualify it. - if (languageVersion >= 2 /* ES6 */) { + // 2. export mechanism for System modules is different from CJS\AMD + // and it does not need qualifications for exports + if (languageVersion >= 2 /* ES6 */ || compilerOptions.module === 4 /* System */) { return undefined; } return "exports." + ts.unescapeIdentifier(symbol.name); @@ -21118,7 +21205,7 @@ var ts; var node = location; var containerSymbol = getParentOfSymbol(symbol); while (node) { - if ((node.kind === 205 /* ModuleDeclaration */ || node.kind === 204 /* EnumDeclaration */) && getSymbolOfNode(node) === containerSymbol) { + if ((node.kind === 206 /* ModuleDeclaration */ || node.kind === 205 /* EnumDeclaration */) && getSymbolOfNode(node) === containerSymbol) { return getGeneratedNameForNode(node) + "." + ts.unescapeIdentifier(symbol.name); } node = node.parent; @@ -21147,22 +21234,22 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 208 /* ImportEqualsDeclaration */: - case 210 /* ImportClause */: - case 211 /* NamespaceImport */: - case 213 /* ImportSpecifier */: - case 217 /* ExportSpecifier */: + case 209 /* ImportEqualsDeclaration */: + case 211 /* ImportClause */: + case 212 /* NamespaceImport */: + case 214 /* ImportSpecifier */: + case 218 /* ExportSpecifier */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: var exportClause = node.exportClause; return exportClause && ts.forEach(exportClause.elements, isValueAliasDeclaration); - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: return node.expression && node.expression.kind === 65 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(node) { - if (node.parent.kind !== 227 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node.parent.kind !== 228 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -21220,7 +21307,7 @@ var ts; return getNodeLinks(node).enumMemberValue; } function getConstantValue(node) { - if (node.kind === 226 /* EnumMember */) { + if (node.kind === 227 /* EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -21265,7 +21352,7 @@ var ts; // * The serialized type of a TypeReference with a value declaration is its entity name. // * The serialized type of a TypeReference with a call or construct signature is "Function". // * The serialized type of any other type is "Object". - var type = getTypeFromTypeReference(node); + var type = getTypeFromTypeNode(node); if (type.flags & 16 /* Void */) { return "void 0"; } @@ -21313,26 +21400,26 @@ var ts; switch (node.kind) { case 99 /* VoidKeyword */: return "void 0"; - case 149 /* ParenthesizedType */: + case 150 /* ParenthesizedType */: return serializeTypeNode(node.type, getGeneratedNameForNode); - case 142 /* FunctionType */: - case 143 /* ConstructorType */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: return "Function"; - case 146 /* ArrayType */: - case 147 /* TupleType */: + case 147 /* ArrayType */: + case 148 /* TupleType */: return "Array"; case 113 /* BooleanKeyword */: return "Boolean"; - case 121 /* StringKeyword */: + case 122 /* StringKeyword */: case 8 /* StringLiteral */: return "String"; - case 119 /* NumberKeyword */: + case 120 /* NumberKeyword */: return "Number"; - case 141 /* TypeReference */: + case 142 /* TypeReference */: return serializeTypeReferenceNode(node, getGeneratedNameForNode); - case 144 /* TypeQuery */: - case 145 /* TypeLiteral */: - case 148 /* UnionType */: + case 145 /* TypeQuery */: + case 146 /* TypeLiteral */: + case 149 /* UnionType */: case 112 /* AnyKeyword */: break; default: @@ -21355,11 +21442,11 @@ var ts; // // For rules on serializing type annotations, see `serializeTypeNode`. switch (node.kind) { - case 201 /* ClassDeclaration */: return "Function"; - case 132 /* PropertyDeclaration */: return serializeTypeNode(node.type, getGeneratedNameForNode); - case 129 /* Parameter */: return serializeTypeNode(node.type, getGeneratedNameForNode); - case 136 /* GetAccessor */: return serializeTypeNode(node.type, getGeneratedNameForNode); - case 137 /* SetAccessor */: return serializeTypeNode(getSetAccessorTypeAnnotationNode(node), getGeneratedNameForNode); + case 202 /* ClassDeclaration */: return "Function"; + case 133 /* PropertyDeclaration */: return serializeTypeNode(node.type, getGeneratedNameForNode); + case 130 /* Parameter */: return serializeTypeNode(node.type, getGeneratedNameForNode); + case 137 /* GetAccessor */: return serializeTypeNode(node.type, getGeneratedNameForNode); + case 138 /* SetAccessor */: return serializeTypeNode(getSetAccessorTypeAnnotationNode(node), getGeneratedNameForNode); } if (ts.isFunctionLike(node)) { return "Function"; @@ -21376,7 +21463,7 @@ var ts; // For the rules on serializing the type of each parameter declaration, see `serializeTypeOfDeclaration`. if (node) { var valueDeclaration; - if (node.kind === 201 /* ClassDeclaration */) { + if (node.kind === 202 /* ClassDeclaration */) { valueDeclaration = ts.getFirstConstructorWithBody(node); } else if (ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)) { @@ -21391,10 +21478,10 @@ var ts; for (var i = 0; i < parameterCount; i++) { if (parameters[i].dotDotDotToken) { var parameterType = parameters[i].type; - if (parameterType.kind === 146 /* ArrayType */) { + if (parameterType.kind === 147 /* ArrayType */) { parameterType = parameterType.elementType; } - else if (parameterType.kind === 141 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { + else if (parameterType.kind === 142 /* TypeReference */ && parameterType.typeArguments && parameterType.typeArguments.length === 1) { parameterType = parameterType.typeArguments[0]; } else { @@ -21442,15 +21529,21 @@ var ts; ts.Debug.assert(!ts.nodeIsSynthesized(location), "resolvesToSomeValue called with a synthesized location"); return !!resolveName(location, name, 107455 /* Value */, undefined, undefined); } + function getReferencedValueDeclaration(reference) { + ts.Debug.assert(!ts.nodeIsSynthesized(reference)); + var symbol = getNodeLinks(reference).resolvedSymbol || + resolveName(reference, reference.text, 107455 /* Value */ | 8388608 /* Alias */, undefined, undefined); + return symbol && getExportSymbolOfValueSymbolIfExported(symbol).valueDeclaration; + } function getBlockScopedVariableId(n) { ts.Debug.assert(!ts.nodeIsSynthesized(n)); - var isVariableDeclarationOrBindingElement = n.parent.kind === 152 /* BindingElement */ || (n.parent.kind === 198 /* VariableDeclaration */ && n.parent.name === n); + var isVariableDeclarationOrBindingElement = n.parent.kind === 153 /* BindingElement */ || (n.parent.kind === 199 /* VariableDeclaration */ && n.parent.name === n); var symbol = (isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) || getNodeLinks(n).resolvedSymbol || resolveName(n, n.text, 107455 /* Value */ | 8388608 /* Alias */, undefined, undefined); var isLetOrConst = symbol && (symbol.flags & 2 /* BlockScopedVariable */) && - symbol.valueDeclaration.parent.kind !== 223 /* CatchClause */; + symbol.valueDeclaration.parent.kind !== 224 /* CatchClause */; if (isLetOrConst) { // side-effect of calling this method: // assign id to symbol if it was not yet set @@ -21489,6 +21582,7 @@ var ts; resolvesToSomeValue: resolvesToSomeValue, collectLinkedAliases: collectLinkedAliases, getBlockScopedVariableId: getBlockScopedVariableId, + getReferencedValueDeclaration: getReferencedValueDeclaration, serializeTypeOfNode: serializeTypeOfNode, serializeParameterTypesOfNode: serializeParameterTypesOfNode, serializeReturnTypeOfNode: serializeReturnTypeOfNode @@ -21545,12 +21639,12 @@ var ts; function isReservedWordInStrictMode(node) { // Check that originalKeywordKind is less than LastFutureReservedWord to see if an Identifier is a strict-mode reserved word return (node.parserContextFlags & 1 /* StrictMode */) && - (node.originalKeywordKind >= 102 /* FirstFutureReservedWord */ && node.originalKeywordKind <= 110 /* LastFutureReservedWord */); + (102 /* FirstFutureReservedWord */ <= node.originalKeywordKind && node.originalKeywordKind <= 110 /* LastFutureReservedWord */); } function reportStrictModeGrammarErrorInClassDeclaration(identifier, message, arg0, arg1, arg2) { // We are checking if this name is inside class declaration or class expression (which are under class definitions inside ES6 spec.) // if so, we would like to give more explicit invalid usage error. - if (ts.getAncestor(identifier, 201 /* ClassDeclaration */) || ts.getAncestor(identifier, 174 /* ClassExpression */)) { + if (ts.getAncestor(identifier, 202 /* ClassDeclaration */) || ts.getAncestor(identifier, 175 /* ClassExpression */)) { return grammarErrorOnNode(identifier, message, arg0); } return false; @@ -21561,19 +21655,19 @@ var ts; var impotClause = node.importClause; if (impotClause.namedBindings) { var nameBindings = impotClause.namedBindings; - if (nameBindings.kind === 211 /* NamespaceImport */) { + if (nameBindings.kind === 212 /* NamespaceImport */) { var name_11 = nameBindings.name; - if (name_11.originalKeywordKind) { + if (isReservedWordInStrictMode(name_11)) { var nameText = ts.declarationNameToString(name_11); return grammarErrorOnNode(name_11, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); } } - else if (nameBindings.kind === 212 /* NamedImports */) { + else if (nameBindings.kind === 213 /* NamedImports */) { var reportError = false; for (var _i = 0, _a = nameBindings.elements; _i < _a.length; _i++) { var element = _a[_i]; var name_12 = element.name; - if (name_12.originalKeywordKind) { + if (isReservedWordInStrictMode(name_12)) { var nameText = ts.declarationNameToString(name_12); reportError = reportError || grammarErrorOnNode(name_12, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); } @@ -21589,23 +21683,23 @@ var ts; if (name && name.kind === 65 /* Identifier */ && isReservedWordInStrictMode(name)) { var nameText = ts.declarationNameToString(name); switch (node.kind) { - case 129 /* Parameter */: - case 198 /* VariableDeclaration */: - case 200 /* FunctionDeclaration */: - case 128 /* TypeParameter */: - case 152 /* BindingElement */: - case 202 /* InterfaceDeclaration */: - case 203 /* TypeAliasDeclaration */: - case 204 /* EnumDeclaration */: + case 130 /* Parameter */: + case 199 /* VariableDeclaration */: + case 201 /* FunctionDeclaration */: + case 129 /* TypeParameter */: + case 153 /* BindingElement */: + case 203 /* InterfaceDeclaration */: + case 204 /* TypeAliasDeclaration */: + case 205 /* EnumDeclaration */: return checkGrammarIdentifierInStrictMode(name); - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: // Report an error if the class declaration uses strict-mode reserved word. return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode, nameText); - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: // Report an error if the module declaration uses strict-mode reserved word. // TODO(yuisu): fix this when having external module in strict mode return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: // TODO(yuisu): fix this when having external module in strict mode return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText); } @@ -21621,7 +21715,7 @@ var ts; if (typeName.kind === 65 /* Identifier */) { checkGrammarTypeNameInStrictMode(typeName); } - else if (typeName.kind === 126 /* QualifiedName */) { + else if (typeName.kind === 127 /* QualifiedName */) { // Walk from right to left and report a possible error at each Identifier in QualifiedName // Example: // x1: public.private.package // error at public and private @@ -21635,18 +21729,18 @@ var ts; // public // error at public // public.private.package // error at public // B.private.B // no error - function checkGrammarHeritageClauseElementInStrictMode(expression) { + function checkGrammarExpressionWithTypeArgumentsInStrictMode(expression) { // Example: // class C extends public // error at public if (expression && expression.kind === 65 /* Identifier */) { return checkGrammarIdentifierInStrictMode(expression); } - else if (expression && expression.kind === 155 /* PropertyAccessExpression */) { + else if (expression && expression.kind === 156 /* PropertyAccessExpression */) { // Walk from left to right in PropertyAccessExpression until we are at the left most expression // in PropertyAccessExpression. According to grammar production of MemberExpression, // the left component expression is a PrimaryExpression (i.e. Identifier) while the other // component after dots can be IdentifierName. - checkGrammarHeritageClauseElementInStrictMode(expression.expression); + checkGrammarExpressionWithTypeArgumentsInStrictMode(expression.expression); } } // The function takes an identifier itself or an expression which has SyntaxKind.Identifier. @@ -21683,7 +21777,7 @@ var ts; else if (languageVersion < 1 /* ES5 */) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher); } - else if (node.kind === 136 /* GetAccessor */ || node.kind === 137 /* SetAccessor */) { + else if (node.kind === 137 /* GetAccessor */ || node.kind === 138 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -21693,26 +21787,26 @@ var ts; } function checkGrammarModifiers(node) { switch (node.kind) { - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 135 /* Constructor */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 140 /* IndexSignature */: - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 205 /* ModuleDeclaration */: - case 204 /* EnumDeclaration */: - case 180 /* VariableStatement */: - case 200 /* FunctionDeclaration */: - case 203 /* TypeAliasDeclaration */: - case 209 /* ImportDeclaration */: - case 208 /* ImportEqualsDeclaration */: - case 215 /* ExportDeclaration */: - case 214 /* ExportAssignment */: - case 129 /* Parameter */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 136 /* Constructor */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 141 /* IndexSignature */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 206 /* ModuleDeclaration */: + case 205 /* EnumDeclaration */: + case 181 /* VariableStatement */: + case 201 /* FunctionDeclaration */: + case 204 /* TypeAliasDeclaration */: + case 210 /* ImportDeclaration */: + case 209 /* ImportEqualsDeclaration */: + case 216 /* ExportDeclaration */: + case 215 /* ExportAssignment */: + case 130 /* Parameter */: break; default: return false; @@ -21746,7 +21840,7 @@ var ts; else if (flags & 128 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } - else if (node.parent.kind === 206 /* ModuleBlock */ || node.parent.kind === 227 /* SourceFile */) { + else if (node.parent.kind === 207 /* ModuleBlock */ || node.parent.kind === 228 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, text); } flags |= ts.modifierToFlag(modifier.kind); @@ -21755,10 +21849,10 @@ var ts; if (flags & 128 /* Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static"); } - else if (node.parent.kind === 206 /* ModuleBlock */ || node.parent.kind === 227 /* SourceFile */) { + else if (node.parent.kind === 207 /* ModuleBlock */ || node.parent.kind === 228 /* SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_element, "static"); } - else if (node.kind === 129 /* Parameter */) { + else if (node.kind === 130 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } flags |= 128 /* Static */; @@ -21771,10 +21865,10 @@ var ts; else if (flags & 2 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (node.parent.kind === 201 /* ClassDeclaration */) { + else if (node.parent.kind === 202 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export"); } - else if (node.kind === 129 /* Parameter */) { + else if (node.kind === 130 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* Export */; @@ -21783,13 +21877,13 @@ var ts; if (flags & 2 /* Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (node.parent.kind === 201 /* ClassDeclaration */) { + else if (node.parent.kind === 202 /* ClassDeclaration */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare"); } - else if (node.kind === 129 /* Parameter */) { + else if (node.kind === 130 /* Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 206 /* ModuleBlock */) { + else if (ts.isInAmbientContext(node.parent) && node.parent.kind === 207 /* ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } flags |= 2 /* Ambient */; @@ -21797,7 +21891,7 @@ var ts; break; } } - if (node.kind === 135 /* Constructor */) { + if (node.kind === 136 /* Constructor */) { if (flags & 128 /* Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -21808,13 +21902,13 @@ var ts; return grammarErrorOnNode(lastPrivate, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "private"); } } - else if ((node.kind === 209 /* ImportDeclaration */ || node.kind === 208 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + else if ((node.kind === 210 /* ImportDeclaration */ || node.kind === 209 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 202 /* InterfaceDeclaration */ && flags & 2 /* Ambient */) { + else if (node.kind === 203 /* InterfaceDeclaration */ && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_declare_modifier_cannot_be_used_with_an_interface_declaration, "declare"); } - else if (node.kind === 129 /* Parameter */ && (flags & 112 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 130 /* Parameter */ && (flags & 112 /* AccessibilityModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_a_binding_pattern); } } @@ -21878,7 +21972,7 @@ var ts; checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file); } function checkGrammarArrowFunction(node, file) { - if (node.kind === 163 /* ArrowFunction */) { + if (node.kind === 164 /* ArrowFunction */) { var arrowFunction = node; var startLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.pos).line; var endLine = ts.getLineAndCharacterOfPosition(file, arrowFunction.equalsGreaterThanToken.end).line; @@ -21913,7 +22007,7 @@ var ts; if (!parameter.type) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - if (parameter.type.kind !== 121 /* StringKeyword */ && parameter.type.kind !== 119 /* NumberKeyword */) { + if (parameter.type.kind !== 122 /* StringKeyword */ && parameter.type.kind !== 120 /* NumberKeyword */) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { @@ -21946,7 +22040,7 @@ var ts; var sourceFile = ts.getSourceFileOfNode(node); for (var _i = 0; _i < arguments.length; _i++) { var arg = arguments[_i]; - if (arg.kind === 175 /* OmittedExpression */) { + if (arg.kind === 176 /* OmittedExpression */) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } } @@ -22020,11 +22114,11 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 127 /* ComputedPropertyName */) { + if (node.kind !== 128 /* ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 169 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 23 /* CommaToken */) { + if (computedPropertyName.expression.kind === 170 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 23 /* CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } @@ -22052,8 +22146,8 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; var name_13 = prop.name; - if (prop.kind === 175 /* OmittedExpression */ || - name_13.kind === 127 /* ComputedPropertyName */) { + if (prop.kind === 176 /* OmittedExpression */ || + name_13.kind === 128 /* ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name_13); continue; @@ -22067,7 +22161,7 @@ var ts; // d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; - if (prop.kind === 224 /* PropertyAssignment */ || prop.kind === 225 /* ShorthandPropertyAssignment */) { + if (prop.kind === 225 /* PropertyAssignment */ || prop.kind === 226 /* ShorthandPropertyAssignment */) { // Grammar checking for computedPropertName and shorthandPropertyAssignment checkGrammarForInvalidQuestionMark(prop, prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name_13.kind === 7 /* NumericLiteral */) { @@ -22075,13 +22169,13 @@ var ts; } currentKind = Property; } - else if (prop.kind === 134 /* MethodDeclaration */) { + else if (prop.kind === 135 /* MethodDeclaration */) { currentKind = Property; } - else if (prop.kind === 136 /* GetAccessor */) { + else if (prop.kind === 137 /* GetAccessor */) { currentKind = GetAccessor; } - else if (prop.kind === 137 /* SetAccessor */) { + else if (prop.kind === 138 /* SetAccessor */) { currentKind = SetAccesor; } else { @@ -22115,24 +22209,24 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.initializer.kind === 199 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 200 /* VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 187 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 188 /* ForInStatement */ ? 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 === 187 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 188 /* ForInStatement */ ? 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 === 187 /* ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 188 /* ForInStatement */ ? 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); @@ -22155,10 +22249,10 @@ var ts; else if (accessor.typeParameters) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } - else if (kind === 136 /* GetAccessor */ && accessor.parameters.length) { + else if (kind === 137 /* GetAccessor */ && accessor.parameters.length) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_get_accessor_cannot_have_parameters); } - else if (kind === 137 /* SetAccessor */) { + else if (kind === 138 /* SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -22183,7 +22277,7 @@ var ts; } } function checkGrammarForNonSymbolComputedProperty(node, message) { - if (node.kind === 127 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(node.expression)) { + if (node.kind === 128 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(node.expression)) { return grammarErrorOnNode(node, message); } } @@ -22193,7 +22287,7 @@ var ts; checkGrammarForGenerator(node)) { return true; } - if (node.parent.kind === 154 /* ObjectLiteralExpression */) { + if (node.parent.kind === 155 /* ObjectLiteralExpression */) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -22201,7 +22295,7 @@ var ts; return grammarErrorAtPos(getSourceFile(node), node.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } - if (node.parent.kind === 201 /* ClassDeclaration */) { + if (node.parent.kind === 202 /* ClassDeclaration */) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, ts.Diagnostics.A_class_member_cannot_be_declared_optional)) { return true; } @@ -22217,22 +22311,22 @@ var ts; 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 === 202 /* InterfaceDeclaration */) { + else if (node.parent.kind === 203 /* InterfaceDeclaration */) { 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 === 145 /* TypeLiteral */) { + else if (node.parent.kind === 146 /* TypeLiteral */) { 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 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 184 /* DoStatement */: - case 185 /* WhileStatement */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 185 /* DoStatement */: + case 186 /* WhileStatement */: return true; - case 194 /* LabeledStatement */: + case 195 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -22244,11 +22338,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 194 /* LabeledStatement */: + case 195 /* LabeledStatement */: if (node.label && current.label.text === node.label.text) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 189 /* ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 190 /* ContinueStatement */ && !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); @@ -22256,8 +22350,8 @@ var ts; return false; } break; - case 193 /* SwitchStatement */: - if (node.kind === 190 /* BreakStatement */ && !node.label) { + case 194 /* SwitchStatement */: + if (node.kind === 191 /* BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -22272,13 +22366,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 190 /* BreakStatement */ + var message = node.kind === 191 /* BreakStatement */ ? 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 === 190 /* BreakStatement */ + var message = node.kind === 191 /* BreakStatement */ ? 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); @@ -22290,7 +22384,7 @@ var ts; if (node !== elements[elements.length - 1]) { return grammarErrorOnNode(node, ts.Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } - if (node.name.kind === 151 /* ArrayBindingPattern */ || node.name.kind === 150 /* ObjectBindingPattern */) { + if (node.name.kind === 152 /* ArrayBindingPattern */ || node.name.kind === 151 /* ObjectBindingPattern */) { return grammarErrorOnNode(node.name, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern); } if (node.initializer) { @@ -22303,7 +22397,7 @@ var ts; return checkGrammarEvalOrArgumentsInStrictMode(node, node.name); } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 187 /* ForInStatement */ && node.parent.parent.kind !== 188 /* ForOfStatement */) { + if (node.parent.parent.kind !== 188 /* ForInStatement */ && node.parent.parent.kind !== 189 /* ForOfStatement */) { if (ts.isInAmbientContext(node)) { if (node.initializer) { // Error on equals token which immediate precedes the initializer @@ -22340,7 +22434,7 @@ var ts; var elements = name.elements; for (var _i = 0; _i < elements.length; _i++) { var element = elements[_i]; - if (element.kind !== 175 /* OmittedExpression */) { + if (element.kind !== 176 /* OmittedExpression */) { checkGrammarNameInLetOrConstDeclarations(element.name); } } @@ -22357,15 +22451,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 183 /* IfStatement */: - case 184 /* DoStatement */: - case 185 /* WhileStatement */: - case 192 /* WithStatement */: - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: + case 184 /* IfStatement */: + case 185 /* DoStatement */: + case 186 /* WhileStatement */: + case 193 /* WithStatement */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: return false; - case 194 /* LabeledStatement */: + case 195 /* LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -22381,7 +22475,7 @@ var ts; } } function isIntegerLiteral(expression) { - if (expression.kind === 167 /* PrefixUnaryExpression */) { + if (expression.kind === 168 /* PrefixUnaryExpression */) { var unaryExpression = expression; if (unaryExpression.operator === 33 /* PlusToken */ || unaryExpression.operator === 34 /* MinusToken */) { expression = unaryExpression.operand; @@ -22410,7 +22504,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 127 /* ComputedPropertyName */) { + if (node.name.kind === 128 /* ComputedPropertyName */) { hasError = grammarErrorOnNode(node.name, ts.Diagnostics.Computed_property_names_are_not_allowed_in_enums); } else if (inAmbientContext) { @@ -22483,18 +22577,18 @@ var ts; } } function checkGrammarProperty(node) { - if (node.parent.kind === 201 /* ClassDeclaration */) { + if (node.parent.kind === 202 /* ClassDeclaration */) { 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 === 202 /* InterfaceDeclaration */) { + else if (node.parent.kind === 203 /* InterfaceDeclaration */) { 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 === 145 /* TypeLiteral */) { + else if (node.parent.kind === 146 /* TypeLiteral */) { if (checkGrammarForNonSymbolComputedProperty(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } @@ -22514,11 +22608,11 @@ var ts; // export_opt ExternalImportDeclaration // export_opt AmbientDeclaration // - if (node.kind === 202 /* InterfaceDeclaration */ || - node.kind === 209 /* ImportDeclaration */ || - node.kind === 208 /* ImportEqualsDeclaration */ || - node.kind === 215 /* ExportDeclaration */ || - node.kind === 214 /* ExportAssignment */ || + if (node.kind === 203 /* InterfaceDeclaration */ || + node.kind === 210 /* ImportDeclaration */ || + node.kind === 209 /* ImportEqualsDeclaration */ || + node.kind === 216 /* ExportDeclaration */ || + node.kind === 215 /* ExportAssignment */ || (node.flags & 2 /* Ambient */) || (node.flags & (1 /* Export */ | 256 /* Default */))) { return false; @@ -22528,7 +22622,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 180 /* VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 181 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -22554,7 +22648,7 @@ var ts; // to prevent noisyness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 179 /* Block */ || node.parent.kind === 206 /* ModuleBlock */ || node.parent.kind === 227 /* SourceFile */) { + if (node.parent.kind === 180 /* Block */ || node.parent.kind === 207 /* ModuleBlock */ || node.parent.kind === 228 /* SourceFile */) { var links_1 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_1.hasReportedStatementInAmbientContext) { @@ -22644,7 +22738,7 @@ var ts; var oldWriter = writer; ts.forEach(moduleElementDeclarationEmitInfo, function (aliasEmitInfo) { if (aliasEmitInfo.isVisible) { - ts.Debug.assert(aliasEmitInfo.node.kind === 209 /* ImportDeclaration */); + ts.Debug.assert(aliasEmitInfo.node.kind === 210 /* ImportDeclaration */); createAndSetNewTextWriterWithSymbolWriter(); ts.Debug.assert(aliasEmitInfo.indent === 0); writeImportDeclaration(aliasEmitInfo.node); @@ -22720,10 +22814,10 @@ var ts; var oldWriter = writer; ts.forEach(nodes, function (declaration) { var nodeToCheck; - if (declaration.kind === 198 /* VariableDeclaration */) { + if (declaration.kind === 199 /* VariableDeclaration */) { nodeToCheck = declaration.parent.parent; } - else if (declaration.kind === 212 /* NamedImports */ || declaration.kind === 213 /* ImportSpecifier */ || declaration.kind === 210 /* ImportClause */) { + else if (declaration.kind === 213 /* NamedImports */ || declaration.kind === 214 /* ImportSpecifier */ || declaration.kind === 211 /* ImportClause */) { ts.Debug.fail("We should be getting ImportDeclaration instead to write"); } else { @@ -22741,7 +22835,7 @@ var ts; // 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 (moduleElementEmitInfo) { - if (moduleElementEmitInfo.node.kind === 209 /* ImportDeclaration */) { + if (moduleElementEmitInfo.node.kind === 210 /* ImportDeclaration */) { // we have to create asynchronous output only after we have collected complete information // because it is possible to enable multiple bindings as asynchronously visible moduleElementEmitInfo.isVisible = true; @@ -22751,12 +22845,12 @@ var ts; for (var declarationIndent = moduleElementEmitInfo.indent; declarationIndent; declarationIndent--) { increaseIndent(); } - if (nodeToCheck.kind === 205 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 206 /* ModuleDeclaration */) { ts.Debug.assert(asynchronousSubModuleDeclarationEmitInfo === undefined); asynchronousSubModuleDeclarationEmitInfo = []; } writeModuleElement(nodeToCheck); - if (nodeToCheck.kind === 205 /* ModuleDeclaration */) { + if (nodeToCheck.kind === 206 /* ModuleDeclaration */) { moduleElementEmitInfo.subModuleElementDeclarationEmitInfo = asynchronousSubModuleDeclarationEmitInfo; asynchronousSubModuleDeclarationEmitInfo = undefined; } @@ -22849,41 +22943,41 @@ var ts; function emitType(type) { switch (type.kind) { case 112 /* AnyKeyword */: - case 121 /* StringKeyword */: - case 119 /* NumberKeyword */: + case 122 /* StringKeyword */: + case 120 /* NumberKeyword */: case 113 /* BooleanKeyword */: - case 122 /* SymbolKeyword */: + case 123 /* SymbolKeyword */: case 99 /* VoidKeyword */: case 8 /* StringLiteral */: return writeTextOfNode(currentSourceFile, type); - case 177 /* HeritageClauseElement */: - return emitHeritageClauseElement(type); - case 141 /* TypeReference */: + case 177 /* ExpressionWithTypeArguments */: + return emitExpressionWithTypeArguments(type); + case 142 /* TypeReference */: return emitTypeReference(type); - case 144 /* TypeQuery */: + case 145 /* TypeQuery */: return emitTypeQuery(type); - case 146 /* ArrayType */: + case 147 /* ArrayType */: return emitArrayType(type); - case 147 /* TupleType */: + case 148 /* TupleType */: return emitTupleType(type); - case 148 /* UnionType */: + case 149 /* UnionType */: return emitUnionType(type); - case 149 /* ParenthesizedType */: + case 150 /* ParenthesizedType */: return emitParenType(type); - case 142 /* FunctionType */: - case 143 /* ConstructorType */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: return emitSignatureDeclarationWithJsDocComments(type); - case 145 /* TypeLiteral */: + case 146 /* TypeLiteral */: return emitTypeLiteral(type); case 65 /* Identifier */: return emitEntityName(type); - case 126 /* QualifiedName */: + case 127 /* QualifiedName */: return emitEntityName(type); } function emitEntityName(entityName) { var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration - entityName.parent.kind === 208 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); + entityName.parent.kind === 209 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); handleSymbolAccessibilityError(visibilityResult); writeEntityName(entityName); function writeEntityName(entityName) { @@ -22891,17 +22985,17 @@ var ts; writeTextOfNode(currentSourceFile, entityName); } else { - var left = entityName.kind === 126 /* QualifiedName */ ? entityName.left : entityName.expression; - var right = entityName.kind === 126 /* QualifiedName */ ? entityName.right : entityName.name; + var left = entityName.kind === 127 /* QualifiedName */ ? entityName.left : entityName.expression; + var right = entityName.kind === 127 /* QualifiedName */ ? entityName.right : entityName.name; writeEntityName(left); write("."); writeTextOfNode(currentSourceFile, right); } } } - function emitHeritageClauseElement(node) { - if (ts.isSupportedHeritageClauseElement(node)) { - ts.Debug.assert(node.expression.kind === 65 /* Identifier */ || node.expression.kind === 155 /* PropertyAccessExpression */); + function emitExpressionWithTypeArguments(node) { + if (ts.isSupportedExpressionWithTypeArguments(node)) { + ts.Debug.assert(node.expression.kind === 65 /* Identifier */ || node.expression.kind === 156 /* PropertyAccessExpression */); emitEntityName(node.expression); if (node.typeArguments) { write("<"); @@ -23013,10 +23107,10 @@ var ts; if (isModuleElementVisible) { writeModuleElement(node); } - else if (node.kind === 208 /* ImportEqualsDeclaration */ || - (node.parent.kind === 227 /* SourceFile */ && ts.isExternalModule(currentSourceFile))) { + else if (node.kind === 209 /* ImportEqualsDeclaration */ || + (node.parent.kind === 228 /* SourceFile */ && ts.isExternalModule(currentSourceFile))) { var isVisible; - if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 227 /* SourceFile */) { + if (asynchronousSubModuleDeclarationEmitInfo && node.parent.kind !== 228 /* SourceFile */) { // Import declaration of another module that is visited async so lets put it in right spot asynchronousSubModuleDeclarationEmitInfo.push({ node: node, @@ -23026,7 +23120,7 @@ var ts; }); } else { - if (node.kind === 209 /* ImportDeclaration */) { + if (node.kind === 210 /* ImportDeclaration */) { var importDeclaration = node; if (importDeclaration.importClause) { isVisible = (importDeclaration.importClause.name && resolver.isDeclarationVisible(importDeclaration.importClause)) || @@ -23044,23 +23138,23 @@ var ts; } function writeModuleElement(node) { switch (node.kind) { - case 200 /* FunctionDeclaration */: + case 201 /* FunctionDeclaration */: return writeFunctionDeclaration(node); - case 180 /* VariableStatement */: + case 181 /* VariableStatement */: return writeVariableStatement(node); - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: return writeInterfaceDeclaration(node); - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: return writeClassDeclaration(node); - case 203 /* TypeAliasDeclaration */: + case 204 /* TypeAliasDeclaration */: return writeTypeAliasDeclaration(node); - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: return writeEnumDeclaration(node); - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: return writeModuleDeclaration(node); - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: return writeImportEqualsDeclaration(node); - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: return writeImportDeclaration(node); default: ts.Debug.fail("Unknown symbol kind"); @@ -23076,7 +23170,7 @@ var ts; if (node.flags & 256 /* Default */) { write("default "); } - else if (node.kind !== 202 /* InterfaceDeclaration */) { + else if (node.kind !== 203 /* InterfaceDeclaration */) { write("declare "); } } @@ -23122,7 +23216,7 @@ var ts; } function isVisibleNamedBinding(namedBindings) { if (namedBindings) { - if (namedBindings.kind === 211 /* NamespaceImport */) { + if (namedBindings.kind === 212 /* NamespaceImport */) { return resolver.isDeclarationVisible(namedBindings); } else { @@ -23150,7 +23244,7 @@ var ts; // If the default binding was emitted, write the separated write(", "); } - if (node.importClause.namedBindings.kind === 211 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 212 /* NamespaceImport */) { write("* as "); writeTextOfNode(currentSourceFile, node.importClause.namedBindings.name); } @@ -23203,7 +23297,7 @@ var ts; emitModuleElementDeclarationFlags(node); write("module "); writeTextOfNode(currentSourceFile, node.name); - while (node.body.kind !== 206 /* ModuleBlock */) { + while (node.body.kind !== 207 /* ModuleBlock */) { node = node.body; write("."); writeTextOfNode(currentSourceFile, node.name); @@ -23264,7 +23358,7 @@ var ts; writeLine(); } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 134 /* MethodDeclaration */ && (node.parent.flags & 32 /* Private */); + return node.parent.kind === 135 /* MethodDeclaration */ && (node.parent.flags & 32 /* Private */); } function emitTypeParameters(typeParameters) { function emitTypeParameter(node) { @@ -23275,15 +23369,15 @@ var ts; // If there is constraint present and this is not a type parameter of the private method emit the constraint if (node.constraint && !isPrivateMethodTypeParameter(node)) { write(" extends "); - if (node.parent.kind === 142 /* FunctionType */ || - node.parent.kind === 143 /* ConstructorType */ || - (node.parent.parent && node.parent.parent.kind === 145 /* TypeLiteral */)) { - ts.Debug.assert(node.parent.kind === 134 /* MethodDeclaration */ || - node.parent.kind === 133 /* MethodSignature */ || - node.parent.kind === 142 /* FunctionType */ || - node.parent.kind === 143 /* ConstructorType */ || - node.parent.kind === 138 /* CallSignature */ || - node.parent.kind === 139 /* ConstructSignature */); + if (node.parent.kind === 143 /* FunctionType */ || + node.parent.kind === 144 /* ConstructorType */ || + (node.parent.parent && node.parent.parent.kind === 146 /* TypeLiteral */)) { + ts.Debug.assert(node.parent.kind === 135 /* MethodDeclaration */ || + node.parent.kind === 134 /* MethodSignature */ || + node.parent.kind === 143 /* FunctionType */ || + node.parent.kind === 144 /* ConstructorType */ || + node.parent.kind === 139 /* CallSignature */ || + node.parent.kind === 140 /* ConstructSignature */); emitType(node.constraint); } else { @@ -23294,31 +23388,31 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 139 /* ConstructSignature */: + case 140 /* ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 138 /* CallSignature */: + case 139 /* CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: if (node.parent.flags & 128 /* Static */) { 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 === 201 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 202 /* ClassDeclaration */) { 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 200 /* FunctionDeclaration */: + case 201 /* FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; default: @@ -23343,13 +23437,13 @@ var ts; emitCommaList(typeReferences, emitTypeOfTypeReference); } function emitTypeOfTypeReference(node) { - if (ts.isSupportedHeritageClauseElement(node)) { + if (ts.isSupportedExpressionWithTypeArguments(node)) { emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError); } function getHeritageClauseVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; // Heritage clause is written by user so it can always be named - if (node.parent.parent.kind === 201 /* ClassDeclaration */) { + if (node.parent.parent.kind === 202 /* ClassDeclaration */) { // Class or Interface implemented/extended is inaccessible diagnosticMessage = isImplementsList ? ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : @@ -23430,7 +23524,7 @@ var ts; function emitVariableDeclaration(node) { // If we are emitting property it isn't moduleElement and hence we already know it needs to be emitted // so there is no check needed to see if declaration is visible - if (node.kind !== 198 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { + if (node.kind !== 199 /* VariableDeclaration */ || resolver.isDeclarationVisible(node)) { if (ts.isBindingPattern(node.name)) { emitBindingPattern(node.name); } @@ -23440,10 +23534,10 @@ var ts; // what we want, namely the name expression enclosed in brackets. writeTextOfNode(currentSourceFile, node.name); // If optional property emit ? - if ((node.kind === 132 /* PropertyDeclaration */ || node.kind === 131 /* PropertySignature */) && ts.hasQuestionToken(node)) { + if ((node.kind === 133 /* PropertyDeclaration */ || node.kind === 132 /* PropertySignature */) && ts.hasQuestionToken(node)) { write("?"); } - if ((node.kind === 132 /* PropertyDeclaration */ || node.kind === 131 /* PropertySignature */) && node.parent.kind === 145 /* TypeLiteral */) { + if ((node.kind === 133 /* PropertyDeclaration */ || node.kind === 132 /* PropertySignature */) && node.parent.kind === 146 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.flags & 32 /* Private */)) { @@ -23452,14 +23546,14 @@ var ts; } } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { - if (node.kind === 198 /* VariableDeclaration */) { + if (node.kind === 199 /* VariableDeclaration */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? 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 === 132 /* PropertyDeclaration */ || node.kind === 131 /* PropertySignature */) { + else if (node.kind === 133 /* PropertyDeclaration */ || node.kind === 132 /* PropertySignature */) { // TODO(jfreeman): Deal with computed properties in error reporting. if (node.flags & 128 /* Static */) { return symbolAccesibilityResult.errorModuleName ? @@ -23468,7 +23562,7 @@ var ts; 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 === 201 /* ClassDeclaration */) { + else if (node.parent.kind === 202 /* ClassDeclaration */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23500,7 +23594,7 @@ var ts; var elements = []; for (var _i = 0, _a = bindingPattern.elements; _i < _a.length; _i++) { var element = _a[_i]; - if (element.kind !== 175 /* OmittedExpression */) { + if (element.kind !== 176 /* OmittedExpression */) { elements.push(element); } } @@ -23570,7 +23664,7 @@ var ts; var type = getTypeAnnotationFromAccessor(node); if (!type) { // couldn't get type for the first accessor, try the another one - var anotherAccessor = node.kind === 136 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; + var anotherAccessor = node.kind === 137 /* GetAccessor */ ? accessors.setAccessor : accessors.getAccessor; type = getTypeAnnotationFromAccessor(anotherAccessor); if (type) { accessorWithTypeAnnotation = anotherAccessor; @@ -23583,7 +23677,7 @@ var ts; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 136 /* GetAccessor */ + return accessor.kind === 137 /* GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -23592,7 +23686,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; - if (accessorWithTypeAnnotation.kind === 137 /* SetAccessor */) { + if (accessorWithTypeAnnotation.kind === 138 /* SetAccessor */) { // Setters have to have type named and cannot infer it so, the type should always be named if (accessorWithTypeAnnotation.parent.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? @@ -23642,17 +23736,17 @@ var ts; // so no need to verify if the declaration is visible if (!resolver.isImplementationOfOverload(node)) { emitJsDocComments(node); - if (node.kind === 200 /* FunctionDeclaration */) { + if (node.kind === 201 /* FunctionDeclaration */) { emitModuleElementDeclarationFlags(node); } - else if (node.kind === 134 /* MethodDeclaration */) { + else if (node.kind === 135 /* MethodDeclaration */) { emitClassMemberDeclarationFlags(node); } - if (node.kind === 200 /* FunctionDeclaration */) { + if (node.kind === 201 /* FunctionDeclaration */) { write("function "); writeTextOfNode(currentSourceFile, node.name); } - else if (node.kind === 135 /* Constructor */) { + else if (node.kind === 136 /* Constructor */) { write("constructor"); } else { @@ -23670,11 +23764,11 @@ var ts; } function emitSignatureDeclaration(node) { // Construct signature or constructor type write new Signature - if (node.kind === 139 /* ConstructSignature */ || node.kind === 143 /* ConstructorType */) { + if (node.kind === 140 /* ConstructSignature */ || node.kind === 144 /* ConstructorType */) { write("new "); } emitTypeParameters(node.typeParameters); - if (node.kind === 140 /* IndexSignature */) { + if (node.kind === 141 /* IndexSignature */) { write("["); } else { @@ -23684,22 +23778,22 @@ var ts; enclosingDeclaration = node; // Parameters emitCommaList(node.parameters, emitParameterDeclaration); - if (node.kind === 140 /* IndexSignature */) { + if (node.kind === 141 /* IndexSignature */) { write("]"); } else { write(")"); } // If this is not a constructor and is not private, emit the return type - var isFunctionTypeOrConstructorType = node.kind === 142 /* FunctionType */ || node.kind === 143 /* ConstructorType */; - if (isFunctionTypeOrConstructorType || node.parent.kind === 145 /* TypeLiteral */) { + var isFunctionTypeOrConstructorType = node.kind === 143 /* FunctionType */ || node.kind === 144 /* ConstructorType */; + if (isFunctionTypeOrConstructorType || node.parent.kind === 146 /* TypeLiteral */) { // Emit type literal signature return type only if specified if (node.type) { write(isFunctionTypeOrConstructorType ? " => " : ": "); emitType(node.type); } } - else if (node.kind !== 135 /* Constructor */ && !(node.flags & 32 /* Private */)) { + else if (node.kind !== 136 /* Constructor */ && !(node.flags & 32 /* Private */)) { writeReturnTypeAtSignature(node, getReturnTypeVisibilityError); } enclosingDeclaration = prevEnclosingDeclaration; @@ -23710,26 +23804,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccesibilityResult) { var diagnosticMessage; switch (node.kind) { - case 139 /* ConstructSignature */: + case 140 /* ConstructSignature */: // Interfaces cannot have return types that cannot be named 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 138 /* CallSignature */: + case 139 /* CallSignature */: // Interfaces cannot have return types that cannot be named 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 140 /* IndexSignature */: + case 141 /* IndexSignature */: // Interfaces cannot have return types that cannot be named 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 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: if (node.flags & 128 /* Static */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -23737,7 +23831,7 @@ var ts; 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 === 201 /* ClassDeclaration */) { + else if (node.parent.kind === 202 /* ClassDeclaration */) { diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -23751,7 +23845,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 200 /* FunctionDeclaration */: + case 201 /* FunctionDeclaration */: diagnosticMessage = symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -23786,9 +23880,9 @@ var ts; write("?"); } decreaseIndent(); - if (node.parent.kind === 142 /* FunctionType */ || - node.parent.kind === 143 /* ConstructorType */ || - node.parent.parent.kind === 145 /* TypeLiteral */) { + if (node.parent.kind === 143 /* FunctionType */ || + node.parent.kind === 144 /* ConstructorType */ || + node.parent.parent.kind === 146 /* TypeLiteral */) { emitTypeOfVariableDeclarationFromTypeLiteral(node); } else if (!(node.parent.flags & 32 /* Private */)) { @@ -23804,24 +23898,24 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult) { switch (node.parent.kind) { - case 135 /* Constructor */: + case 136 /* Constructor */: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? 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; - case 139 /* ConstructSignature */: + case 140 /* ConstructSignature */: // Interfaces cannot have parameter types that cannot be named return 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; - case 138 /* CallSignature */: + case 139 /* CallSignature */: // Interfaces cannot have parameter types that cannot be named return 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; - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: if (node.parent.flags & 128 /* Static */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? @@ -23829,7 +23923,7 @@ var ts; 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 === 201 /* ClassDeclaration */) { + else if (node.parent.parent.kind === 202 /* ClassDeclaration */) { return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23842,7 +23936,7 @@ var ts; 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; } - case 200 /* FunctionDeclaration */: + case 201 /* FunctionDeclaration */: return symbolAccesibilityResult.errorModuleName ? symbolAccesibilityResult.accessibility === 2 /* CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -23854,12 +23948,12 @@ var ts; } function emitBindingPattern(bindingPattern) { // We have to explicitly emit square bracket and bracket because these tokens are not store inside the node. - if (bindingPattern.kind === 150 /* ObjectBindingPattern */) { + if (bindingPattern.kind === 151 /* ObjectBindingPattern */) { write("{"); emitCommaList(bindingPattern.elements, emitBindingElement); write("}"); } - else if (bindingPattern.kind === 151 /* ArrayBindingPattern */) { + else if (bindingPattern.kind === 152 /* ArrayBindingPattern */) { write("["); var elements = bindingPattern.elements; emitCommaList(elements, emitBindingElement); @@ -23878,7 +23972,7 @@ var ts; typeName: bindingElement.name } : undefined; } - if (bindingElement.kind === 175 /* OmittedExpression */) { + if (bindingElement.kind === 176 /* OmittedExpression */) { // If bindingElement is an omittedExpression (i.e. containing elision), // we will emit blank space (although this may differ from users' original code, // it allows emitSeparatedList to write separator appropriately) @@ -23887,7 +23981,7 @@ var ts; // emit : function foo([ , x, , ]) {} write(" "); } - else if (bindingElement.kind === 152 /* BindingElement */) { + else if (bindingElement.kind === 153 /* BindingElement */) { if (bindingElement.propertyName) { // bindingElement has propertyName property in the following case: // { y: [a,b,c] ...} -> bindingPattern will have a property called propertyName for "y" @@ -23928,40 +24022,40 @@ var ts; } function emitNode(node) { switch (node.kind) { - case 200 /* FunctionDeclaration */: - case 205 /* ModuleDeclaration */: - case 208 /* ImportEqualsDeclaration */: - case 202 /* InterfaceDeclaration */: - case 201 /* ClassDeclaration */: - case 203 /* TypeAliasDeclaration */: - case 204 /* EnumDeclaration */: + case 201 /* FunctionDeclaration */: + case 206 /* ModuleDeclaration */: + case 209 /* ImportEqualsDeclaration */: + case 203 /* InterfaceDeclaration */: + case 202 /* ClassDeclaration */: + case 204 /* TypeAliasDeclaration */: + case 205 /* EnumDeclaration */: return emitModuleElement(node, isModuleElementVisible(node)); - case 180 /* VariableStatement */: + case 181 /* VariableStatement */: return emitModuleElement(node, isVariableStatementVisible(node)); - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: // Import declaration without import clause is visible, otherwise it is not visible return emitModuleElement(node, !node.importClause); - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: return emitExportDeclaration(node); - case 135 /* Constructor */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 136 /* Constructor */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: return writeFunctionDeclaration(node); - case 139 /* ConstructSignature */: - case 138 /* CallSignature */: - case 140 /* IndexSignature */: + case 140 /* ConstructSignature */: + case 139 /* CallSignature */: + case 141 /* IndexSignature */: return emitSignatureDeclarationWithJsDocComments(node); - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: return emitAccessorDeclaration(node); - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: return emitPropertyDeclaration(node); - case 226 /* EnumMember */: + case 227 /* EnumMember */: return emitEnumMemberDeclaration(node); - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: return emitExportAssignment(node); - case 227 /* SourceFile */: + case 228 /* SourceFile */: return emitSourceFile(node); } } @@ -24018,21 +24112,20 @@ var ts; TempFlags[TempFlags["Auto"] = 0] = "Auto"; TempFlags[TempFlags["CountMask"] = 268435455] = "CountMask"; TempFlags[TempFlags["_i"] = 268435456] = "_i"; - TempFlags[TempFlags["_n"] = 536870912] = "_n"; })(TempFlags || (TempFlags = {})); // targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature function emitFiles(resolver, host, targetSourceFile) { // emit output for the __extends helper function - var extendsHelper = "\nvar __extends = this.__extends || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n __.prototype = b.prototype;\n d.prototype = new __();\n};"; + var extendsHelper = "\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n __.prototype = b.prototype;\n d.prototype = new __();\n};"; // emit output for the __decorate helper function - var decorateHelper = "\nif (typeof __decorate !== \"function\") __decorate = function (decorators, target, key, desc) {\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") return Reflect.decorate(decorators, target, key, desc);\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; + var decorateHelper = "\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") return Reflect.decorate(decorators, target, key, desc);\n switch (arguments.length) {\n case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);\n case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);\n case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);\n }\n};"; // emit output for the __metadata helper function - var metadataHelper = "\nif (typeof __metadata !== \"function\") __metadata = function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; + var metadataHelper = "\nvar __metadata = (this && this.__metadata) || function (k, v) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(k, v);\n};"; // emit output for the __param helper function - var paramHelper = "\nif (typeof __param !== \"function\") __param = function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; + var paramHelper = "\nvar __param = (this && this.__param) || function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n};"; var compilerOptions = host.getCompilerOptions(); var languageVersion = compilerOptions.target || 0 /* ES3 */; - var sourceMapDataList = compilerOptions.sourceMap ? [] : undefined; + var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? [] : undefined; var diagnostics = []; var newLine = host.getNewLine(); if (targetSourceFile === undefined) { @@ -24090,6 +24183,13 @@ var ts; var increaseIndent = writer.increaseIndent; var decreaseIndent = writer.decreaseIndent; var currentSourceFile; + // name of an exporter function if file is a System external module + // System.register([...], function () {...}) + // exporting in System modules looks like: + // export var x; ... x = 1 + // => + // var x;... exporter("x", x = 1) + var exportFunctionForFile; var generatedNameSet = {}; var nodeToGeneratedName = []; var blockScopedVariableToGeneratedName; @@ -24129,7 +24229,7 @@ var ts; var scopeEmitEnd = function () { }; /** Sourcemap data that will get encoded */ var sourceMapData; - if (compilerOptions.sourceMap) { + if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) { initializeEmitterWithSourceMaps(); } if (root) { @@ -24148,6 +24248,7 @@ var ts; return; function emitSourceFile(sourceFile) { currentSourceFile = sourceFile; + exportFunctionForFile = undefined; emit(sourceFile); } function isUniqueName(name) { @@ -24234,25 +24335,25 @@ var ts; } function generateNameForNode(node) { switch (node.kind) { - case 200 /* FunctionDeclaration */: - case 201 /* ClassDeclaration */: - case 174 /* ClassExpression */: + case 201 /* FunctionDeclaration */: + case 202 /* ClassDeclaration */: + case 175 /* ClassExpression */: generateNameForFunctionOrClassDeclaration(node); break; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: generateNameForModuleOrEnum(node); generateNameForNode(node.body); break; - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: generateNameForModuleOrEnum(node); break; - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: generateNameForImportDeclaration(node); break; - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: generateNameForExportDeclaration(node); break; - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: generateNameForExportAssignment(node); break; } @@ -24408,6 +24509,12 @@ var ts; sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1; // The one that can be used from program to get the actual source file sourceMapData.inputSourceFileNames.push(node.fileName); + if (compilerOptions.inlineSources) { + if (!sourceMapData.sourceMapSourcesContent) { + sourceMapData.sourceMapSourcesContent = []; + } + sourceMapData.sourceMapSourcesContent.push(node.text); + } } function recordScopeNameOfNode(node, scopeName) { function recordScopeNameIndex(scopeNameIndex) { @@ -24422,7 +24529,7 @@ var ts; // unless it is a computed property. Then it is shown with brackets, // but the brackets are included in the name. var name_17 = node.name; - if (!name_17 || name_17.kind !== 127 /* ComputedPropertyName */) { + if (!name_17 || name_17.kind !== 128 /* ComputedPropertyName */) { scopeName = "." + scopeName; } scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName; @@ -24440,20 +24547,20 @@ var ts; // The scope was already given a name use it recordScopeNameStart(scopeName); } - else if (node.kind === 200 /* FunctionDeclaration */ || - node.kind === 162 /* FunctionExpression */ || - node.kind === 134 /* MethodDeclaration */ || - node.kind === 133 /* MethodSignature */ || - node.kind === 136 /* GetAccessor */ || - node.kind === 137 /* SetAccessor */ || - node.kind === 205 /* ModuleDeclaration */ || - node.kind === 201 /* ClassDeclaration */ || - node.kind === 204 /* EnumDeclaration */) { + else if (node.kind === 201 /* FunctionDeclaration */ || + node.kind === 163 /* FunctionExpression */ || + node.kind === 135 /* MethodDeclaration */ || + node.kind === 134 /* MethodSignature */ || + node.kind === 137 /* GetAccessor */ || + node.kind === 138 /* SetAccessor */ || + node.kind === 206 /* ModuleDeclaration */ || + node.kind === 202 /* ClassDeclaration */ || + node.kind === 205 /* EnumDeclaration */) { // Declaration and has associated name use it if (node.name) { var name_18 = node.name; // For computed property names, the text will include the brackets - scopeName = name_18.kind === 127 /* ComputedPropertyName */ + scopeName = name_18.kind === 128 /* ComputedPropertyName */ ? ts.getTextOfNode(name_18) : node.name.text; } @@ -24473,18 +24580,22 @@ var ts; ts.writeCommentRange(currentSourceFile, writer, comment, newLine); recordSourceMapSpan(comment.end); } - function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings) { + function serializeSourceMapContents(version, file, sourceRoot, sources, names, mappings, sourcesContent) { if (typeof JSON !== "undefined") { - return JSON.stringify({ + var map_1 = { version: version, file: file, sourceRoot: sourceRoot, sources: sources, names: names, mappings: mappings - }); + }; + if (sourcesContent !== undefined) { + map_1.sourcesContent = sourcesContent; + } + return JSON.stringify(map_1); } - return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\"}"; + return "{\"version\":" + version + ",\"file\":\"" + ts.escapeString(file) + "\",\"sourceRoot\":\"" + ts.escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + ts.escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}"; function serializeStringArray(list) { var output = ""; for (var i = 0, n = list.length; i < n; i++) { @@ -24497,12 +24608,22 @@ var ts; } } function writeJavaScriptAndSourceMapFile(emitOutput, writeByteOrderMark) { - // Write source map file encodeLastRecordedSourceMapSpan(); - ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings), false); + var sourceMapText = serializeSourceMapContents(3, sourceMapData.sourceMapFile, sourceMapData.sourceMapSourceRoot, sourceMapData.sourceMapSources, sourceMapData.sourceMapNames, sourceMapData.sourceMapMappings, sourceMapData.sourceMapSourcesContent); sourceMapDataList.push(sourceMapData); + var sourceMapUrl; + if (compilerOptions.inlineSourceMap) { + // Encode the sourceMap into the sourceMap url + var base64SourceMapText = ts.convertToBase64(sourceMapText); + sourceMapUrl = "//# sourceMappingURL=data:application/json;base64," + base64SourceMapText; + } + else { + // Write source map file + ts.writeFile(host, diagnostics, sourceMapData.sourceMapFilePath, sourceMapText, false); + sourceMapUrl = "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL; + } // Write sourcemap url to the js file and write the js file - writeJavaScriptFile(emitOutput + "//# sourceMappingURL=" + sourceMapData.jsSourceMappingURL, writeByteOrderMark); + writeJavaScriptFile(emitOutput + sourceMapUrl, writeByteOrderMark); } // Initialize source map data var sourceMapJsFile = ts.getBaseFileName(ts.normalizeSlashes(jsFilePath)); @@ -24515,6 +24636,7 @@ var ts; inputSourceFileNames: [], sourceMapNames: [], sourceMapMappings: "", + sourceMapSourcesContent: undefined, sourceMapDecodedMappings: [] }; // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the @@ -24548,7 +24670,7 @@ var ts; if (ts.nodeIsSynthesized(node)) { return emitNodeWithoutSourceMap(node, false); } - if (node.kind != 227 /* SourceFile */) { + if (node.kind != 228 /* SourceFile */) { recordEmitNodeStartSpan(node); emitNodeWithoutSourceMap(node, allowGeneratedIdentifiers); recordEmitNodeEndSpan(node); @@ -24722,7 +24844,7 @@ var ts; } function emitLiteral(node) { var text = getLiteralText(node); - if (compilerOptions.sourceMap && (node.kind === 8 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { + if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === 8 /* StringLiteral */ || ts.isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } else if (languageVersion < 2 /* ES6 */ && isBinaryOrOctalIntegerLiteral(node, text)) { @@ -24811,10 +24933,10 @@ var ts; write("("); emit(tempVariable); // Now we emit the expressions - if (node.template.kind === 171 /* TemplateExpression */) { + if (node.template.kind === 172 /* TemplateExpression */) { ts.forEach(node.template.templateSpans, function (templateSpan) { write(", "); - var needsParens = templateSpan.expression.kind === 169 /* BinaryExpression */ + var needsParens = templateSpan.expression.kind === 170 /* BinaryExpression */ && templateSpan.expression.operatorToken.kind === 23 /* CommaToken */; emitParenthesizedIf(templateSpan.expression, needsParens); }); @@ -24849,7 +24971,7 @@ var ts; // ("abc" + 1) << (2 + "") // rather than // "abc" + (1 << 2) + "" - var needsParens = templateSpan.expression.kind !== 161 /* ParenthesizedExpression */ + var needsParens = templateSpan.expression.kind !== 162 /* ParenthesizedExpression */ && comparePrecedenceToBinaryPlus(templateSpan.expression) !== 1 /* GreaterThan */; if (i > 0 || headEmitted) { // If this is the first span and the head was not emitted, then this templateSpan's @@ -24891,11 +25013,11 @@ var ts; } function templateNeedsParens(template, parent) { switch (parent.kind) { - case 157 /* CallExpression */: - case 158 /* NewExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: return parent.expression === template; - case 159 /* TaggedTemplateExpression */: - case 161 /* ParenthesizedExpression */: + case 160 /* TaggedTemplateExpression */: + case 162 /* ParenthesizedExpression */: return false; default: return comparePrecedenceToBinaryPlus(parent) !== -1 /* LessThan */; @@ -24916,7 +25038,7 @@ var ts; // 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 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: switch (expression.operatorToken.kind) { case 35 /* AsteriskToken */: case 36 /* SlashToken */: @@ -24928,8 +25050,8 @@ var ts; default: return -1 /* LessThan */; } - case 172 /* YieldExpression */: - case 170 /* ConditionalExpression */: + case 173 /* YieldExpression */: + case 171 /* ConditionalExpression */: return -1 /* LessThan */; default: return 1 /* GreaterThan */; @@ -24944,11 +25066,11 @@ var ts; // 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) { - ts.Debug.assert(node.kind !== 152 /* BindingElement */); + ts.Debug.assert(node.kind !== 153 /* BindingElement */); if (node.kind === 8 /* StringLiteral */) { emitLiteral(node); } - else if (node.kind === 127 /* ComputedPropertyName */) { + else if (node.kind === 128 /* ComputedPropertyName */) { // if this is a decorated computed property, we will need to capture the result // of the property expression so that we can apply decorators later. This is to ensure // we don't introduce unintended side effects: @@ -24992,36 +25114,36 @@ var ts; function isNotExpressionIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 129 /* Parameter */: - case 198 /* VariableDeclaration */: - case 152 /* BindingElement */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 224 /* PropertyAssignment */: - case 225 /* ShorthandPropertyAssignment */: - case 226 /* EnumMember */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 200 /* FunctionDeclaration */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 162 /* FunctionExpression */: - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 204 /* EnumDeclaration */: - case 205 /* ModuleDeclaration */: - case 208 /* ImportEqualsDeclaration */: - case 210 /* ImportClause */: - case 211 /* NamespaceImport */: + case 130 /* Parameter */: + case 199 /* VariableDeclaration */: + case 153 /* BindingElement */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 225 /* PropertyAssignment */: + case 226 /* ShorthandPropertyAssignment */: + case 227 /* EnumMember */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 201 /* FunctionDeclaration */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 163 /* FunctionExpression */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 205 /* EnumDeclaration */: + case 206 /* ModuleDeclaration */: + case 209 /* ImportEqualsDeclaration */: + case 211 /* ImportClause */: + case 212 /* NamespaceImport */: return parent.name === node; - case 213 /* ImportSpecifier */: - case 217 /* ExportSpecifier */: + case 214 /* ImportSpecifier */: + case 218 /* ExportSpecifier */: return parent.name === node || parent.propertyName === node; - case 190 /* BreakStatement */: - case 189 /* ContinueStatement */: - case 214 /* ExportAssignment */: + case 191 /* BreakStatement */: + case 190 /* ContinueStatement */: + case 215 /* ExportAssignment */: return false; - case 194 /* LabeledStatement */: + case 195 /* LabeledStatement */: return node.parent.label === node; } } @@ -25129,11 +25251,11 @@ var ts; function needsParenthesisForPropertyAccessOrInvocation(node) { switch (node.kind) { case 65 /* Identifier */: - case 153 /* ArrayLiteralExpression */: - case 155 /* PropertyAccessExpression */: - case 156 /* ElementAccessExpression */: - case 157 /* CallExpression */: - case 161 /* ParenthesizedExpression */: + case 154 /* ArrayLiteralExpression */: + case 156 /* PropertyAccessExpression */: + case 157 /* ElementAccessExpression */: + case 158 /* CallExpression */: + case 162 /* ParenthesizedExpression */: // This list is not exhaustive and only includes those cases that are relevant // to the check in emitArrayLiteral. More cases can be added as needed. return false; @@ -25153,14 +25275,14 @@ var ts; write(", "); } var e = elements[pos]; - if (e.kind === 173 /* SpreadElementExpression */) { + if (e.kind === 174 /* SpreadElementExpression */) { e = e.expression; emitParenthesizedIf(e, group === 0 && needsParenthesisForPropertyAccessOrInvocation(e)); pos++; } else { var i = pos; - while (i < length && elements[i].kind !== 173 /* SpreadElementExpression */) { + while (i < length && elements[i].kind !== 174 /* SpreadElementExpression */) { i++; } write("["); @@ -25181,7 +25303,7 @@ var ts; } } function isSpreadElementExpression(node) { - return node.kind === 173 /* SpreadElementExpression */; + return node.kind === 174 /* SpreadElementExpression */; } function emitArrayLiteral(node) { var elements = node.elements; @@ -25251,7 +25373,7 @@ var ts; writeComma(); var property = properties[i]; emitStart(property); - if (property.kind === 136 /* GetAccessor */ || property.kind === 137 /* SetAccessor */) { + if (property.kind === 137 /* GetAccessor */ || property.kind === 138 /* SetAccessor */) { // TODO (drosen): Reconcile with 'emitMemberFunctions'. var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property !== accessors.firstAccessor) { @@ -25303,13 +25425,13 @@ var ts; emitMemberAccessForPropertyName(property.name); emitEnd(property.name); write(" = "); - if (property.kind === 224 /* PropertyAssignment */) { + if (property.kind === 225 /* PropertyAssignment */) { emit(property.initializer); } - else if (property.kind === 225 /* ShorthandPropertyAssignment */) { + else if (property.kind === 226 /* ShorthandPropertyAssignment */) { emitExpressionIdentifier(property.name); } - else if (property.kind === 134 /* MethodDeclaration */) { + else if (property.kind === 135 /* MethodDeclaration */) { emitFunctionDeclaration(property); } else { @@ -25343,7 +25465,7 @@ var ts; // 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 === 127 /* ComputedPropertyName */) { + if (properties[i].name.kind === 128 /* ComputedPropertyName */) { numInitialNonComputedProperties = i; break; } @@ -25359,21 +25481,21 @@ var ts; emitObjectLiteralBody(node, properties.length); } function createBinaryExpression(left, operator, right, startsOnNewLine) { - var result = ts.createSynthesizedNode(169 /* BinaryExpression */, startsOnNewLine); + var result = ts.createSynthesizedNode(170 /* BinaryExpression */, startsOnNewLine); result.operatorToken = ts.createSynthesizedNode(operator); result.left = left; result.right = right; return result; } function createPropertyAccessExpression(expression, name) { - var result = ts.createSynthesizedNode(155 /* PropertyAccessExpression */); + var result = ts.createSynthesizedNode(156 /* PropertyAccessExpression */); result.expression = parenthesizeForAccess(expression); result.dotToken = ts.createSynthesizedNode(20 /* DotToken */); result.name = name; return result; } function createElementAccessExpression(expression, argumentExpression) { - var result = ts.createSynthesizedNode(156 /* ElementAccessExpression */); + var result = ts.createSynthesizedNode(157 /* ElementAccessExpression */); result.expression = parenthesizeForAccess(expression); result.argumentExpression = argumentExpression; return result; @@ -25387,10 +25509,10 @@ var ts; // NumberLiteral // 1.x -> not the same as (1).x // - if (ts.isLeftHandSideExpression(expr) && expr.kind !== 158 /* NewExpression */ && expr.kind !== 7 /* NumericLiteral */) { + if (ts.isLeftHandSideExpression(expr) && expr.kind !== 159 /* NewExpression */ && expr.kind !== 7 /* NumericLiteral */) { return expr; } - var node = ts.createSynthesizedNode(161 /* ParenthesizedExpression */); + var node = ts.createSynthesizedNode(162 /* ParenthesizedExpression */); node.expression = expr; return node; } @@ -25454,7 +25576,7 @@ var ts; if (constantValue !== undefined) { write(constantValue.toString()); if (!compilerOptions.removeComments) { - var propertyName = node.kind === 155 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); + var propertyName = node.kind === 156 /* PropertyAccessExpression */ ? ts.declarationNameToString(node.name) : ts.getTextOfNode(node.argumentExpression); write(" /* " + propertyName + " */"); } return true; @@ -25506,10 +25628,10 @@ var ts; write("]"); } function hasSpreadElement(elements) { - return ts.forEach(elements, function (e) { return e.kind === 173 /* SpreadElementExpression */; }); + return ts.forEach(elements, function (e) { return e.kind === 174 /* SpreadElementExpression */; }); } function skipParentheses(node) { - while (node.kind === 161 /* ParenthesizedExpression */ || node.kind === 160 /* TypeAssertionExpression */) { + while (node.kind === 162 /* ParenthesizedExpression */ || node.kind === 161 /* TypeAssertionExpression */) { node = node.expression; } return node; @@ -25530,13 +25652,13 @@ var ts; function emitCallWithSpread(node) { var target; var expr = skipParentheses(node.expression); - if (expr.kind === 155 /* PropertyAccessExpression */) { + if (expr.kind === 156 /* PropertyAccessExpression */) { // Target will be emitted as "this" argument target = emitCallTarget(expr.expression); write("."); emit(expr.name); } - else if (expr.kind === 156 /* ElementAccessExpression */) { + else if (expr.kind === 157 /* ElementAccessExpression */) { // Target will be emitted as "this" argument target = emitCallTarget(expr.expression); write("["); @@ -25581,7 +25703,7 @@ var ts; } else { emit(node.expression); - superCall = node.expression.kind === 155 /* PropertyAccessExpression */ && node.expression.expression.kind === 91 /* SuperKeyword */; + superCall = node.expression.kind === 156 /* PropertyAccessExpression */ && node.expression.expression.kind === 91 /* SuperKeyword */; } if (superCall && languageVersion < 2 /* ES6 */) { write(".call("); @@ -25618,12 +25740,12 @@ var ts; } } function emitParenExpression(node) { - if (!node.parent || node.parent.kind !== 163 /* ArrowFunction */) { - if (node.expression.kind === 160 /* TypeAssertionExpression */) { + if (!node.parent || node.parent.kind !== 164 /* ArrowFunction */) { + if (node.expression.kind === 161 /* TypeAssertionExpression */) { var operand = node.expression.expression; // Make sure we consider all nested cast expressions, e.g.: // (-A).x; - while (operand.kind == 160 /* TypeAssertionExpression */) { + while (operand.kind == 161 /* TypeAssertionExpression */) { operand = operand.expression; } // We have an expression of the form: (SubExpr) @@ -25634,14 +25756,14 @@ var ts; // (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() // (function foo() { })() should be emitted as an IIF (function foo(){})() and not declaration function foo(){} () - if (operand.kind !== 167 /* PrefixUnaryExpression */ && - operand.kind !== 166 /* VoidExpression */ && - operand.kind !== 165 /* TypeOfExpression */ && - operand.kind !== 164 /* DeleteExpression */ && - operand.kind !== 168 /* PostfixUnaryExpression */ && - operand.kind !== 158 /* NewExpression */ && - !(operand.kind === 157 /* CallExpression */ && node.parent.kind === 158 /* NewExpression */) && - !(operand.kind === 162 /* FunctionExpression */ && node.parent.kind === 157 /* CallExpression */)) { + if (operand.kind !== 168 /* PrefixUnaryExpression */ && + operand.kind !== 167 /* VoidExpression */ && + operand.kind !== 166 /* TypeOfExpression */ && + operand.kind !== 165 /* DeleteExpression */ && + operand.kind !== 169 /* PostfixUnaryExpression */ && + operand.kind !== 159 /* NewExpression */ && + !(operand.kind === 158 /* CallExpression */ && node.parent.kind === 159 /* NewExpression */) && + !(operand.kind === 163 /* FunctionExpression */ && node.parent.kind === 158 /* CallExpression */)) { emit(operand); return; } @@ -25666,7 +25788,27 @@ var ts; write(" "); emit(node.expression); } + function isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node) { + if (!isCurrentFileSystemExternalModule() || node.kind !== 65 /* Identifier */ || ts.nodeIsSynthesized(node)) { + return false; + } + var isVariableDeclarationOrBindingElement = node.parent && (node.parent.kind === 199 /* VariableDeclaration */ || node.parent.kind === 153 /* BindingElement */); + var targetDeclaration = isVariableDeclarationOrBindingElement + ? node.parent + : resolver.getReferencedValueDeclaration(node); + return isSourceFileLevelDeclarationInSystemJsModule(targetDeclaration, true); + } function emitPrefixUnaryExpression(node) { + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + // emit + // ++x + // as + // exports('x', ++x) + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + } write(ts.tokenToString(node.operator)); // In some cases, we need to emit a space between the operator and the operand. One obvious case // is when the operator is an identifier, like delete or typeof. We also need to do this for plus @@ -25680,7 +25822,7 @@ var ts; // the resulting expression a prefix increment operation. And in the second, it will make the resulting // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. - if (node.operand.kind === 167 /* PrefixUnaryExpression */) { + if (node.operand.kind === 168 /* PrefixUnaryExpression */) { var operand = node.operand; if (node.operator === 33 /* PlusToken */ && (operand.operator === 33 /* PlusToken */ || operand.operator === 38 /* PlusPlusToken */)) { write(" "); @@ -25690,23 +25832,87 @@ var ts; } } emit(node.operand); + if (exportChanged) { + write(")"); + } } function emitPostfixUnaryExpression(node) { - emit(node.operand); - write(ts.tokenToString(node.operator)); + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.operand); + if (exportChanged) { + // export function returns the value that was passes as the second argument + // however for postfix unary expressions result value should be the value before modification. + // emit 'x++' as '(export('x', ++x) - 1)' and 'x--' as '(export('x', --x) + 1)' + write("(" + exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.operand); + write("\", "); + write(ts.tokenToString(node.operator)); + emit(node.operand); + if (node.operator === 38 /* PlusPlusToken */) { + write(") - 1)"); + } + else { + write(") + 1)"); + } + } + else { + emit(node.operand); + write(ts.tokenToString(node.operator)); + } + } + function shouldHoistDeclarationInSystemJsModule(node) { + return isSourceFileLevelDeclarationInSystemJsModule(node, false); + } + /* + * Checks if given node is a source file level declaration (not nested in module/function). + * If 'isExported' is true - then declaration must also be exported. + * This function is used in two cases: + * - check if node is a exported source file level value to determine + * if we should also export the value after its it changed + * - check if node is a source level declaration to emit it differently, + * i.e non-exported variable statement 'var x = 1' is hoisted so + * we we emit variable statement 'var' should be dropped. + */ + function isSourceFileLevelDeclarationInSystemJsModule(node, isExported) { + if (!node || languageVersion >= 2 /* ES6 */ || !isCurrentFileSystemExternalModule()) { + return false; + } + var current = node; + while (current) { + if (current.kind === 228 /* SourceFile */) { + return !isExported || ((ts.getCombinedNodeFlags(node) & 1 /* Export */) !== 0); + } + else if (ts.isFunctionLike(current) || current.kind === 207 /* ModuleBlock */) { + return false; + } + else { + current = current.parent; + } + } } function emitBinaryExpression(node) { if (languageVersion < 2 /* ES6 */ && node.operatorToken.kind === 53 /* EqualsToken */ && - (node.left.kind === 154 /* ObjectLiteralExpression */ || node.left.kind === 153 /* ArrayLiteralExpression */)) { - emitDestructuring(node, node.parent.kind === 182 /* ExpressionStatement */); + (node.left.kind === 155 /* ObjectLiteralExpression */ || node.left.kind === 154 /* ArrayLiteralExpression */)) { + emitDestructuring(node, node.parent.kind === 183 /* ExpressionStatement */); } else { + var exportChanged = node.operatorToken.kind >= 53 /* FirstAssignment */ && + node.operatorToken.kind <= 64 /* LastAssignment */ && + isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.left); + if (exportChanged) { + // emit assignment 'x y' as 'exports("x", x y)' + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.left); + write("\", "); + } emit(node.left); var indentedBeforeOperator = indentIfOnDifferentLines(node, node.left, node.operatorToken, node.operatorToken.kind !== 23 /* CommaToken */ ? " " : undefined); write(ts.tokenToString(node.operatorToken.kind)); var indentedAfterOperator = indentIfOnDifferentLines(node, node.operatorToken, node.right, " "); emit(node.right); decreaseIndentIf(indentedBeforeOperator, indentedAfterOperator); + if (exportChanged) { + write(")"); + } } } function synthesizedNodeStartsOnNewLine(node) { @@ -25738,7 +25944,7 @@ var ts; } } function isSingleLineEmptyBlock(node) { - if (node && node.kind === 179 /* Block */) { + if (node && node.kind === 180 /* Block */) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); } @@ -25753,12 +25959,12 @@ var ts; emitToken(14 /* OpenBraceToken */, node.pos); increaseIndent(); scopeEmitStart(node.parent); - if (node.kind === 206 /* ModuleBlock */) { - ts.Debug.assert(node.parent.kind === 205 /* ModuleDeclaration */); + if (node.kind === 207 /* ModuleBlock */) { + ts.Debug.assert(node.parent.kind === 206 /* ModuleDeclaration */); emitCaptureThisForNodeIfNecessary(node.parent); } emitLines(node.statements); - if (node.kind === 206 /* ModuleBlock */) { + if (node.kind === 207 /* ModuleBlock */) { emitTempDeclarations(true); } decreaseIndent(); @@ -25767,7 +25973,7 @@ var ts; scopeEmitEnd(); } function emitEmbeddedStatement(node) { - if (node.kind === 179 /* Block */) { + if (node.kind === 180 /* Block */) { write(" "); emit(node); } @@ -25779,7 +25985,7 @@ var ts; } } function emitExpressionStatement(node) { - emitParenthesizedIf(node.expression, node.expression.kind === 163 /* ArrowFunction */); + emitParenthesizedIf(node.expression, node.expression.kind === 164 /* ArrowFunction */); write(";"); } function emitIfStatement(node) { @@ -25792,7 +25998,7 @@ var ts; if (node.elseStatement) { writeLine(); emitToken(76 /* ElseKeyword */, node.thenStatement.end); - if (node.elseStatement.kind === 183 /* IfStatement */) { + if (node.elseStatement.kind === 184 /* IfStatement */) { write(" "); emit(node.elseStatement); } @@ -25804,7 +26010,7 @@ var ts; function emitDoStatement(node) { write("do"); emitEmbeddedStatement(node.statement); - if (node.statement.kind === 179 /* Block */) { + if (node.statement.kind === 180 /* Block */) { write(" "); } else { @@ -25820,7 +26026,15 @@ var ts; write(")"); emitEmbeddedStatement(node.statement); } - function emitStartOfVariableDeclarationList(decl, startPos) { + /* Returns true if start of variable declaration list was emitted. + * Return false if nothing was written - this can happen for source file level variable declarations + * in system modules - such variable declarations are hoisted. + */ + function tryEmitStartOfVariableDeclarationList(decl, startPos) { + if (shouldHoistVariable(decl, true)) { + // variables in variable declaration list were already hoisted + return false; + } var tokenKind = 98 /* VarKeyword */; if (decl && languageVersion >= 2 /* ES6 */) { if (ts.isLet(decl)) { @@ -25832,28 +26046,53 @@ var ts; } if (startPos !== undefined) { emitToken(tokenKind, startPos); + write(" "); } else { switch (tokenKind) { case 98 /* VarKeyword */: - return write("var "); + write("var "); + break; case 104 /* LetKeyword */: - return write("let "); + write("let "); + break; case 70 /* ConstKeyword */: - return write("const "); + write("const "); + break; } } + return true; + } + function emitVariableDeclarationListSkippingUninitializedEntries(list) { + var started = false; + for (var _a = 0, _b = list.declarations; _a < _b.length; _a++) { + var decl = _b[_a]; + if (!decl.initializer) { + continue; + } + if (!started) { + started = true; + } + else { + write(", "); + } + emit(decl); + } + return started; } function emitForStatement(node) { var endPos = emitToken(82 /* ForKeyword */, node.pos); write(" "); endPos = emitToken(16 /* OpenParenToken */, endPos); - if (node.initializer && node.initializer.kind === 199 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 200 /* VariableDeclarationList */) { var variableDeclarationList = node.initializer; - var declarations = variableDeclarationList.declarations; - emitStartOfVariableDeclarationList(declarations[0], endPos); - write(" "); - emitCommaList(declarations); + var startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + if (startIsEmitted) { + emitCommaList(variableDeclarationList.declarations); + } + else { + emitVariableDeclarationListSkippingUninitializedEntries(variableDeclarationList); + } } else if (node.initializer) { emit(node.initializer); @@ -25866,25 +26105,23 @@ var ts; emitEmbeddedStatement(node.statement); } function emitForInOrForOfStatement(node) { - if (languageVersion < 2 /* ES6 */ && node.kind === 188 /* ForOfStatement */) { + if (languageVersion < 2 /* ES6 */ && node.kind === 189 /* ForOfStatement */) { return emitDownLevelForOfStatement(node); } var endPos = emitToken(82 /* ForKeyword */, node.pos); write(" "); endPos = emitToken(16 /* OpenParenToken */, endPos); - if (node.initializer.kind === 199 /* VariableDeclarationList */) { + if (node.initializer.kind === 200 /* VariableDeclarationList */) { var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length >= 1) { - var decl = variableDeclarationList.declarations[0]; - emitStartOfVariableDeclarationList(decl, endPos); - write(" "); - emit(decl); + tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos); + emit(variableDeclarationList.declarations[0]); } } else { emit(node.initializer); } - if (node.kind === 187 /* ForInStatement */) { + if (node.kind === 188 /* ForInStatement */) { write(" in "); } else { @@ -25969,7 +26206,7 @@ var ts; // let v = _a[_i]; var rhsIterationValue = createElementAccessExpression(rhsReference, counter); emitStart(node.initializer); - if (node.initializer.kind === 199 /* VariableDeclarationList */) { + if (node.initializer.kind === 200 /* VariableDeclarationList */) { write("var "); var variableDeclarationList = node.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -25999,7 +26236,7 @@ var ts; // Initializer is an expression. Emit the expression in the body, so that it's // evaluated on every iteration. var assignmentExpression = createBinaryExpression(node.initializer, 53 /* EqualsToken */, rhsIterationValue, false); - if (node.initializer.kind === 153 /* ArrayLiteralExpression */ || node.initializer.kind === 154 /* ObjectLiteralExpression */) { + if (node.initializer.kind === 154 /* ArrayLiteralExpression */ || node.initializer.kind === 155 /* ObjectLiteralExpression */) { // This is a destructuring pattern, so call emitDestructuring instead of emit. Calling emit will not work, because it will cause // the BinaryExpression to be passed in instead of the expression statement, which will cause emitDestructuring to crash. emitDestructuring(assignmentExpression, true, undefined); @@ -26010,7 +26247,7 @@ var ts; } emitEnd(node.initializer); write(";"); - if (node.statement.kind === 179 /* Block */) { + if (node.statement.kind === 180 /* Block */) { emitLines(node.statement.statements); } else { @@ -26022,7 +26259,7 @@ var ts; write("}"); } function emitBreakOrContinueStatement(node) { - emitToken(node.kind === 190 /* BreakStatement */ ? 66 /* BreakKeyword */ : 71 /* ContinueKeyword */, node.pos); + emitToken(node.kind === 191 /* BreakStatement */ ? 66 /* BreakKeyword */ : 71 /* ContinueKeyword */, node.pos); emitOptional(" ", node.label); write(";"); } @@ -26067,7 +26304,7 @@ var ts; ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node) { - if (node.kind === 220 /* CaseClause */) { + if (node.kind === 221 /* CaseClause */) { write("case "); emit(node.expression); write(":"); @@ -26122,7 +26359,7 @@ var ts; function getContainingModule(node) { do { node = node.parent; - } while (node && node.kind !== 205 /* ModuleDeclaration */); + } while (node && node.kind !== 206 /* ModuleDeclaration */); return node; } function emitContainingModuleName(node) { @@ -26137,7 +26374,7 @@ var ts; write(getGeneratedNameForNode(container)); write("."); } - else if (languageVersion < 2 /* ES6 */) { + else if (languageVersion < 2 /* ES6 */ && compilerOptions.module !== 4 /* System */) { write("exports."); } } @@ -26147,7 +26384,7 @@ var ts; function createVoidZero() { var zero = ts.createSynthesizedNode(7 /* NumericLiteral */); zero.text = "0"; - var result = ts.createSynthesizedNode(166 /* VoidExpression */); + var result = ts.createSynthesizedNode(167 /* VoidExpression */); result.expression = zero; return result; } @@ -26155,19 +26392,35 @@ var ts; if (node.flags & 1 /* Export */) { writeLine(); emitStart(node); - if (node.flags & 256 /* Default */) { - if (languageVersion === 0 /* ES3 */) { - write("exports[\"default\"]"); + if (compilerOptions.module === 4 /* System */) { + // emit export default as + // export("default", ) + write(exportFunctionForFile + "(\""); + if (node.flags & 256 /* Default */) { + write("default"); } else { - write("exports.default"); + emitNodeWithoutSourceMap(node.name); } + write("\", "); + emitDeclarationName(node); + write(")"); } else { - emitModuleMemberName(node); + if (node.flags & 256 /* Default */) { + if (languageVersion === 0 /* ES3 */) { + write("exports[\"default\"]"); + } + else { + write("exports.default"); + } + } + else { + emitModuleMemberName(node); + } + write(" = "); + emitDeclarationName(node); } - write(" = "); - emitDeclarationName(node); emitEnd(node); write(";"); } @@ -26177,13 +26430,24 @@ var ts; for (var _a = 0, _b = exportSpecifiers[name.text]; _a < _b.length; _a++) { var specifier = _b[_a]; writeLine(); - emitStart(specifier.name); - emitContainingModuleName(specifier); - write("."); - emitNodeWithoutSourceMap(specifier.name); - emitEnd(specifier.name); - write(" = "); - emitExpressionIdentifier(name); + if (compilerOptions.module === 4 /* System */) { + emitStart(specifier.name); + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(specifier.name); + write("\", "); + emitExpressionIdentifier(name); + write(")"); + emitEnd(specifier.name); + } + else { + emitStart(specifier.name); + emitContainingModuleName(specifier); + write("."); + emitNodeWithoutSourceMap(specifier.name); + emitEnd(specifier.name); + write(" = "); + emitExpressionIdentifier(name); + } write(";"); } } @@ -26192,8 +26456,18 @@ var ts; var emitCount = 0; // An exported declaration is actually emitted as an assignment (to a property on the module object), so // temporary variables in an exported declaration need to have real declarations elsewhere - var isDeclaration = (root.kind === 198 /* VariableDeclaration */ && !(ts.getCombinedNodeFlags(root) & 1 /* Export */)) || root.kind === 129 /* Parameter */; - if (root.kind === 169 /* BinaryExpression */) { + // Also temporary variables should be explicitly allocated for source level declarations when module target is system + // because actual variable declarations are hoisted + var canDefineTempVariablesInPlace = false; + if (root.kind === 199 /* VariableDeclaration */) { + var isExported = ts.getCombinedNodeFlags(root) & 1 /* Export */; + var isSourceLevelForSystemModuleKind = shouldHoistDeclarationInSystemJsModule(root); + canDefineTempVariablesInPlace = !isExported && !isSourceLevelForSystemModuleKind; + } + else if (root.kind === 130 /* Parameter */) { + canDefineTempVariablesInPlace = true; + } + if (root.kind === 170 /* BinaryExpression */) { emitAssignmentExpression(root); } else { @@ -26205,7 +26479,14 @@ var ts; write(", "); } renameNonTopLevelLetAndConst(name); - if (name.parent && (name.parent.kind === 198 /* VariableDeclaration */ || name.parent.kind === 152 /* BindingElement */)) { + var isVariableDeclarationOrBindingElement = name.parent && (name.parent.kind === 199 /* VariableDeclaration */ || name.parent.kind === 153 /* BindingElement */); + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(name); + write("\", "); + } + if (isVariableDeclarationOrBindingElement) { emitModuleMemberName(name.parent); } else { @@ -26213,11 +26494,14 @@ var ts; } write(" = "); emit(value); + if (exportChanged) { + write(")"); + } } function ensureIdentifier(expr) { if (expr.kind !== 65 /* Identifier */) { var identifier = createTempVariable(0 /* Auto */); - if (!isDeclaration) { + if (!canDefineTempVariablesInPlace) { recordTempDeclaration(identifier); } emitAssignment(identifier, expr); @@ -26230,14 +26514,14 @@ var ts; // we need to generate a temporary variable value = ensureIdentifier(value); // Return the expression 'value === void 0 ? defaultValue : value' - var equals = ts.createSynthesizedNode(169 /* BinaryExpression */); + var equals = ts.createSynthesizedNode(170 /* BinaryExpression */); equals.left = value; equals.operatorToken = ts.createSynthesizedNode(30 /* EqualsEqualsEqualsToken */); equals.right = createVoidZero(); return createConditionalExpression(equals, defaultValue, value); } function createConditionalExpression(condition, whenTrue, whenFalse) { - var cond = ts.createSynthesizedNode(170 /* ConditionalExpression */); + var cond = ts.createSynthesizedNode(171 /* ConditionalExpression */); cond.condition = condition; cond.questionToken = ts.createSynthesizedNode(50 /* QuestionToken */); cond.whenTrue = whenTrue; @@ -26257,7 +26541,7 @@ var ts; return createPropertyAccessExpression(object, propName); } function createSliceCall(value, sliceIndex) { - var call = ts.createSynthesizedNode(157 /* CallExpression */); + var call = ts.createSynthesizedNode(158 /* CallExpression */); var sliceIdentifier = ts.createSynthesizedNode(65 /* Identifier */); sliceIdentifier.text = "slice"; call.expression = createPropertyAccessExpression(value, sliceIdentifier); @@ -26274,7 +26558,7 @@ var ts; } for (var _a = 0; _a < properties.length; _a++) { var p = properties[_a]; - if (p.kind === 224 /* PropertyAssignment */ || p.kind === 225 /* ShorthandPropertyAssignment */) { + if (p.kind === 225 /* PropertyAssignment */ || p.kind === 226 /* ShorthandPropertyAssignment */) { // TODO(andersh): Computed property support var propName = (p.name); emitDestructuringAssignment(p.initializer || propName, createPropertyAccessForDestructuringProperty(value, propName)); @@ -26290,8 +26574,8 @@ var ts; } for (var i = 0; i < elements.length; i++) { var e = elements[i]; - if (e.kind !== 175 /* OmittedExpression */) { - if (e.kind !== 173 /* SpreadElementExpression */) { + if (e.kind !== 176 /* OmittedExpression */) { + if (e.kind !== 174 /* SpreadElementExpression */) { emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i))); } else if (i === elements.length - 1) { @@ -26301,14 +26585,14 @@ var ts; } } function emitDestructuringAssignment(target, value) { - if (target.kind === 169 /* BinaryExpression */ && target.operatorToken.kind === 53 /* EqualsToken */) { + if (target.kind === 170 /* BinaryExpression */ && target.operatorToken.kind === 53 /* EqualsToken */) { value = createDefaultValueCheck(value, target.right); target = target.left; } - if (target.kind === 154 /* ObjectLiteralExpression */) { + if (target.kind === 155 /* ObjectLiteralExpression */) { emitObjectLiteralAssignment(target, value); } - else if (target.kind === 153 /* ArrayLiteralExpression */) { + else if (target.kind === 154 /* ArrayLiteralExpression */) { emitArrayLiteralAssignment(target, value); } else { @@ -26322,14 +26606,14 @@ var ts; emitDestructuringAssignment(target, value); } else { - if (root.parent.kind !== 161 /* ParenthesizedExpression */) { + if (root.parent.kind !== 162 /* ParenthesizedExpression */) { write("("); } value = ensureIdentifier(value); emitDestructuringAssignment(target, value); write(", "); emit(value); - if (root.parent.kind !== 161 /* ParenthesizedExpression */) { + if (root.parent.kind !== 162 /* ParenthesizedExpression */) { write(")"); } } @@ -26353,12 +26637,12 @@ var ts; } for (var i = 0; i < elements.length; i++) { var element = elements[i]; - if (pattern.kind === 150 /* ObjectBindingPattern */) { + if (pattern.kind === 151 /* ObjectBindingPattern */) { // Rewrite element to a declaration with an initializer that fetches property var propName = element.propertyName || element.name; emitBindingElement(element, createPropertyAccessForDestructuringProperty(value, propName)); } - else if (element.kind !== 175 /* OmittedExpression */) { + else if (element.kind !== 176 /* OmittedExpression */) { if (!element.dotDotDotToken) { // Rewrite element to a declaration that accesses array element at index i emitBindingElement(element, createElementAccessExpression(value, createNumericLiteral(i))); @@ -26386,7 +26670,6 @@ var ts; } else { renameNonTopLevelLetAndConst(node.name); - emitModuleMemberName(node); var initializer = node.initializer; if (!initializer && languageVersion < 2 /* ES6 */) { // downlevel emit for non-initialized let bindings defined in loops @@ -26399,16 +26682,26 @@ var ts; (getCombinedFlagsForIdentifier(node.name) & 4096 /* Let */); // NOTE: default initialization should not be added to let bindings in for-in\for-of statements if (isUninitializedLet && - node.parent.parent.kind !== 187 /* ForInStatement */ && - node.parent.parent.kind !== 188 /* ForOfStatement */) { + node.parent.parent.kind !== 188 /* ForInStatement */ && + node.parent.parent.kind !== 189 /* ForOfStatement */) { initializer = createVoidZero(); } } + var exportChanged = isNameOfExportedSourceLevelDeclarationInSystemExternalModule(node.name); + if (exportChanged) { + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(node.name); + write("\", "); + } + emitModuleMemberName(node); emitOptional(" = ", initializer); + if (exportChanged) { + write(")"); + } } } function emitExportVariableAssignments(node) { - if (node.kind === 175 /* OmittedExpression */) { + if (node.kind === 176 /* OmittedExpression */) { return; } var name = node.name; @@ -26420,7 +26713,7 @@ var ts; } } function getCombinedFlagsForIdentifier(node) { - if (!node.parent || (node.parent.kind !== 198 /* VariableDeclaration */ && node.parent.kind !== 152 /* BindingElement */)) { + if (!node.parent || (node.parent.kind !== 199 /* VariableDeclaration */ && node.parent.kind !== 153 /* BindingElement */)) { return 0; } return ts.getCombinedNodeFlags(node.parent); @@ -26435,7 +26728,7 @@ var ts; if (languageVersion >= 2 /* ES6 */ || ts.nodeIsSynthesized(node) || node.kind !== 65 /* Identifier */ || - (node.parent.kind !== 198 /* VariableDeclaration */ && node.parent.kind !== 152 /* BindingElement */)) { + (node.parent.kind !== 199 /* VariableDeclaration */ && node.parent.kind !== 153 /* BindingElement */)) { return; } var combinedFlags = getCombinedFlagsForIdentifier(node); @@ -26444,17 +26737,17 @@ var ts; return; } // here it is known that node is a block scoped variable - var list = ts.getAncestor(node, 199 /* VariableDeclarationList */); - if (list.parent.kind === 180 /* VariableStatement */) { - var isSourceFileLevelBinding = list.parent.parent.kind === 227 /* SourceFile */; - var isModuleLevelBinding = list.parent.parent.kind === 206 /* ModuleBlock */; - var isFunctionLevelBinding = list.parent.parent.kind === 179 /* Block */ && ts.isFunctionLike(list.parent.parent.parent); + var list = ts.getAncestor(node, 200 /* VariableDeclarationList */); + if (list.parent.kind === 181 /* VariableStatement */) { + var isSourceFileLevelBinding = list.parent.parent.kind === 228 /* SourceFile */; + var isModuleLevelBinding = list.parent.parent.kind === 207 /* ModuleBlock */; + var isFunctionLevelBinding = list.parent.parent.kind === 180 /* Block */ && ts.isFunctionLike(list.parent.parent.parent); if (isSourceFileLevelBinding || isModuleLevelBinding || isFunctionLevelBinding) { return; } } var blockScopeContainer = ts.getEnclosingBlockScopeContainer(node); - var parent = blockScopeContainer.kind === 227 /* SourceFile */ + var parent = blockScopeContainer.kind === 228 /* SourceFile */ ? blockScopeContainer : blockScopeContainer.parent; if (resolver.resolvesToSomeValue(parent, node.text)) { @@ -26469,19 +26762,28 @@ var ts; function isES6ExportedDeclaration(node) { return !!(node.flags & 1 /* Export */) && languageVersion >= 2 /* ES6 */ && - node.parent.kind === 227 /* SourceFile */; + node.parent.kind === 228 /* SourceFile */; } function emitVariableStatement(node) { + var startIsEmitted = true; if (!(node.flags & 1 /* Export */)) { - emitStartOfVariableDeclarationList(node.declarationList); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); } else if (isES6ExportedDeclaration(node)) { // Exported ES6 module member write("export "); - emitStartOfVariableDeclarationList(node.declarationList); + startIsEmitted = tryEmitStartOfVariableDeclarationList(node.declarationList); + } + if (startIsEmitted) { + emitCommaList(node.declarationList.declarations); + write(";"); + } + else { + var atLeastOneItem = emitVariableDeclarationListSkippingUninitializedEntries(node.declarationList); + if (atLeastOneItem) { + write(";"); + } } - emitCommaList(node.declarationList.declarations); - write(";"); if (languageVersion < 2 /* ES6 */ && node.parent === currentSourceFile) { ts.forEach(node.declarationList.declarations, emitExportVariableAssignments); } @@ -26585,12 +26887,12 @@ var ts; } } function emitAccessor(node) { - write(node.kind === 136 /* GetAccessor */ ? "get " : "set "); + write(node.kind === 137 /* GetAccessor */ ? "get " : "set "); emit(node.name, false); emitSignatureAndBody(node); } function shouldEmitAsArrowFunction(node) { - return node.kind === 163 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; + return node.kind === 164 /* ArrowFunction */ && languageVersion >= 2 /* ES6 */; } function emitDeclarationName(node) { if (node.name) { @@ -26601,11 +26903,11 @@ var ts; } } function shouldEmitFunctionName(node) { - if (node.kind === 162 /* FunctionExpression */) { + if (node.kind === 163 /* FunctionExpression */) { // Emit name if one is present return !!node.name; } - if (node.kind === 200 /* FunctionDeclaration */) { + if (node.kind === 201 /* FunctionDeclaration */) { // Emit name if one is present, or emit generated name in down-level case (for export default case) return !!node.name || languageVersion < 2 /* ES6 */; } @@ -26614,7 +26916,7 @@ var ts; if (ts.nodeIsMissing(node.body)) { return emitOnlyPinnedOrTripleSlashComments(node); } - if (node.kind !== 134 /* MethodDeclaration */ && node.kind !== 133 /* MethodSignature */) { + if (node.kind !== 135 /* MethodDeclaration */ && node.kind !== 134 /* MethodSignature */) { // Methods will emit the comments as part of emitting method declaration emitLeadingComments(node); } @@ -26637,10 +26939,10 @@ var ts; emitDeclarationName(node); } emitSignatureAndBody(node); - if (languageVersion < 2 /* ES6 */ && node.kind === 200 /* FunctionDeclaration */ && node.parent === currentSourceFile && node.name) { + if (languageVersion < 2 /* ES6 */ && node.kind === 201 /* FunctionDeclaration */ && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments(node.name); } - if (node.kind !== 134 /* MethodDeclaration */ && node.kind !== 133 /* MethodSignature */) { + if (node.kind !== 135 /* MethodDeclaration */ && node.kind !== 134 /* MethodSignature */) { emitTrailingComments(node); } } @@ -26691,7 +26993,7 @@ var ts; // in that case. write(" { }"); } - else if (node.body.kind === 179 /* Block */) { + else if (node.body.kind === 180 /* Block */) { emitBlockFunctionBody(node, node.body); } else { @@ -26722,10 +27024,10 @@ var ts; write(" "); // Unwrap all type assertions. var current = body; - while (current.kind === 160 /* TypeAssertionExpression */) { + while (current.kind === 161 /* TypeAssertionExpression */) { current = current.expression; } - emitParenthesizedIf(body, current.kind === 154 /* ObjectLiteralExpression */); + emitParenthesizedIf(body, current.kind === 155 /* ObjectLiteralExpression */); } function emitDownLevelExpressionFunctionBody(node, body) { write(" {"); @@ -26801,9 +27103,9 @@ var ts; function findInitialSuperCall(ctor) { if (ctor.body) { var statement = ctor.body.statements[0]; - if (statement && statement.kind === 182 /* ExpressionStatement */) { + if (statement && statement.kind === 183 /* ExpressionStatement */) { var expr = statement.expression; - if (expr && expr.kind === 157 /* CallExpression */) { + if (expr && expr.kind === 158 /* CallExpression */) { var func = expr.expression; if (func && func.kind === 91 /* SuperKeyword */) { return statement; @@ -26835,7 +27137,7 @@ var ts; emitNodeWithoutSourceMap(memberName); write("]"); } - else if (memberName.kind === 127 /* ComputedPropertyName */) { + else if (memberName.kind === 128 /* ComputedPropertyName */) { emitComputedPropertyName(memberName); } else { @@ -26847,7 +27149,7 @@ var ts; var properties = []; for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if (member.kind === 132 /* PropertyDeclaration */ && static === ((member.flags & 128 /* Static */) !== 0) && member.initializer) { + if (member.kind === 133 /* PropertyDeclaration */ && static === ((member.flags & 128 /* Static */) !== 0) && member.initializer) { properties.push(member); } } @@ -26887,11 +27189,11 @@ var ts; } function emitMemberFunctionsForES5AndLower(node) { ts.forEach(node.members, function (member) { - if (member.kind === 178 /* SemicolonClassElement */) { + if (member.kind === 179 /* SemicolonClassElement */) { writeLine(); write(";"); } - else if (member.kind === 134 /* MethodDeclaration */ || node.kind === 133 /* MethodSignature */) { + else if (member.kind === 135 /* MethodDeclaration */ || node.kind === 134 /* MethodSignature */) { if (!member.body) { return emitOnlyPinnedOrTripleSlashComments(member); } @@ -26910,7 +27212,7 @@ var ts; write(";"); emitTrailingComments(member); } - else if (member.kind === 136 /* GetAccessor */ || member.kind === 137 /* SetAccessor */) { + else if (member.kind === 137 /* GetAccessor */ || member.kind === 138 /* SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); @@ -26960,22 +27262,22 @@ var ts; function emitMemberFunctionsForES6AndHigher(node) { for (var _a = 0, _b = node.members; _a < _b.length; _a++) { var member = _b[_a]; - if ((member.kind === 134 /* MethodDeclaration */ || node.kind === 133 /* MethodSignature */) && !member.body) { + if ((member.kind === 135 /* MethodDeclaration */ || node.kind === 134 /* MethodSignature */) && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } - else if (member.kind === 134 /* MethodDeclaration */ || - member.kind === 136 /* GetAccessor */ || - member.kind === 137 /* SetAccessor */) { + else if (member.kind === 135 /* MethodDeclaration */ || + member.kind === 137 /* GetAccessor */ || + member.kind === 138 /* SetAccessor */) { writeLine(); emitLeadingComments(member); emitStart(member); if (member.flags & 128 /* Static */) { write("static "); } - if (member.kind === 136 /* GetAccessor */) { + if (member.kind === 137 /* GetAccessor */) { write("get "); } - else if (member.kind === 137 /* SetAccessor */) { + else if (member.kind === 138 /* SetAccessor */) { write("set "); } if (member.asteriskToken) { @@ -26986,7 +27288,7 @@ var ts; emitEnd(member); emitTrailingComments(member); } - else if (member.kind === 178 /* SemicolonClassElement */) { + else if (member.kind === 179 /* SemicolonClassElement */) { writeLine(); write(";"); } @@ -27011,11 +27313,11 @@ var ts; var hasInstancePropertyWithInitializer = false; // Emit the constructor overload pinned comments ts.forEach(node.members, function (member) { - if (member.kind === 135 /* Constructor */ && !member.body) { + if (member.kind === 136 /* Constructor */ && !member.body) { emitOnlyPinnedOrTripleSlashComments(member); } // Check if there is any non-static property assignment - if (member.kind === 132 /* PropertyDeclaration */ && member.initializer && (member.flags & 128 /* Static */) === 0) { + if (member.kind === 133 /* PropertyDeclaration */ && member.initializer && (member.flags & 128 /* Static */) === 0) { hasInstancePropertyWithInitializer = true; } }); @@ -27123,7 +27425,7 @@ var ts; } function emitClassLikeDeclarationForES6AndHigher(node) { var thisNodeIsDecorated = ts.nodeIsDecorated(node); - if (node.kind === 201 /* ClassDeclaration */) { + if (node.kind === 202 /* ClassDeclaration */) { if (thisNodeIsDecorated) { // To preserve the correct runtime semantics when decorators are applied to the class, // the emit needs to follow one of the following rules: @@ -27203,7 +27505,7 @@ var ts; // This keeps the expression as an expression, while ensuring that the static parts // of it have been initialized by the time it is used. var staticProperties = getInitializedProperties(node, true); - var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 174 /* ClassExpression */; + var isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === 175 /* ClassExpression */; var tempVariable; if (isClassExpressionWithStaticProperties) { tempVariable = createAndRecordTempVariable(0 /* Auto */); @@ -27295,8 +27597,11 @@ var ts; } } function emitClassLikeDeclarationBelowES6(node) { - if (node.kind === 201 /* ClassDeclaration */) { - write("var "); + if (node.kind === 202 /* ClassDeclaration */) { + // source file level classes in system modules are hoisted so 'var's for them are already defined + if (!shouldHoistDeclarationInSystemJsModule(node)) { + write("var "); + } emitDeclarationName(node); write(" = "); } @@ -27351,11 +27656,11 @@ var ts; emit(baseTypeNode.expression); } write(")"); - if (node.kind === 201 /* ClassDeclaration */) { + if (node.kind === 202 /* ClassDeclaration */) { write(";"); } emitEnd(node); - if (node.kind === 201 /* ClassDeclaration */) { + if (node.kind === 202 /* ClassDeclaration */) { emitExportMemberAssignment(node); } if (languageVersion < 2 /* ES6 */ && node.parent === currentSourceFile && node.name) { @@ -27447,7 +27752,7 @@ var ts; else { decorators = member.decorators; // we only decorate the parameters here if this is a method - if (member.kind === 134 /* MethodDeclaration */) { + if (member.kind === 135 /* MethodDeclaration */) { functionLikeMember = member; } } @@ -27485,7 +27790,7 @@ var ts; // writeLine(); emitStart(member); - if (member.kind !== 132 /* PropertyDeclaration */) { + if (member.kind !== 133 /* PropertyDeclaration */) { write("Object.defineProperty("); emitStart(member.name); emitClassMemberPrefix(node, member); @@ -27515,7 +27820,7 @@ var ts; write(", "); emitExpressionForPropertyName(member.name); emitEnd(member.name); - if (member.kind !== 132 /* PropertyDeclaration */) { + if (member.kind !== 133 /* PropertyDeclaration */) { write(", Object.getOwnPropertyDescriptor("); emitStart(member.name); emitClassMemberPrefix(node, member); @@ -27557,10 +27862,10 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 134 /* MethodDeclaration */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 132 /* PropertyDeclaration */: + case 135 /* MethodDeclaration */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 133 /* PropertyDeclaration */: return true; } return false; @@ -27570,7 +27875,7 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 134 /* MethodDeclaration */: + case 135 /* MethodDeclaration */: return true; } return false; @@ -27580,9 +27885,9 @@ var ts; // The caller should have already tested whether the node has decorators and whether the emitDecoratorMetadata // compiler option is set. switch (node.kind) { - case 201 /* ClassDeclaration */: - case 134 /* MethodDeclaration */: - case 137 /* SetAccessor */: + case 202 /* ClassDeclaration */: + case 135 /* MethodDeclaration */: + case 138 /* SetAccessor */: return true; } return false; @@ -27745,7 +28050,7 @@ var ts; } } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 205 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 206 /* ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -27762,7 +28067,9 @@ var ts; if (!shouldEmit) { return emitOnlyPinnedOrTripleSlashComments(node); } - if (!isModuleMergedWithES6Class(node)) { + var hoistedInDeclarationScope = shouldHoistDeclarationInSystemJsModule(node); + var emitVarForModule = !hoistedInDeclarationScope && !isModuleMergedWithES6Class(node); + if (emitVarForModule) { emitStart(node); if (isES6ExportedDeclaration(node)) { write("export "); @@ -27779,7 +28086,7 @@ var ts; write(getGeneratedNameForNode(node)); emitEnd(node.name); write(") "); - if (node.body.kind === 206 /* ModuleBlock */) { + if (node.body.kind === 207 /* ModuleBlock */) { var saveTempFlags = tempFlags; var saveTempVariables = tempVariables; tempFlags = 0; @@ -27813,6 +28120,14 @@ var ts; write(" = {}));"); emitEnd(node); if (!isES6ExportedDeclaration(node) && node.name.kind === 65 /* Identifier */ && node.parent === currentSourceFile) { + if (compilerOptions.module === 4 /* System */ && (node.flags & 1 /* Export */)) { + writeLine(); + write(exportFunctionForFile + "(\""); + emitDeclarationName(node); + write("\", "); + emitDeclarationName(node); + write(")"); + } emitExportMemberAssignments(node.name); } } @@ -27829,16 +28144,16 @@ var ts; } } function getNamespaceDeclarationNode(node) { - if (node.kind === 208 /* ImportEqualsDeclaration */) { + if (node.kind === 209 /* ImportEqualsDeclaration */) { return node; } var importClause = node.importClause; - if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 211 /* NamespaceImport */) { + if (importClause && importClause.namedBindings && importClause.namedBindings.kind === 212 /* NamespaceImport */) { return importClause.namedBindings; } } function isDefaultImport(node) { - return node.kind === 209 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; + return node.kind === 210 /* ImportDeclaration */ && node.importClause && !!node.importClause.name; } function emitExportImportAssignments(node) { if (ts.isAliasSymbolDeclaration(node) && resolver.isValueAliasDeclaration(node)) { @@ -27866,7 +28181,7 @@ var ts; if (shouldEmitNamedBindings) { emitLeadingComments(node.importClause.namedBindings); emitStart(node.importClause.namedBindings); - if (node.importClause.namedBindings.kind === 211 /* NamespaceImport */) { + if (node.importClause.namedBindings.kind === 212 /* NamespaceImport */) { write("* as "); emit(node.importClause.namedBindings.name); } @@ -27892,7 +28207,7 @@ var ts; } function emitExternalImportDeclaration(node) { if (ts.contains(externalImports, node)) { - var isExportedImport = node.kind === 208 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; + var isExportedImport = node.kind === 209 /* ImportEqualsDeclaration */ && (node.flags & 1 /* Export */) !== 0; var namespaceDeclaration = getNamespaceDeclarationNode(node); if (compilerOptions.module !== 2 /* AMD */) { emitLeadingComments(node); @@ -27911,7 +28226,7 @@ var ts; // import { x, y } from "foo" // import d, * as x from "foo" // import d, { x, y } from "foo" - var isNakedImport = 209 /* ImportDeclaration */ && !node.importClause; + var isNakedImport = 210 /* ImportDeclaration */ && !node.importClause; if (!isNakedImport) { write("var "); write(getGeneratedNameForNode(node)); @@ -27979,6 +28294,7 @@ var ts; } } function emitExportDeclaration(node) { + ts.Debug.assert(compilerOptions.module !== 4 /* System */); if (languageVersion < 2 /* ES6 */) { if (node.moduleSpecifier && (!node.exportClause || resolver.isValueAliasDeclaration(node))) { emitStart(node); @@ -28074,8 +28390,8 @@ var ts; write("export default "); var expression = node.expression; emit(expression); - if (expression.kind !== 200 /* FunctionDeclaration */ && - expression.kind !== 201 /* ClassDeclaration */) { + if (expression.kind !== 201 /* FunctionDeclaration */ && + expression.kind !== 202 /* ClassDeclaration */) { write(";"); } emitEnd(node); @@ -28083,14 +28399,21 @@ var ts; else { writeLine(); emitStart(node); - emitContainingModuleName(node); - if (languageVersion === 0 /* ES3 */) { - write("[\"default\"] = "); + if (compilerOptions.module === 4 /* System */) { + write(exportFunctionForFile + "(\"default\","); + emit(node.expression); + write(")"); } else { - write(".default = "); + emitContainingModuleName(node); + if (languageVersion === 0 /* ES3 */) { + write("[\"default\"] = "); + } + else { + write(".default = "); + } + emit(node.expression); } - emit(node.expression); write(";"); emitEnd(node); } @@ -28104,7 +28427,7 @@ var ts; for (var _a = 0, _b = sourceFile.statements; _a < _b.length; _a++) { var node = _b[_a]; switch (node.kind) { - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: if (!node.importClause || resolver.isReferencedAliasDeclaration(node.importClause, true)) { // import "mod" @@ -28114,13 +28437,13 @@ var ts; externalImports.push(node); } break; - case 208 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 219 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { + case 209 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 220 /* ExternalModuleReference */ && resolver.isReferencedAliasDeclaration(node)) { // import x = require("mod") where x is referenced externalImports.push(node); } break; - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -28141,7 +28464,7 @@ var ts; } } break; - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; @@ -28162,6 +28485,476 @@ var ts; write("}"); } } + function getLocalNameForExternalImport(importNode) { + var namespaceDeclaration = getNamespaceDeclarationNode(importNode); + if (namespaceDeclaration && !isDefaultImport(importNode)) { + return ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); + } + else { + return getGeneratedNameForNode(importNode); + } + } + function getExternalModuleNameText(importNode) { + var moduleName = ts.getExternalModuleName(importNode); + if (moduleName.kind === 8 /* StringLiteral */) { + return getLiteralText(moduleName); + } + return undefined; + } + function emitVariableDeclarationsForImports() { + if (externalImports.length === 0) { + return; + } + writeLine(); + var started = false; + for (var _a = 0; _a < externalImports.length; _a++) { + var importNode = externalImports[_a]; + // do not create variable declaration for exports and imports that lack import clause + var skipNode = importNode.kind === 216 /* ExportDeclaration */ || + (importNode.kind === 210 /* ImportDeclaration */ && !importNode.importClause); + if (skipNode) { + continue; + } + if (!started) { + write("var "); + started = true; + } + else { + write(", "); + } + write(getLocalNameForExternalImport(importNode)); + } + if (started) { + write(";"); + } + } + function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations) { + // when resolving exports local exported entries/indirect exported entries in the module + // should always win over entries with similar names that were added via star exports + // to support this we store names of local/indirect exported entries in a set. + // this set is used to filter names brought by star expors. + if (!hasExportStars) { + // local names set is needed only in presence of star exports + return undefined; + } + // local names set should only be added if we have anything exported + if (!exportedDeclarations && ts.isEmpty(exportSpecifiers)) { + // no exported declarations (export var ...) or export specifiers (export {x}) + // check if we have any non star export declarations. + var hasExportDeclarationWithExportClause = false; + for (var _a = 0; _a < externalImports.length; _a++) { + var externalImport = externalImports[_a]; + if (externalImport.kind === 216 /* ExportDeclaration */ && externalImport.exportClause) { + hasExportDeclarationWithExportClause = true; + break; + } + } + if (!hasExportDeclarationWithExportClause) { + // we still need to emit exportStar helper + return emitExportStarFunction(undefined); + } + } + var exportedNamesStorageRef = makeUniqueName("exportedNames"); + writeLine(); + write("var " + exportedNamesStorageRef + " = {"); + increaseIndent(); + var started = false; + if (exportedDeclarations) { + for (var i = 0; i < exportedDeclarations.length; ++i) { + // write name of exported declaration, i.e 'export var x...' + writeExportedName(exportedDeclarations[i]); + } + } + if (exportSpecifiers) { + for (var n in exportSpecifiers) { + for (var _b = 0, _c = exportSpecifiers[n]; _b < _c.length; _b++) { + var specifier = _c[_b]; + // write name of export specified, i.e. 'export {x}' + writeExportedName(specifier.name); + } + } + } + for (var _d = 0; _d < externalImports.length; _d++) { + var externalImport = externalImports[_d]; + if (externalImport.kind !== 216 /* ExportDeclaration */) { + continue; + } + var exportDecl = externalImport; + if (!exportDecl.exportClause) { + // export * from ... + continue; + } + for (var _e = 0, _f = exportDecl.exportClause.elements; _e < _f.length; _e++) { + var element = _f[_e]; + // write name of indirectly exported entry, i.e. 'export {x} from ...' + writeExportedName(element.name || element.propertyName); + } + } + decreaseIndent(); + writeLine(); + write("};"); + return emitExportStarFunction(exportedNamesStorageRef); + function emitExportStarFunction(localNames) { + var exportStarFunction = makeUniqueName("exportStar"); + writeLine(); + // define an export star helper function + write("function " + exportStarFunction + "(m) {"); + increaseIndent(); + writeLine(); + write("for(var n in m) {"); + increaseIndent(); + writeLine(); + write("if (n !== \"default\""); + if (localNames) { + write("&& !" + localNames + ".hasOwnProperty(n)"); + } + write(") " + exportFunctionForFile + "(n, m[n]);"); + decreaseIndent(); + writeLine(); + write("}"); + decreaseIndent(); + writeLine(); + write("}"); + return exportStarFunction; + } + function writeExportedName(node) { + // do not record default exports + // they are local to module and never overwritten (explicitly skipped) by star export + if (node.kind !== 65 /* Identifier */ && node.flags & 256 /* Default */) { + return; + } + if (started) { + write(","); + } + else { + started = true; + } + writeLine(); + write("'"); + if (node.kind === 65 /* Identifier */) { + emitNodeWithoutSourceMap(node); + } + else { + emitDeclarationName(node); + } + write("': true"); + } + } + function processTopLevelVariableAndFunctionDeclarations(node) { + // per ES6 spec: + // 15.2.1.16.4 ModuleDeclarationInstantiation() Concrete Method + // - var declarations are initialized to undefined - 14.a.ii + // - function/generator declarations are instantiated - 16.a.iv + // this means that after module is instantiated but before its evaluation + // exported functions are already accessible at import sites + // in theory we should hoist only exported functions and its dependencies + // in practice to simplify things we'll hoist all source level functions and variable declaration + // including variables declarations for module and class declarations + var hoistedVars; + var hoistedFunctionDeclarations; + var exportedDeclarations; + visit(node); + if (hoistedVars) { + writeLine(); + write("var "); + for (var i = 0; i < hoistedVars.length; ++i) { + var local = hoistedVars[i]; + if (i !== 0) { + write(", "); + } + if (local.kind === 202 /* ClassDeclaration */ || local.kind === 206 /* ModuleDeclaration */) { + emitDeclarationName(local); + } + else { + emit(local); + } + var flags = ts.getCombinedNodeFlags(local.kind === 65 /* Identifier */ ? local.parent : local); + if (flags & 1 /* Export */) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(local); + } + } + write(";"); + } + if (hoistedFunctionDeclarations) { + for (var _a = 0; _a < hoistedFunctionDeclarations.length; _a++) { + var f = hoistedFunctionDeclarations[_a]; + writeLine(); + emit(f); + if (f.flags & 1 /* Export */) { + if (!exportedDeclarations) { + exportedDeclarations = []; + } + exportedDeclarations.push(f); + } + } + } + return exportedDeclarations; + function visit(node) { + if (node.kind === 201 /* FunctionDeclaration */) { + if (!hoistedFunctionDeclarations) { + hoistedFunctionDeclarations = []; + } + hoistedFunctionDeclarations.push(node); + return; + } + if (node.kind === 202 /* ClassDeclaration */) { + // TODO: rename block scoped classes + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + return; + } + if (node.kind === 206 /* ModuleDeclaration */ && shouldEmitModuleDeclaration(node)) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(node); + return; + } + if (node.kind === 199 /* VariableDeclaration */ || node.kind === 153 /* BindingElement */) { + if (shouldHoistVariable(node, false)) { + var name_21 = node.name; + if (name_21.kind === 65 /* Identifier */) { + if (!hoistedVars) { + hoistedVars = []; + } + hoistedVars.push(name_21); + } + else { + ts.forEachChild(name_21, visit); + } + } + return; + } + if (ts.isBindingPattern(node)) { + ts.forEach(node.elements, visit); + return; + } + if (!ts.isDeclaration(node)) { + ts.forEachChild(node, visit); + } + } + } + function shouldHoistVariable(node, checkIfSourceFileLevelDecl) { + if (checkIfSourceFileLevelDecl && !shouldHoistDeclarationInSystemJsModule(node)) { + return false; + } + // hoist variable if + // - it is not block scoped + // - it is top level block scoped + // if block scoped variables are nested in some another block then + // no other functions can use them except ones that are defined at least in the same block + return (ts.getCombinedNodeFlags(node) & 12288 /* BlockScoped */) === 0 || + ts.getEnclosingBlockScopeContainer(node).kind === 228 /* SourceFile */; + } + function isCurrentFileSystemExternalModule() { + return compilerOptions.module === 4 /* System */ && ts.isExternalModule(currentSourceFile); + } + function emitSystemModuleBody(node, startIndex) { + // shape of the body in system modules: + // function (exports) { + // + // + // + // return { + // setters: [ + // + // ], + // execute: function() { + // + // } + // } + // + // } + // I.e: + // import {x} from 'file1' + // var y = 1; + // export function foo() { return y + x(); } + // console.log(y); + // will be transformed to + // function(exports) { + // var file1; // local alias + // var y; + // function foo() { return y + file1.x(); } + // exports("foo", foo); + // return { + // setters: [ + // function(v) { file1 = v } + // ], + // execute(): function() { + // y = 1; + // console.log(y); + // } + // }; + // } + emitVariableDeclarationsForImports(); + writeLine(); + var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node); + var exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations); + writeLine(); + write("return {"); + increaseIndent(); + writeLine(); + emitSetters(exportStarFunction); + writeLine(); + emitExecute(node, startIndex); + emitTempDeclarations(true); + decreaseIndent(); + writeLine(); + write("}"); // return + } + function emitSetters(exportStarFunction) { + write("setters:["); + for (var i = 0; i < externalImports.length; ++i) { + if (i !== 0) { + write(","); + } + writeLine(); + increaseIndent(); + var importNode = externalImports[i]; + var importVariableName = getLocalNameForExternalImport(importNode) || ""; + var parameterName = "_" + importVariableName; + write("function (" + parameterName + ") {"); + switch (importNode.kind) { + case 210 /* ImportDeclaration */: + if (!importNode.importClause) { + // 'import "..."' case + // module is imported only for side-effects, setter body will be empty + break; + } + // fall-through + case 209 /* ImportEqualsDeclaration */: + ts.Debug.assert(importVariableName !== ""); + increaseIndent(); + writeLine(); + // save import into the local + write(importVariableName + " = " + parameterName + ";"); + writeLine(); + var defaultName = importNode.kind === 210 /* ImportDeclaration */ + ? importNode.importClause.name + : importNode.name; + if (defaultName) { + // emit re-export for imported default name + // import n1 from 'foo1' + // import n2 = require('foo2') + // export {n1} + // export {n2} + emitExportMemberAssignments(defaultName); + writeLine(); + } + if (importNode.kind === 210 /* ImportDeclaration */ && + importNode.importClause.namedBindings) { + var namedBindings = importNode.importClause.namedBindings; + if (namedBindings.kind === 212 /* NamespaceImport */) { + // emit re-export for namespace + // import * as n from 'foo' + // export {n} + emitExportMemberAssignments(namedBindings.name); + writeLine(); + } + else { + // emit re-exports for named imports + // import {a, b} from 'foo' + // export {a, b as c} + for (var _a = 0, _b = namedBindings.elements; _a < _b.length; _a++) { + var element = _b[_a]; + emitExportMemberAssignments(element.name || element.propertyName); + writeLine(); + } + } + } + decreaseIndent(); + break; + case 216 /* ExportDeclaration */: + ts.Debug.assert(importVariableName !== ""); + increaseIndent(); + if (importNode.exportClause) { + // export {a, b as c} from 'foo' + // emit as: + // exports('a', _foo["a"]) + // exports('c', _foo["b"]) + for (var _c = 0, _d = importNode.exportClause.elements; _c < _d.length; _c++) { + var e = _d[_c]; + writeLine(); + write(exportFunctionForFile + "(\""); + emitNodeWithoutSourceMap(e.name); + write("\", " + parameterName + "[\""); + emitNodeWithoutSourceMap(e.propertyName || e.name); + write("\"]);"); + } + } + else { + writeLine(); + // export * from 'foo' + // emit as: + // exportStar(_foo); + write(exportStarFunction + "(" + parameterName + ");"); + } + writeLine(); + decreaseIndent(); + break; + } + write("}"); + decreaseIndent(); + } + write("],"); + } + function emitExecute(node, startIndex) { + write("execute: function() {"); + increaseIndent(); + writeLine(); + for (var i = startIndex; i < node.statements.length; ++i) { + var statement = node.statements[i]; + // - imports/exports are not emitted for system modules + // - function declarations are not emitted because they were already hoisted + switch (statement.kind) { + case 216 /* ExportDeclaration */: + case 210 /* ImportDeclaration */: + case 209 /* ImportEqualsDeclaration */: + case 201 /* FunctionDeclaration */: + continue; + } + writeLine(); + emit(statement); + } + decreaseIndent(); + writeLine(); + write("}"); // execute + } + function emitSystemModule(node, startIndex) { + collectExternalModuleInfo(node); + // System modules has the following shape + // System.register(['dep-1', ... 'dep-n'], function(exports) {/* module body function */}) + // 'exports' here is a function 'exports(name: string, value: T): T' that is used to publish exported values. + // 'exports' returns its 'value' argument so in most cases expressions + // that mutate exported values can be rewritten as: + // expr -> exports('name', expr). + // The only exception in this rule is postfix unary operators, + // see comment to 'emitPostfixUnaryExpression' for more details + ts.Debug.assert(!exportFunctionForFile); + // make sure that name of 'exports' function does not conflict with existing identifiers + exportFunctionForFile = makeUniqueName("exports"); + write("System.register(["); + for (var i = 0; i < externalImports.length; ++i) { + var text = getExternalModuleNameText(externalImports[i]); + if (i !== 0) { + write(", "); + } + write(text); + } + write("], function(" + exportFunctionForFile + ") {"); + writeLine(); + increaseIndent(); + emitCaptureThisForNodeIfNecessary(node); + emitSystemModuleBody(node, startIndex); + decreaseIndent(); + writeLine(); + write("});"); + } function emitAMDDependencies(node, includeNonAmdDependencies) { // An AMD define function has the following shape: // define(id?, dependencies?, factory); @@ -28178,8 +28971,8 @@ var ts; // factory function. var unaliasedModuleNames = []; // names of modules with no corresponding parameters in // factory function. - var importAliasNames = []; // names of the parameters in the factory function; these - // parameters need to match the indexes of the corresponding + var importAliasNames = []; // names of the parameters in the factory function; these + // parameters need to match the indexes of the corresponding // module names in aliasedModuleNames. // Fill in amd-dependency tags for (var _a = 0, _b = node.amdDependencies; _a < _b.length; _a++) { @@ -28195,20 +28988,9 @@ var ts; for (var _c = 0; _c < externalImports.length; _c++) { var importNode = externalImports[_c]; // Find the name of the external module - var externalModuleName = ""; - var moduleName = ts.getExternalModuleName(importNode); - if (moduleName.kind === 8 /* StringLiteral */) { - externalModuleName = getLiteralText(moduleName); - } + var externalModuleName = getExternalModuleNameText(importNode); // Find the name of the module alias, if there is one - var importAliasName = void 0; - var namespaceDeclaration = getNamespaceDeclarationNode(importNode); - if (namespaceDeclaration && !isDefaultImport(importNode)) { - importAliasName = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, namespaceDeclaration.name); - } - else { - importAliasName = getGeneratedNameForNode(importNode); - } + var importAliasName = getLocalNameForExternalImport(importNode); if (includeNonAmdDependencies && importAliasName) { aliasedModuleNames.push(externalModuleName); importAliasNames.push(importAliasName); @@ -28327,30 +29109,36 @@ var ts; emitDetachedComments(node); // emit prologue directives prior to __extends var startIndex = emitDirectivePrologues(node.statements, false); - // Only Emit __extends function when target ES5. - // For target ES6 and above, we can emit classDeclaration as is. - if ((languageVersion < 2 /* ES6 */) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8 /* EmitExtends */)) { - writeLines(extendsHelper); - extendsEmitted = true; - } - if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 512 /* EmitDecorate */) { - writeLines(decorateHelper); - if (compilerOptions.emitDecoratorMetadata) { - writeLines(metadataHelper); + // Only emit helpers if the user did not say otherwise. + if (!compilerOptions.noEmitHelpers) { + // Only Emit __extends function when target ES5. + // For target ES6 and above, we can emit classDeclaration as is. + if ((languageVersion < 2 /* ES6 */) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & 8 /* EmitExtends */)) { + writeLines(extendsHelper); + extendsEmitted = true; + } + if (!decorateEmitted && resolver.getNodeCheckFlags(node) & 512 /* EmitDecorate */) { + writeLines(decorateHelper); + if (compilerOptions.emitDecoratorMetadata) { + writeLines(metadataHelper); + } + decorateEmitted = true; + } + if (!paramEmitted && resolver.getNodeCheckFlags(node) & 1024 /* EmitParam */) { + writeLines(paramHelper); + paramEmitted = true; } - decorateEmitted = true; } - if (!paramEmitted && resolver.getNodeCheckFlags(node) & 1024 /* EmitParam */) { - writeLines(paramHelper); - paramEmitted = true; - } - if (ts.isExternalModule(node)) { + if (ts.isExternalModule(node) || compilerOptions.separateCompilation) { if (languageVersion >= 2 /* ES6 */) { emitES6Module(node, startIndex); } else if (compilerOptions.module === 2 /* AMD */) { emitAMDModule(node, startIndex); } + else if (compilerOptions.module === 4 /* System */) { + emitSystemModule(node, startIndex); + } else if (compilerOptions.module === 3 /* UMD */) { emitUMDModule(node, startIndex); } @@ -28389,18 +29177,18 @@ var ts; switch (node.kind) { // All of these entities are emitted in a specialized fashion. As such, we allow // the specialized methods for each to handle the comments on the nodes. - case 202 /* InterfaceDeclaration */: - case 200 /* FunctionDeclaration */: - case 209 /* ImportDeclaration */: - case 208 /* ImportEqualsDeclaration */: - case 203 /* TypeAliasDeclaration */: - case 214 /* ExportAssignment */: + case 203 /* InterfaceDeclaration */: + case 201 /* FunctionDeclaration */: + case 210 /* ImportDeclaration */: + case 209 /* ImportEqualsDeclaration */: + case 204 /* TypeAliasDeclaration */: + case 215 /* ExportAssignment */: return false; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: // Only emit the leading/trailing comments for a module if we're actually // emitting the module as well. return shouldEmitModuleDeclaration(node); - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: // Only emit the leading/trailing comments for an enum if we're actually // emitting the module as well. return shouldEmitEnumDeclaration(node); @@ -28409,9 +29197,9 @@ var ts; // then we don't want to emit comments when we emit the body. It will have already // been taken care of when we emitted the 'return' statement for the function // expression body. - if (node.kind !== 179 /* Block */ && + if (node.kind !== 180 /* Block */ && node.parent && - node.parent.kind === 163 /* ArrowFunction */ && + node.parent.kind === 164 /* ArrowFunction */ && node.parent.body === node && compilerOptions.target <= 1 /* ES5 */) { return false; @@ -28425,13 +29213,13 @@ var ts; switch (node.kind) { case 65 /* Identifier */: return emitIdentifier(node, allowGeneratedIdentifiers); - case 129 /* Parameter */: + case 130 /* Parameter */: return emitParameter(node); - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: return emitMethod(node); - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: return emitAccessor(node); case 93 /* ThisKeyword */: return emitThis(node); @@ -28451,131 +29239,131 @@ var ts; case 12 /* TemplateMiddle */: case 13 /* TemplateTail */: return emitLiteral(node); - case 171 /* TemplateExpression */: + case 172 /* TemplateExpression */: return emitTemplateExpression(node); - case 176 /* TemplateSpan */: + case 178 /* TemplateSpan */: return emitTemplateSpan(node); - case 126 /* QualifiedName */: + case 127 /* QualifiedName */: return emitQualifiedName(node); - case 150 /* ObjectBindingPattern */: + case 151 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 151 /* ArrayBindingPattern */: + case 152 /* ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 152 /* BindingElement */: + case 153 /* BindingElement */: return emitBindingElement(node); - case 153 /* ArrayLiteralExpression */: + case 154 /* ArrayLiteralExpression */: return emitArrayLiteral(node); - case 154 /* ObjectLiteralExpression */: + case 155 /* ObjectLiteralExpression */: return emitObjectLiteral(node); - case 224 /* PropertyAssignment */: + case 225 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 225 /* ShorthandPropertyAssignment */: + case 226 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 127 /* ComputedPropertyName */: + case 128 /* ComputedPropertyName */: return emitComputedPropertyName(node); - case 155 /* PropertyAccessExpression */: + case 156 /* PropertyAccessExpression */: return emitPropertyAccess(node); - case 156 /* ElementAccessExpression */: + case 157 /* ElementAccessExpression */: return emitIndexedAccess(node); - case 157 /* CallExpression */: + case 158 /* CallExpression */: return emitCallExpression(node); - case 158 /* NewExpression */: + case 159 /* NewExpression */: return emitNewExpression(node); - case 159 /* TaggedTemplateExpression */: + case 160 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 160 /* TypeAssertionExpression */: + case 161 /* TypeAssertionExpression */: return emit(node.expression); - case 161 /* ParenthesizedExpression */: + case 162 /* ParenthesizedExpression */: return emitParenExpression(node); - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: return emitFunctionDeclaration(node); - case 164 /* DeleteExpression */: + case 165 /* DeleteExpression */: return emitDeleteExpression(node); - case 165 /* TypeOfExpression */: + case 166 /* TypeOfExpression */: return emitTypeOfExpression(node); - case 166 /* VoidExpression */: + case 167 /* VoidExpression */: return emitVoidExpression(node); - case 167 /* PrefixUnaryExpression */: + case 168 /* PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 168 /* PostfixUnaryExpression */: + case 169 /* PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: return emitBinaryExpression(node); - case 170 /* ConditionalExpression */: + case 171 /* ConditionalExpression */: return emitConditionalExpression(node); - case 173 /* SpreadElementExpression */: + case 174 /* SpreadElementExpression */: return emitSpreadElementExpression(node); - case 172 /* YieldExpression */: + case 173 /* YieldExpression */: return emitYieldExpression(node); - case 175 /* OmittedExpression */: + case 176 /* OmittedExpression */: return; - case 179 /* Block */: - case 206 /* ModuleBlock */: + case 180 /* Block */: + case 207 /* ModuleBlock */: return emitBlock(node); - case 180 /* VariableStatement */: + case 181 /* VariableStatement */: return emitVariableStatement(node); - case 181 /* EmptyStatement */: + case 182 /* EmptyStatement */: return write(";"); - case 182 /* ExpressionStatement */: + case 183 /* ExpressionStatement */: return emitExpressionStatement(node); - case 183 /* IfStatement */: + case 184 /* IfStatement */: return emitIfStatement(node); - case 184 /* DoStatement */: + case 185 /* DoStatement */: return emitDoStatement(node); - case 185 /* WhileStatement */: + case 186 /* WhileStatement */: return emitWhileStatement(node); - case 186 /* ForStatement */: + case 187 /* ForStatement */: return emitForStatement(node); - case 188 /* ForOfStatement */: - case 187 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 188 /* ForInStatement */: return emitForInOrForOfStatement(node); - case 189 /* ContinueStatement */: - case 190 /* BreakStatement */: + case 190 /* ContinueStatement */: + case 191 /* BreakStatement */: return emitBreakOrContinueStatement(node); - case 191 /* ReturnStatement */: + case 192 /* ReturnStatement */: return emitReturnStatement(node); - case 192 /* WithStatement */: + case 193 /* WithStatement */: return emitWithStatement(node); - case 193 /* SwitchStatement */: + case 194 /* SwitchStatement */: return emitSwitchStatement(node); - case 220 /* CaseClause */: - case 221 /* DefaultClause */: + case 221 /* CaseClause */: + case 222 /* DefaultClause */: return emitCaseOrDefaultClause(node); - case 194 /* LabeledStatement */: + case 195 /* LabeledStatement */: return emitLabelledStatement(node); - case 195 /* ThrowStatement */: + case 196 /* ThrowStatement */: return emitThrowStatement(node); - case 196 /* TryStatement */: + case 197 /* TryStatement */: return emitTryStatement(node); - case 223 /* CatchClause */: + case 224 /* CatchClause */: return emitCatchClause(node); - case 197 /* DebuggerStatement */: + case 198 /* DebuggerStatement */: return emitDebuggerStatement(node); - case 198 /* VariableDeclaration */: + case 199 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 174 /* ClassExpression */: + case 175 /* ClassExpression */: return emitClassExpression(node); - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: return emitClassDeclaration(node); - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 226 /* EnumMember */: + case 227 /* EnumMember */: return emitEnumMember(node); - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: return emitImportDeclaration(node); - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: return emitExportDeclaration(node); - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: return emitExportAssignment(node); - case 227 /* SourceFile */: + case 228 /* SourceFile */: return emitSourceFileNode(node); } } @@ -28607,7 +29395,7 @@ var ts; function getLeadingCommentsToEmit(node) { // Emit the leading comments only if the parent's pos doesn't match because parent should take care of emitting these comments if (node.parent) { - if (node.parent.kind === 227 /* SourceFile */ || node.pos !== node.parent.pos) { + if (node.parent.kind === 228 /* SourceFile */ || node.pos !== node.parent.pos) { if (hasDetachedComments(node.pos)) { // get comments without detached comments return getLeadingCommentsWithoutDetachedComments(); @@ -28622,7 +29410,7 @@ var ts; function getTrailingCommentsToEmit(node) { // Emit the trailing comments only if the parent's pos doesn't match because parent should take care of emitting these comments if (node.parent) { - if (node.parent.kind === 227 /* SourceFile */ || node.end !== node.parent.end) { + if (node.parent.kind === 228 /* SourceFile */ || node.end !== node.parent.end) { return ts.getTrailingCommentRanges(currentSourceFile.text, node.end); } } @@ -28817,10 +29605,10 @@ var ts; }; } ts.createCompilerHost = createCompilerHost; - function getPreEmitDiagnostics(program) { - var diagnostics = program.getSyntacticDiagnostics().concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics()); + function getPreEmitDiagnostics(program, sourceFile) { + var diagnostics = program.getSyntacticDiagnostics(sourceFile).concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics(sourceFile)); if (program.getCompilerOptions().declaration) { - diagnostics.concat(program.getDeclarationDiagnostics()); + diagnostics.concat(program.getDeclarationDiagnostics(sourceFile)); } return ts.sortAndDeduplicateDiagnostics(diagnostics); } @@ -29068,7 +29856,7 @@ var ts; } function processImportedModules(file, basePath) { ts.forEach(file.statements, function (node) { - if (node.kind === 209 /* ImportDeclaration */ || node.kind === 208 /* ImportEqualsDeclaration */ || node.kind === 215 /* ExportDeclaration */) { + if (node.kind === 210 /* ImportDeclaration */ || node.kind === 209 /* ImportEqualsDeclaration */ || node.kind === 216 /* ExportDeclaration */) { var moduleNameExpr = ts.getExternalModuleName(node); if (moduleNameExpr && moduleNameExpr.kind === 8 /* StringLiteral */) { var moduleNameText = moduleNameExpr.text; @@ -29088,7 +29876,7 @@ var ts; } } } - else if (node.kind === 205 /* ModuleDeclaration */ && node.name.kind === 8 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { + else if (node.kind === 206 /* ModuleDeclaration */ && node.name.kind === 8 /* StringLiteral */ && (node.flags & 2 /* Ambient */ || ts.isDeclarationFile(file))) { // TypeScript 1.0 spec (April 2014): 12.1.6 // An AmbientExternalModuleDeclaration declares an external module. // This type of declaration is permitted only in the global module. @@ -29183,6 +29971,22 @@ var ts; diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_out_cannot_be_specified_with_option_separateCompilation)); } } + if (options.inlineSourceMap) { + if (options.sourceMap) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceMap_cannot_be_specified_with_option_inlineSourceMap)); + } + if (options.mapRoot) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_mapRoot_cannot_be_specified_with_option_inlineSourceMap)); + } + if (options.sourceRoot) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_sourceRoot_cannot_be_specified_with_option_inlineSourceMap)); + } + } + if (options.inlineSources) { + if (!options.sourceMap && !options.inlineSourceMap) { + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_inlineSources_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided)); + } + } if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) { // Error to specify --mapRoot or --sourceRoot without mapSourceFiles if (options.mapRoot) { @@ -29202,17 +30006,17 @@ var ts; var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !ts.isDeclarationFile(f) ? f : undefined; }); if (firstNonExternalModuleSourceFile) { var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided)); + diagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_separateCompilation_flag_is_provided)); } } else if (firstExternalModuleSourceFile && languageVersion < 2 /* ES6 */ && !options.module) { // We cannot use createDiagnosticFromNode because nodes do not have parents yet var span = ts.getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); - diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + diagnostics.add(ts.createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided)); } // Cannot specify module gen target when in es6 or above if (options.module && languageVersion >= 2 /* ES6 */) { - diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_external_modules_into_amd_commonjs_or_umd_when_targeting_ES6_or_higher)); + diagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher)); } // there has to be common source directory if user specified --outdir || --sourceRoot // if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted @@ -29279,6 +30083,14 @@ var ts; type: "boolean", description: ts.Diagnostics.Print_this_message }, + { + name: "inlineSourceMap", + type: "boolean" + }, + { + name: "inlineSources", + type: "boolean" + }, { name: "listFiles", type: "boolean" @@ -29300,17 +30112,22 @@ var ts; type: { "commonjs": 1 /* CommonJS */, "amd": 2 /* AMD */, + "system": 4 /* System */, "umd": 3 /* UMD */ }, - description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_or_umd, + description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_or_umd, paramType: ts.Diagnostics.KIND, - error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_or_umd + error: ts.Diagnostics.Argument_for_module_option_must_be_commonjs_amd_system_or_umd }, { name: "noEmit", type: "boolean", description: ts.Diagnostics.Do_not_emit_outputs }, + { + name: "noEmitHelpers", + type: "boolean" + }, { name: "noEmitOnError", type: "boolean", @@ -29531,19 +30348,34 @@ var ts; function readConfigFile(fileName) { try { var text = ts.sys.readFile(fileName); - return /\S/.test(text) ? JSON.parse(text) : {}; } catch (e) { + return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) }; } + return parseConfigFileText(fileName, text); } ts.readConfigFile = readConfigFile; + /** + * Parse the text of the tsconfig.json file + * @param fileName The path to the config file + * @param jsonText The text of the config file + */ + function parseConfigFileText(fileName, jsonText) { + try { + return { config: /\S/.test(jsonText) ? JSON.parse(jsonText) : {} }; + } + catch (e) { + return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; + } + } + ts.parseConfigFileText = parseConfigFileText; /** * Parse the contents of a config file (tsconfig.json). * @param json The contents of the config file to parse * @param basePath A root directory to resolve relative path entries in the config * file to. e.g. outDir */ - function parseConfigFile(json, basePath) { + function parseConfigFile(json, host, basePath) { var errors = []; return { options: getCompilerOptions(), @@ -29599,7 +30431,7 @@ var ts; } } else { - var sysFiles = ts.sys.readDirectory(basePath, ".ts"); + var sysFiles = host.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")) { @@ -29684,7 +30516,7 @@ var ts; } } function autoCollapse(node) { - return ts.isFunctionBlock(node) && node.parent.kind !== 163 /* ArrowFunction */; + return ts.isFunctionBlock(node) && node.parent.kind !== 164 /* ArrowFunction */; } var depth = 0; var maxDepth = 20; @@ -29696,7 +30528,7 @@ var ts; addOutliningForLeadingCommentsForNode(n); } switch (n.kind) { - case 179 /* Block */: + case 180 /* Block */: if (!ts.isFunctionBlock(n)) { var parent_6 = n.parent; var openBrace = ts.findChildOfKind(n, 14 /* OpenBraceToken */, sourceFile); @@ -29704,18 +30536,18 @@ var ts; // Check if the block is standalone, or 'attached' to some parent statement. // If the latter, we want to collaps the block, but consider its hint span // to be the entire span of the parent. - if (parent_6.kind === 184 /* DoStatement */ || - parent_6.kind === 187 /* ForInStatement */ || - parent_6.kind === 188 /* ForOfStatement */ || - parent_6.kind === 186 /* ForStatement */ || - parent_6.kind === 183 /* IfStatement */ || - parent_6.kind === 185 /* WhileStatement */ || - parent_6.kind === 192 /* WithStatement */ || - parent_6.kind === 223 /* CatchClause */) { + if (parent_6.kind === 185 /* DoStatement */ || + parent_6.kind === 188 /* ForInStatement */ || + parent_6.kind === 189 /* ForOfStatement */ || + parent_6.kind === 187 /* ForStatement */ || + parent_6.kind === 184 /* IfStatement */ || + parent_6.kind === 186 /* WhileStatement */ || + parent_6.kind === 193 /* WithStatement */ || + parent_6.kind === 224 /* CatchClause */) { addOutliningSpan(parent_6, openBrace, closeBrace, autoCollapse(n)); break; } - if (parent_6.kind === 196 /* TryStatement */) { + if (parent_6.kind === 197 /* TryStatement */) { // Could be the try-block, or the finally-block. var tryStatement = parent_6; if (tryStatement.tryBlock === n) { @@ -29742,23 +30574,23 @@ var ts; break; } // Fallthrough. - case 206 /* ModuleBlock */: { + case 207 /* ModuleBlock */: { var openBrace = ts.findChildOfKind(n, 14 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 15 /* CloseBraceToken */, sourceFile); addOutliningSpan(n.parent, openBrace, closeBrace, autoCollapse(n)); break; } - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 204 /* EnumDeclaration */: - case 154 /* ObjectLiteralExpression */: - case 207 /* CaseBlock */: { + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 205 /* EnumDeclaration */: + case 155 /* ObjectLiteralExpression */: + case 208 /* CaseBlock */: { var openBrace = ts.findChildOfKind(n, 14 /* OpenBraceToken */, sourceFile); var closeBrace = ts.findChildOfKind(n, 15 /* CloseBraceToken */, sourceFile); addOutliningSpan(n, openBrace, closeBrace, autoCollapse(n)); break; } - case 153 /* ArrayLiteralExpression */: + case 154 /* ArrayLiteralExpression */: var openBracket = ts.findChildOfKind(n, 18 /* OpenBracketToken */, sourceFile); var closeBracket = ts.findChildOfKind(n, 19 /* CloseBracketToken */, sourceFile); addOutliningSpan(n, openBracket, closeBracket, autoCollapse(n)); @@ -29786,12 +30618,12 @@ var ts; ts.forEach(program.getSourceFiles(), function (sourceFile) { cancellationToken.throwIfCancellationRequested(); var nameToDeclarations = sourceFile.getNamedDeclarations(); - for (var name_21 in nameToDeclarations) { - var declarations = ts.getProperty(nameToDeclarations, name_21); + for (var name_22 in nameToDeclarations) { + var declarations = ts.getProperty(nameToDeclarations, name_22); if (declarations) { // First do a quick check to see if the name of the declaration matches the // last portion of the (possibly) dotted name they're searching for. - var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_21); + var matches = patternMatcher.getMatchesForLastSegmentOfPattern(name_22); if (!matches) { continue; } @@ -29804,14 +30636,14 @@ var ts; if (!containers) { return undefined; } - matches = patternMatcher.getMatches(containers, name_21); + matches = patternMatcher.getMatches(containers, name_22); if (!matches) { continue; } } var fileName = sourceFile.fileName; var matchKind = bestMatchKind(matches); - rawItems.push({ name: name_21, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); + rawItems.push({ name: name_22, fileName: fileName, matchKind: matchKind, isCaseSensitive: allMatchesAreCaseSensitive(matches), declaration: declaration }); } } } @@ -29849,7 +30681,7 @@ var ts; if (text !== undefined) { containers.unshift(text); } - else if (declaration.name.kind === 127 /* ComputedPropertyName */) { + else if (declaration.name.kind === 128 /* ComputedPropertyName */) { return tryAddComputedPropertyName(declaration.name.expression, containers, true); } else { @@ -29870,7 +30702,7 @@ var ts; } return true; } - if (expression.kind === 155 /* PropertyAccessExpression */) { + if (expression.kind === 156 /* PropertyAccessExpression */) { var propertyAccess = expression; if (includeLastPortion) { containers.unshift(propertyAccess.name.text); @@ -29883,7 +30715,7 @@ var ts; var containers = []; // First, if we started with a computed property name, then add all but the last // portion into the container array. - if (declaration.name.kind === 127 /* ComputedPropertyName */) { + if (declaration.name.kind === 128 /* ComputedPropertyName */) { if (!tryAddComputedPropertyName(declaration.name.expression, containers, false)) { return undefined; } @@ -29959,17 +30791,17 @@ var ts; var current = node.parent; while (current) { switch (current.kind) { - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: // If we have a module declared as A.B.C, it is more "intuitive" // to say it only has a single layer of depth do { current = current.parent; - } while (current.kind === 205 /* ModuleDeclaration */); + } while (current.kind === 206 /* ModuleDeclaration */); // fall through - case 201 /* ClassDeclaration */: - case 204 /* EnumDeclaration */: - case 202 /* InterfaceDeclaration */: - case 200 /* FunctionDeclaration */: + case 202 /* ClassDeclaration */: + case 205 /* EnumDeclaration */: + case 203 /* InterfaceDeclaration */: + case 201 /* FunctionDeclaration */: indent++; } current = current.parent; @@ -29980,21 +30812,21 @@ var ts; var childNodes = []; function visit(node) { switch (node.kind) { - case 180 /* VariableStatement */: + case 181 /* VariableStatement */: ts.forEach(node.declarationList.declarations, visit); break; - case 150 /* ObjectBindingPattern */: - case 151 /* ArrayBindingPattern */: + case 151 /* ObjectBindingPattern */: + case 152 /* ArrayBindingPattern */: ts.forEach(node.elements, visit); break; - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -30006,7 +30838,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 211 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 212 /* NamespaceImport */) { childNodes.push(importClause.namedBindings); } else { @@ -30015,21 +30847,21 @@ var ts; } } break; - case 152 /* BindingElement */: - case 198 /* VariableDeclaration */: + case 153 /* BindingElement */: + case 199 /* VariableDeclaration */: if (ts.isBindingPattern(node.name)) { visit(node.name); break; } // Fall through - case 201 /* ClassDeclaration */: - case 204 /* EnumDeclaration */: - case 202 /* InterfaceDeclaration */: - case 205 /* ModuleDeclaration */: - case 200 /* FunctionDeclaration */: - case 208 /* ImportEqualsDeclaration */: - case 213 /* ImportSpecifier */: - case 217 /* ExportSpecifier */: + case 202 /* ClassDeclaration */: + case 205 /* EnumDeclaration */: + case 203 /* InterfaceDeclaration */: + case 206 /* ModuleDeclaration */: + case 201 /* FunctionDeclaration */: + case 209 /* ImportEqualsDeclaration */: + case 214 /* ImportSpecifier */: + case 218 /* ExportSpecifier */: childNodes.push(node); break; } @@ -30077,17 +30909,17 @@ var ts; for (var _i = 0; _i < nodes.length; _i++) { var node = nodes[_i]; switch (node.kind) { - case 201 /* ClassDeclaration */: - case 204 /* EnumDeclaration */: - case 202 /* InterfaceDeclaration */: + case 202 /* ClassDeclaration */: + case 205 /* EnumDeclaration */: + case 203 /* InterfaceDeclaration */: topLevelNodes.push(node); break; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: var moduleDeclaration = node; topLevelNodes.push(node); addTopLevelNodes(getInnermostModule(moduleDeclaration).body.statements, topLevelNodes); break; - case 200 /* FunctionDeclaration */: + case 201 /* FunctionDeclaration */: var functionDeclaration = node; if (isTopLevelFunctionDeclaration(functionDeclaration)) { topLevelNodes.push(node); @@ -30098,12 +30930,12 @@ var ts; } } function isTopLevelFunctionDeclaration(functionDeclaration) { - if (functionDeclaration.kind === 200 /* FunctionDeclaration */) { + if (functionDeclaration.kind === 201 /* FunctionDeclaration */) { // A function declaration is 'top level' if it contains any function declarations // within it. - if (functionDeclaration.body && functionDeclaration.body.kind === 179 /* Block */) { + if (functionDeclaration.body && functionDeclaration.body.kind === 180 /* Block */) { // Proper function declarations can only have identifier names - if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 200 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { + if (ts.forEach(functionDeclaration.body.statements, function (s) { return s.kind === 201 /* FunctionDeclaration */ && !isEmpty(s.name.text); })) { return true; } // Or if it is not parented by another function. i.e all functions @@ -30163,7 +30995,7 @@ var ts; } function createChildItem(node) { switch (node.kind) { - case 129 /* Parameter */: + case 130 /* Parameter */: if (ts.isBindingPattern(node.name)) { break; } @@ -30171,36 +31003,36 @@ var ts; return undefined; } return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberFunctionElement); - case 136 /* GetAccessor */: + case 137 /* GetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberGetAccessorElement); - case 137 /* SetAccessor */: + case 138 /* SetAccessor */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberSetAccessorElement); - case 140 /* IndexSignature */: + case 141 /* IndexSignature */: return createItem(node, "[]", ts.ScriptElementKind.indexSignatureElement); - case 226 /* EnumMember */: + case 227 /* EnumMember */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 138 /* CallSignature */: + case 139 /* CallSignature */: return createItem(node, "()", ts.ScriptElementKind.callSignatureElement); - case 139 /* ConstructSignature */: + case 140 /* ConstructSignature */: return createItem(node, "new()", ts.ScriptElementKind.constructSignatureElement); - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.memberVariableElement); - case 200 /* FunctionDeclaration */: + case 201 /* FunctionDeclaration */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.functionElement); - case 198 /* VariableDeclaration */: - case 152 /* BindingElement */: + case 199 /* VariableDeclaration */: + case 153 /* BindingElement */: var variableDeclarationNode; - var name_22; - if (node.kind === 152 /* BindingElement */) { - name_22 = node.name; + var name_23; + if (node.kind === 153 /* BindingElement */) { + name_23 = node.name; variableDeclarationNode = node; // binding elements are added only for variable declarations // bubble up to the containing variable declaration - while (variableDeclarationNode && variableDeclarationNode.kind !== 198 /* VariableDeclaration */) { + while (variableDeclarationNode && variableDeclarationNode.kind !== 199 /* VariableDeclaration */) { variableDeclarationNode = variableDeclarationNode.parent; } ts.Debug.assert(variableDeclarationNode !== undefined); @@ -30208,24 +31040,24 @@ var ts; else { ts.Debug.assert(!ts.isBindingPattern(node.name)); variableDeclarationNode = node; - name_22 = node.name; + name_23 = node.name; } if (ts.isConst(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_22), ts.ScriptElementKind.constElement); + return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.constElement); } else if (ts.isLet(variableDeclarationNode)) { - return createItem(node, getTextOfNode(name_22), ts.ScriptElementKind.letElement); + return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.letElement); } else { - return createItem(node, getTextOfNode(name_22), ts.ScriptElementKind.variableElement); + return createItem(node, getTextOfNode(name_23), ts.ScriptElementKind.variableElement); } - case 135 /* Constructor */: + case 136 /* Constructor */: return createItem(node, "constructor", ts.ScriptElementKind.constructorImplementationElement); - case 217 /* ExportSpecifier */: - case 213 /* ImportSpecifier */: - case 208 /* ImportEqualsDeclaration */: - case 210 /* ImportClause */: - case 211 /* NamespaceImport */: + case 218 /* ExportSpecifier */: + case 214 /* ImportSpecifier */: + case 209 /* ImportEqualsDeclaration */: + case 211 /* ImportClause */: + case 212 /* NamespaceImport */: return createItem(node, getTextOfNode(node.name), ts.ScriptElementKind.alias); } return undefined; @@ -30255,17 +31087,17 @@ var ts; } function createTopLevelItem(node) { switch (node.kind) { - case 227 /* SourceFile */: + case 228 /* SourceFile */: return createSourceFileItem(node); - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: return createClassItem(node); - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: return createEnumItem(node); - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: return createIterfaceItem(node); - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: return createModuleItem(node); - case 200 /* FunctionDeclaration */: + case 201 /* FunctionDeclaration */: return createFunctionItem(node); } return undefined; @@ -30277,7 +31109,7 @@ var ts; // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = []; result.push(moduleDeclaration.name.text); - while (moduleDeclaration.body && moduleDeclaration.body.kind === 205 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 206 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(moduleDeclaration.name.text); } @@ -30289,7 +31121,7 @@ var ts; return getNavigationBarItem(moduleName, ts.ScriptElementKind.moduleElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } function createFunctionItem(node) { - if (node.body && node.body.kind === 179 /* Block */) { + if (node.body && node.body.kind === 180 /* Block */) { var childItems = getItemsWorker(sortNodes(node.body.statements), createChildItem); return getNavigationBarItem(!node.name ? "default" : node.name.text, ts.ScriptElementKind.functionElement, ts.getNodeModifiers(node), [getNodeSpan(node)], childItems, getIndent(node)); } @@ -30310,7 +31142,7 @@ var ts; var childItems; if (node.members) { var constructor = ts.forEach(node.members, function (member) { - return member.kind === 135 /* Constructor */ && member; + return member.kind === 136 /* Constructor */ && member; }); // Add the constructor parameters in as children of the class (for property parameters). // Note that *all non-binding pattern named* parameters will be added to the nodes array, but parameters that @@ -30334,7 +31166,7 @@ var ts; } } function removeComputedProperties(node) { - return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 127 /* ComputedPropertyName */; }); + return ts.filter(node.members, function (member) { return member.name === undefined || member.name.kind !== 128 /* ComputedPropertyName */; }); } /** * Like removeComputedProperties, but retains the properties with well known symbol names @@ -30343,13 +31175,13 @@ var ts; return ts.filter(node.members, function (member) { return !ts.hasDynamicName(member); }); } function getInnermostModule(node) { - while (node.body.kind === 205 /* ModuleDeclaration */) { + while (node.body.kind === 206 /* ModuleDeclaration */) { node = node.body; } return node; } function getNodeSpan(node) { - return node.kind === 227 /* SourceFile */ + return node.kind === 228 /* SourceFile */ ? ts.createTextSpanFromBounds(node.getFullStart(), node.getEnd()) : ts.createTextSpanFromBounds(node.getStart(), node.getEnd()); } @@ -31144,7 +31976,7 @@ var ts; } return createSignatureHelpItems(candidates, resolvedSignature, argumentInfo); function createJavaScriptSignatureHelpItems(argumentInfo) { - if (argumentInfo.invocation.kind !== 157 /* CallExpression */) { + if (argumentInfo.invocation.kind !== 158 /* CallExpression */) { return undefined; } // See if we can find some symbol with the call expression name that has call signatures. @@ -31152,7 +31984,7 @@ var ts; var expression = callExpression.expression; var name = expression.kind === 65 /* Identifier */ ? expression - : expression.kind === 155 /* PropertyAccessExpression */ + : expression.kind === 156 /* PropertyAccessExpression */ ? expression.name : undefined; if (!name || !name.text) { @@ -31185,7 +32017,7 @@ var ts; * in the argument of an invocation; returns undefined otherwise. */ function getImmediatelyContainingArgumentInfo(node) { - if (node.parent.kind === 157 /* CallExpression */ || node.parent.kind === 158 /* NewExpression */) { + if (node.parent.kind === 158 /* CallExpression */ || node.parent.kind === 159 /* NewExpression */) { var callExpression = node.parent; // There are 3 cases to handle: // 1. The token introduces a list, and should begin a sig help session @@ -31238,25 +32070,25 @@ var ts; }; } } - else if (node.kind === 10 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 159 /* TaggedTemplateExpression */) { + else if (node.kind === 10 /* NoSubstitutionTemplateLiteral */ && node.parent.kind === 160 /* TaggedTemplateExpression */) { // Check if we're actually inside the template; // otherwise we'll fall out and return undefined. if (ts.isInsideTemplateLiteral(node, position)) { return getArgumentListInfoForTemplate(node.parent, 0); } } - else if (node.kind === 11 /* TemplateHead */ && node.parent.parent.kind === 159 /* TaggedTemplateExpression */) { + else if (node.kind === 11 /* TemplateHead */ && node.parent.parent.kind === 160 /* TaggedTemplateExpression */) { var templateExpression = node.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 171 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 172 /* TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex); } - else if (node.parent.kind === 176 /* TemplateSpan */ && node.parent.parent.parent.kind === 159 /* TaggedTemplateExpression */) { + else if (node.parent.kind === 178 /* TemplateSpan */ && node.parent.parent.parent.kind === 160 /* TaggedTemplateExpression */) { var templateSpan = node.parent; var templateExpression = templateSpan.parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 171 /* TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 172 /* TemplateExpression */); // If we're just after a template tail, don't show signature help. if (node.kind === 13 /* TemplateTail */ && !ts.isInsideTemplateLiteral(node, position)) { return undefined; @@ -31374,7 +32206,7 @@ var ts; // // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 171 /* TemplateExpression */) { + if (template.kind === 172 /* TemplateExpression */) { var lastSpan = ts.lastOrUndefined(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, false); @@ -31383,7 +32215,7 @@ var ts; return ts.createTextSpan(applicableSpanStart, applicableSpanEnd - applicableSpanStart); } function getContainingArgumentInfo(node) { - for (var n = node; n.kind !== 227 /* SourceFile */; n = n.parent) { + for (var n = node; n.kind !== 228 /* SourceFile */; n = n.parent) { if (ts.isFunctionBlock(n)) { return undefined; } @@ -31584,40 +32416,40 @@ var ts; return false; } switch (n.kind) { - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 204 /* EnumDeclaration */: - case 154 /* ObjectLiteralExpression */: - case 150 /* ObjectBindingPattern */: - case 145 /* TypeLiteral */: - case 179 /* Block */: - case 206 /* ModuleBlock */: - case 207 /* CaseBlock */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 205 /* EnumDeclaration */: + case 155 /* ObjectLiteralExpression */: + case 151 /* ObjectBindingPattern */: + case 146 /* TypeLiteral */: + case 180 /* Block */: + case 207 /* ModuleBlock */: + case 208 /* CaseBlock */: return nodeEndsWith(n, 15 /* CloseBraceToken */, sourceFile); - case 223 /* CatchClause */: + case 224 /* CatchClause */: return isCompletedNode(n.block, sourceFile); - case 158 /* NewExpression */: + case 159 /* NewExpression */: if (!n.arguments) { return true; } // fall through - case 157 /* CallExpression */: - case 161 /* ParenthesizedExpression */: - case 149 /* ParenthesizedType */: + case 158 /* CallExpression */: + case 162 /* ParenthesizedExpression */: + case 150 /* ParenthesizedType */: return nodeEndsWith(n, 17 /* CloseParenToken */, sourceFile); - case 142 /* FunctionType */: - case 143 /* ConstructorType */: + case 143 /* FunctionType */: + case 144 /* ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 139 /* ConstructSignature */: - case 138 /* CallSignature */: - case 163 /* ArrowFunction */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 140 /* ConstructSignature */: + case 139 /* CallSignature */: + case 164 /* ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -31627,63 +32459,63 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 17 /* CloseParenToken */, sourceFile); - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: return n.body && isCompletedNode(n.body, sourceFile); - case 183 /* IfStatement */: + case 184 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 182 /* ExpressionStatement */: + case 183 /* ExpressionStatement */: return isCompletedNode(n.expression, sourceFile); - case 153 /* ArrayLiteralExpression */: - case 151 /* ArrayBindingPattern */: - case 156 /* ElementAccessExpression */: - case 127 /* ComputedPropertyName */: - case 147 /* TupleType */: + case 154 /* ArrayLiteralExpression */: + case 152 /* ArrayBindingPattern */: + case 157 /* ElementAccessExpression */: + case 128 /* ComputedPropertyName */: + case 148 /* TupleType */: return nodeEndsWith(n, 19 /* CloseBracketToken */, sourceFile); - case 140 /* IndexSignature */: + case 141 /* IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 19 /* CloseBracketToken */, sourceFile); - case 220 /* CaseClause */: - case 221 /* DefaultClause */: + case 221 /* CaseClause */: + case 222 /* DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicitly always consider them non-completed return false; - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 185 /* WhileStatement */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 186 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 184 /* DoStatement */: + case 185 /* DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; var hasWhileKeyword = findChildOfKind(n, 100 /* WhileKeyword */, sourceFile); if (hasWhileKeyword) { return nodeEndsWith(n, 17 /* CloseParenToken */, sourceFile); } return isCompletedNode(n.statement, sourceFile); - case 144 /* TypeQuery */: + case 145 /* TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 165 /* TypeOfExpression */: - case 164 /* DeleteExpression */: - case 166 /* VoidExpression */: - case 172 /* YieldExpression */: - case 173 /* SpreadElementExpression */: + case 166 /* TypeOfExpression */: + case 165 /* DeleteExpression */: + case 167 /* VoidExpression */: + case 173 /* YieldExpression */: + case 174 /* SpreadElementExpression */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 159 /* TaggedTemplateExpression */: + case 160 /* TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 171 /* TemplateExpression */: + case 172 /* TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 176 /* TemplateSpan */: + case 178 /* TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 167 /* PrefixUnaryExpression */: + case 168 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 169 /* BinaryExpression */: + case 170 /* BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 170 /* ConditionalExpression */: + case 171 /* ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -31739,7 +32571,7 @@ var ts; // for the position of the relevant node (or comma). var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { // find syntax list that covers the span of the node - if (c.kind === 228 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { + if (c.kind === 229 /* SyntaxList */ && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -31873,7 +32705,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 227 /* SourceFile */); + ts.Debug.assert(startNode !== undefined || n.kind === 228 /* SourceFile */); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -31917,17 +32749,17 @@ var ts; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 141 /* TypeReference */ || node.kind === 157 /* CallExpression */) { + if (node.kind === 142 /* TypeReference */ || node.kind === 158 /* CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 201 /* ClassDeclaration */ || node.kind === 202 /* InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 202 /* ClassDeclaration */ || node.kind === 203 /* InterfaceDeclaration */) { return node.typeParameters; } return undefined; } ts.getTypeArgumentOrTypeParameterList = getTypeArgumentOrTypeParameterList; function isToken(n) { - return n.kind >= 0 /* FirstToken */ && n.kind <= 125 /* LastToken */; + return n.kind >= 0 /* FirstToken */ && n.kind <= 126 /* LastToken */; } ts.isToken = isToken; function isWord(kind) { @@ -31982,7 +32814,7 @@ var ts; var ts; (function (ts) { function isFirstDeclarationOfSymbolParameter(symbol) { - return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 129 /* Parameter */; + return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 130 /* Parameter */; } ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter; var displayPartWriter = getDisplayPartWriter(); @@ -32684,7 +33516,7 @@ var ts; this.SpaceAfterTryFinally = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([96 /* TryKeyword */, 81 /* FinallyKeyword */]), 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // get x() {} // set x(val) {} - this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([116 /* GetKeyword */, 120 /* SetKeyword */]), 65 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); + this.SpaceAfterGetSetInMember = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([116 /* GetKeyword */, 121 /* SetKeyword */]), 65 /* Identifier */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext), 2 /* Space */)); // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. 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 /* Space */)); 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 /* Space */)); @@ -32692,9 +33524,9 @@ var ts; // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses this.NoSpaceAfterConstructor = new formatting.Rule(formatting.RuleDescriptor.create1(114 /* ConstructorKeyword */, 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Use of module as a function call. e.g.: import m2 = module("m2"); - this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([117 /* ModuleKeyword */, 118 /* RequireKeyword */]), 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); + this.NoSpaceAfterModuleImport = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.FromTokens([117 /* ModuleKeyword */, 119 /* RequireKeyword */]), 16 /* OpenParenToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); // Add a space around certain TypeScript keywords - this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([69 /* ClassKeyword */, 115 /* DeclareKeyword */, 77 /* EnumKeyword */, 78 /* ExportKeyword */, 79 /* ExtendsKeyword */, 116 /* GetKeyword */, 102 /* ImplementsKeyword */, 85 /* ImportKeyword */, 103 /* InterfaceKeyword */, 117 /* ModuleKeyword */, 106 /* PrivateKeyword */, 108 /* PublicKeyword */, 120 /* SetKeyword */, 109 /* StaticKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); + this.SpaceAfterCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.FromTokens([69 /* ClassKeyword */, 115 /* DeclareKeyword */, 77 /* EnumKeyword */, 78 /* ExportKeyword */, 79 /* ExtendsKeyword */, 116 /* GetKeyword */, 102 /* ImplementsKeyword */, 85 /* ImportKeyword */, 103 /* InterfaceKeyword */, 117 /* ModuleKeyword */, 118 /* NamespaceKeyword */, 106 /* PrivateKeyword */, 108 /* PublicKeyword */, 121 /* SetKeyword */, 109 /* StaticKeyword */]), formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); this.SpaceBeforeCertainTypeScriptKeywords = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([79 /* ExtendsKeyword */, 102 /* ImplementsKeyword */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { this.SpaceAfterModuleName = new formatting.Rule(formatting.RuleDescriptor.create1(8 /* StringLiteral */, 14 /* OpenBraceToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsModuleDeclContext), 2 /* Space */)); @@ -32714,7 +33546,7 @@ var ts; // decorators this.SpaceBeforeAt = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 52 /* AtToken */), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 2 /* Space */)); this.NoSpaceAfterAt = new formatting.Rule(formatting.RuleDescriptor.create3(52 /* AtToken */, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsSameLineTokenContext), 8 /* Delete */)); - this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([65 /* Identifier */, 78 /* ExportKeyword */, 73 /* DefaultKeyword */, 69 /* ClassKeyword */, 109 /* StaticKeyword */, 108 /* PublicKeyword */, 106 /* PrivateKeyword */, 107 /* ProtectedKeyword */, 116 /* GetKeyword */, 120 /* SetKeyword */, 18 /* OpenBracketToken */, 35 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); + this.SpaceAfterDecorator = new formatting.Rule(formatting.RuleDescriptor.create4(formatting.Shared.TokenRange.Any, formatting.Shared.TokenRange.FromTokens([65 /* Identifier */, 78 /* ExportKeyword */, 73 /* DefaultKeyword */, 69 /* ClassKeyword */, 109 /* StaticKeyword */, 108 /* PublicKeyword */, 106 /* PrivateKeyword */, 107 /* ProtectedKeyword */, 116 /* GetKeyword */, 121 /* SetKeyword */, 18 /* OpenBracketToken */, 35 /* AsteriskToken */])), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsEndOfDecoratorContextOnSameLine), 2 /* Space */)); // These rules are higher in priority than user-configurable rules. this.HighPriorityCommonRules = [ @@ -32804,9 +33636,9 @@ var ts; } Rules.prototype.getRuleName = function (rule) { var o = this; - for (var name_23 in o) { - if (o[name_23] === rule) { - return name_23; + for (var name_24 in o) { + if (o[name_24] === rule) { + return name_24; } } throw new Error("Unknown rule"); @@ -32815,36 +33647,36 @@ var ts; /// Contexts /// Rules.IsForContext = function (context) { - return context.contextNode.kind === 186 /* ForStatement */; + return context.contextNode.kind === 187 /* ForStatement */; }; Rules.IsNotForContext = function (context) { return !Rules.IsForContext(context); }; Rules.IsBinaryOpContext = function (context) { switch (context.contextNode.kind) { - case 169 /* BinaryExpression */: - case 170 /* ConditionalExpression */: + case 170 /* BinaryExpression */: + case 171 /* ConditionalExpression */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 152 /* BindingElement */: + case 153 /* BindingElement */: // equals in type X = ... - case 203 /* TypeAliasDeclaration */: + case 204 /* TypeAliasDeclaration */: // equal in import a = module('a'); - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: // equal in let a = 0; - case 198 /* VariableDeclaration */: + case 199 /* VariableDeclaration */: // equal in p = 0; - case 129 /* Parameter */: - case 226 /* EnumMember */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 130 /* Parameter */: + case 227 /* EnumMember */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: return context.currentTokenSpan.kind === 53 /* EqualsToken */ || context.nextTokenSpan.kind === 53 /* EqualsToken */; // "in" keyword in for (let x in []) { } - case 187 /* ForInStatement */: + case 188 /* ForInStatement */: return context.currentTokenSpan.kind === 86 /* InKeyword */ || context.nextTokenSpan.kind === 86 /* InKeyword */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 188 /* ForOfStatement */: - return context.currentTokenSpan.kind === 125 /* OfKeyword */ || context.nextTokenSpan.kind === 125 /* OfKeyword */; + case 189 /* ForOfStatement */: + return context.currentTokenSpan.kind === 126 /* OfKeyword */ || context.nextTokenSpan.kind === 126 /* OfKeyword */; } return false; }; @@ -32852,7 +33684,7 @@ var ts; return !Rules.IsBinaryOpContext(context); }; Rules.IsConditionalOperatorContext = function (context) { - return context.contextNode.kind === 170 /* ConditionalExpression */; + return context.contextNode.kind === 171 /* ConditionalExpression */; }; Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { //// This check is mainly used inside SpaceBeforeOpenBraceInControl and SpaceBeforeOpenBraceInFunction. @@ -32896,31 +33728,31 @@ var ts; return true; } switch (node.kind) { - case 179 /* Block */: - case 207 /* CaseBlock */: - case 154 /* ObjectLiteralExpression */: - case 206 /* ModuleBlock */: + case 180 /* Block */: + case 208 /* CaseBlock */: + case 155 /* ObjectLiteralExpression */: + case 207 /* ModuleBlock */: return true; } return false; }; Rules.IsFunctionDeclContext = function (context) { switch (context.contextNode.kind) { - case 200 /* FunctionDeclaration */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 201 /* FunctionDeclaration */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: //case SyntaxKind.MemberFunctionDeclaration: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: ///case SyntaxKind.MethodSignature: - case 138 /* CallSignature */: - case 162 /* FunctionExpression */: - case 135 /* Constructor */: - case 163 /* ArrowFunction */: + case 139 /* CallSignature */: + case 163 /* FunctionExpression */: + case 136 /* Constructor */: + case 164 /* ArrowFunction */: //case SyntaxKind.ConstructorDeclaration: //case SyntaxKind.SimpleArrowFunctionExpression: //case SyntaxKind.ParenthesizedArrowFunctionExpression: - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: return true; } return false; @@ -32930,55 +33762,55 @@ var ts; }; Rules.NodeIsTypeScriptDeclWithBlockContext = function (node) { switch (node.kind) { - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 204 /* EnumDeclaration */: - case 145 /* TypeLiteral */: - case 205 /* ModuleDeclaration */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 205 /* EnumDeclaration */: + case 146 /* TypeLiteral */: + case 206 /* ModuleDeclaration */: return true; } return false; }; Rules.IsAfterCodeBlockContext = function (context) { switch (context.currentTokenParent.kind) { - case 201 /* ClassDeclaration */: - case 205 /* ModuleDeclaration */: - case 204 /* EnumDeclaration */: - case 179 /* Block */: - case 223 /* CatchClause */: - case 206 /* ModuleBlock */: - case 193 /* SwitchStatement */: + case 202 /* ClassDeclaration */: + case 206 /* ModuleDeclaration */: + case 205 /* EnumDeclaration */: + case 180 /* Block */: + case 224 /* CatchClause */: + case 207 /* ModuleBlock */: + case 194 /* SwitchStatement */: return true; } return false; }; Rules.IsControlDeclContext = function (context) { switch (context.contextNode.kind) { - case 183 /* IfStatement */: - case 193 /* SwitchStatement */: - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 185 /* WhileStatement */: - case 196 /* TryStatement */: - case 184 /* DoStatement */: - case 192 /* WithStatement */: + case 184 /* IfStatement */: + case 194 /* SwitchStatement */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 186 /* WhileStatement */: + case 197 /* TryStatement */: + case 185 /* DoStatement */: + case 193 /* WithStatement */: // TODO // case SyntaxKind.ElseClause: - case 223 /* CatchClause */: + case 224 /* CatchClause */: return true; default: return false; } }; Rules.IsObjectContext = function (context) { - return context.contextNode.kind === 154 /* ObjectLiteralExpression */; + return context.contextNode.kind === 155 /* ObjectLiteralExpression */; }; Rules.IsFunctionCallContext = function (context) { - return context.contextNode.kind === 157 /* CallExpression */; + return context.contextNode.kind === 158 /* CallExpression */; }; Rules.IsNewContext = function (context) { - return context.contextNode.kind === 158 /* NewExpression */; + return context.contextNode.kind === 159 /* NewExpression */; }; Rules.IsFunctionCallOrNewContext = function (context) { return Rules.IsFunctionCallContext(context) || Rules.IsNewContext(context); @@ -32999,38 +33831,38 @@ var ts; while (ts.isExpression(node)) { node = node.parent; } - return node.kind === 130 /* Decorator */; + return node.kind === 131 /* Decorator */; }; Rules.IsStartOfVariableDeclarationList = function (context) { - return context.currentTokenParent.kind === 199 /* VariableDeclarationList */ && + return context.currentTokenParent.kind === 200 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; }; Rules.IsNotFormatOnEnter = function (context) { return context.formattingRequestKind != 2 /* FormatOnEnter */; }; Rules.IsModuleDeclContext = function (context) { - return context.contextNode.kind === 205 /* ModuleDeclaration */; + return context.contextNode.kind === 206 /* ModuleDeclaration */; }; Rules.IsObjectTypeContext = function (context) { - return context.contextNode.kind === 145 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 146 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; }; Rules.IsTypeArgumentOrParameter = function (token, parent) { if (token.kind !== 24 /* LessThanToken */ && token.kind !== 25 /* GreaterThanToken */) { return false; } switch (parent.kind) { - case 141 /* TypeReference */: - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: - case 157 /* CallExpression */: - case 158 /* NewExpression */: + case 142 /* TypeReference */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: return true; default: return false; @@ -33041,7 +33873,7 @@ var ts; Rules.IsTypeArgumentOrParameter(context.nextTokenSpan, context.nextTokenParent); }; Rules.IsVoidOpContext = function (context) { - return context.currentTokenSpan.kind === 99 /* VoidKeyword */ && context.currentTokenParent.kind === 166 /* VoidExpression */; + return context.currentTokenSpan.kind === 99 /* VoidKeyword */ && context.currentTokenParent.kind === 167 /* VoidExpression */; }; return Rules; })(); @@ -33065,7 +33897,7 @@ var ts; return result; }; RulesMap.prototype.Initialize = function (rules) { - this.mapRowLength = 125 /* LastToken */ + 1; + this.mapRowLength = 126 /* LastToken */ + 1; this.map = new Array(this.mapRowLength * this.mapRowLength); //new Array(this.mapRowLength * this.mapRowLength); // This array is used only during construction of the rulesbucket in the map var rulesBucketConstructionStateList = new Array(this.map.length); //new Array(this.map.length); @@ -33260,7 +34092,7 @@ var ts; } TokenAllAccess.prototype.GetTokens = function () { var result = []; - for (var token = 0 /* FirstToken */; token <= 125 /* LastToken */; token++) { + for (var token = 0 /* FirstToken */; token <= 126 /* LastToken */; token++) { result.push(token); } return result; @@ -33302,9 +34134,9 @@ var ts; }; TokenRange.Any = TokenRange.AllTokens(); TokenRange.AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([3 /* MultiLineCommentTrivia */])); - TokenRange.Keywords = TokenRange.FromRange(66 /* FirstKeyword */, 125 /* LastKeyword */); + TokenRange.Keywords = TokenRange.FromRange(66 /* FirstKeyword */, 126 /* LastKeyword */); TokenRange.BinaryOperators = TokenRange.FromRange(24 /* FirstBinaryOperator */, 64 /* LastBinaryOperator */); - TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([86 /* InKeyword */, 87 /* InstanceOfKeyword */, 125 /* OfKeyword */]); + TokenRange.BinaryKeywordOperators = TokenRange.FromTokens([86 /* InKeyword */, 87 /* InstanceOfKeyword */, 126 /* OfKeyword */]); TokenRange.UnaryPrefixOperators = TokenRange.FromTokens([38 /* PlusPlusToken */, 39 /* MinusMinusToken */, 47 /* TildeToken */, 46 /* ExclamationToken */]); TokenRange.UnaryPrefixExpressions = TokenRange.FromTokens([7 /* NumericLiteral */, 65 /* Identifier */, 16 /* OpenParenToken */, 18 /* OpenBracketToken */, 14 /* OpenBraceToken */, 93 /* ThisKeyword */, 88 /* NewKeyword */]); TokenRange.UnaryPreincrementExpressions = TokenRange.FromTokens([65 /* Identifier */, 16 /* OpenParenToken */, 93 /* ThisKeyword */, 88 /* NewKeyword */]); @@ -33312,7 +34144,7 @@ var ts; TokenRange.UnaryPredecrementExpressions = TokenRange.FromTokens([65 /* Identifier */, 16 /* OpenParenToken */, 93 /* ThisKeyword */, 88 /* NewKeyword */]); TokenRange.UnaryPostdecrementExpressions = TokenRange.FromTokens([65 /* Identifier */, 17 /* CloseParenToken */, 19 /* CloseBracketToken */, 88 /* NewKeyword */]); TokenRange.Comments = TokenRange.FromTokens([2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]); - TokenRange.TypeNames = TokenRange.FromTokens([65 /* Identifier */, 119 /* NumberKeyword */, 121 /* StringKeyword */, 113 /* BooleanKeyword */, 122 /* SymbolKeyword */, 99 /* VoidKeyword */, 112 /* AnyKeyword */]); + TokenRange.TypeNames = TokenRange.FromTokens([65 /* Identifier */, 120 /* NumberKeyword */, 122 /* StringKeyword */, 113 /* BooleanKeyword */, 123 /* SymbolKeyword */, 99 /* VoidKeyword */, 112 /* AnyKeyword */]); return TokenRange; })(); Shared.TokenRange = TokenRange; @@ -33515,17 +34347,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: var body = parent.body; - return body && body.kind === 179 /* Block */ && ts.rangeContainsRange(body.statements, node); - case 227 /* SourceFile */: - case 179 /* Block */: - case 206 /* ModuleBlock */: + return body && body.kind === 180 /* Block */ && ts.rangeContainsRange(body.statements, node); + case 228 /* SourceFile */: + case 180 /* Block */: + case 207 /* ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 223 /* CatchClause */: + case 224 /* CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -33696,9 +34528,9 @@ var ts; // - source file // - switch\default clauses if (isSomeBlock(parent.kind) || - parent.kind === 227 /* SourceFile */ || - parent.kind === 220 /* CaseClause */ || - parent.kind === 221 /* DefaultClause */) { + parent.kind === 228 /* SourceFile */ || + parent.kind === 221 /* CaseClause */ || + parent.kind === 222 /* DefaultClause */) { indentation = parentDynamicIndentation.getIndentation() + parentDynamicIndentation.getDelta(); } else { @@ -33732,19 +34564,19 @@ var ts; return node.modifiers[0].kind; } switch (node.kind) { - case 201 /* ClassDeclaration */: return 69 /* ClassKeyword */; - case 202 /* InterfaceDeclaration */: return 103 /* InterfaceKeyword */; - case 200 /* FunctionDeclaration */: return 83 /* FunctionKeyword */; - case 204 /* EnumDeclaration */: return 204 /* EnumDeclaration */; - case 136 /* GetAccessor */: return 116 /* GetKeyword */; - case 137 /* SetAccessor */: return 120 /* SetKeyword */; - case 134 /* MethodDeclaration */: + case 202 /* ClassDeclaration */: return 69 /* ClassKeyword */; + case 203 /* InterfaceDeclaration */: return 103 /* InterfaceKeyword */; + case 201 /* FunctionDeclaration */: return 83 /* FunctionKeyword */; + case 205 /* EnumDeclaration */: return 205 /* EnumDeclaration */; + case 137 /* GetAccessor */: return 116 /* GetKeyword */; + case 138 /* SetAccessor */: return 121 /* SetKeyword */; + case 135 /* MethodDeclaration */: if (node.asteriskToken) { return 35 /* AsteriskToken */; } // fall-through - case 132 /* PropertyDeclaration */: - case 129 /* Parameter */: + case 133 /* PropertyDeclaration */: + case 130 /* Parameter */: return node.name.kind; } } @@ -33877,7 +34709,7 @@ var ts; consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation); return inheritedIndentation; } - var effectiveParentStartLine = child.kind === 130 /* Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 131 /* Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; @@ -34199,20 +35031,20 @@ var ts; } function isSomeBlock(kind) { switch (kind) { - case 179 /* Block */: - case 206 /* ModuleBlock */: + case 180 /* Block */: + case 207 /* ModuleBlock */: return true; } return false; } function getOpenTokenForList(node, list) { switch (node.kind) { - case 135 /* Constructor */: - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 163 /* ArrowFunction */: + case 136 /* Constructor */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 164 /* ArrowFunction */: if (node.typeParameters === list) { return 24 /* LessThanToken */; } @@ -34220,8 +35052,8 @@ var ts; return 16 /* OpenParenToken */; } break; - case 157 /* CallExpression */: - case 158 /* NewExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: if (node.typeArguments === list) { return 24 /* LessThanToken */; } @@ -34229,7 +35061,7 @@ var ts; return 16 /* OpenParenToken */; } break; - case 141 /* TypeReference */: + case 142 /* TypeReference */: if (node.typeArguments === list) { return 24 /* LessThanToken */; } @@ -34328,7 +35160,7 @@ var ts; return 0; } var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; - if (precedingToken.kind === 23 /* CommaToken */ && precedingToken.parent.kind !== 169 /* BinaryExpression */) { + if (precedingToken.kind === 23 /* CommaToken */ && precedingToken.parent.kind !== 170 /* BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Unknown */) { @@ -34439,7 +35271,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatement(current)) && - (parent.kind === 227 /* SourceFile */ || !parentAndChildShareLine); + (parent.kind === 228 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -34472,7 +35304,7 @@ var ts; return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 183 /* IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 184 /* IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 76 /* ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -34484,23 +35316,23 @@ var ts; function getContainingList(node, sourceFile) { if (node.parent) { switch (node.parent.kind) { - case 141 /* TypeReference */: + case 142 /* TypeReference */: if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, node.getStart(sourceFile), node.getEnd())) { return node.parent.typeArguments; } break; - case 154 /* ObjectLiteralExpression */: + case 155 /* ObjectLiteralExpression */: return node.parent.properties; - case 153 /* ArrayLiteralExpression */: + case 154 /* ArrayLiteralExpression */: return node.parent.elements; - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: { + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: { var start = node.getStart(sourceFile); if (node.parent.typeParameters && ts.rangeContainsStartEnd(node.parent.typeParameters, start, node.getEnd())) { @@ -34511,8 +35343,8 @@ var ts; } break; } - case 158 /* NewExpression */: - case 157 /* CallExpression */: { + case 159 /* NewExpression */: + case 158 /* CallExpression */: { var start = node.getStart(sourceFile); if (node.parent.typeArguments && ts.rangeContainsStartEnd(node.parent.typeArguments, start, node.getEnd())) { @@ -34591,28 +35423,28 @@ var ts; SmartIndenter.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn; function nodeContentIsAlwaysIndented(kind) { switch (kind) { - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 204 /* EnumDeclaration */: - case 153 /* ArrayLiteralExpression */: - case 179 /* Block */: - case 206 /* ModuleBlock */: - case 154 /* ObjectLiteralExpression */: - case 145 /* TypeLiteral */: - case 147 /* TupleType */: - case 207 /* CaseBlock */: - case 221 /* DefaultClause */: - case 220 /* CaseClause */: - case 161 /* ParenthesizedExpression */: - case 157 /* CallExpression */: - case 158 /* NewExpression */: - case 180 /* VariableStatement */: - case 198 /* VariableDeclaration */: - case 214 /* ExportAssignment */: - case 191 /* ReturnStatement */: - case 170 /* ConditionalExpression */: - case 151 /* ArrayBindingPattern */: - case 150 /* ObjectBindingPattern */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 205 /* EnumDeclaration */: + case 154 /* ArrayLiteralExpression */: + case 180 /* Block */: + case 207 /* ModuleBlock */: + case 155 /* ObjectLiteralExpression */: + case 146 /* TypeLiteral */: + case 148 /* TupleType */: + case 208 /* CaseBlock */: + case 222 /* DefaultClause */: + case 221 /* CaseClause */: + case 162 /* ParenthesizedExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: + case 181 /* VariableStatement */: + case 199 /* VariableDeclaration */: + case 215 /* ExportAssignment */: + case 192 /* ReturnStatement */: + case 171 /* ConditionalExpression */: + case 152 /* ArrayBindingPattern */: + case 151 /* ObjectBindingPattern */: return true; } return false; @@ -34622,22 +35454,22 @@ var ts; return true; } switch (parent) { - case 184 /* DoStatement */: - case 185 /* WhileStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 186 /* ForStatement */: - case 183 /* IfStatement */: - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 138 /* CallSignature */: - case 163 /* ArrowFunction */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - return child !== 179 /* Block */; + case 185 /* DoStatement */: + case 186 /* WhileStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 187 /* ForStatement */: + case 184 /* IfStatement */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 139 /* CallSignature */: + case 164 /* ArrowFunction */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + return child !== 180 /* Block */; default: return false; } @@ -34647,7 +35479,7 @@ var ts; })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); /// -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; @@ -34742,7 +35574,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(228 /* SyntaxList */, nodes.pos, nodes.end, 1024 /* Synthetic */, this); + var list = createNode(229 /* SyntaxList */, nodes.pos, nodes.end, 1024 /* Synthetic */, this); list._children = []; var pos = nodes.pos; for (var _i = 0; _i < nodes.length; _i++) { @@ -34761,7 +35593,7 @@ var ts; NodeObject.prototype.createChildren = function (sourceFile) { var _this = this; var children; - if (this.kind >= 126 /* FirstNode */) { + if (this.kind >= 127 /* FirstNode */) { scanner.setText((sourceFile || this.getSourceFile()).text); children = []; var pos = this.pos; @@ -34806,7 +35638,7 @@ var ts; var children = this.getChildren(); for (var _i = 0; _i < children.length; _i++) { var child = children[_i]; - if (child.kind < 126 /* FirstNode */) { + if (child.kind < 127 /* FirstNode */) { return child; } return child.getFirstToken(sourceFile); @@ -34816,7 +35648,7 @@ var ts; var children = this.getChildren(sourceFile); for (var i = children.length - 1; i >= 0; i--) { var child = children[i]; - if (child.kind < 126 /* FirstNode */) { + if (child.kind < 127 /* FirstNode */) { return child; } return child.getLastToken(sourceFile); @@ -34869,7 +35701,7 @@ var ts; if (ts.indexOf(declarations, declaration) === indexOfDeclaration) { var sourceFileOfDeclaration = ts.getSourceFileOfNode(declaration); // If it is parameter - try and get the jsDoc comment with @param tag from function declaration's jsDoc comments - if (canUseParsedParamTagComments && declaration.kind === 129 /* Parameter */) { + if (canUseParsedParamTagComments && declaration.kind === 130 /* Parameter */) { ts.forEach(getJsDocCommentTextRange(declaration.parent, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedParamJsDocComment = getCleanedParamJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedParamJsDocComment) { @@ -34878,15 +35710,15 @@ var ts; }); } // If this is left side of dotted module declaration, there is no doc comments associated with this node - if (declaration.kind === 205 /* ModuleDeclaration */ && declaration.body.kind === 205 /* ModuleDeclaration */) { + if (declaration.kind === 206 /* ModuleDeclaration */ && declaration.body.kind === 206 /* ModuleDeclaration */) { return; } // If this is dotted module name, get the doc comments from the parent - while (declaration.kind === 205 /* ModuleDeclaration */ && declaration.parent.kind === 205 /* ModuleDeclaration */) { + while (declaration.kind === 206 /* ModuleDeclaration */ && declaration.parent.kind === 206 /* ModuleDeclaration */) { declaration = declaration.parent; } // Get the cleaned js doc comment text from the declaration - ts.forEach(getJsDocCommentTextRange(declaration.kind === 198 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { + ts.forEach(getJsDocCommentTextRange(declaration.kind === 199 /* VariableDeclaration */ ? declaration.parent.parent : declaration, sourceFileOfDeclaration), function (jsDocCommentTextRange) { var cleanedJsDocComment = getCleanedJsDocComment(jsDocCommentTextRange.pos, jsDocCommentTextRange.end, sourceFileOfDeclaration); if (cleanedJsDocComment) { jsDocCommentParts.push.apply(jsDocCommentParts, cleanedJsDocComment); @@ -35225,9 +36057,9 @@ var ts; if (result_2 !== undefined) { return result_2; } - if (declaration.name.kind === 127 /* ComputedPropertyName */) { + if (declaration.name.kind === 128 /* ComputedPropertyName */) { var expr = declaration.name.expression; - if (expr.kind === 155 /* PropertyAccessExpression */) { + if (expr.kind === 156 /* PropertyAccessExpression */) { return expr.name.text; } return getTextOfIdentifierOrLiteral(expr); @@ -35247,9 +36079,9 @@ var ts; } function visit(node) { switch (node.kind) { - case 200 /* FunctionDeclaration */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 201 /* FunctionDeclaration */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -35269,60 +36101,60 @@ var ts; ts.forEachChild(node, visit); } break; - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 203 /* TypeAliasDeclaration */: - case 204 /* EnumDeclaration */: - case 205 /* ModuleDeclaration */: - case 208 /* ImportEqualsDeclaration */: - case 217 /* ExportSpecifier */: - case 213 /* ImportSpecifier */: - case 208 /* ImportEqualsDeclaration */: - case 210 /* ImportClause */: - case 211 /* NamespaceImport */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 145 /* TypeLiteral */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 204 /* TypeAliasDeclaration */: + case 205 /* EnumDeclaration */: + case 206 /* ModuleDeclaration */: + case 209 /* ImportEqualsDeclaration */: + case 218 /* ExportSpecifier */: + case 214 /* ImportSpecifier */: + case 209 /* ImportEqualsDeclaration */: + case 211 /* ImportClause */: + case 212 /* NamespaceImport */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 146 /* TypeLiteral */: addDeclaration(node); // fall through - case 135 /* Constructor */: - case 180 /* VariableStatement */: - case 199 /* VariableDeclarationList */: - case 150 /* ObjectBindingPattern */: - case 151 /* ArrayBindingPattern */: - case 206 /* ModuleBlock */: + case 136 /* Constructor */: + case 181 /* VariableStatement */: + case 200 /* VariableDeclarationList */: + case 151 /* ObjectBindingPattern */: + case 152 /* ArrayBindingPattern */: + case 207 /* ModuleBlock */: ts.forEachChild(node, visit); break; - case 179 /* Block */: + case 180 /* Block */: if (ts.isFunctionBlock(node)) { ts.forEachChild(node, visit); } break; - case 129 /* Parameter */: + case 130 /* Parameter */: // Only consider properties defined as constructor parameters if (!(node.flags & 112 /* AccessibilityModifier */)) { break; } // fall through - case 198 /* VariableDeclaration */: - case 152 /* BindingElement */: + case 199 /* VariableDeclaration */: + case 153 /* BindingElement */: if (ts.isBindingPattern(node.name)) { ts.forEachChild(node.name, visit); break; } - case 226 /* EnumMember */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 227 /* EnumMember */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: addDeclaration(node); break; - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; if (node.exportClause) { ts.forEach(node.exportClause.elements, visit); } break; - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -35334,7 +36166,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 211 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 212 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -35393,7 +36225,7 @@ var ts; })(ts.OutputFileType || (ts.OutputFileType = {})); var OutputFileType = ts.OutputFileType; (function (EndOfLineState) { - EndOfLineState[EndOfLineState["Start"] = 0] = "Start"; + EndOfLineState[EndOfLineState["None"] = 0] = "None"; EndOfLineState[EndOfLineState["InMultiLineCommentTrivia"] = 1] = "InMultiLineCommentTrivia"; EndOfLineState[EndOfLineState["InSingleQuoteStringLiteral"] = 2] = "InSingleQuoteStringLiteral"; EndOfLineState[EndOfLineState["InDoubleQuoteStringLiteral"] = 3] = "InDoubleQuoteStringLiteral"; @@ -35495,10 +36327,31 @@ var ts; ClassificationTypeNames.interfaceName = "interface name"; ClassificationTypeNames.moduleName = "module name"; ClassificationTypeNames.typeParameterName = "type parameter name"; - ClassificationTypeNames.typeAlias = "type alias name"; + ClassificationTypeNames.typeAliasName = "type alias name"; + ClassificationTypeNames.parameterName = "parameter name"; return ClassificationTypeNames; })(); ts.ClassificationTypeNames = ClassificationTypeNames; + (function (ClassificationType) { + ClassificationType[ClassificationType["comment"] = 1] = "comment"; + ClassificationType[ClassificationType["identifier"] = 2] = "identifier"; + ClassificationType[ClassificationType["keyword"] = 3] = "keyword"; + ClassificationType[ClassificationType["numericLiteral"] = 4] = "numericLiteral"; + ClassificationType[ClassificationType["operator"] = 5] = "operator"; + ClassificationType[ClassificationType["stringLiteral"] = 6] = "stringLiteral"; + ClassificationType[ClassificationType["regularExpressionLiteral"] = 7] = "regularExpressionLiteral"; + ClassificationType[ClassificationType["whiteSpace"] = 8] = "whiteSpace"; + ClassificationType[ClassificationType["text"] = 9] = "text"; + ClassificationType[ClassificationType["punctuation"] = 10] = "punctuation"; + ClassificationType[ClassificationType["className"] = 11] = "className"; + ClassificationType[ClassificationType["enumName"] = 12] = "enumName"; + ClassificationType[ClassificationType["interfaceName"] = 13] = "interfaceName"; + ClassificationType[ClassificationType["moduleName"] = 14] = "moduleName"; + ClassificationType[ClassificationType["typeParameterName"] = 15] = "typeParameterName"; + ClassificationType[ClassificationType["typeAliasName"] = 16] = "typeAliasName"; + ClassificationType[ClassificationType["parameterName"] = 17] = "parameterName"; + })(ts.ClassificationType || (ts.ClassificationType = {})); + var ClassificationType = ts.ClassificationType; function displayPartsToString(displayParts) { if (displayParts) { return ts.map(displayParts, function (displayPart) { return displayPart.text; }).join(""); @@ -35512,16 +36365,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 162 /* FunctionExpression */) { + if (declaration.kind === 163 /* FunctionExpression */) { return true; } - if (declaration.kind !== 198 /* VariableDeclaration */ && declaration.kind !== 200 /* FunctionDeclaration */) { + if (declaration.kind !== 199 /* VariableDeclaration */ && declaration.kind !== 201 /* FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable for (var parent_7 = declaration.parent; !ts.isFunctionBlock(parent_7); parent_7 = parent_7.parent) { // Reached source file or module block - if (parent_7.kind === 227 /* SourceFile */ || parent_7.kind === 206 /* ModuleBlock */) { + if (parent_7.kind === 228 /* SourceFile */ || parent_7.kind === 207 /* ModuleBlock */) { return false; } } @@ -35873,7 +36726,7 @@ var ts; else { if (token === 65 /* Identifier */) { token = scanner.scan(); - if (token === 124 /* FromKeyword */) { + if (token === 125 /* FromKeyword */) { token = scanner.scan(); if (token === 8 /* StringLiteral */) { // import d from "mod"; @@ -35883,7 +36736,7 @@ var ts; } else if (token === 53 /* EqualsToken */) { token = scanner.scan(); - if (token === 118 /* RequireKeyword */) { + if (token === 119 /* RequireKeyword */) { token = scanner.scan(); if (token === 16 /* OpenParenToken */) { token = scanner.scan(); @@ -35912,7 +36765,7 @@ var ts; } if (token === 15 /* CloseBraceToken */) { token = scanner.scan(); - if (token === 124 /* FromKeyword */) { + if (token === 125 /* FromKeyword */) { token = scanner.scan(); if (token === 8 /* StringLiteral */) { // import {a as A} from "mod"; @@ -35928,7 +36781,7 @@ var ts; token = scanner.scan(); if (token === 65 /* Identifier */) { token = scanner.scan(); - if (token === 124 /* FromKeyword */) { + if (token === 125 /* FromKeyword */) { token = scanner.scan(); if (token === 8 /* StringLiteral */) { // import * as NS from "mod" @@ -35951,7 +36804,7 @@ var ts; } if (token === 15 /* CloseBraceToken */) { token = scanner.scan(); - if (token === 124 /* FromKeyword */) { + if (token === 125 /* FromKeyword */) { token = scanner.scan(); if (token === 8 /* StringLiteral */) { // export {a as A} from "mod"; @@ -35963,7 +36816,7 @@ var ts; } else if (token === 35 /* AsteriskToken */) { token = scanner.scan(); - if (token === 124 /* FromKeyword */) { + if (token === 125 /* FromKeyword */) { token = scanner.scan(); if (token === 8 /* StringLiteral */) { // export * from "mod" @@ -35986,7 +36839,7 @@ var ts; /// Helpers function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 194 /* LabeledStatement */ && referenceNode.label.text === labelName) { + if (referenceNode.kind === 195 /* LabeledStatement */ && referenceNode.label.text === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -35995,12 +36848,12 @@ var ts; } function isJumpStatementTarget(node) { return node.kind === 65 /* Identifier */ && - (node.parent.kind === 190 /* BreakStatement */ || node.parent.kind === 189 /* ContinueStatement */) && + (node.parent.kind === 191 /* BreakStatement */ || node.parent.kind === 190 /* ContinueStatement */) && node.parent.label === node; } function isLabelOfLabeledStatement(node) { return node.kind === 65 /* Identifier */ && - node.parent.kind === 194 /* LabeledStatement */ && + node.parent.kind === 195 /* LabeledStatement */ && node.parent.label === node; } /** @@ -36008,7 +36861,7 @@ var ts; * Note: 'node' cannot be a SourceFile. */ function isLabeledBy(node, labelName) { - for (var owner = node.parent; owner.kind === 194 /* LabeledStatement */; owner = owner.parent) { + for (var owner = node.parent; owner.kind === 195 /* LabeledStatement */; owner = owner.parent) { if (owner.label.text === labelName) { return true; } @@ -36019,25 +36872,25 @@ var ts; return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isRightSideOfQualifiedName(node) { - return node.parent.kind === 126 /* QualifiedName */ && node.parent.right === node; + return node.parent.kind === 127 /* QualifiedName */ && node.parent.right === node; } function isRightSideOfPropertyAccess(node) { - return node && node.parent && node.parent.kind === 155 /* PropertyAccessExpression */ && node.parent.name === node; + return node && node.parent && node.parent.kind === 156 /* PropertyAccessExpression */ && node.parent.name === node; } function isCallExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 157 /* CallExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 158 /* CallExpression */ && node.parent.expression === node; } function isNewExpressionTarget(node) { if (isRightSideOfPropertyAccess(node)) { node = node.parent; } - return node && node.parent && node.parent.kind === 158 /* NewExpression */ && node.parent.expression === node; + return node && node.parent && node.parent.kind === 159 /* NewExpression */ && node.parent.expression === node; } function isNameOfModuleDeclaration(node) { - return node.parent.kind === 205 /* ModuleDeclaration */ && node.parent.name === node; + return node.parent.kind === 206 /* ModuleDeclaration */ && node.parent.name === node; } function isNameOfFunctionDeclaration(node) { return node.kind === 65 /* Identifier */ && @@ -36046,22 +36899,22 @@ var ts; /** Returns true if node is a name of an object literal property, e.g. "a" in x = { "a": 1 } */ function isNameOfPropertyAssignment(node) { return (node.kind === 65 /* Identifier */ || node.kind === 8 /* StringLiteral */ || node.kind === 7 /* NumericLiteral */) && - (node.parent.kind === 224 /* PropertyAssignment */ || node.parent.kind === 225 /* ShorthandPropertyAssignment */) && node.parent.name === node; + (node.parent.kind === 225 /* PropertyAssignment */ || node.parent.kind === 226 /* ShorthandPropertyAssignment */) && node.parent.name === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { if (node.kind === 8 /* StringLiteral */ || node.kind === 7 /* NumericLiteral */) { switch (node.parent.kind) { - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 224 /* PropertyAssignment */: - case 226 /* EnumMember */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 205 /* ModuleDeclaration */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 225 /* PropertyAssignment */: + case 227 /* EnumMember */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 206 /* ModuleDeclaration */: return node.parent.name === node; - case 156 /* ElementAccessExpression */: + case 157 /* ElementAccessExpression */: return node.parent.argumentExpression === node; } } @@ -36120,7 +36973,7 @@ var ts; })(BreakContinueSearchType || (BreakContinueSearchType = {})); // A cache of completion entries for keywords, these do not change between sessions var keywordCompletions = []; - for (var i = 66 /* FirstKeyword */; i <= 125 /* LastKeyword */; i++) { + for (var i = 66 /* FirstKeyword */; i <= 126 /* LastKeyword */; i++) { keywordCompletions.push({ name: ts.tokenToString(i), kind: ScriptElementKind.keyword, @@ -36135,17 +36988,17 @@ var ts; return undefined; } switch (node.kind) { - case 227 /* SourceFile */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 201 /* ClassDeclaration */: - case 202 /* InterfaceDeclaration */: - case 204 /* EnumDeclaration */: - case 205 /* ModuleDeclaration */: + case 228 /* SourceFile */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 202 /* ClassDeclaration */: + case 203 /* InterfaceDeclaration */: + case 205 /* EnumDeclaration */: + case 206 /* ModuleDeclaration */: return node; } } @@ -36153,38 +37006,38 @@ var ts; ts.getContainerNode = getContainerNode; /* @internal */ function getNodeKind(node) { switch (node.kind) { - case 205 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; - case 201 /* ClassDeclaration */: return ScriptElementKind.classElement; - case 202 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; - case 203 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; - case 204 /* EnumDeclaration */: return ScriptElementKind.enumElement; - case 198 /* VariableDeclaration */: + case 206 /* ModuleDeclaration */: return ScriptElementKind.moduleElement; + case 202 /* ClassDeclaration */: return ScriptElementKind.classElement; + case 203 /* InterfaceDeclaration */: return ScriptElementKind.interfaceElement; + case 204 /* TypeAliasDeclaration */: return ScriptElementKind.typeElement; + case 205 /* EnumDeclaration */: return ScriptElementKind.enumElement; + case 199 /* VariableDeclaration */: return ts.isConst(node) ? ScriptElementKind.constElement : ts.isLet(node) ? ScriptElementKind.letElement : ScriptElementKind.variableElement; - case 200 /* FunctionDeclaration */: return ScriptElementKind.functionElement; - case 136 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; - case 137 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 201 /* FunctionDeclaration */: return ScriptElementKind.functionElement; + case 137 /* GetAccessor */: return ScriptElementKind.memberGetAccessorElement; + case 138 /* SetAccessor */: return ScriptElementKind.memberSetAccessorElement; + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: return ScriptElementKind.memberFunctionElement; - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: return ScriptElementKind.memberVariableElement; - case 140 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; - case 139 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; - case 138 /* CallSignature */: return ScriptElementKind.callSignatureElement; - case 135 /* Constructor */: return ScriptElementKind.constructorImplementationElement; - case 128 /* TypeParameter */: return ScriptElementKind.typeParameterElement; - case 226 /* EnumMember */: return ScriptElementKind.variableElement; - case 129 /* Parameter */: return (node.flags & 112 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - case 208 /* ImportEqualsDeclaration */: - case 213 /* ImportSpecifier */: - case 210 /* ImportClause */: - case 217 /* ExportSpecifier */: - case 211 /* NamespaceImport */: + case 141 /* IndexSignature */: return ScriptElementKind.indexSignatureElement; + case 140 /* ConstructSignature */: return ScriptElementKind.constructSignatureElement; + case 139 /* CallSignature */: return ScriptElementKind.callSignatureElement; + case 136 /* Constructor */: return ScriptElementKind.constructorImplementationElement; + case 129 /* TypeParameter */: return ScriptElementKind.typeParameterElement; + case 227 /* EnumMember */: return ScriptElementKind.variableElement; + case 130 /* Parameter */: return (node.flags & 112 /* AccessibilityModifier */) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + case 209 /* ImportEqualsDeclaration */: + case 214 /* ImportSpecifier */: + case 211 /* ImportClause */: + case 218 /* ExportSpecifier */: + case 212 /* NamespaceImport */: return ScriptElementKind.alias; } return ScriptElementKind.unknown; @@ -36385,44 +37238,44 @@ var ts; return false; } switch (node.kind) { - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file)); return true; - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file)); return true; - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: var classDeclaration = node; if (checkModifiers(classDeclaration.modifiers) || checkTypeParameters(classDeclaration.typeParameters)) { return true; } break; - case 222 /* HeritageClause */: + case 223 /* HeritageClause */: var heritageClause = node; if (heritageClause.token === 102 /* ImplementsKeyword */) { diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file)); return true; } break; - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file)); return true; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file)); return true; - case 203 /* TypeAliasDeclaration */: + case 204 /* TypeAliasDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file)); return true; - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 162 /* FunctionExpression */: - case 200 /* FunctionDeclaration */: - case 163 /* ArrowFunction */: - case 200 /* FunctionDeclaration */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 163 /* FunctionExpression */: + case 201 /* FunctionDeclaration */: + case 164 /* ArrowFunction */: + case 201 /* FunctionDeclaration */: var functionDeclaration = node; if (checkModifiers(functionDeclaration.modifiers) || checkTypeParameters(functionDeclaration.typeParameters) || @@ -36430,20 +37283,20 @@ var ts; return true; } break; - case 180 /* VariableStatement */: + case 181 /* VariableStatement */: var variableStatement = node; if (checkModifiers(variableStatement.modifiers)) { return true; } break; - case 198 /* VariableDeclaration */: + case 199 /* VariableDeclaration */: var variableDeclaration = node; if (checkTypeAnnotation(variableDeclaration.type)) { return true; } break; - case 157 /* CallExpression */: - case 158 /* NewExpression */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: var expression = node; if (expression.typeArguments && expression.typeArguments.length > 0) { var start = expression.typeArguments.pos; @@ -36451,7 +37304,7 @@ var ts; return true; } break; - case 129 /* Parameter */: + case 130 /* Parameter */: var parameter = node; if (parameter.modifiers) { var start = parameter.modifiers.pos; @@ -36467,17 +37320,17 @@ var ts; return true; } break; - case 132 /* PropertyDeclaration */: + case 133 /* PropertyDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.property_declarations_can_only_be_used_in_a_ts_file)); return true; - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return true; - case 160 /* TypeAssertionExpression */: + case 161 /* TypeAssertionExpression */: var typeAssertionExpression = node; diagnostics.push(ts.createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return true; - case 130 /* Decorator */: + case 131 /* Decorator */: diagnostics.push(ts.createDiagnosticForNode(node, ts.Diagnostics.decorators_can_only_be_used_in_a_ts_file)); return true; } @@ -36610,11 +37463,11 @@ var ts; // visible symbols in the scope, and the node is the current location. var node = currentToken; var isRightOfDot = false; - if (contextToken && contextToken.kind === 20 /* DotToken */ && contextToken.parent.kind === 155 /* PropertyAccessExpression */) { + if (contextToken && contextToken.kind === 20 /* DotToken */ && contextToken.parent.kind === 156 /* PropertyAccessExpression */) { node = contextToken.parent.expression; isRightOfDot = true; } - else if (contextToken && contextToken.kind === 20 /* DotToken */ && contextToken.parent.kind === 126 /* QualifiedName */) { + else if (contextToken && contextToken.kind === 20 /* DotToken */ && contextToken.parent.kind === 127 /* QualifiedName */) { node = contextToken.parent.left; isRightOfDot = true; } @@ -36641,7 +37494,7 @@ var ts; // Right of dot member completion list isMemberCompletion = true; isNewIdentifierLocation = false; - if (node.kind === 65 /* Identifier */ || node.kind === 126 /* QualifiedName */ || node.kind === 155 /* PropertyAccessExpression */) { + if (node.kind === 65 /* Identifier */ || node.kind === 127 /* QualifiedName */ || node.kind === 156 /* PropertyAccessExpression */) { var symbol = typeChecker.getSymbolAtLocation(node); // This is an alias, follow what it aliases if (symbol && symbol.flags & 8388608 /* Alias */) { @@ -36683,13 +37536,13 @@ var ts; symbols = filterContextualMembersList(contextualTypeMembers, containingObjectLiteral.properties); } } - else if (ts.getAncestor(contextToken, 210 /* ImportClause */)) { + else if (ts.getAncestor(contextToken, 211 /* ImportClause */)) { // cursor is in import clause // try to show exported member for imported module isMemberCompletion = true; isNewIdentifierLocation = true; if (showCompletionsInImportsClause(contextToken)) { - var importDeclaration = ts.getAncestor(contextToken, 209 /* ImportDeclaration */); + var importDeclaration = ts.getAncestor(contextToken, 210 /* ImportDeclaration */); ts.Debug.assert(importDeclaration !== undefined); var exports; if (importDeclaration.moduleSpecifier) { @@ -36768,7 +37621,7 @@ var ts; // import {| // import {a,| if (node.kind === 14 /* OpenBraceToken */ || node.kind === 23 /* CommaToken */) { - return node.parent.kind === 212 /* NamedImports */; + return node.parent.kind === 213 /* NamedImports */; } } return false; @@ -36778,35 +37631,36 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23 /* CommaToken */: - return containingNodeKind === 157 /* CallExpression */ // func( a, | - || containingNodeKind === 135 /* Constructor */ // constructor( a, | public, protected, private keywords are allowed here, so show completion - || containingNodeKind === 158 /* NewExpression */ // new C(a, | - || containingNodeKind === 153 /* ArrayLiteralExpression */ // [a, | - || containingNodeKind === 169 /* BinaryExpression */; // let x = (a, | + return containingNodeKind === 158 /* CallExpression */ // func( a, | + || containingNodeKind === 136 /* Constructor */ // constructor( a, | public, protected, private keywords are allowed here, so show completion + || containingNodeKind === 159 /* NewExpression */ // new C(a, | + || containingNodeKind === 154 /* ArrayLiteralExpression */ // [a, | + || containingNodeKind === 170 /* BinaryExpression */; // let x = (a, | case 16 /* OpenParenToken */: - return containingNodeKind === 157 /* CallExpression */ // func( | - || containingNodeKind === 135 /* Constructor */ // constructor( | - || containingNodeKind === 158 /* NewExpression */ // new C(a| - || containingNodeKind === 161 /* ParenthesizedExpression */; // let x = (a| + return containingNodeKind === 158 /* CallExpression */ // func( | + || containingNodeKind === 136 /* Constructor */ // constructor( | + || containingNodeKind === 159 /* NewExpression */ // new C(a| + || containingNodeKind === 162 /* ParenthesizedExpression */; // let x = (a| case 18 /* OpenBracketToken */: - return containingNodeKind === 153 /* ArrayLiteralExpression */; // [ | - case 117 /* ModuleKeyword */: + return containingNodeKind === 154 /* ArrayLiteralExpression */; // [ | + case 117 /* ModuleKeyword */: // module | + case 118 /* NamespaceKeyword */: return true; case 20 /* DotToken */: - return containingNodeKind === 205 /* ModuleDeclaration */; // module A.| + return containingNodeKind === 206 /* ModuleDeclaration */; // module A.| case 14 /* OpenBraceToken */: - return containingNodeKind === 201 /* ClassDeclaration */; // class A{ | + return containingNodeKind === 202 /* ClassDeclaration */; // class A{ | case 53 /* EqualsToken */: - return containingNodeKind === 198 /* VariableDeclaration */ // let x = a| - || containingNodeKind === 169 /* BinaryExpression */; // x = a| + return containingNodeKind === 199 /* VariableDeclaration */ // let x = a| + || containingNodeKind === 170 /* BinaryExpression */; // x = a| case 11 /* TemplateHead */: - return containingNodeKind === 171 /* TemplateExpression */; // `aa ${| + return containingNodeKind === 172 /* TemplateExpression */; // `aa ${| case 12 /* TemplateMiddle */: - return containingNodeKind === 176 /* TemplateSpan */; // `aa ${10} dd ${| + return containingNodeKind === 178 /* TemplateSpan */; // `aa ${10} dd ${| case 108 /* PublicKeyword */: case 106 /* PrivateKeyword */: case 107 /* ProtectedKeyword */: - return containingNodeKind === 132 /* PropertyDeclaration */; // class A{ public | + return containingNodeKind === 133 /* PropertyDeclaration */; // class A{ public | } // Previous token may have been a keyword that was converted to an identifier. switch (previousToken.getText()) { @@ -36842,7 +37696,7 @@ var ts; switch (previousToken.kind) { case 14 /* OpenBraceToken */: // let x = { | case 23 /* CommaToken */: - if (parent_8 && parent_8.kind === 154 /* ObjectLiteralExpression */) { + if (parent_8 && parent_8.kind === 155 /* ObjectLiteralExpression */) { return parent_8; } break; @@ -36852,16 +37706,16 @@ var ts; } function isFunction(kind) { switch (kind) { - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: - case 200 /* FunctionDeclaration */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 138 /* CallSignature */: - case 139 /* ConstructSignature */: - case 140 /* IndexSignature */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: + case 201 /* FunctionDeclaration */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 139 /* CallSignature */: + case 140 /* ConstructSignature */: + case 141 /* IndexSignature */: return true; } return false; @@ -36871,56 +37725,56 @@ var ts; var containingNodeKind = previousToken.parent.kind; switch (previousToken.kind) { case 23 /* CommaToken */: - return containingNodeKind === 198 /* VariableDeclaration */ || - containingNodeKind === 199 /* VariableDeclarationList */ || - containingNodeKind === 180 /* VariableStatement */ || - containingNodeKind === 204 /* EnumDeclaration */ || + return containingNodeKind === 199 /* VariableDeclaration */ || + containingNodeKind === 200 /* VariableDeclarationList */ || + containingNodeKind === 181 /* VariableStatement */ || + containingNodeKind === 205 /* EnumDeclaration */ || isFunction(containingNodeKind) || - containingNodeKind === 201 /* ClassDeclaration */ || - containingNodeKind === 200 /* FunctionDeclaration */ || - containingNodeKind === 202 /* InterfaceDeclaration */ || - containingNodeKind === 151 /* ArrayBindingPattern */ || - containingNodeKind === 150 /* ObjectBindingPattern */; // function func({ x, y| + containingNodeKind === 202 /* ClassDeclaration */ || + containingNodeKind === 201 /* FunctionDeclaration */ || + containingNodeKind === 203 /* InterfaceDeclaration */ || + containingNodeKind === 152 /* ArrayBindingPattern */ || + containingNodeKind === 151 /* ObjectBindingPattern */; // function func({ x, y| case 20 /* DotToken */: - return containingNodeKind === 151 /* ArrayBindingPattern */; // var [.| + return containingNodeKind === 152 /* ArrayBindingPattern */; // var [.| case 18 /* OpenBracketToken */: - return containingNodeKind === 151 /* ArrayBindingPattern */; // var [x| + return containingNodeKind === 152 /* ArrayBindingPattern */; // var [x| case 16 /* OpenParenToken */: - return containingNodeKind === 223 /* CatchClause */ || + return containingNodeKind === 224 /* CatchClause */ || isFunction(containingNodeKind); case 14 /* OpenBraceToken */: - return containingNodeKind === 204 /* EnumDeclaration */ || - containingNodeKind === 202 /* InterfaceDeclaration */ || - containingNodeKind === 145 /* TypeLiteral */ || - containingNodeKind === 150 /* ObjectBindingPattern */; // function func({ x| + return containingNodeKind === 205 /* EnumDeclaration */ || + containingNodeKind === 203 /* InterfaceDeclaration */ || + containingNodeKind === 146 /* TypeLiteral */ || + containingNodeKind === 151 /* ObjectBindingPattern */; // function func({ x| case 22 /* SemicolonToken */: - return containingNodeKind === 131 /* PropertySignature */ && + return containingNodeKind === 132 /* PropertySignature */ && previousToken.parent && previousToken.parent.parent && - (previousToken.parent.parent.kind === 202 /* InterfaceDeclaration */ || - previousToken.parent.parent.kind === 145 /* TypeLiteral */); // let x : { a; | + (previousToken.parent.parent.kind === 203 /* InterfaceDeclaration */ || + previousToken.parent.parent.kind === 146 /* TypeLiteral */); // let x : { a; | case 24 /* LessThanToken */: - return containingNodeKind === 201 /* ClassDeclaration */ || - containingNodeKind === 200 /* FunctionDeclaration */ || - containingNodeKind === 202 /* InterfaceDeclaration */ || + return containingNodeKind === 202 /* ClassDeclaration */ || + containingNodeKind === 201 /* FunctionDeclaration */ || + containingNodeKind === 203 /* InterfaceDeclaration */ || isFunction(containingNodeKind); case 109 /* StaticKeyword */: - return containingNodeKind === 132 /* PropertyDeclaration */; + return containingNodeKind === 133 /* PropertyDeclaration */; case 21 /* DotDotDotToken */: - return containingNodeKind === 129 /* Parameter */ || - containingNodeKind === 135 /* Constructor */ || + return containingNodeKind === 130 /* Parameter */ || + containingNodeKind === 136 /* Constructor */ || (previousToken.parent && previousToken.parent.parent && - previousToken.parent.parent.kind === 151 /* ArrayBindingPattern */); // var [ ...z| + previousToken.parent.parent.kind === 152 /* ArrayBindingPattern */); // var [ ...z| case 108 /* PublicKeyword */: case 106 /* PrivateKeyword */: case 107 /* ProtectedKeyword */: - return containingNodeKind === 129 /* Parameter */; + return containingNodeKind === 130 /* Parameter */; case 69 /* ClassKeyword */: case 77 /* EnumKeyword */: case 103 /* InterfaceKeyword */: case 83 /* FunctionKeyword */: case 98 /* VarKeyword */: case 116 /* GetKeyword */: - case 120 /* SetKeyword */: + case 121 /* SetKeyword */: case 85 /* ImportKeyword */: case 104 /* LetKeyword */: case 70 /* ConstKeyword */: @@ -36956,7 +37810,7 @@ var ts; return exports; } if (importDeclaration.importClause.namedBindings && - importDeclaration.importClause.namedBindings.kind === 212 /* NamedImports */) { + importDeclaration.importClause.namedBindings.kind === 213 /* NamedImports */) { ts.forEach(importDeclaration.importClause.namedBindings.elements, function (el) { var name = el.propertyName || el.name; exisingImports[name.text] = true; @@ -36973,7 +37827,7 @@ var ts; } var existingMemberNames = {}; ts.forEach(existingMembers, function (m) { - if (m.kind !== 224 /* PropertyAssignment */ && m.kind !== 225 /* ShorthandPropertyAssignment */) { + if (m.kind !== 225 /* PropertyAssignment */ && m.kind !== 226 /* ShorthandPropertyAssignment */) { // Ignore omitted expressions for missing members in the object literal return; } @@ -37023,10 +37877,10 @@ var ts; for (var _i = 0, _a = program.getSourceFiles(); _i < _a.length; _i++) { var sourceFile = _a[_i]; var nameTable = getNameTable(sourceFile); - for (var name_24 in nameTable) { - if (!allNames[name_24]) { - allNames[name_24] = name_24; - var displayName = getCompletionEntryDisplayName(name_24, target, true); + for (var name_25 in nameTable) { + if (!allNames[name_25]) { + allNames[name_25] = name_25; + var displayName = getCompletionEntryDisplayName(name_25, target, true); if (displayName) { var entry = { name: displayName, @@ -37241,7 +38095,7 @@ var ts; var signature; type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (type) { - if (location.parent && location.parent.kind === 155 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 156 /* PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -37250,7 +38104,7 @@ var ts; } // try get the call/construct signature from the type if it matches var callExpression; - if (location.kind === 157 /* CallExpression */ || location.kind === 158 /* NewExpression */) { + if (location.kind === 158 /* CallExpression */ || location.kind === 159 /* NewExpression */) { callExpression = location; } else if (isCallExpressionTarget(location) || isNewExpressionTarget(location)) { @@ -37263,7 +38117,7 @@ var ts; // Use the first candidate: signature = candidateSignatures[0]; } - var useConstructSignatures = callExpression.kind === 158 /* NewExpression */ || callExpression.expression.kind === 91 /* SuperKeyword */; + var useConstructSignatures = callExpression.kind === 159 /* NewExpression */ || callExpression.expression.kind === 91 /* SuperKeyword */; var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (!ts.contains(allSignatures, signature.target || signature)) { // Get the first signature if there @@ -37315,24 +38169,24 @@ var ts; } } else if ((isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304 /* Accessor */)) || - (location.kind === 114 /* ConstructorKeyword */ && location.parent.kind === 135 /* Constructor */)) { + (location.kind === 114 /* ConstructorKeyword */ && location.parent.kind === 136 /* Constructor */)) { // get the signature from the declaration and write it var functionDeclaration = location.parent; - var allSignatures = functionDeclaration.kind === 135 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); + var allSignatures = functionDeclaration.kind === 136 /* Constructor */ ? type.getConstructSignatures() : type.getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 135 /* Constructor */) { + if (functionDeclaration.kind === 136 /* Constructor */) { // show (constructor) Type(...) signature symbolKind = ScriptElementKind.constructorImplementationElement; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 138 /* CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 139 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); } addSignatureDisplayParts(signature, allSignatures); @@ -37355,7 +38209,7 @@ var ts; } if (symbolFlags & 524288 /* TypeAlias */) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(123 /* TypeKeyword */)); + displayParts.push(ts.keywordPart(124 /* TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); displayParts.push(ts.spacePart()); @@ -37375,7 +38229,9 @@ var ts; } if (symbolFlags & 1536 /* Module */) { addNewLineIfDisplayPartsExist(); - displayParts.push(ts.keywordPart(117 /* ModuleKeyword */)); + var declaration = ts.getDeclarationOfKind(symbol, 206 /* ModuleDeclaration */); + var isNamespace = declaration && declaration.name && declaration.name.kind === 65 /* Identifier */; + displayParts.push(ts.keywordPart(isNamespace ? 118 /* NamespaceKeyword */ : 117 /* ModuleKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } @@ -37396,13 +38252,13 @@ var ts; } else { // Method/function type parameter - var signatureDeclaration = ts.getDeclarationOfKind(symbol, 128 /* TypeParameter */).parent; + var signatureDeclaration = ts.getDeclarationOfKind(symbol, 129 /* TypeParameter */).parent; var signature = typeChecker.getSignatureFromDeclaration(signatureDeclaration); - if (signatureDeclaration.kind === 139 /* ConstructSignature */) { + if (signatureDeclaration.kind === 140 /* ConstructSignature */) { displayParts.push(ts.keywordPart(88 /* NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (signatureDeclaration.kind !== 138 /* CallSignature */ && signatureDeclaration.name) { + else if (signatureDeclaration.kind !== 139 /* CallSignature */ && signatureDeclaration.name) { addFullSymbolName(signatureDeclaration.symbol); } displayParts.push.apply(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); @@ -37411,7 +38267,7 @@ var ts; if (symbolFlags & 8 /* EnumMember */) { addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; - if (declaration.kind === 226 /* EnumMember */) { + if (declaration.kind === 227 /* EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -37427,13 +38283,13 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 208 /* ImportEqualsDeclaration */) { + if (declaration.kind === 209 /* ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); displayParts.push(ts.operatorPart(53 /* EqualsToken */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(118 /* RequireKeyword */)); + displayParts.push(ts.keywordPart(119 /* RequireKeyword */)); displayParts.push(ts.punctuationPart(16 /* OpenParenToken */)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(17 /* CloseParenToken */)); @@ -37560,8 +38416,8 @@ var ts; // Try getting just type at this position and show switch (node.kind) { case 65 /* Identifier */: - case 155 /* PropertyAccessExpression */: - case 126 /* QualifiedName */: + case 156 /* PropertyAccessExpression */: + case 127 /* QualifiedName */: case 93 /* ThisKeyword */: case 91 /* SuperKeyword */: // For the identifiers/this/super etc get the type at position @@ -37649,7 +38505,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 225 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 226 /* ShorthandPropertyAssignment */) { var shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); if (!shorthandSymbol) { return []; @@ -37680,7 +38536,7 @@ var ts; if (isNewExpressionTarget(location) || location.kind === 114 /* ConstructorKeyword */) { if (symbol.flags & 32 /* Class */) { var classDeclaration = symbol.getDeclarations()[0]; - ts.Debug.assert(classDeclaration && classDeclaration.kind === 201 /* ClassDeclaration */); + ts.Debug.assert(classDeclaration && classDeclaration.kind === 202 /* ClassDeclaration */); return tryAddSignature(classDeclaration.members, true, symbolKind, symbolName, containerName, result); } } @@ -37696,8 +38552,8 @@ var ts; var declarations = []; var definition; ts.forEach(signatureDeclarations, function (d) { - if ((selectConstructors && d.kind === 135 /* Constructor */) || - (!selectConstructors && (d.kind === 200 /* FunctionDeclaration */ || d.kind === 134 /* MethodDeclaration */ || d.kind === 133 /* MethodSignature */))) { + if ((selectConstructors && d.kind === 136 /* Constructor */) || + (!selectConstructors && (d.kind === 201 /* FunctionDeclaration */ || d.kind === 135 /* MethodDeclaration */ || d.kind === 134 /* MethodSignature */))) { declarations.push(d); if (d.body) definition = d; @@ -37799,74 +38655,74 @@ var ts; switch (node.kind) { case 84 /* IfKeyword */: case 76 /* ElseKeyword */: - if (hasKind(node.parent, 183 /* IfStatement */)) { + if (hasKind(node.parent, 184 /* IfStatement */)) { return getIfElseOccurrences(node.parent); } break; case 90 /* ReturnKeyword */: - if (hasKind(node.parent, 191 /* ReturnStatement */)) { + if (hasKind(node.parent, 192 /* ReturnStatement */)) { return getReturnOccurrences(node.parent); } break; case 94 /* ThrowKeyword */: - if (hasKind(node.parent, 195 /* ThrowStatement */)) { + if (hasKind(node.parent, 196 /* ThrowStatement */)) { return getThrowOccurrences(node.parent); } break; case 68 /* CatchKeyword */: - if (hasKind(parent(parent(node)), 196 /* TryStatement */)) { + if (hasKind(parent(parent(node)), 197 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent.parent); } break; case 96 /* TryKeyword */: case 81 /* FinallyKeyword */: - if (hasKind(parent(node), 196 /* TryStatement */)) { + if (hasKind(parent(node), 197 /* TryStatement */)) { return getTryCatchFinallyOccurrences(node.parent); } break; case 92 /* SwitchKeyword */: - if (hasKind(node.parent, 193 /* SwitchStatement */)) { + if (hasKind(node.parent, 194 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent); } break; case 67 /* CaseKeyword */: case 73 /* DefaultKeyword */: - if (hasKind(parent(parent(parent(node))), 193 /* SwitchStatement */)) { + if (hasKind(parent(parent(parent(node))), 194 /* SwitchStatement */)) { return getSwitchCaseDefaultOccurrences(node.parent.parent.parent); } break; case 66 /* BreakKeyword */: case 71 /* ContinueKeyword */: - if (hasKind(node.parent, 190 /* BreakStatement */) || hasKind(node.parent, 189 /* ContinueStatement */)) { + if (hasKind(node.parent, 191 /* BreakStatement */) || hasKind(node.parent, 190 /* ContinueStatement */)) { return getBreakOrContinueStatementOccurences(node.parent); } break; case 82 /* ForKeyword */: - if (hasKind(node.parent, 186 /* ForStatement */) || - hasKind(node.parent, 187 /* ForInStatement */) || - hasKind(node.parent, 188 /* ForOfStatement */)) { + if (hasKind(node.parent, 187 /* ForStatement */) || + hasKind(node.parent, 188 /* ForInStatement */) || + hasKind(node.parent, 189 /* ForOfStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 100 /* WhileKeyword */: case 75 /* DoKeyword */: - if (hasKind(node.parent, 185 /* WhileStatement */) || hasKind(node.parent, 184 /* DoStatement */)) { + if (hasKind(node.parent, 186 /* WhileStatement */) || hasKind(node.parent, 185 /* DoStatement */)) { return getLoopBreakContinueOccurrences(node.parent); } break; case 114 /* ConstructorKeyword */: - if (hasKind(node.parent, 135 /* Constructor */)) { + if (hasKind(node.parent, 136 /* Constructor */)) { return getConstructorOccurrences(node.parent); } break; case 116 /* GetKeyword */: - case 120 /* SetKeyword */: - if (hasKind(node.parent, 136 /* GetAccessor */) || hasKind(node.parent, 137 /* SetAccessor */)) { + case 121 /* SetKeyword */: + if (hasKind(node.parent, 137 /* GetAccessor */) || hasKind(node.parent, 138 /* SetAccessor */)) { return getGetAndSetOccurrences(node.parent); } default: if (ts.isModifier(node.kind) && node.parent && - (ts.isDeclaration(node.parent) || node.parent.kind === 180 /* VariableStatement */)) { + (ts.isDeclaration(node.parent) || node.parent.kind === 181 /* VariableStatement */)) { return getModifierOccurrences(node.kind, node.parent); } } @@ -37882,10 +38738,10 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 195 /* ThrowStatement */) { + if (node.kind === 196 /* ThrowStatement */) { statementAccumulator.push(node); } - else if (node.kind === 196 /* TryStatement */) { + else if (node.kind === 197 /* TryStatement */) { var tryStatement = node; if (tryStatement.catchClause) { aggregate(tryStatement.catchClause); @@ -37914,12 +38770,12 @@ var ts; var child = throwStatement; while (child.parent) { var parent_9 = child.parent; - if (ts.isFunctionBlock(parent_9) || parent_9.kind === 227 /* SourceFile */) { + if (ts.isFunctionBlock(parent_9) || parent_9.kind === 228 /* SourceFile */) { return parent_9; } // A throw-statement is only owned by a try-statement if the try-statement has // a catch clause, and if the throw-statement occurs within the try block. - if (parent_9.kind === 196 /* TryStatement */) { + if (parent_9.kind === 197 /* TryStatement */) { var tryStatement = parent_9; if (tryStatement.tryBlock === child && tryStatement.catchClause) { return child; @@ -37934,7 +38790,7 @@ var ts; aggregate(node); return statementAccumulator; function aggregate(node) { - if (node.kind === 190 /* BreakStatement */ || node.kind === 189 /* ContinueStatement */) { + if (node.kind === 191 /* BreakStatement */ || node.kind === 190 /* ContinueStatement */) { statementAccumulator.push(node); } else if (!ts.isFunctionLike(node)) { @@ -37950,16 +38806,16 @@ var ts; function getBreakOrContinueOwner(statement) { for (var node_1 = statement.parent; node_1; node_1 = node_1.parent) { switch (node_1.kind) { - case 193 /* SwitchStatement */: - if (statement.kind === 189 /* ContinueStatement */) { + case 194 /* SwitchStatement */: + if (statement.kind === 190 /* ContinueStatement */) { continue; } // Fall through. - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 185 /* WhileStatement */: - case 184 /* DoStatement */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 186 /* WhileStatement */: + case 185 /* DoStatement */: if (!statement.label || isLabeledBy(node_1, statement.label.text)) { return node_1; } @@ -37978,18 +38834,18 @@ var ts; var container = declaration.parent; // Make sure we only highlight the keyword when it makes sense to do so. if (ts.isAccessibilityModifier(modifier)) { - if (!(container.kind === 201 /* ClassDeclaration */ || - (declaration.kind === 129 /* Parameter */ && hasKind(container, 135 /* Constructor */)))) { + if (!(container.kind === 202 /* ClassDeclaration */ || + (declaration.kind === 130 /* Parameter */ && hasKind(container, 136 /* Constructor */)))) { return undefined; } } else if (modifier === 109 /* StaticKeyword */) { - if (container.kind !== 201 /* ClassDeclaration */) { + if (container.kind !== 202 /* ClassDeclaration */) { return undefined; } } else if (modifier === 78 /* ExportKeyword */ || modifier === 115 /* DeclareKeyword */) { - if (!(container.kind === 206 /* ModuleBlock */ || container.kind === 227 /* SourceFile */)) { + if (!(container.kind === 207 /* ModuleBlock */ || container.kind === 228 /* SourceFile */)) { return undefined; } } @@ -38001,20 +38857,20 @@ var ts; var modifierFlag = getFlagFromModifier(modifier); var nodes; switch (container.kind) { - case 206 /* ModuleBlock */: - case 227 /* SourceFile */: + case 207 /* ModuleBlock */: + case 228 /* SourceFile */: nodes = container.statements; break; - case 135 /* Constructor */: + case 136 /* Constructor */: nodes = container.parameters.concat(container.parent.members); break; - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. if (modifierFlag & 112 /* AccessibilityModifier */) { var constructor = ts.forEach(container.members, function (member) { - return member.kind === 135 /* Constructor */ && member; + return member.kind === 136 /* Constructor */ && member; }); if (constructor) { nodes = nodes.concat(constructor.parameters); @@ -38062,13 +38918,13 @@ var ts; } function getGetAndSetOccurrences(accessorDeclaration) { var keywords = []; - tryPushAccessorKeyword(accessorDeclaration.symbol, 136 /* GetAccessor */); - tryPushAccessorKeyword(accessorDeclaration.symbol, 137 /* SetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 137 /* GetAccessor */); + tryPushAccessorKeyword(accessorDeclaration.symbol, 138 /* SetAccessor */); return ts.map(keywords, getHighlightSpanForNode); function tryPushAccessorKeyword(accessorSymbol, accessorKind) { var accessor = ts.getDeclarationOfKind(accessorSymbol, accessorKind); if (accessor) { - ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 116 /* GetKeyword */, 120 /* SetKeyword */); }); + ts.forEach(accessor.getChildren(), function (child) { return pushKeywordIf(keywords, child, 116 /* GetKeyword */, 121 /* SetKeyword */); }); } } } @@ -38086,7 +38942,7 @@ var ts; var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 82 /* ForKeyword */, 100 /* WhileKeyword */, 75 /* DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 184 /* DoStatement */) { + if (loopNode.kind === 185 /* DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 100 /* WhileKeyword */)) { @@ -38107,13 +38963,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 186 /* ForStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: - case 184 /* DoStatement */: - case 185 /* WhileStatement */: + case 187 /* ForStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: + case 185 /* DoStatement */: + case 186 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 193 /* SwitchStatement */: + case 194 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -38167,7 +39023,7 @@ var ts; function getReturnOccurrences(returnStatement) { var func = ts.getContainingFunction(returnStatement); // If we didn't find a containing function with a block body, bail out. - if (!(func && hasKind(func.body, 179 /* Block */))) { + if (!(func && hasKind(func.body, 180 /* Block */))) { return undefined; } var keywords = []; @@ -38183,7 +39039,7 @@ var ts; function getIfElseOccurrences(ifStatement) { var keywords = []; // Traverse upwards through all parent if-statements linked by their else-branches. - while (hasKind(ifStatement.parent, 183 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { + while (hasKind(ifStatement.parent, 184 /* IfStatement */) && ifStatement.parent.elseStatement === ifStatement) { ifStatement = ifStatement.parent; } // Now traverse back down through the else branches, aggregating if/else keywords of if-statements. @@ -38196,7 +39052,7 @@ var ts; break; } } - if (!hasKind(ifStatement.elseStatement, 183 /* IfStatement */)) { + if (!hasKind(ifStatement.elseStatement, 184 /* IfStatement */)) { break; } ifStatement = ifStatement.elseStatement; @@ -38375,17 +39231,17 @@ var ts; } function isImportOrExportSpecifierName(location) { return location.parent && - (location.parent.kind === 213 /* ImportSpecifier */ || location.parent.kind === 217 /* ExportSpecifier */) && + (location.parent.kind === 214 /* ImportSpecifier */ || location.parent.kind === 218 /* ExportSpecifier */) && location.parent.propertyName === location; } function isImportOrExportSpecifierImportSymbol(symbol) { return (symbol.flags & 8388608 /* Alias */) && ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 213 /* ImportSpecifier */ || declaration.kind === 217 /* ExportSpecifier */; + return declaration.kind === 214 /* ImportSpecifier */ || declaration.kind === 218 /* ExportSpecifier */; }); } function getDeclaredName(symbol, location) { // Special case for function expressions, whose names are solely local to their bodies. - var functionExpression = ts.forEach(symbol.declarations, function (d) { return d.kind === 162 /* FunctionExpression */ ? d : undefined; }); + var functionExpression = ts.forEach(symbol.declarations, function (d) { return d.kind === 163 /* FunctionExpression */ ? d : undefined; }); // When a name gets interned into a SourceFile's 'identifiers' Map, // its name is escaped and stored in the same way its symbol name/identifier // name should be stored. Function expressions, however, are a special case, @@ -38412,7 +39268,7 @@ var ts; return location.getText(); } // Special case for function expressions, whose names are solely local to their bodies. - var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 162 /* FunctionExpression */ ? d : undefined; }); + var functionExpression = ts.forEach(declarations, function (d) { return d.kind === 163 /* FunctionExpression */ ? d : undefined; }); // When a name gets interned into a SourceFile's 'identifiers' Map, // its name is escaped and stored in the same way its symbol name/identifier // name should be stored. Function expressions, however, are a special case, @@ -38436,7 +39292,7 @@ var ts; if (symbol.flags & (4 /* Property */ | 8192 /* Method */)) { var privateDeclaration = ts.forEach(symbol.getDeclarations(), function (d) { return (d.flags & 32 /* Private */) ? d : undefined; }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 201 /* ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 202 /* ClassDeclaration */); } } // If the symbol is an import we would like to find it if we are looking for what it imports. @@ -38462,7 +39318,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (container.kind === 227 /* SourceFile */ && !ts.isExternalModule(container)) { + if (container.kind === 228 /* SourceFile */ && !ts.isExternalModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -38650,13 +39506,13 @@ var ts; // Whether 'super' occurs in a static context within a class. var staticFlag = 128 /* Static */; switch (searchSpaceNode.kind) { - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -38688,27 +39544,27 @@ var ts; // Whether 'this' occurs in a static context within a class. var staticFlag = 128 /* Static */; switch (searchSpaceNode.kind) { - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { break; } // fall through - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: staticFlag &= searchSpaceNode.flags; searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 227 /* SourceFile */: + case 228 /* SourceFile */: if (ts.isExternalModule(searchSpaceNode)) { return undefined; } // Fall through - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. @@ -38717,7 +39573,7 @@ var ts; } var references = []; var possiblePositions; - if (searchSpaceNode.kind === 227 /* SourceFile */) { + if (searchSpaceNode.kind === 228 /* SourceFile */) { ts.forEach(sourceFiles, function (sourceFile) { possiblePositions = getPossibleSymbolReferencePositions(sourceFile, "this", sourceFile.getStart(), sourceFile.getEnd()); getThisReferencesInFile(sourceFile, sourceFile, possiblePositions, references); @@ -38748,27 +39604,27 @@ var ts; } var container = ts.getThisContainer(node, false); switch (searchSpaceNode.kind) { - case 162 /* FunctionExpression */: - case 200 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 201 /* FunctionDeclaration */: if (searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol) { result.push(getReferenceEntryFromNode(node)); } break; - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: // Make sure the container belongs to the same class // and has the appropriate static modifier from the original container. if (container.parent && searchSpaceNode.symbol === container.parent.symbol && (container.flags & 128 /* Static */) === staticFlag) { result.push(getReferenceEntryFromNode(node)); } break; - case 227 /* SourceFile */: - if (container.kind === 227 /* SourceFile */ && !ts.isExternalModule(container)) { + case 228 /* SourceFile */: + if (container.kind === 228 /* SourceFile */ && !ts.isExternalModule(container)) { result.push(getReferenceEntryFromNode(node)); } break; @@ -38822,11 +39678,11 @@ var ts; function getPropertySymbolsFromBaseTypes(symbol, propertyName, result) { if (symbol && symbol.flags & (32 /* Class */ | 64 /* Interface */)) { ts.forEach(symbol.getDeclarations(), function (declaration) { - if (declaration.kind === 201 /* ClassDeclaration */) { + if (declaration.kind === 202 /* ClassDeclaration */) { getPropertySymbolFromTypeReference(ts.getClassExtendsHeritageClauseElement(declaration)); ts.forEach(ts.getClassImplementsHeritageClauseElements(declaration), getPropertySymbolFromTypeReference); } - else if (declaration.kind === 202 /* InterfaceDeclaration */) { + else if (declaration.kind === 203 /* InterfaceDeclaration */) { ts.forEach(ts.getInterfaceBaseTypeNodes(declaration), getPropertySymbolFromTypeReference); } }); @@ -38887,19 +39743,19 @@ var ts; if (isNameOfPropertyAssignment(node)) { var objectLiteral = node.parent.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name_25 = node.text; + var name_26 = node.text; if (contextualType) { if (contextualType.flags & 16384 /* Union */) { // This is a union type, first see if the property we are looking for is a union property (i.e. exists in all types) // if not, search the constituent types for the property - var unionProperty = contextualType.getProperty(name_25); + var unionProperty = contextualType.getProperty(name_26); if (unionProperty) { return [unionProperty]; } else { var result_4 = []; ts.forEach(contextualType.types, function (t) { - var symbol = t.getProperty(name_25); + var symbol = t.getProperty(name_26); if (symbol) { result_4.push(symbol); } @@ -38908,7 +39764,7 @@ var ts; } } else { - var symbol_1 = contextualType.getProperty(name_25); + var symbol_1 = contextualType.getProperty(name_26); if (symbol_1) { return [symbol_1]; } @@ -38966,10 +39822,10 @@ var ts; } var parent = node.parent; if (parent) { - if (parent.kind === 168 /* PostfixUnaryExpression */ || parent.kind === 167 /* PrefixUnaryExpression */) { + if (parent.kind === 169 /* PostfixUnaryExpression */ || parent.kind === 168 /* PrefixUnaryExpression */) { return true; } - else if (parent.kind === 169 /* BinaryExpression */ && parent.left === node) { + else if (parent.kind === 170 /* BinaryExpression */ && parent.left === node) { var operator = parent.operatorToken.kind; return 53 /* FirstAssignment */ <= operator && operator <= 64 /* LastAssignment */; } @@ -39003,33 +39859,33 @@ var ts; } function getMeaningFromDeclaration(node) { switch (node.kind) { - case 129 /* Parameter */: - case 198 /* VariableDeclaration */: - case 152 /* BindingElement */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: - case 224 /* PropertyAssignment */: - case 225 /* ShorthandPropertyAssignment */: - case 226 /* EnumMember */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 135 /* Constructor */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 200 /* FunctionDeclaration */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: - case 223 /* CatchClause */: + case 130 /* Parameter */: + case 199 /* VariableDeclaration */: + case 153 /* BindingElement */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: + case 225 /* PropertyAssignment */: + case 226 /* ShorthandPropertyAssignment */: + case 227 /* EnumMember */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 136 /* Constructor */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 201 /* FunctionDeclaration */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: + case 224 /* CatchClause */: return 1 /* Value */; - case 128 /* TypeParameter */: - case 202 /* InterfaceDeclaration */: - case 203 /* TypeAliasDeclaration */: - case 145 /* TypeLiteral */: + case 129 /* TypeParameter */: + case 203 /* InterfaceDeclaration */: + case 204 /* TypeAliasDeclaration */: + case 146 /* TypeLiteral */: return 2 /* Type */; - case 201 /* ClassDeclaration */: - case 204 /* EnumDeclaration */: + case 202 /* ClassDeclaration */: + case 205 /* EnumDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: if (node.name.kind === 8 /* StringLiteral */) { return 4 /* Namespace */ | 1 /* Value */; } @@ -39039,15 +39895,15 @@ var ts; else { return 4 /* Namespace */; } - case 212 /* NamedImports */: - case 213 /* ImportSpecifier */: - case 208 /* ImportEqualsDeclaration */: - case 209 /* ImportDeclaration */: - case 214 /* ExportAssignment */: - case 215 /* ExportDeclaration */: + case 213 /* NamedImports */: + case 214 /* ImportSpecifier */: + case 209 /* ImportEqualsDeclaration */: + case 210 /* ImportDeclaration */: + case 215 /* ExportAssignment */: + case 216 /* ExportDeclaration */: return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; // An external module can be a Value - case 227 /* SourceFile */: + case 228 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; @@ -39057,7 +39913,7 @@ var ts; if (ts.isRightSideOfQualifiedNameOrPropertyAccess(node)) { node = node.parent; } - return node.parent.kind === 141 /* TypeReference */ || node.parent.kind === 177 /* HeritageClauseElement */; + return node.parent.kind === 142 /* TypeReference */ || node.parent.kind === 177 /* ExpressionWithTypeArguments */; } function isNamespaceReference(node) { return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node); @@ -39065,32 +39921,32 @@ var ts; function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 155 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 155 /* PropertyAccessExpression */) { + if (root.parent.kind === 156 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 156 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 177 /* HeritageClauseElement */ && root.parent.parent.kind === 222 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 177 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 223 /* HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 201 /* ClassDeclaration */ && root.parent.parent.token === 102 /* ImplementsKeyword */) || - (decl.kind === 202 /* InterfaceDeclaration */ && root.parent.parent.token === 79 /* ExtendsKeyword */); + return (decl.kind === 202 /* ClassDeclaration */ && root.parent.parent.token === 102 /* ImplementsKeyword */) || + (decl.kind === 203 /* InterfaceDeclaration */ && root.parent.parent.token === 79 /* ExtendsKeyword */); } return false; } function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 126 /* QualifiedName */) { - while (root.parent && root.parent.kind === 126 /* QualifiedName */) { + if (root.parent.kind === 127 /* QualifiedName */) { + while (root.parent && root.parent.kind === 127 /* QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 141 /* TypeReference */ && !isLastClause; + return root.parent.kind === 142 /* TypeReference */ && !isLastClause; } function isInRightSideOfImport(node) { - while (node.parent.kind === 126 /* QualifiedName */) { + while (node.parent.kind === 127 /* QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -39100,15 +39956,15 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - if (node.parent.kind === 126 /* QualifiedName */ && + if (node.parent.kind === 127 /* QualifiedName */ && node.parent.right === node && - node.parent.parent.kind === 208 /* ImportEqualsDeclaration */) { + node.parent.parent.kind === 209 /* ImportEqualsDeclaration */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } return 4 /* Namespace */; } function getMeaningFromLocation(node) { - if (node.parent.kind === 214 /* ExportAssignment */) { + if (node.parent.kind === 215 /* ExportAssignment */) { return 1 /* Value */ | 2 /* Type */ | 4 /* Namespace */; } else if (isInRightSideOfImport(node)) { @@ -39148,8 +40004,8 @@ var ts; return; } switch (node.kind) { - case 155 /* PropertyAccessExpression */: - case 126 /* QualifiedName */: + case 156 /* PropertyAccessExpression */: + case 127 /* QualifiedName */: case 8 /* StringLiteral */: case 80 /* FalseKeyword */: case 95 /* TrueKeyword */: @@ -39172,7 +40028,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 205 /* ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 206 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -39199,29 +40055,37 @@ var ts; return ts.NavigationBar.getNavigationBarItems(sourceFile); } function getSemanticClassifications(fileName, span) { + return convertClassifications(getEncodedSemanticClassifications(fileName, span)); + } + function getEncodedSemanticClassifications(fileName, span) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var typeChecker = program.getTypeChecker(); var result = []; processNode(sourceFile); - return result; + return { spans: result, endOfLineState: 0 /* None */ }; + function pushClassification(start, length, type) { + result.push(start); + result.push(length); + result.push(type); + } function classifySymbol(symbol, meaningAtPosition) { var flags = symbol.getFlags(); if (flags & 32 /* Class */) { - return ClassificationTypeNames.className; + return 11 /* className */; } else if (flags & 384 /* Enum */) { - return ClassificationTypeNames.enumName; + return 12 /* enumName */; } else if (flags & 524288 /* TypeAlias */) { - return ClassificationTypeNames.typeAlias; + return 16 /* typeAliasName */; } else if (meaningAtPosition & 2 /* Type */) { if (flags & 64 /* Interface */) { - return ClassificationTypeNames.interfaceName; + return 13 /* interfaceName */; } else if (flags & 262144 /* TypeParameter */) { - return ClassificationTypeNames.typeParameterName; + return 15 /* typeParameterName */; } } else if (flags & 1536 /* Module */) { @@ -39230,7 +40094,7 @@ var ts; // - There exists a module declaration which actually impacts the value side. if (meaningAtPosition & 4 /* Namespace */ || (meaningAtPosition & 1 /* Value */ && hasValueSideModule(symbol))) { - return ClassificationTypeNames.moduleName; + return 14 /* moduleName */; } } return undefined; @@ -39239,7 +40103,7 @@ var ts; */ function hasValueSideModule(symbol) { return ts.forEach(symbol.declarations, function (declaration) { - return declaration.kind === 205 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) == 1 /* Instantiated */; + return declaration.kind === 206 /* ModuleDeclaration */ && ts.getModuleInstanceState(declaration) == 1 /* Instantiated */; }); } } @@ -39251,10 +40115,7 @@ var ts; if (symbol) { var type = classifySymbol(symbol, getMeaningFromLocation(node)); if (type) { - result.push({ - textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), - classificationType: type - }); + pushClassification(node.getStart(), node.getWidth(), type); } } } @@ -39262,7 +40123,42 @@ var ts; } } } + function getClassificationTypeName(type) { + switch (type) { + case 1 /* comment */: return ClassificationTypeNames.comment; + case 2 /* identifier */: return ClassificationTypeNames.identifier; + case 3 /* keyword */: return ClassificationTypeNames.keyword; + case 4 /* numericLiteral */: return ClassificationTypeNames.numericLiteral; + case 5 /* operator */: return ClassificationTypeNames.operator; + case 6 /* stringLiteral */: return ClassificationTypeNames.stringLiteral; + case 8 /* whiteSpace */: return ClassificationTypeNames.whiteSpace; + case 9 /* text */: return ClassificationTypeNames.text; + case 10 /* punctuation */: return ClassificationTypeNames.punctuation; + case 11 /* className */: return ClassificationTypeNames.className; + case 12 /* enumName */: return ClassificationTypeNames.enumName; + case 13 /* interfaceName */: return ClassificationTypeNames.interfaceName; + case 14 /* moduleName */: return ClassificationTypeNames.moduleName; + case 15 /* typeParameterName */: return ClassificationTypeNames.typeParameterName; + case 16 /* typeAliasName */: return ClassificationTypeNames.typeAliasName; + case 17 /* parameterName */: return ClassificationTypeNames.parameterName; + } + } + function convertClassifications(classifications) { + ts.Debug.assert(classifications.spans.length % 3 === 0); + var dense = classifications.spans; + var result = []; + for (var i = 0, n = dense.length; i < n; i += 3) { + result.push({ + textSpan: ts.createTextSpan(dense[i], dense[i + 1]), + classificationType: getClassificationTypeName(dense[i + 2]) + }); + } + return result; + } function getSyntacticClassifications(fileName, span) { + return convertClassifications(getEncodedSyntacticClassifications(fileName, span)); + } + function getEncodedSyntacticClassifications(fileName, span) { // doesn't use compiler - no need to synchronize with host var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); // Make a scanner we can get trivia from. @@ -39270,7 +40166,12 @@ var ts; var mergeConflictScanner = ts.createScanner(2 /* Latest */, false, sourceFile.text); var result = []; processElement(sourceFile); - return result; + return { spans: result, endOfLineState: 0 /* None */ }; + function pushClassification(start, length, type) { + result.push(start); + result.push(length); + result.push(type); + } function classifyLeadingTrivia(token) { var tokenStart = ts.skipTrivia(sourceFile.text, token.pos, false); if (tokenStart === token.pos) { @@ -39289,10 +40190,7 @@ var ts; } if (ts.isComment(kind)) { // Simple comment. Just add as is. - result.push({ - textSpan: ts.createTextSpan(start, width), - classificationType: ClassificationTypeNames.comment - }); + pushClassification(start, width, 1 /* comment */); continue; } if (kind === 6 /* ConflictMarkerTrivia */) { @@ -39301,10 +40199,7 @@ var ts; // for the <<<<<<< and >>>>>>> markers, we just add them in as comments // in the classification stream. if (ch === 60 /* lessThan */ || ch === 62 /* greaterThan */) { - result.push({ - textSpan: ts.createTextSpan(start, width), - classificationType: ClassificationTypeNames.comment - }); + pushClassification(start, width, 1 /* comment */); continue; } // for the ======== add a comment for the first line, and then lex all @@ -39323,10 +40218,7 @@ var ts; break; } } - result.push({ - textSpan: ts.createTextSpanFromBounds(start, i), - classificationType: ClassificationTypeNames.comment - }); + pushClassification(start, i - start, 1 /* comment */); mergeConflictScanner.setTextPos(i); while (mergeConflictScanner.getTextPos() < end) { classifyDisabledCodeToken(); @@ -39338,10 +40230,7 @@ var ts; var end = mergeConflictScanner.getTextPos(); var type = classifyTokenType(tokenKind); if (type) { - result.push({ - textSpan: ts.createTextSpanFromBounds(start, end), - classificationType: type - }); + pushClassification(start, end - start, type); } } function classifyToken(token) { @@ -39349,10 +40238,7 @@ var ts; if (token.getWidth() > 0) { var type = classifyTokenType(token.kind, token); if (type) { - result.push({ - textSpan: ts.createTextSpan(token.getStart(), token.getWidth()), - classificationType: type - }); + pushClassification(token.getStart(), token.getWidth(), type); } } } @@ -39361,7 +40247,7 @@ var ts; // classify based on that instead. function classifyTokenType(tokenKind, token) { if (ts.isKeyword(tokenKind)) { - return ClassificationTypeNames.keyword; + return 3 /* keyword */; } // Special case < and > If they appear in a generic context they are punctuation, // not operators. @@ -39369,73 +40255,78 @@ var ts; // If the node owning the token has a type argument list or type parameter list, then // we can effectively assume that a '<' and '>' belong to those lists. if (token && ts.getTypeArgumentOrTypeParameterList(token.parent)) { - return ClassificationTypeNames.punctuation; + return 10 /* punctuation */; } } if (ts.isPunctuation(tokenKind)) { if (token) { if (tokenKind === 53 /* EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (token.parent.kind === 198 /* VariableDeclaration */ || - token.parent.kind === 132 /* PropertyDeclaration */ || - token.parent.kind === 129 /* Parameter */) { - return ClassificationTypeNames.operator; + if (token.parent.kind === 199 /* VariableDeclaration */ || + token.parent.kind === 133 /* PropertyDeclaration */ || + token.parent.kind === 130 /* Parameter */) { + return 5 /* operator */; } } - if (token.parent.kind === 169 /* BinaryExpression */ || - token.parent.kind === 167 /* PrefixUnaryExpression */ || - token.parent.kind === 168 /* PostfixUnaryExpression */ || - token.parent.kind === 170 /* ConditionalExpression */) { - return ClassificationTypeNames.operator; + if (token.parent.kind === 170 /* BinaryExpression */ || + token.parent.kind === 168 /* PrefixUnaryExpression */ || + token.parent.kind === 169 /* PostfixUnaryExpression */ || + token.parent.kind === 171 /* ConditionalExpression */) { + return 5 /* operator */; } } - return ClassificationTypeNames.punctuation; + return 10 /* punctuation */; } else if (tokenKind === 7 /* NumericLiteral */) { - return ClassificationTypeNames.numericLiteral; + return 4 /* numericLiteral */; } else if (tokenKind === 8 /* StringLiteral */) { - return ClassificationTypeNames.stringLiteral; + return 6 /* stringLiteral */; } else if (tokenKind === 9 /* RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. - return ClassificationTypeNames.stringLiteral; + return 6 /* stringLiteral */; } else if (ts.isTemplateLiteralKind(tokenKind)) { // TODO (drosen): we should *also* get another classification type for these literals. - return ClassificationTypeNames.stringLiteral; + return 6 /* stringLiteral */; } else if (tokenKind === 65 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: if (token.parent.name === token) { - return ClassificationTypeNames.className; + return 11 /* className */; } return; - case 128 /* TypeParameter */: + case 129 /* TypeParameter */: if (token.parent.name === token) { - return ClassificationTypeNames.typeParameterName; + return 15 /* typeParameterName */; } return; - case 202 /* InterfaceDeclaration */: + case 203 /* InterfaceDeclaration */: if (token.parent.name === token) { - return ClassificationTypeNames.interfaceName; + return 13 /* interfaceName */; } return; - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: if (token.parent.name === token) { - return ClassificationTypeNames.enumName; + return 12 /* enumName */; } return; - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: if (token.parent.name === token) { - return ClassificationTypeNames.moduleName; + return 14 /* moduleName */; + } + return; + case 130 /* Parameter */: + if (token.parent.name === token) { + return 17 /* parameterName */; } return; } } - return ClassificationTypeNames.text; + return 9 /* text */; } } function processElement(element) { @@ -39715,6 +40606,8 @@ var ts; getCompilerOptionsDiagnostics: getCompilerOptionsDiagnostics, getSyntacticClassifications: getSyntacticClassifications, getSemanticClassifications: getSemanticClassifications, + getEncodedSyntacticClassifications: getEncodedSyntacticClassifications, + getEncodedSemanticClassifications: getEncodedSemanticClassifications, getCompletionsAtPosition: getCompletionsAtPosition, getCompletionEntryDetails: getCompletionEntryDetails, getSignatureHelpItems: getSignatureHelpItems, @@ -39767,7 +40660,7 @@ var ts; // then we want 'something' to be in the name table. Similarly, if we have // "a['propname']" then we want to store "propname" in the name table. if (ts.isDeclarationName(node) || - node.parent.kind === 219 /* ExternalModuleReference */ || + node.parent.kind === 220 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node)) { nameTable[node.text] = node.text; } @@ -39780,7 +40673,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 156 /* ElementAccessExpression */ && + node.parent.kind === 157 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } /// Classifier @@ -39828,7 +40721,7 @@ var ts; function canFollow(keyword1, keyword2) { if (ts.isAccessibilityModifier(keyword1)) { if (keyword2 === 116 /* GetKeyword */ || - keyword2 === 120 /* SetKeyword */ || + keyword2 === 121 /* SetKeyword */ || keyword2 === 114 /* ConstructorKeyword */ || keyword2 === 109 /* StaticKeyword */) { // Allow things like "public get", "public constructor" and "public static". @@ -39843,9 +40736,58 @@ var ts; // if there are more cases we want the classifier to be better at. return true; } + function convertClassifications(classifications, text) { + var entries = []; + var dense = classifications.spans; + var lastEnd = 0; + for (var i = 0, n = dense.length; i < n; i += 3) { + var start = dense[i]; + var length_1 = dense[i + 1]; + var type = dense[i + 2]; + // Make a whitespace entry between the last item and this one. + if (lastEnd >= 0) { + var whitespaceLength_1 = start - lastEnd; + if (whitespaceLength_1 > 0) { + entries.push({ length: whitespaceLength_1, classification: TokenClass.Whitespace }); + } + } + entries.push({ length: length_1, classification: convertClassification(type) }); + lastEnd = start + length_1; + } + var whitespaceLength = text.length - lastEnd; + if (whitespaceLength > 0) { + entries.push({ length: whitespaceLength, classification: TokenClass.Whitespace }); + } + return { entries: entries, finalLexState: classifications.endOfLineState }; + } + function convertClassification(type) { + switch (type) { + case 1 /* comment */: return TokenClass.Comment; + case 3 /* keyword */: return TokenClass.Keyword; + case 4 /* numericLiteral */: return TokenClass.NumberLiteral; + case 5 /* operator */: return TokenClass.Operator; + case 6 /* stringLiteral */: return TokenClass.StringLiteral; + case 8 /* whiteSpace */: return TokenClass.Whitespace; + case 10 /* punctuation */: return TokenClass.Punctuation; + case 2 /* identifier */: + case 11 /* className */: + case 12 /* enumName */: + case 13 /* interfaceName */: + case 14 /* moduleName */: + case 15 /* typeParameterName */: + case 16 /* typeAliasName */: + case 9 /* text */: + case 17 /* parameterName */: + default: + return TokenClass.Identifier; + } + } + function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) { + return convertClassifications(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text); + } // If there is a syntactic classifier ('syntacticClassifierAbsent' is false), // we will be more conservative in order to avoid conflicting with the syntactic classifier. - function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) { + function getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent) { var offset = 0; var token = 0 /* Unknown */; var lastNonTriviaToken = 0 /* Unknown */; @@ -39885,8 +40827,8 @@ var ts; } scanner.setText(text); var result = { - finalLexState: 0 /* Start */, - entries: [] + endOfLineState: 0 /* None */, + spans: [] }; // We can run into an unfortunate interaction between the lexical and syntactic classifier // when the user is typing something generic. Consider the case where the user types: @@ -39938,10 +40880,10 @@ var ts; angleBracketStack--; } else if (token === 112 /* AnyKeyword */ || - token === 121 /* StringKeyword */ || - token === 119 /* NumberKeyword */ || + token === 122 /* StringKeyword */ || + token === 120 /* NumberKeyword */ || token === 113 /* BooleanKeyword */ || - token === 122 /* SymbolKeyword */) { + token === 123 /* SymbolKeyword */) { if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, @@ -39988,7 +40930,7 @@ var ts; function processToken() { var start = scanner.getTokenPos(); var end = scanner.getTextPos(); - addResult(end - start, classFromKind(token)); + addResult(start, end, classFromKind(token)); if (end >= text.length) { if (token === 8 /* StringLiteral */) { // Check to see if we finished up on a multiline string literal. @@ -40002,7 +40944,7 @@ var ts; // If we have an odd number of backslashes, then the multiline string is unclosed if (numBackslashes & 1) { var quoteChar = tokenText.charCodeAt(0); - result.finalLexState = quoteChar === 34 /* doubleQuote */ + result.endOfLineState = quoteChar === 34 /* doubleQuote */ ? 3 /* InDoubleQuoteStringLiteral */ : 2 /* InSingleQuoteStringLiteral */; } @@ -40011,16 +40953,16 @@ var ts; else if (token === 3 /* MultiLineCommentTrivia */) { // Check to see if the multiline comment was unclosed. if (scanner.isUnterminated()) { - result.finalLexState = 1 /* InMultiLineCommentTrivia */; + result.endOfLineState = 1 /* InMultiLineCommentTrivia */; } } else if (ts.isTemplateLiteralKind(token)) { if (scanner.isUnterminated()) { if (token === 13 /* TemplateTail */) { - result.finalLexState = 5 /* InTemplateMiddleOrTail */; + result.endOfLineState = 5 /* InTemplateMiddleOrTail */; } else if (token === 10 /* NoSubstitutionTemplateLiteral */) { - result.finalLexState = 4 /* InTemplateHeadOrNoSubstitutionTemplate */; + result.endOfLineState = 4 /* InTemplateHeadOrNoSubstitutionTemplate */; } else { ts.Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #" + token); @@ -40028,18 +40970,30 @@ var ts; } } else if (templateStack.length > 0 && ts.lastOrUndefined(templateStack) === 11 /* TemplateHead */) { - result.finalLexState = 6 /* InTemplateSubstitutionPosition */; + result.endOfLineState = 6 /* InTemplateSubstitutionPosition */; } } } - function addResult(length, classification) { + function addResult(start, end, classification) { + if (classification === 8 /* whiteSpace */) { + // Don't bother with whitespace classifications. They're not needed. + return; + } + if (start === 0 && offset > 0) { + // We're classifying the first token, and this was a case where we prepended + // text. We should consider the start of this token to be at the start of + // the original text. + start += offset; + } + // All our tokens are in relation to the augmented text. Move them back to be + // relative to the original text. + start -= offset; + end -= offset; + var length = end - start; if (length > 0) { - // If this is the first classification we're adding to the list, then remove any - // offset we have if we were continuing a construct from the previous line. - if (result.entries.length === 0) { - length -= offset; - } - result.entries.push({ length: length, classification: classification }); + result.spans.push(start); + result.spans.push(length); + result.spans.push(classification); } } } @@ -40100,41 +41054,44 @@ var ts; } } function isKeyword(token) { - return token >= 66 /* FirstKeyword */ && token <= 125 /* LastKeyword */; + return token >= 66 /* FirstKeyword */ && token <= 126 /* LastKeyword */; } function classFromKind(token) { if (isKeyword(token)) { - return TokenClass.Keyword; + return 3 /* keyword */; } else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { - return TokenClass.Operator; + return 5 /* operator */; } else if (token >= 14 /* FirstPunctuation */ && token <= 64 /* LastPunctuation */) { - return TokenClass.Punctuation; + return 10 /* punctuation */; } switch (token) { case 7 /* NumericLiteral */: - return TokenClass.NumberLiteral; + return 4 /* numericLiteral */; case 8 /* StringLiteral */: - return TokenClass.StringLiteral; + return 6 /* stringLiteral */; case 9 /* RegularExpressionLiteral */: - return TokenClass.RegExpLiteral; + return 7 /* regularExpressionLiteral */; case 6 /* ConflictMarkerTrivia */: case 3 /* MultiLineCommentTrivia */: case 2 /* SingleLineCommentTrivia */: - return TokenClass.Comment; + return 1 /* comment */; case 5 /* WhitespaceTrivia */: case 4 /* NewLineTrivia */: - return TokenClass.Whitespace; + return 8 /* whiteSpace */; case 65 /* Identifier */: default: if (ts.isTemplateLiteralKind(token)) { - return TokenClass.StringLiteral; + return 6 /* stringLiteral */; } - return TokenClass.Identifier; + return 2 /* identifier */; } } - return { getClassificationsForLine: getClassificationsForLine }; + return { + getClassificationsForLine: getClassificationsForLine, + getEncodedLexicalClassifications: getEncodedLexicalClassifications + }; } ts.createClassifier = createClassifier; /** @@ -40155,7 +41112,7 @@ var ts; getNodeConstructor: function (kind) { function Node() { } - var proto = kind === 227 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); + var proto = kind === 228 /* SourceFile */ ? new SourceFileObject() : new NodeObject(); proto.kind = kind; proto.pos = 0; proto.end = 0; @@ -40225,125 +41182,125 @@ var ts; function spanInNode(node) { if (node) { if (ts.isExpression(node)) { - if (node.parent.kind === 184 /* DoStatement */) { + if (node.parent.kind === 185 /* DoStatement */) { // Set span as if on while keyword return spanInPreviousNode(node); } - if (node.parent.kind === 186 /* ForStatement */) { + if (node.parent.kind === 187 /* ForStatement */) { // For now lets set the span on this expression, fix it later return textSpan(node); } - if (node.parent.kind === 169 /* BinaryExpression */ && node.parent.operatorToken.kind === 23 /* CommaToken */) { + if (node.parent.kind === 170 /* BinaryExpression */ && node.parent.operatorToken.kind === 23 /* CommaToken */) { // if this is comma expression, the breakpoint is possible in this expression return textSpan(node); } - if (node.parent.kind == 163 /* ArrowFunction */ && node.parent.body == node) { + if (node.parent.kind == 164 /* ArrowFunction */ && node.parent.body == node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); } } switch (node.kind) { - case 180 /* VariableStatement */: + case 181 /* VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 198 /* VariableDeclaration */: - case 132 /* PropertyDeclaration */: - case 131 /* PropertySignature */: + case 199 /* VariableDeclaration */: + case 133 /* PropertyDeclaration */: + case 132 /* PropertySignature */: return spanInVariableDeclaration(node); - case 129 /* Parameter */: + case 130 /* Parameter */: return spanInParameterDeclaration(node); - case 200 /* FunctionDeclaration */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 135 /* Constructor */: - case 162 /* FunctionExpression */: - case 163 /* ArrowFunction */: + case 201 /* FunctionDeclaration */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 136 /* Constructor */: + case 163 /* FunctionExpression */: + case 164 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 179 /* Block */: + case 180 /* Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // Fall through - case 206 /* ModuleBlock */: + case 207 /* ModuleBlock */: return spanInBlock(node); - case 223 /* CatchClause */: + case 224 /* CatchClause */: return spanInBlock(node.block); - case 182 /* ExpressionStatement */: + case 183 /* ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 191 /* ReturnStatement */: + case 192 /* ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 185 /* WhileStatement */: + case 186 /* WhileStatement */: // Span on while(...) return textSpan(node, ts.findNextToken(node.expression, node)); - case 184 /* DoStatement */: + case 185 /* DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 197 /* DebuggerStatement */: + case 198 /* DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 183 /* IfStatement */: + case 184 /* IfStatement */: // set on if(..) span return textSpan(node, ts.findNextToken(node.expression, node)); - case 194 /* LabeledStatement */: + case 195 /* LabeledStatement */: // span in statement return spanInNode(node.statement); - case 190 /* BreakStatement */: - case 189 /* ContinueStatement */: + case 191 /* BreakStatement */: + case 190 /* ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 186 /* ForStatement */: + case 187 /* ForStatement */: return spanInForStatement(node); - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: // span on for (a in ...) return textSpan(node, ts.findNextToken(node.expression, node)); - case 193 /* SwitchStatement */: + case 194 /* SwitchStatement */: // span on switch(...) return textSpan(node, ts.findNextToken(node.expression, node)); - case 220 /* CaseClause */: - case 221 /* DefaultClause */: + case 221 /* CaseClause */: + case 222 /* DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 196 /* TryStatement */: + case 197 /* TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 195 /* ThrowStatement */: + case 196 /* ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 214 /* ExportAssignment */: + case 215 /* ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 208 /* ImportEqualsDeclaration */: + case 209 /* ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 209 /* ImportDeclaration */: + case 210 /* ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 215 /* ExportDeclaration */: + case 216 /* ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) { return undefined; } - case 201 /* ClassDeclaration */: - case 204 /* EnumDeclaration */: - case 226 /* EnumMember */: - case 157 /* CallExpression */: - case 158 /* NewExpression */: + case 202 /* ClassDeclaration */: + case 205 /* EnumDeclaration */: + case 227 /* EnumMember */: + case 158 /* CallExpression */: + case 159 /* NewExpression */: // span on complete node return textSpan(node); - case 192 /* WithStatement */: + case 193 /* WithStatement */: // span in statement return spanInNode(node.statement); // No breakpoint in interface, type alias - case 202 /* InterfaceDeclaration */: - case 203 /* TypeAliasDeclaration */: + case 203 /* InterfaceDeclaration */: + case 204 /* TypeAliasDeclaration */: return undefined; // Tokens: case 22 /* SemicolonToken */: @@ -40373,11 +41330,11 @@ var ts; return spanInNextNode(node); default: // If this is name of property assignment, set breakpoint in the initializer - if (node.parent.kind === 224 /* PropertyAssignment */ && node.parent.name === node) { + if (node.parent.kind === 225 /* PropertyAssignment */ && node.parent.name === node) { return spanInNode(node.parent.initializer); } // Breakpoint in type assertion goes to its operand - if (node.parent.kind === 160 /* TypeAssertionExpression */ && node.parent.type === node) { + if (node.parent.kind === 161 /* TypeAssertionExpression */ && node.parent.type === node) { return spanInNode(node.parent.expression); } // return type of function go to previous token @@ -40390,12 +41347,12 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 187 /* ForInStatement */ || - variableDeclaration.parent.parent.kind === 188 /* ForOfStatement */) { + if (variableDeclaration.parent.parent.kind === 188 /* ForInStatement */ || + variableDeclaration.parent.parent.kind === 189 /* ForOfStatement */) { return spanInNode(variableDeclaration.parent.parent); } - var isParentVariableStatement = variableDeclaration.parent.parent.kind === 180 /* VariableStatement */; - var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 186 /* ForStatement */ && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); + var isParentVariableStatement = variableDeclaration.parent.parent.kind === 181 /* VariableStatement */; + var isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === 187 /* ForStatement */ && ts.contains(variableDeclaration.parent.parent.initializer.declarations, variableDeclaration); var declarations = isParentVariableStatement ? variableDeclaration.parent.parent.declarationList.declarations : isDeclarationOfForStatement @@ -40449,7 +41406,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return !!(functionDeclaration.flags & 1 /* Export */) || - (functionDeclaration.parent.kind === 201 /* ClassDeclaration */ && functionDeclaration.kind !== 135 /* Constructor */); + (functionDeclaration.parent.kind === 202 /* ClassDeclaration */ && functionDeclaration.kind !== 136 /* Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -40472,18 +41429,18 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 205 /* ModuleDeclaration */: + case 206 /* ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement - case 185 /* WhileStatement */: - case 183 /* IfStatement */: - case 187 /* ForInStatement */: - case 188 /* ForOfStatement */: + case 186 /* WhileStatement */: + case 184 /* IfStatement */: + case 188 /* ForInStatement */: + case 189 /* ForOfStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 186 /* ForStatement */: + case 187 /* ForStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement @@ -40491,7 +41448,7 @@ var ts; } function spanInForStatement(forStatement) { if (forStatement.initializer) { - if (forStatement.initializer.kind === 199 /* VariableDeclarationList */) { + if (forStatement.initializer.kind === 200 /* VariableDeclarationList */) { var variableDeclarationList = forStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -40511,13 +41468,13 @@ var ts; // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 204 /* EnumDeclaration */: + case 205 /* EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 201 /* ClassDeclaration */: + case 202 /* ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 207 /* CaseBlock */: + case 208 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -40525,25 +41482,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 206 /* ModuleBlock */: + case 207 /* ModuleBlock */: // If this is not instantiated module block no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) { return undefined; } - case 204 /* EnumDeclaration */: - case 201 /* ClassDeclaration */: + case 205 /* EnumDeclaration */: + case 202 /* ClassDeclaration */: // Span on close brace token return textSpan(node); - case 179 /* Block */: + case 180 /* Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // fall through. - case 223 /* CatchClause */: + case 224 /* CatchClause */: return spanInNode(node.parent.statements[node.parent.statements.length - 1]); ; - case 207 /* CaseBlock */: + case 208 /* CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = caseBlock.clauses[caseBlock.clauses.length - 1]; @@ -40557,7 +41514,7 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 184 /* DoStatement */) { + if (node.parent.kind === 185 /* DoStatement */) { // Go to while keyword and do action instead return spanInPreviousNode(node); } @@ -40567,17 +41524,17 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 162 /* FunctionExpression */: - case 200 /* FunctionDeclaration */: - case 163 /* ArrowFunction */: - case 134 /* MethodDeclaration */: - case 133 /* MethodSignature */: - case 136 /* GetAccessor */: - case 137 /* SetAccessor */: - case 135 /* Constructor */: - case 185 /* WhileStatement */: - case 184 /* DoStatement */: - case 186 /* ForStatement */: + case 163 /* FunctionExpression */: + case 201 /* FunctionDeclaration */: + case 164 /* ArrowFunction */: + case 135 /* MethodDeclaration */: + case 134 /* MethodSignature */: + case 137 /* GetAccessor */: + case 138 /* SetAccessor */: + case 136 /* Constructor */: + case 186 /* WhileStatement */: + case 185 /* DoStatement */: + case 187 /* ForStatement */: return spanInPreviousNode(node); // Default to parent node default: @@ -40588,19 +41545,19 @@ var ts; } function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration - if (ts.isFunctionLike(node.parent) || node.parent.kind === 224 /* PropertyAssignment */) { + if (ts.isFunctionLike(node.parent) || node.parent.kind === 225 /* PropertyAssignment */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 160 /* TypeAssertionExpression */) { + if (node.parent.kind === 161 /* TypeAssertionExpression */) { return spanInNode(node.parent.expression); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 184 /* DoStatement */) { + if (node.parent.kind === 185 /* DoStatement */) { // Set span on while expression return textSpan(node, ts.findNextToken(node.parent.expression, node.parent)); } @@ -40633,7 +41590,9 @@ var debugObjectHost = this; var ts; (function (ts) { function logInternalError(logger, err) { - logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message); + if (logger) { + logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message); + } } var ScriptSnapshotShimAdapter = (function () { function ScriptSnapshotShimAdapter(scriptSnapshotShim) { @@ -40726,24 +41685,39 @@ var ts; return LanguageServiceShimHostAdapter; })(); ts.LanguageServiceShimHostAdapter = LanguageServiceShimHostAdapter; - function simpleForwardCall(logger, actionDescription, action) { - logger.log(actionDescription); - var start = Date.now(); + var CoreServicesShimHostAdapter = (function () { + function CoreServicesShimHostAdapter(shimHost) { + this.shimHost = shimHost; + } + CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extension) { + var encoded = this.shimHost.readDirectory(rootDir, extension); + return JSON.parse(encoded); + }; + return CoreServicesShimHostAdapter; + })(); + ts.CoreServicesShimHostAdapter = CoreServicesShimHostAdapter; + function simpleForwardCall(logger, actionDescription, action, noPerfLogging) { + if (!noPerfLogging) { + 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) + "..."; + if (!noPerfLogging) { + 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) + "'"); } - logger.log(" result.length=" + str.length + ", result='" + JSON.stringify(str) + "'"); } return result; } - function forwardJSONCall(logger, actionDescription, action) { + function forwardJSONCall(logger, actionDescription, action, noPerfLogging) { try { - var result = simpleForwardCall(logger, actionDescription, action); + var result = simpleForwardCall(logger, actionDescription, action, noPerfLogging); return JSON.stringify({ result: result }); } catch (err) { @@ -40788,7 +41762,7 @@ var ts; this.logger = this.host; } LanguageServiceShimObject.prototype.forwardJSONCall = function (actionDescription, action) { - return forwardJSONCall(this.logger, actionDescription, action); + return forwardJSONCall(this.logger, actionDescription, action, false); }; /// DISPOSE /** @@ -40841,6 +41815,22 @@ var ts; return classifications; }); }; + LanguageServiceShimObject.prototype.getEncodedSyntacticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { + // directly serialize the spans out to a string. This is much faster to decode + // on the managed side versus a full JSON array. + return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); + }); + }; + LanguageServiceShimObject.prototype.getEncodedSemanticClassifications = function (fileName, start, length) { + var _this = this; + return this.forwardJSONCall("getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", function () { + // directly serialize the spans out to a string. This is much faster to decode + // on the managed side versus a full JSON array. + return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); + }); + }; LanguageServiceShimObject.prototype.getNewLine = function () { return this.host.getNewLine ? this.host.getNewLine() : "\r\n"; }; @@ -41060,12 +42050,21 @@ var ts; }; return LanguageServiceShimObject; })(ShimBase); + function convertClassifications(classifications) { + return { spans: classifications.spans.join(","), endOfLineState: classifications.endOfLineState }; + } var ClassifierShimObject = (function (_super) { __extends(ClassifierShimObject, _super); - function ClassifierShimObject(factory) { + function ClassifierShimObject(factory, logger) { _super.call(this, factory); + this.logger = logger; this.classifier = ts.createClassifier(); } + ClassifierShimObject.prototype.getEncodedLexicalClassifications = function (text, lexState, syntacticClassifierAbsent) { + var _this = this; + return forwardJSONCall(this.logger, "getEncodedLexicalClassifications", function () { return convertClassifications(_this.classifier.getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent)); }, + /*noPerfLogging:*/ true); + }; /// COLORIZATION ClassifierShimObject.prototype.getClassificationsForLine = function (text, lexState, classifyKeywordsInGenerics) { var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics); @@ -41082,12 +42081,13 @@ var ts; })(ShimBase); var CoreServicesShimObject = (function (_super) { __extends(CoreServicesShimObject, _super); - function CoreServicesShimObject(factory, logger) { + function CoreServicesShimObject(factory, logger, host) { _super.call(this, factory); this.logger = logger; + this.host = host; } CoreServicesShimObject.prototype.forwardJSONCall = function (actionDescription, action) { - return forwardJSONCall(this.logger, actionDescription, action); + return forwardJSONCall(this.logger, actionDescription, action, false); }; CoreServicesShimObject.prototype.getPreProcessedFileInfo = function (fileName, sourceTextSnapshot) { return this.forwardJSONCall("getPreProcessedFileInfo('" + fileName + "')", function () { @@ -41114,6 +42114,26 @@ var ts; return convertResult; }); }; + CoreServicesShimObject.prototype.getTSConfigFileInfo = function (fileName, sourceTextSnapshot) { + var _this = this; + return this.forwardJSONCall("getTSConfigFileInfo('" + fileName + "')", function () { + var text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()); + var result = ts.parseConfigFileText(fileName, text); + if (result.error) { + return { + options: {}, + files: [], + errors: [realizeDiagnostic(result.error, '\r\n')] + }; + } + var configFile = ts.parseConfigFile(result.config, _this.host, ts.getDirectoryPath(ts.normalizeSlashes(fileName))); + return { + options: configFile.options, + files: configFile.fileNames, + errors: realizeDiagnostics(configFile.errors, '\r\n') + }; + }); + }; CoreServicesShimObject.prototype.getDefaultCompilationSettings = function () { return this.forwardJSONCall("getDefaultCompilationSettings()", function () { return ts.getDefaultCompilerOptions(); @@ -41145,19 +42165,20 @@ var ts; }; TypeScriptServicesFactory.prototype.createClassifierShim = function (logger) { try { - return new ClassifierShimObject(this); + return new ClassifierShimObject(this, logger); } catch (err) { logInternalError(logger, err); throw err; } }; - TypeScriptServicesFactory.prototype.createCoreServicesShim = function (logger) { + TypeScriptServicesFactory.prototype.createCoreServicesShim = function (host) { try { - return new CoreServicesShimObject(this, logger); + var adapter = new CoreServicesShimHostAdapter(host); + return new CoreServicesShimObject(this, host, adapter); } catch (err) { - logInternalError(logger, err); + logInternalError(host, err); throw err; } }; diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 469ecf80c84..04766f22c4e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3182,7 +3182,7 @@ module ts { function getRestTypeOfSignature(signature: Signature): Type { if (signature.hasRestParameter) { - let type = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]); + let type = getTypeOfSymbol(lastOrUndefined(signature.parameters)); if (type.flags & TypeFlags.Reference && (type).target === globalArrayType) { return (type).typeArguments[0]; } @@ -5666,7 +5666,7 @@ module ts { // If last parameter is contextually rest parameter get its type if (indexOfParameter === (func.parameters.length - 1) && funcHasRestParameters && contextualSignature.hasRestParameter && func.parameters.length >= contextualSignature.parameters.length) { - return getTypeOfSymbol(contextualSignature.parameters[contextualSignature.parameters.length - 1]); + return getTypeOfSymbol(lastOrUndefined(contextualSignature.parameters)); } } } @@ -7215,9 +7215,9 @@ module ts { links.type = instantiateType(getTypeAtPosition(context, i), mapper); } if (signature.hasRestParameter && context.hasRestParameter && signature.parameters.length >= context.parameters.length) { - let parameter = signature.parameters[signature.parameters.length - 1]; + let parameter = lastOrUndefined(signature.parameters); let links = getSymbolLinks(parameter); - links.type = instantiateType(getTypeOfSymbol(context.parameters[context.parameters.length - 1]), mapper); + links.type = instantiateType(getTypeOfSymbol(lastOrUndefined(context.parameters)), mapper); } } @@ -12829,7 +12829,7 @@ module ts { function checkGrammarBindingElement(node: BindingElement) { if (node.dotDotDotToken) { let elements = (node.parent).elements; - if (node !== elements[elements.length - 1]) { + if (node !== lastOrUndefined(elements)) { return grammarErrorOnNode(node, Diagnostics.A_rest_element_must_be_last_in_an_array_destructuring_pattern); } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 15a67db77e0..da31878403a 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -71,6 +71,10 @@ module ts { type: "boolean", description: Diagnostics.Do_not_emit_outputs, }, + { + name: "noEmitHelpers", + type: "boolean" + }, { name: "noEmitOnError", type: "boolean", diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 6383108b0d6..9b987ba77c6 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -470,7 +470,7 @@ module ts { let normalized: string[] = []; for (let part of parts) { if (part !== ".") { - if (part === ".." && normalized.length > 0 && normalized[normalized.length - 1] !== "..") { + if (part === ".." && normalized.length > 0 && lastOrUndefined(normalized) !== "..") { normalized.pop(); } else { @@ -586,7 +586,7 @@ module ts { export function getRelativePathToDirectoryOrUrl(directoryPathOrUrl: string, relativeOrAbsolutePath: string, currentDirectory: string, getCanonicalFileName: (fileName: string) => string, isAbsolutePathAnUrl: boolean) { let pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory); let directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory); - if (directoryComponents.length > 1 && directoryComponents[directoryComponents.length - 1] === "") { + if (directoryComponents.length > 1 && lastOrUndefined(directoryComponents) === "") { // If the directory path given was of type test/cases/ then we really need components of directory to be only till its name // that is ["test", "cases", ""] needs to be actually ["test", "cases"] directoryComponents.length--; diff --git a/src/compiler/emitter.js b/src/compiler/emitter.js index 9a6b96640c9..a00f3a4dde3 100644 --- a/src/compiler/emitter.js +++ b/src/compiler/emitter.js @@ -267,7 +267,7 @@ var ts; var sourceMapNameIndexMap = {}; var sourceMapNameIndices = []; function getSourceMapNameIndex() { - return sourceMapNameIndices.length ? sourceMapNameIndices[sourceMapNameIndices.length - 1] : -1; + return sourceMapNameIndices.length ? lastOrUndefined(sourceMapNameIndices) : -1; } // Last recorded and encoded spans var lastRecordedSourceMapSpan; @@ -5084,11 +5084,11 @@ var ts; } } function hasDetachedComments(pos) { - return detachedCommentsInfo !== undefined && detachedCommentsInfo[detachedCommentsInfo.length - 1].nodePos === pos; + return detachedCommentsInfo !== undefined && lastOrUndefined(detachedCommentsInfo).nodePos === pos; } function getLeadingCommentsWithoutDetachedComments() { // get the leading comments from detachedPos - var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos); + var leadingComments = ts.getLeadingCommentRanges(currentSourceFile.text, lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); if (detachedCommentsInfo.length - 1) { detachedCommentsInfo.pop(); } @@ -5189,13 +5189,13 @@ var ts; // All comments look like they could have been part of the copyright header. Make // sure there is at least one blank line between it and the node. If not, it's not // a copyright header. - var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); + var lastCommentLine = ts.getLineOfLocalPosition(currentSourceFile, lastOrUndefined(detachedComments).end); var nodeLine = ts.getLineOfLocalPosition(currentSourceFile, ts.skipTrivia(currentSourceFile.text, node.pos)); if (nodeLine >= lastCommentLine + 2) { // Valid detachedComments ts.emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); ts.emitComments(currentSourceFile, writer, detachedComments, true, newLine, writeComment); - var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; + var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: lastOrUndefined(detachedComments).end }; if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 7ebdb3026ce..5a9a654ce60 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -18,7 +18,7 @@ module ts { export function emitFiles(resolver: EmitResolver, host: EmitHost, targetSourceFile: SourceFile): EmitResult { // emit output for the __extends helper function const extendsHelper = ` -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; @@ -27,7 +27,7 @@ var __extends = this.__extends || function (d, b) { // emit output for the __decorate helper function const decorateHelper = ` -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); @@ -38,13 +38,13 @@ if (typeof __decorate !== "function") __decorate = function (decorators, target, // emit output for the __metadata helper function const metadataHelper = ` -if (typeof __metadata !== "function") __metadata = function (k, v) { +var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); };`; // emit output for the __param helper function const paramHelper = ` -if (typeof __param !== "function") __param = function (paramIndex, decorator) { +var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } };`; @@ -336,7 +336,7 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) { let sourceMapNameIndexMap: Map = {}; let sourceMapNameIndices: number[] = []; function getSourceMapNameIndex() { - return sourceMapNameIndices.length ? sourceMapNameIndices[sourceMapNameIndices.length - 1] : -1; + return sourceMapNameIndices.length ? lastOrUndefined(sourceMapNameIndices) : -1; } // Last recorded and encoded spans @@ -3481,10 +3481,10 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) { } } - function getInitializedProperties(node: ClassLikeDeclaration, static: boolean) { + function getInitializedProperties(node: ClassLikeDeclaration, isStatic: boolean) { let properties: PropertyDeclaration[] = []; for (let member of node.members) { - if (member.kind === SyntaxKind.PropertyDeclaration && static === ((member.flags & NodeFlags.Static) !== 0) && (member).initializer) { + if (member.kind === SyntaxKind.PropertyDeclaration && isStatic === ((member.flags & NodeFlags.Static) !== 0) && (member).initializer) { properties.push(member); } } @@ -5614,24 +5614,28 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) { // emit prologue directives prior to __extends var startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); - // Only Emit __extends function when target ES5. - // For target ES6 and above, we can emit classDeclaration as is. - if ((languageVersion < ScriptTarget.ES6) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitExtends)) { - writeLines(extendsHelper); - extendsEmitted = true; - } - if (!decorateEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitDecorate) { - writeLines(decorateHelper); - if (compilerOptions.emitDecoratorMetadata) { - writeLines(metadataHelper); + // Only emit helpers if the user did not say otherwise. + if (!compilerOptions.noEmitHelpers) { + // Only Emit __extends function when target ES5. + // For target ES6 and above, we can emit classDeclaration as is. + if ((languageVersion < ScriptTarget.ES6) && (!extendsEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitExtends)) { + writeLines(extendsHelper); + extendsEmitted = true; } - decorateEmitted = true; - } - if (!paramEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitParam) { - writeLines(paramHelper); - paramEmitted = true; + if (!decorateEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitDecorate) { + writeLines(decorateHelper); + if (compilerOptions.emitDecoratorMetadata) { + writeLines(metadataHelper); + } + decorateEmitted = true; + } + + if (!paramEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitParam) { + writeLines(paramHelper); + paramEmitted = true; + } } if (isExternalModule(node) || compilerOptions.separateCompilation) { @@ -5886,13 +5890,13 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) { } function hasDetachedComments(pos: number) { - return detachedCommentsInfo !== undefined && detachedCommentsInfo[detachedCommentsInfo.length - 1].nodePos === pos; + return detachedCommentsInfo !== undefined && lastOrUndefined(detachedCommentsInfo).nodePos === pos; } function getLeadingCommentsWithoutDetachedComments() { // get the leading comments from detachedPos let leadingComments = getLeadingCommentRanges(currentSourceFile.text, - detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos); + lastOrUndefined(detachedCommentsInfo).detachedCommentEndPos); if (detachedCommentsInfo.length - 1) { detachedCommentsInfo.pop(); } @@ -6013,13 +6017,13 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) { // All comments look like they could have been part of the copyright header. Make // sure there is at least one blank line between it and the node. If not, it's not // a copyright header. - let lastCommentLine = getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); + let lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastOrUndefined(detachedComments).end); let 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); - let currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; + let currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: lastOrUndefined(detachedComments).end }; if (detachedCommentsInfo) { detachedCommentsInfo.push(currentDetachedCommentInfo); } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 7d984a3dfa4..055fc1b6f74 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1691,7 +1691,7 @@ module ts { do { templateSpans.push(parseTemplateSpan()); } - while (templateSpans[templateSpans.length - 1].literal.kind === SyntaxKind.TemplateMiddle) + while (lastOrUndefined(templateSpans).literal.kind === SyntaxKind.TemplateMiddle) templateSpans.end = getNodeEnd(); template.templateSpans = templateSpans; diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index f7224e619bb..4ed5d1cdb5b 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -522,7 +522,7 @@ module ts { } collecting = true; if (result && result.length) { - result[result.length - 1].hasTrailingNewLine = true; + lastOrUndefined(result).hasTrailingNewLine = true; } continue; case CharacterCodes.tab: @@ -569,7 +569,7 @@ module ts { default: if (ch > CharacterCodes.maxAsciiCharacter && (isWhiteSpace(ch) || isLineBreak(ch))) { if (result && result.length && isLineBreak(ch)) { - result[result.length - 1].hasTrailingNewLine = true; + lastOrUndefined(result).hasTrailingNewLine = true; } pos++; continue; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 4799f314063..9e7e6ac7328 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1657,6 +1657,7 @@ module ts { mapRoot?: string; module?: ModuleKind; noEmit?: boolean; + noEmitHelpers?: boolean; noEmitOnError?: boolean; noErrorTruncation?: boolean; noImplicitAny?: boolean; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 5296f063a94..3e825c6802c 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -856,7 +856,7 @@ module ts { } export function hasRestParameters(s: SignatureDeclaration): boolean { - return s.parameters.length > 0 && s.parameters[s.parameters.length - 1].dotDotDotToken !== undefined; + return s.parameters.length > 0 && lastOrUndefined(s.parameters).dotDotDotToken !== undefined; } export function isLiteralKind(kind: SyntaxKind): boolean { @@ -1362,7 +1362,7 @@ module ts { let lineStartsOfS = computeLineStarts(s); if (lineStartsOfS.length > 1) { lineCount = lineCount + lineStartsOfS.length - 1; - linePos = output.length - s.length + lineStartsOfS[lineStartsOfS.length - 1]; + linePos = output.length - s.length + lastOrUndefined(lineStartsOfS); } } } @@ -1727,8 +1727,8 @@ module ts { output.push(((charCode >> 6) & 0B00111111) | 0B10000000); output.push((charCode & 0B00111111) | 0B10000000); } - else { - Debug.assert(false, "Unexpected code point"); + else { + Debug.assert(false, "Unexpected code point"); } } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 6af77e3d746..30ae22a9e4a 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -990,6 +990,14 @@ module Harness { } break; + case 'emitdecoratormetadata': + options.emitDecoratorMetadata = setting.value === 'true'; + break; + + case 'noemithelpers': + options.noEmitHelpers = setting.value === 'true'; + break; + case 'noemitonerror': options.noEmitOnError = !!setting.value; break; @@ -1477,12 +1485,12 @@ module Harness { // List of allowed metadata names var fileMetadataNames = ["filename", "comments", "declaration", "module", - "nolib", "sourcemap", "target", "out", "outdir", "noemitonerror", + "nolib", "sourcemap", "target", "out", "outdir", "noemithelpers", "noemitonerror", "noimplicitany", "noresolve", "newline", "newlines", "emitbom", "errortruncation", "usecasesensitivefilenames", "preserveconstenums", "includebuiltfile", "suppressimplicitanyindexerrors", "stripinternal", "separatecompilation", "inlinesourcemap", "maproot", "sourceroot", - "inlinesources"]; + "inlinesources", "emitdecoratormetadata"]; function extractCompilerSettings(content: string): CompilerSetting[] { diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 808a25e6067..0e0b8d82918 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -241,6 +241,9 @@ module Harness.LanguageService { class ClassifierShimProxy implements ts.Classifier { constructor(private shim: ts.ClassifierShim) { } + getEncodedLexicalClassifications(text: string, lexState: ts.EndOfLineState, classifyKeywordsInGenerics?: boolean): ts.Classifications { + throw new Error("NYI"); + } getClassificationsForLine(text: string, lexState: ts.EndOfLineState, classifyKeywordsInGenerics?: boolean): ts.ClassificationResult { var result = this.shim.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics).split('\n'); var entries: ts.ClassificationInfo[] = []; @@ -306,6 +309,12 @@ module Harness.LanguageService { getSemanticClassifications(fileName: string, span: ts.TextSpan): ts.ClassifiedSpan[] { return unwrapJSONCallResult(this.shim.getSemanticClassifications(fileName, span.start, span.length)); } + getEncodedSyntacticClassifications(fileName: string, span: ts.TextSpan): ts.Classifications { + return unwrapJSONCallResult(this.shim.getEncodedSyntacticClassifications(fileName, span.start, span.length)); + } + getEncodedSemanticClassifications(fileName: string, span: ts.TextSpan): ts.Classifications { + return unwrapJSONCallResult(this.shim.getEncodedSemanticClassifications(fileName, span.start, span.length)); + } getCompletionsAtPosition(fileName: string, position: number): ts.CompletionInfo { return unwrapJSONCallResult(this.shim.getCompletionsAtPosition(fileName, position)); } diff --git a/src/lib/dom.generated.d.ts b/src/lib/dom.generated.d.ts index 1958bf55439..00b4e8ea570 100644 --- a/src/lib/dom.generated.d.ts +++ b/src/lib/dom.generated.d.ts @@ -3697,6 +3697,8 @@ interface HTMLCanvasElement extends HTMLElement { * Returns an object that provides methods and properties for drawing and manipulating images and graphics on a canvas element in a document. A context object includes information about colors, line widths, fonts, and other graphic parameters that can be drawn on a canvas. * @param contextId The identifier (ID) of the type of canvas to create. Internet Explorer 9 and Internet Explorer 10 support only a 2-D context using canvas.getContext("2d"); IE11 Preview also supports 3-D or WebGL context using canvas.getContext("experimental-webgl"); */ + getContext(contextId: "2d"): CanvasRenderingContext2D; + getContext(contextId: "experimental-webgl"): WebGLRenderingContext; getContext(contextId: string, ...args: any[]): CanvasRenderingContext2D | WebGLRenderingContext; /** * Returns a blob object encoded as a Portable Network Graphics (PNG) format from a canvas image or drawing. @@ -12332,11 +12334,13 @@ interface DocumentEvent { createEvent(eventInterface:"CloseEvent"): CloseEvent; createEvent(eventInterface:"CommandEvent"): CommandEvent; createEvent(eventInterface:"CompositionEvent"): CompositionEvent; + createEvent(eventInterface: "CustomEvent"): CustomEvent; createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent; createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent; createEvent(eventInterface:"DragEvent"): DragEvent; createEvent(eventInterface:"ErrorEvent"): ErrorEvent; createEvent(eventInterface:"Event"): Event; + createEvent(eventInterface:"Events"): Event; createEvent(eventInterface:"FocusEvent"): FocusEvent; createEvent(eventInterface:"GamepadEvent"): GamepadEvent; createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent; @@ -12351,8 +12355,12 @@ interface DocumentEvent { createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent; createEvent(eventInterface:"MessageEvent"): MessageEvent; createEvent(eventInterface:"MouseEvent"): MouseEvent; + createEvent(eventInterface:"MouseEvents"): MouseEvent; createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent; + createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent; + createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent; createEvent(eventInterface:"MutationEvent"): MutationEvent; + createEvent(eventInterface:"MutationEvents"): MutationEvent; createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent; createEvent(eventInterface:"NavigationEvent"): NavigationEvent; createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer; @@ -12363,6 +12371,7 @@ interface DocumentEvent { createEvent(eventInterface:"PopStateEvent"): PopStateEvent; createEvent(eventInterface:"ProgressEvent"): ProgressEvent; createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent; + createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent; createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent; createEvent(eventInterface:"StorageEvent"): StorageEvent; createEvent(eventInterface:"TextEvent"): TextEvent; @@ -12370,6 +12379,7 @@ interface DocumentEvent { createEvent(eventInterface:"TrackEvent"): TrackEvent; createEvent(eventInterface:"TransitionEvent"): TransitionEvent; createEvent(eventInterface:"UIEvent"): UIEvent; + createEvent(eventInterface:"UIEvents"): UIEvent; createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent; createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent; createEvent(eventInterface:"WheelEvent"): WheelEvent; diff --git a/src/lib/es6.d.ts b/src/lib/es6.d.ts index 71778ecf907..fb0c64f8495 100644 --- a/src/lib/es6.d.ts +++ b/src/lib/es6.d.ts @@ -51,11 +51,41 @@ interface SymbolConstructor { isConcatSpreadable: symbol; /** - * A method that returns the default iterator for an object.Called by the semantics of the + * A method that returns the default iterator for an object. Called by the semantics of the * for-of statement. */ iterator: symbol; + /** + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + replace: symbol; + + /** + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. + */ + search: symbol; + + /** + * A function valued property that is the constructor function that is used to create + * derived objects. + */ + species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + split: symbol; + /** * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive * abstract operation. @@ -3542,6 +3572,16 @@ declare module Reflect { function setPrototypeOf(target: any, proto: any): boolean; } +interface PromiseLike { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; +} + /** * Represents the completion of an asynchronous operation */ @@ -3552,14 +3592,16 @@ interface Promise { * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of which ever callback is executed. */ - then(onfulfilled?: (value: T) => TResult | Promise, onrejected?: (reason: any) => TResult | Promise): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; /** * Attaches a callback for only the rejection of the Promise. * @param onrejected The callback to execute when the Promise is rejected. * @returns A Promise for the completion of the callback. */ - catch(onrejected?: (reason: any) => T | Promise): Promise; + catch(onrejected?: (reason: any) => T | PromiseLike): Promise; + + [Symbol.toStringTag]: string; } interface PromiseConstructor { @@ -3570,13 +3612,11 @@ interface PromiseConstructor { /** * Creates a new Promise. - * @param init A callback used to initialize the promise. This callback is passed two arguments: + * @param executor A callback used to initialize the promise. This callback is passed two arguments: * a resolve callback used resolve the promise with a value or the result of another promise, * and a reject callback used to reject the promise with a provided reason or error. */ - new (init: (resolve: (value?: T | Promise) => void, reject: (reason?: any) => void) => void): Promise; - - (init: (resolve: (value?: T | Promise) => void, reject: (reason?: any) => void) => void): Promise; + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; /** * Creates a Promise that is resolved with an array of results when all of the provided Promises @@ -3584,15 +3624,7 @@ interface PromiseConstructor { * @param values An array of Promises. * @returns A new Promise. */ - all(values: (T | Promise)[]): Promise; - - /** - * Creates a Promise that is resolved with an array of results when all of the provided Promises - * resolve, or rejected when any Promise is rejected. - * @param values An array of values. - * @returns A new Promise. - */ - all(values: Promise[]): Promise; + all(values: Iterable>): Promise; /** * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved @@ -3600,7 +3632,7 @@ interface PromiseConstructor { * @param values An array of Promises. * @returns A new Promise. */ - race(values: (T | Promise)[]): Promise; + race(values: Iterable>): Promise; /** * Creates a new rejected promise for the provided reason. @@ -3621,13 +3653,15 @@ interface PromiseConstructor { * @param value A promise. * @returns A promise whose internal state matches the provided promise. */ - resolve(value: T | Promise): Promise; + resolve(value: T | PromiseLike): Promise; /** * Creates a new resolved promise . * @returns A resolved promise. */ resolve(): Promise; + + [Symbol.species]: Function; } declare var Promise: PromiseConstructor; diff --git a/src/server/client.ts b/src/server/client.ts index ea0ca3bb05f..3582d508322 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -559,6 +559,14 @@ module ts.server { throw new Error("Not Implemented Yet."); } + getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications { + throw new Error("Not Implemented Yet."); + } + + getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications { + throw new Error("Not Implemented Yet."); + } + getProgram(): Program { throw new Error("SourceFile objects are not serializable through the server protocol."); } diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 85f0dc14779..dbf3ff3e51c 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -424,7 +424,7 @@ module ts.server { getFormatCodeOptions(file?: string) { if (file) { - var info = this.filenameToScriptInfo[file]; + var info = this.filenameToScriptInfo[file]; if (info) { return info.formatCodeOptions; } @@ -750,6 +750,7 @@ module ts.server { if (content !== undefined) { var indentSize: number; info = new ScriptInfo(this.host, fileName, content, openedByClient); + info.setFormatOptions(this.getFormatCodeOptions()); this.filenameToScriptInfo[fileName] = info; if (!info.isOpen) { info.fileWatcher = this.host.watchFile(fileName, _ => { this.watchedFileChanged(fileName); }); diff --git a/src/server/session.ts b/src/server/session.ts index 4003b7c3186..baf0a085ad4 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -542,7 +542,7 @@ module ts.server { IndentSize: formatOptions.IndentSize, TabSize: formatOptions.TabSize, NewLineCharacter: "\n", - ConvertTabsToSpaces: true, + ConvertTabsToSpaces: formatOptions.ConvertTabsToSpaces, }; var indentPosition = compilerService.languageService.getIndentationAtPosition(file, position, editorOptions); diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 19235269f22..41079c08201 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -446,14 +446,14 @@ module ts.BreakpointResolver { // fall through. case SyntaxKind.CatchClause: - return spanInNode((node.parent).statements[(node.parent).statements.length - 1]);; + return spanInNode(lastOrUndefined((node.parent).statements));; case SyntaxKind.CaseBlock: // breakpoint in last statement of the last clause let caseBlock = node.parent; - let lastClause = caseBlock.clauses[caseBlock.clauses.length - 1]; + let lastClause = lastOrUndefined(caseBlock.clauses); if (lastClause) { - return spanInNode(lastClause.statements[lastClause.statements.length - 1]); + return spanInNode(lastOrUndefined(lastClause.statements)); } return undefined; diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts index 388d9428ffc..e09b5dfba92 100644 --- a/src/services/formatting/formattingScanner.ts +++ b/src/services/formatting/formattingScanner.ts @@ -51,7 +51,7 @@ module ts.formatting { if (isStarted) { if (trailingTrivia) { Debug.assert(trailingTrivia.length !== 0); - wasNewLine = trailingTrivia[trailingTrivia.length - 1].kind === SyntaxKind.NewLineTrivia; + wasNewLine = lastOrUndefined(trailingTrivia).kind === SyntaxKind.NewLineTrivia; } else { wasNewLine = false; diff --git a/src/services/services.ts b/src/services/services.ts index 50d962fbe7d..1333f2a13cb 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -197,6 +197,9 @@ module ts { let list = createNode(SyntaxKind.SyntaxList, nodes.pos, nodes.end, NodeFlags.Synthetic, this); list._children = []; let pos = nodes.pos; + + + for (let node of nodes) { if (pos < node.pos) { pos = this.addSyntheticNodes(list._children, pos, node.pos); @@ -969,9 +972,20 @@ module ts { getSemanticDiagnostics(fileName: string): Diagnostic[]; getCompilerOptionsDiagnostics(): Diagnostic[]; + /** + * @deprecated Use getEncodedSyntacticClassifications instead. + */ getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + + /** + * @deprecated Use getEncodedSemanticClassifications instead. + */ getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]; + // Encoded as triples of [start, length, ClassificationType]. + getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications; + getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications; + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo; getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails; @@ -1017,6 +1031,11 @@ module ts { dispose(): void; } + export interface Classifications { + spans: number[], + endOfLineState: EndOfLineState + } + export interface ClassifiedSpan { textSpan: TextSpan; classificationType: string; // ClassificationTypeNames @@ -1260,7 +1279,7 @@ module ts { } export const enum EndOfLineState { - Start, + None, InMultiLineCommentTrivia, InSingleQuoteStringLiteral, InDoubleQuoteStringLiteral, @@ -1310,8 +1329,10 @@ module ts { * classifications which may be incorrectly categorized will be given * back as Identifiers in order to allow the syntactic classifier to * subsume the classification. + * @deprecated Use getLexicalClassifications instead. */ getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult; + getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications; } /** @@ -1486,7 +1507,28 @@ module ts { public static interfaceName = "interface name"; public static moduleName = "module name"; public static typeParameterName = "type parameter name"; - public static typeAlias = "type alias name"; + public static typeAliasName = "type alias name"; + public static parameterName = "parameter name"; + } + + export const enum ClassificationType { + comment = 1, + identifier = 2, + keyword = 3, + numericLiteral = 4, + operator = 5, + stringLiteral = 6, + regularExpressionLiteral = 7, + whiteSpace = 8, + text = 9, + punctuation = 10, + className = 11, + enumName = 12, + interfaceName = 13, + moduleName = 14, + typeParameterName = 15, + typeAliasName = 16, + parameterName = 17 } /// Language Service @@ -3933,7 +3975,7 @@ module ts { return true; } else if (declarations.length) { - result.push(createDefinitionInfo(declarations[declarations.length - 1], symbolKind, symbolName, containerName)); + result.push(createDefinitionInfo(lastOrUndefined(declarations), symbolKind, symbolName, containerName)); return true; } @@ -5838,35 +5880,45 @@ module ts { return NavigationBar.getNavigationBarItems(sourceFile); } - function getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] { + function getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]{ + return convertClassifications(getEncodedSemanticClassifications(fileName, span)); + } + + function getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications { synchronizeHostData(); let sourceFile = getValidSourceFile(fileName); let typeChecker = program.getTypeChecker(); - let result: ClassifiedSpan[] = []; + let result: number[] = []; processNode(sourceFile); - return result; + return { spans: result, endOfLineState: EndOfLineState.None }; - function classifySymbol(symbol: Symbol, meaningAtPosition: SemanticMeaning) { + function pushClassification(start: number, length: number, type: ClassificationType) { + result.push(start); + result.push(length); + result.push(type); + } + + function classifySymbol(symbol: Symbol, meaningAtPosition: SemanticMeaning): ClassificationType { let flags = symbol.getFlags(); if (flags & SymbolFlags.Class) { - return ClassificationTypeNames.className; + return ClassificationType.className; } else if (flags & SymbolFlags.Enum) { - return ClassificationTypeNames.enumName; + return ClassificationType.enumName; } else if (flags & SymbolFlags.TypeAlias) { - return ClassificationTypeNames.typeAlias; + return ClassificationType.typeAliasName; } else if (meaningAtPosition & SemanticMeaning.Type) { if (flags & SymbolFlags.Interface) { - return ClassificationTypeNames.interfaceName; + return ClassificationType.interfaceName; } else if (flags & SymbolFlags.TypeParameter) { - return ClassificationTypeNames.typeParameterName; + return ClassificationType.typeParameterName; } } else if (flags & SymbolFlags.Module) { @@ -5875,7 +5927,7 @@ module ts { // - There exists a module declaration which actually impacts the value side. if (meaningAtPosition & SemanticMeaning.Namespace || (meaningAtPosition & SemanticMeaning.Value && hasValueSideModule(symbol))) { - return ClassificationTypeNames.moduleName; + return ClassificationType.moduleName; } } @@ -5899,10 +5951,7 @@ module ts { if (symbol) { let type = classifySymbol(symbol, getMeaningFromLocation(node)); if (type) { - result.push({ - textSpan: createTextSpan(node.getStart(), node.getWidth()), - classificationType: type - }); + pushClassification(node.getStart(), node.getWidth(), type); } } } @@ -5912,7 +5961,46 @@ module ts { } } - function getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] { + function getClassificationTypeName(type: ClassificationType) { + switch (type) { + case ClassificationType.comment: return ClassificationTypeNames.comment; + case ClassificationType.identifier: return ClassificationTypeNames.identifier; + case ClassificationType.keyword: return ClassificationTypeNames.keyword; + case ClassificationType.numericLiteral: return ClassificationTypeNames.numericLiteral; + case ClassificationType.operator: return ClassificationTypeNames.operator; + case ClassificationType.stringLiteral: return ClassificationTypeNames.stringLiteral; + case ClassificationType.whiteSpace: return ClassificationTypeNames.whiteSpace; + case ClassificationType.text: return ClassificationTypeNames.text; + case ClassificationType.punctuation: return ClassificationTypeNames.punctuation; + case ClassificationType.className: return ClassificationTypeNames.className; + case ClassificationType.enumName: return ClassificationTypeNames.enumName; + case ClassificationType.interfaceName: return ClassificationTypeNames.interfaceName; + case ClassificationType.moduleName: return ClassificationTypeNames.moduleName; + case ClassificationType.typeParameterName: return ClassificationTypeNames.typeParameterName; + case ClassificationType.typeAliasName: return ClassificationTypeNames.typeAliasName; + case ClassificationType.parameterName: return ClassificationTypeNames.parameterName; + } + } + + function convertClassifications(classifications: Classifications): ClassifiedSpan[] { + Debug.assert(classifications.spans.length % 3 === 0); + let dense = classifications.spans; + let result: ClassifiedSpan[] = []; + for (let i = 0, n = dense.length; i < n; i += 3) { + result.push({ + textSpan: createTextSpan(dense[i], dense[i + 1]), + classificationType: getClassificationTypeName(dense[i + 2]) + }); + } + + return result; + } + + function getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]{ + return convertClassifications(getEncodedSyntacticClassifications(fileName, span)); + } + + function getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications { // doesn't use compiler - no need to synchronize with host let sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); @@ -5920,10 +6008,16 @@ module ts { let triviaScanner = createScanner(ScriptTarget.Latest, /*skipTrivia:*/ false, sourceFile.text); let mergeConflictScanner = createScanner(ScriptTarget.Latest, /*skipTrivia:*/ false, sourceFile.text); - let result: ClassifiedSpan[] = []; + let result: number[] = []; processElement(sourceFile); - return result; + return { spans: result, endOfLineState: EndOfLineState.None }; + + function pushClassification(start: number, length: number, type: ClassificationType) { + result.push(start); + result.push(length); + result.push(type); + } function classifyLeadingTrivia(token: Node): void { let tokenStart = skipTrivia(sourceFile.text, token.pos, /*stopAfterLineBreak:*/ false); @@ -5946,10 +6040,7 @@ module ts { if (isComment(kind)) { // Simple comment. Just add as is. - result.push({ - textSpan: createTextSpan(start, width), - classificationType: ClassificationTypeNames.comment - }) + pushClassification(start, width, ClassificationType.comment); continue; } @@ -5960,10 +6051,7 @@ module ts { // for the <<<<<<< and >>>>>>> markers, we just add them in as comments // in the classification stream. if (ch === CharacterCodes.lessThan || ch === CharacterCodes.greaterThan) { - result.push({ - textSpan: createTextSpan(start, width), - classificationType: ClassificationTypeNames.comment - }); + pushClassification(start, width, ClassificationType.comment); continue; } @@ -5984,11 +6072,7 @@ module ts { break; } } - result.push({ - textSpan: createTextSpanFromBounds(start, i), - classificationType: ClassificationTypeNames.comment - }); - + pushClassification(start, i - start, ClassificationType.comment); mergeConflictScanner.setTextPos(i); while (mergeConflictScanner.getTextPos() < end) { @@ -6003,10 +6087,7 @@ module ts { let type = classifyTokenType(tokenKind); if (type) { - result.push({ - textSpan: createTextSpanFromBounds(start, end), - classificationType: type - }); + pushClassification(start, end - start, type); } } @@ -6016,10 +6097,7 @@ module ts { if (token.getWidth() > 0) { let type = classifyTokenType(token.kind, token); if (type) { - result.push({ - textSpan: createTextSpan(token.getStart(), token.getWidth()), - classificationType: type - }); + pushClassification(token.getStart(), token.getWidth(), type); } } } @@ -6027,9 +6105,9 @@ module ts { // for accurate classification, the actual token should be passed in. however, for // cases like 'disabled merge code' classification, we just get the token kind and // classify based on that instead. - function classifyTokenType(tokenKind: SyntaxKind, token?: Node): string { + function classifyTokenType(tokenKind: SyntaxKind, token?: Node): ClassificationType { if (isKeyword(tokenKind)) { - return ClassificationTypeNames.keyword; + return ClassificationType.keyword; } // Special case < and > If they appear in a generic context they are punctuation, @@ -6038,7 +6116,7 @@ module ts { // If the node owning the token has a type argument list or type parameter list, then // we can effectively assume that a '<' and '>' belong to those lists. if (token && getTypeArgumentOrTypeParameterList(token.parent)) { - return ClassificationTypeNames.punctuation; + return ClassificationType.punctuation; } } @@ -6049,7 +6127,7 @@ module ts { if (token.parent.kind === SyntaxKind.VariableDeclaration || token.parent.kind === SyntaxKind.PropertyDeclaration || token.parent.kind === SyntaxKind.Parameter) { - return ClassificationTypeNames.operator; + return ClassificationType.operator; } } @@ -6057,58 +6135,64 @@ module ts { token.parent.kind === SyntaxKind.PrefixUnaryExpression || token.parent.kind === SyntaxKind.PostfixUnaryExpression || token.parent.kind === SyntaxKind.ConditionalExpression) { - return ClassificationTypeNames.operator; + return ClassificationType.operator; } } - return ClassificationTypeNames.punctuation; + return ClassificationType.punctuation; } else if (tokenKind === SyntaxKind.NumericLiteral) { - return ClassificationTypeNames.numericLiteral; + return ClassificationType.numericLiteral; } else if (tokenKind === SyntaxKind.StringLiteral) { - return ClassificationTypeNames.stringLiteral; + return ClassificationType.stringLiteral; } else if (tokenKind === SyntaxKind.RegularExpressionLiteral) { // TODO: we should get another classification type for these literals. - return ClassificationTypeNames.stringLiteral; + return ClassificationType.stringLiteral; } else if (isTemplateLiteralKind(tokenKind)) { // TODO (drosen): we should *also* get another classification type for these literals. - return ClassificationTypeNames.stringLiteral; + return ClassificationType.stringLiteral; } else if (tokenKind === SyntaxKind.Identifier) { if (token) { switch (token.parent.kind) { case SyntaxKind.ClassDeclaration: if ((token.parent).name === token) { - return ClassificationTypeNames.className; + return ClassificationType.className; } return; case SyntaxKind.TypeParameter: if ((token.parent).name === token) { - return ClassificationTypeNames.typeParameterName; + return ClassificationType.typeParameterName; } return; case SyntaxKind.InterfaceDeclaration: if ((token.parent).name === token) { - return ClassificationTypeNames.interfaceName; + return ClassificationType.interfaceName; } return; case SyntaxKind.EnumDeclaration: if ((token.parent).name === token) { - return ClassificationTypeNames.enumName; + return ClassificationType.enumName; } return; case SyntaxKind.ModuleDeclaration: if ((token.parent).name === token) { - return ClassificationTypeNames.moduleName; + return ClassificationType.moduleName; } return; + case SyntaxKind.Parameter: + if ((token.parent).name === token) { + return ClassificationType.parameterName; + } + return; + } } - return ClassificationTypeNames.text; + return ClassificationType.text; } } @@ -6439,6 +6523,8 @@ module ts { getCompilerOptionsDiagnostics, getSyntacticClassifications, getSemanticClassifications, + getEncodedSyntacticClassifications, + getEncodedSemanticClassifications, getCompletionsAtPosition, getCompletionEntryDetails, getSignatureHelpItems, @@ -6580,10 +6666,67 @@ module ts { // if there are more cases we want the classifier to be better at. return true; } - + + function convertClassifications(classifications: Classifications, text: string): ClassificationResult { + var entries: ClassificationInfo[] = []; + let dense = classifications.spans; + let lastEnd = 0; + + for (let i = 0, n = dense.length; i < n; i += 3) { + let start = dense[i]; + let length = dense[i + 1]; + let type = dense[i + 2]; + + // Make a whitespace entry between the last item and this one. + if (lastEnd >= 0) { + let whitespaceLength = start - lastEnd; + if (whitespaceLength > 0) { + entries.push({ length: whitespaceLength, classification: TokenClass.Whitespace }); + } + } + + entries.push({ length, classification: convertClassification(type) }); + lastEnd = start + length; + } + + let whitespaceLength = text.length - lastEnd; + if (whitespaceLength > 0) { + entries.push({ length: whitespaceLength, classification: TokenClass.Whitespace }); + } + + return { entries, finalLexState: classifications.endOfLineState }; + } + + function convertClassification(type: ClassificationType): TokenClass { + switch (type) { + case ClassificationType.comment: return TokenClass.Comment; + case ClassificationType.keyword: return TokenClass.Keyword; + case ClassificationType.numericLiteral: return TokenClass.NumberLiteral; + case ClassificationType.operator: return TokenClass.Operator; + case ClassificationType.stringLiteral: return TokenClass.StringLiteral; + case ClassificationType.whiteSpace: return TokenClass.Whitespace; + case ClassificationType.punctuation: return TokenClass.Punctuation; + case ClassificationType.identifier: + case ClassificationType.className: + case ClassificationType.enumName: + case ClassificationType.interfaceName: + case ClassificationType.moduleName: + case ClassificationType.typeParameterName: + case ClassificationType.typeAliasName: + case ClassificationType.text: + case ClassificationType.parameterName: + default: + return TokenClass.Identifier; + } + } + + function getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult { + return convertClassifications(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text); + } + // If there is a syntactic classifier ('syntacticClassifierAbsent' is false), // we will be more conservative in order to avoid conflicting with the syntactic classifier. - function getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult { + function getEncodedLexicalClassifications(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications { let offset = 0; let token = SyntaxKind.Unknown; let lastNonTriviaToken = SyntaxKind.Unknown; @@ -6626,9 +6769,9 @@ module ts { scanner.setText(text); - let result: ClassificationResult = { - finalLexState: EndOfLineState.Start, - entries: [] + let result: Classifications = { + endOfLineState: EndOfLineState.None, + spans: [] }; // We can run into an unfortunate interaction between the lexical and syntactic classifier @@ -6741,7 +6884,7 @@ module ts { let start = scanner.getTokenPos(); let end = scanner.getTextPos(); - addResult(end - start, classFromKind(token)); + addResult(start, end, classFromKind(token)); if (end >= text.length) { if (token === SyntaxKind.StringLiteral) { @@ -6758,7 +6901,7 @@ module ts { // If we have an odd number of backslashes, then the multiline string is unclosed if (numBackslashes & 1) { let quoteChar = tokenText.charCodeAt(0); - result.finalLexState = quoteChar === CharacterCodes.doubleQuote + result.endOfLineState = quoteChar === CharacterCodes.doubleQuote ? EndOfLineState.InDoubleQuoteStringLiteral : EndOfLineState.InSingleQuoteStringLiteral; } @@ -6767,16 +6910,16 @@ module ts { else if (token === SyntaxKind.MultiLineCommentTrivia) { // Check to see if the multiline comment was unclosed. if (scanner.isUnterminated()) { - result.finalLexState = EndOfLineState.InMultiLineCommentTrivia; + result.endOfLineState = EndOfLineState.InMultiLineCommentTrivia; } } else if (isTemplateLiteralKind(token)) { if (scanner.isUnterminated()) { if (token === SyntaxKind.TemplateTail) { - result.finalLexState = EndOfLineState.InTemplateMiddleOrTail; + result.endOfLineState = EndOfLineState.InTemplateMiddleOrTail; } else if (token === SyntaxKind.NoSubstitutionTemplateLiteral) { - result.finalLexState = EndOfLineState.InTemplateHeadOrNoSubstitutionTemplate; + result.endOfLineState = EndOfLineState.InTemplateHeadOrNoSubstitutionTemplate; } else { Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #" + token); @@ -6784,20 +6927,34 @@ module ts { } } else if (templateStack.length > 0 && lastOrUndefined(templateStack) === SyntaxKind.TemplateHead) { - result.finalLexState = EndOfLineState.InTemplateSubstitutionPosition; + result.endOfLineState = EndOfLineState.InTemplateSubstitutionPosition; } } } - function addResult(length: number, classification: TokenClass): void { - if (length > 0) { - // If this is the first classification we're adding to the list, then remove any - // offset we have if we were continuing a construct from the previous line. - if (result.entries.length === 0) { - length -= offset; - } + function addResult(start: number, end: number, classification: ClassificationType): void { + if (classification === ClassificationType.whiteSpace) { + // Don't bother with whitespace classifications. They're not needed. + return; + } - result.entries.push({ length: length, classification: classification }); + if (start === 0 && offset > 0) { + // We're classifying the first token, and this was a case where we prepended + // text. We should consider the start of this token to be at the start of + // the original text. + start += offset; + } + + // All our tokens are in relation to the augmented text. Move them back to be + // relative to the original text. + start -= offset; + end -= offset; + let length = end - start; + + if (length > 0) { + result.spans.push(start); + result.spans.push(length); + result.spans.push(classification); } } } @@ -6864,41 +7021,44 @@ module ts { return token >= SyntaxKind.FirstKeyword && token <= SyntaxKind.LastKeyword; } - function classFromKind(token: SyntaxKind) { + function classFromKind(token: SyntaxKind): ClassificationType { if (isKeyword(token)) { - return TokenClass.Keyword; + return ClassificationType.keyword; } else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { - return TokenClass.Operator; + return ClassificationType.operator; } else if (token >= SyntaxKind.FirstPunctuation && token <= SyntaxKind.LastPunctuation) { - return TokenClass.Punctuation; + return ClassificationType.punctuation; } switch (token) { case SyntaxKind.NumericLiteral: - return TokenClass.NumberLiteral; + return ClassificationType.numericLiteral; case SyntaxKind.StringLiteral: - return TokenClass.StringLiteral; + return ClassificationType.stringLiteral; case SyntaxKind.RegularExpressionLiteral: - return TokenClass.RegExpLiteral; + return ClassificationType.regularExpressionLiteral; case SyntaxKind.ConflictMarkerTrivia: case SyntaxKind.MultiLineCommentTrivia: case SyntaxKind.SingleLineCommentTrivia: - return TokenClass.Comment; + return ClassificationType.comment; case SyntaxKind.WhitespaceTrivia: case SyntaxKind.NewLineTrivia: - return TokenClass.Whitespace; + return ClassificationType.whiteSpace; case SyntaxKind.Identifier: default: if (isTemplateLiteralKind(token)) { - return TokenClass.StringLiteral; + return ClassificationType.stringLiteral; } - return TokenClass.Identifier; + return ClassificationType.identifier; } } - return { getClassificationsForLine }; + return { + getClassificationsForLine, + getEncodedLexicalClassifications + }; } /// getDefaultLibraryFilePath diff --git a/src/services/shims.ts b/src/services/shims.ts index 786e3da66d4..906b8b59d3c 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -99,6 +99,8 @@ module ts { getSyntacticClassifications(fileName: string, start: number, length: number): string; getSemanticClassifications(fileName: string, start: number, length: number): string; + getEncodedSyntacticClassifications(fileName: string, start: number, length: number): string; + getEncodedSemanticClassifications(fileName: string, start: number, length: number): string; getCompletionsAtPosition(fileName: string, position: number): string; getCompletionEntryDetails(fileName: string, position: number, entryName: string): string; @@ -197,6 +199,7 @@ module ts { } export interface ClassifierShim extends Shim { + getEncodedLexicalClassifications(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string; getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string; } @@ -207,7 +210,9 @@ module ts { } function logInternalError(logger: Logger, err: Error) { - logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message); + if (logger) { + logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message); + } } class ScriptSnapshotShimAdapter implements IScriptSnapshot { @@ -329,25 +334,32 @@ module ts { } } - function simpleForwardCall(logger: Logger, actionDescription: string, action: () => any): any { - 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) + "'"); + function simpleForwardCall(logger: Logger, actionDescription: string, action: () => any, noPerfLogging: boolean): any { + if (!noPerfLogging) { + logger.log(actionDescription); + var start = Date.now(); } + + var result = action(); + + if (!noPerfLogging) { + 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: Logger, actionDescription: string, action: () => any): string { + function forwardJSONCall(logger: Logger, actionDescription: string, action: () => any, noPerfLogging: boolean): string { try { - var result = simpleForwardCall(logger, actionDescription, action); + var result = simpleForwardCall(logger, actionDescription, action, noPerfLogging); return JSON.stringify({ result: result }); } catch (err) { @@ -395,7 +407,7 @@ module ts { } public forwardJSONCall(actionDescription: string, action: () => any): string { - return forwardJSONCall(this.logger, actionDescription, action); + return forwardJSONCall(this.logger, actionDescription, action, /*noPerfLogging:*/ false); } /// DISPOSE @@ -465,6 +477,26 @@ module ts { }); } + public getEncodedSyntacticClassifications(fileName: string, start: number, length: number): string { + return this.forwardJSONCall( + "getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", + () => { + // directly serialize the spans out to a string. This is much faster to decode + // on the managed side versus a full JSON array. + return convertClassifications(this.languageService.getEncodedSyntacticClassifications(fileName, createTextSpan(start, length))); + }); + } + + public getEncodedSemanticClassifications(fileName: string, start: number, length: number): string { + return this.forwardJSONCall( + "getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", + () => { + // directly serialize the spans out to a string. This is much faster to decode + // on the managed side versus a full JSON array. + return convertClassifications(this.languageService.getEncodedSemanticClassifications(fileName, createTextSpan(start, length))); + }); + } + private getNewLine(): string { return this.host.getNewLine ? this.host.getNewLine() : "\r\n"; } @@ -758,14 +790,24 @@ module ts { } } + function convertClassifications(classifications: Classifications): { spans: string, endOfLineState: EndOfLineState } { + return { spans: classifications.spans.join(","), endOfLineState: classifications.endOfLineState }; + } + class ClassifierShimObject extends ShimBase implements ClassifierShim { public classifier: Classifier; - constructor(factory: ShimFactory) { + constructor(factory: ShimFactory, private logger: Logger) { super(factory); this.classifier = createClassifier(); } + public getEncodedLexicalClassifications(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string { + return forwardJSONCall(this.logger, "getEncodedLexicalClassifications", + () => convertClassifications(this.classifier.getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent)), + /*noPerfLogging:*/ true); + } + /// COLORIZATION public getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): string { var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics); @@ -787,7 +829,7 @@ module ts { } private forwardJSONCall(actionDescription: string, action: () => any): any { - return forwardJSONCall(this.logger, actionDescription, action); + return forwardJSONCall(this.logger, actionDescription, action, /*noPerfLogging:*/ false); } public getPreProcessedFileInfo(fileName: string, sourceTextSnapshot: IScriptSnapshot): string { @@ -880,7 +922,7 @@ module ts { public createClassifierShim(logger: Logger): ClassifierShim { try { - return new ClassifierShimObject(this); + return new ClassifierShimObject(this, logger); } catch (err) { logInternalError(logger, err); diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 5e1460bbdcd..f2074d43ec9 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -200,7 +200,7 @@ module ts { function nodeEndsWith(n: Node, expectedLastToken: SyntaxKind, sourceFile: SourceFile): boolean { let children = n.getChildren(sourceFile); if (children.length) { - let last = children[children.length - 1]; + let last = lastOrUndefined(children); if (last.kind === expectedLastToken) { return true; } diff --git a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js index bfa243937d6..ec30d5b4dc7 100644 --- a/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js +++ b/tests/baselines/reference/ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js @@ -21,7 +21,7 @@ module A { //// [ExportClassWithAccessibleTypesInTypeParameterConstraintsClassHeritageListMemberTypeAnnotations.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js index 71a43788c55..4d296bf9ea5 100644 --- a/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js +++ b/tests/baselines/reference/ExportClassWithInaccessibleTypeInTypeParameterConstraint.js @@ -25,7 +25,7 @@ module A { //// [ExportClassWithInaccessibleTypeInTypeParameterConstraint.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/accessOverriddenBaseClassMember1.js b/tests/baselines/reference/accessOverriddenBaseClassMember1.js index b6817ed7621..f6d3f29f1ab 100644 --- a/tests/baselines/reference/accessOverriddenBaseClassMember1.js +++ b/tests/baselines/reference/accessOverriddenBaseClassMember1.js @@ -16,7 +16,7 @@ class ColoredPoint extends Point { //// [accessOverriddenBaseClassMember1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; 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 9aa7ce2f408..8b75e27031a 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_inference.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_inference.js @@ -25,7 +25,7 @@ class LanguageSpec_section_4_5_inference { } //// [accessors_spec_section-4.5_inference.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js index 485aedc971d..06c8b55e23d 100644 --- a/tests/baselines/reference/aliasUsageInAccessorsOfClass.js +++ b/tests/baselines/reference/aliasUsageInAccessorsOfClass.js @@ -35,7 +35,7 @@ var Model = (function () { })(); exports.Model = Model; //// [aliasUsage1_moduleA.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/aliasUsageInArray.js b/tests/baselines/reference/aliasUsageInArray.js index 5712abf3443..e5d44320c7d 100644 --- a/tests/baselines/reference/aliasUsageInArray.js +++ b/tests/baselines/reference/aliasUsageInArray.js @@ -29,7 +29,7 @@ var Model = (function () { })(); exports.Model = Model; //// [aliasUsageInArray_moduleA.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/aliasUsageInFunctionExpression.js b/tests/baselines/reference/aliasUsageInFunctionExpression.js index 661c8fd91e7..b7b95661ac8 100644 --- a/tests/baselines/reference/aliasUsageInFunctionExpression.js +++ b/tests/baselines/reference/aliasUsageInFunctionExpression.js @@ -28,7 +28,7 @@ var Model = (function () { })(); exports.Model = Model; //// [aliasUsageInFunctionExpression_moduleA.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/aliasUsageInGenericFunction.js b/tests/baselines/reference/aliasUsageInGenericFunction.js index 1070036adea..856e6ddb43e 100644 --- a/tests/baselines/reference/aliasUsageInGenericFunction.js +++ b/tests/baselines/reference/aliasUsageInGenericFunction.js @@ -32,7 +32,7 @@ var Model = (function () { })(); exports.Model = Model; //// [aliasUsageInGenericFunction_moduleA.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/aliasUsageInIndexerOfClass.js b/tests/baselines/reference/aliasUsageInIndexerOfClass.js index 7b2907681e0..e05f5e4f5cd 100644 --- a/tests/baselines/reference/aliasUsageInIndexerOfClass.js +++ b/tests/baselines/reference/aliasUsageInIndexerOfClass.js @@ -34,7 +34,7 @@ var Model = (function () { })(); exports.Model = Model; //// [aliasUsageInIndexerOfClass_moduleA.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/aliasUsageInObjectLiteral.js b/tests/baselines/reference/aliasUsageInObjectLiteral.js index 50ccfaf944d..cc4b8273e84 100644 --- a/tests/baselines/reference/aliasUsageInObjectLiteral.js +++ b/tests/baselines/reference/aliasUsageInObjectLiteral.js @@ -29,7 +29,7 @@ var Model = (function () { })(); exports.Model = Model; //// [aliasUsageInObjectLiteral_moduleA.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/aliasUsageInOrExpression.js b/tests/baselines/reference/aliasUsageInOrExpression.js index 07a382ebca1..f382ee2f617 100644 --- a/tests/baselines/reference/aliasUsageInOrExpression.js +++ b/tests/baselines/reference/aliasUsageInOrExpression.js @@ -32,7 +32,7 @@ var Model = (function () { })(); exports.Model = Model; //// [aliasUsageInOrExpression_moduleA.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js index 7161d065528..39ff58a5322 100644 --- a/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js +++ b/tests/baselines/reference/aliasUsageInTypeArgumentOfExtendsClause.js @@ -32,7 +32,7 @@ var Model = (function () { })(); exports.Model = Model; //// [aliasUsageInTypeArgumentOfExtendsClause_moduleA.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; @@ -48,7 +48,7 @@ var VisualizationModel = (function (_super) { })(Backbone.Model); exports.VisualizationModel = VisualizationModel; //// [aliasUsageInTypeArgumentOfExtendsClause_main.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/aliasUsageInVarAssignment.js b/tests/baselines/reference/aliasUsageInVarAssignment.js index 31d976f6ef2..2de34f00566 100644 --- a/tests/baselines/reference/aliasUsageInVarAssignment.js +++ b/tests/baselines/reference/aliasUsageInVarAssignment.js @@ -28,7 +28,7 @@ var Model = (function () { })(); exports.Model = Model; //// [aliasUsageInVarAssignment_moduleA.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/ambiguousOverloadResolution.js b/tests/baselines/reference/ambiguousOverloadResolution.js index 2d817ba1385..8c2ceb055c7 100644 --- a/tests/baselines/reference/ambiguousOverloadResolution.js +++ b/tests/baselines/reference/ambiguousOverloadResolution.js @@ -9,7 +9,7 @@ var x: B; var t: number = f(x, x); // Not an error //// [ambiguousOverloadResolution.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/apparentTypeSubtyping.js b/tests/baselines/reference/apparentTypeSubtyping.js index fd01d0df2ba..087a91fb02c 100644 --- a/tests/baselines/reference/apparentTypeSubtyping.js +++ b/tests/baselines/reference/apparentTypeSubtyping.js @@ -24,7 +24,7 @@ class Derived2 extends Base2 { // error because of the prototy //// [apparentTypeSubtyping.js] // subtype checks use the apparent type of the target type // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/apparentTypeSupertype.js b/tests/baselines/reference/apparentTypeSupertype.js index 75703fbd06b..0b4462bebe7 100644 --- a/tests/baselines/reference/apparentTypeSupertype.js +++ b/tests/baselines/reference/apparentTypeSupertype.js @@ -14,7 +14,7 @@ class Derived extends Base { // error //// [apparentTypeSupertype.js] // subtype checks use the apparent type of the target type // S is a subtype of a type T, and T is a supertype of S, if one of the following is true, where S' denotes the apparent type (section 3.8.1) of S: -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/arrayAssignmentTest1.js b/tests/baselines/reference/arrayAssignmentTest1.js index 0abfa889bed..43aad9921bb 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.js +++ b/tests/baselines/reference/arrayAssignmentTest1.js @@ -86,7 +86,7 @@ arr_any = c3; // should be an error - is arr_any = i1; // should be an error - is //// [arrayAssignmentTest1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/arrayAssignmentTest2.js b/tests/baselines/reference/arrayAssignmentTest2.js index 977862866ed..5aeb74114bc 100644 --- a/tests/baselines/reference/arrayAssignmentTest2.js +++ b/tests/baselines/reference/arrayAssignmentTest2.js @@ -60,7 +60,7 @@ arr_any = i1; // should be an error - is //// [arrayAssignmentTest2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/arrayBestCommonTypes.js b/tests/baselines/reference/arrayBestCommonTypes.js index f8e158e5b02..8d2445e2739 100644 --- a/tests/baselines/reference/arrayBestCommonTypes.js +++ b/tests/baselines/reference/arrayBestCommonTypes.js @@ -108,7 +108,7 @@ module NonEmptyTypes { //// [arrayBestCommonTypes.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/arrayLiteralTypeInference.js b/tests/baselines/reference/arrayLiteralTypeInference.js index 28aa143fa61..dfd662bbf1c 100644 --- a/tests/baselines/reference/arrayLiteralTypeInference.js +++ b/tests/baselines/reference/arrayLiteralTypeInference.js @@ -52,7 +52,7 @@ var z3: { id: number }[] = //// [arrayLiteralTypeInference.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/arrayLiterals.js b/tests/baselines/reference/arrayLiterals.js index 16e5ec7eee4..cb1d25258f2 100644 --- a/tests/baselines/reference/arrayLiterals.js +++ b/tests/baselines/reference/arrayLiterals.js @@ -38,7 +38,7 @@ var context4: Base[] = [new Derived1(), new Derived1()]; //// [arrayLiterals.js] // Empty array literal with no contextual type has type Undefined[] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js index f15215a88eb..b3c0a0f7877 100644 --- a/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js +++ b/tests/baselines/reference/arrayLiteralsWithRecursiveGenerics.js @@ -26,7 +26,7 @@ var myDerivedList: DerivedList; var as = [list, myDerivedList]; // List[] //// [arrayLiteralsWithRecursiveGenerics.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/arrowFunctionContexts.js b/tests/baselines/reference/arrowFunctionContexts.js index a10e3955ae0..f4a11fb47ae 100644 --- a/tests/baselines/reference/arrowFunctionContexts.js +++ b/tests/baselines/reference/arrowFunctionContexts.js @@ -97,7 +97,7 @@ var asserted2: any; //// [arrowFunctionContexts.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js index 8d33412bb4b..1ad82ca531b 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures3.js @@ -101,7 +101,7 @@ b18 = a18; // ok //// [assignmentCompatWithCallSignatures3.js] // these are all permitted with the current rules, since we do not do contextual signature instantiation -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js index 926d8eb13e1..387395525ad 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures4.js @@ -100,7 +100,7 @@ module Errors { //// [assignmentCompatWithCallSignatures4.js] // These are mostly permitted with the current loose rules. All ok unless otherwise noted. -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js index afe3166ccb5..2e3790cd529 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures5.js @@ -67,7 +67,7 @@ b18 = a18; // ok //// [assignmentCompatWithCallSignatures5.js] // checking assignment compat for function types. No errors in this file -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js index 0db1f1f79fb..a29a607f9ef 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures6.js @@ -44,7 +44,7 @@ b16 = x.a16; //// [assignmentCompatWithCallSignatures6.js] // checking assignment compatibility relations for function types. All valid -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js index 1926f0e0684..32176e764e9 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures3.js @@ -101,7 +101,7 @@ b18 = a18; // ok //// [assignmentCompatWithConstructSignatures3.js] // checking assignment compatibility relations for function types. All of these are valid. -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js index 9e12f0f360d..21bace1645c 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures4.js @@ -100,7 +100,7 @@ module Errors { //// [assignmentCompatWithConstructSignatures4.js] // checking assignment compatibility relations for function types. -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js index 1b26d813d45..76be317e95a 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures5.js @@ -67,7 +67,7 @@ b18 = a18; // ok //// [assignmentCompatWithConstructSignatures5.js] // checking assignment compat for function types. All valid -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js index ccca809c281..dc1d0dd2dee 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures6.js @@ -44,7 +44,7 @@ b16 = x.a16; //// [assignmentCompatWithConstructSignatures6.js] // checking assignment compatibility relations for function types. All valid. -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js index a139787130e..6044c40b3cc 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer.js @@ -45,7 +45,7 @@ module Generics { //// [assignmentCompatWithNumericIndexer.js] // Derived type indexer must be subtype of base type indexer -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js index 8aa8dca511e..b3c073ea0b7 100644 --- a/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js +++ b/tests/baselines/reference/assignmentCompatWithNumericIndexer3.js @@ -42,7 +42,7 @@ module Generics { //// [assignmentCompatWithNumericIndexer3.js] // Derived type indexer must be subtype of base type indexer -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js index 0d535cbb20d..229525a91f0 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembers4.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembers4.js @@ -93,7 +93,7 @@ module WithBase { //// [assignmentCompatWithObjectMembers4.js] // members N and M of types S and T have the same name, same accessibility, same optionality, and N is not assignable M -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js index 5525b623ecc..629f7bf5113 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality.js @@ -90,7 +90,7 @@ module SourceHasOptional { //// [assignmentCompatWithObjectMembersOptionality.js] // Derived member is not optional but base member is, should be ok -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js index 8859a4c9ab0..4ffec4aa7dd 100644 --- a/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js +++ b/tests/baselines/reference/assignmentCompatWithObjectMembersOptionality2.js @@ -92,7 +92,7 @@ module SourceHasOptional { //// [assignmentCompatWithObjectMembersOptionality2.js] // M is optional and S contains no property with the same name as M // N is optional and T contains no property with the same name as N -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/assignmentCompatWithStringIndexer.js b/tests/baselines/reference/assignmentCompatWithStringIndexer.js index b54c75a1bec..99457453af4 100644 --- a/tests/baselines/reference/assignmentCompatWithStringIndexer.js +++ b/tests/baselines/reference/assignmentCompatWithStringIndexer.js @@ -55,7 +55,7 @@ module Generics { //// [assignmentCompatWithStringIndexer.js] // index signatures must be compatible in assignments -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/assignmentLHSIsValue.js b/tests/baselines/reference/assignmentLHSIsValue.js index 4b17f855171..d5276e71a9b 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.js +++ b/tests/baselines/reference/assignmentLHSIsValue.js @@ -71,7 +71,7 @@ foo() = value; (foo()) = value; //// [assignmentLHSIsValue.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/autolift4.js b/tests/baselines/reference/autolift4.js index 6a903b890d8..5986ef4a3f5 100644 --- a/tests/baselines/reference/autolift4.js +++ b/tests/baselines/reference/autolift4.js @@ -24,7 +24,7 @@ class Point3D extends Point { //// [autolift4.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/baseCheck.js b/tests/baselines/reference/baseCheck.js index 2ebefcbade2..4e7db8e6a5b 100644 --- a/tests/baselines/reference/baseCheck.js +++ b/tests/baselines/reference/baseCheck.js @@ -30,7 +30,7 @@ function f() { //// [baseCheck.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/baseIndexSignatureResolution.js b/tests/baselines/reference/baseIndexSignatureResolution.js index 4720e92b969..85b76221e3c 100644 --- a/tests/baselines/reference/baseIndexSignatureResolution.js +++ b/tests/baselines/reference/baseIndexSignatureResolution.js @@ -25,7 +25,7 @@ var z: Derived = b.foo(); */ //// [baseIndexSignatureResolution.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/baseTypeOrderChecking.js b/tests/baselines/reference/baseTypeOrderChecking.js index b206ef2b911..754d90e21ea 100644 --- a/tests/baselines/reference/baseTypeOrderChecking.js +++ b/tests/baselines/reference/baseTypeOrderChecking.js @@ -37,7 +37,7 @@ class Class4 extends Class3 //// [baseTypeOrderChecking.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js index 97180f42133..aaa93710339 100644 --- a/tests/baselines/reference/baseTypeWrappingInstantiationChain.js +++ b/tests/baselines/reference/baseTypeWrappingInstantiationChain.js @@ -27,7 +27,7 @@ class Wrapper { } //// [baseTypeWrappingInstantiationChain.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/bases.js b/tests/baselines/reference/bases.js index 32d65d1a248..5687e9e0fe1 100644 --- a/tests/baselines/reference/bases.js +++ b/tests/baselines/reference/bases.js @@ -21,7 +21,7 @@ new C().y; //// [bases.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js index 49bc535dbfe..e56e530ad64 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions.js @@ -29,7 +29,7 @@ function foo5(t: T, u: U): Object { //// [bestCommonTypeOfConditionalExpressions.js] // conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) // no errors expected here -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js index 49659de94d4..fb3c15a8fba 100644 --- a/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js +++ b/tests/baselines/reference/bestCommonTypeOfConditionalExpressions2.js @@ -27,7 +27,7 @@ function foo3(t: T, u: U) { //// [bestCommonTypeOfConditionalExpressions2.js] // conditional expressions return the best common type of the branches plus contextual type (using the first candidate if multiple BCTs exist) // these are errors -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/bestCommonTypeOfTuple2.js b/tests/baselines/reference/bestCommonTypeOfTuple2.js index f9183f41348..5642df5570c 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple2.js +++ b/tests/baselines/reference/bestCommonTypeOfTuple2.js @@ -23,7 +23,7 @@ var e51 = t5[2]; // {} //// [bestCommonTypeOfTuple2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js index 8bb4cb665a2..685e33acb6b 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance2.js @@ -71,7 +71,7 @@ interface I extends A { //// [callSignatureAssignabilityInInheritance2.js] // checking subtype relations for function types as it relates to contextual signature instantiation -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js index 31cdc8980fd..135c0c056ae 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance3.js @@ -116,7 +116,7 @@ module Errors { //// [callSignatureAssignabilityInInheritance3.js] // checking subtype relations for function types as it relates to contextual signature instantiation // error cases -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js index 2f9cbc2a9e7..c578a49ee55 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance4.js @@ -51,7 +51,7 @@ interface I extends A { //// [callSignatureAssignabilityInInheritance4.js] // checking subtype relations for function types as it relates to contextual signature instantiation -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js index 0cb4830188a..74987308ef7 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance5.js @@ -51,7 +51,7 @@ interface I extends B { //// [callSignatureAssignabilityInInheritance5.js] // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithCallSignatures2 just with an extra level of indirection in the inheritance chain -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js index dd471f09223..aa2e9787bd1 100644 --- a/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/callSignatureAssignabilityInInheritance6.js @@ -54,7 +54,7 @@ interface I9 extends A { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithCallSignatures4 but using class type parameters instead of generic signatures // all are errors -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/callWithSpread.js b/tests/baselines/reference/callWithSpread.js index d676c0f2a33..c9cd5d2adce 100644 --- a/tests/baselines/reference/callWithSpread.js +++ b/tests/baselines/reference/callWithSpread.js @@ -54,7 +54,7 @@ var c = new C(1, 2, ...a); //// [callWithSpread.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/callWithSpreadES6.symbols b/tests/baselines/reference/callWithSpreadES6.symbols index 0dd186210b2..94e0b94b002 100644 --- a/tests/baselines/reference/callWithSpreadES6.symbols +++ b/tests/baselines/reference/callWithSpreadES6.symbols @@ -94,7 +94,7 @@ xa[1].foo(1, 2, ...a, "abc"); >a : Symbol(a, Decl(callWithSpreadES6.ts, 8, 3)) (xa[1].foo)(...[1, 2, "abc"]); ->Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11), Decl(lib.d.ts, 1325, 1)) +>Function : Symbol(Function, Decl(lib.d.ts, 223, 38), Decl(lib.d.ts, 269, 11), Decl(lib.d.ts, 1355, 1)) >xa[1].foo : Symbol(X.foo, Decl(callWithSpreadES6.ts, 1, 13)) >xa : Symbol(xa, Decl(callWithSpreadES6.ts, 11, 3)) >foo : Symbol(X.foo, Decl(callWithSpreadES6.ts, 1, 13)) diff --git a/tests/baselines/reference/captureThisInSuperCall.js b/tests/baselines/reference/captureThisInSuperCall.js index 7200fabd8c4..27c80e2991d 100644 --- a/tests/baselines/reference/captureThisInSuperCall.js +++ b/tests/baselines/reference/captureThisInSuperCall.js @@ -9,7 +9,7 @@ class B extends A { } //// [captureThisInSuperCall.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/castingTuple.js b/tests/baselines/reference/castingTuple.js index 2c41d81cd6a..8b1005d4487 100644 --- a/tests/baselines/reference/castingTuple.js +++ b/tests/baselines/reference/castingTuple.js @@ -33,7 +33,7 @@ t4[2] = 10; //// [castingTuple.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/chainedAssignment3.js b/tests/baselines/reference/chainedAssignment3.js index 11b9ceb3a07..022668ba7cf 100644 --- a/tests/baselines/reference/chainedAssignment3.js +++ b/tests/baselines/reference/chainedAssignment3.js @@ -23,7 +23,7 @@ a = b = new A(); //// [chainedAssignment3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js index 70456b9e9d1..494f0bc1b5d 100644 --- a/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js +++ b/tests/baselines/reference/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js @@ -20,7 +20,7 @@ class C extends B { (new Chain(new A)).then(a => new B).then(b => new C).then(c => new B).then(b => new A); //// [chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/checkForObjectTooStrict.js b/tests/baselines/reference/checkForObjectTooStrict.js index b134ff2a40a..bcdde6b3be1 100644 --- a/tests/baselines/reference/checkForObjectTooStrict.js +++ b/tests/baselines/reference/checkForObjectTooStrict.js @@ -32,7 +32,7 @@ class Baz extends Object { //// [checkForObjectTooStrict.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/circularImportAlias.js b/tests/baselines/reference/circularImportAlias.js index b1d435cc8ce..1a50a46221b 100644 --- a/tests/baselines/reference/circularImportAlias.js +++ b/tests/baselines/reference/circularImportAlias.js @@ -21,7 +21,7 @@ var c = new B.a.C(); //// [circularImportAlias.js] // expected no error -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classConstructorParametersAccessibility.js b/tests/baselines/reference/classConstructorParametersAccessibility.js index 03d56d94e58..5d715556ec1 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility.js @@ -27,7 +27,7 @@ class Derived extends C3 { //// [classConstructorParametersAccessibility.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classConstructorParametersAccessibility2.js b/tests/baselines/reference/classConstructorParametersAccessibility2.js index 1b16d13c82a..1d273e119ec 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility2.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility2.js @@ -27,7 +27,7 @@ class Derived extends C3 { //// [classConstructorParametersAccessibility2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classConstructorParametersAccessibility3.js b/tests/baselines/reference/classConstructorParametersAccessibility3.js index 9bd6c4bf7f5..43823bbb4d9 100644 --- a/tests/baselines/reference/classConstructorParametersAccessibility3.js +++ b/tests/baselines/reference/classConstructorParametersAccessibility3.js @@ -14,7 +14,7 @@ var d: Derived; d.p; // public, OK //// [classConstructorParametersAccessibility3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js index c2bd2f09cf2..7299b04720f 100644 --- a/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js +++ b/tests/baselines/reference/classDeclarationMergedInModuleWithContinuation.js @@ -12,7 +12,7 @@ module M { } //// [classDeclarationMergedInModuleWithContinuation.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js index a62d5b1532b..52474582315 100644 --- a/tests/baselines/reference/classDoesNotDependOnBaseTypes.js +++ b/tests/baselines/reference/classDoesNotDependOnBaseTypes.js @@ -13,7 +13,7 @@ class StringTreeCollectionBase { class StringTreeCollection extends StringTreeCollectionBase { } //// [classDoesNotDependOnBaseTypes.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classExpressionWithDecorator1.js b/tests/baselines/reference/classExpressionWithDecorator1.js index 754d6199115..4b1700df7af 100644 --- a/tests/baselines/reference/classExpressionWithDecorator1.js +++ b/tests/baselines/reference/classExpressionWithDecorator1.js @@ -2,7 +2,7 @@ var v = @decorate class C { static p = 1 }; //// [classExpressionWithDecorator1.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/classExtendingClass.js b/tests/baselines/reference/classExtendingClass.js index 130bf5818ee..b8e079e8ecb 100644 --- a/tests/baselines/reference/classExtendingClass.js +++ b/tests/baselines/reference/classExtendingClass.js @@ -32,7 +32,7 @@ var r7 = d2.thing(''); var r8 = D2.other(1); //// [classExtendingClass.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classExtendingPrimitive.js b/tests/baselines/reference/classExtendingPrimitive.js index 45e92dde5f8..b099ce763e8 100644 --- a/tests/baselines/reference/classExtendingPrimitive.js +++ b/tests/baselines/reference/classExtendingPrimitive.js @@ -16,7 +16,7 @@ class C8 extends E { } //// [classExtendingPrimitive.js] // classes cannot extend primitives -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classExtendingPrimitive2.js b/tests/baselines/reference/classExtendingPrimitive2.js index 4ac6b14121a..3dcff0b44b9 100644 --- a/tests/baselines/reference/classExtendingPrimitive2.js +++ b/tests/baselines/reference/classExtendingPrimitive2.js @@ -6,7 +6,7 @@ class C5a extends null { } //// [classExtendingPrimitive2.js] // classes cannot extend primitives -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classExtendingQualifiedName.js b/tests/baselines/reference/classExtendingQualifiedName.js index c6721909db7..0289797d1e3 100644 --- a/tests/baselines/reference/classExtendingQualifiedName.js +++ b/tests/baselines/reference/classExtendingQualifiedName.js @@ -8,7 +8,7 @@ module M { } //// [classExtendingQualifiedName.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classExtendingQualifiedName2.js b/tests/baselines/reference/classExtendingQualifiedName2.js index 9fc31a231ea..76065ccc577 100644 --- a/tests/baselines/reference/classExtendingQualifiedName2.js +++ b/tests/baselines/reference/classExtendingQualifiedName2.js @@ -8,7 +8,7 @@ module M { } //// [classExtendingQualifiedName2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js index 6d4a9a09b67..21e0326f741 100644 --- a/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js +++ b/tests/baselines/reference/classExtendsClauseClassMergedWithModuleNotReferingConstructor.js @@ -14,7 +14,7 @@ module Foo { } //// [classExtendsClauseClassMergedWithModuleNotReferingConstructor.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js b/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js index 03fcfa19a37..8dc3410a179 100644 --- a/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js +++ b/tests/baselines/reference/classExtendsClauseClassNotReferringConstructor.js @@ -7,7 +7,7 @@ module Foo { //// [classExtendsClauseClassNotReferringConstructor.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classExtendsEveryObjectType.js b/tests/baselines/reference/classExtendsEveryObjectType.js index 30966fedafc..afbb4dab714 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType.js +++ b/tests/baselines/reference/classExtendsEveryObjectType.js @@ -17,7 +17,7 @@ class C5 extends foo { } // error class C6 extends []{ } // error //// [classExtendsEveryObjectType.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classExtendsEveryObjectType2.js b/tests/baselines/reference/classExtendsEveryObjectType2.js index 37c0861f5ec..c41943072dd 100644 --- a/tests/baselines/reference/classExtendsEveryObjectType2.js +++ b/tests/baselines/reference/classExtendsEveryObjectType2.js @@ -4,7 +4,7 @@ class C2 extends { foo: string; } { } // error class C6 extends []{ } // error //// [classExtendsEveryObjectType2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classExtendsInterface.js b/tests/baselines/reference/classExtendsInterface.js index e40c9154e31..a3e596299fa 100644 --- a/tests/baselines/reference/classExtendsInterface.js +++ b/tests/baselines/reference/classExtendsInterface.js @@ -9,7 +9,7 @@ class B2 implements Comparable2 {} //// [classExtendsInterface.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classExtendsItself.js b/tests/baselines/reference/classExtendsItself.js index bb6b68f07d6..79a4226731f 100644 --- a/tests/baselines/reference/classExtendsItself.js +++ b/tests/baselines/reference/classExtendsItself.js @@ -6,7 +6,7 @@ class D extends D { } // error class E extends E { } // error //// [classExtendsItself.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classExtendsItselfIndirectly.js b/tests/baselines/reference/classExtendsItselfIndirectly.js index 11b697cff6b..eee52b877e3 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly.js @@ -12,7 +12,7 @@ class D2 extends C2 { bar: T; } class E2 extends D2 { baz: T; } //// [classExtendsItselfIndirectly.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classExtendsItselfIndirectly2.js b/tests/baselines/reference/classExtendsItselfIndirectly2.js index 129b2f51b36..02201425cba 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly2.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly2.js @@ -23,7 +23,7 @@ module O { } //// [classExtendsItselfIndirectly2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classExtendsItselfIndirectly3.js b/tests/baselines/reference/classExtendsItselfIndirectly3.js index 679525a40a6..bff6dd92bc9 100644 --- a/tests/baselines/reference/classExtendsItselfIndirectly3.js +++ b/tests/baselines/reference/classExtendsItselfIndirectly3.js @@ -19,7 +19,7 @@ class D2 extends C2 { bar: T; } class E2 extends D2 { baz: T; } //// [classExtendsItselfIndirectly_file1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; @@ -33,7 +33,7 @@ var C = (function (_super) { return C; })(E); // error //// [classExtendsItselfIndirectly_file2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; @@ -47,7 +47,7 @@ var D = (function (_super) { return D; })(C); //// [classExtendsItselfIndirectly_file3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; @@ -61,7 +61,7 @@ var E = (function (_super) { return E; })(D); //// [classExtendsItselfIndirectly_file4.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; @@ -75,7 +75,7 @@ var C2 = (function (_super) { return C2; })(E2); // error //// [classExtendsItselfIndirectly_file5.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; @@ -89,7 +89,7 @@ var D2 = (function (_super) { return D2; })(C2); //// [classExtendsItselfIndirectly_file6.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classExtendsMultipleBaseClasses.js b/tests/baselines/reference/classExtendsMultipleBaseClasses.js index 07d6450f405..7027e85450d 100644 --- a/tests/baselines/reference/classExtendsMultipleBaseClasses.js +++ b/tests/baselines/reference/classExtendsMultipleBaseClasses.js @@ -4,7 +4,7 @@ class B { } class C extends A,B { } //// [classExtendsMultipleBaseClasses.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classExtendsShadowedConstructorFunction.js b/tests/baselines/reference/classExtendsShadowedConstructorFunction.js index b7245b8095c..48f2e791139 100644 --- a/tests/baselines/reference/classExtendsShadowedConstructorFunction.js +++ b/tests/baselines/reference/classExtendsShadowedConstructorFunction.js @@ -9,7 +9,7 @@ module M { } //// [classExtendsShadowedConstructorFunction.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classExtendsValidConstructorFunction.js b/tests/baselines/reference/classExtendsValidConstructorFunction.js index c2f0f17e534..411bd3c2fba 100644 --- a/tests/baselines/reference/classExtendsValidConstructorFunction.js +++ b/tests/baselines/reference/classExtendsValidConstructorFunction.js @@ -6,7 +6,7 @@ var x = new foo(); // can be used as a constructor function class C extends foo { } // error, cannot extend it though //// [classExtendsValidConstructorFunction.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classHeritageWithTrailingSeparator.js b/tests/baselines/reference/classHeritageWithTrailingSeparator.js index 5c6470ffdfd..6d33f79a4d5 100644 --- a/tests/baselines/reference/classHeritageWithTrailingSeparator.js +++ b/tests/baselines/reference/classHeritageWithTrailingSeparator.js @@ -4,7 +4,7 @@ class D extends C, { } //// [classHeritageWithTrailingSeparator.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classImplementsClass2.js b/tests/baselines/reference/classImplementsClass2.js index bc4f6b6748c..49b73bfdb18 100644 --- a/tests/baselines/reference/classImplementsClass2.js +++ b/tests/baselines/reference/classImplementsClass2.js @@ -14,7 +14,7 @@ c = c2; c2 = c; //// [classImplementsClass2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classImplementsClass3.js b/tests/baselines/reference/classImplementsClass3.js index 450263d00c9..f8773b435bd 100644 --- a/tests/baselines/reference/classImplementsClass3.js +++ b/tests/baselines/reference/classImplementsClass3.js @@ -15,7 +15,7 @@ c = c2; c2 = c; //// [classImplementsClass3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classImplementsClass4.js b/tests/baselines/reference/classImplementsClass4.js index ac5c899bbbf..cf442b0ad24 100644 --- a/tests/baselines/reference/classImplementsClass4.js +++ b/tests/baselines/reference/classImplementsClass4.js @@ -17,7 +17,7 @@ c = c2; c2 = c; //// [classImplementsClass4.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classImplementsClass5.js b/tests/baselines/reference/classImplementsClass5.js index a0971904cc3..a648f6bd63f 100644 --- a/tests/baselines/reference/classImplementsClass5.js +++ b/tests/baselines/reference/classImplementsClass5.js @@ -18,7 +18,7 @@ c = c2; c2 = c; //// [classImplementsClass5.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classImplementsClass6.js b/tests/baselines/reference/classImplementsClass6.js index 931218e2bea..af6f0844d28 100644 --- a/tests/baselines/reference/classImplementsClass6.js +++ b/tests/baselines/reference/classImplementsClass6.js @@ -22,7 +22,7 @@ c.bar(); // error c2.bar(); // should error //// [classImplementsClass6.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classIndexer3.js b/tests/baselines/reference/classIndexer3.js index ca5c5913d75..9f630b96306 100644 --- a/tests/baselines/reference/classIndexer3.js +++ b/tests/baselines/reference/classIndexer3.js @@ -11,7 +11,7 @@ class D123 extends C123 { } //// [classIndexer3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classInheritence.js b/tests/baselines/reference/classInheritence.js index 3378aea91c0..374248c3a2c 100644 --- a/tests/baselines/reference/classInheritence.js +++ b/tests/baselines/reference/classInheritence.js @@ -3,7 +3,7 @@ class B extends A { } class A extends A { } //// [classInheritence.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classIsSubtypeOfBaseType.js b/tests/baselines/reference/classIsSubtypeOfBaseType.js index db9ae2adc28..a33bf5499be 100644 --- a/tests/baselines/reference/classIsSubtypeOfBaseType.js +++ b/tests/baselines/reference/classIsSubtypeOfBaseType.js @@ -16,7 +16,7 @@ class Derived2 extends Base<{ bar: string; }> { } //// [classIsSubtypeOfBaseType.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classOrder2.js b/tests/baselines/reference/classOrder2.js index 4bc1c3f790c..8eed39bddeb 100644 --- a/tests/baselines/reference/classOrder2.js +++ b/tests/baselines/reference/classOrder2.js @@ -20,7 +20,7 @@ a.foo(); //// [classOrder2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classOrderBug.js b/tests/baselines/reference/classOrderBug.js index ddf33831873..ae50152d608 100644 --- a/tests/baselines/reference/classOrderBug.js +++ b/tests/baselines/reference/classOrderBug.js @@ -16,7 +16,7 @@ class foo extends baz {} //// [classOrderBug.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classSideInheritance1.js b/tests/baselines/reference/classSideInheritance1.js index 74df624a78c..66cbc0c25c7 100644 --- a/tests/baselines/reference/classSideInheritance1.js +++ b/tests/baselines/reference/classSideInheritance1.js @@ -16,7 +16,7 @@ A.bar(); // valid C2.bar(); // valid //// [classSideInheritance1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classSideInheritance2.js b/tests/baselines/reference/classSideInheritance2.js index f848226bb0e..e09301fe85f 100644 --- a/tests/baselines/reference/classSideInheritance2.js +++ b/tests/baselines/reference/classSideInheritance2.js @@ -21,7 +21,7 @@ class TextBase implements IText { } //// [classSideInheritance2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classSideInheritance3.js b/tests/baselines/reference/classSideInheritance3.js index 9f90fad487b..a69b6ff0345 100644 --- a/tests/baselines/reference/classSideInheritance3.js +++ b/tests/baselines/reference/classSideInheritance3.js @@ -19,7 +19,7 @@ var r2: new (x: string) => A = B; // error var r3: typeof A = C; // ok //// [classSideInheritance3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classUpdateTests.js b/tests/baselines/reference/classUpdateTests.js index 351ddac52e8..90149d88d9d 100644 --- a/tests/baselines/reference/classUpdateTests.js +++ b/tests/baselines/reference/classUpdateTests.js @@ -114,7 +114,7 @@ class R { } //// [classUpdateTests.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classWithBaseClassButNoConstructor.js b/tests/baselines/reference/classWithBaseClassButNoConstructor.js index 2c881a29a7c..f1a10b317a1 100644 --- a/tests/baselines/reference/classWithBaseClassButNoConstructor.js +++ b/tests/baselines/reference/classWithBaseClassButNoConstructor.js @@ -41,7 +41,7 @@ var d5 = new D(); // error var d6 = new D(1); // ok //// [classWithBaseClassButNoConstructor.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classWithConstructors.js b/tests/baselines/reference/classWithConstructors.js index 10afc3a9f1b..467738e0966 100644 --- a/tests/baselines/reference/classWithConstructors.js +++ b/tests/baselines/reference/classWithConstructors.js @@ -50,7 +50,7 @@ module Generics { } //// [classWithConstructors.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classWithProtectedProperty.js b/tests/baselines/reference/classWithProtectedProperty.js index 4de87229ad0..7d86e1c7229 100644 --- a/tests/baselines/reference/classWithProtectedProperty.js +++ b/tests/baselines/reference/classWithProtectedProperty.js @@ -29,7 +29,7 @@ class D extends C { //// [classWithProtectedProperty.js] // accessing any protected outside the class is an error -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classWithStaticMembers.js b/tests/baselines/reference/classWithStaticMembers.js index 36b8bd0af64..edad6c22c70 100644 --- a/tests/baselines/reference/classWithStaticMembers.js +++ b/tests/baselines/reference/classWithStaticMembers.js @@ -20,7 +20,7 @@ var r2 = r.x; var r3 = r.foo; //// [classWithStaticMembers.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/classdecl.js b/tests/baselines/reference/classdecl.js index e9253b61cac..127e0e9f32b 100644 --- a/tests/baselines/reference/classdecl.js +++ b/tests/baselines/reference/classdecl.js @@ -94,7 +94,7 @@ class e { } //// [classdecl.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/clodulesDerivedClasses.js b/tests/baselines/reference/clodulesDerivedClasses.js index b4b31e59d3e..c37b9f0e96a 100644 --- a/tests/baselines/reference/clodulesDerivedClasses.js +++ b/tests/baselines/reference/clodulesDerivedClasses.js @@ -23,7 +23,7 @@ module Path.Utils { //// [clodulesDerivedClasses.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js index 92ddebd156c..a58f4aa9f94 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.js @@ -40,7 +40,7 @@ class c extends Foo { } //// [collisionSuperAndLocalFunctionInAccessors.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js index 0d6f15cc374..b89a8753acd 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.js @@ -25,7 +25,7 @@ class c extends Foo { } //// [collisionSuperAndLocalFunctionInConstructor.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js index 4e116deb802..efa9c1d9f03 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.js @@ -29,7 +29,7 @@ class c extends Foo { } //// [collisionSuperAndLocalFunctionInMethod.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js index 45a4c704b52..228b7243d4f 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.js @@ -19,7 +19,7 @@ class b extends Foo { } //// [collisionSuperAndLocalFunctionInProperty.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js index 5a8e54a6c3d..d2392f4df38 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInAccessors.js @@ -33,7 +33,7 @@ class c extends Foo { } //// [collisionSuperAndLocalVarInAccessors.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js b/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js index 2cd7549c78c..dc3210c1f8e 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInConstructor.js @@ -21,7 +21,7 @@ class c extends Foo { } //// [collisionSuperAndLocalVarInConstructor.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js b/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js index e7b374e5a61..7a6ee0c45c5 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInMethod.js @@ -19,7 +19,7 @@ class c extends Foo { } //// [collisionSuperAndLocalVarInMethod.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js b/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js index 55777f920a2..f678c7cf6ca 100644 --- a/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js +++ b/tests/baselines/reference/collisionSuperAndLocalVarInProperty.js @@ -18,7 +18,7 @@ class b extends Foo { } //// [collisionSuperAndLocalVarInProperty.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/collisionSuperAndNameResolution.js b/tests/baselines/reference/collisionSuperAndNameResolution.js index 763e151247e..540a2b659d9 100644 --- a/tests/baselines/reference/collisionSuperAndNameResolution.js +++ b/tests/baselines/reference/collisionSuperAndNameResolution.js @@ -12,7 +12,7 @@ class Foo extends base { } //// [collisionSuperAndNameResolution.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/collisionSuperAndParameter.js b/tests/baselines/reference/collisionSuperAndParameter.js index be9e0ce3f68..ac8947e00d3 100644 --- a/tests/baselines/reference/collisionSuperAndParameter.js +++ b/tests/baselines/reference/collisionSuperAndParameter.js @@ -63,7 +63,7 @@ class Foo4 extends Foo { } //// [collisionSuperAndParameter.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/collisionSuperAndParameter1.js b/tests/baselines/reference/collisionSuperAndParameter1.js index 11a4206624a..b072667396d 100644 --- a/tests/baselines/reference/collisionSuperAndParameter1.js +++ b/tests/baselines/reference/collisionSuperAndParameter1.js @@ -10,7 +10,7 @@ class Foo2 extends Foo { } //// [collisionSuperAndParameter1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js b/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js index fd523d010fb..e96ae7d8928 100644 --- a/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js +++ b/tests/baselines/reference/collisionSuperAndPropertyNameAsConstuctorParameter.js @@ -31,7 +31,7 @@ class b4 extends a { } //// [collisionSuperAndPropertyNameAsConstuctorParameter.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js b/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js index d502fc5c03a..dbf36111dfb 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarWithSuperExperssion.js @@ -19,7 +19,7 @@ class b2 extends a { } //// [collisionThisExpressionAndLocalVarWithSuperExperssion.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/commentsInheritance.js b/tests/baselines/reference/commentsInheritance.js index 06cd5840d68..4fe5a30cb8b 100644 --- a/tests/baselines/reference/commentsInheritance.js +++ b/tests/baselines/reference/commentsInheritance.js @@ -152,7 +152,7 @@ i2_i = i3_i; //// [commentsInheritance.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js index 4bdb1e38ba7..aebb486a1b5 100644 --- a/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js +++ b/tests/baselines/reference/comparisonOperatorWithIdenticalObjects.js @@ -195,7 +195,7 @@ var r8b6 = b5 !== a5; var r8b7 = b6 !== a6; //// [comparisonOperatorWithIdenticalObjects.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js index 10250785642..3d7e96be633 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js @@ -169,7 +169,7 @@ var r8b6 = b6 !== a6; var r8b7 = b7 !== a7; //// [comparisonOperatorWithNoRelationshipObjectsOnCallSignature.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js index 6235eb4b4d9..097246f183b 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js @@ -169,7 +169,7 @@ var r8b6 = b6 !== a6; var r8b7 = b7 !== a7; //// [comparisonOperatorWithNoRelationshipObjectsOnConstructorSignature.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js index 43ae21c3b03..6bb3cddc8a7 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js @@ -112,7 +112,7 @@ var r8b3 = b3 !== a3; var r8b4 = b4 !== a4; //// [comparisonOperatorWithNoRelationshipObjectsOnIndexSignature.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js index 83adba638a6..dee8fb5ed5a 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js @@ -150,7 +150,7 @@ var r8b5 = b5 !== a5; var r8b6 = b6 !== a6; //// [comparisonOperatorWithNoRelationshipObjectsOnInstantiatedCallSignature.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js index a5a52dccf83..bc7db12ebf2 100644 --- a/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js @@ -150,7 +150,7 @@ var r8b5 = b5 !== a5; var r8b6 = b6 !== a6; //// [comparisonOperatorWithNoRelationshipObjectsOnInstantiatedConstructorSignature.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js index 5a00fd85f3c..a35ece1b617 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnCallSignature.js @@ -260,7 +260,7 @@ var r8b11 = b11 !== a11; //var r8b12 = b12 !== a12; //// [comparisonOperatorWithSubtypeObjectOnCallSignature.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js index cba4f67933b..8ade79daa20 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnConstructorSignature.js @@ -222,7 +222,7 @@ var r8b9 = b9 !== a9; //var r8b10 = b10 !== a10; //// [comparisonOperatorWithSubtypeObjectOnConstructorSignature.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js index ec152ef0da5..080c7990c04 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnIndexSignature.js @@ -108,7 +108,7 @@ var r8b1 = b3 !== a3; var r8b1 = b4 !== a4; //// [comparisonOperatorWithSubtypeObjectOnIndexSignature.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js index 1f2400f9bea..f01b18496d5 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js @@ -165,7 +165,7 @@ var r8b6 = b6 !== a6; //var r8b7 = b7 !== a7; //// [comparisonOperatorWithSubtypeObjectOnInstantiatedCallSignature.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js index e80480e1a4e..bd4525e5c7b 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js @@ -165,7 +165,7 @@ var r8b6 = b6 !== a6; //var r8b7 = b7 !== a7; //// [comparisonOperatorWithSubtypeObjectOnInstantiatedConstructorSignature.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js index 99c64617531..cbd31f56b30 100644 --- a/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js +++ b/tests/baselines/reference/comparisonOperatorWithSubtypeObjectOnProperty.js @@ -79,7 +79,7 @@ var rh3 = b1 !== a1; var rh4 = b2 !== a2; //// [comparisonOperatorWithSubtypeObjectOnProperty.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/complexClassRelationships.js b/tests/baselines/reference/complexClassRelationships.js index e8dc954e14c..2d750b77f71 100644 --- a/tests/baselines/reference/complexClassRelationships.js +++ b/tests/baselines/reference/complexClassRelationships.js @@ -48,7 +48,7 @@ class FooBase { } //// [complexClassRelationships.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js index 49171d4c87b..920172b206d 100644 --- a/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js +++ b/tests/baselines/reference/complicatedGenericRecursiveBaseClassReference.js @@ -6,7 +6,7 @@ class S18 extends S18 //// [complicatedGenericRecursiveBaseClassReference.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/compoundAssignmentLHSIsValue.js b/tests/baselines/reference/compoundAssignmentLHSIsValue.js index d85d053f8eb..6e355e136e3 100644 --- a/tests/baselines/reference/compoundAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundAssignmentLHSIsValue.js @@ -123,7 +123,7 @@ foo() += value; (foo()) += value; //// [compoundAssignmentLHSIsValue.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/computedPropertyNames24_ES5.js b/tests/baselines/reference/computedPropertyNames24_ES5.js index 3fd4d41d0c2..e433383eb5c 100644 --- a/tests/baselines/reference/computedPropertyNames24_ES5.js +++ b/tests/baselines/reference/computedPropertyNames24_ES5.js @@ -9,7 +9,7 @@ class C extends Base { } //// [computedPropertyNames24_ES5.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js index b6a8d254b26..eca2485ab7d 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.js +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -14,7 +14,7 @@ class C extends Base { } //// [computedPropertyNames25_ES5.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.js b/tests/baselines/reference/computedPropertyNames26_ES5.js index 7a0a982eb41..0e3b6c126bc 100644 --- a/tests/baselines/reference/computedPropertyNames26_ES5.js +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -11,7 +11,7 @@ class C extends Base { } //// [computedPropertyNames26_ES5.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/computedPropertyNames27_ES5.js b/tests/baselines/reference/computedPropertyNames27_ES5.js index df1fed09724..12f02fbefa9 100644 --- a/tests/baselines/reference/computedPropertyNames27_ES5.js +++ b/tests/baselines/reference/computedPropertyNames27_ES5.js @@ -6,7 +6,7 @@ class C extends Base { } //// [computedPropertyNames27_ES5.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js index 5940c498db8..b2be5f120a5 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES5.js +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -11,7 +11,7 @@ class C extends Base { } //// [computedPropertyNames28_ES5.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js index 05196e23c5b..6bbca3da056 100644 --- a/tests/baselines/reference/computedPropertyNames30_ES5.js +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -16,7 +16,7 @@ class C extends Base { } //// [computedPropertyNames30_ES5.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js index 173e3c7222b..fb7d651364b 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.js +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -16,7 +16,7 @@ class C extends Base { } //// [computedPropertyNames31_ES5.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/computedPropertyNames43_ES5.js b/tests/baselines/reference/computedPropertyNames43_ES5.js index b689f02ee98..e51df61a8c1 100644 --- a/tests/baselines/reference/computedPropertyNames43_ES5.js +++ b/tests/baselines/reference/computedPropertyNames43_ES5.js @@ -13,7 +13,7 @@ class D extends C { } //// [computedPropertyNames43_ES5.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/computedPropertyNames44_ES5.js b/tests/baselines/reference/computedPropertyNames44_ES5.js index 32d3505e252..5efc5a11496 100644 --- a/tests/baselines/reference/computedPropertyNames44_ES5.js +++ b/tests/baselines/reference/computedPropertyNames44_ES5.js @@ -12,7 +12,7 @@ class D extends C { } //// [computedPropertyNames44_ES5.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/computedPropertyNames45_ES5.js b/tests/baselines/reference/computedPropertyNames45_ES5.js index 3d924b00b73..d7fb6f35407 100644 --- a/tests/baselines/reference/computedPropertyNames45_ES5.js +++ b/tests/baselines/reference/computedPropertyNames45_ES5.js @@ -13,7 +13,7 @@ class D extends C { } //// [computedPropertyNames45_ES5.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js index 722310815ae..18c09a500a6 100644 --- a/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js +++ b/tests/baselines/reference/conditionalOperatorWithIdenticalBCT.js @@ -48,7 +48,7 @@ var result11: any = true ? 1 : 'string'; //// [conditionalOperatorWithIdenticalBCT.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js index 83262ed1301..62b887d7e60 100644 --- a/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js +++ b/tests/baselines/reference/conditionalOperatorWithoutIdenticalBCT.js @@ -24,7 +24,7 @@ var result61: (t: X) => number| string = true ? (m) => m.propertyX1 : (n) => n.p //// [conditionalOperatorWithoutIdenticalBCT.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/constantOverloadFunction.js b/tests/baselines/reference/constantOverloadFunction.js index 408b56805fb..aa89c619e7e 100644 --- a/tests/baselines/reference/constantOverloadFunction.js +++ b/tests/baselines/reference/constantOverloadFunction.js @@ -14,7 +14,7 @@ function foo(tagName: any): Base { //// [constantOverloadFunction.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js index 591d6171dbe..529f888bfc9 100644 --- a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js +++ b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.js @@ -15,7 +15,7 @@ function foo(tagName: any): Base { //// [constantOverloadFunctionNoSubtypeError.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js index caeb2d32ee4..22b77ba6816 100644 --- a/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js +++ b/tests/baselines/reference/constraintCheckInGenericBaseTypeReference.js @@ -20,7 +20,7 @@ class Container { } //// [constraintCheckInGenericBaseTypeReference.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js index 3cc7bddd1d0..c1c10ead1e3 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance2.js @@ -71,7 +71,7 @@ interface I extends A { //// [constructSignatureAssignabilityInInheritance2.js] // checking subtype relations for function types as it relates to contextual signature instantiation -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js index f9f8ca0c089..12907c6d032 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance3.js @@ -114,7 +114,7 @@ module Errors { //// [constructSignatureAssignabilityInInheritance3.js] // checking subtype relations for function types as it relates to contextual signature instantiation // error cases -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js index 4119b87ba97..ef03802a17e 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance4.js @@ -61,7 +61,7 @@ interface I extends A { //// [constructSignatureAssignabilityInInheritance4.js] // checking subtype relations for function types as it relates to contextual signature instantiation -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js index a33d2a03b26..9964a3464a1 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance5.js @@ -51,7 +51,7 @@ interface I extends B { //// [constructSignatureAssignabilityInInheritance5.js] // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js index f94845e82bf..4cf9b7d71f5 100644 --- a/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js +++ b/tests/baselines/reference/constructSignatureAssignabilityInInheritance6.js @@ -54,7 +54,7 @@ interface I9 extends A { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures // all are errors -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/constructorArgs.js b/tests/baselines/reference/constructorArgs.js index e77c6ed8e0f..93a47178d52 100644 --- a/tests/baselines/reference/constructorArgs.js +++ b/tests/baselines/reference/constructorArgs.js @@ -16,7 +16,7 @@ class Sub extends Super { //// [constructorArgs.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js index 7262e5b7e0d..9c92f31ce97 100644 --- a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js +++ b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType.js @@ -20,7 +20,7 @@ class Derived2 extends Base { } //// [constructorFunctionTypeIsAssignableToBaseType.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js index 79094a38b1d..61cf399f613 100644 --- a/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js +++ b/tests/baselines/reference/constructorFunctionTypeIsAssignableToBaseType2.js @@ -34,7 +34,7 @@ class Derived2 extends Base { //// [constructorFunctionTypeIsAssignableToBaseType2.js] // the constructor function itself does not need to be a subtype of the base type constructor function -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/constructorHasPrototypeProperty.js b/tests/baselines/reference/constructorHasPrototypeProperty.js index 951593e9353..47020120f9f 100644 --- a/tests/baselines/reference/constructorHasPrototypeProperty.js +++ b/tests/baselines/reference/constructorHasPrototypeProperty.js @@ -32,7 +32,7 @@ module Generic { } //// [constructorHasPrototypeProperty.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/constructorOverloads2.js b/tests/baselines/reference/constructorOverloads2.js index e3eae0ed5a9..16da3f0fa0a 100644 --- a/tests/baselines/reference/constructorOverloads2.js +++ b/tests/baselines/reference/constructorOverloads2.js @@ -26,7 +26,7 @@ f1.bar1(); //// [constructorOverloads2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/constructorOverloads3.js b/tests/baselines/reference/constructorOverloads3.js index c54226745c2..f4299466aa1 100644 --- a/tests/baselines/reference/constructorOverloads3.js +++ b/tests/baselines/reference/constructorOverloads3.js @@ -23,7 +23,7 @@ f1.bar1(); //// [constructorOverloads3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js index b44d7faa5a6..01a1880ffd5 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js @@ -280,7 +280,7 @@ TypeScriptAllInOne.Program.Main(); //// [constructorWithIncompleteTypeAnnotation.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/contextualTypingArrayOfLambdas.js b/tests/baselines/reference/contextualTypingArrayOfLambdas.js index 844a50428e2..e24ae90176c 100644 --- a/tests/baselines/reference/contextualTypingArrayOfLambdas.js +++ b/tests/baselines/reference/contextualTypingArrayOfLambdas.js @@ -15,7 +15,7 @@ var xs = [(x: A) => { }, (x: B) => { }, (x: C) => { }]; //// [contextualTypingArrayOfLambdas.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression.js b/tests/baselines/reference/contextualTypingOfConditionalExpression.js index b1100ba80a9..72c15455e8e 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression.js +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression.js @@ -15,7 +15,7 @@ var x2: (a: A) => void = true ? (a) => a.foo : (b) => b.foo; //// [contextualTypingOfConditionalExpression.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/contextualTypingOfConditionalExpression2.js b/tests/baselines/reference/contextualTypingOfConditionalExpression2.js index f832d2766ee..4e6b95a6857 100644 --- a/tests/baselines/reference/contextualTypingOfConditionalExpression2.js +++ b/tests/baselines/reference/contextualTypingOfConditionalExpression2.js @@ -13,7 +13,7 @@ var x2: (a: A) => void = true ? (a: C) => a.foo : (b: number) => { }; //// [contextualTypingOfConditionalExpression2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js index 8928e45694c..17c9ac649d8 100644 --- a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js +++ b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.js @@ -11,7 +11,7 @@ var a: D = foo("hi", []); //// [crashInsourcePropertyIsRelatableToTargetProperty.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js b/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js index c19ab9a3fb1..134bacd6053 100644 --- a/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js +++ b/tests/baselines/reference/declFileForFunctionTypeAsTypeParameter.js @@ -10,7 +10,7 @@ interface I extends X<() => number> { //// [declFileForFunctionTypeAsTypeParameter.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js index dfeb6f5d3c3..23630ba5218 100644 --- a/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js +++ b/tests/baselines/reference/declFileGenericClassWithGenericExtendedClass.js @@ -13,7 +13,7 @@ class Baz implements IBar { //// [declFileGenericClassWithGenericExtendedClass.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/declFileGenericType.js b/tests/baselines/reference/declFileGenericType.js index e01626a7ead..35fde5bde00 100644 --- a/tests/baselines/reference/declFileGenericType.js +++ b/tests/baselines/reference/declFileGenericType.js @@ -40,7 +40,7 @@ export var j = C.F6; //// [declFileGenericType.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/declFileGenericType2.js b/tests/baselines/reference/declFileGenericType2.js index db1399e64d3..03649af4ba6 100644 --- a/tests/baselines/reference/declFileGenericType2.js +++ b/tests/baselines/reference/declFileGenericType2.js @@ -43,7 +43,7 @@ module templa.dom.mvc.composite { //// [declFileGenericType2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js index 7da7dd8716a..8881122839e 100644 --- a/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js +++ b/tests/baselines/reference/declFileWithClassNameConflictingWithClassReferredByExtendsClause.js @@ -21,7 +21,7 @@ module X.Y.base.Z { //// [declFileWithClassNameConflictingWithClassReferredByExtendsClause.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js index 5f6509cb597..c06461e89fc 100644 --- a/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js +++ b/tests/baselines/reference/declFileWithExtendsClauseThatHasItsContainerNameConflict.js @@ -19,7 +19,7 @@ module A.B.C { } //// [declFileWithExtendsClauseThatHasItsContainerNameConflict.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/declarationEmit_nameConflicts3.js b/tests/baselines/reference/declarationEmit_nameConflicts3.js index 0d68c38cfda..8f4fa686e44 100644 --- a/tests/baselines/reference/declarationEmit_nameConflicts3.js +++ b/tests/baselines/reference/declarationEmit_nameConflicts3.js @@ -27,7 +27,7 @@ module M.P { } //// [declarationEmit_nameConflicts3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/declarationEmit_protectedMembers.js b/tests/baselines/reference/declarationEmit_protectedMembers.js index 61a4ebdfcab..faa1dc298e1 100644 --- a/tests/baselines/reference/declarationEmit_protectedMembers.js +++ b/tests/baselines/reference/declarationEmit_protectedMembers.js @@ -51,7 +51,7 @@ class C4 { } //// [declarationEmit_protectedMembers.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/declareDottedExtend.js b/tests/baselines/reference/declareDottedExtend.js index 974a678abda..2579a5557fc 100644 --- a/tests/baselines/reference/declareDottedExtend.js +++ b/tests/baselines/reference/declareDottedExtend.js @@ -12,7 +12,7 @@ class E extends A.B.C{ } //// [declareDottedExtend.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/decoratedClassFromExternalModule.js b/tests/baselines/reference/decoratedClassFromExternalModule.js index da31e7c2f92..36cffbb6677 100644 --- a/tests/baselines/reference/decoratedClassFromExternalModule.js +++ b/tests/baselines/reference/decoratedClassFromExternalModule.js @@ -10,7 +10,7 @@ export default class Decorated { } import Decorated from 'decorated'; //// [decorated.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClass1.js b/tests/baselines/reference/decoratorOnClass1.js index 49b2b27ac8b..b8099222acc 100644 --- a/tests/baselines/reference/decoratorOnClass1.js +++ b/tests/baselines/reference/decoratorOnClass1.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClass1.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClass2.js b/tests/baselines/reference/decoratorOnClass2.js index 71ac2358555..18492794331 100644 --- a/tests/baselines/reference/decoratorOnClass2.js +++ b/tests/baselines/reference/decoratorOnClass2.js @@ -6,7 +6,7 @@ export class C { } //// [decoratorOnClass2.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClass3.js b/tests/baselines/reference/decoratorOnClass3.js index 37da7043615..2291a2dbc57 100644 --- a/tests/baselines/reference/decoratorOnClass3.js +++ b/tests/baselines/reference/decoratorOnClass3.js @@ -7,7 +7,7 @@ class C { } //// [decoratorOnClass3.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClass4.js b/tests/baselines/reference/decoratorOnClass4.js index e56e427b797..484efdf6128 100644 --- a/tests/baselines/reference/decoratorOnClass4.js +++ b/tests/baselines/reference/decoratorOnClass4.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClass4.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClass5.js b/tests/baselines/reference/decoratorOnClass5.js index b415fcf8f9a..02ea01c3fd6 100644 --- a/tests/baselines/reference/decoratorOnClass5.js +++ b/tests/baselines/reference/decoratorOnClass5.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClass5.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClass8.js b/tests/baselines/reference/decoratorOnClass8.js index 500cdcf4511..e75ccac3c86 100644 --- a/tests/baselines/reference/decoratorOnClass8.js +++ b/tests/baselines/reference/decoratorOnClass8.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClass8.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassAccessor1.js b/tests/baselines/reference/decoratorOnClassAccessor1.js index 2e0f3520b43..2700c531e42 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor1.js +++ b/tests/baselines/reference/decoratorOnClassAccessor1.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassAccessor1.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassAccessor2.js b/tests/baselines/reference/decoratorOnClassAccessor2.js index a339c3b1663..c29c7598013 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor2.js +++ b/tests/baselines/reference/decoratorOnClassAccessor2.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassAccessor2.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassAccessor3.js b/tests/baselines/reference/decoratorOnClassAccessor3.js index 843a1113255..61430a986ac 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor3.js +++ b/tests/baselines/reference/decoratorOnClassAccessor3.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassAccessor3.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassAccessor4.js b/tests/baselines/reference/decoratorOnClassAccessor4.js index 416472ba5ff..0ad11c4c09e 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor4.js +++ b/tests/baselines/reference/decoratorOnClassAccessor4.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassAccessor4.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassAccessor5.js b/tests/baselines/reference/decoratorOnClassAccessor5.js index ba4e20955e9..53a43f7912c 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor5.js +++ b/tests/baselines/reference/decoratorOnClassAccessor5.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassAccessor5.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassAccessor6.js b/tests/baselines/reference/decoratorOnClassAccessor6.js index 05f0651e1e5..eaa21f45234 100644 --- a/tests/baselines/reference/decoratorOnClassAccessor6.js +++ b/tests/baselines/reference/decoratorOnClassAccessor6.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassAccessor6.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassConstructorParameter1.js b/tests/baselines/reference/decoratorOnClassConstructorParameter1.js index aa477bcdaef..b2af1450123 100644 --- a/tests/baselines/reference/decoratorOnClassConstructorParameter1.js +++ b/tests/baselines/reference/decoratorOnClassConstructorParameter1.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassConstructorParameter1.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); @@ -14,7 +14,7 @@ if (typeof __decorate !== "function") __decorate = function (decorators, target, case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } }; -if (typeof __param !== "function") __param = function (paramIndex, decorator) { +var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; var C = (function () { diff --git a/tests/baselines/reference/decoratorOnClassConstructorParameter4.js b/tests/baselines/reference/decoratorOnClassConstructorParameter4.js index 7b7f418ed02..5273482586e 100644 --- a/tests/baselines/reference/decoratorOnClassConstructorParameter4.js +++ b/tests/baselines/reference/decoratorOnClassConstructorParameter4.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassConstructorParameter4.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); @@ -14,7 +14,7 @@ if (typeof __decorate !== "function") __decorate = function (decorators, target, case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } }; -if (typeof __param !== "function") __param = function (paramIndex, decorator) { +var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; var C = (function () { diff --git a/tests/baselines/reference/decoratorOnClassMethod1.js b/tests/baselines/reference/decoratorOnClassMethod1.js index c2f64cb0639..65c2f4b6008 100644 --- a/tests/baselines/reference/decoratorOnClassMethod1.js +++ b/tests/baselines/reference/decoratorOnClassMethod1.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassMethod1.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassMethod10.js b/tests/baselines/reference/decoratorOnClassMethod10.js index ad934eb6d08..bae4e97fb5b 100644 --- a/tests/baselines/reference/decoratorOnClassMethod10.js +++ b/tests/baselines/reference/decoratorOnClassMethod10.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassMethod10.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassMethod11.js b/tests/baselines/reference/decoratorOnClassMethod11.js index b55cdf81b24..5d4ac60c14e 100644 --- a/tests/baselines/reference/decoratorOnClassMethod11.js +++ b/tests/baselines/reference/decoratorOnClassMethod11.js @@ -9,7 +9,7 @@ module M { } //// [decoratorOnClassMethod11.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassMethod12.js b/tests/baselines/reference/decoratorOnClassMethod12.js index 4c2c19bd6a5..aa938eaaaf4 100644 --- a/tests/baselines/reference/decoratorOnClassMethod12.js +++ b/tests/baselines/reference/decoratorOnClassMethod12.js @@ -10,13 +10,13 @@ module M { } //// [decoratorOnClassMethod12.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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 __(); }; -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassMethod13.js b/tests/baselines/reference/decoratorOnClassMethod13.js index be6d7449ee4..967cc05ba4d 100644 --- a/tests/baselines/reference/decoratorOnClassMethod13.js +++ b/tests/baselines/reference/decoratorOnClassMethod13.js @@ -7,7 +7,7 @@ class C { } //// [decoratorOnClassMethod13.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassMethod2.js b/tests/baselines/reference/decoratorOnClassMethod2.js index 7500cebc12d..8b4ceeb47ee 100644 --- a/tests/baselines/reference/decoratorOnClassMethod2.js +++ b/tests/baselines/reference/decoratorOnClassMethod2.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassMethod2.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassMethod3.js b/tests/baselines/reference/decoratorOnClassMethod3.js index 54b2ae20d87..fff0e845860 100644 --- a/tests/baselines/reference/decoratorOnClassMethod3.js +++ b/tests/baselines/reference/decoratorOnClassMethod3.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassMethod3.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassMethod4.js b/tests/baselines/reference/decoratorOnClassMethod4.js index 7ce4596fc17..9f5b0d67eb1 100644 --- a/tests/baselines/reference/decoratorOnClassMethod4.js +++ b/tests/baselines/reference/decoratorOnClassMethod4.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassMethod4.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassMethod5.js b/tests/baselines/reference/decoratorOnClassMethod5.js index 9f768816b47..f767b176207 100644 --- a/tests/baselines/reference/decoratorOnClassMethod5.js +++ b/tests/baselines/reference/decoratorOnClassMethod5.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassMethod5.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassMethod6.js b/tests/baselines/reference/decoratorOnClassMethod6.js index 064992b1c7a..33dc4c86fd2 100644 --- a/tests/baselines/reference/decoratorOnClassMethod6.js +++ b/tests/baselines/reference/decoratorOnClassMethod6.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassMethod6.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassMethod7.js b/tests/baselines/reference/decoratorOnClassMethod7.js index 8635fe25b6a..c20a726fc46 100644 --- a/tests/baselines/reference/decoratorOnClassMethod7.js +++ b/tests/baselines/reference/decoratorOnClassMethod7.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassMethod7.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassMethod8.js b/tests/baselines/reference/decoratorOnClassMethod8.js index e63de6d4db3..a664bdb8494 100644 --- a/tests/baselines/reference/decoratorOnClassMethod8.js +++ b/tests/baselines/reference/decoratorOnClassMethod8.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassMethod8.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassMethodParameter1.js b/tests/baselines/reference/decoratorOnClassMethodParameter1.js index a81cdaa19c8..4a3ed36eec5 100644 --- a/tests/baselines/reference/decoratorOnClassMethodParameter1.js +++ b/tests/baselines/reference/decoratorOnClassMethodParameter1.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassMethodParameter1.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); @@ -14,7 +14,7 @@ if (typeof __decorate !== "function") __decorate = function (decorators, target, case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } }; -if (typeof __param !== "function") __param = function (paramIndex, decorator) { +var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; var C = (function () { diff --git a/tests/baselines/reference/decoratorOnClassProperty1.js b/tests/baselines/reference/decoratorOnClassProperty1.js index 23e5eec1cc0..567eb510cb3 100644 --- a/tests/baselines/reference/decoratorOnClassProperty1.js +++ b/tests/baselines/reference/decoratorOnClassProperty1.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassProperty1.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassProperty10.js b/tests/baselines/reference/decoratorOnClassProperty10.js index b3848e73d57..b64986a8c97 100644 --- a/tests/baselines/reference/decoratorOnClassProperty10.js +++ b/tests/baselines/reference/decoratorOnClassProperty10.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassProperty10.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassProperty11.js b/tests/baselines/reference/decoratorOnClassProperty11.js index 72ad6f276de..a33fc724180 100644 --- a/tests/baselines/reference/decoratorOnClassProperty11.js +++ b/tests/baselines/reference/decoratorOnClassProperty11.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassProperty11.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassProperty2.js b/tests/baselines/reference/decoratorOnClassProperty2.js index 72fb1bcb331..f5de593b057 100644 --- a/tests/baselines/reference/decoratorOnClassProperty2.js +++ b/tests/baselines/reference/decoratorOnClassProperty2.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassProperty2.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassProperty3.js b/tests/baselines/reference/decoratorOnClassProperty3.js index af72503b914..d2876d2cd6a 100644 --- a/tests/baselines/reference/decoratorOnClassProperty3.js +++ b/tests/baselines/reference/decoratorOnClassProperty3.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassProperty3.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassProperty6.js b/tests/baselines/reference/decoratorOnClassProperty6.js index a8621e253e8..4ebd19ceee8 100644 --- a/tests/baselines/reference/decoratorOnClassProperty6.js +++ b/tests/baselines/reference/decoratorOnClassProperty6.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassProperty6.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/decoratorOnClassProperty7.js b/tests/baselines/reference/decoratorOnClassProperty7.js index 6c7b3292235..045f8722b97 100644 --- a/tests/baselines/reference/decoratorOnClassProperty7.js +++ b/tests/baselines/reference/decoratorOnClassProperty7.js @@ -6,7 +6,7 @@ class C { } //// [decoratorOnClassProperty7.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js index 32e8cf4199e..37dc2db870b 100644 --- a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js +++ b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js @@ -34,7 +34,7 @@ class Derived4 extends Base2 { //// [derivedClassConstructorWithoutSuperCall.js] // derived class constructors must contain a super call -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js index 615c3e7f7a6..eaf7dfd5698 100644 --- a/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js +++ b/tests/baselines/reference/derivedClassFunctionOverridesBaseClassAccessor.js @@ -15,7 +15,7 @@ class Derived extends Base { } //// [derivedClassFunctionOverridesBaseClassAccessor.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js index f2e816604d2..b83255ccf93 100644 --- a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js +++ b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js @@ -41,7 +41,7 @@ var r8 = d2[1]; //// [derivedClassIncludesInheritedMembers.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js b/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js index a942e1ee237..1fe59d78044 100644 --- a/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js +++ b/tests/baselines/reference/derivedClassOverridesIndexersWithAssignmentCompatibility.js @@ -18,7 +18,7 @@ class Derived2 extends Base2 { } //// [derivedClassOverridesIndexersWithAssignmentCompatibility.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js b/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js index c1519f7695c..b9cd6df0338 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js +++ b/tests/baselines/reference/derivedClassOverridesPrivateFunction1.js @@ -16,7 +16,7 @@ class DerivedClass extends BaseClass { new DerivedClass(); //// [derivedClassOverridesPrivateFunction1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassOverridesPrivates.js b/tests/baselines/reference/derivedClassOverridesPrivates.js index f6a704e076a..2cc8360a803 100644 --- a/tests/baselines/reference/derivedClassOverridesPrivates.js +++ b/tests/baselines/reference/derivedClassOverridesPrivates.js @@ -16,7 +16,7 @@ class Derived2 extends Base2 { } //// [derivedClassOverridesPrivates.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js index b66d356a73e..48ee6eded6c 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js @@ -37,7 +37,7 @@ class Derived extends Base { //// [derivedClassOverridesProtectedMembers.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js index 80f7456ab9a..fca27b0de04 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js @@ -64,7 +64,7 @@ var r8 = d2[1]; //// [derivedClassOverridesProtectedMembers2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js index cfb6116ee85..2a102d55eac 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js @@ -72,7 +72,7 @@ class Derived10 extends Base { } //// [derivedClassOverridesProtectedMembers3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js index e1d5b766b82..5145f3919a8 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers4.js @@ -15,7 +15,7 @@ class Derived2 extends Derived1 { } //// [derivedClassOverridesProtectedMembers4.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassOverridesPublicMembers.js b/tests/baselines/reference/derivedClassOverridesPublicMembers.js index 9d7df0eee40..0529189e4c1 100644 --- a/tests/baselines/reference/derivedClassOverridesPublicMembers.js +++ b/tests/baselines/reference/derivedClassOverridesPublicMembers.js @@ -63,7 +63,7 @@ var r8 = d2[1]; //// [derivedClassOverridesPublicMembers.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js index 7a18c0d71a5..5cb746bfdd3 100644 --- a/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js +++ b/tests/baselines/reference/derivedClassOverridesWithoutSubtype.js @@ -24,7 +24,7 @@ class Derived2 extends Base2 { } //// [derivedClassOverridesWithoutSubtype.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassParameterProperties.js b/tests/baselines/reference/derivedClassParameterProperties.js index 0ad14313c17..dd5b206ecdd 100644 --- a/tests/baselines/reference/derivedClassParameterProperties.js +++ b/tests/baselines/reference/derivedClassParameterProperties.js @@ -96,7 +96,7 @@ class Derived10 extends Base2 { //// [derivedClassParameterProperties.js] // ordering of super calls in derived constructors matters depending on other class contents -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js index 14ac1f47e2f..d2914cd6949 100644 --- a/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js +++ b/tests/baselines/reference/derivedClassSuperCallsInNonConstructorMembers.js @@ -33,7 +33,7 @@ class Derived extends Base { //// [derivedClassSuperCallsInNonConstructorMembers.js] // error to use super calls outside a constructor -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js index 1902b6f4068..7c7e9b40cec 100644 --- a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js +++ b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js @@ -29,7 +29,7 @@ class Derived4 extends Base { } //// [derivedClassSuperCallsWithThisArg.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassTransitivity.js b/tests/baselines/reference/derivedClassTransitivity.js index 2088fc1122b..ad4f3e481a7 100644 --- a/tests/baselines/reference/derivedClassTransitivity.js +++ b/tests/baselines/reference/derivedClassTransitivity.js @@ -22,7 +22,7 @@ var r2 = e.foo(''); //// [derivedClassTransitivity.js] // subclassing is not transitive when you can remove required parameters and add optional parameters -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassTransitivity2.js b/tests/baselines/reference/derivedClassTransitivity2.js index 458aede164c..efeb25195ff 100644 --- a/tests/baselines/reference/derivedClassTransitivity2.js +++ b/tests/baselines/reference/derivedClassTransitivity2.js @@ -22,7 +22,7 @@ var r2 = e.foo(1, ''); //// [derivedClassTransitivity2.js] // subclassing is not transitive when you can remove required parameters and add optional parameters -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassTransitivity3.js b/tests/baselines/reference/derivedClassTransitivity3.js index 9768a8f5fa3..8befbf18731 100644 --- a/tests/baselines/reference/derivedClassTransitivity3.js +++ b/tests/baselines/reference/derivedClassTransitivity3.js @@ -22,7 +22,7 @@ var r2 = e.foo('', 1); //// [derivedClassTransitivity3.js] // subclassing is not transitive when you can remove required parameters and add optional parameters -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassTransitivity4.js b/tests/baselines/reference/derivedClassTransitivity4.js index abf1a3b5bd0..546c7e4a849 100644 --- a/tests/baselines/reference/derivedClassTransitivity4.js +++ b/tests/baselines/reference/derivedClassTransitivity4.js @@ -22,7 +22,7 @@ var r2 = e.foo(''); //// [derivedClassTransitivity4.js] // subclassing is not transitive when you can remove required parameters and add optional parameters on protected members -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassWithAny.js b/tests/baselines/reference/derivedClassWithAny.js index 8070e689bd0..6f9ef484627 100644 --- a/tests/baselines/reference/derivedClassWithAny.js +++ b/tests/baselines/reference/derivedClassWithAny.js @@ -60,7 +60,7 @@ var r = c.foo(); // e.foo would return string //// [derivedClassWithAny.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js index 8b00c632058..bf8b1b51cd1 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js @@ -23,7 +23,7 @@ class Derived extends Base { //// [derivedClassWithPrivateInstanceShadowingProtectedInstance.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js index 4ac57d159e6..131c529f3bf 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js @@ -33,7 +33,7 @@ var r6 = Derived.a; // error Derived.a = 2; // error //// [derivedClassWithPrivateInstanceShadowingPublicInstance.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js index 1037d3faaae..d661eeadc06 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js @@ -22,7 +22,7 @@ class Derived extends Base { } //// [derivedClassWithPrivateStaticShadowingProtectedStatic.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js index c5bfea288bd..c3fc34b21c1 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js @@ -34,7 +34,7 @@ var r6 = Derived.a; // error Derived.a = 2; // error //// [derivedClassWithPrivateStaticShadowingPublicStatic.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js index 350e36b9bf7..16b9b110a5f 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor.js @@ -26,7 +26,7 @@ var d = new D(); // error var d2 = new D(new Date()); // ok //// [derivedClassWithoutExplicitConstructor.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js index b0f10960578..6e413752f1d 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor2.js @@ -34,7 +34,7 @@ var d3 = new D(new Date(), new Date()); var d4 = new D(new Date(), new Date(), new Date()); //// [derivedClassWithoutExplicitConstructor2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js index 618750d3321..b72fdb1503d 100644 --- a/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js +++ b/tests/baselines/reference/derivedClassWithoutExplicitConstructor3.js @@ -48,7 +48,7 @@ var d3 = new D2(new Date(), new Date()); // ok //// [derivedClassWithoutExplicitConstructor3.js] // automatic constructors with a class hieararchy of depth > 2 -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedClasses.js b/tests/baselines/reference/derivedClasses.js index e256313d27b..7221031cb8b 100644 --- a/tests/baselines/reference/derivedClasses.js +++ b/tests/baselines/reference/derivedClasses.js @@ -31,7 +31,7 @@ b.hue(); //// [derivedClasses.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedGenericClassWithAny.js b/tests/baselines/reference/derivedGenericClassWithAny.js index 4d1f0452be4..b5bfbd5e5db 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.js +++ b/tests/baselines/reference/derivedGenericClassWithAny.js @@ -43,7 +43,7 @@ c = e; var r = c.foo(); // e.foo would return string //// [derivedGenericClassWithAny.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js index 39e87b620d6..564a51f2b13 100644 --- a/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js +++ b/tests/baselines/reference/derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js @@ -18,7 +18,7 @@ class Derived extends Base { } //// [derivedTypeAccessesHiddenBaseCallViaSuperPropertyAccess.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js index 50c8aba1ef8..f981a5e6e54 100644 --- a/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js +++ b/tests/baselines/reference/derivedTypeDoesNotRequireExtendsClause.js @@ -21,7 +21,7 @@ b = d2; var r: Base[] = [d1, d2]; //// [derivedTypeDoesNotRequireExtendsClause.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols index 623cc4c9690..18e1063f1e6 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments14_ES6.symbols @@ -5,7 +5,7 @@ function f() { if (Math.random()) { >Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) ->Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1664, 1)) +>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1694, 1)) >random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) let arguments = 100; diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols index d140c21284c..6885b359416 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments15_ES6.symbols @@ -8,7 +8,7 @@ function f() { if (Math.random()) { >Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) ->Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1664, 1)) +>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1694, 1)) >random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) const arguments = 100; diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols index e970b527d56..ae6be6f7951 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments16_ES6.symbols @@ -8,7 +8,7 @@ function f() { if (Math.random()) { >Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) ->Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1664, 1)) +>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1694, 1)) >random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) return () => arguments[0]; diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols index 8612e0896d1..c8bf211897a 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments17_ES6.symbols @@ -9,7 +9,7 @@ function f() { if (Math.random()) { >Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) ->Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1664, 1)) +>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1694, 1)) >random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) return () => arguments[0]; diff --git a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols index 96f9712635c..cc867dd2c72 100644 --- a/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols +++ b/tests/baselines/reference/emitArrowFunctionWhenUsingArguments18_ES6.symbols @@ -9,7 +9,7 @@ function f() { if (Math.random()) { >Math.random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) ->Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1664, 1)) +>Math : Symbol(Math, Decl(lib.d.ts, 522, 1), Decl(lib.d.ts, 633, 11), Decl(lib.d.ts, 1694, 1)) >random : Symbol(Math.random, Decl(lib.d.ts, 608, 38)) return () => arguments; diff --git a/tests/baselines/reference/emitThisInSuperMethodCall.js b/tests/baselines/reference/emitThisInSuperMethodCall.js index de47b0b95af..9224e156de9 100644 --- a/tests/baselines/reference/emitThisInSuperMethodCall.js +++ b/tests/baselines/reference/emitThisInSuperMethodCall.js @@ -28,7 +28,7 @@ class RegisteredUser extends User { //// [emitThisInSuperMethodCall.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js index 5bfa3b38e83..f1a0d741a5c 100644 --- a/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js +++ b/tests/baselines/reference/errorForwardReferenceForwadingConstructor.js @@ -12,7 +12,7 @@ class derived extends base { } //// [errorForwardReferenceForwadingConstructor.js] // Error forward referencing derived class with forwarding constructor -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/errorSuperCalls.js b/tests/baselines/reference/errorSuperCalls.js index 4e0f84656fd..bd692f35fa3 100644 --- a/tests/baselines/reference/errorSuperCalls.js +++ b/tests/baselines/reference/errorSuperCalls.js @@ -75,7 +75,7 @@ class OtherDerived extends OtherBase { //// [errorSuperCalls.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/errorSuperPropertyAccess.js b/tests/baselines/reference/errorSuperPropertyAccess.js index 26ef99f269d..abf077d2b82 100644 --- a/tests/baselines/reference/errorSuperPropertyAccess.js +++ b/tests/baselines/reference/errorSuperPropertyAccess.js @@ -129,7 +129,7 @@ var obj = { n: super.wat, p: super.foo() }; //// [errorSuperPropertyAccess.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/errorsInGenericTypeReference.js b/tests/baselines/reference/errorsInGenericTypeReference.js index 03bf31a6a6b..0ba69b601ae 100644 --- a/tests/baselines/reference/errorsInGenericTypeReference.js +++ b/tests/baselines/reference/errorsInGenericTypeReference.js @@ -73,7 +73,7 @@ interface testInterface2 { //// [errorsInGenericTypeReference.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/es6ClassSuperCodegenBug.js b/tests/baselines/reference/es6ClassSuperCodegenBug.js index c5d668c2f3d..a374778ef45 100644 --- a/tests/baselines/reference/es6ClassSuperCodegenBug.js +++ b/tests/baselines/reference/es6ClassSuperCodegenBug.js @@ -14,7 +14,7 @@ class B extends A { //// [es6ClassSuperCodegenBug.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/es6ClassTest.js b/tests/baselines/reference/es6ClassTest.js index 08c184a0df2..bf65840e31c 100644 --- a/tests/baselines/reference/es6ClassTest.js +++ b/tests/baselines/reference/es6ClassTest.js @@ -85,7 +85,7 @@ declare module AmbientMod { //// [es6ClassTest.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/es6ClassTest2.js b/tests/baselines/reference/es6ClassTest2.js index f23be04fd17..40f1c15c8f1 100644 --- a/tests/baselines/reference/es6ClassTest2.js +++ b/tests/baselines/reference/es6ClassTest2.js @@ -159,7 +159,7 @@ var ccwc = new ChildClassWithoutConstructor(1, "s"); //// [es6ClassTest2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/es6ClassTest7.js b/tests/baselines/reference/es6ClassTest7.js index 728b4d0a404..c4f7e83b9a2 100644 --- a/tests/baselines/reference/es6ClassTest7.js +++ b/tests/baselines/reference/es6ClassTest7.js @@ -9,7 +9,7 @@ class Bar extends M.Foo { //// [es6ClassTest7.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/exportAssignmentOfGenericType1.js b/tests/baselines/reference/exportAssignmentOfGenericType1.js index 0b8c4f2596c..983c328cd98 100644 --- a/tests/baselines/reference/exportAssignmentOfGenericType1.js +++ b/tests/baselines/reference/exportAssignmentOfGenericType1.js @@ -23,7 +23,7 @@ define(["require", "exports"], function (require, exports) { return T; }); //// [exportAssignmentOfGenericType1_1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/exportDeclarationInInternalModule.js b/tests/baselines/reference/exportDeclarationInInternalModule.js index 97011f2425f..9894f1fb194 100644 --- a/tests/baselines/reference/exportDeclarationInInternalModule.js +++ b/tests/baselines/reference/exportDeclarationInInternalModule.js @@ -19,7 +19,7 @@ var a: Bbb.SomeType; //// [exportDeclarationInInternalModule.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/extBaseClass1.js b/tests/baselines/reference/extBaseClass1.js index 7997944ee7a..9e7421b906c 100644 --- a/tests/baselines/reference/extBaseClass1.js +++ b/tests/baselines/reference/extBaseClass1.js @@ -20,7 +20,7 @@ module N { //// [extBaseClass1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/extBaseClass2.js b/tests/baselines/reference/extBaseClass2.js index eff97549010..e5a717bca80 100644 --- a/tests/baselines/reference/extBaseClass2.js +++ b/tests/baselines/reference/extBaseClass2.js @@ -11,7 +11,7 @@ module M { //// [extBaseClass2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType.js b/tests/baselines/reference/extendAndImplementTheSameBaseType.js index 23c9127175e..c69315dbd61 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType.js +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType.js @@ -14,7 +14,7 @@ d.baz(); d.foo; //// [extendAndImplementTheSameBaseType.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/extendAndImplementTheSameBaseType2.js b/tests/baselines/reference/extendAndImplementTheSameBaseType2.js index 234cc59ff70..06ea74880c2 100644 --- a/tests/baselines/reference/extendAndImplementTheSameBaseType2.js +++ b/tests/baselines/reference/extendAndImplementTheSameBaseType2.js @@ -17,7 +17,7 @@ var r3: string = d.bar(); var r4: number = d.bar(); //// [extendAndImplementTheSameBaseType2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js index 5034fd96691..7598d771bac 100644 --- a/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js +++ b/tests/baselines/reference/extendBaseClassBeforeItsDeclared.js @@ -4,7 +4,7 @@ class derived extends base { } class base { constructor (public n: number) { } } //// [extendBaseClassBeforeItsDeclared.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/extendNonClassSymbol1.js b/tests/baselines/reference/extendNonClassSymbol1.js index 26f0c776dd8..59da2d7ca2b 100644 --- a/tests/baselines/reference/extendNonClassSymbol1.js +++ b/tests/baselines/reference/extendNonClassSymbol1.js @@ -4,7 +4,7 @@ var x = A; class C extends x { } // error, could not find symbol xs //// [extendNonClassSymbol1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/extendNonClassSymbol2.js b/tests/baselines/reference/extendNonClassSymbol2.js index 4cb7b1787df..830994e3d26 100644 --- a/tests/baselines/reference/extendNonClassSymbol2.js +++ b/tests/baselines/reference/extendNonClassSymbol2.js @@ -6,7 +6,7 @@ var x = new Foo(); // legal, considered a constructor function class C extends Foo {} // error, could not find symbol Foo //// [extendNonClassSymbol2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js index 09280cd224a..0bf86390b74 100644 --- a/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js +++ b/tests/baselines/reference/extendingClassFromAliasAndUsageInIndexer.js @@ -40,7 +40,7 @@ var Model = (function () { })(); exports.Model = Model; //// [extendingClassFromAliasAndUsageInIndexer_moduleA.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; @@ -56,7 +56,7 @@ var VisualizationModel = (function (_super) { })(Backbone.Model); exports.VisualizationModel = VisualizationModel; //// [extendingClassFromAliasAndUsageInIndexer_moduleB.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/extendsClauseAlreadySeen.js b/tests/baselines/reference/extendsClauseAlreadySeen.js index 820a6910962..3e7151b8e0d 100644 --- a/tests/baselines/reference/extendsClauseAlreadySeen.js +++ b/tests/baselines/reference/extendsClauseAlreadySeen.js @@ -7,7 +7,7 @@ class D extends C extends C { } //// [extendsClauseAlreadySeen.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/extendsClauseAlreadySeen2.js b/tests/baselines/reference/extendsClauseAlreadySeen2.js index ad88446c4c4..9ee428c36ed 100644 --- a/tests/baselines/reference/extendsClauseAlreadySeen2.js +++ b/tests/baselines/reference/extendsClauseAlreadySeen2.js @@ -7,7 +7,7 @@ class D extends C extends C { } //// [extendsClauseAlreadySeen2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/for-inStatements.js b/tests/baselines/reference/for-inStatements.js index 3db07d878bf..749c7b47b34 100644 --- a/tests/baselines/reference/for-inStatements.js +++ b/tests/baselines/reference/for-inStatements.js @@ -81,7 +81,7 @@ for (var x in Color.Blue) { } //// [for-inStatements.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/for-inStatementsInvalid.js b/tests/baselines/reference/for-inStatementsInvalid.js index 6d42a550a01..e1806272790 100644 --- a/tests/baselines/reference/for-inStatementsInvalid.js +++ b/tests/baselines/reference/for-inStatementsInvalid.js @@ -64,7 +64,7 @@ for (var x in i[42]) { } //// [for-inStatementsInvalid.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/for-of13.symbols b/tests/baselines/reference/for-of13.symbols index c9d3c4d254c..833ea1d6875 100644 --- a/tests/baselines/reference/for-of13.symbols +++ b/tests/baselines/reference/for-of13.symbols @@ -4,6 +4,6 @@ var v: string; for (v of [""].values()) { } >v : Symbol(v, Decl(for-of13.ts, 0, 3)) ->[""].values : Symbol(Array.values, Decl(lib.d.ts, 1423, 37)) ->values : Symbol(Array.values, Decl(lib.d.ts, 1423, 37)) +>[""].values : Symbol(Array.values, Decl(lib.d.ts, 1453, 37)) +>values : Symbol(Array.values, Decl(lib.d.ts, 1453, 37)) diff --git a/tests/baselines/reference/for-of18.symbols b/tests/baselines/reference/for-of18.symbols index 180766144c8..2c08338ce73 100644 --- a/tests/baselines/reference/for-of18.symbols +++ b/tests/baselines/reference/for-of18.symbols @@ -23,7 +23,7 @@ class StringIterator { } [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/for-of19.symbols b/tests/baselines/reference/for-of19.symbols index 5dd58d671a7..6be3c83964a 100644 --- a/tests/baselines/reference/for-of19.symbols +++ b/tests/baselines/reference/for-of19.symbols @@ -28,7 +28,7 @@ class FooIterator { } [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/for-of20.symbols b/tests/baselines/reference/for-of20.symbols index 50c191a7ac0..97200f93f35 100644 --- a/tests/baselines/reference/for-of20.symbols +++ b/tests/baselines/reference/for-of20.symbols @@ -28,7 +28,7 @@ class FooIterator { } [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/for-of21.symbols b/tests/baselines/reference/for-of21.symbols index 0fbef87af15..bbe3504294c 100644 --- a/tests/baselines/reference/for-of21.symbols +++ b/tests/baselines/reference/for-of21.symbols @@ -28,7 +28,7 @@ class FooIterator { } [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/for-of22.symbols b/tests/baselines/reference/for-of22.symbols index 9714f615a79..4f15b541356 100644 --- a/tests/baselines/reference/for-of22.symbols +++ b/tests/baselines/reference/for-of22.symbols @@ -29,7 +29,7 @@ class FooIterator { } [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/for-of23.symbols b/tests/baselines/reference/for-of23.symbols index 328cb41ad29..0f409605e28 100644 --- a/tests/baselines/reference/for-of23.symbols +++ b/tests/baselines/reference/for-of23.symbols @@ -28,7 +28,7 @@ class FooIterator { } [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/for-of25.symbols b/tests/baselines/reference/for-of25.symbols index 1a0b660fc1e..44cc83143af 100644 --- a/tests/baselines/reference/for-of25.symbols +++ b/tests/baselines/reference/for-of25.symbols @@ -11,7 +11,7 @@ class StringIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return x; diff --git a/tests/baselines/reference/for-of26.symbols b/tests/baselines/reference/for-of26.symbols index a2c21c95146..0218a8b9995 100644 --- a/tests/baselines/reference/for-of26.symbols +++ b/tests/baselines/reference/for-of26.symbols @@ -17,7 +17,7 @@ class StringIterator { } [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/for-of27.symbols b/tests/baselines/reference/for-of27.symbols index e03b580551d..82918a19986 100644 --- a/tests/baselines/reference/for-of27.symbols +++ b/tests/baselines/reference/for-of27.symbols @@ -8,6 +8,6 @@ class StringIterator { [Symbol.iterator]: any; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) } diff --git a/tests/baselines/reference/for-of28.symbols b/tests/baselines/reference/for-of28.symbols index 9d6b912bd94..e4324b05779 100644 --- a/tests/baselines/reference/for-of28.symbols +++ b/tests/baselines/reference/for-of28.symbols @@ -11,7 +11,7 @@ class StringIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/for-of37.symbols b/tests/baselines/reference/for-of37.symbols index 86841971be7..93f6c4f7dd6 100644 --- a/tests/baselines/reference/for-of37.symbols +++ b/tests/baselines/reference/for-of37.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of37.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of37.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, 1837, 1), Decl(lib.d.ts, 1859, 11)) +>Map : Symbol(Map, Decl(lib.d.ts, 1867, 1), Decl(lib.d.ts, 1889, 11)) for (var v of map) { >v : Symbol(v, Decl(for-of37.ts, 1, 8)) diff --git a/tests/baselines/reference/for-of38.symbols b/tests/baselines/reference/for-of38.symbols index 5ee81f2eb15..fab42d91724 100644 --- a/tests/baselines/reference/for-of38.symbols +++ b/tests/baselines/reference/for-of38.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of38.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of38.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, 1837, 1), Decl(lib.d.ts, 1859, 11)) +>Map : Symbol(Map, Decl(lib.d.ts, 1867, 1), Decl(lib.d.ts, 1889, 11)) for (var [k, v] of map) { >k : Symbol(k, Decl(for-of38.ts, 1, 10)) diff --git a/tests/baselines/reference/for-of40.symbols b/tests/baselines/reference/for-of40.symbols index a9c0b3fbc30..1cd3538f987 100644 --- a/tests/baselines/reference/for-of40.symbols +++ b/tests/baselines/reference/for-of40.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of40.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of40.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, 1837, 1), Decl(lib.d.ts, 1859, 11)) +>Map : Symbol(Map, Decl(lib.d.ts, 1867, 1), Decl(lib.d.ts, 1889, 11)) for (var [k = "", v = false] of map) { >k : Symbol(k, Decl(for-of40.ts, 1, 10)) diff --git a/tests/baselines/reference/for-of44.symbols b/tests/baselines/reference/for-of44.symbols index e01aad51d54..9c6afa04adb 100644 --- a/tests/baselines/reference/for-of44.symbols +++ b/tests/baselines/reference/for-of44.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of44.ts === var array: [number, string | boolean | symbol][] = [[0, ""], [0, true], [1, Symbol()]] >array : Symbol(array, Decl(for-of44.ts, 0, 3)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) for (var [num, strBoolSym] of array) { >num : Symbol(num, Decl(for-of44.ts, 1, 10)) diff --git a/tests/baselines/reference/for-of45.symbols b/tests/baselines/reference/for-of45.symbols index e86ee110362..9fda4cb4e0a 100644 --- a/tests/baselines/reference/for-of45.symbols +++ b/tests/baselines/reference/for-of45.symbols @@ -5,7 +5,7 @@ var k: string, v: boolean; var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of45.ts, 1, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, 1837, 1), Decl(lib.d.ts, 1859, 11)) +>Map : Symbol(Map, Decl(lib.d.ts, 1867, 1), Decl(lib.d.ts, 1889, 11)) for ([k = "", v = false] of map) { >k : Symbol(k, Decl(for-of45.ts, 0, 3)) diff --git a/tests/baselines/reference/for-of50.symbols b/tests/baselines/reference/for-of50.symbols index 9076f63300e..c176e1aca0c 100644 --- a/tests/baselines/reference/for-of50.symbols +++ b/tests/baselines/reference/for-of50.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of50.ts === var map = new Map([["", true]]); >map : Symbol(map, Decl(for-of50.ts, 0, 3)) ->Map : Symbol(Map, Decl(lib.d.ts, 1837, 1), Decl(lib.d.ts, 1859, 11)) +>Map : Symbol(Map, Decl(lib.d.ts, 1867, 1), Decl(lib.d.ts, 1889, 11)) for (const [k, v] of map) { >k : Symbol(k, Decl(for-of50.ts, 1, 12)) diff --git a/tests/baselines/reference/for-of57.symbols b/tests/baselines/reference/for-of57.symbols index 60e87b25587..27aed0777ba 100644 --- a/tests/baselines/reference/for-of57.symbols +++ b/tests/baselines/reference/for-of57.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/for-ofStatements/for-of57.ts === var iter: Iterable; >iter : Symbol(iter, Decl(for-of57.ts, 0, 3)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1633, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 1663, 1)) for (let num of iter) { } >num : Symbol(num, Decl(for-of57.ts, 1, 8)) diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js index 2282136be3a..b00e8acef14 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js @@ -54,7 +54,7 @@ for(var m: typeof M;;){} for( var m = M.A;;){} //// [forStatementsMultipleInvalidDecl.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/functionImplementationErrors.js b/tests/baselines/reference/functionImplementationErrors.js index 5eaf9027335..6c1daffdaf1 100644 --- a/tests/baselines/reference/functionImplementationErrors.js +++ b/tests/baselines/reference/functionImplementationErrors.js @@ -74,7 +74,7 @@ var f13 = () => { //// [functionImplementationErrors.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/functionImplementations.js b/tests/baselines/reference/functionImplementations.js index c478f892fd5..0370c4c0027 100644 --- a/tests/baselines/reference/functionImplementations.js +++ b/tests/baselines/reference/functionImplementations.js @@ -157,7 +157,7 @@ var f12: (x: number) => any = x => { // should be (x: number) => Base | AnotherC } //// [functionImplementations.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs.js b/tests/baselines/reference/functionSubtypingOfVarArgs.js index c527ca9696a..b0168975677 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs.js +++ b/tests/baselines/reference/functionSubtypingOfVarArgs.js @@ -15,7 +15,7 @@ class StringEvent extends EventBase { // should work //// [functionSubtypingOfVarArgs.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/functionSubtypingOfVarArgs2.js b/tests/baselines/reference/functionSubtypingOfVarArgs2.js index e11c03404a9..7efd35cc2d2 100644 --- a/tests/baselines/reference/functionSubtypingOfVarArgs2.js +++ b/tests/baselines/reference/functionSubtypingOfVarArgs2.js @@ -15,7 +15,7 @@ class StringEvent extends EventBase { //// [functionSubtypingOfVarArgs2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/generatedContextualTyping.js b/tests/baselines/reference/generatedContextualTyping.js index a88929669fd..3c2c704ddb0 100644 --- a/tests/baselines/reference/generatedContextualTyping.js +++ b/tests/baselines/reference/generatedContextualTyping.js @@ -355,7 +355,7 @@ var x355 = function(n: (s: Base[]) => any) { }; x355(n => { var n: Base[]; retur var x356 = function(n: Genric) { }; x356({ func: n => { return [d1, d2]; } }); //// [generatedContextualTyping.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty.js b/tests/baselines/reference/genericBaseClassLiteralProperty.js index bde7fa69302..5e365531461 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty.js +++ b/tests/baselines/reference/genericBaseClassLiteralProperty.js @@ -13,7 +13,7 @@ class SubClass extends BaseClass { } //// [genericBaseClassLiteralProperty.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericBaseClassLiteralProperty2.js b/tests/baselines/reference/genericBaseClassLiteralProperty2.js index f558f424302..8a19d857bb6 100644 --- a/tests/baselines/reference/genericBaseClassLiteralProperty2.js +++ b/tests/baselines/reference/genericBaseClassLiteralProperty2.js @@ -16,7 +16,7 @@ class DataView2 extends BaseCollection2 { //// [genericBaseClassLiteralProperty2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js index be6ef0e4124..f00468dcbc5 100644 --- a/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js +++ b/tests/baselines/reference/genericCallWithConstraintsTypeArgumentInference.js @@ -109,7 +109,7 @@ var r11 = i.foo8(); // Base //// [genericCallWithConstraintsTypeArgumentInference.js] // Basic type inference with generic calls and constraints, no errors expected -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgs2.js b/tests/baselines/reference/genericCallWithObjectTypeArgs2.js index 3a72feff979..910e3860b49 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgs2.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgs2.js @@ -33,7 +33,7 @@ var i: I; var r4 = f2(i); // Base => Derived //// [genericCallWithObjectTypeArgs2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js index c1f0945ba10..9cb2425f9d0 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints2.js @@ -41,7 +41,7 @@ var r7 = f3(null, x => x); // any //// [genericCallWithObjectTypeArgsAndConstraints2.js] // Generic call with constraints infering type parameter from object member properties // No errors expected -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js index b9c722f80be..3c5a4c24b53 100644 --- a/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js +++ b/tests/baselines/reference/genericCallWithObjectTypeArgsAndConstraints3.js @@ -39,7 +39,7 @@ var r6 = f3(x => x, null); //// [genericCallWithObjectTypeArgsAndConstraints3.js] // Generic call with constraints infering type parameter from object member properties -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericCallbacksAndClassHierarchy.js b/tests/baselines/reference/genericCallbacksAndClassHierarchy.js index e63c7a98272..16abb2683e7 100644 --- a/tests/baselines/reference/genericCallbacksAndClassHierarchy.js +++ b/tests/baselines/reference/genericCallbacksAndClassHierarchy.js @@ -24,7 +24,7 @@ module M { } //// [genericCallbacksAndClassHierarchy.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js index 489ecd0f059..22bb975e7d7 100644 --- a/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js +++ b/tests/baselines/reference/genericClassInheritsConstructorFromNonGenericClass.js @@ -6,7 +6,7 @@ class C { } //// [genericClassInheritsConstructorFromNonGenericClass.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js index 4f26e35d1b0..43d1e53a615 100644 --- a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js +++ b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js @@ -76,7 +76,7 @@ class ViewModel implements Contract { //// [genericClassPropertyInheritanceSpecialization.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericClassStaticMethod.js b/tests/baselines/reference/genericClassStaticMethod.js index 71dafd8ee8b..23e1874c0ed 100644 --- a/tests/baselines/reference/genericClassStaticMethod.js +++ b/tests/baselines/reference/genericClassStaticMethod.js @@ -11,7 +11,7 @@ class Bar extends Foo { //// [genericClassStaticMethod.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericClasses3.js b/tests/baselines/reference/genericClasses3.js index 621142c2e9a..373052d78e3 100644 --- a/tests/baselines/reference/genericClasses3.js +++ b/tests/baselines/reference/genericClasses3.js @@ -18,7 +18,7 @@ var z = v2.b; //// [genericClasses3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js index e2babf511b4..561c24cd50e 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes.js @@ -27,7 +27,7 @@ module EndGate.Tweening { } //// [genericConstraintOnExtendedBuiltinTypes.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js index ccbbf9d11a6..2420e082e3d 100644 --- a/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js +++ b/tests/baselines/reference/genericConstraintOnExtendedBuiltinTypes2.js @@ -26,7 +26,7 @@ module EndGate.Tweening { } //// [genericConstraintOnExtendedBuiltinTypes2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js index 7f639415490..69ae509bf54 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase.js @@ -13,7 +13,7 @@ x = y; // error //// [genericDerivedTypeWithSpecializedBase.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js index 4b28d4b7f1c..1c4f27b5ebe 100644 --- a/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js +++ b/tests/baselines/reference/genericDerivedTypeWithSpecializedBase2.js @@ -13,7 +13,7 @@ x = y; // error //// [genericDerivedTypeWithSpecializedBase2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericPrototypeProperty2.js b/tests/baselines/reference/genericPrototypeProperty2.js index 9a48ef679dc..b91b345481e 100644 --- a/tests/baselines/reference/genericPrototypeProperty2.js +++ b/tests/baselines/reference/genericPrototypeProperty2.js @@ -16,7 +16,7 @@ class MyEventWrapper extends BaseEventWrapper { } //// [genericPrototypeProperty2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericPrototypeProperty3.js b/tests/baselines/reference/genericPrototypeProperty3.js index 522b3a11e1b..de093886ea4 100644 --- a/tests/baselines/reference/genericPrototypeProperty3.js +++ b/tests/baselines/reference/genericPrototypeProperty3.js @@ -15,7 +15,7 @@ class MyEventWrapper extends BaseEventWrapper { } //// [genericPrototypeProperty3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js index 4d5c6810f75..b73239626d0 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors2.js @@ -27,7 +27,7 @@ module TypeScript2 { //// [genericRecursiveImplicitConstructorErrors2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js index e01c9045345..0d4a3315acd 100644 --- a/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js +++ b/tests/baselines/reference/genericRecursiveImplicitConstructorErrors3.js @@ -31,7 +31,7 @@ module TypeScript { //// [genericRecursiveImplicitConstructorErrors3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericTypeAssertions2.js b/tests/baselines/reference/genericTypeAssertions2.js index 3c904c7a30e..a3b88f599b9 100644 --- a/tests/baselines/reference/genericTypeAssertions2.js +++ b/tests/baselines/reference/genericTypeAssertions2.js @@ -14,7 +14,7 @@ var r4: A = >new A(); var r5: A = >[]; // error //// [genericTypeAssertions2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericTypeAssertions4.js b/tests/baselines/reference/genericTypeAssertions4.js index a607fb07428..95ca5482b2e 100644 --- a/tests/baselines/reference/genericTypeAssertions4.js +++ b/tests/baselines/reference/genericTypeAssertions4.js @@ -26,7 +26,7 @@ function foo2(x: T) { } //// [genericTypeAssertions4.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericTypeAssertions6.js b/tests/baselines/reference/genericTypeAssertions6.js index d6061d8cf0a..d19da506680 100644 --- a/tests/baselines/reference/genericTypeAssertions6.js +++ b/tests/baselines/reference/genericTypeAssertions6.js @@ -25,7 +25,7 @@ var b: B; var c: A = >b; //// [genericTypeAssertions6.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js index 4be1cce27a9..5ec0a25af3d 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js @@ -40,7 +40,7 @@ var k = null; //// [genericTypeReferenceWithoutTypeArgument.js] // it is an error to use a generic type without type arguments // all of these are errors -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js index 803d499705a..2f36a74de76 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js @@ -40,7 +40,7 @@ var k = null; //// [genericTypeReferenceWithoutTypeArgument2.js] // it is an error to use a generic type without type arguments // all of these are errors -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js index fdd2e470a55..8142cd86407 100644 --- a/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js +++ b/tests/baselines/reference/genericWithIndexerOfTypeParameterType2.js @@ -15,7 +15,7 @@ export class ListItem extends CollectionItem { //// [genericWithIndexerOfTypeParameterType2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/heterogeneousArrayLiterals.js b/tests/baselines/reference/heterogeneousArrayLiterals.js index 4ac929305c0..26d1b09a6fc 100644 --- a/tests/baselines/reference/heterogeneousArrayLiterals.js +++ b/tests/baselines/reference/heterogeneousArrayLiterals.js @@ -133,7 +133,7 @@ function foo4(t: T, u: U) { //// [heterogeneousArrayLiterals.js] // type of an array is the best common type of its elements (plus its contextual type if it exists) -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/ifDoWhileStatements.js b/tests/baselines/reference/ifDoWhileStatements.js index 793094584bf..d389f705707 100644 --- a/tests/baselines/reference/ifDoWhileStatements.js +++ b/tests/baselines/reference/ifDoWhileStatements.js @@ -163,7 +163,7 @@ do { }while(fn) //// [ifDoWhileStatements.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/illegalSuperCallsInConstructor.js b/tests/baselines/reference/illegalSuperCallsInConstructor.js index 0bdcebed9c5..57a382fe625 100644 --- a/tests/baselines/reference/illegalSuperCallsInConstructor.js +++ b/tests/baselines/reference/illegalSuperCallsInConstructor.js @@ -21,7 +21,7 @@ class Derived extends Base { } //// [illegalSuperCallsInConstructor.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/implementClausePrecedingExtends.js b/tests/baselines/reference/implementClausePrecedingExtends.js index e8f0b96f485..7501c231dc8 100644 --- a/tests/baselines/reference/implementClausePrecedingExtends.js +++ b/tests/baselines/reference/implementClausePrecedingExtends.js @@ -3,7 +3,7 @@ class C { foo: number } class D implements C extends C { } //// [implementClausePrecedingExtends.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js index 767851fd16d..3d80d344850 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithPrivates2.js @@ -86,7 +86,7 @@ module M2 { } //// [implementingAnInterfaceExtendingClassWithPrivates2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js index 1a79496bd12..1fa40bf7aa2 100644 --- a/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js +++ b/tests/baselines/reference/implementingAnInterfaceExtendingClassWithProtecteds.js @@ -42,7 +42,7 @@ class Bar8 extends Foo implements I { //// [implementingAnInterfaceExtendingClassWithProtecteds.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/importAsBaseClass.js b/tests/baselines/reference/importAsBaseClass.js index 8114e88ca4b..24f7e0477d6 100644 --- a/tests/baselines/reference/importAsBaseClass.js +++ b/tests/baselines/reference/importAsBaseClass.js @@ -19,7 +19,7 @@ var Greeter = (function () { })(); exports.Greeter = Greeter; //// [importAsBaseClass_1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/importShadowsGlobalName.js b/tests/baselines/reference/importShadowsGlobalName.js index 0f673097dc2..6db46eb41b1 100644 --- a/tests/baselines/reference/importShadowsGlobalName.js +++ b/tests/baselines/reference/importShadowsGlobalName.js @@ -20,7 +20,7 @@ define(["require", "exports"], function (require, exports) { return Foo; }); //// [Bar.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/importUsedInExtendsList1.js b/tests/baselines/reference/importUsedInExtendsList1.js index 3c9f296d2c2..3e07ee084f3 100644 --- a/tests/baselines/reference/importUsedInExtendsList1.js +++ b/tests/baselines/reference/importUsedInExtendsList1.js @@ -19,7 +19,7 @@ var Super = (function () { })(); exports.Super = Super; //// [importUsedInExtendsList1_1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/indexerConstraints2.js b/tests/baselines/reference/indexerConstraints2.js index df5dbf22f35..7d3966688db 100644 --- a/tests/baselines/reference/indexerConstraints2.js +++ b/tests/baselines/reference/indexerConstraints2.js @@ -29,7 +29,7 @@ class K extends J { } //// [indexerConstraints2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/indirectSelfReference.js b/tests/baselines/reference/indirectSelfReference.js index eb5503c4db9..3652d2962d0 100644 --- a/tests/baselines/reference/indirectSelfReference.js +++ b/tests/baselines/reference/indirectSelfReference.js @@ -3,7 +3,7 @@ class a extends b{ } class b extends a{ } //// [indirectSelfReference.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/indirectSelfReferenceGeneric.js b/tests/baselines/reference/indirectSelfReferenceGeneric.js index eb861bcf294..079a37dc201 100644 --- a/tests/baselines/reference/indirectSelfReferenceGeneric.js +++ b/tests/baselines/reference/indirectSelfReferenceGeneric.js @@ -3,7 +3,7 @@ class a extends b { } class b extends a { } //// [indirectSelfReferenceGeneric.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js index cc80c0b43ce..71390b03c83 100644 --- a/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js +++ b/tests/baselines/reference/infinitelyExpandingTypesNonGenericBase.js @@ -25,7 +25,7 @@ o(A); //// [infinitelyExpandingTypesNonGenericBase.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritFromGenericTypeParameter.js b/tests/baselines/reference/inheritFromGenericTypeParameter.js index 8611563af69..ccf445a26bf 100644 --- a/tests/baselines/reference/inheritFromGenericTypeParameter.js +++ b/tests/baselines/reference/inheritFromGenericTypeParameter.js @@ -3,7 +3,7 @@ class C extends T { } interface I extends T { } //// [inheritFromGenericTypeParameter.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js index b201108a7e2..850741c3666 100644 --- a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js +++ b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromSameOrigin.js @@ -11,7 +11,7 @@ interface A extends C, C2 { // ok } //// [inheritSameNamePrivatePropertiesFromSameOrigin.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritance.js b/tests/baselines/reference/inheritance.js index f7a274b1990..f2b5be9335e 100644 --- a/tests/baselines/reference/inheritance.js +++ b/tests/baselines/reference/inheritance.js @@ -35,7 +35,7 @@ class Baad extends Good { //// [inheritance.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritance1.js b/tests/baselines/reference/inheritance1.js index f00a46922bf..e0d4fa974c5 100644 --- a/tests/baselines/reference/inheritance1.js +++ b/tests/baselines/reference/inheritance1.js @@ -62,7 +62,7 @@ l1 = sc; l1 = c; //// [inheritance1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js index 4544df2dcf2..0f016233ef3 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollision.js @@ -11,7 +11,7 @@ class C extends B { //// [inheritanceGrandParentPrivateMemberCollision.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js index df6e5943173..596982a4794 100644 --- a/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js +++ b/tests/baselines/reference/inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js @@ -11,7 +11,7 @@ class C extends B { //// [inheritanceGrandParentPrivateMemberCollisionWithPublicMember.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js index 682a8ab4402..ec8ae03b3e3 100644 --- a/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js +++ b/tests/baselines/reference/inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js @@ -11,7 +11,7 @@ class C extends B { //// [inheritanceGrandParentPublicMemberCollisionWithPrivateMember.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js index d1eb53c4ec7..2da2bcbe6fe 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingAccessor.js @@ -18,7 +18,7 @@ class b extends a { } //// [inheritanceMemberAccessorOverridingAccessor.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js index d234eb89582..8b58a7f2b35 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingMethod.js @@ -15,7 +15,7 @@ class b extends a { } //// [inheritanceMemberAccessorOverridingMethod.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js index b307f3bfedb..1864e62b237 100644 --- a/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberAccessorOverridingProperty.js @@ -13,7 +13,7 @@ class b extends a { } //// [inheritanceMemberAccessorOverridingProperty.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js index e05ed9633cc..0b24db92a35 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingAccessor.js @@ -15,7 +15,7 @@ class b extends a { } //// [inheritanceMemberFuncOverridingAccessor.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js index 747a56b3b3b..bf1186a5cde 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingMethod.js @@ -12,7 +12,7 @@ class b extends a { } //// [inheritanceMemberFuncOverridingMethod.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js b/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js index 1f33f0dfb07..2ecf7edb0e8 100644 --- a/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberFuncOverridingProperty.js @@ -10,7 +10,7 @@ class b extends a { } //// [inheritanceMemberFuncOverridingProperty.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js index 7d92b494416..512ca023dee 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingAccessor.js @@ -14,7 +14,7 @@ class b extends a { } //// [inheritanceMemberPropertyOverridingAccessor.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js index cf0f4b0b58c..975727031e3 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingMethod.js @@ -10,7 +10,7 @@ class b extends a { } //// [inheritanceMemberPropertyOverridingMethod.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js index 8cfd68eb30d..b924932e0b4 100644 --- a/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js +++ b/tests/baselines/reference/inheritanceMemberPropertyOverridingProperty.js @@ -8,7 +8,7 @@ class b extends a { } //// [inheritanceMemberPropertyOverridingProperty.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js index 7c1eb291327..d62c62410b7 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod1.js @@ -8,7 +8,7 @@ var b3 = new B(); // error, could not select overload for 'new' expression //// [inheritanceOfGenericConstructorMethod1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js index 0db872e52dd..c54f8b4d317 100644 --- a/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js +++ b/tests/baselines/reference/inheritanceOfGenericConstructorMethod2.js @@ -15,7 +15,7 @@ var n3 = new N.D2(); // no error, D2 //// [inheritanceOfGenericConstructorMethod2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js index f7ed912d030..120efc11e27 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingAccessor.js @@ -18,7 +18,7 @@ class b extends a { } //// [inheritanceStaticAccessorOverridingAccessor.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js index dbef001740e..7200f37f94b 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingMethod.js @@ -15,7 +15,7 @@ class b extends a { } //// [inheritanceStaticAccessorOverridingMethod.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js index 3536ca8accb..2fd5e18dab9 100644 --- a/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticAccessorOverridingProperty.js @@ -13,7 +13,7 @@ class b extends a { } //// [inheritanceStaticAccessorOverridingProperty.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js index b3cc7d3461e..812ac57bfe4 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessor.js @@ -15,7 +15,7 @@ class b extends a { } //// [inheritanceStaticFuncOverridingAccessor.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js index bb77561153e..224c0326a87 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingAccessorOfFuncType.js @@ -12,7 +12,7 @@ class b extends a { } //// [inheritanceStaticFuncOverridingAccessorOfFuncType.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js b/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js index e05a5b245cd..375f07fd905 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingMethod.js @@ -12,7 +12,7 @@ class b extends a { } //// [inheritanceStaticFuncOverridingMethod.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js b/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js index cc8f081f1c6..c4d3f7ca420 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingProperty.js @@ -10,7 +10,7 @@ class b extends a { } //// [inheritanceStaticFuncOverridingProperty.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js b/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js index 3eb016b1e09..f9513f68585 100644 --- a/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js +++ b/tests/baselines/reference/inheritanceStaticFuncOverridingPropertyOfFuncType.js @@ -10,7 +10,7 @@ class b extends a { } //// [inheritanceStaticFuncOverridingPropertyOfFuncType.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js index 3585fbc3532..f64615e8a7c 100644 --- a/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js +++ b/tests/baselines/reference/inheritanceStaticFunctionOverridingInstanceProperty.js @@ -10,7 +10,7 @@ class b extends a { } //// [inheritanceStaticFunctionOverridingInstanceProperty.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceStaticMembersCompatible.js b/tests/baselines/reference/inheritanceStaticMembersCompatible.js index 5fe4a2d002d..f1e288c57f5 100644 --- a/tests/baselines/reference/inheritanceStaticMembersCompatible.js +++ b/tests/baselines/reference/inheritanceStaticMembersCompatible.js @@ -8,7 +8,7 @@ class b extends a { } //// [inheritanceStaticMembersCompatible.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceStaticMembersIncompatible.js b/tests/baselines/reference/inheritanceStaticMembersIncompatible.js index 48b54dd47d3..66ad8612538 100644 --- a/tests/baselines/reference/inheritanceStaticMembersIncompatible.js +++ b/tests/baselines/reference/inheritanceStaticMembersIncompatible.js @@ -8,7 +8,7 @@ class b extends a { } //// [inheritanceStaticMembersIncompatible.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js index da3a42eafe1..310f2127e7e 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingAccessor.js @@ -12,7 +12,7 @@ class b extends a { } //// [inheritanceStaticPropertyOverridingAccessor.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js index db25abeafd9..3e8a444d772 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingMethod.js @@ -10,7 +10,7 @@ class b extends a { } //// [inheritanceStaticPropertyOverridingMethod.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js b/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js index f75becd518c..088cfa9b1f9 100644 --- a/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js +++ b/tests/baselines/reference/inheritanceStaticPropertyOverridingProperty.js @@ -8,7 +8,7 @@ class b extends a { } //// [inheritanceStaticPropertyOverridingProperty.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams.js b/tests/baselines/reference/inheritedConstructorWithRestParams.js index b924fe25db9..45f4fe72535 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams.js +++ b/tests/baselines/reference/inheritedConstructorWithRestParams.js @@ -15,7 +15,7 @@ new Derived("", 3); new Derived(3); //// [inheritedConstructorWithRestParams.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritedConstructorWithRestParams2.js b/tests/baselines/reference/inheritedConstructorWithRestParams2.js index 2c59c91dde7..eeb0413d1ec 100644 --- a/tests/baselines/reference/inheritedConstructorWithRestParams2.js +++ b/tests/baselines/reference/inheritedConstructorWithRestParams2.js @@ -35,7 +35,7 @@ new Derived("", 3, "", 3); new Derived("", 3, "", ""); //// [inheritedConstructorWithRestParams2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/inheritedModuleMembersForClodule.js b/tests/baselines/reference/inheritedModuleMembersForClodule.js index 0c9bcd81905..75a2f13fed7 100644 --- a/tests/baselines/reference/inheritedModuleMembersForClodule.js +++ b/tests/baselines/reference/inheritedModuleMembersForClodule.js @@ -22,7 +22,7 @@ class E extends D { //// [inheritedModuleMembersForClodule.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js index 7ab3b4a0aa3..9e8e6d26b31 100644 --- a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js @@ -43,7 +43,7 @@ module Generic { } //// [instancePropertiesInheritedIntoClassType.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/instanceSubtypeCheck2.js b/tests/baselines/reference/instanceSubtypeCheck2.js index f2b709194b3..e02a2b2afad 100644 --- a/tests/baselines/reference/instanceSubtypeCheck2.js +++ b/tests/baselines/reference/instanceSubtypeCheck2.js @@ -8,7 +8,7 @@ class C2 extends C1 { } //// [instanceSubtypeCheck2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/instantiatedReturnTypeContravariance.js b/tests/baselines/reference/instantiatedReturnTypeContravariance.js index 6b84c40d8fd..678f324797f 100644 --- a/tests/baselines/reference/instantiatedReturnTypeContravariance.js +++ b/tests/baselines/reference/instantiatedReturnTypeContravariance.js @@ -31,7 +31,7 @@ return null; //// [instantiatedReturnTypeContravariance.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/interfaceExtendsClass1.js b/tests/baselines/reference/interfaceExtendsClass1.js index d376f2dca98..5e72b36ef30 100644 --- a/tests/baselines/reference/interfaceExtendsClass1.js +++ b/tests/baselines/reference/interfaceExtendsClass1.js @@ -19,7 +19,7 @@ class Location { //// [interfaceExtendsClass1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js index 521a71199ad..dac502b9ca3 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js @@ -28,7 +28,7 @@ c = d; d = c; // error //// [interfaceExtendsClassWithPrivate1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js index c177f2e7a90..c6a11c1d3ab 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js @@ -24,7 +24,7 @@ class D2 extends C implements I { // error } //// [interfaceExtendsClassWithPrivate2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/interfaceImplementation8.js b/tests/baselines/reference/interfaceImplementation8.js index e6848b5baf9..64b4c453829 100644 --- a/tests/baselines/reference/interfaceImplementation8.js +++ b/tests/baselines/reference/interfaceImplementation8.js @@ -41,7 +41,7 @@ class C8 extends C7 implements i2{ //// [interfaceImplementation8.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js index 077d7ddbcdc..4b3ab1b6d88 100644 --- a/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js +++ b/tests/baselines/reference/invalidModuleWithStatementsOfEveryKind.js @@ -80,7 +80,7 @@ module YYY4 { //// [invalidModuleWithStatementsOfEveryKind.js] // All of these should be an error -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/invalidMultipleVariableDeclarations.js b/tests/baselines/reference/invalidMultipleVariableDeclarations.js index 824bee92227..31d0e44c918 100644 --- a/tests/baselines/reference/invalidMultipleVariableDeclarations.js +++ b/tests/baselines/reference/invalidMultipleVariableDeclarations.js @@ -54,7 +54,7 @@ var m: typeof M; var m = M.A; //// [invalidMultipleVariableDeclarations.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/invalidReturnStatements.js b/tests/baselines/reference/invalidReturnStatements.js index d637158780a..50977334f4c 100644 --- a/tests/baselines/reference/invalidReturnStatements.js +++ b/tests/baselines/reference/invalidReturnStatements.js @@ -21,7 +21,7 @@ function fn11(): D { return new C(); } //// [invalidReturnStatements.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/iterableArrayPattern1.symbols b/tests/baselines/reference/iterableArrayPattern1.symbols index ae0acb823a0..c6025123179 100644 --- a/tests/baselines/reference/iterableArrayPattern1.symbols +++ b/tests/baselines/reference/iterableArrayPattern1.symbols @@ -13,7 +13,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iterableArrayPattern1.ts, 3, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) done: false >done : Symbol(done, Decl(iterableArrayPattern1.ts, 4, 28)) @@ -23,7 +23,7 @@ class SymbolIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/iterableArrayPattern11.symbols b/tests/baselines/reference/iterableArrayPattern11.symbols index 38a9b18e2d1..07b1fb52af8 100644 --- a/tests/baselines/reference/iterableArrayPattern11.symbols +++ b/tests/baselines/reference/iterableArrayPattern11.symbols @@ -37,7 +37,7 @@ class FooIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/iterableArrayPattern12.symbols b/tests/baselines/reference/iterableArrayPattern12.symbols index 118bea4d0b4..001cb99b486 100644 --- a/tests/baselines/reference/iterableArrayPattern12.symbols +++ b/tests/baselines/reference/iterableArrayPattern12.symbols @@ -37,7 +37,7 @@ class FooIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/iterableArrayPattern13.symbols b/tests/baselines/reference/iterableArrayPattern13.symbols index 832d8ecf69c..7085fd224f4 100644 --- a/tests/baselines/reference/iterableArrayPattern13.symbols +++ b/tests/baselines/reference/iterableArrayPattern13.symbols @@ -36,7 +36,7 @@ class FooIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/iterableArrayPattern2.symbols b/tests/baselines/reference/iterableArrayPattern2.symbols index 0f4e7682235..09a6984cb3c 100644 --- a/tests/baselines/reference/iterableArrayPattern2.symbols +++ b/tests/baselines/reference/iterableArrayPattern2.symbols @@ -13,7 +13,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iterableArrayPattern2.ts, 3, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) done: false >done : Symbol(done, Decl(iterableArrayPattern2.ts, 4, 28)) @@ -23,7 +23,7 @@ class SymbolIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/iterableArrayPattern3.symbols b/tests/baselines/reference/iterableArrayPattern3.symbols index 32907a90b20..4ee65a10825 100644 --- a/tests/baselines/reference/iterableArrayPattern3.symbols +++ b/tests/baselines/reference/iterableArrayPattern3.symbols @@ -38,7 +38,7 @@ class FooIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/iterableArrayPattern30.symbols b/tests/baselines/reference/iterableArrayPattern30.symbols index d291c3b128b..0f50713b43d 100644 --- a/tests/baselines/reference/iterableArrayPattern30.symbols +++ b/tests/baselines/reference/iterableArrayPattern30.symbols @@ -4,5 +4,5 @@ const [[k1, v1], [k2, v2]] = new Map([["", true], ["hello", true]]) >v1 : Symbol(v1, Decl(iterableArrayPattern30.ts, 0, 11)) >k2 : Symbol(k2, Decl(iterableArrayPattern30.ts, 0, 18)) >v2 : Symbol(v2, Decl(iterableArrayPattern30.ts, 0, 21)) ->Map : Symbol(Map, Decl(lib.d.ts, 1837, 1), Decl(lib.d.ts, 1859, 11)) +>Map : Symbol(Map, Decl(lib.d.ts, 1867, 1), Decl(lib.d.ts, 1889, 11)) diff --git a/tests/baselines/reference/iterableArrayPattern4.symbols b/tests/baselines/reference/iterableArrayPattern4.symbols index 473262707b0..aa5ce5783a0 100644 --- a/tests/baselines/reference/iterableArrayPattern4.symbols +++ b/tests/baselines/reference/iterableArrayPattern4.symbols @@ -38,7 +38,7 @@ class FooIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/iterableArrayPattern9.symbols b/tests/baselines/reference/iterableArrayPattern9.symbols index 7e188f1c94e..01cfba0f09e 100644 --- a/tests/baselines/reference/iterableArrayPattern9.symbols +++ b/tests/baselines/reference/iterableArrayPattern9.symbols @@ -33,7 +33,7 @@ class FooIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/iterableContextualTyping1.symbols b/tests/baselines/reference/iterableContextualTyping1.symbols index 90b025ddbb0..76d94dc2923 100644 --- a/tests/baselines/reference/iterableContextualTyping1.symbols +++ b/tests/baselines/reference/iterableContextualTyping1.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/expressions/contextualTyping/iterableContextualTyping1.ts === var iter: Iterable<(x: string) => number> = [s => s.length]; >iter : Symbol(iter, Decl(iterableContextualTyping1.ts, 0, 3)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1633, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 1663, 1)) >x : Symbol(x, Decl(iterableContextualTyping1.ts, 0, 20)) >s : Symbol(s, Decl(iterableContextualTyping1.ts, 0, 45)) >s.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) diff --git a/tests/baselines/reference/iteratorSpreadInArray.symbols b/tests/baselines/reference/iteratorSpreadInArray.symbols index c535fe5426f..f53e8266baa 100644 --- a/tests/baselines/reference/iteratorSpreadInArray.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray.symbols @@ -12,7 +12,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray.ts, 4, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray.ts, 5, 28)) @@ -22,7 +22,7 @@ class SymbolIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/iteratorSpreadInArray11.symbols b/tests/baselines/reference/iteratorSpreadInArray11.symbols index 7df50594c22..b128803aa50 100644 --- a/tests/baselines/reference/iteratorSpreadInArray11.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray11.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/spread/iteratorSpreadInArray11.ts === var iter: Iterable; >iter : Symbol(iter, Decl(iteratorSpreadInArray11.ts, 0, 3)) ->Iterable : Symbol(Iterable, Decl(lib.d.ts, 1633, 1)) +>Iterable : Symbol(Iterable, Decl(lib.d.ts, 1663, 1)) var array = [...iter]; >array : Symbol(array, Decl(iteratorSpreadInArray11.ts, 1, 3)) diff --git a/tests/baselines/reference/iteratorSpreadInArray2.symbols b/tests/baselines/reference/iteratorSpreadInArray2.symbols index 48f2f853db8..db8da1bac9d 100644 --- a/tests/baselines/reference/iteratorSpreadInArray2.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray2.symbols @@ -13,7 +13,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray2.ts, 4, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray2.ts, 5, 28)) @@ -23,7 +23,7 @@ class SymbolIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; @@ -49,7 +49,7 @@ class NumberIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/iteratorSpreadInArray3.symbols b/tests/baselines/reference/iteratorSpreadInArray3.symbols index b55f8e415ff..bdc200c25ec 100644 --- a/tests/baselines/reference/iteratorSpreadInArray3.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray3.symbols @@ -12,7 +12,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray3.ts, 4, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray3.ts, 5, 28)) @@ -22,7 +22,7 @@ class SymbolIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/iteratorSpreadInArray4.symbols b/tests/baselines/reference/iteratorSpreadInArray4.symbols index a1cba88d942..c49ea74dc23 100644 --- a/tests/baselines/reference/iteratorSpreadInArray4.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray4.symbols @@ -12,7 +12,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray4.ts, 4, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray4.ts, 5, 28)) @@ -22,7 +22,7 @@ class SymbolIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/iteratorSpreadInArray7.symbols b/tests/baselines/reference/iteratorSpreadInArray7.symbols index c9b8bba1090..e7fbdac2264 100644 --- a/tests/baselines/reference/iteratorSpreadInArray7.symbols +++ b/tests/baselines/reference/iteratorSpreadInArray7.symbols @@ -17,7 +17,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInArray7.ts, 5, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) done: false >done : Symbol(done, Decl(iteratorSpreadInArray7.ts, 6, 28)) @@ -27,7 +27,7 @@ class SymbolIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/iteratorSpreadInCall11.symbols b/tests/baselines/reference/iteratorSpreadInCall11.symbols index fbc31e96020..54ac770c5df 100644 --- a/tests/baselines/reference/iteratorSpreadInCall11.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall11.symbols @@ -19,7 +19,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInCall11.ts, 6, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) done: false >done : Symbol(done, Decl(iteratorSpreadInCall11.ts, 7, 28)) @@ -29,7 +29,7 @@ class SymbolIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/iteratorSpreadInCall12.symbols b/tests/baselines/reference/iteratorSpreadInCall12.symbols index 66a8fc2f667..8b24ba5d1b7 100644 --- a/tests/baselines/reference/iteratorSpreadInCall12.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall12.symbols @@ -22,7 +22,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInCall12.ts, 8, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) done: false >done : Symbol(done, Decl(iteratorSpreadInCall12.ts, 9, 28)) @@ -32,7 +32,7 @@ class SymbolIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; @@ -58,7 +58,7 @@ class StringIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/iteratorSpreadInCall3.symbols b/tests/baselines/reference/iteratorSpreadInCall3.symbols index 121c10ec977..d43a7f9b4fc 100644 --- a/tests/baselines/reference/iteratorSpreadInCall3.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall3.symbols @@ -16,7 +16,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInCall3.ts, 5, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) done: false >done : Symbol(done, Decl(iteratorSpreadInCall3.ts, 6, 28)) @@ -26,7 +26,7 @@ class SymbolIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/iteratorSpreadInCall5.symbols b/tests/baselines/reference/iteratorSpreadInCall5.symbols index 5e88a2be8a1..9d86858eb8e 100644 --- a/tests/baselines/reference/iteratorSpreadInCall5.symbols +++ b/tests/baselines/reference/iteratorSpreadInCall5.symbols @@ -17,7 +17,7 @@ class SymbolIterator { return { value: Symbol(), >value : Symbol(value, Decl(iteratorSpreadInCall5.ts, 5, 16)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) done: false >done : Symbol(done, Decl(iteratorSpreadInCall5.ts, 6, 28)) @@ -27,7 +27,7 @@ class SymbolIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; @@ -53,7 +53,7 @@ class StringIterator { [Symbol.iterator]() { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) return this; diff --git a/tests/baselines/reference/lambdaArgCrash.js b/tests/baselines/reference/lambdaArgCrash.js index d3de40dcb0b..0f71ae803d6 100644 --- a/tests/baselines/reference/lambdaArgCrash.js +++ b/tests/baselines/reference/lambdaArgCrash.js @@ -35,7 +35,7 @@ class ItemSetEvent extends Event { //// [lambdaArgCrash.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/lift.js b/tests/baselines/reference/lift.js index 33f8200530b..eaaf94e7024 100644 --- a/tests/baselines/reference/lift.js +++ b/tests/baselines/reference/lift.js @@ -18,7 +18,7 @@ class C extends B { //// [lift.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/m7Bugs.js b/tests/baselines/reference/m7Bugs.js index bd5a0f24c61..72829316fb8 100644 --- a/tests/baselines/reference/m7Bugs.js +++ b/tests/baselines/reference/m7Bugs.js @@ -27,7 +27,7 @@ var y3: C1 = {}; //// [m7Bugs.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js index e9f16103535..389bbfa63dd 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates2.js @@ -32,7 +32,7 @@ var r = a.x; // error var r2 = a.w; // error //// [mergedInterfacesWithInheritedPrivates2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js index a58a62de267..d088aab3d3c 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.js @@ -39,7 +39,7 @@ module M { } //// [mergedInterfacesWithInheritedPrivates3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/missingDecoratorType.js b/tests/baselines/reference/missingDecoratorType.js index 974c884ecd1..4460abdc798 100644 --- a/tests/baselines/reference/missingDecoratorType.js +++ b/tests/baselines/reference/missingDecoratorType.js @@ -22,7 +22,7 @@ class C { //// [a.js] //// [b.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); diff --git a/tests/baselines/reference/moduleAsBaseType.js b/tests/baselines/reference/moduleAsBaseType.js index 2537611ddbc..c2246be8795 100644 --- a/tests/baselines/reference/moduleAsBaseType.js +++ b/tests/baselines/reference/moduleAsBaseType.js @@ -5,7 +5,7 @@ interface I extends M { } class C2 implements M { } //// [moduleAsBaseType.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js b/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js index 62518b7ae01..e8e08eed26c 100644 --- a/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js +++ b/tests/baselines/reference/moduleImportedForTypeArgumentPosition.js @@ -15,7 +15,7 @@ class Test1 extends C1 { define(["require", "exports"], function (require, exports) { }); //// [moduleImportedForTypeArgumentPosition_1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/moduleWithStatementsOfEveryKind.js b/tests/baselines/reference/moduleWithStatementsOfEveryKind.js index 8ce4cb693f7..6c0f625f986 100644 --- a/tests/baselines/reference/moduleWithStatementsOfEveryKind.js +++ b/tests/baselines/reference/moduleWithStatementsOfEveryKind.js @@ -59,7 +59,7 @@ module Y { //// [moduleWithStatementsOfEveryKind.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/multipleInheritance.js b/tests/baselines/reference/multipleInheritance.js index 269d5c2ea19..ea4a7156df9 100644 --- a/tests/baselines/reference/multipleInheritance.js +++ b/tests/baselines/reference/multipleInheritance.js @@ -39,7 +39,7 @@ class Baad extends Good { //// [multipleInheritance.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js index 76fd13aa320..9b3d6f31291 100644 --- a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js +++ b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js @@ -11,7 +11,7 @@ var test = new foo(); //// [mutuallyRecursiveGenericBaseTypes2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/noEmitHelpers.js b/tests/baselines/reference/noEmitHelpers.js new file mode 100644 index 00000000000..8db5cd862bf --- /dev/null +++ b/tests/baselines/reference/noEmitHelpers.js @@ -0,0 +1,19 @@ +//// [noEmitHelpers.ts] + +class A { } +class B extends A { } + + +//// [noEmitHelpers.js] +var A = (function () { + function A() { + } + return A; +})(); +var B = (function (_super) { + __extends(B, _super); + function B() { + _super.apply(this, arguments); + } + return B; +})(A); diff --git a/tests/baselines/reference/noEmitHelpers.symbols b/tests/baselines/reference/noEmitHelpers.symbols new file mode 100644 index 00000000000..efd281c812b --- /dev/null +++ b/tests/baselines/reference/noEmitHelpers.symbols @@ -0,0 +1,9 @@ +=== tests/cases/compiler/noEmitHelpers.ts === + +class A { } +>A : Symbol(A, Decl(noEmitHelpers.ts, 0, 0)) + +class B extends A { } +>B : Symbol(B, Decl(noEmitHelpers.ts, 1, 11)) +>A : Symbol(A, Decl(noEmitHelpers.ts, 0, 0)) + diff --git a/tests/baselines/reference/noEmitHelpers.types b/tests/baselines/reference/noEmitHelpers.types new file mode 100644 index 00000000000..d25bd88255c --- /dev/null +++ b/tests/baselines/reference/noEmitHelpers.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/noEmitHelpers.ts === + +class A { } +>A : A + +class B extends A { } +>B : B +>A : A + diff --git a/tests/baselines/reference/noEmitHelpers2.js b/tests/baselines/reference/noEmitHelpers2.js new file mode 100644 index 00000000000..1bd42377679 --- /dev/null +++ b/tests/baselines/reference/noEmitHelpers2.js @@ -0,0 +1,22 @@ +//// [noEmitHelpers2.ts] + +function decorator() { } + +@decorator +class A { + constructor(a: number, @decorator b: string) { + } +} + +//// [noEmitHelpers2.js] +function decorator() { } +var A = (function () { + function A(a, b) { + } + A = __decorate([ + decorator, + __param(1, decorator), + __metadata('design:paramtypes', [Number, String]) + ], A); + return A; +})(); diff --git a/tests/baselines/reference/noEmitHelpers2.symbols b/tests/baselines/reference/noEmitHelpers2.symbols new file mode 100644 index 00000000000..3a3e3ec94c7 --- /dev/null +++ b/tests/baselines/reference/noEmitHelpers2.symbols @@ -0,0 +1,17 @@ +=== tests/cases/compiler/noEmitHelpers2.ts === + +function decorator() { } +>decorator : Symbol(decorator, Decl(noEmitHelpers2.ts, 0, 0)) + +@decorator +>decorator : Symbol(decorator, Decl(noEmitHelpers2.ts, 0, 0)) + +class A { +>A : Symbol(A, Decl(noEmitHelpers2.ts, 1, 24)) + + constructor(a: number, @decorator b: string) { +>a : Symbol(a, Decl(noEmitHelpers2.ts, 5, 16)) +>decorator : Symbol(decorator, Decl(noEmitHelpers2.ts, 0, 0)) +>b : Symbol(b, Decl(noEmitHelpers2.ts, 5, 26)) + } +} diff --git a/tests/baselines/reference/noEmitHelpers2.types b/tests/baselines/reference/noEmitHelpers2.types new file mode 100644 index 00000000000..2a5b5413a7e --- /dev/null +++ b/tests/baselines/reference/noEmitHelpers2.types @@ -0,0 +1,17 @@ +=== tests/cases/compiler/noEmitHelpers2.ts === + +function decorator() { } +>decorator : () => void + +@decorator +>decorator : () => void + +class A { +>A : A + + constructor(a: number, @decorator b: string) { +>a : number +>decorator : () => void +>b : string + } +} diff --git a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js index 560c8c3cbd7..b687162c154 100644 --- a/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js +++ b/tests/baselines/reference/nonGenericClassExtendingGenericClassWithAny.js @@ -6,7 +6,7 @@ class Foo { class Bar extends Foo { } // Valid //// [nonGenericClassExtendingGenericClassWithAny.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js index 0474abef393..fe1e4768672 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js @@ -47,7 +47,7 @@ var b: { [x: number]: A } = { //// [numericIndexerConstrainsPropertyDeclarations2.js] // String indexer providing a constraint of a user defined type -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/numericIndexerConstraint3.js b/tests/baselines/reference/numericIndexerConstraint3.js index 4f4fd826c25..724db29f557 100644 --- a/tests/baselines/reference/numericIndexerConstraint3.js +++ b/tests/baselines/reference/numericIndexerConstraint3.js @@ -13,7 +13,7 @@ class C { } //// [numericIndexerConstraint3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/numericIndexerConstraint4.js b/tests/baselines/reference/numericIndexerConstraint4.js index 531c450e7e1..404a9394bf7 100644 --- a/tests/baselines/reference/numericIndexerConstraint4.js +++ b/tests/baselines/reference/numericIndexerConstraint4.js @@ -12,7 +12,7 @@ var x: { } = { data: new B() } //// [numericIndexerConstraint4.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/numericIndexerTyping2.js b/tests/baselines/reference/numericIndexerTyping2.js index 424f56b6214..c5e91e9dfc0 100644 --- a/tests/baselines/reference/numericIndexerTyping2.js +++ b/tests/baselines/reference/numericIndexerTyping2.js @@ -13,7 +13,7 @@ var i2: I2; var r2: string = i2[1]; // error: numeric indexer returns the type of the string indexere //// [numericIndexerTyping2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/objectCreationOfElementAccessExpression.js b/tests/baselines/reference/objectCreationOfElementAccessExpression.js index f3c5760ae63..45d56a1d716 100644 --- a/tests/baselines/reference/objectCreationOfElementAccessExpression.js +++ b/tests/baselines/reference/objectCreationOfElementAccessExpression.js @@ -56,7 +56,7 @@ var foods2: MonsterFood[] = new PetFood[new IceCream('Mint chocolate chip') , Co //// [objectCreationOfElementAccessExpression.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js index 16268c1331c..339f6b23f6a 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js +++ b/tests/baselines/reference/objectTypeHidingMembersOfExtendedObject.js @@ -55,7 +55,7 @@ var b: { var r4: void = b.valueOf(); //// [objectTypeHidingMembersOfExtendedObject.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js index 1dc6505456a..8f6d1706e40 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers1.js @@ -124,7 +124,7 @@ function foo16(x: any) { } //// [objectTypesIdentityWithNumericIndexers1.js] // object types are identical structurally -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js index e2fd1b99bfa..8f5b6449a88 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers2.js @@ -127,7 +127,7 @@ function foo16(x: any) { } //// [objectTypesIdentityWithNumericIndexers2.js] // object types are identical structurally -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js index 11d64efc9d5..2fc8c0c946d 100644 --- a/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js +++ b/tests/baselines/reference/objectTypesIdentityWithNumericIndexers3.js @@ -124,7 +124,7 @@ function foo16(x: any) { } //// [objectTypesIdentityWithNumericIndexers3.js] // object types are identical structurally -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates.js b/tests/baselines/reference/objectTypesIdentityWithPrivates.js index 5c8a0afed72..a68eba8c6a2 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates.js @@ -122,7 +122,7 @@ function foo16(x: any) { } //// [objectTypesIdentityWithPrivates.js] // object types are identical structurally -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates2.js b/tests/baselines/reference/objectTypesIdentityWithPrivates2.js index 36c3e67c70e..92aac37ecdb 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates2.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates2.js @@ -40,7 +40,7 @@ function foo6(x: any): any { } //// [objectTypesIdentityWithPrivates2.js] // object types are identical structurally -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/objectTypesIdentityWithPrivates3.js b/tests/baselines/reference/objectTypesIdentityWithPrivates3.js index 7c8dac97250..c202f684895 100644 --- a/tests/baselines/reference/objectTypesIdentityWithPrivates3.js +++ b/tests/baselines/reference/objectTypesIdentityWithPrivates3.js @@ -26,7 +26,7 @@ var c3: C3; c3; // Should fail (private x originates in the same declaration, but different types) //// [objectTypesIdentityWithPrivates3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js index 37c5537aa4b..98693b4e6ee 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers.js @@ -124,7 +124,7 @@ function foo16(x: any) { } //// [objectTypesIdentityWithStringIndexers.js] // object types are identical structurally -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js index e90dc8598e4..7e9abbad7e6 100644 --- a/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js +++ b/tests/baselines/reference/objectTypesIdentityWithStringIndexers2.js @@ -127,7 +127,7 @@ function foo16(x: any) { } //// [objectTypesIdentityWithStringIndexers2.js] // object types are identical structurally -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/optionalConstructorArgInSuper.js b/tests/baselines/reference/optionalConstructorArgInSuper.js index 5204d7f8307..2ac23c39be5 100644 --- a/tests/baselines/reference/optionalConstructorArgInSuper.js +++ b/tests/baselines/reference/optionalConstructorArgInSuper.js @@ -11,7 +11,7 @@ d2.foo(); //// [optionalConstructorArgInSuper.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/optionalParamArgsTest.js b/tests/baselines/reference/optionalParamArgsTest.js index 5598f8d0872..7538397566a 100644 --- a/tests/baselines/reference/optionalParamArgsTest.js +++ b/tests/baselines/reference/optionalParamArgsTest.js @@ -126,7 +126,7 @@ fnOpt2(1, [2, 3], [1], true); //// [optionalParamArgsTest.js] // Optional parameter and default argument tests -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/optionalParamInOverride.js b/tests/baselines/reference/optionalParamInOverride.js index cfdfce368d0..aa76f41644c 100644 --- a/tests/baselines/reference/optionalParamInOverride.js +++ b/tests/baselines/reference/optionalParamInOverride.js @@ -8,7 +8,7 @@ class Y extends Z { //// [optionalParamInOverride.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/overload1.js b/tests/baselines/reference/overload1.js index c7134966cec..b308c0e8d83 100644 --- a/tests/baselines/reference/overload1.js +++ b/tests/baselines/reference/overload1.js @@ -40,7 +40,7 @@ var v=x.g; //// [overload1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks1.js b/tests/baselines/reference/overloadOnConstConstraintChecks1.js index eb613586118..4588bef017b 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks1.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks1.js @@ -23,7 +23,7 @@ class D implements MyDoc { } //// [overloadOnConstConstraintChecks1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks2.js b/tests/baselines/reference/overloadOnConstConstraintChecks2.js index 25759d0a839..709f7808ac1 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks2.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks2.js @@ -12,7 +12,7 @@ function foo(name: any): A { } //// [overloadOnConstConstraintChecks2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks3.js b/tests/baselines/reference/overloadOnConstConstraintChecks3.js index 5980c852f41..7104c441938 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks3.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks3.js @@ -13,7 +13,7 @@ function foo(name: any): A { //// [overloadOnConstConstraintChecks3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks4.js b/tests/baselines/reference/overloadOnConstConstraintChecks4.js index b2ae1125750..4483b42a941 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks4.js +++ b/tests/baselines/reference/overloadOnConstConstraintChecks4.js @@ -14,7 +14,7 @@ function foo(name: any): Z { //// [overloadOnConstConstraintChecks4.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js index cf9bc526b51..efcad011ab5 100644 --- a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js +++ b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.js @@ -12,7 +12,7 @@ function foo(name: "DIV"): Derived2 { foo("HI"); //// [overloadOnConstantsInvalidOverload1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/overloadResolution.js b/tests/baselines/reference/overloadResolution.js index 1ee5e077c08..d234ea4a69a 100644 --- a/tests/baselines/reference/overloadResolution.js +++ b/tests/baselines/reference/overloadResolution.js @@ -95,7 +95,7 @@ var s = fn5((n) => n.substr(0)); //// [overloadResolution.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/overloadResolutionClassConstructors.js b/tests/baselines/reference/overloadResolutionClassConstructors.js index 2571a0e02db..fc7dbd9cebe 100644 --- a/tests/baselines/reference/overloadResolutionClassConstructors.js +++ b/tests/baselines/reference/overloadResolutionClassConstructors.js @@ -102,7 +102,7 @@ new fn5((n) => n.blah); // Error //// [overloadResolutionClassConstructors.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/overloadResolutionConstructors.js b/tests/baselines/reference/overloadResolutionConstructors.js index 9e10215b1cb..b3c2b2ef764 100644 --- a/tests/baselines/reference/overloadResolutionConstructors.js +++ b/tests/baselines/reference/overloadResolutionConstructors.js @@ -103,7 +103,7 @@ var s = new fn5((n) => n.substr(0)); //// [overloadResolutionConstructors.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/overloadingOnConstants1.js b/tests/baselines/reference/overloadingOnConstants1.js index 7ebeeb2890f..4274841d60f 100644 --- a/tests/baselines/reference/overloadingOnConstants1.js +++ b/tests/baselines/reference/overloadingOnConstants1.js @@ -26,7 +26,7 @@ var htmlDivElement2: Derived1 = d2.createElement("div"); var htmlSpanElement2: Derived1 = d2.createElement("span"); //// [overloadingOnConstants1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/overloadingOnConstants2.js b/tests/baselines/reference/overloadingOnConstants2.js index 4a3f49d1b06..2414ec4eab2 100644 --- a/tests/baselines/reference/overloadingOnConstants2.js +++ b/tests/baselines/reference/overloadingOnConstants2.js @@ -28,7 +28,7 @@ var e: E = bar("bye", []); // E var f: C = bar("um", []); // C //// [overloadingOnConstants2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/overridingPrivateStaticMembers.js b/tests/baselines/reference/overridingPrivateStaticMembers.js index 2174f9e298b..56ecfec66c0 100644 --- a/tests/baselines/reference/overridingPrivateStaticMembers.js +++ b/tests/baselines/reference/overridingPrivateStaticMembers.js @@ -8,7 +8,7 @@ class Derived2 extends Base2 { } //// [overridingPrivateStaticMembers.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/parseErrorInHeritageClause1.js b/tests/baselines/reference/parseErrorInHeritageClause1.js index d08a4920171..66facdeadf0 100644 --- a/tests/baselines/reference/parseErrorInHeritageClause1.js +++ b/tests/baselines/reference/parseErrorInHeritageClause1.js @@ -3,7 +3,7 @@ class C extends A # { } //// [parseErrorInHeritageClause1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/parser509630.js b/tests/baselines/reference/parser509630.js index 0d5a96884f3..20e00ea01ed 100644 --- a/tests/baselines/reference/parser509630.js +++ b/tests/baselines/reference/parser509630.js @@ -7,7 +7,7 @@ class Any extends Type { //// [parser509630.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/parserAstSpans1.js b/tests/baselines/reference/parserAstSpans1.js index 64c8f5c0612..ec88d11b0c9 100644 --- a/tests/baselines/reference/parserAstSpans1.js +++ b/tests/baselines/reference/parserAstSpans1.js @@ -220,7 +220,7 @@ class c6 extends c5 { } //// [parserAstSpans1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/parserClassDeclaration1.js b/tests/baselines/reference/parserClassDeclaration1.js index 1e4fc0d5bcf..9ef865adb75 100644 --- a/tests/baselines/reference/parserClassDeclaration1.js +++ b/tests/baselines/reference/parserClassDeclaration1.js @@ -3,7 +3,7 @@ class C extends A extends B { } //// [parserClassDeclaration1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/parserClassDeclaration3.js b/tests/baselines/reference/parserClassDeclaration3.js index 99d34bedaed..644c4fcb54a 100644 --- a/tests/baselines/reference/parserClassDeclaration3.js +++ b/tests/baselines/reference/parserClassDeclaration3.js @@ -3,7 +3,7 @@ class C implements A extends B { } //// [parserClassDeclaration3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/parserClassDeclaration4.js b/tests/baselines/reference/parserClassDeclaration4.js index 3552c74f184..d7cd9ca6cac 100644 --- a/tests/baselines/reference/parserClassDeclaration4.js +++ b/tests/baselines/reference/parserClassDeclaration4.js @@ -3,7 +3,7 @@ class C extends A implements B extends C { } //// [parserClassDeclaration4.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/parserClassDeclaration5.js b/tests/baselines/reference/parserClassDeclaration5.js index 6a7846fd036..4f75eb96668 100644 --- a/tests/baselines/reference/parserClassDeclaration5.js +++ b/tests/baselines/reference/parserClassDeclaration5.js @@ -3,7 +3,7 @@ class C extends A implements B implements C { } //// [parserClassDeclaration5.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/parserClassDeclaration6.js b/tests/baselines/reference/parserClassDeclaration6.js index 24e55a48344..a653a7e4042 100644 --- a/tests/baselines/reference/parserClassDeclaration6.js +++ b/tests/baselines/reference/parserClassDeclaration6.js @@ -3,7 +3,7 @@ class C extends A, B { } //// [parserClassDeclaration6.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js index babceb0f752..43ebfa2bb0e 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause2.js @@ -3,7 +3,7 @@ class C extends A, { } //// [parserErrorRecovery_ExtendsOrImplementsClause2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js index 5c0e793173a..732508b8d85 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause4.js @@ -3,7 +3,7 @@ class C extends A implements { } //// [parserErrorRecovery_ExtendsOrImplementsClause4.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js index 40dbcf61820..58f4f4631dc 100644 --- a/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js +++ b/tests/baselines/reference/parserErrorRecovery_ExtendsOrImplementsClause5.js @@ -3,7 +3,7 @@ class C extends A, implements B, { } //// [parserErrorRecovery_ExtendsOrImplementsClause5.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/parserGenericsInTypeContexts1.js b/tests/baselines/reference/parserGenericsInTypeContexts1.js index a8f6729b3d1..5c2369e61c7 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts1.js +++ b/tests/baselines/reference/parserGenericsInTypeContexts1.js @@ -18,7 +18,7 @@ function f2(): F { //// [parserGenericsInTypeContexts1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/parserGenericsInTypeContexts2.js b/tests/baselines/reference/parserGenericsInTypeContexts2.js index 9735d7cab3c..487038e1959 100644 --- a/tests/baselines/reference/parserGenericsInTypeContexts2.js +++ b/tests/baselines/reference/parserGenericsInTypeContexts2.js @@ -18,7 +18,7 @@ function f2(): F, Y>> { //// [parserGenericsInTypeContexts2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/parserRealSource10.js b/tests/baselines/reference/parserRealSource10.js index 2ddc7a8dce2..4c241abba0e 100644 --- a/tests/baselines/reference/parserRealSource10.js +++ b/tests/baselines/reference/parserRealSource10.js @@ -458,7 +458,7 @@ module TypeScript { //// [parserRealSource10.js] // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/parserRealSource11.js b/tests/baselines/reference/parserRealSource11.js index 72fec692184..c6a08062820 100644 --- a/tests/baselines/reference/parserRealSource11.js +++ b/tests/baselines/reference/parserRealSource11.js @@ -2367,7 +2367,7 @@ module TypeScript { //// [parserRealSource11.js] // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. // See LICENSE.txt in the project root for complete license information. -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/parserSymbolProperty1.symbols b/tests/baselines/reference/parserSymbolProperty1.symbols index 4d7a9b669e4..54d674ea0a8 100644 --- a/tests/baselines/reference/parserSymbolProperty1.symbols +++ b/tests/baselines/reference/parserSymbolProperty1.symbols @@ -4,6 +4,6 @@ interface I { [Symbol.iterator]: string; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) } diff --git a/tests/baselines/reference/parserSymbolProperty2.symbols b/tests/baselines/reference/parserSymbolProperty2.symbols index ff110a6fe03..51fdb40efd4 100644 --- a/tests/baselines/reference/parserSymbolProperty2.symbols +++ b/tests/baselines/reference/parserSymbolProperty2.symbols @@ -3,7 +3,7 @@ interface I { >I : Symbol(I, Decl(parserSymbolProperty2.ts, 0, 0)) [Symbol.unscopables](): string; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1254, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1254, 24)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1284, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1284, 24)) } diff --git a/tests/baselines/reference/parserSymbolProperty3.symbols b/tests/baselines/reference/parserSymbolProperty3.symbols index b75a737af0a..11b6d8de94f 100644 --- a/tests/baselines/reference/parserSymbolProperty3.symbols +++ b/tests/baselines/reference/parserSymbolProperty3.symbols @@ -3,7 +3,7 @@ declare class C { >C : Symbol(C, Decl(parserSymbolProperty3.ts, 0, 0)) [Symbol.unscopables](): string; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1254, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1254, 24)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1284, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1284, 24)) } diff --git a/tests/baselines/reference/parserSymbolProperty4.symbols b/tests/baselines/reference/parserSymbolProperty4.symbols index 122a46180d2..b2ffc2c89d2 100644 --- a/tests/baselines/reference/parserSymbolProperty4.symbols +++ b/tests/baselines/reference/parserSymbolProperty4.symbols @@ -3,7 +3,7 @@ declare class C { >C : Symbol(C, Decl(parserSymbolProperty4.ts, 0, 0)) [Symbol.toPrimitive]: string; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) } diff --git a/tests/baselines/reference/parserSymbolProperty5.symbols b/tests/baselines/reference/parserSymbolProperty5.symbols index f6049c352e9..e896ebbd2a2 100644 --- a/tests/baselines/reference/parserSymbolProperty5.symbols +++ b/tests/baselines/reference/parserSymbolProperty5.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(parserSymbolProperty5.ts, 0, 0)) [Symbol.toPrimitive]: string; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) } diff --git a/tests/baselines/reference/parserSymbolProperty6.symbols b/tests/baselines/reference/parserSymbolProperty6.symbols index 6f8a8d820be..1859c954ba4 100644 --- a/tests/baselines/reference/parserSymbolProperty6.symbols +++ b/tests/baselines/reference/parserSymbolProperty6.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(parserSymbolProperty6.ts, 0, 0)) [Symbol.toStringTag]: string = ""; ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) } diff --git a/tests/baselines/reference/parserSymbolProperty7.symbols b/tests/baselines/reference/parserSymbolProperty7.symbols index abcffb9a1fd..a91a8227ae4 100644 --- a/tests/baselines/reference/parserSymbolProperty7.symbols +++ b/tests/baselines/reference/parserSymbolProperty7.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(parserSymbolProperty7.ts, 0, 0)) [Symbol.toStringTag](): void { } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) } diff --git a/tests/baselines/reference/parserSymbolProperty8.symbols b/tests/baselines/reference/parserSymbolProperty8.symbols index 4b2adf9c750..dee98ed1e77 100644 --- a/tests/baselines/reference/parserSymbolProperty8.symbols +++ b/tests/baselines/reference/parserSymbolProperty8.symbols @@ -3,7 +3,7 @@ var x: { >x : Symbol(x, Decl(parserSymbolProperty8.ts, 0, 3)) [Symbol.toPrimitive](): string ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) } diff --git a/tests/baselines/reference/parserSymbolProperty9.symbols b/tests/baselines/reference/parserSymbolProperty9.symbols index cca16d768e6..cffbded17e6 100644 --- a/tests/baselines/reference/parserSymbolProperty9.symbols +++ b/tests/baselines/reference/parserSymbolProperty9.symbols @@ -3,7 +3,7 @@ var x: { >x : Symbol(x, Decl(parserSymbolProperty9.ts, 0, 3)) [Symbol.toPrimitive]: string ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) } diff --git a/tests/baselines/reference/parserharness.js b/tests/baselines/reference/parserharness.js index 02304380013..d74e81fad27 100644 --- a/tests/baselines/reference/parserharness.js +++ b/tests/baselines/reference/parserharness.js @@ -2096,7 +2096,7 @@ module Harness { // See the License for the specific language governing permissions and // limitations under the License. // -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/primitiveMembers.js b/tests/baselines/reference/primitiveMembers.js index 629d55ed0f7..a49d6f7ee1c 100644 --- a/tests/baselines/reference/primitiveMembers.js +++ b/tests/baselines/reference/primitiveMembers.js @@ -32,7 +32,7 @@ class foo extends baz { public bar(){ return undefined}; } //// [primitiveMembers.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/privacyClass.js b/tests/baselines/reference/privacyClass.js index 564d49721f1..4d6d0a72e4a 100644 --- a/tests/baselines/reference/privacyClass.js +++ b/tests/baselines/reference/privacyClass.js @@ -128,7 +128,7 @@ export class glo_C12_public extends glo_c_private implements glo_i_private, glo } //// [privacyClass.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js index 6a7d716d50d..044c30f3797 100644 --- a/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js +++ b/tests/baselines/reference/privacyClassExtendsClauseDeclFile.js @@ -98,7 +98,7 @@ class publicClassExtendingPublicClassInGlobal extends publicClassInGlobal { //// [privacyClassExtendsClauseDeclFile_externalModule.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; @@ -285,7 +285,7 @@ var publicClassExtendingFromPrivateModuleClass = (function (_super) { })(privateModule.publicClassInPrivateModule); exports.publicClassExtendingFromPrivateModuleClass = publicClassExtendingFromPrivateModuleClass; //// [privacyClassExtendsClauseDeclFile_GlobalFile.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/privacyGloClass.js b/tests/baselines/reference/privacyGloClass.js index 5cd5ace3247..58877eae167 100644 --- a/tests/baselines/reference/privacyGloClass.js +++ b/tests/baselines/reference/privacyGloClass.js @@ -61,7 +61,7 @@ class glo_C11_public extends glo_c_public implements glo_i_public { //// [privacyGloClass.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/privateAccessInSubclass1.js b/tests/baselines/reference/privateAccessInSubclass1.js index 0d56cf415ac..7004a535952 100644 --- a/tests/baselines/reference/privateAccessInSubclass1.js +++ b/tests/baselines/reference/privateAccessInSubclass1.js @@ -10,7 +10,7 @@ class D extends Base { } //// [privateAccessInSubclass1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/privateInstanceMemberAccessibility.js b/tests/baselines/reference/privateInstanceMemberAccessibility.js index a719e54768b..4158ef6a8f7 100644 --- a/tests/baselines/reference/privateInstanceMemberAccessibility.js +++ b/tests/baselines/reference/privateInstanceMemberAccessibility.js @@ -14,7 +14,7 @@ class Derived extends Base { } //// [privateInstanceMemberAccessibility.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/privateStaticMemberAccessibility.js b/tests/baselines/reference/privateStaticMemberAccessibility.js index fdcb2663299..013c606f829 100644 --- a/tests/baselines/reference/privateStaticMemberAccessibility.js +++ b/tests/baselines/reference/privateStaticMemberAccessibility.js @@ -9,7 +9,7 @@ class Derived extends Base { } //// [privateStaticMemberAccessibility.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js index a4562e02b65..3db3a636c7d 100644 --- a/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js +++ b/tests/baselines/reference/privateStaticNotAccessibleInClodule2.js @@ -16,7 +16,7 @@ module D { //// [privateStaticNotAccessibleInClodule2.js] // Any attempt to access a private property member outside the class body that contains its declaration results in a compile-time error. -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js index 7af6249615c..5bdce5cf48a 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/amd/testGlo.js @@ -1,4 +1,4 @@ -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js index 7af6249615c..5bdce5cf48a 100644 --- a/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js +++ b/tests/baselines/reference/project/privacyCheckOnImportedModuleDeclarationsInsideModule/node/testGlo.js @@ -1,4 +1,4 @@ -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/project/prologueEmit/amd/out.js b/tests/baselines/reference/project/prologueEmit/amd/out.js index b19a07f6490..e621c38f984 100644 --- a/tests/baselines/reference/project/prologueEmit/amd/out.js +++ b/tests/baselines/reference/project/prologueEmit/amd/out.js @@ -1,7 +1,7 @@ var _this = this; // Add a lambda to ensure global 'this' capture is triggered (function () { return _this.window; }); -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/project/prologueEmit/node/out.js b/tests/baselines/reference/project/prologueEmit/node/out.js index b19a07f6490..e621c38f984 100644 --- a/tests/baselines/reference/project/prologueEmit/node/out.js +++ b/tests/baselines/reference/project/prologueEmit/node/out.js @@ -1,7 +1,7 @@ var _this = this; // Add a lambda to ensure global 'this' capture is triggered (function () { return _this.window; }); -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js index 3818742d7a4..b1f4dd64ef2 100644 --- a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js +++ b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/amd/m'ain.js @@ -1,5 +1,5 @@ /// -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js index 3818742d7a4..b1f4dd64ef2 100644 --- a/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js +++ b/tests/baselines/reference/project/quotesInFileAndDirectoryNames/node/m'ain.js @@ -1,5 +1,5 @@ /// -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/propertiesAndIndexers.js b/tests/baselines/reference/propertiesAndIndexers.js index 23673dbcfad..f67a9d89249 100644 --- a/tests/baselines/reference/propertiesAndIndexers.js +++ b/tests/baselines/reference/propertiesAndIndexers.js @@ -52,7 +52,7 @@ var c: { }; //// [propertiesAndIndexers.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/propertyAccess.js b/tests/baselines/reference/propertyAccess.js index 9295ce43b26..1e6ef5c1d6d 100644 --- a/tests/baselines/reference/propertyAccess.js +++ b/tests/baselines/reference/propertyAccess.js @@ -151,7 +151,7 @@ var x3: A; //// [propertyAccess.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js index 88baee7752e..dc4c30d9165 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js @@ -83,7 +83,7 @@ var r4 = b.foo(aB, aB); // no inferences for T so constraint isn't satisfied, er //// [propertyAccessOnTypeParameterWithConstraints2.js] // generic types should behave as if they have properties of their constraint type -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js index 941adc7ab43..7e935609e36 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js @@ -58,7 +58,7 @@ var r4 = b.foo(new B()); // valid call to an invalid function //// [propertyAccessOnTypeParameterWithConstraints3.js] // generic types should behave as if they have properties of their constraint type -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js index fe3c9433796..f871ce553b7 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js @@ -45,7 +45,7 @@ var b = { var r4 = b.foo(new B()); // error after constraints above made illegal, doesn't matter //// [propertyAccessOnTypeParameterWithConstraints5.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js index 28a1da5ffec..45f001c65fb 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js @@ -21,7 +21,7 @@ class C extends B { //// [protectedClassPropertyAccessibleWithinSubclass.js] // no errors -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js index 73abc96cc43..10276f8ac85 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass2.js @@ -95,7 +95,7 @@ d3.x; // Error, neither within their declaring class nor class d4.x; // Error, neither within their declaring class nor classes derived from their declaring class //// [protectedClassPropertyAccessibleWithinSubclass2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js index 8085112d994..1a5b7489910 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass3.js @@ -14,7 +14,7 @@ class Derived extends Base { } //// [protectedClassPropertyAccessibleWithinSubclass3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/protectedInstanceMemberAccessibility.js b/tests/baselines/reference/protectedInstanceMemberAccessibility.js index de7a6e0d00e..7560c5c89ca 100644 --- a/tests/baselines/reference/protectedInstanceMemberAccessibility.js +++ b/tests/baselines/reference/protectedInstanceMemberAccessibility.js @@ -45,7 +45,7 @@ class C extends A { //// [protectedInstanceMemberAccessibility.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/protectedMembers.js b/tests/baselines/reference/protectedMembers.js index dd2e113d665..33b6e2ebde2 100644 --- a/tests/baselines/reference/protectedMembers.js +++ b/tests/baselines/reference/protectedMembers.js @@ -117,7 +117,7 @@ class B3 extends A3 { //// [protectedMembers.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js index 81c11369ee8..1bd102694d4 100644 --- a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass.js @@ -44,7 +44,7 @@ Derived2.x; // Error, neither within their declaring class nor classes deriv Derived3.x; // Error, neither within their declaring class nor classes derived from their declaring class //// [protectedStaticClassPropertyAccessibleWithinSubclass.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js index 520851f5e95..c82c67b7003 100644 --- a/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js +++ b/tests/baselines/reference/protectedStaticClassPropertyAccessibleWithinSubclass2.js @@ -22,7 +22,7 @@ class Derived2 extends Derived1 { } //// [protectedStaticClassPropertyAccessibleWithinSubclass2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js b/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js index a8dc4ebba21..8b071cb6b52 100644 --- a/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js +++ b/tests/baselines/reference/qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js @@ -7,7 +7,7 @@ class Beta extends Alpha.x { } //// [qualifiedName_entity-name-resolution-does-not-affect-class-heritage.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/recursiveBaseCheck3.js b/tests/baselines/reference/recursiveBaseCheck3.js index d79aaa30d9a..6c1cd918779 100644 --- a/tests/baselines/reference/recursiveBaseCheck3.js +++ b/tests/baselines/reference/recursiveBaseCheck3.js @@ -5,7 +5,7 @@ class C extends A { } (new C).blah; //// [recursiveBaseCheck3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/recursiveBaseCheck4.js b/tests/baselines/reference/recursiveBaseCheck4.js index e6779fc74e9..1abb6731263 100644 --- a/tests/baselines/reference/recursiveBaseCheck4.js +++ b/tests/baselines/reference/recursiveBaseCheck4.js @@ -3,7 +3,7 @@ class M extends M { } (new M).blah; //// [recursiveBaseCheck4.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/recursiveBaseCheck6.js b/tests/baselines/reference/recursiveBaseCheck6.js index ee97b3ec436..7fb9b444650 100644 --- a/tests/baselines/reference/recursiveBaseCheck6.js +++ b/tests/baselines/reference/recursiveBaseCheck6.js @@ -3,7 +3,7 @@ class S18 extends S18<{ S19: A; }>{ } (new S18()).blah; //// [recursiveBaseCheck6.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/recursiveBaseConstructorCreation1.js b/tests/baselines/reference/recursiveBaseConstructorCreation1.js index c475f604b14..d0fc83b30f2 100644 --- a/tests/baselines/reference/recursiveBaseConstructorCreation1.js +++ b/tests/baselines/reference/recursiveBaseConstructorCreation1.js @@ -7,7 +7,7 @@ var x = new C2(); // Valid //// [recursiveBaseConstructorCreation1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js index 403eb330cd7..214c543b836 100644 --- a/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js +++ b/tests/baselines/reference/recursiveClassInstantiationsWithDefaultConstructors.js @@ -10,7 +10,7 @@ export class MemberNameArray extends MemberName { //// [recursiveClassInstantiationsWithDefaultConstructors.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js b/tests/baselines/reference/recursiveClassReferenceTest.js index d47d9340a8c..e9339fec4df 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js +++ b/tests/baselines/reference/recursiveClassReferenceTest.js @@ -105,7 +105,7 @@ module Sample.Thing.Languages.PlainText { //// [recursiveClassReferenceTest.js] // Scenario 1: Test reqursive function call with "this" parameter // Scenario 2: Test recursive function call with cast and "this" parameter -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt index 23950aba4ba..67031d420ea 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt +++ b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt @@ -26,7 +26,7 @@ sourceFile:recursiveClassReferenceTest.ts 1->Emitted(2, 1) Source(2, 1) + SourceIndex(0) 2 >Emitted(2, 75) Source(2, 75) + SourceIndex(0) --- ->>>var __extends = this.__extends || function (d, b) { +>>>var __extends = (this && 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; diff --git a/tests/baselines/reference/recursiveComplicatedClasses.js b/tests/baselines/reference/recursiveComplicatedClasses.js index 25f20f57d23..6e88dd8dc22 100644 --- a/tests/baselines/reference/recursiveComplicatedClasses.js +++ b/tests/baselines/reference/recursiveComplicatedClasses.js @@ -25,7 +25,7 @@ class TypeSymbol extends InferenceSymbol { } //// [recursiveComplicatedClasses.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js index c0abe985dbc..60022dc245a 100644 --- a/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js +++ b/tests/baselines/reference/recursivelySpecializedConstructorDeclaration.js @@ -30,7 +30,7 @@ declare module MsPortal.Controls.Base.ItemList { */ //// [recursivelySpecializedConstructorDeclaration.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js index 24f0e7f1bcb..72cc702309c 100644 --- a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js +++ b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js @@ -1020,7 +1020,7 @@ module caurinus { //// [resolvingClassDeclarationWhenInBaseTypeResolution.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/returnInConstructor1.js b/tests/baselines/reference/returnInConstructor1.js index 0096c4d65b6..87b1b6d672a 100644 --- a/tests/baselines/reference/returnInConstructor1.js +++ b/tests/baselines/reference/returnInConstructor1.js @@ -67,7 +67,7 @@ class I extends G { //// [returnInConstructor1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/returnStatements.js b/tests/baselines/reference/returnStatements.js index 77b6ae1f774..35c208b19ee 100644 --- a/tests/baselines/reference/returnStatements.js +++ b/tests/baselines/reference/returnStatements.js @@ -25,7 +25,7 @@ function fn13(): C { return null; } //// [returnStatements.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js b/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js index 23b6f2f7e50..f971f089741 100644 --- a/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js +++ b/tests/baselines/reference/scopeCheckExtendedClassInsidePublicMethod2.js @@ -9,7 +9,7 @@ class D extends C { } //// [scopeCheckExtendedClassInsidePublicMethod2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js b/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js index 7e604118f52..a7f7f4fde99 100644 --- a/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js +++ b/tests/baselines/reference/scopeCheckExtendedClassInsideStaticMethod1.js @@ -9,7 +9,7 @@ class D extends C { } //// [scopeCheckExtendedClassInsideStaticMethod1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/scopeTests.js b/tests/baselines/reference/scopeTests.js index c21a821100e..99a933cf157 100644 --- a/tests/baselines/reference/scopeTests.js +++ b/tests/baselines/reference/scopeTests.js @@ -12,7 +12,7 @@ class D extends C { } //// [scopeTests.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/separateCompilationImportExportElision.js b/tests/baselines/reference/separateCompilationImportExportElision.js index 2d255798c3f..cfa57980249 100644 --- a/tests/baselines/reference/separateCompilationImportExportElision.js +++ b/tests/baselines/reference/separateCompilationImportExportElision.js @@ -14,7 +14,7 @@ export {c1} from "module"; export var z = x; //// [separateCompilationImportExportElision.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/shadowPrivateMembers.js b/tests/baselines/reference/shadowPrivateMembers.js index 098a7914a71..4100dba13e3 100644 --- a/tests/baselines/reference/shadowPrivateMembers.js +++ b/tests/baselines/reference/shadowPrivateMembers.js @@ -4,7 +4,7 @@ class derived extends base { private n() {} } //// [shadowPrivateMembers.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js index 94d91cc03cb..cae6e991e24 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js @@ -8,7 +8,7 @@ class Greeter extends AbstractGreeter { } //// [sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt index 96b52724320..d0934f3c9ed 100644 --- a/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.sourcemap.txt @@ -8,7 +8,7 @@ sources: sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts emittedFile:tests/cases/compiler/sourceMapValidationClassWithDefaultConstructorAndExtendsClause.js sourceFile:sourceMapValidationClassWithDefaultConstructorAndExtendsClause.ts ------------------------------------------------------------------- ->>>var __extends = this.__extends || function (d, b) { +>>>var __extends = (this && 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; diff --git a/tests/baselines/reference/sourceMapValidationDecorators.js b/tests/baselines/reference/sourceMapValidationDecorators.js index fc4417c2f45..f858aeff586 100644 --- a/tests/baselines/reference/sourceMapValidationDecorators.js +++ b/tests/baselines/reference/sourceMapValidationDecorators.js @@ -55,7 +55,7 @@ class Greeter { } //// [sourceMapValidationDecorators.js] -if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); switch (arguments.length) { case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); @@ -63,7 +63,7 @@ if (typeof __decorate !== "function") __decorate = function (decorators, target, case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); } }; -if (typeof __param !== "function") __param = function (paramIndex, decorator) { +var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; var Greeter = (function () { diff --git a/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt b/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt index b5749e50fa1..68ad353db9f 100644 --- a/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt +++ b/tests/baselines/reference/sourceMapValidationDecorators.sourcemap.txt @@ -8,7 +8,7 @@ sources: sourceMapValidationDecorators.ts emittedFile:tests/cases/compiler/sourceMapValidationDecorators.js sourceFile:sourceMapValidationDecorators.ts ------------------------------------------------------------------- ->>>if (typeof __decorate !== "function") __decorate = function (decorators, target, key, desc) { +>>>var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { >>> if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc); >>> switch (arguments.length) { >>> case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target); @@ -16,7 +16,7 @@ sourceFile:sourceMapValidationDecorators.ts >>> case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc); >>> } >>>}; ->>>if (typeof __param !== "function") __param = function (paramIndex, decorator) { +>>>var __param = (this && this.__param) || function (paramIndex, decorator) { >>> return function (target, key) { decorator(target, key, paramIndex); } >>>}; >>>var Greeter = (function () { diff --git a/tests/baselines/reference/specializedInheritedConstructors1.js b/tests/baselines/reference/specializedInheritedConstructors1.js index 36280f9a44e..ec467ad9877 100644 --- a/tests/baselines/reference/specializedInheritedConstructors1.js +++ b/tests/baselines/reference/specializedInheritedConstructors1.js @@ -18,7 +18,7 @@ var myView = new MyView(m); // was error //// [specializedInheritedConstructors1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/specializedOverloadWithRestParameters.js b/tests/baselines/reference/specializedOverloadWithRestParameters.js index f091a39677c..2a022cdf7da 100644 --- a/tests/baselines/reference/specializedOverloadWithRestParameters.js +++ b/tests/baselines/reference/specializedOverloadWithRestParameters.js @@ -13,7 +13,7 @@ function g(tagName: any): Base { } //// [specializedOverloadWithRestParameters.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/staticFactory1.js b/tests/baselines/reference/staticFactory1.js index 529cc230d73..96303af586f 100644 --- a/tests/baselines/reference/staticFactory1.js +++ b/tests/baselines/reference/staticFactory1.js @@ -14,7 +14,7 @@ var d = Derived.create(); d.foo(); //// [staticFactory1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/staticInheritance.js b/tests/baselines/reference/staticInheritance.js index a577bad3a86..0aba29b3560 100644 --- a/tests/baselines/reference/staticInheritance.js +++ b/tests/baselines/reference/staticInheritance.js @@ -12,7 +12,7 @@ doThing(B); //OK //// [staticInheritance.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/staticMemberAccessOffDerivedType1.js b/tests/baselines/reference/staticMemberAccessOffDerivedType1.js index a4bbc3947cd..ab3c010d571 100644 --- a/tests/baselines/reference/staticMemberAccessOffDerivedType1.js +++ b/tests/baselines/reference/staticMemberAccessOffDerivedType1.js @@ -10,7 +10,7 @@ class P extends SomeBase { //// [staticMemberAccessOffDerivedType1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/staticPropSuper.js b/tests/baselines/reference/staticPropSuper.js index f77098b56e4..f0d50b3ecb6 100644 --- a/tests/baselines/reference/staticPropSuper.js +++ b/tests/baselines/reference/staticPropSuper.js @@ -36,7 +36,7 @@ class E extends A { } //// [staticPropSuper.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/strictModeInConstructor.js b/tests/baselines/reference/strictModeInConstructor.js index f7c5c3ecc5c..fef1ef46b1a 100644 --- a/tests/baselines/reference/strictModeInConstructor.js +++ b/tests/baselines/reference/strictModeInConstructor.js @@ -61,7 +61,7 @@ class Ds extends A { } //// [strictModeInConstructor.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js index 98b38532aa6..9ee817182c2 100644 --- a/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js +++ b/tests/baselines/reference/strictModeReservedWordInClassDeclaration.js @@ -29,7 +29,7 @@ class G extends package { } class H extends package.A { } //// [strictModeReservedWordInClassDeclaration.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js index c9278c40446..b6bd2dbd437 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js @@ -41,7 +41,7 @@ var b: { [x: string]: A } = { //// [stringIndexerConstrainsPropertyDeclarations2.js] // String indexer providing a constraint of a user defined type -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypesOfTypeParameter.js b/tests/baselines/reference/subtypesOfTypeParameter.js index 7fe3d28278b..5abdd633424 100644 --- a/tests/baselines/reference/subtypesOfTypeParameter.js +++ b/tests/baselines/reference/subtypesOfTypeParameter.js @@ -107,7 +107,7 @@ function f2(x: T, y: U) { //// [subtypesOfTypeParameter.js] // checking whether other types are subtypes of type parameters -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js index 2adc3712c26..afe9b998bd4 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints.js @@ -169,7 +169,7 @@ class D29 extends C3 { //// [subtypesOfTypeParameterWithConstraints.js] // checking whether other types are subtypes of type parameters with constraints -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js index f1cf61d484f..6f1756912a6 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints4.js @@ -80,7 +80,7 @@ class D9 extends B1 { //// [subtypesOfTypeParameterWithConstraints4.js] // checking whether other types are subtypes of type parameters with constraints -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js index 1caa7d99087..3d2b6372302 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithRecursiveConstraints.js @@ -159,7 +159,7 @@ module M2 { //// [subtypesOfTypeParameterWithRecursiveConstraints.js] // checking whether other types are subtypes of type parameters with constraints -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingTransitivity.js b/tests/baselines/reference/subtypingTransitivity.js index 828831c19bf..9dcb4095aa2 100644 --- a/tests/baselines/reference/subtypingTransitivity.js +++ b/tests/baselines/reference/subtypingTransitivity.js @@ -20,7 +20,7 @@ b.x = 1; // assigned number to string //// [subtypingTransitivity.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingWithCallSignatures2.js b/tests/baselines/reference/subtypingWithCallSignatures2.js index e1341914739..db6f1d85954 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures2.js +++ b/tests/baselines/reference/subtypingWithCallSignatures2.js @@ -174,7 +174,7 @@ var r18 = foo18(r18arg1); //// [subtypingWithCallSignatures2.js] // checking subtype relations for function types as it relates to contextual signature instantiation -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingWithCallSignatures3.js b/tests/baselines/reference/subtypingWithCallSignatures3.js index fb7b0fef551..d7ff8a79b6c 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures3.js +++ b/tests/baselines/reference/subtypingWithCallSignatures3.js @@ -121,7 +121,7 @@ module WithGenericSignaturesInBaseType { //// [subtypingWithCallSignatures3.js] // checking subtype relations for function types as it relates to contextual signature instantiation // error cases, so function calls will all result in 'any' -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingWithCallSignatures4.js b/tests/baselines/reference/subtypingWithCallSignatures4.js index cbdf92e2e60..739e3cacd86 100644 --- a/tests/baselines/reference/subtypingWithCallSignatures4.js +++ b/tests/baselines/reference/subtypingWithCallSignatures4.js @@ -113,7 +113,7 @@ var r18 = foo18(r18arg); //// [subtypingWithCallSignatures4.js] // checking subtype relations for function types as it relates to contextual signature instantiation -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures2.js b/tests/baselines/reference/subtypingWithConstructSignatures2.js index 9a7ecd791c3..4e93ddbbe55 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures2.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures2.js @@ -174,7 +174,7 @@ var r18 = foo18(r18arg1); //// [subtypingWithConstructSignatures2.js] // checking subtype relations for function types as it relates to contextual signature instantiation -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures3.js b/tests/baselines/reference/subtypingWithConstructSignatures3.js index a74c14e8d4b..7022b4b395c 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures3.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures3.js @@ -123,7 +123,7 @@ module WithGenericSignaturesInBaseType { //// [subtypingWithConstructSignatures3.js] // checking subtype relations for function types as it relates to contextual signature instantiation // error cases, so function calls will all result in 'any' -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures4.js b/tests/baselines/reference/subtypingWithConstructSignatures4.js index b3d43b03087..a16ea8e2397 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures4.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures4.js @@ -113,7 +113,7 @@ var r18 = foo18(r18arg); //// [subtypingWithConstructSignatures4.js] // checking subtype relations for function types as it relates to contextual signature instantiation -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures5.js b/tests/baselines/reference/subtypingWithConstructSignatures5.js index 3e1a373d4ee..fe3b86d1775 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures5.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures5.js @@ -51,7 +51,7 @@ interface I extends B { //// [subtypingWithConstructSignatures5.js] // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures2 just with an extra level of indirection in the inheritance chain -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingWithConstructSignatures6.js b/tests/baselines/reference/subtypingWithConstructSignatures6.js index 3d8f0cfee60..990b654bf45 100644 --- a/tests/baselines/reference/subtypingWithConstructSignatures6.js +++ b/tests/baselines/reference/subtypingWithConstructSignatures6.js @@ -54,7 +54,7 @@ interface I9 extends A { // checking subtype relations for function types as it relates to contextual signature instantiation // same as subtypingWithConstructSignatures4 but using class type parameters instead of generic signatures // all are errors -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingWithNumericIndexer.js b/tests/baselines/reference/subtypingWithNumericIndexer.js index 643d71e035f..a7790fba564 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer.js @@ -41,7 +41,7 @@ module Generics { //// [subtypingWithNumericIndexer.js] // Derived type indexer must be subtype of base type indexer -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingWithNumericIndexer3.js b/tests/baselines/reference/subtypingWithNumericIndexer3.js index 44bd366d705..c3fff86274f 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer3.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer3.js @@ -45,7 +45,7 @@ module Generics { //// [subtypingWithNumericIndexer3.js] // Derived type indexer must be subtype of base type indexer -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingWithNumericIndexer4.js b/tests/baselines/reference/subtypingWithNumericIndexer4.js index 44c88e1c520..e7ec08436a7 100644 --- a/tests/baselines/reference/subtypingWithNumericIndexer4.js +++ b/tests/baselines/reference/subtypingWithNumericIndexer4.js @@ -29,7 +29,7 @@ module Generics { //// [subtypingWithNumericIndexer4.js] // Derived type indexer must be subtype of base type indexer -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingWithObjectMembers.js b/tests/baselines/reference/subtypingWithObjectMembers.js index 06d8f4e0a78..28af7239222 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers.js +++ b/tests/baselines/reference/subtypingWithObjectMembers.js @@ -68,7 +68,7 @@ module TwoLevels { } //// [subtypingWithObjectMembers.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingWithObjectMembers4.js b/tests/baselines/reference/subtypingWithObjectMembers4.js index 31b0cb6e8f9..b04c3056a3e 100644 --- a/tests/baselines/reference/subtypingWithObjectMembers4.js +++ b/tests/baselines/reference/subtypingWithObjectMembers4.js @@ -35,7 +35,7 @@ class B3 extends A3 { //// [subtypingWithObjectMembers4.js] // subtyping when property names do not match -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js b/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js index ef873bf81b2..d3b62890855 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility.js @@ -35,7 +35,7 @@ class B3 extends A3 { //// [subtypingWithObjectMembersAccessibility.js] // Derived member is private, base member is not causes errors -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js index 6981fbcfebe..4a0ff448b7b 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js +++ b/tests/baselines/reference/subtypingWithObjectMembersAccessibility2.js @@ -63,7 +63,7 @@ module ImplicitPublic { //// [subtypingWithObjectMembersAccessibility2.js] // Derived member is private, base member is not causes errors -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingWithStringIndexer.js b/tests/baselines/reference/subtypingWithStringIndexer.js index 46f46a570cf..4b398451de8 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer.js +++ b/tests/baselines/reference/subtypingWithStringIndexer.js @@ -42,7 +42,7 @@ module Generics { //// [subtypingWithStringIndexer.js] // Derived type indexer must be subtype of base type indexer -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingWithStringIndexer3.js b/tests/baselines/reference/subtypingWithStringIndexer3.js index c5b9d96ce54..cf1ec80a8d2 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer3.js +++ b/tests/baselines/reference/subtypingWithStringIndexer3.js @@ -45,7 +45,7 @@ module Generics { //// [subtypingWithStringIndexer3.js] // Derived type indexer must be subtype of base type indexer -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/subtypingWithStringIndexer4.js b/tests/baselines/reference/subtypingWithStringIndexer4.js index 0dbe8912eba..e6aa298fed8 100644 --- a/tests/baselines/reference/subtypingWithStringIndexer4.js +++ b/tests/baselines/reference/subtypingWithStringIndexer4.js @@ -29,7 +29,7 @@ module Generics { //// [subtypingWithStringIndexer4.js] // Derived type indexer must be subtype of base type indexer -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/super.js b/tests/baselines/reference/super.js index 453eb820ddb..ed220ae1f18 100644 --- a/tests/baselines/reference/super.js +++ b/tests/baselines/reference/super.js @@ -38,7 +38,7 @@ s.foo() + ss.foo(); //// [super.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/super1.js b/tests/baselines/reference/super1.js index ab982aa8fdf..1bf75783a60 100644 --- a/tests/baselines/reference/super1.js +++ b/tests/baselines/reference/super1.js @@ -67,7 +67,7 @@ module Base4 { //// [super1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/super2.js b/tests/baselines/reference/super2.js index 0b596b44d32..0f5531a8d57 100644 --- a/tests/baselines/reference/super2.js +++ b/tests/baselines/reference/super2.js @@ -51,7 +51,7 @@ results1.x() + results1.y() + results2.y(); //// [super2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superAccess.js b/tests/baselines/reference/superAccess.js index 3d9080b76e1..bf6a9ee3ad0 100644 --- a/tests/baselines/reference/superAccess.js +++ b/tests/baselines/reference/superAccess.js @@ -14,7 +14,7 @@ class MyDerived extends MyBase { } //// [superAccess.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superAccess2.js b/tests/baselines/reference/superAccess2.js index 8672b5b9935..afcba34aa5d 100644 --- a/tests/baselines/reference/superAccess2.js +++ b/tests/baselines/reference/superAccess2.js @@ -25,7 +25,7 @@ class Q extends P { } //// [superAccess2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superAccessInFatArrow1.js b/tests/baselines/reference/superAccessInFatArrow1.js index c7cc8308c5a..6222bf42fee 100644 --- a/tests/baselines/reference/superAccessInFatArrow1.js +++ b/tests/baselines/reference/superAccessInFatArrow1.js @@ -16,7 +16,7 @@ module test { } //// [superAccessInFatArrow1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superCallArgsMustMatch.js b/tests/baselines/reference/superCallArgsMustMatch.js index e38c519ead9..7c7948cc387 100644 --- a/tests/baselines/reference/superCallArgsMustMatch.js +++ b/tests/baselines/reference/superCallArgsMustMatch.js @@ -26,7 +26,7 @@ class T6 extends T5{ //// [superCallArgsMustMatch.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superCallAssignResult.js b/tests/baselines/reference/superCallAssignResult.js index 3a57a173a1c..a83e5b3de75 100644 --- a/tests/baselines/reference/superCallAssignResult.js +++ b/tests/baselines/reference/superCallAssignResult.js @@ -11,7 +11,7 @@ class H extends E { } //// [superCallAssignResult.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js index 036c6de833e..15e26b5481f 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType1.js @@ -12,7 +12,7 @@ class D extends B { //// [superCallFromClassThatDerivesFromGenericType1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js index 193e3c1ed28..15d24015a04 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericType2.js @@ -11,7 +11,7 @@ class D extends B { //// [superCallFromClassThatDerivesFromGenericType2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js index 92abed0d66d..114505b85a2 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js @@ -11,7 +11,7 @@ class B extends A { } //// [superCallFromClassThatDerivesFromGenericTypeButWithIncorrectNumberOfTypeArguments1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js index 7e3c61e6690..226665e3e67 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js @@ -11,7 +11,7 @@ class B extends A { } //// [superCallFromClassThatDerivesFromGenericTypeButWithNoTypeArguments1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js b/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js index b48d5bb7f58..7c07e78b0f9 100644 --- a/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js +++ b/tests/baselines/reference/superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js @@ -11,7 +11,7 @@ class B extends A { } //// [superCallFromClassThatDerivesNonGenericTypeButWithTypeArguments1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superCallInNonStaticMethod.js b/tests/baselines/reference/superCallInNonStaticMethod.js index 7ef1ce1c62a..c3038e23c4c 100644 --- a/tests/baselines/reference/superCallInNonStaticMethod.js +++ b/tests/baselines/reference/superCallInNonStaticMethod.js @@ -51,7 +51,7 @@ class Other extends Doing { //// [superCallInNonStaticMethod.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superCallInStaticMethod.js b/tests/baselines/reference/superCallInStaticMethod.js index 820551724ac..7e57cd2d2e8 100644 --- a/tests/baselines/reference/superCallInStaticMethod.js +++ b/tests/baselines/reference/superCallInStaticMethod.js @@ -47,7 +47,7 @@ class Other extends Doing { //// [superCallInStaticMethod.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superCallOutsideConstructor.js b/tests/baselines/reference/superCallOutsideConstructor.js index 94f41cccb57..0a1822bc549 100644 --- a/tests/baselines/reference/superCallOutsideConstructor.js +++ b/tests/baselines/reference/superCallOutsideConstructor.js @@ -23,7 +23,7 @@ var d = new D(); //// [superCallOutsideConstructor.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superCallParameterContextualTyping1.js b/tests/baselines/reference/superCallParameterContextualTyping1.js index b11d62d62c8..4888473319e 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping1.js +++ b/tests/baselines/reference/superCallParameterContextualTyping1.js @@ -13,7 +13,7 @@ class B extends A { //// [superCallParameterContextualTyping1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superCallParameterContextualTyping2.js b/tests/baselines/reference/superCallParameterContextualTyping2.js index 61e8b94f00f..ab6093c42be 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping2.js +++ b/tests/baselines/reference/superCallParameterContextualTyping2.js @@ -12,7 +12,7 @@ class C extends A { } //// [superCallParameterContextualTyping2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superCallParameterContextualTyping3.js b/tests/baselines/reference/superCallParameterContextualTyping3.js index e33bcb29bb8..574d281ed09 100644 --- a/tests/baselines/reference/superCallParameterContextualTyping3.js +++ b/tests/baselines/reference/superCallParameterContextualTyping3.js @@ -32,7 +32,7 @@ class C extends CBase { } //// [superCallParameterContextualTyping3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superCalls.js b/tests/baselines/reference/superCalls.js index 2928793feb6..d2e4f9ff7f1 100644 --- a/tests/baselines/reference/superCalls.js +++ b/tests/baselines/reference/superCalls.js @@ -31,7 +31,7 @@ class OtherDerived extends OtherBase { //// [superCalls.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superCallsInConstructor.js b/tests/baselines/reference/superCallsInConstructor.js index 0c19e365d92..6bd313898d4 100644 --- a/tests/baselines/reference/superCallsInConstructor.js +++ b/tests/baselines/reference/superCallsInConstructor.js @@ -21,7 +21,7 @@ class Derived extends Base { } //// [superCallsInConstructor.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superErrors.js b/tests/baselines/reference/superErrors.js index bb17019aa4e..2e1cd346cd4 100644 --- a/tests/baselines/reference/superErrors.js +++ b/tests/baselines/reference/superErrors.js @@ -52,7 +52,7 @@ class RegisteredUser extends User { } //// [superErrors.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superInCatchBlock1.js b/tests/baselines/reference/superInCatchBlock1.js index 1b9085ec266..38131f5f08e 100644 --- a/tests/baselines/reference/superInCatchBlock1.js +++ b/tests/baselines/reference/superInCatchBlock1.js @@ -14,7 +14,7 @@ class B extends A { //// [superInCatchBlock1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superInConstructorParam1.js b/tests/baselines/reference/superInConstructorParam1.js index e08dc9d73fd..aaf4162e992 100644 --- a/tests/baselines/reference/superInConstructorParam1.js +++ b/tests/baselines/reference/superInConstructorParam1.js @@ -11,7 +11,7 @@ class C extends B { } //// [superInConstructorParam1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superInLambdas.js b/tests/baselines/reference/superInLambdas.js index 10c489f1b40..5640425f6bc 100644 --- a/tests/baselines/reference/superInLambdas.js +++ b/tests/baselines/reference/superInLambdas.js @@ -68,7 +68,7 @@ class RegisteredUser4 extends User { } //// [superInLambdas.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superNewCall1.js b/tests/baselines/reference/superNewCall1.js index d9b74ac5080..1b11b61ce2f 100644 --- a/tests/baselines/reference/superNewCall1.js +++ b/tests/baselines/reference/superNewCall1.js @@ -13,7 +13,7 @@ class B extends A { } //// [superNewCall1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superPropertyAccess.js b/tests/baselines/reference/superPropertyAccess.js index a5419aaf36e..016fc09ff96 100644 --- a/tests/baselines/reference/superPropertyAccess.js +++ b/tests/baselines/reference/superPropertyAccess.js @@ -37,7 +37,7 @@ class MyDerived extends MyBase { } //// [superPropertyAccess.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superPropertyAccess1.js b/tests/baselines/reference/superPropertyAccess1.js index a0a52526f93..1ee834f3495 100644 --- a/tests/baselines/reference/superPropertyAccess1.js +++ b/tests/baselines/reference/superPropertyAccess1.js @@ -28,7 +28,7 @@ class D extends C { } //// [superPropertyAccess1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superPropertyAccess2.js b/tests/baselines/reference/superPropertyAccess2.js index b906f1b0a8b..0877cf23b9d 100644 --- a/tests/baselines/reference/superPropertyAccess2.js +++ b/tests/baselines/reference/superPropertyAccess2.js @@ -28,7 +28,7 @@ class D extends C { } //// [superPropertyAccess2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superPropertyAccessNoError.js b/tests/baselines/reference/superPropertyAccessNoError.js index e49a2c6b719..f8ee7f6d01b 100644 --- a/tests/baselines/reference/superPropertyAccessNoError.js +++ b/tests/baselines/reference/superPropertyAccessNoError.js @@ -67,7 +67,7 @@ class SomeDerivedClass extends SomeBaseClass { //super.publicInstanceMemberFunction in lambda in member function //super.publicStaticMemberFunction in static member function of derived class //super.publicStaticMemberFunction in static member accessor(get and set) of derived class -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superWithGenericSpecialization.js b/tests/baselines/reference/superWithGenericSpecialization.js index 92d7a8156aa..5cd85f90735 100644 --- a/tests/baselines/reference/superWithGenericSpecialization.js +++ b/tests/baselines/reference/superWithGenericSpecialization.js @@ -15,7 +15,7 @@ var r: string = d.x; var r2: number = d.y; //// [superWithGenericSpecialization.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superWithGenerics.js b/tests/baselines/reference/superWithGenerics.js index 1daef3e269f..8ba6f878dc2 100644 --- a/tests/baselines/reference/superWithGenerics.js +++ b/tests/baselines/reference/superWithGenerics.js @@ -12,7 +12,7 @@ class D extends B { //// [superWithGenerics.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superWithTypeArgument.js b/tests/baselines/reference/superWithTypeArgument.js index 96566a57490..2e5ea93a47a 100644 --- a/tests/baselines/reference/superWithTypeArgument.js +++ b/tests/baselines/reference/superWithTypeArgument.js @@ -10,7 +10,7 @@ class D extends C { } //// [superWithTypeArgument.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superWithTypeArgument2.js b/tests/baselines/reference/superWithTypeArgument2.js index a3dc7fbe58d..c33497d58fd 100644 --- a/tests/baselines/reference/superWithTypeArgument2.js +++ b/tests/baselines/reference/superWithTypeArgument2.js @@ -10,7 +10,7 @@ class D extends C { } //// [superWithTypeArgument2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/superWithTypeArgument3.js b/tests/baselines/reference/superWithTypeArgument3.js index ef228a3ba20..1266d97f264 100644 --- a/tests/baselines/reference/superWithTypeArgument3.js +++ b/tests/baselines/reference/superWithTypeArgument3.js @@ -14,7 +14,7 @@ class D extends C { } //// [superWithTypeArgument3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; 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 2a97b6d04d7..97fa57528cf 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 @@ -28,7 +28,7 @@ class SuperObjectTest extends F { //// [super_inside-object-literal-getters-and-setters.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/switchStatements.js b/tests/baselines/reference/switchStatements.js index 6348ca62e78..debd9a4d531 100644 --- a/tests/baselines/reference/switchStatements.js +++ b/tests/baselines/reference/switchStatements.js @@ -56,7 +56,7 @@ switch (((x: T) => '')(1)) { } //// [switchStatements.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/symbolDeclarationEmit1.symbols b/tests/baselines/reference/symbolDeclarationEmit1.symbols index 9205c9561c1..f24cfe2b783 100644 --- a/tests/baselines/reference/symbolDeclarationEmit1.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit1.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit1.ts, 0, 0)) [Symbol.toPrimitive]: number; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit10.symbols b/tests/baselines/reference/symbolDeclarationEmit10.symbols index 0f967048ef6..375bcf2174a 100644 --- a/tests/baselines/reference/symbolDeclarationEmit10.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit10.symbols @@ -4,12 +4,12 @@ var obj = { get [Symbol.isConcatSpreadable]() { return '' }, >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) set [Symbol.isConcatSpreadable](x) { } >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) >x : Symbol(x, Decl(symbolDeclarationEmit10.ts, 2, 36)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit11.symbols b/tests/baselines/reference/symbolDeclarationEmit11.symbols index 1f9b2f021a0..90290569e07 100644 --- a/tests/baselines/reference/symbolDeclarationEmit11.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit11.symbols @@ -4,22 +4,22 @@ class C { static [Symbol.iterator] = 0; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) static [Symbol.isConcatSpreadable]() { } >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) static get [Symbol.toPrimitive]() { return ""; } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) static set [Symbol.toPrimitive](x) { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) >x : Symbol(x, Decl(symbolDeclarationEmit11.ts, 4, 36)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit13.symbols b/tests/baselines/reference/symbolDeclarationEmit13.symbols index a4605173830..66f540a8cae 100644 --- a/tests/baselines/reference/symbolDeclarationEmit13.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit13.symbols @@ -3,13 +3,13 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit13.ts, 0, 0)) get [Symbol.toPrimitive]() { return ""; } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) set [Symbol.toStringTag](x) { } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) >x : Symbol(x, Decl(symbolDeclarationEmit13.ts, 2, 29)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit14.symbols b/tests/baselines/reference/symbolDeclarationEmit14.symbols index dcd0f523d61..5927b8a6a29 100644 --- a/tests/baselines/reference/symbolDeclarationEmit14.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit14.symbols @@ -3,12 +3,12 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit14.ts, 0, 0)) get [Symbol.toPrimitive]() { return ""; } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) get [Symbol.toStringTag]() { return ""; } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit2.symbols b/tests/baselines/reference/symbolDeclarationEmit2.symbols index 66d5fccb56e..3c214bd9c25 100644 --- a/tests/baselines/reference/symbolDeclarationEmit2.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit2.symbols @@ -3,7 +3,7 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit2.ts, 0, 0)) [Symbol.toPrimitive] = ""; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit3.symbols b/tests/baselines/reference/symbolDeclarationEmit3.symbols index 6fb95c4d2ac..d3a3a313223 100644 --- a/tests/baselines/reference/symbolDeclarationEmit3.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit3.symbols @@ -3,20 +3,20 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit3.ts, 0, 0)) [Symbol.toPrimitive](x: number); ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) >x : Symbol(x, Decl(symbolDeclarationEmit3.ts, 1, 25)) [Symbol.toPrimitive](x: string); ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) >x : Symbol(x, Decl(symbolDeclarationEmit3.ts, 2, 25)) [Symbol.toPrimitive](x: any) { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) >x : Symbol(x, Decl(symbolDeclarationEmit3.ts, 3, 25)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit4.symbols b/tests/baselines/reference/symbolDeclarationEmit4.symbols index feebcb95db5..d552300b70e 100644 --- a/tests/baselines/reference/symbolDeclarationEmit4.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit4.symbols @@ -3,13 +3,13 @@ class C { >C : Symbol(C, Decl(symbolDeclarationEmit4.ts, 0, 0)) get [Symbol.toPrimitive]() { return ""; } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) set [Symbol.toPrimitive](x) { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) >x : Symbol(x, Decl(symbolDeclarationEmit4.ts, 2, 29)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit5.symbols b/tests/baselines/reference/symbolDeclarationEmit5.symbols index c8db12c3e98..7f5fc3cf51b 100644 --- a/tests/baselines/reference/symbolDeclarationEmit5.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit5.symbols @@ -4,6 +4,6 @@ interface I { [Symbol.isConcatSpreadable](): string; >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit6.symbols b/tests/baselines/reference/symbolDeclarationEmit6.symbols index 999a852c5c7..fe60e2ecc31 100644 --- a/tests/baselines/reference/symbolDeclarationEmit6.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit6.symbols @@ -4,6 +4,6 @@ interface I { [Symbol.isConcatSpreadable]: string; >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit7.symbols b/tests/baselines/reference/symbolDeclarationEmit7.symbols index 75e92a85922..b044c5264d8 100644 --- a/tests/baselines/reference/symbolDeclarationEmit7.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit7.symbols @@ -4,6 +4,6 @@ var obj: { [Symbol.isConcatSpreadable]: string; >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit8.symbols b/tests/baselines/reference/symbolDeclarationEmit8.symbols index e57bb11047b..797b422c7fc 100644 --- a/tests/baselines/reference/symbolDeclarationEmit8.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit8.symbols @@ -4,6 +4,6 @@ var obj = { [Symbol.isConcatSpreadable]: 0 >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) } diff --git a/tests/baselines/reference/symbolDeclarationEmit9.symbols b/tests/baselines/reference/symbolDeclarationEmit9.symbols index fe80dae2816..deaf1c1bb62 100644 --- a/tests/baselines/reference/symbolDeclarationEmit9.symbols +++ b/tests/baselines/reference/symbolDeclarationEmit9.symbols @@ -4,6 +4,6 @@ var obj = { [Symbol.isConcatSpreadable]() { } >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) } diff --git a/tests/baselines/reference/symbolProperty11.symbols b/tests/baselines/reference/symbolProperty11.symbols index f1988f05268..f8b758cbf68 100644 --- a/tests/baselines/reference/symbolProperty11.symbols +++ b/tests/baselines/reference/symbolProperty11.symbols @@ -7,7 +7,7 @@ interface I { [Symbol.iterator]?: { x }; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) >x : Symbol(x, Decl(symbolProperty11.ts, 2, 25)) } diff --git a/tests/baselines/reference/symbolProperty13.symbols b/tests/baselines/reference/symbolProperty13.symbols index a2b66415992..246ca2f0851 100644 --- a/tests/baselines/reference/symbolProperty13.symbols +++ b/tests/baselines/reference/symbolProperty13.symbols @@ -4,7 +4,7 @@ class C { [Symbol.iterator]: { x; y }; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) >x : Symbol(x, Decl(symbolProperty13.ts, 1, 24)) >y : Symbol(y, Decl(symbolProperty13.ts, 1, 27)) @@ -14,7 +14,7 @@ interface I { [Symbol.iterator]: { x }; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) >x : Symbol(x, Decl(symbolProperty13.ts, 4, 24)) } diff --git a/tests/baselines/reference/symbolProperty14.symbols b/tests/baselines/reference/symbolProperty14.symbols index 27e8a5fd4c6..4531b13dca1 100644 --- a/tests/baselines/reference/symbolProperty14.symbols +++ b/tests/baselines/reference/symbolProperty14.symbols @@ -4,7 +4,7 @@ class C { [Symbol.iterator]: { x; y }; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) >x : Symbol(x, Decl(symbolProperty14.ts, 1, 24)) >y : Symbol(y, Decl(symbolProperty14.ts, 1, 27)) @@ -14,7 +14,7 @@ interface I { [Symbol.iterator]?: { x }; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) >x : Symbol(x, Decl(symbolProperty14.ts, 4, 25)) } diff --git a/tests/baselines/reference/symbolProperty15.symbols b/tests/baselines/reference/symbolProperty15.symbols index b18cc518ccb..6027f5e797e 100644 --- a/tests/baselines/reference/symbolProperty15.symbols +++ b/tests/baselines/reference/symbolProperty15.symbols @@ -7,7 +7,7 @@ interface I { [Symbol.iterator]?: { x }; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) >x : Symbol(x, Decl(symbolProperty15.ts, 2, 25)) } diff --git a/tests/baselines/reference/symbolProperty16.symbols b/tests/baselines/reference/symbolProperty16.symbols index c23f6ecd892..f7700e3b777 100644 --- a/tests/baselines/reference/symbolProperty16.symbols +++ b/tests/baselines/reference/symbolProperty16.symbols @@ -4,7 +4,7 @@ class C { private [Symbol.iterator]: { x }; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) >x : Symbol(x, Decl(symbolProperty16.ts, 1, 32)) } @@ -13,7 +13,7 @@ interface I { [Symbol.iterator]: { x }; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) >x : Symbol(x, Decl(symbolProperty16.ts, 4, 24)) } diff --git a/tests/baselines/reference/symbolProperty18.symbols b/tests/baselines/reference/symbolProperty18.symbols index db5cfb0d3f0..bc23c468a22 100644 --- a/tests/baselines/reference/symbolProperty18.symbols +++ b/tests/baselines/reference/symbolProperty18.symbols @@ -4,18 +4,18 @@ var i = { [Symbol.iterator]: 0, >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) [Symbol.toStringTag]() { return "" }, ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) set [Symbol.toPrimitive](p: boolean) { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) >p : Symbol(p, Decl(symbolProperty18.ts, 3, 29)) } @@ -23,19 +23,19 @@ var it = i[Symbol.iterator]; >it : Symbol(it, Decl(symbolProperty18.ts, 6, 3)) >i : Symbol(i, Decl(symbolProperty18.ts, 0, 3)) >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) var str = i[Symbol.toStringTag](); >str : Symbol(str, Decl(symbolProperty18.ts, 7, 3)) >i : Symbol(i, Decl(symbolProperty18.ts, 0, 3)) ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) i[Symbol.toPrimitive] = false; >i : Symbol(i, Decl(symbolProperty18.ts, 0, 3)) ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) diff --git a/tests/baselines/reference/symbolProperty19.symbols b/tests/baselines/reference/symbolProperty19.symbols index 5030f37d6bc..a0274f2c762 100644 --- a/tests/baselines/reference/symbolProperty19.symbols +++ b/tests/baselines/reference/symbolProperty19.symbols @@ -4,14 +4,14 @@ var i = { [Symbol.iterator]: { p: null }, >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) >p : Symbol(p, Decl(symbolProperty19.ts, 1, 24)) [Symbol.toStringTag]() { return { p: undefined }; } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) >p : Symbol(p, Decl(symbolProperty19.ts, 2, 37)) >undefined : Symbol(undefined) } @@ -20,13 +20,13 @@ var it = i[Symbol.iterator]; >it : Symbol(it, Decl(symbolProperty19.ts, 5, 3)) >i : Symbol(i, Decl(symbolProperty19.ts, 0, 3)) >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) var str = i[Symbol.toStringTag](); >str : Symbol(str, Decl(symbolProperty19.ts, 6, 3)) >i : Symbol(i, Decl(symbolProperty19.ts, 0, 3)) ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) diff --git a/tests/baselines/reference/symbolProperty2.symbols b/tests/baselines/reference/symbolProperty2.symbols index a2eea4344ab..c6bb74bef31 100644 --- a/tests/baselines/reference/symbolProperty2.symbols +++ b/tests/baselines/reference/symbolProperty2.symbols @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/Symbols/symbolProperty2.ts === var s = Symbol(); >s : Symbol(s, Decl(symbolProperty2.ts, 0, 3)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) var x = { >x : Symbol(x, Decl(symbolProperty2.ts, 1, 3)) diff --git a/tests/baselines/reference/symbolProperty20.symbols b/tests/baselines/reference/symbolProperty20.symbols index d7281ee1aec..04c76275b55 100644 --- a/tests/baselines/reference/symbolProperty20.symbols +++ b/tests/baselines/reference/symbolProperty20.symbols @@ -4,14 +4,14 @@ interface I { [Symbol.iterator]: (s: string) => string; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) >s : Symbol(s, Decl(symbolProperty20.ts, 1, 24)) [Symbol.toStringTag](s: number): number; ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) >s : Symbol(s, Decl(symbolProperty20.ts, 2, 25)) } @@ -21,15 +21,15 @@ var i: I = { [Symbol.iterator]: s => s, >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) >s : Symbol(s, Decl(symbolProperty20.ts, 6, 22)) >s : Symbol(s, Decl(symbolProperty20.ts, 6, 22)) [Symbol.toStringTag](n) { return n; } ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) >n : Symbol(n, Decl(symbolProperty20.ts, 7, 25)) >n : Symbol(n, Decl(symbolProperty20.ts, 7, 25)) } diff --git a/tests/baselines/reference/symbolProperty21.symbols b/tests/baselines/reference/symbolProperty21.symbols index 5a62b46dd85..544813c3056 100644 --- a/tests/baselines/reference/symbolProperty21.symbols +++ b/tests/baselines/reference/symbolProperty21.symbols @@ -5,14 +5,14 @@ interface I { >U : Symbol(U, Decl(symbolProperty21.ts, 0, 14)) [Symbol.unscopables]: T; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1254, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1254, 24)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1284, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1284, 24)) >T : Symbol(T, Decl(symbolProperty21.ts, 0, 12)) [Symbol.isConcatSpreadable]: U; >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) >U : Symbol(U, Decl(symbolProperty21.ts, 0, 14)) } @@ -35,17 +35,17 @@ foo({ [Symbol.isConcatSpreadable]: "", >Symbol.isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >isConcatSpreadable : Symbol(SymbolConstructor.isConcatSpreadable, Decl(lib.d.ts, 1230, 24)) [Symbol.toPrimitive]: 0, ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) [Symbol.unscopables]: true ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1254, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1254, 24)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1284, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1284, 24)) }); diff --git a/tests/baselines/reference/symbolProperty22.symbols b/tests/baselines/reference/symbolProperty22.symbols index c346eb2df33..e9f6761e121 100644 --- a/tests/baselines/reference/symbolProperty22.symbols +++ b/tests/baselines/reference/symbolProperty22.symbols @@ -5,9 +5,9 @@ interface I { >U : Symbol(U, Decl(symbolProperty22.ts, 0, 14)) [Symbol.unscopables](x: T): U; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1254, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1254, 24)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1284, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1284, 24)) >x : Symbol(x, Decl(symbolProperty22.ts, 1, 25)) >T : Symbol(T, Decl(symbolProperty22.ts, 0, 12)) >U : Symbol(U, Decl(symbolProperty22.ts, 0, 14)) @@ -27,9 +27,9 @@ declare function foo(p1: T, p2: I): U; foo("", { [Symbol.unscopables]: s => s.length }); >foo : Symbol(foo, Decl(symbolProperty22.ts, 2, 1)) ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1254, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1254, 24)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1284, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1284, 24)) >s : Symbol(s, Decl(symbolProperty22.ts, 6, 31)) >s.length : Symbol(String.length, Decl(lib.d.ts, 414, 19)) >s : Symbol(s, Decl(symbolProperty22.ts, 6, 31)) diff --git a/tests/baselines/reference/symbolProperty23.symbols b/tests/baselines/reference/symbolProperty23.symbols index f6cb0feaa45..d220f80c0f7 100644 --- a/tests/baselines/reference/symbolProperty23.symbols +++ b/tests/baselines/reference/symbolProperty23.symbols @@ -3,9 +3,9 @@ interface I { >I : Symbol(I, Decl(symbolProperty23.ts, 0, 0)) [Symbol.toPrimitive]: () => boolean; ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) } class C implements I { @@ -13,9 +13,9 @@ class C implements I { >I : Symbol(I, Decl(symbolProperty23.ts, 0, 0)) [Symbol.toPrimitive]() { ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) return true; } diff --git a/tests/baselines/reference/symbolProperty26.symbols b/tests/baselines/reference/symbolProperty26.symbols index e64337f1cf2..819b93e6147 100644 --- a/tests/baselines/reference/symbolProperty26.symbols +++ b/tests/baselines/reference/symbolProperty26.symbols @@ -3,9 +3,9 @@ class C1 { >C1 : Symbol(C1, Decl(symbolProperty26.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) return ""; } @@ -16,9 +16,9 @@ class C2 extends C1 { >C1 : Symbol(C1, Decl(symbolProperty26.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) return ""; } diff --git a/tests/baselines/reference/symbolProperty27.symbols b/tests/baselines/reference/symbolProperty27.symbols index f2d92b6e0c7..7ead7b14b34 100644 --- a/tests/baselines/reference/symbolProperty27.symbols +++ b/tests/baselines/reference/symbolProperty27.symbols @@ -3,9 +3,9 @@ class C1 { >C1 : Symbol(C1, Decl(symbolProperty27.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) return {}; } @@ -16,9 +16,9 @@ class C2 extends C1 { >C1 : Symbol(C1, Decl(symbolProperty27.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) return ""; } diff --git a/tests/baselines/reference/symbolProperty28.symbols b/tests/baselines/reference/symbolProperty28.symbols index 045ed15a707..9f57cd1e2e3 100644 --- a/tests/baselines/reference/symbolProperty28.symbols +++ b/tests/baselines/reference/symbolProperty28.symbols @@ -3,9 +3,9 @@ class C1 { >C1 : Symbol(C1, Decl(symbolProperty28.ts, 0, 0)) [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) return { x: "" }; >x : Symbol(x, Decl(symbolProperty28.ts, 2, 16)) @@ -24,8 +24,8 @@ var obj = c[Symbol.toStringTag]().x; >obj : Symbol(obj, Decl(symbolProperty28.ts, 9, 3)) >c[Symbol.toStringTag]().x : Symbol(x, Decl(symbolProperty28.ts, 2, 16)) >c : Symbol(c, Decl(symbolProperty28.ts, 8, 3)) ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) >x : Symbol(x, Decl(symbolProperty28.ts, 2, 16)) diff --git a/tests/baselines/reference/symbolProperty4.symbols b/tests/baselines/reference/symbolProperty4.symbols index 564597e236d..a6594f5146b 100644 --- a/tests/baselines/reference/symbolProperty4.symbols +++ b/tests/baselines/reference/symbolProperty4.symbols @@ -3,13 +3,13 @@ var x = { >x : Symbol(x, Decl(symbolProperty4.ts, 0, 3)) [Symbol()]: 0, ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) [Symbol()]() { }, ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) get [Symbol()]() { ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) return 0; } diff --git a/tests/baselines/reference/symbolProperty40.symbols b/tests/baselines/reference/symbolProperty40.symbols index a524bd2b809..1f0fdaf91a7 100644 --- a/tests/baselines/reference/symbolProperty40.symbols +++ b/tests/baselines/reference/symbolProperty40.symbols @@ -4,19 +4,19 @@ class C { [Symbol.iterator](x: string): string; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) >x : Symbol(x, Decl(symbolProperty40.ts, 1, 22)) [Symbol.iterator](x: number): number; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) >x : Symbol(x, Decl(symbolProperty40.ts, 2, 22)) [Symbol.iterator](x: any) { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) >x : Symbol(x, Decl(symbolProperty40.ts, 3, 22)) @@ -32,12 +32,12 @@ var c = new C; c[Symbol.iterator](""); >c : Symbol(c, Decl(symbolProperty40.ts, 8, 3)) >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) c[Symbol.iterator](0); >c : Symbol(c, Decl(symbolProperty40.ts, 8, 3)) >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) diff --git a/tests/baselines/reference/symbolProperty41.symbols b/tests/baselines/reference/symbolProperty41.symbols index 78eae3f7704..d50401a637a 100644 --- a/tests/baselines/reference/symbolProperty41.symbols +++ b/tests/baselines/reference/symbolProperty41.symbols @@ -4,14 +4,14 @@ class C { [Symbol.iterator](x: string): { x: string }; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) >x : Symbol(x, Decl(symbolProperty41.ts, 1, 22)) >x : Symbol(x, Decl(symbolProperty41.ts, 1, 35)) [Symbol.iterator](x: "hello"): { x: string; hello: string }; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) >x : Symbol(x, Decl(symbolProperty41.ts, 2, 22)) >x : Symbol(x, Decl(symbolProperty41.ts, 2, 36)) @@ -19,7 +19,7 @@ class C { [Symbol.iterator](x: any) { >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) >x : Symbol(x, Decl(symbolProperty41.ts, 3, 22)) @@ -35,12 +35,12 @@ var c = new C; c[Symbol.iterator](""); >c : Symbol(c, Decl(symbolProperty41.ts, 8, 3)) >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) c[Symbol.iterator]("hello"); >c : Symbol(c, Decl(symbolProperty41.ts, 8, 3)) >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) diff --git a/tests/baselines/reference/symbolProperty45.symbols b/tests/baselines/reference/symbolProperty45.symbols index d086418b1f7..4c3d2595c13 100644 --- a/tests/baselines/reference/symbolProperty45.symbols +++ b/tests/baselines/reference/symbolProperty45.symbols @@ -4,15 +4,15 @@ class C { get [Symbol.hasInstance]() { >Symbol.hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.d.ts, 1222, 32)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >hasInstance : Symbol(SymbolConstructor.hasInstance, Decl(lib.d.ts, 1222, 32)) return ""; } get [Symbol.toPrimitive]() { ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) return ""; } diff --git a/tests/baselines/reference/symbolProperty5.symbols b/tests/baselines/reference/symbolProperty5.symbols index 8bef856c527..a759e09588e 100644 --- a/tests/baselines/reference/symbolProperty5.symbols +++ b/tests/baselines/reference/symbolProperty5.symbols @@ -4,18 +4,18 @@ var x = { [Symbol.iterator]: 0, >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) [Symbol.toPrimitive]() { }, ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) get [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) return 0; } diff --git a/tests/baselines/reference/symbolProperty50.symbols b/tests/baselines/reference/symbolProperty50.symbols index 7d2c00d0c1f..ee785ae606d 100644 --- a/tests/baselines/reference/symbolProperty50.symbols +++ b/tests/baselines/reference/symbolProperty50.symbols @@ -10,7 +10,7 @@ module M { [Symbol.iterator]() { } >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) } } diff --git a/tests/baselines/reference/symbolProperty51.symbols b/tests/baselines/reference/symbolProperty51.symbols index 1f66a4f6416..825f73ebcd1 100644 --- a/tests/baselines/reference/symbolProperty51.symbols +++ b/tests/baselines/reference/symbolProperty51.symbols @@ -10,7 +10,7 @@ module M { [Symbol.iterator]() { } >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) } } diff --git a/tests/baselines/reference/symbolProperty55.symbols b/tests/baselines/reference/symbolProperty55.symbols index fadedd9c9ac..e76ad43f43d 100644 --- a/tests/baselines/reference/symbolProperty55.symbols +++ b/tests/baselines/reference/symbolProperty55.symbols @@ -4,7 +4,7 @@ var obj = { [Symbol.iterator]: 0 >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) }; diff --git a/tests/baselines/reference/symbolProperty56.symbols b/tests/baselines/reference/symbolProperty56.symbols index 51540e8f743..caca4686bbf 100644 --- a/tests/baselines/reference/symbolProperty56.symbols +++ b/tests/baselines/reference/symbolProperty56.symbols @@ -4,7 +4,7 @@ var obj = { [Symbol.iterator]: 0 >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) }; diff --git a/tests/baselines/reference/symbolProperty57.symbols b/tests/baselines/reference/symbolProperty57.symbols index 01bedd59434..4e0ce420388 100644 --- a/tests/baselines/reference/symbolProperty57.symbols +++ b/tests/baselines/reference/symbolProperty57.symbols @@ -4,7 +4,7 @@ var obj = { [Symbol.iterator]: 0 >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) }; @@ -12,5 +12,5 @@ var obj = { // Should give type 'any'. obj[Symbol["nonsense"]]; >obj : Symbol(obj, Decl(symbolProperty57.ts, 0, 3)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) diff --git a/tests/baselines/reference/symbolProperty6.symbols b/tests/baselines/reference/symbolProperty6.symbols index 9accb8142b4..cedcfe69a9f 100644 --- a/tests/baselines/reference/symbolProperty6.symbols +++ b/tests/baselines/reference/symbolProperty6.symbols @@ -4,23 +4,23 @@ class C { [Symbol.iterator] = 0; >Symbol.iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >iterator : Symbol(SymbolConstructor.iterator, Decl(lib.d.ts, 1236, 31)) [Symbol.unscopables]: number; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1254, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1254, 24)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1284, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1284, 24)) [Symbol.toPrimitive]() { } ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) get [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1248, 24)) +>Symbol.toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toStringTag : Symbol(SymbolConstructor.toStringTag, Decl(lib.d.ts, 1278, 24)) return 0; } diff --git a/tests/baselines/reference/symbolProperty8.symbols b/tests/baselines/reference/symbolProperty8.symbols index 7c894d2b00d..269a8412d95 100644 --- a/tests/baselines/reference/symbolProperty8.symbols +++ b/tests/baselines/reference/symbolProperty8.symbols @@ -3,12 +3,12 @@ interface I { >I : Symbol(I, Decl(symbolProperty8.ts, 0, 0)) [Symbol.unscopables]: number; ->Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1254, 24)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1254, 24)) +>Symbol.unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1284, 24)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>unscopables : Symbol(SymbolConstructor.unscopables, Decl(lib.d.ts, 1284, 24)) [Symbol.toPrimitive](); ->Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) ->toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1242, 21)) +>Symbol.toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) +>toPrimitive : Symbol(SymbolConstructor.toPrimitive, Decl(lib.d.ts, 1272, 18)) } diff --git a/tests/baselines/reference/symbolType11.symbols b/tests/baselines/reference/symbolType11.symbols index 219e0b2f496..4bf91a6112e 100644 --- a/tests/baselines/reference/symbolType11.symbols +++ b/tests/baselines/reference/symbolType11.symbols @@ -2,7 +2,7 @@ var s = Symbol.for("logical"); >s : Symbol(s, Decl(symbolType11.ts, 0, 3)) >Symbol.for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, 1208, 42)) ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11)) >for : Symbol(SymbolConstructor.for, Decl(lib.d.ts, 1208, 42)) s && s; diff --git a/tests/baselines/reference/symbolType16.symbols b/tests/baselines/reference/symbolType16.symbols index ac0749f4ac5..1d87ae6a1a4 100644 --- a/tests/baselines/reference/symbolType16.symbols +++ b/tests/baselines/reference/symbolType16.symbols @@ -1,6 +1,6 @@ === tests/cases/conformance/es6/Symbols/symbolType16.ts === interface Symbol { ->Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1262, 11), Decl(symbolType16.ts, 0, 0)) +>Symbol : Symbol(Symbol, Decl(lib.d.ts, 1186, 52), Decl(lib.d.ts, 1292, 11), Decl(symbolType16.ts, 0, 0)) newSymbolProp: number; >newSymbolProp : Symbol(newSymbolProp, Decl(symbolType16.ts, 0, 18)) diff --git a/tests/baselines/reference/targetTypeBaseCalls.js b/tests/baselines/reference/targetTypeBaseCalls.js index c886183bacf..bde689ba2c9 100644 --- a/tests/baselines/reference/targetTypeBaseCalls.js +++ b/tests/baselines/reference/targetTypeBaseCalls.js @@ -19,7 +19,7 @@ class Bar extends Foo { constructor() { super(function(s) { s = 5 }) } } // err //// [targetTypeBaseCalls.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols b/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols index 7191801513a..0cfe0d854be 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols +++ b/tests/baselines/reference/templateStringWithEmbeddedNewOperatorES6.symbols @@ -1,5 +1,5 @@ === tests/cases/conformance/es6/templates/templateStringWithEmbeddedNewOperatorES6.ts === var x = `abc${ new String("Hi") }def`; >x : Symbol(x, Decl(templateStringWithEmbeddedNewOperatorES6.ts, 0, 3)) ->String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1508, 1)) +>String : Symbol(String, Decl(lib.d.ts, 275, 1), Decl(lib.d.ts, 443, 11), Decl(lib.d.ts, 1538, 1)) diff --git a/tests/baselines/reference/thisInInvalidContexts.js b/tests/baselines/reference/thisInInvalidContexts.js index 5720156de0b..afce4ec0375 100644 --- a/tests/baselines/reference/thisInInvalidContexts.js +++ b/tests/baselines/reference/thisInInvalidContexts.js @@ -49,7 +49,7 @@ enum SomeEnum { //// [thisInInvalidContexts.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/thisInInvalidContextsExternalModule.js b/tests/baselines/reference/thisInInvalidContextsExternalModule.js index eee8bcc8487..8fcbe226437 100644 --- a/tests/baselines/reference/thisInInvalidContextsExternalModule.js +++ b/tests/baselines/reference/thisInInvalidContextsExternalModule.js @@ -49,7 +49,7 @@ enum SomeEnum { export = this; // Should be an error //// [thisInInvalidContextsExternalModule.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/thisInSuperCall.js b/tests/baselines/reference/thisInSuperCall.js index 779d74daa58..3da6d9c8a68 100644 --- a/tests/baselines/reference/thisInSuperCall.js +++ b/tests/baselines/reference/thisInSuperCall.js @@ -23,7 +23,7 @@ class Foo3 extends Base { } //// [thisInSuperCall.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/thisInSuperCall1.js b/tests/baselines/reference/thisInSuperCall1.js index 09b3c2cb591..b0ff1bd4bab 100644 --- a/tests/baselines/reference/thisInSuperCall1.js +++ b/tests/baselines/reference/thisInSuperCall1.js @@ -11,7 +11,7 @@ class Foo extends Base { //// [thisInSuperCall1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/thisInSuperCall2.js b/tests/baselines/reference/thisInSuperCall2.js index d21496a9834..fca671a2c73 100644 --- a/tests/baselines/reference/thisInSuperCall2.js +++ b/tests/baselines/reference/thisInSuperCall2.js @@ -20,7 +20,7 @@ class Foo2 extends Base { //// [thisInSuperCall2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/thisInSuperCall3.js b/tests/baselines/reference/thisInSuperCall3.js index 6660788e40d..fe2bdec77ed 100644 --- a/tests/baselines/reference/thisInSuperCall3.js +++ b/tests/baselines/reference/thisInSuperCall3.js @@ -13,7 +13,7 @@ class Foo extends Base { //// [thisInSuperCall3.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/typeAssertions.js b/tests/baselines/reference/typeAssertions.js index 01acf58227b..51ca6a27f0e 100644 --- a/tests/baselines/reference/typeAssertions.js +++ b/tests/baselines/reference/typeAssertions.js @@ -43,7 +43,7 @@ someOther = someOther; //// [typeAssertions.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/typeGuardOfFormInstanceOf.js b/tests/baselines/reference/typeGuardOfFormInstanceOf.js index 093e80cbb74..de7e9813a84 100644 --- a/tests/baselines/reference/typeGuardOfFormInstanceOf.js +++ b/tests/baselines/reference/typeGuardOfFormInstanceOf.js @@ -36,7 +36,7 @@ var r2: D1 | C2 = c2Ord1 instanceof C1 && c2Ord1; // C2 | D1 // - when true, narrows the type of x to the type of the 'prototype' property in C provided // it is a subtype of the type of x, or // - when false, has no effect on the type of x. -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/typeMatch2.js b/tests/baselines/reference/typeMatch2.js index 1fd624e4e5b..6f05bf684f1 100644 --- a/tests/baselines/reference/typeMatch2.js +++ b/tests/baselines/reference/typeMatch2.js @@ -45,7 +45,7 @@ function f4() { //// [typeMatch2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/typeOfSuperCall.js b/tests/baselines/reference/typeOfSuperCall.js index 206b44ea349..5df29d615e4 100644 --- a/tests/baselines/reference/typeOfSuperCall.js +++ b/tests/baselines/reference/typeOfSuperCall.js @@ -9,7 +9,7 @@ class D extends C { } //// [typeOfSuperCall.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/typeParameterAsBaseClass.js b/tests/baselines/reference/typeParameterAsBaseClass.js index 8814b3a8531..b00a00abac5 100644 --- a/tests/baselines/reference/typeParameterAsBaseClass.js +++ b/tests/baselines/reference/typeParameterAsBaseClass.js @@ -3,7 +3,7 @@ class C extends T {} class C2 implements T {} //// [typeParameterAsBaseClass.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/typeParameterAsBaseType.js b/tests/baselines/reference/typeParameterAsBaseType.js index c7b15484cba..2715c09fa23 100644 --- a/tests/baselines/reference/typeParameterAsBaseType.js +++ b/tests/baselines/reference/typeParameterAsBaseType.js @@ -13,7 +13,7 @@ interface I2 extends U { } //// [typeParameterAsBaseType.js] // type parameters cannot be used as base types // these are all errors -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/typeParameterExtendingUnion1.js b/tests/baselines/reference/typeParameterExtendingUnion1.js index 2cfbe7b07b6..c5e8fccf350 100644 --- a/tests/baselines/reference/typeParameterExtendingUnion1.js +++ b/tests/baselines/reference/typeParameterExtendingUnion1.js @@ -13,7 +13,7 @@ function f(a: T) { } //// [typeParameterExtendingUnion1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/typeParameterExtendingUnion2.js b/tests/baselines/reference/typeParameterExtendingUnion2.js index c5e462bb96c..e53aeb42f22 100644 --- a/tests/baselines/reference/typeParameterExtendingUnion2.js +++ b/tests/baselines/reference/typeParameterExtendingUnion2.js @@ -13,7 +13,7 @@ function f(a: T) { } //// [typeParameterExtendingUnion2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/typeValueConflict1.js b/tests/baselines/reference/typeValueConflict1.js index 8f39b913f82..d036d90262f 100644 --- a/tests/baselines/reference/typeValueConflict1.js +++ b/tests/baselines/reference/typeValueConflict1.js @@ -12,7 +12,7 @@ module M2 { //// [typeValueConflict1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/typeValueConflict2.js b/tests/baselines/reference/typeValueConflict2.js index 52d3d906cfd..c927e70615a 100644 --- a/tests/baselines/reference/typeValueConflict2.js +++ b/tests/baselines/reference/typeValueConflict2.js @@ -19,7 +19,7 @@ module M3 { //// [typeValueConflict2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/typedArrays.symbols b/tests/baselines/reference/typedArrays.symbols index c0ddc7183f0..27b72cc54f1 100644 --- a/tests/baselines/reference/typedArrays.symbols +++ b/tests/baselines/reference/typedArrays.symbols @@ -8,39 +8,39 @@ function CreateTypedArrayTypes() { typedArrays[0] = Int8Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2077, 42), Decl(lib.d.ts, 2367, 11)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2107, 42), Decl(lib.d.ts, 2397, 11)) typedArrays[1] = Uint8Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2367, 44), Decl(lib.d.ts, 2657, 11)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2397, 44), Decl(lib.d.ts, 2687, 11)) typedArrays[2] = Int16Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2947, 60), Decl(lib.d.ts, 3237, 11)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2977, 60), Decl(lib.d.ts, 3267, 11)) typedArrays[3] = Uint16Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3237, 46), Decl(lib.d.ts, 3527, 11)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3267, 46), Decl(lib.d.ts, 3557, 11)) typedArrays[4] = Int32Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3527, 48), Decl(lib.d.ts, 3817, 11)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3557, 48), Decl(lib.d.ts, 3847, 11)) typedArrays[5] = Uint32Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3817, 46), Decl(lib.d.ts, 4107, 11)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3847, 46), Decl(lib.d.ts, 4137, 11)) typedArrays[6] = Float32Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4107, 48), Decl(lib.d.ts, 4397, 11)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4137, 48), Decl(lib.d.ts, 4427, 11)) typedArrays[7] = Float64Array; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4397, 50), Decl(lib.d.ts, 4687, 11)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4427, 50), Decl(lib.d.ts, 4717, 11)) typedArrays[8] = Uint8ClampedArray; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2657, 46), Decl(lib.d.ts, 2947, 11)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2687, 46), Decl(lib.d.ts, 2977, 11)) return typedArrays; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 2, 7)) @@ -55,47 +55,47 @@ function CreateTypedArrayInstancesFromLength(obj: number) { typedArrays[0] = new Int8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2077, 42), Decl(lib.d.ts, 2367, 11)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2107, 42), Decl(lib.d.ts, 2397, 11)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[1] = new Uint8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2367, 44), Decl(lib.d.ts, 2657, 11)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2397, 44), Decl(lib.d.ts, 2687, 11)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[2] = new Int16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2947, 60), Decl(lib.d.ts, 3237, 11)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2977, 60), Decl(lib.d.ts, 3267, 11)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[3] = new Uint16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3237, 46), Decl(lib.d.ts, 3527, 11)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3267, 46), Decl(lib.d.ts, 3557, 11)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[4] = new Int32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3527, 48), Decl(lib.d.ts, 3817, 11)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3557, 48), Decl(lib.d.ts, 3847, 11)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[5] = new Uint32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3817, 46), Decl(lib.d.ts, 4107, 11)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3847, 46), Decl(lib.d.ts, 4137, 11)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[6] = new Float32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4107, 48), Decl(lib.d.ts, 4397, 11)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4137, 48), Decl(lib.d.ts, 4427, 11)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[7] = new Float64Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4397, 50), Decl(lib.d.ts, 4687, 11)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4427, 50), Decl(lib.d.ts, 4717, 11)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) typedArrays[8] = new Uint8ClampedArray(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 17, 7)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2657, 46), Decl(lib.d.ts, 2947, 11)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2687, 46), Decl(lib.d.ts, 2977, 11)) >obj : Symbol(obj, Decl(typedArrays.ts, 16, 45)) return typedArrays; @@ -111,47 +111,47 @@ function CreateTypedArrayInstancesFromArray(obj: number[]) { typedArrays[0] = new Int8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2077, 42), Decl(lib.d.ts, 2367, 11)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2107, 42), Decl(lib.d.ts, 2397, 11)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[1] = new Uint8Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2367, 44), Decl(lib.d.ts, 2657, 11)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2397, 44), Decl(lib.d.ts, 2687, 11)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[2] = new Int16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2947, 60), Decl(lib.d.ts, 3237, 11)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2977, 60), Decl(lib.d.ts, 3267, 11)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[3] = new Uint16Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3237, 46), Decl(lib.d.ts, 3527, 11)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3267, 46), Decl(lib.d.ts, 3557, 11)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[4] = new Int32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3527, 48), Decl(lib.d.ts, 3817, 11)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3557, 48), Decl(lib.d.ts, 3847, 11)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[5] = new Uint32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3817, 46), Decl(lib.d.ts, 4107, 11)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3847, 46), Decl(lib.d.ts, 4137, 11)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[6] = new Float32Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4107, 48), Decl(lib.d.ts, 4397, 11)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4137, 48), Decl(lib.d.ts, 4427, 11)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[7] = new Float64Array(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4397, 50), Decl(lib.d.ts, 4687, 11)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4427, 50), Decl(lib.d.ts, 4717, 11)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) typedArrays[8] = new Uint8ClampedArray(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 32, 7)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2657, 46), Decl(lib.d.ts, 2947, 11)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2687, 46), Decl(lib.d.ts, 2977, 11)) >obj : Symbol(obj, Decl(typedArrays.ts, 31, 44)) return typedArrays; @@ -167,65 +167,65 @@ function CreateIntegerTypedArraysFromArray2(obj:number[]) { typedArrays[0] = Int8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2357, 38)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2077, 42), Decl(lib.d.ts, 2367, 11)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2357, 38)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2387, 38)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2107, 42), Decl(lib.d.ts, 2397, 11)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2387, 38)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[1] = Uint8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2647, 39)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2367, 44), Decl(lib.d.ts, 2657, 11)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2647, 39)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2677, 39)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2397, 44), Decl(lib.d.ts, 2687, 11)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2677, 39)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[2] = Int16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3227, 39)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2947, 60), Decl(lib.d.ts, 3237, 11)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3227, 39)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3257, 39)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2977, 60), Decl(lib.d.ts, 3267, 11)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3257, 39)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[3] = Uint16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3517, 40)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3237, 46), Decl(lib.d.ts, 3527, 11)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3517, 40)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3547, 40)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3267, 46), Decl(lib.d.ts, 3557, 11)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3547, 40)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[4] = Int32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3807, 39)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3527, 48), Decl(lib.d.ts, 3817, 11)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3807, 39)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3837, 39)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3557, 48), Decl(lib.d.ts, 3847, 11)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3837, 39)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[5] = Uint32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4097, 40)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3817, 46), Decl(lib.d.ts, 4107, 11)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4097, 40)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4127, 40)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3847, 46), Decl(lib.d.ts, 4137, 11)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4127, 40)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[6] = Float32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4387, 41)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4107, 48), Decl(lib.d.ts, 4397, 11)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4387, 41)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4417, 41)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4137, 48), Decl(lib.d.ts, 4427, 11)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4417, 41)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[7] = Float64Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4677, 41)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4397, 50), Decl(lib.d.ts, 4687, 11)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4677, 41)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4707, 41)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4427, 50), Decl(lib.d.ts, 4717, 11)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4707, 41)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) typedArrays[8] = Uint8ClampedArray.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 47, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2937, 46)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2657, 46), Decl(lib.d.ts, 2947, 11)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2937, 46)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2967, 46)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2687, 46), Decl(lib.d.ts, 2977, 11)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2967, 46)) >obj : Symbol(obj, Decl(typedArrays.ts, 46, 44)) return typedArrays; @@ -235,72 +235,72 @@ function CreateIntegerTypedArraysFromArray2(obj:number[]) { function CreateIntegerTypedArraysFromArrayLike(obj:ArrayLike) { >CreateIntegerTypedArraysFromArrayLike : Symbol(CreateIntegerTypedArraysFromArrayLike, Decl(typedArrays.ts, 59, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) ->ArrayLike : Symbol(ArrayLike, Decl(lib.d.ts, 1404, 1)) +>ArrayLike : Symbol(ArrayLike, Decl(lib.d.ts, 1434, 1)) var typedArrays = []; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) typedArrays[0] = Int8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2357, 38)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2077, 42), Decl(lib.d.ts, 2367, 11)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2357, 38)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2387, 38)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2107, 42), Decl(lib.d.ts, 2397, 11)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2387, 38)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[1] = Uint8Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2647, 39)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2367, 44), Decl(lib.d.ts, 2657, 11)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2647, 39)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2677, 39)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2397, 44), Decl(lib.d.ts, 2687, 11)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2677, 39)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[2] = Int16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3227, 39)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2947, 60), Decl(lib.d.ts, 3237, 11)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3227, 39)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3257, 39)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2977, 60), Decl(lib.d.ts, 3267, 11)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3257, 39)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[3] = Uint16Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3517, 40)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3237, 46), Decl(lib.d.ts, 3527, 11)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3517, 40)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3547, 40)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3267, 46), Decl(lib.d.ts, 3557, 11)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3547, 40)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[4] = Int32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3807, 39)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3527, 48), Decl(lib.d.ts, 3817, 11)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3807, 39)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3837, 39)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3557, 48), Decl(lib.d.ts, 3847, 11)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3837, 39)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[5] = Uint32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4097, 40)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3817, 46), Decl(lib.d.ts, 4107, 11)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4097, 40)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4127, 40)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3847, 46), Decl(lib.d.ts, 4137, 11)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4127, 40)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[6] = Float32Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4387, 41)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4107, 48), Decl(lib.d.ts, 4397, 11)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4387, 41)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4417, 41)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4137, 48), Decl(lib.d.ts, 4427, 11)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4417, 41)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[7] = Float64Array.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4677, 41)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4397, 50), Decl(lib.d.ts, 4687, 11)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4677, 41)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4707, 41)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4427, 50), Decl(lib.d.ts, 4717, 11)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4707, 41)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) typedArrays[8] = Uint8ClampedArray.from(obj); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 62, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2937, 46)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2657, 46), Decl(lib.d.ts, 2947, 11)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2937, 46)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2967, 46)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2687, 46), Decl(lib.d.ts, 2977, 11)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2967, 46)) >obj : Symbol(obj, Decl(typedArrays.ts, 61, 47)) return typedArrays; @@ -332,57 +332,57 @@ function CreateTypedArraysOf2() { typedArrays[0] = Int8Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Int8Array.of : Symbol(Int8ArrayConstructor.of, Decl(lib.d.ts, 2351, 30)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2077, 42), Decl(lib.d.ts, 2367, 11)) ->of : Symbol(Int8ArrayConstructor.of, Decl(lib.d.ts, 2351, 30)) +>Int8Array.of : Symbol(Int8ArrayConstructor.of, Decl(lib.d.ts, 2381, 30)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2107, 42), Decl(lib.d.ts, 2397, 11)) +>of : Symbol(Int8ArrayConstructor.of, Decl(lib.d.ts, 2381, 30)) typedArrays[1] = Uint8Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Uint8Array.of : Symbol(Uint8ArrayConstructor.of, Decl(lib.d.ts, 2641, 30)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2367, 44), Decl(lib.d.ts, 2657, 11)) ->of : Symbol(Uint8ArrayConstructor.of, Decl(lib.d.ts, 2641, 30)) +>Uint8Array.of : Symbol(Uint8ArrayConstructor.of, Decl(lib.d.ts, 2671, 30)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2397, 44), Decl(lib.d.ts, 2687, 11)) +>of : Symbol(Uint8ArrayConstructor.of, Decl(lib.d.ts, 2671, 30)) typedArrays[2] = Int16Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Int16Array.of : Symbol(Int16ArrayConstructor.of, Decl(lib.d.ts, 3221, 30)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2947, 60), Decl(lib.d.ts, 3237, 11)) ->of : Symbol(Int16ArrayConstructor.of, Decl(lib.d.ts, 3221, 30)) +>Int16Array.of : Symbol(Int16ArrayConstructor.of, Decl(lib.d.ts, 3251, 30)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2977, 60), Decl(lib.d.ts, 3267, 11)) +>of : Symbol(Int16ArrayConstructor.of, Decl(lib.d.ts, 3251, 30)) typedArrays[3] = Uint16Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Uint16Array.of : Symbol(Uint16ArrayConstructor.of, Decl(lib.d.ts, 3511, 30)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3237, 46), Decl(lib.d.ts, 3527, 11)) ->of : Symbol(Uint16ArrayConstructor.of, Decl(lib.d.ts, 3511, 30)) +>Uint16Array.of : Symbol(Uint16ArrayConstructor.of, Decl(lib.d.ts, 3541, 30)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3267, 46), Decl(lib.d.ts, 3557, 11)) +>of : Symbol(Uint16ArrayConstructor.of, Decl(lib.d.ts, 3541, 30)) typedArrays[4] = Int32Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Int32Array.of : Symbol(Int32ArrayConstructor.of, Decl(lib.d.ts, 3801, 30)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3527, 48), Decl(lib.d.ts, 3817, 11)) ->of : Symbol(Int32ArrayConstructor.of, Decl(lib.d.ts, 3801, 30)) +>Int32Array.of : Symbol(Int32ArrayConstructor.of, Decl(lib.d.ts, 3831, 30)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3557, 48), Decl(lib.d.ts, 3847, 11)) +>of : Symbol(Int32ArrayConstructor.of, Decl(lib.d.ts, 3831, 30)) typedArrays[5] = Uint32Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Uint32Array.of : Symbol(Uint32ArrayConstructor.of, Decl(lib.d.ts, 4091, 30)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3817, 46), Decl(lib.d.ts, 4107, 11)) ->of : Symbol(Uint32ArrayConstructor.of, Decl(lib.d.ts, 4091, 30)) +>Uint32Array.of : Symbol(Uint32ArrayConstructor.of, Decl(lib.d.ts, 4121, 30)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3847, 46), Decl(lib.d.ts, 4137, 11)) +>of : Symbol(Uint32ArrayConstructor.of, Decl(lib.d.ts, 4121, 30)) typedArrays[6] = Float32Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Float32Array.of : Symbol(Float32ArrayConstructor.of, Decl(lib.d.ts, 4381, 30)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4107, 48), Decl(lib.d.ts, 4397, 11)) ->of : Symbol(Float32ArrayConstructor.of, Decl(lib.d.ts, 4381, 30)) +>Float32Array.of : Symbol(Float32ArrayConstructor.of, Decl(lib.d.ts, 4411, 30)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4137, 48), Decl(lib.d.ts, 4427, 11)) +>of : Symbol(Float32ArrayConstructor.of, Decl(lib.d.ts, 4411, 30)) typedArrays[7] = Float64Array.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Float64Array.of : Symbol(Float64ArrayConstructor.of, Decl(lib.d.ts, 4671, 30)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4397, 50), Decl(lib.d.ts, 4687, 11)) ->of : Symbol(Float64ArrayConstructor.of, Decl(lib.d.ts, 4671, 30)) +>Float64Array.of : Symbol(Float64ArrayConstructor.of, Decl(lib.d.ts, 4701, 30)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4427, 50), Decl(lib.d.ts, 4717, 11)) +>of : Symbol(Float64ArrayConstructor.of, Decl(lib.d.ts, 4701, 30)) typedArrays[8] = Uint8ClampedArray.of(1,2,3,4); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) ->Uint8ClampedArray.of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.d.ts, 2931, 30)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2657, 46), Decl(lib.d.ts, 2947, 11)) ->of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.d.ts, 2931, 30)) +>Uint8ClampedArray.of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.d.ts, 2961, 30)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2687, 46), Decl(lib.d.ts, 2977, 11)) +>of : Symbol(Uint8ClampedArrayConstructor.of, Decl(lib.d.ts, 2961, 30)) return typedArrays; >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 94, 7)) @@ -391,7 +391,7 @@ function CreateTypedArraysOf2() { function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:number)=> number) { >CreateTypedArraysFromMapFn : Symbol(CreateTypedArraysFromMapFn, Decl(typedArrays.ts, 106, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) ->ArrayLike : Symbol(ArrayLike, Decl(lib.d.ts, 1404, 1)) +>ArrayLike : Symbol(ArrayLike, Decl(lib.d.ts, 1434, 1)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) >n : Symbol(n, Decl(typedArrays.ts, 108, 67)) >v : Symbol(v, Decl(typedArrays.ts, 108, 76)) @@ -401,73 +401,73 @@ function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:n typedArrays[0] = Int8Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2357, 38)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2077, 42), Decl(lib.d.ts, 2367, 11)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2357, 38)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2387, 38)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2107, 42), Decl(lib.d.ts, 2397, 11)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2387, 38)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[1] = Uint8Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2647, 39)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2367, 44), Decl(lib.d.ts, 2657, 11)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2647, 39)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2677, 39)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2397, 44), Decl(lib.d.ts, 2687, 11)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2677, 39)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[2] = Int16Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3227, 39)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2947, 60), Decl(lib.d.ts, 3237, 11)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3227, 39)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3257, 39)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2977, 60), Decl(lib.d.ts, 3267, 11)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3257, 39)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[3] = Uint16Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3517, 40)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3237, 46), Decl(lib.d.ts, 3527, 11)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3517, 40)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3547, 40)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3267, 46), Decl(lib.d.ts, 3557, 11)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3547, 40)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[4] = Int32Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3807, 39)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3527, 48), Decl(lib.d.ts, 3817, 11)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3807, 39)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3837, 39)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3557, 48), Decl(lib.d.ts, 3847, 11)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3837, 39)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[5] = Uint32Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4097, 40)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3817, 46), Decl(lib.d.ts, 4107, 11)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4097, 40)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4127, 40)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3847, 46), Decl(lib.d.ts, 4137, 11)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4127, 40)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[6] = Float32Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4387, 41)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4107, 48), Decl(lib.d.ts, 4397, 11)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4387, 41)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4417, 41)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4137, 48), Decl(lib.d.ts, 4427, 11)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4417, 41)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[7] = Float64Array.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4677, 41)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4397, 50), Decl(lib.d.ts, 4687, 11)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4677, 41)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4707, 41)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4427, 50), Decl(lib.d.ts, 4717, 11)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4707, 41)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) typedArrays[8] = Uint8ClampedArray.from(obj, mapFn); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 109, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2937, 46)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2657, 46), Decl(lib.d.ts, 2947, 11)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2937, 46)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2967, 46)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2687, 46), Decl(lib.d.ts, 2977, 11)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2967, 46)) >obj : Symbol(obj, Decl(typedArrays.ts, 108, 36)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 108, 58)) @@ -478,7 +478,7 @@ function CreateTypedArraysFromMapFn(obj:ArrayLike, mapFn: (n:number, v:n function CreateTypedArraysFromThisObj(obj:ArrayLike, mapFn: (n:number, v:number)=> number, thisArg: {}) { >CreateTypedArraysFromThisObj : Symbol(CreateTypedArraysFromThisObj, Decl(typedArrays.ts, 121, 1)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) ->ArrayLike : Symbol(ArrayLike, Decl(lib.d.ts, 1404, 1)) +>ArrayLike : Symbol(ArrayLike, Decl(lib.d.ts, 1434, 1)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >n : Symbol(n, Decl(typedArrays.ts, 123, 69)) >v : Symbol(v, Decl(typedArrays.ts, 123, 78)) @@ -489,81 +489,81 @@ function CreateTypedArraysFromThisObj(obj:ArrayLike, mapFn: (n:number, v typedArrays[0] = Int8Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2357, 38)) ->Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2077, 42), Decl(lib.d.ts, 2367, 11)) ->from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2357, 38)) +>Int8Array.from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2387, 38)) +>Int8Array : Symbol(Int8Array, Decl(lib.d.ts, 2107, 42), Decl(lib.d.ts, 2397, 11)) +>from : Symbol(Int8ArrayConstructor.from, Decl(lib.d.ts, 2387, 38)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[1] = Uint8Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2647, 39)) ->Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2367, 44), Decl(lib.d.ts, 2657, 11)) ->from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2647, 39)) +>Uint8Array.from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2677, 39)) +>Uint8Array : Symbol(Uint8Array, Decl(lib.d.ts, 2397, 44), Decl(lib.d.ts, 2687, 11)) +>from : Symbol(Uint8ArrayConstructor.from, Decl(lib.d.ts, 2677, 39)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[2] = Int16Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3227, 39)) ->Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2947, 60), Decl(lib.d.ts, 3237, 11)) ->from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3227, 39)) +>Int16Array.from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3257, 39)) +>Int16Array : Symbol(Int16Array, Decl(lib.d.ts, 2977, 60), Decl(lib.d.ts, 3267, 11)) +>from : Symbol(Int16ArrayConstructor.from, Decl(lib.d.ts, 3257, 39)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[3] = Uint16Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3517, 40)) ->Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3237, 46), Decl(lib.d.ts, 3527, 11)) ->from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3517, 40)) +>Uint16Array.from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3547, 40)) +>Uint16Array : Symbol(Uint16Array, Decl(lib.d.ts, 3267, 46), Decl(lib.d.ts, 3557, 11)) +>from : Symbol(Uint16ArrayConstructor.from, Decl(lib.d.ts, 3547, 40)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[4] = Int32Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3807, 39)) ->Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3527, 48), Decl(lib.d.ts, 3817, 11)) ->from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3807, 39)) +>Int32Array.from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3837, 39)) +>Int32Array : Symbol(Int32Array, Decl(lib.d.ts, 3557, 48), Decl(lib.d.ts, 3847, 11)) +>from : Symbol(Int32ArrayConstructor.from, Decl(lib.d.ts, 3837, 39)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[5] = Uint32Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4097, 40)) ->Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3817, 46), Decl(lib.d.ts, 4107, 11)) ->from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4097, 40)) +>Uint32Array.from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4127, 40)) +>Uint32Array : Symbol(Uint32Array, Decl(lib.d.ts, 3847, 46), Decl(lib.d.ts, 4137, 11)) +>from : Symbol(Uint32ArrayConstructor.from, Decl(lib.d.ts, 4127, 40)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[6] = Float32Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4387, 41)) ->Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4107, 48), Decl(lib.d.ts, 4397, 11)) ->from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4387, 41)) +>Float32Array.from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4417, 41)) +>Float32Array : Symbol(Float32Array, Decl(lib.d.ts, 4137, 48), Decl(lib.d.ts, 4427, 11)) +>from : Symbol(Float32ArrayConstructor.from, Decl(lib.d.ts, 4417, 41)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[7] = Float64Array.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4677, 41)) ->Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4397, 50), Decl(lib.d.ts, 4687, 11)) ->from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4677, 41)) +>Float64Array.from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4707, 41)) +>Float64Array : Symbol(Float64Array, Decl(lib.d.ts, 4427, 50), Decl(lib.d.ts, 4717, 11)) +>from : Symbol(Float64ArrayConstructor.from, Decl(lib.d.ts, 4707, 41)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) typedArrays[8] = Uint8ClampedArray.from(obj, mapFn, thisArg); >typedArrays : Symbol(typedArrays, Decl(typedArrays.ts, 124, 7)) ->Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2937, 46)) ->Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2657, 46), Decl(lib.d.ts, 2947, 11)) ->from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2937, 46)) +>Uint8ClampedArray.from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2967, 46)) +>Uint8ClampedArray : Symbol(Uint8ClampedArray, Decl(lib.d.ts, 2687, 46), Decl(lib.d.ts, 2977, 11)) +>from : Symbol(Uint8ClampedArrayConstructor.from, Decl(lib.d.ts, 2967, 46)) >obj : Symbol(obj, Decl(typedArrays.ts, 123, 38)) >mapFn : Symbol(mapFn, Decl(typedArrays.ts, 123, 60)) >thisArg : Symbol(thisArg, Decl(typedArrays.ts, 123, 98)) diff --git a/tests/baselines/reference/typeofClass2.js b/tests/baselines/reference/typeofClass2.js index 1cef22bf2eb..f4401db1549 100644 --- a/tests/baselines/reference/typeofClass2.js +++ b/tests/baselines/reference/typeofClass2.js @@ -22,7 +22,7 @@ var r1: typeof D; var r2: typeof d; //// [typeofClass2.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/typesWithSpecializedCallSignatures.js b/tests/baselines/reference/typesWithSpecializedCallSignatures.js index e33c0302a2a..4baa9d71194 100644 --- a/tests/baselines/reference/typesWithSpecializedCallSignatures.js +++ b/tests/baselines/reference/typesWithSpecializedCallSignatures.js @@ -43,7 +43,7 @@ var r3: Base = c.foo('hm'); //// [typesWithSpecializedCallSignatures.js] // basic uses of specialized signatures without errors -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/typesWithSpecializedConstructSignatures.js b/tests/baselines/reference/typesWithSpecializedConstructSignatures.js index ecb43cfcc9e..8f64b4be3bf 100644 --- a/tests/baselines/reference/typesWithSpecializedConstructSignatures.js +++ b/tests/baselines/reference/typesWithSpecializedConstructSignatures.js @@ -41,7 +41,7 @@ var r3: Base = new a('hm'); //// [typesWithSpecializedConstructSignatures.js] // basic uses of specialized signatures without errors -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/undeclaredBase.js b/tests/baselines/reference/undeclaredBase.js index 33e1d522b1f..bb78d5995c3 100644 --- a/tests/baselines/reference/undeclaredBase.js +++ b/tests/baselines/reference/undeclaredBase.js @@ -4,7 +4,7 @@ module M { export class C extends M.I { } } //// [undeclaredBase.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/undefinedIsSubtypeOfEverything.js b/tests/baselines/reference/undefinedIsSubtypeOfEverything.js index b1ef3e19edd..49877eb62e0 100644 --- a/tests/baselines/reference/undefinedIsSubtypeOfEverything.js +++ b/tests/baselines/reference/undefinedIsSubtypeOfEverything.js @@ -123,7 +123,7 @@ class D17 extends Base { //// [undefinedIsSubtypeOfEverything.js] // undefined is a subtype of every other types, no errors expected below -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/underscoreMapFirst.js b/tests/baselines/reference/underscoreMapFirst.js index bff8b7ef43f..c1839fadfdc 100644 --- a/tests/baselines/reference/underscoreMapFirst.js +++ b/tests/baselines/reference/underscoreMapFirst.js @@ -49,7 +49,7 @@ class MyView extends View { //// [underscoreMapFirst.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/unionTypeEquivalence.js b/tests/baselines/reference/unionTypeEquivalence.js index 8343b8e5208..04ee64b73e3 100644 --- a/tests/baselines/reference/unionTypeEquivalence.js +++ b/tests/baselines/reference/unionTypeEquivalence.js @@ -20,7 +20,7 @@ var z1: string | typeof BC; //// [unionTypeEquivalence.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/unionTypeFromArrayLiteral.js b/tests/baselines/reference/unionTypeFromArrayLiteral.js index 0aa549f5490..ab43a6273b2 100644 --- a/tests/baselines/reference/unionTypeFromArrayLiteral.js +++ b/tests/baselines/reference/unionTypeFromArrayLiteral.js @@ -28,7 +28,7 @@ var arr9 = [e, f]; // (E|F)[] // If the array literal is empty, the resulting type is an array type with the element type Undefined. // Otherwise, if the array literal is contextually typed by a type that has a property with the numeric name ‘0’, the resulting type is a tuple type constructed from the types of the element expressions. // Otherwise, the resulting type is an array type with an element type that is the union of the types of the element expressions. -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/unionTypesAssignability.js b/tests/baselines/reference/unionTypesAssignability.js index a94ea07dce2..7778e1beded 100644 --- a/tests/baselines/reference/unionTypesAssignability.js +++ b/tests/baselines/reference/unionTypesAssignability.js @@ -73,7 +73,7 @@ function foo(t: T, u: U) { //// [unionTypesAssignability.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/unknownSymbols1.js b/tests/baselines/reference/unknownSymbols1.js index cbcdd2ea27f..0e081a66b83 100644 --- a/tests/baselines/reference/unknownSymbols1.js +++ b/tests/baselines/reference/unknownSymbols1.js @@ -33,7 +33,7 @@ class C5 { } //// [unknownSymbols1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/unspecializedConstraints.js b/tests/baselines/reference/unspecializedConstraints.js index 0ca464a93af..df64daff2bf 100644 --- a/tests/baselines/reference/unspecializedConstraints.js +++ b/tests/baselines/reference/unspecializedConstraints.js @@ -154,7 +154,7 @@ module ts { //// [unspecializedConstraints.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js index 9e0ff95536d..8304aae576f 100644 --- a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js +++ b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js @@ -44,7 +44,7 @@ c5(1); // error //// [untypedFunctionCallsWithTypeParameters1.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/validUseOfThisInSuper.js b/tests/baselines/reference/validUseOfThisInSuper.js index d71548e02e8..6f2fc67d7e1 100644 --- a/tests/baselines/reference/validUseOfThisInSuper.js +++ b/tests/baselines/reference/validUseOfThisInSuper.js @@ -10,7 +10,7 @@ class Super extends Base { } //// [validUseOfThisInSuper.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/baselines/reference/varArgsOnConstructorTypes.js b/tests/baselines/reference/varArgsOnConstructorTypes.js index e61377e255b..005ba55d761 100644 --- a/tests/baselines/reference/varArgsOnConstructorTypes.js +++ b/tests/baselines/reference/varArgsOnConstructorTypes.js @@ -25,7 +25,7 @@ reg.register(B); //// [varArgsOnConstructorTypes.js] -var __extends = this.__extends || function (d, b) { +var __extends = (this && 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; diff --git a/tests/cases/compiler/noEmitHelpers.ts b/tests/cases/compiler/noEmitHelpers.ts new file mode 100644 index 00000000000..cb37c0db961 --- /dev/null +++ b/tests/cases/compiler/noEmitHelpers.ts @@ -0,0 +1,4 @@ +// @noemithelpers: true + +class A { } +class B extends A { } diff --git a/tests/cases/compiler/noEmitHelpers2.ts b/tests/cases/compiler/noEmitHelpers2.ts new file mode 100644 index 00000000000..df71f4fae82 --- /dev/null +++ b/tests/cases/compiler/noEmitHelpers2.ts @@ -0,0 +1,11 @@ +// @noemithelpers: true +// @emitdecoratormetadata: true +// @target: es5 + +function decorator() { } + +@decorator +class A { + constructor(a: number, @decorator b: string) { + } +} \ No newline at end of file diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index a5efdd18148..9c6fd814d9f 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -659,8 +659,12 @@ module FourSlashInterface { return getClassification("typeParameterName", text, position); } - export function typeAlias(text: string, position?: number): { classificationType: string; text: string; textSpan?: TextSpan } { - return getClassification("typeAlias", text, position); + export function parameterName(text: string, position?: number): { classificationType: string; text: string; textSpan?: TextSpan } { + return getClassification("parameterName", text, position); + } + + export function typeAliasName(text: string, position?: number): { classificationType: string; text: string; textSpan?: TextSpan } { + return getClassification("typeAliasName", text, position); } function getClassification(type: string, text: string, position?: number) { diff --git a/tests/cases/fourslash/semanticClassificatonTypeAlias.ts b/tests/cases/fourslash/semanticClassificatonTypeAlias.ts index 726588a2c9e..188a09afcbc 100644 --- a/tests/cases/fourslash/semanticClassificatonTypeAlias.ts +++ b/tests/cases/fourslash/semanticClassificatonTypeAlias.ts @@ -7,9 +7,9 @@ var c = classification; verify.semanticClassificationsAre( - c.typeAlias("Alias", test.marker("0").position), - c.typeAlias("Alias", test.marker("1").position), - c.typeAlias("Alias", test.marker("2").position), - c.typeAlias("Alias", test.marker("3").position), - c.typeAlias("Alias", test.marker("4").position) + c.typeAliasName("Alias", test.marker("0").position), + c.typeAliasName("Alias", test.marker("1").position), + c.typeAliasName("Alias", test.marker("2").position), + c.typeAliasName("Alias", test.marker("3").position), + c.typeAliasName("Alias", test.marker("4").position) ); \ No newline at end of file diff --git a/tests/cases/fourslash/syntacticClassificationsFunctionWithComments.ts b/tests/cases/fourslash/syntacticClassificationsFunctionWithComments.ts index eeaf4a7033f..f7e5b7355a7 100644 --- a/tests/cases/fourslash/syntacticClassificationsFunctionWithComments.ts +++ b/tests/cases/fourslash/syntacticClassificationsFunctionWithComments.ts @@ -19,7 +19,7 @@ var firstCommentText = var c = classification; verify.syntacticClassificationsAre( c.comment(firstCommentText), - c.keyword("function"), c.text("myFunction"), c.punctuation("("), c.comment("/* x */"), c.text("x"), c.punctuation(":"), c.keyword("any"), c.punctuation(")"), c.punctuation("{"), + c.keyword("function"), c.text("myFunction"), c.punctuation("("), c.comment("/* x */"), c.parameterName("x"), c.punctuation(":"), c.keyword("any"), c.punctuation(")"), c.punctuation("{"), c.keyword("var"), c.text("y"), c.operator("="), c.text("x"), c.operator("?"), c.text("x"), c.operator("++"), c.operator(":"), c.operator("++"), c.text("x"), c.punctuation(";"), c.punctuation("}"), c.comment("// end of file")); \ No newline at end of file diff --git a/tests/cases/unittests/services/colorization.ts b/tests/cases/unittests/services/colorization.ts index 6c685cdb174..4351f0ccb1d 100644 --- a/tests/cases/unittests/services/colorization.ts +++ b/tests/cases/unittests/services/colorization.ts @@ -66,8 +66,9 @@ describe('Colorization', function () { describe("test getClassifications", function () { it("Returns correct token classes", function () { + debugger; testLexicalClassification("var x: string = \"foo\"; //Hello", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, keyword("var"), whitespace(" "), identifier("x"), @@ -81,7 +82,7 @@ describe('Colorization', function () { it("correctly classifies a comment after a divide operator", function () { testLexicalClassification("1 / 2 // comment", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, numberLiteral("1"), whitespace(" "), operator("/"), @@ -91,7 +92,7 @@ describe('Colorization', function () { it("correctly classifies a literal after a divide operator", function () { testLexicalClassification("1 / 2, 3 / 4", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, numberLiteral("1"), whitespace(" "), operator("/"), @@ -103,40 +104,41 @@ describe('Colorization', function () { it("correctly classifies a multi-line string with one backslash", function () { testLexicalClassification("'line1\\", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, stringLiteral("'line1\\"), finalEndOfLineState(ts.EndOfLineState.InSingleQuoteStringLiteral)); }); it("correctly classifies a multi-line string with three backslashes", function () { testLexicalClassification("'line1\\\\\\", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, stringLiteral("'line1\\\\\\"), finalEndOfLineState(ts.EndOfLineState.InSingleQuoteStringLiteral)); }); it("correctly classifies an unterminated single-line string with no backslashes", function () { testLexicalClassification("'line1", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, stringLiteral("'line1"), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); }); it("correctly classifies an unterminated single-line string with two backslashes", function () { testLexicalClassification("'line1\\\\", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, stringLiteral("'line1\\\\"), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); }); it("correctly classifies an unterminated single-line string with four backslashes", function () { testLexicalClassification("'line1\\\\\\\\", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, stringLiteral("'line1\\\\\\\\"), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); }); it("correctly classifies the continuing line of a multi-line string ending in one backslash", function () { + debugger; testLexicalClassification("\\", ts.EndOfLineState.InDoubleQuoteStringLiteral, stringLiteral("\\"), @@ -154,33 +156,33 @@ describe('Colorization', function () { testLexicalClassification(" ", ts.EndOfLineState.InDoubleQuoteStringLiteral, stringLiteral(" "), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); }); it("correctly classifies the last line of an unterminated multi-line string ending in two backslashes", function () { testLexicalClassification("\\\\", ts.EndOfLineState.InDoubleQuoteStringLiteral, stringLiteral("\\\\"), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); }); it("correctly classifies the last line of an unterminated multi-line string ending in four backslashes", function () { testLexicalClassification("\\\\\\\\", ts.EndOfLineState.InDoubleQuoteStringLiteral, stringLiteral("\\\\\\\\"), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); }); it("correctly classifies the last line of a multi-line string", function () { testLexicalClassification("'", ts.EndOfLineState.InSingleQuoteStringLiteral, stringLiteral("'"), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); }); it("correctly classifies an unterminated multiline comment", function () { testLexicalClassification("/*", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, comment("/*"), finalEndOfLineState(ts.EndOfLineState.InMultiLineCommentTrivia)); }); @@ -189,7 +191,7 @@ describe('Colorization', function () { testLexicalClassification(" */ ", ts.EndOfLineState.InMultiLineCommentTrivia, comment(" */"), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); }); it("correctly classifies the continuation of a multiline comment", function () { @@ -201,33 +203,33 @@ describe('Colorization', function () { it("correctly classifies an unterminated multiline comment on a line ending in '/*/'", function () { testLexicalClassification(" /*/", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, comment("/*/"), finalEndOfLineState(ts.EndOfLineState.InMultiLineCommentTrivia)); }); it("correctly classifies an unterminated multiline comment with trailing space", function () { testLexicalClassification("/* ", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, comment("/* "), finalEndOfLineState(ts.EndOfLineState.InMultiLineCommentTrivia)); }); it("correctly classifies a keyword after a dot", function () { testLexicalClassification("a.var", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, identifier("var")); }); it("correctly classifies a string literal after a dot", function () { testLexicalClassification("a.\"var\"", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, stringLiteral("\"var\"")); }); it("correctly classifies a keyword after a dot separated by comment trivia", function () { testLexicalClassification("a./*hello world*/ var", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, identifier("a"), punctuation("."), comment("/*hello world*/"), @@ -236,41 +238,41 @@ describe('Colorization', function () { it("classifies a property access with whitespace around the dot", function () { testLexicalClassification(" x .\tfoo ()", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, identifier("x"), identifier("foo")); }); it("classifies a keyword after a dot on previous line", function () { testLexicalClassification("var", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, keyword("var"), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); }); it("classifies multiple keywords properly", function () { testLexicalClassification("public static", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, keyword("public"), keyword("static"), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); testLexicalClassification("public var", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, keyword("public"), identifier("var"), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); }); it("classifies a single line no substitution template string correctly", () => { testLexicalClassification("`number number public string`", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, stringLiteral("`number number public string`"), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); }); it("classifies substitution parts of a template string correctly", () => { testLexicalClassification("`number '${ 1 + 1 }' string '${ 'hello' }'`", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, stringLiteral("`number '${"), numberLiteral("1"), operator("+"), @@ -278,11 +280,11 @@ describe('Colorization', function () { stringLiteral("}' string '${"), stringLiteral("'hello'"), stringLiteral("}'`"), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); }); it("classifies an unterminated no substitution template string correctly", () => { testLexicalClassification("`hello world", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, stringLiteral("`hello world"), finalEndOfLineState(ts.EndOfLineState.InTemplateHeadOrNoSubstitutionTemplate)); }); @@ -308,7 +310,7 @@ describe('Colorization', function () { testLexicalClassification("...`", ts.EndOfLineState.InTemplateHeadOrNoSubstitutionTemplate, stringLiteral("...`"), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); }); it("classifies the substitution parts and middle/tail of a multiline template string", () => { testLexicalClassification("${ 1 + 1 }...`", @@ -318,7 +320,7 @@ describe('Colorization', function () { operator("+"), numberLiteral("1"), stringLiteral("}...`"), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); }); it("classifies a template middle and propagates the end of line state",() => { testLexicalClassification("${ 1 + 1 }...`", @@ -328,7 +330,7 @@ describe('Colorization', function () { operator("+"), numberLiteral("1"), stringLiteral("}...`"), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); }); it("classifies substitution expressions with curly braces appropriately", () => { var pos = 0; @@ -349,7 +351,7 @@ describe('Colorization', function () { stringLiteral(track(" ", "`1`"), pos), punctuation(track(" ", "}"), pos), stringLiteral(track(" ", "}...`"), pos), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); // Adjusts 'pos' by accounting for the length of each portion of the string, // but only return the last given string @@ -364,22 +366,22 @@ describe('Colorization', function () { it("classifies partially written generics correctly.", function () { testLexicalClassification("Foo { @@ -400,7 +402,7 @@ describe('Colorization', function () { v = 2;\r\n\ >>>>>>> Branch - a\r\n\ }", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, keyword("class"), identifier("C"), punctuation("{"), @@ -412,7 +414,7 @@ describe('Colorization', function () { comment("=======\r\n v = 2;\r\n"), comment(">>>>>>> Branch - a"), punctuation("}"), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); testLexicalClassification( "<<<<<<< HEAD\r\n\ @@ -420,7 +422,7 @@ class C { }\r\n\ =======\r\n\ class D { }\r\n\ >>>>>>> Branch - a\r\n", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, comment("<<<<<<< HEAD"), keyword("class"), identifier("C"), @@ -428,12 +430,12 @@ class D { }\r\n\ punctuation("}"), comment("=======\r\nclass D { }\r\n"), comment(">>>>>>> Branch - a"), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); }); it("'of' keyword", function () { testLexicalClassification("for (var of of of) { }", - ts.EndOfLineState.Start, + ts.EndOfLineState.None, keyword("for"), punctuation("("), keyword("var"), @@ -443,7 +445,7 @@ class D { }\r\n\ punctuation(")"), punctuation("{"), punctuation("}"), - finalEndOfLineState(ts.EndOfLineState.Start)); + finalEndOfLineState(ts.EndOfLineState.None)); }); }); }); \ No newline at end of file