mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' into fix4211
This commit is contained in:
@@ -1,3 +1,45 @@
|
||||
# Instructions for Logging Issues
|
||||
|
||||
## 1. Read the FAQ
|
||||
|
||||
Please [read the FAQ](https://github.com/Microsoft/TypeScript/wiki/FAQ) before logging new issues, even if you think you have found a bug.
|
||||
|
||||
Issues that ask questions answered in the FAQ will be closed without elaboration.
|
||||
|
||||
## 2. Search for Duplicates
|
||||
|
||||
[Search the existing issues](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=is%3Aissue) before logging a new one.
|
||||
|
||||
## 3. Do you have a question?
|
||||
|
||||
The issue tracker is for **issues**, in other words, bugs and suggestions.
|
||||
If you have a *question*, please use [http://stackoverflow.com/questions/tagged/typescript](Stack Overflow), [https://gitter.im/Microsoft/TypeScript](Gitter), your favorite search engine, or other resources.
|
||||
Due to increased traffic, we can no longer answer questions in the issue tracker.
|
||||
|
||||
## 4. Did you find a bug?
|
||||
|
||||
When logging a bug, please be sure to include the following:
|
||||
* What version of TypeScript you're using (run `tsc --v`)
|
||||
* If at all possible, an *isolated* way to reproduce the behavior
|
||||
* The behavior you expect to see, and the actual behavior
|
||||
|
||||
You can try out the nightly build of TypeScript (`npm install typescript@next`) to see if the bug has already been fixed.
|
||||
|
||||
## 5. Do you have a suggestion?
|
||||
|
||||
We also accept suggestions in the issue tracker.
|
||||
Be sure to [check the FAQ](https://github.com/Microsoft/TypeScript/wiki/FAQ) and [search](https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=is%3Aissue) first.
|
||||
|
||||
In general, things we find useful when reviewing suggestins are:
|
||||
* A description of the problem you're trying to solve
|
||||
* An overview of the suggested solution
|
||||
* Examples of how the suggestion would work in various places
|
||||
* Code examples showing e.g. "this would be an error, this wouldn't"
|
||||
* Code examples showing the generated JavaScript (if applicable)
|
||||
* If relevant, precedent in other languages can be useful for establishing context and expected behavior
|
||||
|
||||
# Instructions for Contributing Code
|
||||
|
||||
## Contributing bug fixes
|
||||
|
||||
TypeScript is currently accepting contributions in the form of bug fixes. A bug must have an issue tracking it in the issue tracker that has been approved ("Milestone == Community") by the TypeScript team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort.
|
||||
|
||||
+7
-4
@@ -163,13 +163,15 @@ var harnessSources = harnessCoreSources.concat([
|
||||
}));
|
||||
|
||||
var librarySourceMap = [
|
||||
{ target: "lib.core.d.ts", sources: ["core.d.ts"] },
|
||||
{ target: "lib.core.d.ts", sources: ["header.d.ts", "core.d.ts"] },
|
||||
{ target: "lib.dom.d.ts", sources: ["importcore.d.ts", "intl.d.ts", "dom.generated.d.ts"], },
|
||||
{ target: "lib.webworker.d.ts", sources: ["importcore.d.ts", "intl.d.ts", "webworker.generated.d.ts"], },
|
||||
{ target: "lib.scriptHost.d.ts", sources: ["importcore.d.ts", "scriptHost.d.ts"], },
|
||||
{ target: "lib.d.ts", sources: ["core.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], },
|
||||
{ target: "lib.core.es6.d.ts", sources: ["core.d.ts", "es6.d.ts"]},
|
||||
{ target: "lib.es6.d.ts", sources: ["es6.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] }
|
||||
{ target: "lib.d.ts", sources: ["header.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], },
|
||||
{ target: "lib.core.es6.d.ts", sources: ["header.d.ts", "core.d.ts", "es6.d.ts"]},
|
||||
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es6.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] },
|
||||
{ target: "lib.core.es7.d.ts", sources: ["header.d.ts", "core.d.ts", "es6.d.ts", "es7.d.ts"]},
|
||||
{ target: "lib.es7.d.ts", sources: ["header.d.ts", "es6.d.ts", "es7.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] }
|
||||
];
|
||||
|
||||
var libraryTargets = librarySourceMap.map(function (f) {
|
||||
@@ -893,6 +895,7 @@ function getLinterOptions() {
|
||||
|
||||
function lintFileContents(options, path, contents) {
|
||||
var ll = new Linter(path, contents, options);
|
||||
console.log("Linting '" + path + "'.")
|
||||
return ll.lint();
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
+1
-1
@@ -3885,7 +3885,7 @@ function g(x: number) {
|
||||
|
||||
the inferred return type for 'f' and 'g' is Any because the functions reference themselves through a cycle with no return type annotations. Adding an explicit return type 'number' to either breaks the cycle and causes the return type 'number' to be inferred for the other.
|
||||
|
||||
An explicitly typed function whose return type isn't the Void or the Any type must have at least one return statement somewhere in its body. An exception to this rule is if the function implementation consists of a single 'throw' statement.
|
||||
An explicitly typed function whose return type isn't the Void type, the Any type, or a union type containing the Void or Any type as a constituent must have at least one return statement somewhere in its body. An exception to this rule is if the function implementation consists of a single 'throw' statement.
|
||||
|
||||
The type of 'this' in a function implementation is the Any type.
|
||||
|
||||
|
||||
Vendored
-1
@@ -14,7 +14,6 @@ and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
/////////////////////////////
|
||||
/// ECMAScript APIs
|
||||
/////////////////////////////
|
||||
|
||||
Vendored
+8
-9
@@ -14,7 +14,6 @@ and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
/////////////////////////////
|
||||
/// ECMAScript APIs
|
||||
/////////////////////////////
|
||||
@@ -5121,15 +5120,15 @@ interface PromiseConstructor {
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
|
||||
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
|
||||
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
|
||||
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
|
||||
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
|
||||
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
|
||||
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
|
||||
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
|
||||
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
|
||||
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
|
||||
all<TAll>(values: Iterable<TAll | PromiseLike<TAll>>): Promise<TAll[]>;
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+32
-14
@@ -14,7 +14,6 @@ and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
/////////////////////////////
|
||||
/// ECMAScript APIs
|
||||
/////////////////////////////
|
||||
@@ -5296,7 +5295,7 @@ interface Console {
|
||||
select(element: Element): void;
|
||||
time(timerName?: string): void;
|
||||
timeEnd(timerName?: string): void;
|
||||
trace(): void;
|
||||
trace(message?: any, ...optionalParams: any[]): void;
|
||||
warn(message?: any, ...optionalParams: any[]): void;
|
||||
}
|
||||
|
||||
@@ -5555,9 +5554,9 @@ interface DataTransferItemList {
|
||||
length: number;
|
||||
add(data: File): DataTransferItem;
|
||||
clear(): void;
|
||||
item(index: number): File;
|
||||
item(index: number): DataTransferItem;
|
||||
remove(index: number): void;
|
||||
[index: number]: File;
|
||||
[index: number]: DataTransferItem;
|
||||
}
|
||||
|
||||
declare var DataTransferItemList: {
|
||||
@@ -6610,6 +6609,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
|
||||
* @param content The text and HTML tags to write.
|
||||
*/
|
||||
writeln(...content: string[]): void;
|
||||
createElement(tagName: "picture"): HTMLPictureElement;
|
||||
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
|
||||
addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -7022,6 +7023,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
|
||||
webkitRequestFullscreen(): void;
|
||||
getElementsByClassName(classNames: string): NodeListOf<Element>;
|
||||
matches(selector: string): boolean;
|
||||
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -7811,6 +7813,7 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
|
||||
*/
|
||||
toDataURL(type?: string, ...args: any[]): string;
|
||||
toBlob(): Blob;
|
||||
}
|
||||
|
||||
declare var HTMLCanvasElement: {
|
||||
@@ -10965,7 +10968,7 @@ interface IDBDatabase extends EventTarget {
|
||||
objectStoreNames: DOMStringList;
|
||||
onabort: (ev: Event) => any;
|
||||
onerror: (ev: Event) => any;
|
||||
version: string;
|
||||
version: number;
|
||||
close(): void;
|
||||
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
@@ -11681,7 +11684,7 @@ declare var MediaQueryList: {
|
||||
interface MediaSource extends EventTarget {
|
||||
activeSourceBuffers: SourceBufferList;
|
||||
duration: number;
|
||||
readyState: number;
|
||||
readyState: string;
|
||||
sourceBuffers: SourceBufferList;
|
||||
addSourceBuffer(type: string): SourceBuffer;
|
||||
endOfStream(error?: number): void;
|
||||
@@ -14410,17 +14413,16 @@ declare var Storage: {
|
||||
}
|
||||
|
||||
interface StorageEvent extends Event {
|
||||
key: string;
|
||||
newValue: any;
|
||||
oldValue: any;
|
||||
storageArea: Storage;
|
||||
url: string;
|
||||
initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void;
|
||||
key?: string;
|
||||
oldValue?: string;
|
||||
newValue?: string;
|
||||
storageArea?: Storage;
|
||||
}
|
||||
|
||||
declare var StorageEvent: {
|
||||
prototype: StorageEvent;
|
||||
new(): StorageEvent;
|
||||
new (type: string, eventInitDict?: StorageEventInit): StorageEvent;
|
||||
}
|
||||
|
||||
interface StyleMedia {
|
||||
@@ -16018,7 +16020,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
msMatchMedia(mediaQuery: string): MediaQueryList;
|
||||
msRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
msWriteProfilerMark(profilerMarkName: string): void;
|
||||
open(url?: string, target?: string, features?: string, replace?: boolean): any;
|
||||
open(url?: string, target?: string, features?: string, replace?: boolean): Window;
|
||||
postMessage(message: any, targetOrigin: string, ports?: any): void;
|
||||
print(): void;
|
||||
prompt(message?: string, _default?: string): string;
|
||||
@@ -16620,6 +16622,14 @@ interface XMLHttpRequestEventTarget {
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
interface StorageEventInit extends EventInit {
|
||||
key?: string;
|
||||
oldValue?: string;
|
||||
newValue?: string;
|
||||
url: string;
|
||||
storageArea?: Storage;
|
||||
}
|
||||
|
||||
interface IDBObjectStoreParameters {
|
||||
keyPath?: string | string[];
|
||||
autoIncrement?: boolean;
|
||||
@@ -16674,6 +16684,14 @@ declare var HTMLTemplateElement: {
|
||||
new(): HTMLTemplateElement;
|
||||
}
|
||||
|
||||
interface HTMLPictureElement extends HTMLElement {
|
||||
}
|
||||
|
||||
declare var HTMLPictureElement: {
|
||||
prototype: HTMLPictureElement;
|
||||
new(): HTMLPictureElement;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
@@ -16870,7 +16888,7 @@ declare function msCancelRequestAnimationFrame(handle: number): void;
|
||||
declare function msMatchMedia(mediaQuery: string): MediaQueryList;
|
||||
declare function msRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
declare function msWriteProfilerMark(profilerMarkName: string): void;
|
||||
declare function open(url?: string, target?: string, features?: string, replace?: boolean): any;
|
||||
declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window;
|
||||
declare function postMessage(message: any, targetOrigin: string, ports?: any): void;
|
||||
declare function print(): void;
|
||||
declare function prompt(message?: string, _default?: string): string;
|
||||
|
||||
Vendored
+32
-13
@@ -1472,7 +1472,7 @@ interface Console {
|
||||
select(element: Element): void;
|
||||
time(timerName?: string): void;
|
||||
timeEnd(timerName?: string): void;
|
||||
trace(): void;
|
||||
trace(message?: any, ...optionalParams: any[]): void;
|
||||
warn(message?: any, ...optionalParams: any[]): void;
|
||||
}
|
||||
|
||||
@@ -1731,9 +1731,9 @@ interface DataTransferItemList {
|
||||
length: number;
|
||||
add(data: File): DataTransferItem;
|
||||
clear(): void;
|
||||
item(index: number): File;
|
||||
item(index: number): DataTransferItem;
|
||||
remove(index: number): void;
|
||||
[index: number]: File;
|
||||
[index: number]: DataTransferItem;
|
||||
}
|
||||
|
||||
declare var DataTransferItemList: {
|
||||
@@ -2786,6 +2786,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
|
||||
* @param content The text and HTML tags to write.
|
||||
*/
|
||||
writeln(...content: string[]): void;
|
||||
createElement(tagName: "picture"): HTMLPictureElement;
|
||||
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
|
||||
addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -3198,6 +3200,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
|
||||
webkitRequestFullscreen(): void;
|
||||
getElementsByClassName(classNames: string): NodeListOf<Element>;
|
||||
matches(selector: string): boolean;
|
||||
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -3987,6 +3990,7 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
|
||||
*/
|
||||
toDataURL(type?: string, ...args: any[]): string;
|
||||
toBlob(): Blob;
|
||||
}
|
||||
|
||||
declare var HTMLCanvasElement: {
|
||||
@@ -7141,7 +7145,7 @@ interface IDBDatabase extends EventTarget {
|
||||
objectStoreNames: DOMStringList;
|
||||
onabort: (ev: Event) => any;
|
||||
onerror: (ev: Event) => any;
|
||||
version: string;
|
||||
version: number;
|
||||
close(): void;
|
||||
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
@@ -7857,7 +7861,7 @@ declare var MediaQueryList: {
|
||||
interface MediaSource extends EventTarget {
|
||||
activeSourceBuffers: SourceBufferList;
|
||||
duration: number;
|
||||
readyState: number;
|
||||
readyState: string;
|
||||
sourceBuffers: SourceBufferList;
|
||||
addSourceBuffer(type: string): SourceBuffer;
|
||||
endOfStream(error?: number): void;
|
||||
@@ -10586,17 +10590,16 @@ declare var Storage: {
|
||||
}
|
||||
|
||||
interface StorageEvent extends Event {
|
||||
key: string;
|
||||
newValue: any;
|
||||
oldValue: any;
|
||||
storageArea: Storage;
|
||||
url: string;
|
||||
initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void;
|
||||
key?: string;
|
||||
oldValue?: string;
|
||||
newValue?: string;
|
||||
storageArea?: Storage;
|
||||
}
|
||||
|
||||
declare var StorageEvent: {
|
||||
prototype: StorageEvent;
|
||||
new(): StorageEvent;
|
||||
new (type: string, eventInitDict?: StorageEventInit): StorageEvent;
|
||||
}
|
||||
|
||||
interface StyleMedia {
|
||||
@@ -12194,7 +12197,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
msMatchMedia(mediaQuery: string): MediaQueryList;
|
||||
msRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
msWriteProfilerMark(profilerMarkName: string): void;
|
||||
open(url?: string, target?: string, features?: string, replace?: boolean): any;
|
||||
open(url?: string, target?: string, features?: string, replace?: boolean): Window;
|
||||
postMessage(message: any, targetOrigin: string, ports?: any): void;
|
||||
print(): void;
|
||||
prompt(message?: string, _default?: string): string;
|
||||
@@ -12796,6 +12799,14 @@ interface XMLHttpRequestEventTarget {
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
interface StorageEventInit extends EventInit {
|
||||
key?: string;
|
||||
oldValue?: string;
|
||||
newValue?: string;
|
||||
url: string;
|
||||
storageArea?: Storage;
|
||||
}
|
||||
|
||||
interface IDBObjectStoreParameters {
|
||||
keyPath?: string | string[];
|
||||
autoIncrement?: boolean;
|
||||
@@ -12850,6 +12861,14 @@ declare var HTMLTemplateElement: {
|
||||
new(): HTMLTemplateElement;
|
||||
}
|
||||
|
||||
interface HTMLPictureElement extends HTMLElement {
|
||||
}
|
||||
|
||||
declare var HTMLPictureElement: {
|
||||
prototype: HTMLPictureElement;
|
||||
new(): HTMLPictureElement;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
@@ -13046,7 +13065,7 @@ declare function msCancelRequestAnimationFrame(handle: number): void;
|
||||
declare function msMatchMedia(mediaQuery: string): MediaQueryList;
|
||||
declare function msRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
declare function msWriteProfilerMark(profilerMarkName: string): void;
|
||||
declare function open(url?: string, target?: string, features?: string, replace?: boolean): any;
|
||||
declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window;
|
||||
declare function postMessage(message: any, targetOrigin: string, ports?: any): void;
|
||||
declare function print(): void;
|
||||
declare function prompt(message?: string, _default?: string): string;
|
||||
|
||||
Vendored
+41
-23
@@ -13,6 +13,7 @@ See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
/// <reference no-default-lib="true"/>
|
||||
declare type PropertyKey = string | number | symbol;
|
||||
|
||||
interface Symbol {
|
||||
@@ -1296,15 +1297,15 @@ interface PromiseConstructor {
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
|
||||
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
|
||||
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
|
||||
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
|
||||
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
|
||||
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
|
||||
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
|
||||
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
|
||||
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
|
||||
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
|
||||
all<TAll>(values: Iterable<TAll | PromiseLike<TAll>>): Promise<TAll[]>;
|
||||
|
||||
/**
|
||||
@@ -1346,8 +1347,6 @@ interface PromiseConstructor {
|
||||
}
|
||||
|
||||
declare var Promise: PromiseConstructor;
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
/////////////////////////////
|
||||
/// ECMAScript APIs
|
||||
/////////////////////////////
|
||||
@@ -6629,7 +6628,7 @@ interface Console {
|
||||
select(element: Element): void;
|
||||
time(timerName?: string): void;
|
||||
timeEnd(timerName?: string): void;
|
||||
trace(): void;
|
||||
trace(message?: any, ...optionalParams: any[]): void;
|
||||
warn(message?: any, ...optionalParams: any[]): void;
|
||||
}
|
||||
|
||||
@@ -6888,9 +6887,9 @@ interface DataTransferItemList {
|
||||
length: number;
|
||||
add(data: File): DataTransferItem;
|
||||
clear(): void;
|
||||
item(index: number): File;
|
||||
item(index: number): DataTransferItem;
|
||||
remove(index: number): void;
|
||||
[index: number]: File;
|
||||
[index: number]: DataTransferItem;
|
||||
}
|
||||
|
||||
declare var DataTransferItemList: {
|
||||
@@ -7943,6 +7942,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
|
||||
* @param content The text and HTML tags to write.
|
||||
*/
|
||||
writeln(...content: string[]): void;
|
||||
createElement(tagName: "picture"): HTMLPictureElement;
|
||||
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
|
||||
addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -8355,6 +8356,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
|
||||
webkitRequestFullscreen(): void;
|
||||
getElementsByClassName(classNames: string): NodeListOf<Element>;
|
||||
matches(selector: string): boolean;
|
||||
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -9144,6 +9146,7 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
|
||||
*/
|
||||
toDataURL(type?: string, ...args: any[]): string;
|
||||
toBlob(): Blob;
|
||||
}
|
||||
|
||||
declare var HTMLCanvasElement: {
|
||||
@@ -12298,7 +12301,7 @@ interface IDBDatabase extends EventTarget {
|
||||
objectStoreNames: DOMStringList;
|
||||
onabort: (ev: Event) => any;
|
||||
onerror: (ev: Event) => any;
|
||||
version: string;
|
||||
version: number;
|
||||
close(): void;
|
||||
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
@@ -13014,7 +13017,7 @@ declare var MediaQueryList: {
|
||||
interface MediaSource extends EventTarget {
|
||||
activeSourceBuffers: SourceBufferList;
|
||||
duration: number;
|
||||
readyState: number;
|
||||
readyState: string;
|
||||
sourceBuffers: SourceBufferList;
|
||||
addSourceBuffer(type: string): SourceBuffer;
|
||||
endOfStream(error?: number): void;
|
||||
@@ -15743,17 +15746,16 @@ declare var Storage: {
|
||||
}
|
||||
|
||||
interface StorageEvent extends Event {
|
||||
key: string;
|
||||
newValue: any;
|
||||
oldValue: any;
|
||||
storageArea: Storage;
|
||||
url: string;
|
||||
initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void;
|
||||
key?: string;
|
||||
oldValue?: string;
|
||||
newValue?: string;
|
||||
storageArea?: Storage;
|
||||
}
|
||||
|
||||
declare var StorageEvent: {
|
||||
prototype: StorageEvent;
|
||||
new(): StorageEvent;
|
||||
new (type: string, eventInitDict?: StorageEventInit): StorageEvent;
|
||||
}
|
||||
|
||||
interface StyleMedia {
|
||||
@@ -17351,7 +17353,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
msMatchMedia(mediaQuery: string): MediaQueryList;
|
||||
msRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
msWriteProfilerMark(profilerMarkName: string): void;
|
||||
open(url?: string, target?: string, features?: string, replace?: boolean): any;
|
||||
open(url?: string, target?: string, features?: string, replace?: boolean): Window;
|
||||
postMessage(message: any, targetOrigin: string, ports?: any): void;
|
||||
print(): void;
|
||||
prompt(message?: string, _default?: string): string;
|
||||
@@ -17953,6 +17955,14 @@ interface XMLHttpRequestEventTarget {
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
interface StorageEventInit extends EventInit {
|
||||
key?: string;
|
||||
oldValue?: string;
|
||||
newValue?: string;
|
||||
url: string;
|
||||
storageArea?: Storage;
|
||||
}
|
||||
|
||||
interface IDBObjectStoreParameters {
|
||||
keyPath?: string | string[];
|
||||
autoIncrement?: boolean;
|
||||
@@ -18007,6 +18017,14 @@ declare var HTMLTemplateElement: {
|
||||
new(): HTMLTemplateElement;
|
||||
}
|
||||
|
||||
interface HTMLPictureElement extends HTMLElement {
|
||||
}
|
||||
|
||||
declare var HTMLPictureElement: {
|
||||
prototype: HTMLPictureElement;
|
||||
new(): HTMLPictureElement;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
@@ -18203,7 +18221,7 @@ declare function msCancelRequestAnimationFrame(handle: number): void;
|
||||
declare function msMatchMedia(mediaQuery: string): MediaQueryList;
|
||||
declare function msRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
declare function msWriteProfilerMark(profilerMarkName: string): void;
|
||||
declare function open(url?: string, target?: string, features?: string, replace?: boolean): any;
|
||||
declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window;
|
||||
declare function postMessage(message: any, targetOrigin: string, ports?: any): void;
|
||||
declare function print(): void;
|
||||
declare function prompt(message?: string, _default?: string): string;
|
||||
|
||||
Vendored
+2
-2
@@ -286,7 +286,7 @@ interface Console {
|
||||
select(element: any): void;
|
||||
time(timerName?: string): void;
|
||||
timeEnd(timerName?: string): void;
|
||||
trace(): void;
|
||||
trace(message?: any, ...optionalParams: any[]): void;
|
||||
warn(message?: any, ...optionalParams: any[]): void;
|
||||
}
|
||||
|
||||
@@ -526,7 +526,7 @@ interface IDBDatabase extends EventTarget {
|
||||
objectStoreNames: DOMStringList;
|
||||
onabort: (ev: Event) => any;
|
||||
onerror: (ev: Event) => any;
|
||||
version: string;
|
||||
version: number;
|
||||
close(): void;
|
||||
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
|
||||
+3048
-2636
File diff suppressed because it is too large
Load Diff
+4087
-3504
File diff suppressed because it is too large
Load Diff
Vendored
+169
-149
@@ -167,161 +167,162 @@ declare namespace ts {
|
||||
SymbolKeyword = 131,
|
||||
TypeKeyword = 132,
|
||||
FromKeyword = 133,
|
||||
OfKeyword = 134,
|
||||
QualifiedName = 135,
|
||||
ComputedPropertyName = 136,
|
||||
TypeParameter = 137,
|
||||
Parameter = 138,
|
||||
Decorator = 139,
|
||||
PropertySignature = 140,
|
||||
PropertyDeclaration = 141,
|
||||
MethodSignature = 142,
|
||||
MethodDeclaration = 143,
|
||||
Constructor = 144,
|
||||
GetAccessor = 145,
|
||||
SetAccessor = 146,
|
||||
CallSignature = 147,
|
||||
ConstructSignature = 148,
|
||||
IndexSignature = 149,
|
||||
TypePredicate = 150,
|
||||
TypeReference = 151,
|
||||
FunctionType = 152,
|
||||
ConstructorType = 153,
|
||||
TypeQuery = 154,
|
||||
TypeLiteral = 155,
|
||||
ArrayType = 156,
|
||||
TupleType = 157,
|
||||
UnionType = 158,
|
||||
IntersectionType = 159,
|
||||
ParenthesizedType = 160,
|
||||
ThisType = 161,
|
||||
StringLiteralType = 162,
|
||||
ObjectBindingPattern = 163,
|
||||
ArrayBindingPattern = 164,
|
||||
BindingElement = 165,
|
||||
ArrayLiteralExpression = 166,
|
||||
ObjectLiteralExpression = 167,
|
||||
PropertyAccessExpression = 168,
|
||||
ElementAccessExpression = 169,
|
||||
CallExpression = 170,
|
||||
NewExpression = 171,
|
||||
TaggedTemplateExpression = 172,
|
||||
TypeAssertionExpression = 173,
|
||||
ParenthesizedExpression = 174,
|
||||
FunctionExpression = 175,
|
||||
ArrowFunction = 176,
|
||||
DeleteExpression = 177,
|
||||
TypeOfExpression = 178,
|
||||
VoidExpression = 179,
|
||||
AwaitExpression = 180,
|
||||
PrefixUnaryExpression = 181,
|
||||
PostfixUnaryExpression = 182,
|
||||
BinaryExpression = 183,
|
||||
ConditionalExpression = 184,
|
||||
TemplateExpression = 185,
|
||||
YieldExpression = 186,
|
||||
SpreadElementExpression = 187,
|
||||
ClassExpression = 188,
|
||||
OmittedExpression = 189,
|
||||
ExpressionWithTypeArguments = 190,
|
||||
AsExpression = 191,
|
||||
TemplateSpan = 192,
|
||||
SemicolonClassElement = 193,
|
||||
Block = 194,
|
||||
VariableStatement = 195,
|
||||
EmptyStatement = 196,
|
||||
ExpressionStatement = 197,
|
||||
IfStatement = 198,
|
||||
DoStatement = 199,
|
||||
WhileStatement = 200,
|
||||
ForStatement = 201,
|
||||
ForInStatement = 202,
|
||||
ForOfStatement = 203,
|
||||
ContinueStatement = 204,
|
||||
BreakStatement = 205,
|
||||
ReturnStatement = 206,
|
||||
WithStatement = 207,
|
||||
SwitchStatement = 208,
|
||||
LabeledStatement = 209,
|
||||
ThrowStatement = 210,
|
||||
TryStatement = 211,
|
||||
DebuggerStatement = 212,
|
||||
VariableDeclaration = 213,
|
||||
VariableDeclarationList = 214,
|
||||
FunctionDeclaration = 215,
|
||||
ClassDeclaration = 216,
|
||||
InterfaceDeclaration = 217,
|
||||
TypeAliasDeclaration = 218,
|
||||
EnumDeclaration = 219,
|
||||
ModuleDeclaration = 220,
|
||||
ModuleBlock = 221,
|
||||
CaseBlock = 222,
|
||||
ImportEqualsDeclaration = 223,
|
||||
ImportDeclaration = 224,
|
||||
ImportClause = 225,
|
||||
NamespaceImport = 226,
|
||||
NamedImports = 227,
|
||||
ImportSpecifier = 228,
|
||||
ExportAssignment = 229,
|
||||
ExportDeclaration = 230,
|
||||
NamedExports = 231,
|
||||
ExportSpecifier = 232,
|
||||
MissingDeclaration = 233,
|
||||
ExternalModuleReference = 234,
|
||||
JsxElement = 235,
|
||||
JsxSelfClosingElement = 236,
|
||||
JsxOpeningElement = 237,
|
||||
JsxText = 238,
|
||||
JsxClosingElement = 239,
|
||||
JsxAttribute = 240,
|
||||
JsxSpreadAttribute = 241,
|
||||
JsxExpression = 242,
|
||||
CaseClause = 243,
|
||||
DefaultClause = 244,
|
||||
HeritageClause = 245,
|
||||
CatchClause = 246,
|
||||
PropertyAssignment = 247,
|
||||
ShorthandPropertyAssignment = 248,
|
||||
EnumMember = 249,
|
||||
SourceFile = 250,
|
||||
JSDocTypeExpression = 251,
|
||||
JSDocAllType = 252,
|
||||
JSDocUnknownType = 253,
|
||||
JSDocArrayType = 254,
|
||||
JSDocUnionType = 255,
|
||||
JSDocTupleType = 256,
|
||||
JSDocNullableType = 257,
|
||||
JSDocNonNullableType = 258,
|
||||
JSDocRecordType = 259,
|
||||
JSDocRecordMember = 260,
|
||||
JSDocTypeReference = 261,
|
||||
JSDocOptionalType = 262,
|
||||
JSDocFunctionType = 263,
|
||||
JSDocVariadicType = 264,
|
||||
JSDocConstructorType = 265,
|
||||
JSDocThisType = 266,
|
||||
JSDocComment = 267,
|
||||
JSDocTag = 268,
|
||||
JSDocParameterTag = 269,
|
||||
JSDocReturnTag = 270,
|
||||
JSDocTypeTag = 271,
|
||||
JSDocTemplateTag = 272,
|
||||
SyntaxList = 273,
|
||||
Count = 274,
|
||||
GlobalKeyword = 134,
|
||||
OfKeyword = 135,
|
||||
QualifiedName = 136,
|
||||
ComputedPropertyName = 137,
|
||||
TypeParameter = 138,
|
||||
Parameter = 139,
|
||||
Decorator = 140,
|
||||
PropertySignature = 141,
|
||||
PropertyDeclaration = 142,
|
||||
MethodSignature = 143,
|
||||
MethodDeclaration = 144,
|
||||
Constructor = 145,
|
||||
GetAccessor = 146,
|
||||
SetAccessor = 147,
|
||||
CallSignature = 148,
|
||||
ConstructSignature = 149,
|
||||
IndexSignature = 150,
|
||||
TypePredicate = 151,
|
||||
TypeReference = 152,
|
||||
FunctionType = 153,
|
||||
ConstructorType = 154,
|
||||
TypeQuery = 155,
|
||||
TypeLiteral = 156,
|
||||
ArrayType = 157,
|
||||
TupleType = 158,
|
||||
UnionType = 159,
|
||||
IntersectionType = 160,
|
||||
ParenthesizedType = 161,
|
||||
ThisType = 162,
|
||||
StringLiteralType = 163,
|
||||
ObjectBindingPattern = 164,
|
||||
ArrayBindingPattern = 165,
|
||||
BindingElement = 166,
|
||||
ArrayLiteralExpression = 167,
|
||||
ObjectLiteralExpression = 168,
|
||||
PropertyAccessExpression = 169,
|
||||
ElementAccessExpression = 170,
|
||||
CallExpression = 171,
|
||||
NewExpression = 172,
|
||||
TaggedTemplateExpression = 173,
|
||||
TypeAssertionExpression = 174,
|
||||
ParenthesizedExpression = 175,
|
||||
FunctionExpression = 176,
|
||||
ArrowFunction = 177,
|
||||
DeleteExpression = 178,
|
||||
TypeOfExpression = 179,
|
||||
VoidExpression = 180,
|
||||
AwaitExpression = 181,
|
||||
PrefixUnaryExpression = 182,
|
||||
PostfixUnaryExpression = 183,
|
||||
BinaryExpression = 184,
|
||||
ConditionalExpression = 185,
|
||||
TemplateExpression = 186,
|
||||
YieldExpression = 187,
|
||||
SpreadElementExpression = 188,
|
||||
ClassExpression = 189,
|
||||
OmittedExpression = 190,
|
||||
ExpressionWithTypeArguments = 191,
|
||||
AsExpression = 192,
|
||||
TemplateSpan = 193,
|
||||
SemicolonClassElement = 194,
|
||||
Block = 195,
|
||||
VariableStatement = 196,
|
||||
EmptyStatement = 197,
|
||||
ExpressionStatement = 198,
|
||||
IfStatement = 199,
|
||||
DoStatement = 200,
|
||||
WhileStatement = 201,
|
||||
ForStatement = 202,
|
||||
ForInStatement = 203,
|
||||
ForOfStatement = 204,
|
||||
ContinueStatement = 205,
|
||||
BreakStatement = 206,
|
||||
ReturnStatement = 207,
|
||||
WithStatement = 208,
|
||||
SwitchStatement = 209,
|
||||
LabeledStatement = 210,
|
||||
ThrowStatement = 211,
|
||||
TryStatement = 212,
|
||||
DebuggerStatement = 213,
|
||||
VariableDeclaration = 214,
|
||||
VariableDeclarationList = 215,
|
||||
FunctionDeclaration = 216,
|
||||
ClassDeclaration = 217,
|
||||
InterfaceDeclaration = 218,
|
||||
TypeAliasDeclaration = 219,
|
||||
EnumDeclaration = 220,
|
||||
ModuleDeclaration = 221,
|
||||
ModuleBlock = 222,
|
||||
CaseBlock = 223,
|
||||
ImportEqualsDeclaration = 224,
|
||||
ImportDeclaration = 225,
|
||||
ImportClause = 226,
|
||||
NamespaceImport = 227,
|
||||
NamedImports = 228,
|
||||
ImportSpecifier = 229,
|
||||
ExportAssignment = 230,
|
||||
ExportDeclaration = 231,
|
||||
NamedExports = 232,
|
||||
ExportSpecifier = 233,
|
||||
MissingDeclaration = 234,
|
||||
ExternalModuleReference = 235,
|
||||
JsxElement = 236,
|
||||
JsxSelfClosingElement = 237,
|
||||
JsxOpeningElement = 238,
|
||||
JsxText = 239,
|
||||
JsxClosingElement = 240,
|
||||
JsxAttribute = 241,
|
||||
JsxSpreadAttribute = 242,
|
||||
JsxExpression = 243,
|
||||
CaseClause = 244,
|
||||
DefaultClause = 245,
|
||||
HeritageClause = 246,
|
||||
CatchClause = 247,
|
||||
PropertyAssignment = 248,
|
||||
ShorthandPropertyAssignment = 249,
|
||||
EnumMember = 250,
|
||||
SourceFile = 251,
|
||||
JSDocTypeExpression = 252,
|
||||
JSDocAllType = 253,
|
||||
JSDocUnknownType = 254,
|
||||
JSDocArrayType = 255,
|
||||
JSDocUnionType = 256,
|
||||
JSDocTupleType = 257,
|
||||
JSDocNullableType = 258,
|
||||
JSDocNonNullableType = 259,
|
||||
JSDocRecordType = 260,
|
||||
JSDocRecordMember = 261,
|
||||
JSDocTypeReference = 262,
|
||||
JSDocOptionalType = 263,
|
||||
JSDocFunctionType = 264,
|
||||
JSDocVariadicType = 265,
|
||||
JSDocConstructorType = 266,
|
||||
JSDocThisType = 267,
|
||||
JSDocComment = 268,
|
||||
JSDocTag = 269,
|
||||
JSDocParameterTag = 270,
|
||||
JSDocReturnTag = 271,
|
||||
JSDocTypeTag = 272,
|
||||
JSDocTemplateTag = 273,
|
||||
SyntaxList = 274,
|
||||
Count = 275,
|
||||
FirstAssignment = 56,
|
||||
LastAssignment = 68,
|
||||
FirstReservedWord = 70,
|
||||
LastReservedWord = 105,
|
||||
FirstKeyword = 70,
|
||||
LastKeyword = 134,
|
||||
LastKeyword = 135,
|
||||
FirstFutureReservedWord = 106,
|
||||
LastFutureReservedWord = 114,
|
||||
FirstTypeNode = 150,
|
||||
LastTypeNode = 162,
|
||||
FirstTypeNode = 151,
|
||||
LastTypeNode = 163,
|
||||
FirstPunctuation = 15,
|
||||
LastPunctuation = 68,
|
||||
FirstToken = 0,
|
||||
LastToken = 134,
|
||||
LastToken = 135,
|
||||
FirstTriviaToken = 2,
|
||||
LastTriviaToken = 7,
|
||||
FirstLiteralToken = 8,
|
||||
@@ -330,7 +331,7 @@ declare namespace ts {
|
||||
LastTemplateToken = 14,
|
||||
FirstBinaryOperator = 25,
|
||||
LastBinaryOperator = 68,
|
||||
FirstNode = 135,
|
||||
FirstNode = 136,
|
||||
}
|
||||
enum NodeFlags {
|
||||
None = 0,
|
||||
@@ -354,10 +355,16 @@ declare namespace ts {
|
||||
ContainsThis = 262144,
|
||||
HasImplicitReturn = 524288,
|
||||
HasExplicitReturn = 1048576,
|
||||
GlobalAugmentation = 2097152,
|
||||
HasClassExtends = 4194304,
|
||||
HasDecorators = 8388608,
|
||||
HasParamDecorators = 16777216,
|
||||
HasAsyncFunctions = 33554432,
|
||||
Modifier = 1022,
|
||||
AccessibilityModifier = 56,
|
||||
BlockScoped = 24576,
|
||||
ReachabilityCheckFlags = 1572864,
|
||||
EmitHelperFlags = 62914560,
|
||||
}
|
||||
enum JsxFlags {
|
||||
None = 0,
|
||||
@@ -1141,6 +1148,7 @@ declare namespace ts {
|
||||
getSymbolAtLocation(node: Node): Symbol;
|
||||
getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[];
|
||||
getShorthandAssignmentValueSymbol(location: Node): Symbol;
|
||||
getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol;
|
||||
getTypeAtLocation(node: Node): Type;
|
||||
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
|
||||
symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
|
||||
@@ -1154,6 +1162,7 @@ declare namespace ts {
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
isUndefinedSymbol(symbol: Symbol): boolean;
|
||||
isArgumentsSymbol(symbol: Symbol): boolean;
|
||||
isUnknownSymbol(symbol: Symbol): boolean;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
|
||||
getAliasedSymbol(symbol: Symbol): Symbol;
|
||||
@@ -1543,6 +1552,8 @@ declare namespace ts {
|
||||
}
|
||||
}
|
||||
declare namespace ts {
|
||||
type FileWatcherCallback = (path: string, removed?: boolean) => void;
|
||||
type DirectoryWatcherCallback = (path: string) => void;
|
||||
interface System {
|
||||
args: string[];
|
||||
newLine: string;
|
||||
@@ -1550,8 +1561,8 @@ declare namespace ts {
|
||||
write(s: string): void;
|
||||
readFile(path: string, encoding?: string): string;
|
||||
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher;
|
||||
watchDirectory?(path: string, callback: (path: string) => void, recursive?: boolean): FileWatcher;
|
||||
watchFile?(path: Path, callback: FileWatcherCallback): FileWatcher;
|
||||
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(path: string): boolean;
|
||||
directoryExists(path: string): boolean;
|
||||
@@ -1565,6 +1576,10 @@ declare namespace ts {
|
||||
interface FileWatcher {
|
||||
close(): void;
|
||||
}
|
||||
interface DirectoryWatcher extends FileWatcher {
|
||||
directoryPath: Path;
|
||||
referenceCount: number;
|
||||
}
|
||||
var sys: System;
|
||||
}
|
||||
declare namespace ts {
|
||||
@@ -2237,6 +2252,9 @@ declare namespace ts {
|
||||
static jsxOpenTagName: string;
|
||||
static jsxCloseTagName: string;
|
||||
static jsxSelfClosingTagName: string;
|
||||
static jsxAttribute: string;
|
||||
static jsxText: string;
|
||||
static jsxAttributeStringLiteralValue: string;
|
||||
}
|
||||
enum ClassificationType {
|
||||
comment = 1,
|
||||
@@ -2260,6 +2278,9 @@ declare namespace ts {
|
||||
jsxOpenTagName = 19,
|
||||
jsxCloseTagName = 20,
|
||||
jsxSelfClosingTagName = 21,
|
||||
jsxAttribute = 22,
|
||||
jsxText = 23,
|
||||
jsxAttributeStringLiteralValue = 24,
|
||||
}
|
||||
interface DisplayPartsSymbolWriter extends SymbolWriter {
|
||||
displayParts(): SymbolDisplayPart[];
|
||||
@@ -2283,7 +2304,6 @@ declare namespace ts {
|
||||
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
|
||||
let disableIncrementalParsing: boolean;
|
||||
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string;
|
||||
function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry;
|
||||
function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo;
|
||||
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
|
||||
|
||||
+4698
-3926
File diff suppressed because it is too large
Load Diff
Vendored
+169
-149
@@ -167,161 +167,162 @@ declare namespace ts {
|
||||
SymbolKeyword = 131,
|
||||
TypeKeyword = 132,
|
||||
FromKeyword = 133,
|
||||
OfKeyword = 134,
|
||||
QualifiedName = 135,
|
||||
ComputedPropertyName = 136,
|
||||
TypeParameter = 137,
|
||||
Parameter = 138,
|
||||
Decorator = 139,
|
||||
PropertySignature = 140,
|
||||
PropertyDeclaration = 141,
|
||||
MethodSignature = 142,
|
||||
MethodDeclaration = 143,
|
||||
Constructor = 144,
|
||||
GetAccessor = 145,
|
||||
SetAccessor = 146,
|
||||
CallSignature = 147,
|
||||
ConstructSignature = 148,
|
||||
IndexSignature = 149,
|
||||
TypePredicate = 150,
|
||||
TypeReference = 151,
|
||||
FunctionType = 152,
|
||||
ConstructorType = 153,
|
||||
TypeQuery = 154,
|
||||
TypeLiteral = 155,
|
||||
ArrayType = 156,
|
||||
TupleType = 157,
|
||||
UnionType = 158,
|
||||
IntersectionType = 159,
|
||||
ParenthesizedType = 160,
|
||||
ThisType = 161,
|
||||
StringLiteralType = 162,
|
||||
ObjectBindingPattern = 163,
|
||||
ArrayBindingPattern = 164,
|
||||
BindingElement = 165,
|
||||
ArrayLiteralExpression = 166,
|
||||
ObjectLiteralExpression = 167,
|
||||
PropertyAccessExpression = 168,
|
||||
ElementAccessExpression = 169,
|
||||
CallExpression = 170,
|
||||
NewExpression = 171,
|
||||
TaggedTemplateExpression = 172,
|
||||
TypeAssertionExpression = 173,
|
||||
ParenthesizedExpression = 174,
|
||||
FunctionExpression = 175,
|
||||
ArrowFunction = 176,
|
||||
DeleteExpression = 177,
|
||||
TypeOfExpression = 178,
|
||||
VoidExpression = 179,
|
||||
AwaitExpression = 180,
|
||||
PrefixUnaryExpression = 181,
|
||||
PostfixUnaryExpression = 182,
|
||||
BinaryExpression = 183,
|
||||
ConditionalExpression = 184,
|
||||
TemplateExpression = 185,
|
||||
YieldExpression = 186,
|
||||
SpreadElementExpression = 187,
|
||||
ClassExpression = 188,
|
||||
OmittedExpression = 189,
|
||||
ExpressionWithTypeArguments = 190,
|
||||
AsExpression = 191,
|
||||
TemplateSpan = 192,
|
||||
SemicolonClassElement = 193,
|
||||
Block = 194,
|
||||
VariableStatement = 195,
|
||||
EmptyStatement = 196,
|
||||
ExpressionStatement = 197,
|
||||
IfStatement = 198,
|
||||
DoStatement = 199,
|
||||
WhileStatement = 200,
|
||||
ForStatement = 201,
|
||||
ForInStatement = 202,
|
||||
ForOfStatement = 203,
|
||||
ContinueStatement = 204,
|
||||
BreakStatement = 205,
|
||||
ReturnStatement = 206,
|
||||
WithStatement = 207,
|
||||
SwitchStatement = 208,
|
||||
LabeledStatement = 209,
|
||||
ThrowStatement = 210,
|
||||
TryStatement = 211,
|
||||
DebuggerStatement = 212,
|
||||
VariableDeclaration = 213,
|
||||
VariableDeclarationList = 214,
|
||||
FunctionDeclaration = 215,
|
||||
ClassDeclaration = 216,
|
||||
InterfaceDeclaration = 217,
|
||||
TypeAliasDeclaration = 218,
|
||||
EnumDeclaration = 219,
|
||||
ModuleDeclaration = 220,
|
||||
ModuleBlock = 221,
|
||||
CaseBlock = 222,
|
||||
ImportEqualsDeclaration = 223,
|
||||
ImportDeclaration = 224,
|
||||
ImportClause = 225,
|
||||
NamespaceImport = 226,
|
||||
NamedImports = 227,
|
||||
ImportSpecifier = 228,
|
||||
ExportAssignment = 229,
|
||||
ExportDeclaration = 230,
|
||||
NamedExports = 231,
|
||||
ExportSpecifier = 232,
|
||||
MissingDeclaration = 233,
|
||||
ExternalModuleReference = 234,
|
||||
JsxElement = 235,
|
||||
JsxSelfClosingElement = 236,
|
||||
JsxOpeningElement = 237,
|
||||
JsxText = 238,
|
||||
JsxClosingElement = 239,
|
||||
JsxAttribute = 240,
|
||||
JsxSpreadAttribute = 241,
|
||||
JsxExpression = 242,
|
||||
CaseClause = 243,
|
||||
DefaultClause = 244,
|
||||
HeritageClause = 245,
|
||||
CatchClause = 246,
|
||||
PropertyAssignment = 247,
|
||||
ShorthandPropertyAssignment = 248,
|
||||
EnumMember = 249,
|
||||
SourceFile = 250,
|
||||
JSDocTypeExpression = 251,
|
||||
JSDocAllType = 252,
|
||||
JSDocUnknownType = 253,
|
||||
JSDocArrayType = 254,
|
||||
JSDocUnionType = 255,
|
||||
JSDocTupleType = 256,
|
||||
JSDocNullableType = 257,
|
||||
JSDocNonNullableType = 258,
|
||||
JSDocRecordType = 259,
|
||||
JSDocRecordMember = 260,
|
||||
JSDocTypeReference = 261,
|
||||
JSDocOptionalType = 262,
|
||||
JSDocFunctionType = 263,
|
||||
JSDocVariadicType = 264,
|
||||
JSDocConstructorType = 265,
|
||||
JSDocThisType = 266,
|
||||
JSDocComment = 267,
|
||||
JSDocTag = 268,
|
||||
JSDocParameterTag = 269,
|
||||
JSDocReturnTag = 270,
|
||||
JSDocTypeTag = 271,
|
||||
JSDocTemplateTag = 272,
|
||||
SyntaxList = 273,
|
||||
Count = 274,
|
||||
GlobalKeyword = 134,
|
||||
OfKeyword = 135,
|
||||
QualifiedName = 136,
|
||||
ComputedPropertyName = 137,
|
||||
TypeParameter = 138,
|
||||
Parameter = 139,
|
||||
Decorator = 140,
|
||||
PropertySignature = 141,
|
||||
PropertyDeclaration = 142,
|
||||
MethodSignature = 143,
|
||||
MethodDeclaration = 144,
|
||||
Constructor = 145,
|
||||
GetAccessor = 146,
|
||||
SetAccessor = 147,
|
||||
CallSignature = 148,
|
||||
ConstructSignature = 149,
|
||||
IndexSignature = 150,
|
||||
TypePredicate = 151,
|
||||
TypeReference = 152,
|
||||
FunctionType = 153,
|
||||
ConstructorType = 154,
|
||||
TypeQuery = 155,
|
||||
TypeLiteral = 156,
|
||||
ArrayType = 157,
|
||||
TupleType = 158,
|
||||
UnionType = 159,
|
||||
IntersectionType = 160,
|
||||
ParenthesizedType = 161,
|
||||
ThisType = 162,
|
||||
StringLiteralType = 163,
|
||||
ObjectBindingPattern = 164,
|
||||
ArrayBindingPattern = 165,
|
||||
BindingElement = 166,
|
||||
ArrayLiteralExpression = 167,
|
||||
ObjectLiteralExpression = 168,
|
||||
PropertyAccessExpression = 169,
|
||||
ElementAccessExpression = 170,
|
||||
CallExpression = 171,
|
||||
NewExpression = 172,
|
||||
TaggedTemplateExpression = 173,
|
||||
TypeAssertionExpression = 174,
|
||||
ParenthesizedExpression = 175,
|
||||
FunctionExpression = 176,
|
||||
ArrowFunction = 177,
|
||||
DeleteExpression = 178,
|
||||
TypeOfExpression = 179,
|
||||
VoidExpression = 180,
|
||||
AwaitExpression = 181,
|
||||
PrefixUnaryExpression = 182,
|
||||
PostfixUnaryExpression = 183,
|
||||
BinaryExpression = 184,
|
||||
ConditionalExpression = 185,
|
||||
TemplateExpression = 186,
|
||||
YieldExpression = 187,
|
||||
SpreadElementExpression = 188,
|
||||
ClassExpression = 189,
|
||||
OmittedExpression = 190,
|
||||
ExpressionWithTypeArguments = 191,
|
||||
AsExpression = 192,
|
||||
TemplateSpan = 193,
|
||||
SemicolonClassElement = 194,
|
||||
Block = 195,
|
||||
VariableStatement = 196,
|
||||
EmptyStatement = 197,
|
||||
ExpressionStatement = 198,
|
||||
IfStatement = 199,
|
||||
DoStatement = 200,
|
||||
WhileStatement = 201,
|
||||
ForStatement = 202,
|
||||
ForInStatement = 203,
|
||||
ForOfStatement = 204,
|
||||
ContinueStatement = 205,
|
||||
BreakStatement = 206,
|
||||
ReturnStatement = 207,
|
||||
WithStatement = 208,
|
||||
SwitchStatement = 209,
|
||||
LabeledStatement = 210,
|
||||
ThrowStatement = 211,
|
||||
TryStatement = 212,
|
||||
DebuggerStatement = 213,
|
||||
VariableDeclaration = 214,
|
||||
VariableDeclarationList = 215,
|
||||
FunctionDeclaration = 216,
|
||||
ClassDeclaration = 217,
|
||||
InterfaceDeclaration = 218,
|
||||
TypeAliasDeclaration = 219,
|
||||
EnumDeclaration = 220,
|
||||
ModuleDeclaration = 221,
|
||||
ModuleBlock = 222,
|
||||
CaseBlock = 223,
|
||||
ImportEqualsDeclaration = 224,
|
||||
ImportDeclaration = 225,
|
||||
ImportClause = 226,
|
||||
NamespaceImport = 227,
|
||||
NamedImports = 228,
|
||||
ImportSpecifier = 229,
|
||||
ExportAssignment = 230,
|
||||
ExportDeclaration = 231,
|
||||
NamedExports = 232,
|
||||
ExportSpecifier = 233,
|
||||
MissingDeclaration = 234,
|
||||
ExternalModuleReference = 235,
|
||||
JsxElement = 236,
|
||||
JsxSelfClosingElement = 237,
|
||||
JsxOpeningElement = 238,
|
||||
JsxText = 239,
|
||||
JsxClosingElement = 240,
|
||||
JsxAttribute = 241,
|
||||
JsxSpreadAttribute = 242,
|
||||
JsxExpression = 243,
|
||||
CaseClause = 244,
|
||||
DefaultClause = 245,
|
||||
HeritageClause = 246,
|
||||
CatchClause = 247,
|
||||
PropertyAssignment = 248,
|
||||
ShorthandPropertyAssignment = 249,
|
||||
EnumMember = 250,
|
||||
SourceFile = 251,
|
||||
JSDocTypeExpression = 252,
|
||||
JSDocAllType = 253,
|
||||
JSDocUnknownType = 254,
|
||||
JSDocArrayType = 255,
|
||||
JSDocUnionType = 256,
|
||||
JSDocTupleType = 257,
|
||||
JSDocNullableType = 258,
|
||||
JSDocNonNullableType = 259,
|
||||
JSDocRecordType = 260,
|
||||
JSDocRecordMember = 261,
|
||||
JSDocTypeReference = 262,
|
||||
JSDocOptionalType = 263,
|
||||
JSDocFunctionType = 264,
|
||||
JSDocVariadicType = 265,
|
||||
JSDocConstructorType = 266,
|
||||
JSDocThisType = 267,
|
||||
JSDocComment = 268,
|
||||
JSDocTag = 269,
|
||||
JSDocParameterTag = 270,
|
||||
JSDocReturnTag = 271,
|
||||
JSDocTypeTag = 272,
|
||||
JSDocTemplateTag = 273,
|
||||
SyntaxList = 274,
|
||||
Count = 275,
|
||||
FirstAssignment = 56,
|
||||
LastAssignment = 68,
|
||||
FirstReservedWord = 70,
|
||||
LastReservedWord = 105,
|
||||
FirstKeyword = 70,
|
||||
LastKeyword = 134,
|
||||
LastKeyword = 135,
|
||||
FirstFutureReservedWord = 106,
|
||||
LastFutureReservedWord = 114,
|
||||
FirstTypeNode = 150,
|
||||
LastTypeNode = 162,
|
||||
FirstTypeNode = 151,
|
||||
LastTypeNode = 163,
|
||||
FirstPunctuation = 15,
|
||||
LastPunctuation = 68,
|
||||
FirstToken = 0,
|
||||
LastToken = 134,
|
||||
LastToken = 135,
|
||||
FirstTriviaToken = 2,
|
||||
LastTriviaToken = 7,
|
||||
FirstLiteralToken = 8,
|
||||
@@ -330,7 +331,7 @@ declare namespace ts {
|
||||
LastTemplateToken = 14,
|
||||
FirstBinaryOperator = 25,
|
||||
LastBinaryOperator = 68,
|
||||
FirstNode = 135,
|
||||
FirstNode = 136,
|
||||
}
|
||||
enum NodeFlags {
|
||||
None = 0,
|
||||
@@ -354,10 +355,16 @@ declare namespace ts {
|
||||
ContainsThis = 262144,
|
||||
HasImplicitReturn = 524288,
|
||||
HasExplicitReturn = 1048576,
|
||||
GlobalAugmentation = 2097152,
|
||||
HasClassExtends = 4194304,
|
||||
HasDecorators = 8388608,
|
||||
HasParamDecorators = 16777216,
|
||||
HasAsyncFunctions = 33554432,
|
||||
Modifier = 1022,
|
||||
AccessibilityModifier = 56,
|
||||
BlockScoped = 24576,
|
||||
ReachabilityCheckFlags = 1572864,
|
||||
EmitHelperFlags = 62914560,
|
||||
}
|
||||
enum JsxFlags {
|
||||
None = 0,
|
||||
@@ -1141,6 +1148,7 @@ declare namespace ts {
|
||||
getSymbolAtLocation(node: Node): Symbol;
|
||||
getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[];
|
||||
getShorthandAssignmentValueSymbol(location: Node): Symbol;
|
||||
getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol;
|
||||
getTypeAtLocation(node: Node): Type;
|
||||
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
|
||||
symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
|
||||
@@ -1154,6 +1162,7 @@ declare namespace ts {
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
isUndefinedSymbol(symbol: Symbol): boolean;
|
||||
isArgumentsSymbol(symbol: Symbol): boolean;
|
||||
isUnknownSymbol(symbol: Symbol): boolean;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
|
||||
getAliasedSymbol(symbol: Symbol): Symbol;
|
||||
@@ -1543,6 +1552,8 @@ declare namespace ts {
|
||||
}
|
||||
}
|
||||
declare namespace ts {
|
||||
type FileWatcherCallback = (path: string, removed?: boolean) => void;
|
||||
type DirectoryWatcherCallback = (path: string) => void;
|
||||
interface System {
|
||||
args: string[];
|
||||
newLine: string;
|
||||
@@ -1550,8 +1561,8 @@ declare namespace ts {
|
||||
write(s: string): void;
|
||||
readFile(path: string, encoding?: string): string;
|
||||
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher;
|
||||
watchDirectory?(path: string, callback: (path: string) => void, recursive?: boolean): FileWatcher;
|
||||
watchFile?(path: Path, callback: FileWatcherCallback): FileWatcher;
|
||||
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(path: string): boolean;
|
||||
directoryExists(path: string): boolean;
|
||||
@@ -1565,6 +1576,10 @@ declare namespace ts {
|
||||
interface FileWatcher {
|
||||
close(): void;
|
||||
}
|
||||
interface DirectoryWatcher extends FileWatcher {
|
||||
directoryPath: Path;
|
||||
referenceCount: number;
|
||||
}
|
||||
var sys: System;
|
||||
}
|
||||
declare namespace ts {
|
||||
@@ -2237,6 +2252,9 @@ declare namespace ts {
|
||||
static jsxOpenTagName: string;
|
||||
static jsxCloseTagName: string;
|
||||
static jsxSelfClosingTagName: string;
|
||||
static jsxAttribute: string;
|
||||
static jsxText: string;
|
||||
static jsxAttributeStringLiteralValue: string;
|
||||
}
|
||||
enum ClassificationType {
|
||||
comment = 1,
|
||||
@@ -2260,6 +2278,9 @@ declare namespace ts {
|
||||
jsxOpenTagName = 19,
|
||||
jsxCloseTagName = 20,
|
||||
jsxSelfClosingTagName = 21,
|
||||
jsxAttribute = 22,
|
||||
jsxText = 23,
|
||||
jsxAttributeStringLiteralValue = 24,
|
||||
}
|
||||
interface DisplayPartsSymbolWriter extends SymbolWriter {
|
||||
displayParts(): SymbolDisplayPart[];
|
||||
@@ -2283,7 +2304,6 @@ declare namespace ts {
|
||||
function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile;
|
||||
let disableIncrementalParsing: boolean;
|
||||
function updateLanguageServiceSourceFile(sourceFile: SourceFile, scriptSnapshot: IScriptSnapshot, version: string, textChangeRange: TextChangeRange, aggressiveChecks?: boolean): SourceFile;
|
||||
function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string;
|
||||
function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory?: string): DocumentRegistry;
|
||||
function preProcessFile(sourceText: string, readImportFiles?: boolean, detectJavaScriptImports?: boolean): PreProcessedFileInfo;
|
||||
function createLanguageService(host: LanguageServiceHost, documentRegistry?: DocumentRegistry): LanguageService;
|
||||
|
||||
+4698
-3926
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "typescript",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "http://typescriptlang.org/",
|
||||
"version": "1.8.0",
|
||||
"version": "1.9.0",
|
||||
"license": "Apache-2.0",
|
||||
"description": "TypeScript is a language for application scale JavaScript development",
|
||||
"keywords": [
|
||||
|
||||
+114
-13
@@ -117,6 +117,12 @@ namespace ts {
|
||||
let labelIndexMap: Map<number>;
|
||||
let implicitLabels: number[];
|
||||
|
||||
// state used for emit helpers
|
||||
let hasClassExtends: boolean;
|
||||
let hasAsyncFunctions: boolean;
|
||||
let hasDecorators: boolean;
|
||||
let hasParameterDecorators: boolean;
|
||||
|
||||
// If this file is an external module, then it is automatically in strict-mode according to
|
||||
// ES6. If it is not an external module, then we'll determine if it is in strict mode or
|
||||
// not depending on if we see "use strict" in certain places (or if we hit a class/namespace).
|
||||
@@ -131,6 +137,7 @@ namespace ts {
|
||||
options = opts;
|
||||
inStrictMode = !!file.externalModuleIndicator;
|
||||
classifiableNames = {};
|
||||
|
||||
Symbol = objectAllocator.getSymbolConstructor();
|
||||
|
||||
if (!file.locals) {
|
||||
@@ -150,6 +157,10 @@ namespace ts {
|
||||
labelStack = undefined;
|
||||
labelIndexMap = undefined;
|
||||
implicitLabels = undefined;
|
||||
hasClassExtends = false;
|
||||
hasAsyncFunctions = false;
|
||||
hasDecorators = false;
|
||||
hasParameterDecorators = false;
|
||||
}
|
||||
|
||||
return bindSourceFile;
|
||||
@@ -191,8 +202,8 @@ namespace ts {
|
||||
// unless it is a well known Symbol.
|
||||
function getDeclarationName(node: Declaration): string {
|
||||
if (node.name) {
|
||||
if (node.kind === SyntaxKind.ModuleDeclaration && node.name.kind === SyntaxKind.StringLiteral) {
|
||||
return `"${(<LiteralExpression>node.name).text}"`;
|
||||
if (isAmbientModule(node)) {
|
||||
return isGlobalScopeAugmentation(<ModuleDeclaration>node) ? "__global" : `"${(<LiteralExpression>node.name).text}"`;
|
||||
}
|
||||
if (node.name.kind === SyntaxKind.ComputedPropertyName) {
|
||||
const nameExpression = (<ComputedPropertyName>node.name).expression;
|
||||
@@ -240,6 +251,15 @@ namespace ts {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
return node.flags & NodeFlags.Default ? "default" : undefined;
|
||||
case SyntaxKind.JSDocFunctionType:
|
||||
return isJSDocConstructSignature(node) ? "__new" : "__call";
|
||||
case SyntaxKind.Parameter:
|
||||
// Parameters with names are handled at the top of this function. Parameters
|
||||
// without names can only come from JSDocFunctionTypes.
|
||||
Debug.assert(node.parent.kind === SyntaxKind.JSDocFunctionType);
|
||||
let functionType = <JSDocFunctionType>node.parent;
|
||||
let index = indexOf(functionType.parameters, node);
|
||||
return "p" + index;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,7 +368,12 @@ namespace 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 & NodeFlags.ExportContext) {
|
||||
|
||||
// NOTE: Nested ambient modules always should go to to 'locals' table to prevent their automatic merge
|
||||
// during global merging in the checker. Why? The only case when ambient module is permitted inside another module is module augmentation
|
||||
// and this case is specially handled. Module augmentations should only be merged with original module definition
|
||||
// and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed.
|
||||
if (!isAmbientModule(node) && (hasExportModifier || container.flags & NodeFlags.ExportContext)) {
|
||||
const exportKind =
|
||||
(symbolFlags & SymbolFlags.Value ? SymbolFlags.ExportValue : 0) |
|
||||
(symbolFlags & SymbolFlags.Type ? SymbolFlags.ExportType : 0) |
|
||||
@@ -405,7 +430,6 @@ namespace ts {
|
||||
|
||||
addToContainerChain(container);
|
||||
}
|
||||
|
||||
else if (containerFlags & ContainerFlags.IsBlockScopedContainer) {
|
||||
blockScopeContainer = node;
|
||||
blockScopeContainer.locals = undefined;
|
||||
@@ -423,6 +447,9 @@ namespace ts {
|
||||
// reset all reachability check related flags on node (for incremental scenarios)
|
||||
flags &= ~NodeFlags.ReachabilityCheckFlags;
|
||||
|
||||
// reset all emit helper flags on node (for incremental scenarios)
|
||||
flags &= ~NodeFlags.EmitHelperFlags;
|
||||
|
||||
if (kind === SyntaxKind.InterfaceDeclaration) {
|
||||
seenThisKeyword = false;
|
||||
}
|
||||
@@ -440,6 +467,10 @@ namespace ts {
|
||||
labelStack = labelIndexMap = implicitLabels = undefined;
|
||||
}
|
||||
|
||||
if (isInJavaScriptFile(node) && node.jsDocComment) {
|
||||
bind(node.jsDocComment);
|
||||
}
|
||||
|
||||
bindReachableStatement(node);
|
||||
|
||||
if (currentReachabilityState === Reachability.Reachable && isFunctionLikeKind(kind) && nodeIsPresent((<FunctionLikeDeclaration>node).body)) {
|
||||
@@ -453,6 +484,21 @@ namespace ts {
|
||||
flags = seenThisKeyword ? flags | NodeFlags.ContainsThis : flags & ~NodeFlags.ContainsThis;
|
||||
}
|
||||
|
||||
if (kind === SyntaxKind.SourceFile) {
|
||||
if (hasClassExtends) {
|
||||
flags |= NodeFlags.HasClassExtends;
|
||||
}
|
||||
if (hasDecorators) {
|
||||
flags |= NodeFlags.HasDecorators;
|
||||
}
|
||||
if (hasParameterDecorators) {
|
||||
flags |= NodeFlags.HasParamDecorators;
|
||||
}
|
||||
if (hasAsyncFunctions) {
|
||||
flags |= NodeFlags.HasAsyncFunctions;
|
||||
}
|
||||
}
|
||||
|
||||
node.flags = flags;
|
||||
|
||||
if (saveState) {
|
||||
@@ -688,8 +734,9 @@ namespace ts {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.JSDocRecordType:
|
||||
return ContainerFlags.IsContainer;
|
||||
|
||||
case SyntaxKind.CallSignature:
|
||||
@@ -775,6 +822,7 @@ namespace ts {
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.JSDocRecordType:
|
||||
// Interface/Object-types always have their children added to the 'members' of
|
||||
// their container. They are only accessible through an instance of their
|
||||
// container, and are never in scope otherwise (even inside the body of the
|
||||
@@ -795,6 +843,7 @@ namespace ts {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.JSDocFunctionType:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
// All the children of these container types are never visible through another
|
||||
// symbol (i.e. through another symbol's 'exports' or 'members'). Instead,
|
||||
@@ -843,7 +892,10 @@ namespace ts {
|
||||
|
||||
function bindModuleDeclaration(node: ModuleDeclaration) {
|
||||
setExportContextFlag(node);
|
||||
if (node.name.kind === SyntaxKind.StringLiteral) {
|
||||
if (isAmbientModule(node)) {
|
||||
if (node.flags & NodeFlags.Export) {
|
||||
errorOnFirstToken(node, Diagnostics.export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible);
|
||||
}
|
||||
declareSymbolAndAddToSymbolTable(node, SymbolFlags.ValueModule, SymbolFlags.ValueModuleExcludes);
|
||||
}
|
||||
else {
|
||||
@@ -873,7 +925,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function bindFunctionOrConstructorType(node: SignatureDeclaration) {
|
||||
function bindFunctionOrConstructorType(node: SignatureDeclaration): void {
|
||||
// For a given function symbol "<...>(...) => T" we want to generate a symbol identical
|
||||
// to the one we would get for: { <...>(...): T }
|
||||
//
|
||||
@@ -948,7 +1000,7 @@ namespace ts {
|
||||
declareModuleMember(node, symbolFlags, symbolExcludes);
|
||||
break;
|
||||
}
|
||||
// fall through.
|
||||
// fall through.
|
||||
default:
|
||||
if (!blockScopeContainer.locals) {
|
||||
blockScopeContainer.locals = {};
|
||||
@@ -1227,12 +1279,14 @@ namespace ts {
|
||||
return bindVariableDeclarationOrBindingElement(<VariableDeclaration | BindingElement>node);
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
case SyntaxKind.JSDocRecordMember:
|
||||
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.Property | ((<PropertyDeclaration>node).questionToken ? SymbolFlags.Optional : SymbolFlags.None), SymbolFlags.PropertyExcludes);
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
case SyntaxKind.ShorthandPropertyAssignment:
|
||||
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
|
||||
case SyntaxKind.EnumMember:
|
||||
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.EnumMember, SymbolFlags.EnumMemberExcludes);
|
||||
|
||||
case SyntaxKind.CallSignature:
|
||||
case SyntaxKind.ConstructSignature:
|
||||
case SyntaxKind.IndexSignature:
|
||||
@@ -1246,8 +1300,7 @@ namespace ts {
|
||||
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.Method | ((<MethodDeclaration>node).questionToken ? SymbolFlags.Optional : SymbolFlags.None),
|
||||
isObjectLiteralMethod(node) ? SymbolFlags.PropertyExcludes : SymbolFlags.MethodExcludes);
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
checkStrictModeFunctionName(<FunctionDeclaration>node);
|
||||
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.Function, SymbolFlags.FunctionExcludes);
|
||||
return bindFunctionDeclaration(<FunctionDeclaration>node);
|
||||
case SyntaxKind.Constructor:
|
||||
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.Constructor, /*symbolExcludes:*/ SymbolFlags.None);
|
||||
case SyntaxKind.GetAccessor:
|
||||
@@ -1256,16 +1309,16 @@ namespace ts {
|
||||
return bindPropertyOrMethodOrAccessor(<Declaration>node, SymbolFlags.SetAccessor, SymbolFlags.SetAccessorExcludes);
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.JSDocFunctionType:
|
||||
return bindFunctionOrConstructorType(<SignatureDeclaration>node);
|
||||
case SyntaxKind.TypeLiteral:
|
||||
case SyntaxKind.JSDocRecordType:
|
||||
return bindAnonymousDeclaration(<TypeLiteralNode>node, SymbolFlags.TypeLiteral, "__type");
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
return bindObjectLiteralExpression(<ObjectLiteralExpression>node);
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
checkStrictModeFunctionName(<FunctionExpression>node);
|
||||
const bindingName = (<FunctionExpression>node).name ? (<FunctionExpression>node).name.text : "__function";
|
||||
return bindAnonymousDeclaration(<FunctionExpression>node, SymbolFlags.Function, bindingName);
|
||||
return bindFunctionExpression(<FunctionExpression>node);
|
||||
|
||||
case SyntaxKind.CallExpression:
|
||||
if (isInJavaScriptFile(node)) {
|
||||
@@ -1415,6 +1468,15 @@ namespace ts {
|
||||
}
|
||||
|
||||
function bindClassLikeDeclaration(node: ClassLikeDeclaration) {
|
||||
if (!isDeclarationFile(file) && !isInAmbientContext(node)) {
|
||||
if (getClassExtendsHeritageClauseElement(node) !== undefined) {
|
||||
hasClassExtends = true;
|
||||
}
|
||||
if (nodeIsDecorated(node)) {
|
||||
hasDecorators = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (node.kind === SyntaxKind.ClassDeclaration) {
|
||||
bindBlockScopedDeclaration(node, SymbolFlags.Class, SymbolFlags.ClassExcludes);
|
||||
}
|
||||
@@ -1484,6 +1546,13 @@ namespace ts {
|
||||
}
|
||||
|
||||
function bindParameter(node: ParameterDeclaration) {
|
||||
if (!isDeclarationFile(file) &&
|
||||
!isInAmbientContext(node) &&
|
||||
nodeIsDecorated(node)) {
|
||||
hasDecorators = true;
|
||||
hasParameterDecorators = true;
|
||||
}
|
||||
|
||||
if (inStrictMode) {
|
||||
// It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a
|
||||
// strict mode FunctionLikeDeclaration or FunctionExpression(13.1)
|
||||
@@ -1505,7 +1574,39 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function bindFunctionDeclaration(node: FunctionDeclaration) {
|
||||
if (!isDeclarationFile(file) && !isInAmbientContext(node)) {
|
||||
if (isAsyncFunctionLike(node)) {
|
||||
hasAsyncFunctions = true;
|
||||
}
|
||||
}
|
||||
|
||||
checkStrictModeFunctionName(<FunctionDeclaration>node);
|
||||
return declareSymbolAndAddToSymbolTable(<Declaration>node, SymbolFlags.Function, SymbolFlags.FunctionExcludes);
|
||||
}
|
||||
|
||||
function bindFunctionExpression(node: FunctionExpression) {
|
||||
if (!isDeclarationFile(file) && !isInAmbientContext(node)) {
|
||||
if (isAsyncFunctionLike(node)) {
|
||||
hasAsyncFunctions = true;
|
||||
}
|
||||
}
|
||||
|
||||
checkStrictModeFunctionName(<FunctionExpression>node);
|
||||
const bindingName = (<FunctionExpression>node).name ? (<FunctionExpression>node).name.text : "__function";
|
||||
return bindAnonymousDeclaration(<FunctionExpression>node, SymbolFlags.Function, bindingName);
|
||||
}
|
||||
|
||||
function bindPropertyOrMethodOrAccessor(node: Declaration, symbolFlags: SymbolFlags, symbolExcludes: SymbolFlags) {
|
||||
if (!isDeclarationFile(file) && !isInAmbientContext(node)) {
|
||||
if (isAsyncFunctionLike(node)) {
|
||||
hasAsyncFunctions = true;
|
||||
}
|
||||
if (nodeIsDecorated(node)) {
|
||||
hasDecorators = true;
|
||||
}
|
||||
}
|
||||
|
||||
return hasDynamicName(node)
|
||||
? bindAnonymousDeclaration(node, symbolFlags, "__computed")
|
||||
: declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes);
|
||||
|
||||
+732
-343
File diff suppressed because it is too large
Load Diff
@@ -493,8 +493,8 @@ namespace ts {
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions: CompilerOptions = {}): ParsedCommandLine {
|
||||
const { options: optionsFromJsonConfigFile, errors } = convertCompilerOptionsFromJson(json["compilerOptions"], basePath);
|
||||
export function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions: CompilerOptions = {}, configFileName?: string): ParsedCommandLine {
|
||||
const { options: optionsFromJsonConfigFile, errors } = convertCompilerOptionsFromJson(json["compilerOptions"], basePath, configFileName);
|
||||
|
||||
const options = extend(existingOptions, optionsFromJsonConfigFile);
|
||||
return {
|
||||
@@ -523,7 +523,7 @@ namespace ts {
|
||||
for (const extension of supportedExtensions) {
|
||||
const filesInDirWithExtension = host.readDirectory(basePath, extension, exclude);
|
||||
for (const fileName of filesInDirWithExtension) {
|
||||
// .ts extension would read the .d.ts extension files too but since .d.ts is lower priority extension,
|
||||
// .ts extension would read the .d.ts extension files too but since .d.ts is lower priority extension,
|
||||
// lets pick them when its turn comes up
|
||||
if (extension === ".ts" && fileExtensionIs(fileName, ".d.ts")) {
|
||||
continue;
|
||||
@@ -547,10 +547,15 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
export function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string): { options: CompilerOptions, errors: Diagnostic[] } {
|
||||
export function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): { options: CompilerOptions, errors: Diagnostic[] } {
|
||||
const options: CompilerOptions = {};
|
||||
const errors: Diagnostic[] = [];
|
||||
|
||||
if (configFileName && getBaseFileName(configFileName) === "jsconfig.json") {
|
||||
options.module = ModuleKind.CommonJS;
|
||||
options.allowJs = true;
|
||||
}
|
||||
|
||||
if (!jsonOptions) {
|
||||
return { options, errors };
|
||||
}
|
||||
|
||||
+12
-2
@@ -616,7 +616,9 @@ namespace ts {
|
||||
return path.substr(0, rootLength) + normalized.join(directorySeparator);
|
||||
}
|
||||
|
||||
export function getDirectoryPath(path: string) {
|
||||
export function getDirectoryPath(path: Path): Path;
|
||||
export function getDirectoryPath(path: string): string;
|
||||
export function getDirectoryPath(path: string): any {
|
||||
return path.substr(0, Math.max(getRootLength(path), path.lastIndexOf(directorySeparator)));
|
||||
}
|
||||
|
||||
@@ -716,7 +718,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
// Find the component that differs
|
||||
for (var joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) {
|
||||
let joinStartIndex: number;
|
||||
for (joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) {
|
||||
if (getCanonicalFileName(directoryComponents[joinStartIndex]) !== getCanonicalFileName(pathComponents[joinStartIndex])) {
|
||||
break;
|
||||
}
|
||||
@@ -874,4 +877,11 @@ namespace ts {
|
||||
}
|
||||
return copiedList;
|
||||
}
|
||||
|
||||
export function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string {
|
||||
return useCaseSensitivefileNames
|
||||
? ((fileName) => fileName)
|
||||
: ((fileName) => fileName.toLowerCase());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace ts {
|
||||
let writer = createAndSetNewTextWriterWithSymbolWriter();
|
||||
|
||||
let enclosingDeclaration: Node;
|
||||
let resultHasExternalModuleIndicator: boolean;
|
||||
let currentText: string;
|
||||
let currentLineMap: number[];
|
||||
let currentIdentifiers: Map<string>;
|
||||
@@ -101,6 +102,7 @@ namespace ts {
|
||||
});
|
||||
}
|
||||
|
||||
resultHasExternalModuleIndicator = false;
|
||||
if (!isBundledEmit || !isExternalModule(sourceFile)) {
|
||||
noDeclare = false;
|
||||
emitSourceFile(sourceFile);
|
||||
@@ -139,6 +141,14 @@ namespace ts {
|
||||
allSourcesModuleElementDeclarationEmitInfo = allSourcesModuleElementDeclarationEmitInfo.concat(moduleElementDeclarationEmitInfo);
|
||||
moduleElementDeclarationEmitInfo = [];
|
||||
}
|
||||
|
||||
if (!isBundledEmit && isExternalModule(sourceFile) && sourceFile.moduleAugmentations.length && !resultHasExternalModuleIndicator) {
|
||||
// if file was external module with augmentations - this fact should be preserved in .d.ts as well.
|
||||
// in case if we didn't write any external module specifiers in .d.ts we need to emit something
|
||||
// that will force compiler to think that this file is an external module - 'export {}' is a reasonable choice here.
|
||||
write("export {};");
|
||||
writeLine();
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
@@ -721,16 +731,25 @@ namespace ts {
|
||||
writer.writeLine();
|
||||
}
|
||||
|
||||
function emitExternalModuleSpecifier(parent: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration) {
|
||||
function emitExternalModuleSpecifier(parent: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration) {
|
||||
// emitExternalModuleSpecifier is usually called when we emit something in the.d.ts file that will make it an external module (i.e. import/export declarations).
|
||||
// the only case when it is not true is when we call it to emit correct name for module augmentation - d.ts files with just module augmentations are not considered
|
||||
// external modules since they are indistingushable from script files with ambient modules. To fix this in such d.ts files we'll emit top level 'export {}'
|
||||
// so compiler will treat them as external modules.
|
||||
resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent.kind !== SyntaxKind.ModuleDeclaration;
|
||||
let moduleSpecifier: Node;
|
||||
if (parent.kind === SyntaxKind.ImportEqualsDeclaration) {
|
||||
const node = parent as ImportEqualsDeclaration;
|
||||
moduleSpecifier = getExternalModuleImportEqualsDeclarationExpression(node);
|
||||
}
|
||||
else if (parent.kind === SyntaxKind.ModuleDeclaration) {
|
||||
moduleSpecifier = (<ModuleDeclaration>parent).name;
|
||||
}
|
||||
else {
|
||||
const node = parent as (ImportDeclaration | ExportDeclaration);
|
||||
moduleSpecifier = node.moduleSpecifier;
|
||||
}
|
||||
|
||||
if (moduleSpecifier.kind === SyntaxKind.StringLiteral && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) {
|
||||
const moduleName = getExternalModuleNameFromDeclaration(host, resolver, parent);
|
||||
if (moduleName) {
|
||||
@@ -784,13 +803,23 @@ namespace ts {
|
||||
function writeModuleDeclaration(node: ModuleDeclaration) {
|
||||
emitJsDocComments(node);
|
||||
emitModuleElementDeclarationFlags(node);
|
||||
if (node.flags & NodeFlags.Namespace) {
|
||||
write("namespace ");
|
||||
if (isGlobalScopeAugmentation(node)) {
|
||||
write("global ");
|
||||
}
|
||||
else {
|
||||
write("module ");
|
||||
if (node.flags & NodeFlags.Namespace) {
|
||||
write("namespace ");
|
||||
}
|
||||
else {
|
||||
write("module ");
|
||||
}
|
||||
if (isExternalModuleAugmentation(node)) {
|
||||
emitExternalModuleSpecifier(node);
|
||||
}
|
||||
else {
|
||||
writeTextOfNode(currentText, node.name);
|
||||
}
|
||||
}
|
||||
writeTextOfNode(currentText, node.name);
|
||||
while (node.body.kind !== SyntaxKind.ModuleBlock) {
|
||||
node = <ModuleDeclaration>node.body;
|
||||
write(".");
|
||||
|
||||
@@ -711,10 +711,6 @@
|
||||
"category": "Error",
|
||||
"code": 1227
|
||||
},
|
||||
"A type predicate is only allowed in return type position for functions and methods.": {
|
||||
"category": "Error",
|
||||
"code": 1228
|
||||
},
|
||||
"A type predicate cannot reference a rest parameter.": {
|
||||
"category": "Error",
|
||||
"code": 1229
|
||||
@@ -1655,10 +1651,6 @@
|
||||
"category": "Error",
|
||||
"code": 2518
|
||||
},
|
||||
"A 'this'-based type predicate is only allowed within a class or interface's members, get accessors, or return type positions for functions and methods.": {
|
||||
"category": "Error",
|
||||
"code": 2519
|
||||
},
|
||||
"Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions.": {
|
||||
"category": "Error",
|
||||
"code": 2520
|
||||
@@ -1771,6 +1763,46 @@
|
||||
"category": "Error",
|
||||
"code": 2660
|
||||
},
|
||||
"Cannot re-export name that is not defined in the module.": {
|
||||
"category": "Error",
|
||||
"code": 2661
|
||||
},
|
||||
"Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?": {
|
||||
"category": "Error",
|
||||
"code": 2662
|
||||
},
|
||||
"Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?": {
|
||||
"category": "Error",
|
||||
"code": 2663
|
||||
},
|
||||
"Invalid module name in augmentation, module '{0}' cannot be found.": {
|
||||
"category": "Error",
|
||||
"code": 2664
|
||||
},
|
||||
"Module augmentation cannot introduce new names in the top level scope.": {
|
||||
"category": "Error",
|
||||
"code": 2665
|
||||
},
|
||||
"Exports and export assignments are not permitted in module augmentations.": {
|
||||
"category": "Error",
|
||||
"code": 2666
|
||||
},
|
||||
"Imports are not permitted in module augmentations. Consider moving them to the enclosing external module.": {
|
||||
"category": "Error",
|
||||
"code": 2667
|
||||
},
|
||||
"'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible.": {
|
||||
"category": "Error",
|
||||
"code": 2668
|
||||
},
|
||||
"Augmentations for the global scope can only be directly nested in external modules or ambient module declarations.": {
|
||||
"category": "Error",
|
||||
"code": 2669
|
||||
},
|
||||
"Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context.": {
|
||||
"category": "Error",
|
||||
"code": 2670
|
||||
},
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
"code": 4000
|
||||
|
||||
+187
-107
@@ -319,17 +319,12 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
};`;
|
||||
|
||||
const awaiterHelper = `
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
generator = generator.call(thisArg, _arguments);
|
||||
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
|
||||
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
|
||||
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
|
||||
function step(verb, value) {
|
||||
var result = generator[verb](value);
|
||||
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
|
||||
}
|
||||
step("next", void 0);
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new P(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};`;
|
||||
|
||||
@@ -464,8 +459,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
const writer = createTextWriter(newLine);
|
||||
const { write, writeTextOfNode, writeLine, increaseIndent, decreaseIndent } = writer;
|
||||
|
||||
const sourceMap = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? createSourceMapWriter(host, writer) : getNullSourceMapWriter();
|
||||
const { setSourceFile, emitStart, emitEnd, emitPos } = sourceMap;
|
||||
let sourceMap = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? createSourceMapWriter(host, writer) : getNullSourceMapWriter();
|
||||
let { setSourceFile, emitStart, emitEnd, emitPos } = sourceMap;
|
||||
|
||||
let currentSourceFile: SourceFile;
|
||||
let currentText: string;
|
||||
@@ -512,6 +507,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
/** If removeComments is true, no leading-comments needed to be emitted **/
|
||||
const emitLeadingCommentsOfPosition = compilerOptions.removeComments ? function (pos: number) { } : emitLeadingCommentsOfPositionWorker;
|
||||
|
||||
const setSourceMapWriterEmit = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? changeSourceMapEmit : function (writer: SourceMapWriter) { };
|
||||
|
||||
const moduleEmitDelegates: Map<(node: SourceFile, emitRelativePathAsModuleName?: boolean) => void> = {
|
||||
[ModuleKind.ES6]: emitES6Module,
|
||||
[ModuleKind.AMD]: emitAMDModule,
|
||||
@@ -1248,7 +1245,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
else {
|
||||
// One object literal with all the attributes in them
|
||||
write("{");
|
||||
for (var i = 0; i < attrs.length; i++) {
|
||||
for (let i = 0, n = attrs.length; i < n; i++) {
|
||||
if (i > 0) {
|
||||
write(", ");
|
||||
}
|
||||
@@ -1260,7 +1257,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
|
||||
// Children
|
||||
if (children) {
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
for (let i = 0; i < children.length; i++) {
|
||||
// Don't emit empty expressions
|
||||
if (children[i].kind === SyntaxKind.JsxExpression && !((<JsxExpression>children[i]).expression)) {
|
||||
continue;
|
||||
@@ -1354,7 +1351,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
function emitJsxElement(node: JsxElement) {
|
||||
emitJsxOpeningOrSelfClosingElement(node.openingElement);
|
||||
|
||||
for (var i = 0, n = node.children.length; i < n; i++) {
|
||||
for (let i = 0, n = node.children.length; i < n; i++) {
|
||||
emit(node.children[i]);
|
||||
}
|
||||
|
||||
@@ -1491,11 +1488,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
function emitExpressionIdentifier(node: Identifier) {
|
||||
if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.LexicalArguments) {
|
||||
write("_arguments");
|
||||
return;
|
||||
}
|
||||
|
||||
const container = resolver.getReferencedExportContainer(node);
|
||||
if (container) {
|
||||
if (container.kind === SyntaxKind.SourceFile) {
|
||||
@@ -1975,7 +1967,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
result.expression = parenthesizeForAccess(expression);
|
||||
result.dotToken = createSynthesizedNode(SyntaxKind.DotToken);
|
||||
result.name = name;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2126,6 +2117,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
return;
|
||||
}
|
||||
|
||||
if (languageVersion === ScriptTarget.ES6 &&
|
||||
node.expression.kind === SyntaxKind.SuperKeyword &&
|
||||
isInAsyncMethodWithSuperInES6(node)) {
|
||||
const name = <StringLiteral>createSynthesizedNode(SyntaxKind.StringLiteral);
|
||||
name.text = node.name.text;
|
||||
emitSuperAccessInAsyncMethod(node.expression, name);
|
||||
return;
|
||||
}
|
||||
|
||||
emit(node.expression);
|
||||
const indentedBeforeDot = indentIfOnDifferentLines(node, node.expression, node.dotToken);
|
||||
|
||||
@@ -2211,6 +2211,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (tryEmitConstantValue(node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (languageVersion === ScriptTarget.ES6 &&
|
||||
node.expression.kind === SyntaxKind.SuperKeyword &&
|
||||
isInAsyncMethodWithSuperInES6(node)) {
|
||||
emitSuperAccessInAsyncMethod(node.expression, node.argumentExpression);
|
||||
return;
|
||||
}
|
||||
|
||||
emit(node.expression);
|
||||
write("[");
|
||||
emit(node.argumentExpression);
|
||||
@@ -2286,23 +2294,47 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write(")");
|
||||
}
|
||||
|
||||
function isInAsyncMethodWithSuperInES6(node: Node) {
|
||||
if (languageVersion === ScriptTarget.ES6) {
|
||||
const container = getSuperContainer(node, /*includeFunctions*/ false);
|
||||
if (container && resolver.getNodeCheckFlags(container) & (NodeCheckFlags.AsyncMethodWithSuper | NodeCheckFlags.AsyncMethodWithSuperBinding)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function emitSuperAccessInAsyncMethod(superNode: Node, argumentExpression: Expression) {
|
||||
const container = getSuperContainer(superNode, /*includeFunctions*/ false);
|
||||
const isSuperBinding = resolver.getNodeCheckFlags(container) & NodeCheckFlags.AsyncMethodWithSuperBinding;
|
||||
write("_super(");
|
||||
emit(argumentExpression);
|
||||
write(isSuperBinding ? ").value" : ")");
|
||||
}
|
||||
|
||||
function emitCallExpression(node: CallExpression) {
|
||||
if (languageVersion < ScriptTarget.ES6 && hasSpreadElement(node.arguments)) {
|
||||
emitCallWithSpread(node);
|
||||
return;
|
||||
}
|
||||
|
||||
const expression = node.expression;
|
||||
let superCall = false;
|
||||
if (node.expression.kind === SyntaxKind.SuperKeyword) {
|
||||
emitSuper(node.expression);
|
||||
let isAsyncMethodWithSuper = false;
|
||||
if (expression.kind === SyntaxKind.SuperKeyword) {
|
||||
emitSuper(expression);
|
||||
superCall = true;
|
||||
}
|
||||
else {
|
||||
emit(node.expression);
|
||||
superCall = node.expression.kind === SyntaxKind.PropertyAccessExpression && (<PropertyAccessExpression>node.expression).expression.kind === SyntaxKind.SuperKeyword;
|
||||
superCall = isSuperPropertyOrElementAccess(expression);
|
||||
isAsyncMethodWithSuper = superCall && isInAsyncMethodWithSuperInES6(node);
|
||||
emit(expression);
|
||||
}
|
||||
if (superCall && languageVersion < ScriptTarget.ES6) {
|
||||
|
||||
if (superCall && (languageVersion < ScriptTarget.ES6 || isAsyncMethodWithSuper)) {
|
||||
write(".call(");
|
||||
emitThis(node.expression);
|
||||
emitThis(expression);
|
||||
if (node.arguments.length) {
|
||||
write(", ");
|
||||
emitCommaList(node.arguments);
|
||||
@@ -2568,7 +2600,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
leftHandSideExpression.argumentExpression.kind !== SyntaxKind.StringLiteral) {
|
||||
const tempArgumentExpression = createAndRecordTempVariable(TempFlags._i);
|
||||
(<ElementAccessExpression>synthesizedLHS).argumentExpression = tempArgumentExpression;
|
||||
emitAssignment(tempArgumentExpression, leftHandSideExpression.argumentExpression, /*shouldEmitCommaBeforeAssignment*/ true);
|
||||
emitAssignment(tempArgumentExpression, leftHandSideExpression.argumentExpression, /*shouldEmitCommaBeforeAssignment*/ true, leftHandSideExpression.expression);
|
||||
}
|
||||
else {
|
||||
(<ElementAccessExpression>synthesizedLHS).argumentExpression = leftHandSideExpression.argumentExpression;
|
||||
@@ -2796,7 +2828,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
* Returns false if nothing was written - this can happen for source file level variable declarations
|
||||
* in system modules where such variable declarations are hoisted.
|
||||
*/
|
||||
function tryEmitStartOfVariableDeclarationList(decl: VariableDeclarationList, startPos?: number): boolean {
|
||||
function tryEmitStartOfVariableDeclarationList(decl: VariableDeclarationList): boolean {
|
||||
if (shouldHoistVariable(decl, /*checkIfSourceFileLevelDecl*/ true)) {
|
||||
// variables in variable declaration list were already hoisted
|
||||
return false;
|
||||
@@ -2811,34 +2843,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
return false;
|
||||
}
|
||||
|
||||
let tokenKind = SyntaxKind.VarKeyword;
|
||||
emitStart(decl);
|
||||
if (decl && languageVersion >= ScriptTarget.ES6) {
|
||||
if (isLet(decl)) {
|
||||
tokenKind = SyntaxKind.LetKeyword;
|
||||
write("let ");
|
||||
}
|
||||
else if (isConst(decl)) {
|
||||
tokenKind = SyntaxKind.ConstKeyword;
|
||||
write("const ");
|
||||
}
|
||||
else {
|
||||
write("var ");
|
||||
}
|
||||
}
|
||||
|
||||
if (startPos !== undefined) {
|
||||
emitToken(tokenKind, startPos);
|
||||
write(" ");
|
||||
}
|
||||
else {
|
||||
switch (tokenKind) {
|
||||
case SyntaxKind.VarKeyword:
|
||||
write("var ");
|
||||
break;
|
||||
case SyntaxKind.LetKeyword:
|
||||
write("let ");
|
||||
break;
|
||||
case SyntaxKind.ConstKeyword:
|
||||
write("const ");
|
||||
break;
|
||||
}
|
||||
write("var ");
|
||||
}
|
||||
|
||||
// Note here we specifically dont emit end so that if we are going to emit binding pattern
|
||||
// we can alter the source map correctly
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2896,7 +2917,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
case SyntaxKind.ForStatement:
|
||||
case SyntaxKind.ForInStatement:
|
||||
case SyntaxKind.ForOfStatement:
|
||||
if ((<ForStatement | ForInStatement | ForOfStatement>node).initializer.kind === SyntaxKind.VariableDeclarationList) {
|
||||
const initializer = (<ForStatement | ForInStatement | ForOfStatement>node).initializer;
|
||||
if (initializer && initializer.kind === SyntaxKind.VariableDeclarationList) {
|
||||
loopInitializer = <VariableDeclarationList>(<ForStatement | ForInStatement | ForOfStatement>node).initializer;
|
||||
}
|
||||
break;
|
||||
@@ -3177,7 +3199,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
endPos = emitToken(SyntaxKind.OpenParenToken, endPos);
|
||||
if (node.initializer && node.initializer.kind === SyntaxKind.VariableDeclarationList) {
|
||||
const variableDeclarationList = <VariableDeclarationList>node.initializer;
|
||||
const startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos);
|
||||
const startIsEmitted = tryEmitStartOfVariableDeclarationList(variableDeclarationList);
|
||||
if (startIsEmitted) {
|
||||
emitCommaList(variableDeclarationList.declarations);
|
||||
}
|
||||
@@ -3218,7 +3240,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (node.initializer.kind === SyntaxKind.VariableDeclarationList) {
|
||||
const variableDeclarationList = <VariableDeclarationList>node.initializer;
|
||||
if (variableDeclarationList.declarations.length >= 1) {
|
||||
tryEmitStartOfVariableDeclarationList(variableDeclarationList, endPos);
|
||||
tryEmitStartOfVariableDeclarationList(variableDeclarationList);
|
||||
emit(variableDeclarationList.declarations[0]);
|
||||
}
|
||||
}
|
||||
@@ -3305,21 +3327,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write("; ");
|
||||
|
||||
// _i < _a.length;
|
||||
emitStart(node.initializer);
|
||||
emitStart(node.expression);
|
||||
emitNodeWithoutSourceMap(counter);
|
||||
write(" < ");
|
||||
|
||||
emitNodeWithCommentsAndWithoutSourcemap(rhsReference);
|
||||
write(".length");
|
||||
|
||||
emitEnd(node.initializer);
|
||||
emitEnd(node.expression);
|
||||
write("; ");
|
||||
|
||||
// _i++)
|
||||
emitStart(node.initializer);
|
||||
emitStart(node.expression);
|
||||
emitNodeWithoutSourceMap(counter);
|
||||
write("++");
|
||||
emitEnd(node.initializer);
|
||||
emitEnd(node.expression);
|
||||
emitToken(SyntaxKind.CloseParenToken, node.expression.end);
|
||||
|
||||
// Body
|
||||
@@ -3719,7 +3741,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
* @param value an expression as a right-hand-side operand of the assignment
|
||||
* @param shouldEmitCommaBeforeAssignment a boolean indicating whether to prefix an assignment with comma
|
||||
*/
|
||||
function emitAssignment(name: Identifier, value: Expression, shouldEmitCommaBeforeAssignment: boolean) {
|
||||
function emitAssignment(name: Identifier, value: Expression, shouldEmitCommaBeforeAssignment: boolean, nodeForSourceMap: Node) {
|
||||
if (shouldEmitCommaBeforeAssignment) {
|
||||
write(", ");
|
||||
}
|
||||
@@ -3735,15 +3757,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
const isVariableDeclarationOrBindingElement =
|
||||
name.parent && (name.parent.kind === SyntaxKind.VariableDeclaration || name.parent.kind === SyntaxKind.BindingElement);
|
||||
|
||||
if (isVariableDeclarationOrBindingElement) {
|
||||
emitModuleMemberName(<Declaration>name.parent);
|
||||
}
|
||||
else {
|
||||
emit(name);
|
||||
}
|
||||
// If this is first var declaration, we need to start at var/let/const keyword instead
|
||||
// otherwise use nodeForSourceMap as the start position
|
||||
emitStart(isFirstVariableDeclaration(nodeForSourceMap) ? nodeForSourceMap.parent : nodeForSourceMap);
|
||||
withTemporaryNoSourceMap(() => {
|
||||
if (isVariableDeclarationOrBindingElement) {
|
||||
emitModuleMemberName(<Declaration>name.parent);
|
||||
}
|
||||
else {
|
||||
emit(name);
|
||||
}
|
||||
|
||||
write(" = ");
|
||||
emit(value);
|
||||
write(" = ");
|
||||
emit(value);
|
||||
});
|
||||
emitEnd(nodeForSourceMap, /*stopOverridingSpan*/true);
|
||||
|
||||
if (exportChanged) {
|
||||
write(")");
|
||||
@@ -3756,15 +3784,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
* @param canDefineTempVariablesInPlace a boolean indicating whether you can define the temporary variable at an assignment location
|
||||
* @param shouldEmitCommaBeforeAssignment a boolean indicating whether an assignment should prefix with comma
|
||||
*/
|
||||
function emitTempVariableAssignment(expression: Expression, canDefineTempVariablesInPlace: boolean, shouldEmitCommaBeforeAssignment: boolean): Identifier {
|
||||
function emitTempVariableAssignment(expression: Expression, canDefineTempVariablesInPlace: boolean, shouldEmitCommaBeforeAssignment: boolean, sourceMapNode?: Node): Identifier {
|
||||
const identifier = createTempVariable(TempFlags.Auto);
|
||||
if (!canDefineTempVariablesInPlace) {
|
||||
recordTempDeclaration(identifier);
|
||||
}
|
||||
emitAssignment(identifier, expression, shouldEmitCommaBeforeAssignment);
|
||||
emitAssignment(identifier, expression, shouldEmitCommaBeforeAssignment, sourceMapNode || expression.parent);
|
||||
return identifier;
|
||||
}
|
||||
|
||||
function isFirstVariableDeclaration(root: Node) {
|
||||
return root.kind === SyntaxKind.VariableDeclaration &&
|
||||
root.parent.kind === SyntaxKind.VariableDeclarationList &&
|
||||
(<VariableDeclarationList>root.parent).declarations[0] === root;
|
||||
}
|
||||
|
||||
function emitDestructuring(root: BinaryExpression | VariableDeclaration | ParameterDeclaration, isAssignmentExpressionStatement: boolean, value?: Expression) {
|
||||
let emitCount = 0;
|
||||
|
||||
@@ -3787,6 +3821,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
else {
|
||||
Debug.assert(!isAssignmentExpressionStatement);
|
||||
// If first variable declaration of variable statement correct the start location
|
||||
if (isFirstVariableDeclaration(root)) {
|
||||
// Use emit location of "var " as next emit start entry
|
||||
sourceMap.changeEmitSourcePos();
|
||||
}
|
||||
emitBindingElement(<BindingElement>root, value);
|
||||
}
|
||||
|
||||
@@ -3800,20 +3839,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
* @param reuseIdentifierExpressions true if identifier expressions can simply be returned;
|
||||
* false if it is necessary to always emit an identifier.
|
||||
*/
|
||||
function ensureIdentifier(expr: Expression, reuseIdentifierExpressions: boolean): Expression {
|
||||
function ensureIdentifier(expr: Expression, reuseIdentifierExpressions: boolean, sourceMapNode: Node): Expression {
|
||||
if (expr.kind === SyntaxKind.Identifier && reuseIdentifierExpressions) {
|
||||
return expr;
|
||||
}
|
||||
|
||||
const identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCount > 0);
|
||||
const identifier = emitTempVariableAssignment(expr, canDefineTempVariablesInPlace, emitCount > 0, sourceMapNode);
|
||||
emitCount++;
|
||||
return identifier;
|
||||
}
|
||||
|
||||
function createDefaultValueCheck(value: Expression, defaultValue: Expression): Expression {
|
||||
function createDefaultValueCheck(value: Expression, defaultValue: Expression, sourceMapNode: Node): Expression {
|
||||
// The value expression will be evaluated twice, so for anything but a simple identifier
|
||||
// we need to generate a temporary variable
|
||||
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true);
|
||||
// If the temporary variable needs to be emitted use the source Map node for assignment of that statement
|
||||
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, sourceMapNode);
|
||||
// Return the expression 'value === void 0 ? defaultValue : value'
|
||||
const equals = <BinaryExpression>createSynthesizedNode(SyntaxKind.BinaryExpression);
|
||||
equals.left = value;
|
||||
@@ -3842,7 +3882,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
let index: Expression;
|
||||
const nameIsComputed = propName.kind === SyntaxKind.ComputedPropertyName;
|
||||
if (nameIsComputed) {
|
||||
index = ensureIdentifier((<ComputedPropertyName>propName).expression, /*reuseIdentifierExpressions*/ false);
|
||||
// TODO to handle when we look into sourcemaps for computed properties, for now use propName
|
||||
index = ensureIdentifier((<ComputedPropertyName>propName).expression, /*reuseIdentifierExpressions*/ false, propName);
|
||||
}
|
||||
else {
|
||||
// We create a synthetic copy of the identifier in order to avoid the rewriting that might
|
||||
@@ -3866,61 +3907,66 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
return call;
|
||||
}
|
||||
|
||||
function emitObjectLiteralAssignment(target: ObjectLiteralExpression, value: Expression) {
|
||||
function emitObjectLiteralAssignment(target: ObjectLiteralExpression, value: Expression, sourceMapNode: Node) {
|
||||
const properties = target.properties;
|
||||
if (properties.length !== 1) {
|
||||
// For anything but a single element destructuring we need to generate a temporary
|
||||
// to ensure value is evaluated exactly once.
|
||||
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true);
|
||||
// When doing so we want to hightlight the passed in source map node since thats the one needing this temp assignment
|
||||
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, sourceMapNode);
|
||||
}
|
||||
for (const p of properties) {
|
||||
if (p.kind === SyntaxKind.PropertyAssignment || p.kind === SyntaxKind.ShorthandPropertyAssignment) {
|
||||
const propName = <Identifier | LiteralExpression>(<PropertyAssignment>p).name;
|
||||
const target = p.kind === SyntaxKind.ShorthandPropertyAssignment ? <ShorthandPropertyAssignment>p : (<PropertyAssignment>p).initializer || propName;
|
||||
emitDestructuringAssignment(target, createPropertyAccessForDestructuringProperty(value, propName));
|
||||
// Assignment for target = value.propName should highligh whole property, hence use p as source map node
|
||||
emitDestructuringAssignment(target, createPropertyAccessForDestructuringProperty(value, propName), p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function emitArrayLiteralAssignment(target: ArrayLiteralExpression, value: Expression) {
|
||||
function emitArrayLiteralAssignment(target: ArrayLiteralExpression, value: Expression, sourceMapNode: Node) {
|
||||
const elements = target.elements;
|
||||
if (elements.length !== 1) {
|
||||
// For anything but a single element destructuring we need to generate a temporary
|
||||
// to ensure value is evaluated exactly once.
|
||||
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true);
|
||||
// When doing so we want to hightlight the passed in source map node since thats the one needing this temp assignment
|
||||
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, sourceMapNode);
|
||||
}
|
||||
for (let i = 0; i < elements.length; i++) {
|
||||
const e = elements[i];
|
||||
if (e.kind !== SyntaxKind.OmittedExpression) {
|
||||
// Assignment for target = value.propName should highligh whole property, hence use e as source map node
|
||||
if (e.kind !== SyntaxKind.SpreadElementExpression) {
|
||||
emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i)));
|
||||
emitDestructuringAssignment(e, createElementAccessExpression(value, createNumericLiteral(i)), e);
|
||||
}
|
||||
else if (i === elements.length - 1) {
|
||||
emitDestructuringAssignment((<SpreadElementExpression>e).expression, createSliceCall(value, i));
|
||||
emitDestructuringAssignment((<SpreadElementExpression>e).expression, createSliceCall(value, i), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function emitDestructuringAssignment(target: Expression | ShorthandPropertyAssignment, value: Expression) {
|
||||
function emitDestructuringAssignment(target: Expression | ShorthandPropertyAssignment, value: Expression, sourceMapNode: Node) {
|
||||
// When emitting target = value use source map node to highlight, including any temporary assignments needed for this
|
||||
if (target.kind === SyntaxKind.ShorthandPropertyAssignment) {
|
||||
if ((<ShorthandPropertyAssignment>target).objectAssignmentInitializer) {
|
||||
value = createDefaultValueCheck(value, (<ShorthandPropertyAssignment>target).objectAssignmentInitializer);
|
||||
value = createDefaultValueCheck(value, (<ShorthandPropertyAssignment>target).objectAssignmentInitializer, sourceMapNode);
|
||||
}
|
||||
target = (<ShorthandPropertyAssignment>target).name;
|
||||
}
|
||||
else if (target.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>target).operatorToken.kind === SyntaxKind.EqualsToken) {
|
||||
value = createDefaultValueCheck(value, (<BinaryExpression>target).right);
|
||||
value = createDefaultValueCheck(value, (<BinaryExpression>target).right, sourceMapNode);
|
||||
target = (<BinaryExpression>target).left;
|
||||
}
|
||||
if (target.kind === SyntaxKind.ObjectLiteralExpression) {
|
||||
emitObjectLiteralAssignment(<ObjectLiteralExpression>target, value);
|
||||
emitObjectLiteralAssignment(<ObjectLiteralExpression>target, value, sourceMapNode);
|
||||
}
|
||||
else if (target.kind === SyntaxKind.ArrayLiteralExpression) {
|
||||
emitArrayLiteralAssignment(<ArrayLiteralExpression>target, value);
|
||||
emitArrayLiteralAssignment(<ArrayLiteralExpression>target, value, sourceMapNode);
|
||||
}
|
||||
else {
|
||||
emitAssignment(<Identifier>target, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0);
|
||||
emitAssignment(<Identifier>target, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0, sourceMapNode);
|
||||
emitCount++;
|
||||
}
|
||||
}
|
||||
@@ -3933,14 +3979,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
emit(value);
|
||||
}
|
||||
else if (isAssignmentExpressionStatement) {
|
||||
emitDestructuringAssignment(target, value);
|
||||
// Source map node for root.left = root.right is root
|
||||
// but if root is synthetic, which could be in below case, use the target which is { a }
|
||||
// for ({a} of {a: string}) {
|
||||
// }
|
||||
emitDestructuringAssignment(target, value, nodeIsSynthesized(root) ? target : root);
|
||||
}
|
||||
else {
|
||||
if (root.parent.kind !== SyntaxKind.ParenthesizedExpression) {
|
||||
write("(");
|
||||
}
|
||||
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true);
|
||||
emitDestructuringAssignment(target, value);
|
||||
// Temporary assignment needed to emit root should highlight whole binary expression
|
||||
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ true, root);
|
||||
// Source map node for root.left = root.right is root
|
||||
emitDestructuringAssignment(target, value, root);
|
||||
write(", ");
|
||||
emit(value);
|
||||
if (root.parent.kind !== SyntaxKind.ParenthesizedExpression) {
|
||||
@@ -3950,9 +4002,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
function emitBindingElement(target: BindingElement | VariableDeclaration, value: Expression) {
|
||||
// Any temporary assignments needed to emit target = value should point to target
|
||||
if (target.initializer) {
|
||||
// Combine value and initializer
|
||||
value = value ? createDefaultValueCheck(value, target.initializer) : target.initializer;
|
||||
value = value ? createDefaultValueCheck(value, target.initializer, target) : target.initializer;
|
||||
}
|
||||
else if (!value) {
|
||||
// Use 'void 0' in absence of value and initializer
|
||||
@@ -3968,7 +4021,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
// to ensure value is evaluated exactly once. Additionally, if we have zero elements
|
||||
// we need to emit *something* to ensure that in case a 'var' keyword was already emitted,
|
||||
// so in that case, we'll intentionally create that temporary.
|
||||
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0);
|
||||
value = ensureIdentifier(value, /*reuseIdentifierExpressions*/ numElements !== 0, target);
|
||||
}
|
||||
|
||||
for (let i = 0; i < numElements; i++) {
|
||||
@@ -3990,7 +4043,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
else {
|
||||
emitAssignment(<Identifier>target.name, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0);
|
||||
emitAssignment(<Identifier>target.name, value, /*shouldEmitCommaBeforeAssignment*/ emitCount > 0, target);
|
||||
emitCount++;
|
||||
}
|
||||
}
|
||||
@@ -4453,6 +4506,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
write(" {");
|
||||
increaseIndent();
|
||||
writeLine();
|
||||
|
||||
if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.AsyncMethodWithSuperBinding) {
|
||||
writeLines(`
|
||||
const _super = (function (geti, seti) {
|
||||
const cache = Object.create(null);
|
||||
return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });
|
||||
})(name => super[name], (name, value) => super[name] = value);`);
|
||||
writeLine();
|
||||
}
|
||||
else if (resolver.getNodeCheckFlags(node) & NodeCheckFlags.AsyncMethodWithSuper) {
|
||||
write(`const _super = name => super[name];`);
|
||||
writeLine();
|
||||
}
|
||||
|
||||
write("return");
|
||||
}
|
||||
|
||||
@@ -4472,12 +4539,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
|
||||
// Emit the call to __awaiter.
|
||||
if (hasLexicalArguments) {
|
||||
write(", function* (_arguments)");
|
||||
}
|
||||
else {
|
||||
write(", function* ()");
|
||||
}
|
||||
write(", function* ()");
|
||||
|
||||
// Emit the signature and body for the inner generator function.
|
||||
emitFunctionBody(node);
|
||||
@@ -5150,7 +5212,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
// a lexical declaration such as a LexicalDeclaration or a ClassDeclaration.
|
||||
|
||||
if (isClassExpressionWithStaticProperties) {
|
||||
for (var property of staticProperties) {
|
||||
for (const property of staticProperties) {
|
||||
write(",");
|
||||
writeLine();
|
||||
emitPropertyDeclaration(node, property, /*receiver*/ tempVariable, /*isExpression*/ true);
|
||||
@@ -5697,7 +5759,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
const parameters = valueDeclaration.parameters;
|
||||
const parameterCount = parameters.length;
|
||||
if (parameterCount > 0) {
|
||||
for (var i = 0; i < parameterCount; i++) {
|
||||
for (let i = 0; i < parameterCount; i++) {
|
||||
if (i > 0) {
|
||||
write(", ");
|
||||
}
|
||||
@@ -6083,6 +6145,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (contains(externalImports, node)) {
|
||||
const isExportedImport = node.kind === SyntaxKind.ImportEqualsDeclaration && (node.flags & NodeFlags.Export) !== 0;
|
||||
const namespaceDeclaration = getNamespaceDeclarationNode(node);
|
||||
const varOrConst = (languageVersion <= ScriptTarget.ES5) ? "var " : "const ";
|
||||
|
||||
if (modulekind !== ModuleKind.AMD) {
|
||||
emitLeadingComments(node);
|
||||
@@ -6090,7 +6153,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
if (namespaceDeclaration && !isDefaultImport(node)) {
|
||||
// import x = require("foo")
|
||||
// import * as x from "foo"
|
||||
if (!isExportedImport) write("var ");
|
||||
if (!isExportedImport) {
|
||||
write(varOrConst);
|
||||
};
|
||||
emitModuleMemberName(namespaceDeclaration);
|
||||
write(" = ");
|
||||
}
|
||||
@@ -6102,7 +6167,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
// import d, { x, y } from "foo"
|
||||
const isNakedImport = SyntaxKind.ImportDeclaration && !(<ImportDeclaration>node).importClause;
|
||||
if (!isNakedImport) {
|
||||
write("var ");
|
||||
write(varOrConst);
|
||||
write(getGeneratedNameForNode(<ImportDeclaration>node));
|
||||
write(" = ");
|
||||
}
|
||||
@@ -6129,7 +6194,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
else if (namespaceDeclaration && isDefaultImport(node)) {
|
||||
// import d, * as x from "foo"
|
||||
write("var ");
|
||||
write(varOrConst);
|
||||
emitModuleMemberName(namespaceDeclaration);
|
||||
write(" = ");
|
||||
write(getGeneratedNameForNode(<ImportDeclaration>node));
|
||||
@@ -7332,12 +7397,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
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)) {
|
||||
if ((languageVersion < ScriptTarget.ES6) && (!extendsEmitted && node.flags & NodeFlags.HasClassExtends)) {
|
||||
writeLines(extendsHelper);
|
||||
extendsEmitted = true;
|
||||
}
|
||||
|
||||
if (!decorateEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitDecorate) {
|
||||
if (!decorateEmitted && node.flags & NodeFlags.HasDecorators) {
|
||||
writeLines(decorateHelper);
|
||||
if (compilerOptions.emitDecoratorMetadata) {
|
||||
writeLines(metadataHelper);
|
||||
@@ -7345,12 +7410,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
decorateEmitted = true;
|
||||
}
|
||||
|
||||
if (!paramEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitParam) {
|
||||
if (!paramEmitted && node.flags & NodeFlags.HasParamDecorators) {
|
||||
writeLines(paramHelper);
|
||||
paramEmitted = true;
|
||||
}
|
||||
|
||||
if (!awaiterEmitted && resolver.getNodeCheckFlags(node) & NodeCheckFlags.EmitAwaiter) {
|
||||
if (!awaiterEmitted && node.flags & NodeFlags.HasAsyncFunctions) {
|
||||
writeLines(awaiterHelper);
|
||||
awaiterEmitted = true;
|
||||
}
|
||||
@@ -7434,6 +7499,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
||||
}
|
||||
}
|
||||
|
||||
function changeSourceMapEmit(writer: SourceMapWriter) {
|
||||
sourceMap = writer;
|
||||
emitStart = writer.emitStart;
|
||||
emitEnd = writer.emitEnd;
|
||||
emitPos = writer.emitPos;
|
||||
setSourceFile = writer.setSourceFile;
|
||||
}
|
||||
|
||||
function withTemporaryNoSourceMap(callback: () => void) {
|
||||
const prevSourceMap = sourceMap;
|
||||
setSourceMapWriterEmit(getNullSourceMapWriter());
|
||||
callback();
|
||||
setSourceMapWriterEmit(prevSourceMap);
|
||||
}
|
||||
|
||||
function isSpecializedCommentHandling(node: Node): boolean {
|
||||
switch (node.kind) {
|
||||
// All of these entities are emitted in a specialized fashion. As such, we allow
|
||||
|
||||
+190
-167
@@ -546,7 +546,7 @@ namespace ts {
|
||||
|
||||
function getLanguageVariant(fileName: string) {
|
||||
// .tsx and .jsx files are treated as jsx language variant.
|
||||
return fileExtensionIs(fileName, ".tsx") || fileExtensionIs(fileName, ".jsx") ? LanguageVariant.JSX : LanguageVariant.Standard;
|
||||
return fileExtensionIs(fileName, ".tsx") || fileExtensionIs(fileName, ".jsx") || fileExtensionIs(fileName, ".js") ? LanguageVariant.JSX : LanguageVariant.Standard;
|
||||
}
|
||||
|
||||
function initializeState(fileName: string, _sourceText: string, languageVersion: ScriptTarget, isJavaScriptFile: boolean, _syntaxCursor: IncrementalParser.SyntaxCursor) {
|
||||
@@ -611,44 +611,24 @@ namespace ts {
|
||||
fixupParentReferences(sourceFile);
|
||||
}
|
||||
|
||||
// If this is a javascript file, proactively see if we can get JSDoc comments for
|
||||
// relevant nodes in the file. We'll use these to provide typing informaion if they're
|
||||
// available.
|
||||
if (isSourceFileJavaScript(sourceFile)) {
|
||||
addJSDocComments();
|
||||
}
|
||||
|
||||
return sourceFile;
|
||||
}
|
||||
|
||||
function addJSDocComments() {
|
||||
forEachChild(sourceFile, visit);
|
||||
return;
|
||||
|
||||
function visit(node: Node) {
|
||||
// Add additional cases as necessary depending on how we see JSDoc comments used
|
||||
// in the wild.
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.VariableStatement:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.Parameter:
|
||||
addJSDocComment(node);
|
||||
}
|
||||
|
||||
forEachChild(node, visit);
|
||||
}
|
||||
}
|
||||
|
||||
function addJSDocComment(node: Node) {
|
||||
const comments = getLeadingCommentRangesOfNode(node, sourceFile);
|
||||
if (comments) {
|
||||
for (const comment of comments) {
|
||||
const jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos);
|
||||
if (jsDocComment) {
|
||||
node.jsDocComment = jsDocComment;
|
||||
function addJSDocComment<T extends Node>(node: T): T {
|
||||
if (contextFlags & ParserContextFlags.JavaScriptFile) {
|
||||
const comments = getLeadingCommentRangesOfNode(node, sourceFile);
|
||||
if (comments) {
|
||||
for (const comment of comments) {
|
||||
const jsDocComment = JSDocParser.parseJSDocComment(node, comment.pos, comment.end - comment.pos);
|
||||
if (jsDocComment) {
|
||||
node.jsDocComment = jsDocComment;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
export function fixupParentReferences(sourceFile: Node) {
|
||||
@@ -896,17 +876,19 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Invokes the provided callback then unconditionally restores the parser to the state it
|
||||
// was in immediately prior to invoking the callback. The result of invoking the callback
|
||||
// is returned from this function.
|
||||
/** Invokes the provided callback then unconditionally restores the parser to the state it
|
||||
* was in immediately prior to invoking the callback. The result of invoking the callback
|
||||
* is returned from this function.
|
||||
*/
|
||||
function lookAhead<T>(callback: () => T): T {
|
||||
return speculationHelper(callback, /*isLookAhead*/ true);
|
||||
}
|
||||
|
||||
// Invokes the provided callback. If the callback returns something falsy, then it restores
|
||||
// the parser to the state it was in immediately prior to invoking the callback. If the
|
||||
// callback returns something truthy, then the parser state is not rolled back. The result
|
||||
// of invoking the callback is returned from this function.
|
||||
/** Invokes the provided callback. If the callback returns something falsy, then it restores
|
||||
* the parser to the state it was in immediately prior to invoking the callback. If the
|
||||
* callback returns something truthy, then the parser state is not rolled back. The result
|
||||
* of invoking the callback is returned from this function.
|
||||
*/
|
||||
function tryParse<T>(callback: () => T): T {
|
||||
return speculationHelper(callback, /*isLookAhead*/ false);
|
||||
}
|
||||
@@ -1948,11 +1930,8 @@ namespace ts {
|
||||
|
||||
// TYPES
|
||||
|
||||
function parseTypeReferenceOrTypePredicate(): TypeReferenceNode | TypePredicateNode {
|
||||
function parseTypeReference(): TypeReferenceNode {
|
||||
const typeName = parseEntityName(/*allowReservedWords*/ false, Diagnostics.Type_expected);
|
||||
if (typeName.kind === SyntaxKind.Identifier && token === SyntaxKind.IsKeyword && !scanner.hasPrecedingLineBreak()) {
|
||||
return parseTypePredicate(typeName as Identifier);
|
||||
}
|
||||
const node = <TypeReferenceNode>createNode(SyntaxKind.TypeReference, typeName.pos);
|
||||
node.typeName = typeName;
|
||||
if (!scanner.hasPrecedingLineBreak() && token === SyntaxKind.LessThanToken) {
|
||||
@@ -2068,7 +2047,8 @@ namespace ts {
|
||||
// contexts. In addition, parameter initializers are semantically disallowed in
|
||||
// overload signatures. So parameter initializers are transitively disallowed in
|
||||
// ambient contexts.
|
||||
return finishNode(node);
|
||||
|
||||
return addJSDocComment(finishNode(node));
|
||||
}
|
||||
|
||||
function parseBindingElementInitializer(inParameter: boolean) {
|
||||
@@ -2092,10 +2072,10 @@ namespace ts {
|
||||
|
||||
if (returnTokenRequired) {
|
||||
parseExpected(returnToken);
|
||||
signature.type = parseType();
|
||||
signature.type = parseTypeOrTypePredicate();
|
||||
}
|
||||
else if (parseOptional(returnToken)) {
|
||||
signature.type = parseType();
|
||||
signature.type = parseTypeOrTypePredicate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2411,7 +2391,7 @@ namespace ts {
|
||||
case SyntaxKind.SymbolKeyword:
|
||||
// If these are followed by a dot, then parse these out as a dotted type reference instead.
|
||||
const node = tryParse(parseKeywordAndNoDot);
|
||||
return node || parseTypeReferenceOrTypePredicate();
|
||||
return node || parseTypeReference();
|
||||
case SyntaxKind.StringLiteral:
|
||||
return parseStringLiteralTypeNode();
|
||||
case SyntaxKind.VoidKeyword:
|
||||
@@ -2434,7 +2414,7 @@ namespace ts {
|
||||
case SyntaxKind.OpenParenToken:
|
||||
return parseParenthesizedType();
|
||||
default:
|
||||
return parseTypeReferenceOrTypePredicate();
|
||||
return parseTypeReference();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2541,6 +2521,28 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
function parseTypeOrTypePredicate(): TypeNode {
|
||||
const typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix);
|
||||
const type = parseType();
|
||||
if (typePredicateVariable) {
|
||||
const node = <TypePredicateNode>createNode(SyntaxKind.TypePredicate, typePredicateVariable.pos);
|
||||
node.parameterName = typePredicateVariable;
|
||||
node.type = type;
|
||||
return finishNode(node);
|
||||
}
|
||||
else {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
function parseTypePredicatePrefix() {
|
||||
const id = parseIdentifier();
|
||||
if (token === SyntaxKind.IsKeyword && !scanner.hasPrecedingLineBreak()) {
|
||||
nextToken();
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
function parseType(): TypeNode {
|
||||
// The rules about 'yield' only apply to actual code/expression contexts. They don't
|
||||
// apply to 'type' contexts. So we disable these parameters here before moving on.
|
||||
@@ -4409,6 +4411,9 @@ namespace ts {
|
||||
}
|
||||
continue;
|
||||
|
||||
case SyntaxKind.GlobalKeyword:
|
||||
return nextToken() === SyntaxKind.OpenBraceToken;
|
||||
|
||||
case SyntaxKind.ImportKeyword:
|
||||
nextToken();
|
||||
return token === SyntaxKind.StringLiteral || token === SyntaxKind.AsteriskToken ||
|
||||
@@ -4473,6 +4478,7 @@ namespace ts {
|
||||
case SyntaxKind.ModuleKeyword:
|
||||
case SyntaxKind.NamespaceKeyword:
|
||||
case SyntaxKind.TypeKeyword:
|
||||
case SyntaxKind.GlobalKeyword:
|
||||
// When these don't start a declaration, they're an identifier in an expression statement
|
||||
return true;
|
||||
|
||||
@@ -4561,6 +4567,7 @@ namespace ts {
|
||||
case SyntaxKind.PublicKeyword:
|
||||
case SyntaxKind.AbstractKeyword:
|
||||
case SyntaxKind.StaticKeyword:
|
||||
case SyntaxKind.GlobalKeyword:
|
||||
if (isStartOfDeclaration()) {
|
||||
return parseDeclaration();
|
||||
}
|
||||
@@ -4588,6 +4595,7 @@ namespace ts {
|
||||
return parseTypeAliasDeclaration(fullStart, decorators, modifiers);
|
||||
case SyntaxKind.EnumKeyword:
|
||||
return parseEnumDeclaration(fullStart, decorators, modifiers);
|
||||
case SyntaxKind.GlobalKeyword:
|
||||
case SyntaxKind.ModuleKeyword:
|
||||
case SyntaxKind.NamespaceKeyword:
|
||||
return parseModuleDeclaration(fullStart, decorators, modifiers);
|
||||
@@ -4746,7 +4754,7 @@ namespace ts {
|
||||
setModifiers(node, modifiers);
|
||||
node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false);
|
||||
parseSemicolon();
|
||||
return finishNode(node);
|
||||
return addJSDocComment(finishNode(node));
|
||||
}
|
||||
|
||||
function parseFunctionDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): FunctionDeclaration {
|
||||
@@ -4760,7 +4768,7 @@ namespace ts {
|
||||
const isAsync = !!(node.flags & NodeFlags.Async);
|
||||
fillSignature(SyntaxKind.ColonToken, /*yieldContext*/ isGenerator, /*awaitContext*/ isAsync, /*requireCompleteParameterList*/ false, node);
|
||||
node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, Diagnostics.or_expected);
|
||||
return finishNode(node);
|
||||
return addJSDocComment(finishNode(node));
|
||||
}
|
||||
|
||||
function parseConstructorDeclaration(pos: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ConstructorDeclaration {
|
||||
@@ -5222,14 +5230,25 @@ namespace ts {
|
||||
const node = <ModuleDeclaration>createNode(SyntaxKind.ModuleDeclaration, fullStart);
|
||||
node.decorators = decorators;
|
||||
setModifiers(node, modifiers);
|
||||
node.name = parseLiteralNode(/*internName*/ true);
|
||||
if (token === SyntaxKind.GlobalKeyword) {
|
||||
// parse 'global' as name of global scope augmentation
|
||||
node.name = parseIdentifier();
|
||||
node.flags |= NodeFlags.GlobalAugmentation;
|
||||
}
|
||||
else {
|
||||
node.name = parseLiteralNode(/*internName*/ true);
|
||||
}
|
||||
node.body = parseModuleBlock();
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function parseModuleDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ModuleDeclaration {
|
||||
let flags = modifiers ? modifiers.flags : 0;
|
||||
if (parseOptional(SyntaxKind.NamespaceKeyword)) {
|
||||
if (token === SyntaxKind.GlobalKeyword) {
|
||||
// global augmentation
|
||||
return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers);
|
||||
}
|
||||
else if (parseOptional(SyntaxKind.NamespaceKeyword)) {
|
||||
flags |= NodeFlags.Namespace;
|
||||
}
|
||||
else {
|
||||
@@ -5586,23 +5605,19 @@ namespace ts {
|
||||
|
||||
export function parseJSDocTypeExpressionForTests(content: string, start: number, length: number) {
|
||||
initializeState("file.js", content, ScriptTarget.Latest, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined);
|
||||
const jsDocTypeExpression = parseJSDocTypeExpression(start, length);
|
||||
scanner.setText(content, start, length);
|
||||
token = scanner.scan();
|
||||
const jsDocTypeExpression = parseJSDocTypeExpression();
|
||||
const diagnostics = parseDiagnostics;
|
||||
clearState();
|
||||
|
||||
return jsDocTypeExpression ? { jsDocTypeExpression, diagnostics } : undefined;
|
||||
}
|
||||
|
||||
// Parses out a JSDoc type expression. The starting position should be right at the open
|
||||
// curly in the type expression. Returns 'undefined' if it encounters any errors while parsing.
|
||||
// Parses out a JSDoc type expression.
|
||||
/* @internal */
|
||||
export function parseJSDocTypeExpression(start: number, length: number): JSDocTypeExpression {
|
||||
scanner.setText(sourceText, start, length);
|
||||
|
||||
// Prime the first token for us to start processing.
|
||||
token = nextToken();
|
||||
|
||||
const result = <JSDocTypeExpression>createNode(SyntaxKind.JSDocTypeExpression);
|
||||
export function parseJSDocTypeExpression(): JSDocTypeExpression {
|
||||
const result = <JSDocTypeExpression>createNode(SyntaxKind.JSDocTypeExpression, scanner.getTokenPos());
|
||||
|
||||
parseExpected(SyntaxKind.OpenBraceToken);
|
||||
result.type = parseJSDocTopLevelType();
|
||||
@@ -5900,7 +5915,8 @@ namespace ts {
|
||||
|
||||
export function parseIsolatedJSDocComment(content: string, start: number, length: number) {
|
||||
initializeState("file.js", content, ScriptTarget.Latest, /*isJavaScriptFile*/ true, /*_syntaxCursor:*/ undefined);
|
||||
const jsDocComment = parseJSDocComment(/*parent:*/ undefined, start, length);
|
||||
sourceFile = <SourceFile>{ languageVariant: LanguageVariant.Standard, text: content };
|
||||
const jsDocComment = parseJSDocCommentWorker(start, length);
|
||||
const diagnostics = parseDiagnostics;
|
||||
clearState();
|
||||
|
||||
@@ -5908,12 +5924,19 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function parseJSDocComment(parent: Node, start: number, length: number): JSDocComment {
|
||||
const saveToken = token;
|
||||
const saveParseDiagnosticsLength = parseDiagnostics.length;
|
||||
const saveParseErrorBeforeNextFinishedNode = parseErrorBeforeNextFinishedNode;
|
||||
|
||||
const comment = parseJSDocCommentWorker(start, length);
|
||||
if (comment) {
|
||||
fixupParentReferences(comment);
|
||||
comment.parent = parent;
|
||||
}
|
||||
|
||||
token = saveToken;
|
||||
parseDiagnostics.length = saveParseDiagnosticsLength;
|
||||
parseErrorBeforeNextFinishedNode = saveParseErrorBeforeNextFinishedNode;
|
||||
|
||||
return comment;
|
||||
}
|
||||
|
||||
@@ -5928,69 +5951,69 @@ namespace ts {
|
||||
Debug.assert(end <= content.length);
|
||||
|
||||
let tags: NodeArray<JSDocTag>;
|
||||
let pos: number;
|
||||
|
||||
// NOTE(cyrusn): This is essentially a handwritten scanner for JSDocComments. I
|
||||
// considered using an actual Scanner, but this would complicate things. The
|
||||
// scanner would need to know it was in a Doc Comment. Otherwise, it would then
|
||||
// produce comments *inside* the doc comment. In the end it was just easier to
|
||||
// write a simple scanner rather than go that route.
|
||||
if (length >= "/** */".length) {
|
||||
if (content.charCodeAt(start) === CharacterCodes.slash &&
|
||||
content.charCodeAt(start + 1) === CharacterCodes.asterisk &&
|
||||
content.charCodeAt(start + 2) === CharacterCodes.asterisk &&
|
||||
content.charCodeAt(start + 3) !== CharacterCodes.asterisk) {
|
||||
let result: JSDocComment;
|
||||
|
||||
// Check for /** (JSDoc opening part)
|
||||
if (content.charCodeAt(start) === CharacterCodes.slash &&
|
||||
content.charCodeAt(start + 1) === CharacterCodes.asterisk &&
|
||||
content.charCodeAt(start + 2) === CharacterCodes.asterisk &&
|
||||
content.charCodeAt(start + 3) !== CharacterCodes.asterisk) {
|
||||
|
||||
|
||||
// + 3 for leading /**, - 5 in total for /** */
|
||||
scanner.scanRange(start + 3, length - 5, () => {
|
||||
// Initially we can parse out a tag. We also have seen a starting asterisk.
|
||||
// This is so that /** * @type */ doesn't parse.
|
||||
let canParseTag = true;
|
||||
let seenAsterisk = true;
|
||||
|
||||
for (pos = start + "/**".length; pos < end; ) {
|
||||
const ch = content.charCodeAt(pos);
|
||||
pos++;
|
||||
nextJSDocToken();
|
||||
while (token !== SyntaxKind.EndOfFileToken) {
|
||||
switch (token) {
|
||||
case SyntaxKind.AtToken:
|
||||
if (canParseTag) {
|
||||
parseTag();
|
||||
}
|
||||
// This will take us to the end of the line, so it's OK to parse a tag on the next pass through the loop
|
||||
seenAsterisk = false;
|
||||
break;
|
||||
|
||||
if (ch === CharacterCodes.at && canParseTag) {
|
||||
parseTag();
|
||||
case SyntaxKind.NewLineTrivia:
|
||||
// After a line break, we can parse a tag, and we haven't seen an asterisk on the next line yet
|
||||
canParseTag = true;
|
||||
seenAsterisk = false;
|
||||
break;
|
||||
|
||||
// Once we parse out a tag, we cannot keep parsing out tags on this line.
|
||||
canParseTag = false;
|
||||
continue;
|
||||
}
|
||||
case SyntaxKind.AsteriskToken:
|
||||
if (seenAsterisk) {
|
||||
// If we've already seen an asterisk, then we can no longer parse a tag on this line
|
||||
canParseTag = false;
|
||||
}
|
||||
// Ignore the first asterisk on a line
|
||||
seenAsterisk = true;
|
||||
break;
|
||||
|
||||
if (isLineBreak(ch)) {
|
||||
// After a line break, we can parse a tag, and we haven't seen as asterisk
|
||||
// on the next line yet.
|
||||
canParseTag = true;
|
||||
seenAsterisk = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isWhiteSpace(ch)) {
|
||||
// Whitespace doesn't affect any of our parsing.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore the first asterisk on a line.
|
||||
if (ch === CharacterCodes.asterisk) {
|
||||
if (seenAsterisk) {
|
||||
// If we've already seen an asterisk, then we can no longer parse a tag
|
||||
// on this line.
|
||||
case SyntaxKind.Identifier:
|
||||
// Anything else is doc comment text. We can't do anything with it. Because it
|
||||
// wasn't a tag, we can no longer parse a tag on this line until we hit the next
|
||||
// line break.
|
||||
canParseTag = false;
|
||||
}
|
||||
seenAsterisk = true;
|
||||
continue;
|
||||
break;
|
||||
|
||||
case SyntaxKind.EndOfFileToken:
|
||||
break;
|
||||
}
|
||||
|
||||
// Anything else is doc comment text. We can't do anything with it. Because it
|
||||
// wasn't a tag, we can no longer parse a tag on this line until we hit the next
|
||||
// line break.
|
||||
canParseTag = false;
|
||||
nextJSDocToken();
|
||||
}
|
||||
}
|
||||
|
||||
result = createJSDocComment();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
return createJSDocComment();
|
||||
return result;
|
||||
|
||||
function createJSDocComment(): JSDocComment {
|
||||
if (!tags) {
|
||||
@@ -6003,17 +6026,18 @@ namespace ts {
|
||||
}
|
||||
|
||||
function skipWhitespace(): void {
|
||||
while (pos < end && isWhiteSpace(content.charCodeAt(pos))) {
|
||||
pos++;
|
||||
while (token === SyntaxKind.WhitespaceTrivia || token === SyntaxKind.NewLineTrivia) {
|
||||
nextJSDocToken();
|
||||
}
|
||||
}
|
||||
|
||||
function parseTag(): void {
|
||||
Debug.assert(content.charCodeAt(pos - 1) === CharacterCodes.at);
|
||||
const atToken = createNode(SyntaxKind.AtToken, pos - 1);
|
||||
atToken.end = pos;
|
||||
Debug.assert(token === SyntaxKind.AtToken);
|
||||
const atToken = createNode(SyntaxKind.AtToken, scanner.getTokenPos());
|
||||
atToken.end = scanner.getTextPos();
|
||||
nextJSDocToken();
|
||||
|
||||
const tagName = scanIdentifier();
|
||||
const tagName = parseJSDocIdentifier();
|
||||
if (!tagName) {
|
||||
return;
|
||||
}
|
||||
@@ -6044,7 +6068,7 @@ namespace ts {
|
||||
const result = <JSDocTag>createNode(SyntaxKind.JSDocTag, atToken.pos);
|
||||
result.atToken = atToken;
|
||||
result.tagName = tagName;
|
||||
return finishNode(result, pos);
|
||||
return finishNode(result);
|
||||
}
|
||||
|
||||
function addTag(tag: JSDocTag): void {
|
||||
@@ -6060,14 +6084,11 @@ namespace ts {
|
||||
}
|
||||
|
||||
function tryParseTypeExpression(): JSDocTypeExpression {
|
||||
skipWhitespace();
|
||||
|
||||
if (content.charCodeAt(pos) !== CharacterCodes.openBrace) {
|
||||
if (token !== SyntaxKind.OpenBraceToken) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const typeExpression = parseJSDocTypeExpression(pos, end - pos);
|
||||
pos = typeExpression.end;
|
||||
const typeExpression = parseJSDocTypeExpression();
|
||||
return typeExpression;
|
||||
}
|
||||
|
||||
@@ -6077,18 +6098,25 @@ namespace ts {
|
||||
skipWhitespace();
|
||||
let name: Identifier;
|
||||
let isBracketed: boolean;
|
||||
if (content.charCodeAt(pos) === CharacterCodes.openBracket) {
|
||||
pos++;
|
||||
skipWhitespace();
|
||||
name = scanIdentifier();
|
||||
// Looking for something like '[foo]' or 'foo'
|
||||
if (parseOptionalToken(SyntaxKind.OpenBracketToken)) {
|
||||
name = parseJSDocIdentifier();
|
||||
isBracketed = true;
|
||||
|
||||
// May have an optional default, e.g. '[foo = 42]'
|
||||
if (parseOptionalToken(SyntaxKind.EqualsToken)) {
|
||||
parseExpression();
|
||||
}
|
||||
|
||||
parseExpected(SyntaxKind.CloseBracketToken);
|
||||
}
|
||||
else {
|
||||
name = scanIdentifier();
|
||||
else if (token === SyntaxKind.Identifier) {
|
||||
name = parseJSDocIdentifier();
|
||||
}
|
||||
|
||||
if (!name) {
|
||||
parseErrorAtPosition(pos, 0, Diagnostics.Identifier_expected);
|
||||
parseErrorAtPosition(scanner.getStartPos(), 0, Diagnostics.Identifier_expected);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let preName: Identifier, postName: Identifier;
|
||||
@@ -6110,95 +6138,90 @@ namespace ts {
|
||||
result.typeExpression = typeExpression;
|
||||
result.postParameterName = postName;
|
||||
result.isBracketed = isBracketed;
|
||||
return finishNode(result, pos);
|
||||
return finishNode(result);
|
||||
}
|
||||
|
||||
function handleReturnTag(atToken: Node, tagName: Identifier): JSDocReturnTag {
|
||||
if (forEach(tags, t => t.kind === SyntaxKind.JSDocReturnTag)) {
|
||||
parseErrorAtPosition(tagName.pos, pos - tagName.pos, Diagnostics._0_tag_already_specified, tagName.text);
|
||||
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, Diagnostics._0_tag_already_specified, tagName.text);
|
||||
}
|
||||
|
||||
const result = <JSDocReturnTag>createNode(SyntaxKind.JSDocReturnTag, atToken.pos);
|
||||
result.atToken = atToken;
|
||||
result.tagName = tagName;
|
||||
result.typeExpression = tryParseTypeExpression();
|
||||
return finishNode(result, pos);
|
||||
return finishNode(result);
|
||||
}
|
||||
|
||||
function handleTypeTag(atToken: Node, tagName: Identifier): JSDocTypeTag {
|
||||
if (forEach(tags, t => t.kind === SyntaxKind.JSDocTypeTag)) {
|
||||
parseErrorAtPosition(tagName.pos, pos - tagName.pos, Diagnostics._0_tag_already_specified, tagName.text);
|
||||
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, Diagnostics._0_tag_already_specified, tagName.text);
|
||||
}
|
||||
|
||||
const result = <JSDocTypeTag>createNode(SyntaxKind.JSDocTypeTag, atToken.pos);
|
||||
result.atToken = atToken;
|
||||
result.tagName = tagName;
|
||||
result.typeExpression = tryParseTypeExpression();
|
||||
return finishNode(result, pos);
|
||||
return finishNode(result);
|
||||
}
|
||||
|
||||
function handleTemplateTag(atToken: Node, tagName: Identifier): JSDocTemplateTag {
|
||||
if (forEach(tags, t => t.kind === SyntaxKind.JSDocTemplateTag)) {
|
||||
parseErrorAtPosition(tagName.pos, pos - tagName.pos, Diagnostics._0_tag_already_specified, tagName.text);
|
||||
parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, Diagnostics._0_tag_already_specified, tagName.text);
|
||||
}
|
||||
|
||||
// Type parameter list looks like '@template T,U,V'
|
||||
const typeParameters = <NodeArray<TypeParameterDeclaration>>[];
|
||||
typeParameters.pos = pos;
|
||||
typeParameters.pos = scanner.getStartPos();
|
||||
|
||||
while (true) {
|
||||
skipWhitespace();
|
||||
|
||||
const startPos = pos;
|
||||
const name = scanIdentifier();
|
||||
const name = parseJSDocIdentifier();
|
||||
if (!name) {
|
||||
parseErrorAtPosition(startPos, 0, Diagnostics.Identifier_expected);
|
||||
parseErrorAtPosition(scanner.getStartPos(), 0, Diagnostics.Identifier_expected);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const typeParameter = <TypeParameterDeclaration>createNode(SyntaxKind.TypeParameter, name.pos);
|
||||
typeParameter.name = name;
|
||||
finishNode(typeParameter, pos);
|
||||
finishNode(typeParameter);
|
||||
|
||||
typeParameters.push(typeParameter);
|
||||
|
||||
skipWhitespace();
|
||||
if (content.charCodeAt(pos) !== CharacterCodes.comma) {
|
||||
if (token === SyntaxKind.CommaToken) {
|
||||
nextJSDocToken();
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
|
||||
pos++;
|
||||
}
|
||||
|
||||
typeParameters.end = pos;
|
||||
|
||||
const result = <JSDocTemplateTag>createNode(SyntaxKind.JSDocTemplateTag, atToken.pos);
|
||||
result.atToken = atToken;
|
||||
result.tagName = tagName;
|
||||
result.typeParameters = typeParameters;
|
||||
return finishNode(result, pos);
|
||||
finishNode(result);
|
||||
typeParameters.end = result.end;
|
||||
return result;
|
||||
}
|
||||
|
||||
function scanIdentifier(): Identifier {
|
||||
const startPos = pos;
|
||||
for (; pos < end; pos++) {
|
||||
const ch = content.charCodeAt(pos);
|
||||
if (pos === startPos && isIdentifierStart(ch, ScriptTarget.Latest)) {
|
||||
continue;
|
||||
}
|
||||
else if (pos > startPos && isIdentifierPart(ch, ScriptTarget.Latest)) {
|
||||
continue;
|
||||
}
|
||||
function nextJSDocToken(): SyntaxKind {
|
||||
return token = scanner.scanJSDocToken();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (startPos === pos) {
|
||||
function parseJSDocIdentifier(): Identifier {
|
||||
if (token !== SyntaxKind.Identifier) {
|
||||
parseErrorAtCurrentToken(Diagnostics.Identifier_expected);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const result = <Identifier>createNode(SyntaxKind.Identifier, startPos);
|
||||
result.text = content.substring(startPos, pos);
|
||||
return finishNode(result, pos);
|
||||
const pos = scanner.getTokenPos();
|
||||
const end = scanner.getTextPos();
|
||||
const result = <Identifier>createNode(SyntaxKind.Identifier, pos);
|
||||
result.text = content.substring(pos, end);
|
||||
finishNode(result, end);
|
||||
|
||||
nextJSDocToken();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+96
-47
@@ -12,7 +12,7 @@ namespace ts {
|
||||
|
||||
const emptyArray: any[] = [];
|
||||
|
||||
export const version = "1.8.0";
|
||||
export const version = "1.9.0";
|
||||
|
||||
export function findConfigFile(searchPath: string, fileExists: (fileName: string) => boolean): string {
|
||||
let fileName = "tsconfig.json";
|
||||
@@ -361,7 +361,24 @@ namespace ts {
|
||||
const currentDirectory = host.getCurrentDirectory();
|
||||
const resolveModuleNamesWorker = host.resolveModuleNames
|
||||
? ((moduleNames: string[], containingFile: string) => host.resolveModuleNames(moduleNames, containingFile))
|
||||
: ((moduleNames: string[], containingFile: string) => map(moduleNames, moduleName => resolveModuleName(moduleName, containingFile, options, host).resolvedModule));
|
||||
: ((moduleNames: string[], containingFile: string) => {
|
||||
const resolvedModuleNames: ResolvedModule[] = [];
|
||||
// resolveModuleName does not store any results between calls.
|
||||
// lookup is a local cache to avoid resolving the same module name several times
|
||||
const lookup: Map<ResolvedModule> = {};
|
||||
for (const moduleName of moduleNames) {
|
||||
let resolvedName: ResolvedModule;
|
||||
if (hasProperty(lookup, moduleName)) {
|
||||
resolvedName = lookup[moduleName];
|
||||
}
|
||||
else {
|
||||
resolvedName = resolveModuleName(moduleName, containingFile, options, host).resolvedModule;
|
||||
lookup[moduleName] = resolvedName;
|
||||
}
|
||||
resolvedModuleNames.push(resolvedName);
|
||||
}
|
||||
return resolvedModuleNames;
|
||||
});
|
||||
|
||||
const filesByName = createFileMap<SourceFile>();
|
||||
// stores 'filename -> file association' ignoring case
|
||||
@@ -498,15 +515,19 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check imports
|
||||
// check imports and module augmentations
|
||||
collectExternalModuleReferences(newSourceFile);
|
||||
if (!arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
|
||||
// imports has changed
|
||||
return false;
|
||||
}
|
||||
if (!arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
|
||||
// moduleAugmentations has changed
|
||||
return false;
|
||||
}
|
||||
|
||||
if (resolveModuleNamesWorker) {
|
||||
const moduleNames = map(newSourceFile.imports, name => name.text);
|
||||
const moduleNames = map(concatenate(newSourceFile.imports, newSourceFile.moduleAugmentations), getTextOfLiteral);
|
||||
const resolutions = resolveModuleNamesWorker(moduleNames, getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory));
|
||||
// ensure that module resolution results are still correct
|
||||
for (let i = 0; i < moduleNames.length; i++) {
|
||||
@@ -895,65 +916,85 @@ namespace ts {
|
||||
return a.text === b.text;
|
||||
}
|
||||
|
||||
function getTextOfLiteral(literal: LiteralExpression): string {
|
||||
return literal.text;
|
||||
}
|
||||
|
||||
function collectExternalModuleReferences(file: SourceFile): void {
|
||||
if (file.imports) {
|
||||
return;
|
||||
}
|
||||
|
||||
const isJavaScriptFile = isSourceFileJavaScript(file);
|
||||
const isExternalModuleFile = isExternalModule(file);
|
||||
|
||||
let imports: LiteralExpression[];
|
||||
let moduleAugmentations: LiteralExpression[];
|
||||
|
||||
for (const node of file.statements) {
|
||||
collect(node, /*allowRelativeModuleNames*/ true, /*collectOnlyRequireCalls*/ false);
|
||||
collectModuleReferences(node, /*inAmbientModule*/ false);
|
||||
if (isJavaScriptFile) {
|
||||
collectRequireCalls(node);
|
||||
}
|
||||
}
|
||||
|
||||
file.imports = imports || emptyArray;
|
||||
file.moduleAugmentations = moduleAugmentations || emptyArray;
|
||||
|
||||
return;
|
||||
|
||||
function collect(node: Node, allowRelativeModuleNames: boolean, collectOnlyRequireCalls: boolean): void {
|
||||
if (!collectOnlyRequireCalls) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
case SyntaxKind.ExportDeclaration:
|
||||
let moduleNameExpr = getExternalModuleName(node);
|
||||
if (!moduleNameExpr || moduleNameExpr.kind !== SyntaxKind.StringLiteral) {
|
||||
break;
|
||||
}
|
||||
if (!(<LiteralExpression>moduleNameExpr).text) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (allowRelativeModuleNames || !isExternalModuleNameRelative((<LiteralExpression>moduleNameExpr).text)) {
|
||||
(imports || (imports = [])).push(<LiteralExpression>moduleNameExpr);
|
||||
}
|
||||
function collectModuleReferences(node: Node, inAmbientModule: boolean): void {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
case SyntaxKind.ExportDeclaration:
|
||||
let moduleNameExpr = getExternalModuleName(node);
|
||||
if (!moduleNameExpr || moduleNameExpr.kind !== SyntaxKind.StringLiteral) {
|
||||
break;
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
if ((<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral && (node.flags & NodeFlags.Ambient || isDeclarationFile(file))) {
|
||||
// TypeScript 1.0 spec (April 2014): 12.1.6
|
||||
}
|
||||
if (!(<LiteralExpression>moduleNameExpr).text) {
|
||||
break;
|
||||
}
|
||||
|
||||
// TypeScript 1.0 spec (April 2014): 12.1.6
|
||||
// An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference other external modules
|
||||
// only through top - level external module names. Relative external module names are not permitted.
|
||||
if (!inAmbientModule || !isExternalModuleNameRelative((<LiteralExpression>moduleNameExpr).text)) {
|
||||
(imports || (imports = [])).push(<LiteralExpression>moduleNameExpr);
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
if (isAmbientModule(<ModuleDeclaration>node) && (inAmbientModule || node.flags & NodeFlags.Ambient || isDeclarationFile(file))) {
|
||||
const moduleName = <LiteralExpression>(<ModuleDeclaration>node).name;
|
||||
// Ambient module declarations can be interpreted as augmentations for some existing external modules.
|
||||
// This will happen in two cases:
|
||||
// - if current file is external module then module augmentation is a ambient module declaration defined in the top level scope
|
||||
// - if current file is not external module then module augmentation is an ambient module declaration with non-relative module name
|
||||
// immediately nested in top level ambient module declaration .
|
||||
if (isExternalModuleFile || (inAmbientModule && !isExternalModuleNameRelative(moduleName.text))) {
|
||||
(moduleAugmentations || (moduleAugmentations = [])).push(moduleName);
|
||||
}
|
||||
else if (!inAmbientModule) {
|
||||
// An AmbientExternalModuleDeclaration declares an external module.
|
||||
// This type of declaration is permitted only in the global module.
|
||||
// The StringLiteral must specify a top - level external module name.
|
||||
// Relative external module names are not permitted
|
||||
forEachChild((<ModuleDeclaration>node).body, node => {
|
||||
// TypeScript 1.0 spec (April 2014): 12.1.6
|
||||
// An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules
|
||||
// only through top - level external module names. Relative external module names are not permitted.
|
||||
collect(node, /*allowRelativeModuleNames*/ false, collectOnlyRequireCalls);
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isJavaScriptFile) {
|
||||
if (isRequireCall(node)) {
|
||||
(imports || (imports = [])).push(<StringLiteral>(<CallExpression>node).arguments[0]);
|
||||
}
|
||||
else {
|
||||
forEachChild(node, node => collect(node, allowRelativeModuleNames, /*collectOnlyRequireCalls*/ true));
|
||||
}
|
||||
// NOTE: body of ambient module is always a module block
|
||||
for (const statement of (<ModuleBlock>(<ModuleDeclaration>node).body).statements) {
|
||||
collectModuleReferences(statement, /*inAmbientModule*/ true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function collectRequireCalls(node: Node): void {
|
||||
if (isRequireCall(node)) {
|
||||
(imports || (imports = [])).push(<StringLiteral>(<CallExpression>node).arguments[0]);
|
||||
}
|
||||
else {
|
||||
forEachChild(node, collectRequireCalls);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1083,14 +1124,22 @@ namespace ts {
|
||||
|
||||
function processImportedModules(file: SourceFile, basePath: string) {
|
||||
collectExternalModuleReferences(file);
|
||||
if (file.imports.length) {
|
||||
if (file.imports.length || file.moduleAugmentations.length) {
|
||||
file.resolvedModules = {};
|
||||
const moduleNames = map(file.imports, name => name.text);
|
||||
const moduleNames = map(concatenate(file.imports, file.moduleAugmentations), getTextOfLiteral);
|
||||
const resolutions = resolveModuleNamesWorker(moduleNames, getNormalizedAbsolutePath(file.fileName, currentDirectory));
|
||||
for (let i = 0; i < file.imports.length; i++) {
|
||||
for (let i = 0; i < moduleNames.length; i++) {
|
||||
const resolution = resolutions[i];
|
||||
setResolvedModule(file, moduleNames[i], resolution);
|
||||
if (resolution && !options.noResolve) {
|
||||
// add file to program only if:
|
||||
// - resolution was successfull
|
||||
// - noResolve is falsy
|
||||
// - module name come from the list fo imports
|
||||
const shouldAddFile = resolution &&
|
||||
!options.noResolve &&
|
||||
i < file.imports.length;
|
||||
|
||||
if (shouldAddFile) {
|
||||
const importedFile = findSourceFile(resolution.resolvedFileName, toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /*isDefaultLib*/ false, file, skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
|
||||
|
||||
if (importedFile && resolution.isExternalLibraryImport) {
|
||||
@@ -1168,7 +1217,7 @@ namespace ts {
|
||||
if (sourceFiles) {
|
||||
const absoluteRootDirectoryPath = host.getCanonicalFileName(getNormalizedAbsolutePath(rootDirectory, currentDirectory));
|
||||
|
||||
for (var sourceFile of sourceFiles) {
|
||||
for (const sourceFile of sourceFiles) {
|
||||
if (!isDeclarationFile(sourceFile)) {
|
||||
const absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));
|
||||
if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace ts {
|
||||
scanJsxIdentifier(): SyntaxKind;
|
||||
reScanJsxToken(): SyntaxKind;
|
||||
scanJsxToken(): SyntaxKind;
|
||||
scanJSDocToken(): SyntaxKind;
|
||||
scan(): SyntaxKind;
|
||||
// Sets the text for the scanner to scan. An optional subrange starting point and length
|
||||
// can be provided to have the scanner only scan a portion of the text.
|
||||
@@ -42,6 +43,10 @@ namespace ts {
|
||||
// is returned from this function.
|
||||
lookAhead<T>(callback: () => T): T;
|
||||
|
||||
// Invokes the callback with the scanner set to scan the specified range. When the callback
|
||||
// returns, the scanner is restored to the state it was in before scanRange was called.
|
||||
scanRange<T>(start: number, length: number, callback: () => T): T;
|
||||
|
||||
// Invokes the provided callback. If the callback returns something falsy, then it restores
|
||||
// the scanner to the state it was in immediately prior to invoking the callback. If the
|
||||
// callback returns something truthy, then the scanner state is not rolled back. The result
|
||||
@@ -94,6 +99,7 @@ namespace ts {
|
||||
"protected": SyntaxKind.ProtectedKeyword,
|
||||
"public": SyntaxKind.PublicKeyword,
|
||||
"require": SyntaxKind.RequireKeyword,
|
||||
"global": SyntaxKind.GlobalKeyword,
|
||||
"return": SyntaxKind.ReturnKeyword,
|
||||
"set": SyntaxKind.SetKeyword,
|
||||
"static": SyntaxKind.StaticKeyword,
|
||||
@@ -749,6 +755,7 @@ namespace ts {
|
||||
scanJsxIdentifier,
|
||||
reScanJsxToken,
|
||||
scanJsxToken,
|
||||
scanJSDocToken,
|
||||
scan,
|
||||
setText,
|
||||
setScriptTarget,
|
||||
@@ -757,6 +764,7 @@ namespace ts {
|
||||
setTextPos,
|
||||
tryScan,
|
||||
lookAhead,
|
||||
scanRange,
|
||||
};
|
||||
|
||||
function error(message: DiagnosticMessage, length?: number): void {
|
||||
@@ -1664,6 +1672,60 @@ namespace ts {
|
||||
return token;
|
||||
}
|
||||
|
||||
function scanJSDocToken(): SyntaxKind {
|
||||
if (pos >= end) {
|
||||
return token = SyntaxKind.EndOfFileToken;
|
||||
}
|
||||
|
||||
startPos = pos;
|
||||
|
||||
// Eat leading whitespace
|
||||
let ch = text.charCodeAt(pos);
|
||||
while (pos < end) {
|
||||
ch = text.charCodeAt(pos);
|
||||
if (isWhiteSpace(ch)) {
|
||||
pos++;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
tokenPos = pos;
|
||||
|
||||
switch (ch) {
|
||||
case CharacterCodes.at:
|
||||
return pos += 1, token = SyntaxKind.AtToken;
|
||||
case CharacterCodes.lineFeed:
|
||||
case CharacterCodes.carriageReturn:
|
||||
return pos += 1, token = SyntaxKind.NewLineTrivia;
|
||||
case CharacterCodes.asterisk:
|
||||
return pos += 1, token = SyntaxKind.AsteriskToken;
|
||||
case CharacterCodes.openBrace:
|
||||
return pos += 1, token = SyntaxKind.OpenBraceToken;
|
||||
case CharacterCodes.closeBrace:
|
||||
return pos += 1, token = SyntaxKind.CloseBraceToken;
|
||||
case CharacterCodes.openBracket:
|
||||
return pos += 1, token = SyntaxKind.OpenBracketToken;
|
||||
case CharacterCodes.closeBracket:
|
||||
return pos += 1, token = SyntaxKind.CloseBracketToken;
|
||||
case CharacterCodes.equals:
|
||||
return pos += 1, token = SyntaxKind.EqualsToken;
|
||||
case CharacterCodes.comma:
|
||||
return pos += 1, token = SyntaxKind.CommaToken;
|
||||
}
|
||||
|
||||
if (isIdentifierStart(ch, ScriptTarget.Latest)) {
|
||||
pos++;
|
||||
while (isIdentifierPart(text.charCodeAt(pos), ScriptTarget.Latest) && pos < end) {
|
||||
pos++;
|
||||
}
|
||||
return token = SyntaxKind.Identifier;
|
||||
}
|
||||
else {
|
||||
return pos += 1, token = SyntaxKind.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
function speculationHelper<T>(callback: () => T, isLookahead: boolean): T {
|
||||
const savePos = pos;
|
||||
const saveStartPos = startPos;
|
||||
@@ -1686,6 +1748,33 @@ namespace ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function scanRange<T>(start: number, length: number, callback: () => T): T {
|
||||
const saveEnd = end;
|
||||
const savePos = pos;
|
||||
const saveStartPos = startPos;
|
||||
const saveTokenPos = tokenPos;
|
||||
const saveToken = token;
|
||||
const savePrecedingLineBreak = precedingLineBreak;
|
||||
const saveTokenValue = tokenValue;
|
||||
const saveHasExtendedUnicodeEscape = hasExtendedUnicodeEscape;
|
||||
const saveTokenIsUnterminated = tokenIsUnterminated;
|
||||
|
||||
setText(text, start, length);
|
||||
const result = callback();
|
||||
|
||||
end = saveEnd;
|
||||
pos = savePos;
|
||||
startPos = saveStartPos;
|
||||
tokenPos = saveTokenPos;
|
||||
token = saveToken;
|
||||
precedingLineBreak = savePrecedingLineBreak;
|
||||
tokenValue = saveTokenValue;
|
||||
hasExtendedUnicodeEscape = saveHasExtendedUnicodeEscape;
|
||||
tokenIsUnterminated = saveTokenIsUnterminated;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function lookAhead<T>(callback: () => T): T {
|
||||
return speculationHelper(callback, /*isLookahead*/ true);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@ namespace ts {
|
||||
setSourceFile(sourceFile: SourceFile): void;
|
||||
emitPos(pos: number): void;
|
||||
emitStart(range: TextRange): void;
|
||||
emitEnd(range: TextRange): void;
|
||||
emitEnd(range: TextRange, stopOverridingSpan?: boolean): void;
|
||||
changeEmitSourcePos(): void;
|
||||
getText(): string;
|
||||
getSourceMappingURL(): string;
|
||||
initialize(filePath: string, sourceMapFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean): void;
|
||||
@@ -22,8 +23,9 @@ namespace ts {
|
||||
getSourceMapData(): SourceMapData { return undefined; },
|
||||
setSourceFile(sourceFile: SourceFile): void { },
|
||||
emitStart(range: TextRange): void { },
|
||||
emitEnd(range: TextRange): void { },
|
||||
emitEnd(range: TextRange, stopOverridingSpan?: boolean): void { },
|
||||
emitPos(pos: number): void { },
|
||||
changeEmitSourcePos(): void { },
|
||||
getText(): string { return undefined; },
|
||||
getSourceMappingURL(): string { return undefined; },
|
||||
initialize(filePath: string, sourceMapFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean): void { },
|
||||
@@ -38,6 +40,8 @@ namespace ts {
|
||||
const compilerOptions = host.getCompilerOptions();
|
||||
let currentSourceFile: SourceFile;
|
||||
let sourceMapDir: string; // The directory in which sourcemap will be
|
||||
let stopOverridingSpan = false;
|
||||
let modifyLastSourcePos = false;
|
||||
|
||||
// Current source map file and its index in the sources list
|
||||
let sourceMapSourceIndex: number;
|
||||
@@ -56,6 +60,7 @@ namespace ts {
|
||||
emitPos,
|
||||
emitStart,
|
||||
emitEnd,
|
||||
changeEmitSourcePos,
|
||||
getText,
|
||||
getSourceMappingURL,
|
||||
initialize,
|
||||
@@ -142,6 +147,45 @@ namespace ts {
|
||||
sourceMapData = undefined;
|
||||
}
|
||||
|
||||
function updateLastEncodedAndRecordedSpans() {
|
||||
if (modifyLastSourcePos) {
|
||||
// Reset the source pos
|
||||
modifyLastSourcePos = false;
|
||||
|
||||
// Change Last recorded Map with last encoded emit line and character
|
||||
lastRecordedSourceMapSpan.emittedLine = lastEncodedSourceMapSpan.emittedLine;
|
||||
lastRecordedSourceMapSpan.emittedColumn = lastEncodedSourceMapSpan.emittedColumn;
|
||||
|
||||
// Pop sourceMapDecodedMappings to remove last entry
|
||||
sourceMapData.sourceMapDecodedMappings.pop();
|
||||
|
||||
// Change the last encoded source map
|
||||
lastEncodedSourceMapSpan = sourceMapData.sourceMapDecodedMappings.length ?
|
||||
sourceMapData.sourceMapDecodedMappings[sourceMapData.sourceMapDecodedMappings.length - 1] :
|
||||
undefined;
|
||||
|
||||
// TODO: Update lastEncodedNameIndex
|
||||
// Since we dont support this any more, lets not worry about it right now.
|
||||
// When we start supporting nameIndex, we will get back to this
|
||||
|
||||
// Change the encoded source map
|
||||
const sourceMapMappings = sourceMapData.sourceMapMappings;
|
||||
let lenthToSet = sourceMapMappings.length - 1;
|
||||
for (; lenthToSet >= 0; lenthToSet--) {
|
||||
const currentChar = sourceMapMappings.charAt(lenthToSet);
|
||||
if (currentChar === ",") {
|
||||
// Separator for the entry found
|
||||
break;
|
||||
}
|
||||
if (currentChar === ";" && lenthToSet !== 0 && sourceMapMappings.charAt(lenthToSet - 1) !== ";") {
|
||||
// Last line separator found
|
||||
break;
|
||||
}
|
||||
}
|
||||
sourceMapData.sourceMapMappings = sourceMapMappings.substr(0, Math.max(0, lenthToSet));
|
||||
}
|
||||
}
|
||||
|
||||
// Encoding for sourcemap span
|
||||
function encodeLastRecordedSourceMapSpan() {
|
||||
if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) {
|
||||
@@ -178,6 +222,7 @@ namespace ts {
|
||||
|
||||
// 5. Relative namePosition 0 based
|
||||
if (lastRecordedSourceMapSpan.nameIndex >= 0) {
|
||||
Debug.assert(false, "We do not support name index right now, Make sure to update updateLastEncodedAndRecordedSpans when we start using this");
|
||||
sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex);
|
||||
lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex;
|
||||
}
|
||||
@@ -219,22 +264,36 @@ namespace ts {
|
||||
sourceColumn: sourceLinePos.character,
|
||||
sourceIndex: sourceMapSourceIndex
|
||||
};
|
||||
|
||||
stopOverridingSpan = false;
|
||||
}
|
||||
else {
|
||||
else if (!stopOverridingSpan) {
|
||||
// Take the new pos instead since there is no change in emittedLine and column since last location
|
||||
lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line;
|
||||
lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character;
|
||||
lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex;
|
||||
}
|
||||
|
||||
updateLastEncodedAndRecordedSpans();
|
||||
}
|
||||
|
||||
function getStartPos(range: TextRange) {
|
||||
const rangeHasDecorators = !!(range as Node).decorators;
|
||||
return range.pos !== -1 ? skipTrivia(currentSourceFile.text, rangeHasDecorators ? (range as Node).decorators.end : range.pos) : -1;
|
||||
}
|
||||
|
||||
function emitStart(range: TextRange) {
|
||||
const rangeHasDecorators = !!(range as Node).decorators;
|
||||
emitPos(range.pos !== -1 ? skipTrivia(currentSourceFile.text, rangeHasDecorators ? (range as Node).decorators.end : range.pos) : -1);
|
||||
emitPos(getStartPos(range));
|
||||
}
|
||||
|
||||
function emitEnd(range: TextRange) {
|
||||
function emitEnd(range: TextRange, stopOverridingEnd?: boolean) {
|
||||
emitPos(range.end);
|
||||
stopOverridingSpan = stopOverridingEnd;
|
||||
}
|
||||
|
||||
function changeEmitSourcePos() {
|
||||
Debug.assert(!modifyLastSourcePos);
|
||||
modifyLastSourcePos = true;
|
||||
}
|
||||
|
||||
function setSourceFile(sourceFile: SourceFile) {
|
||||
|
||||
+127
-23
@@ -1,6 +1,9 @@
|
||||
/// <reference path="core.ts"/>
|
||||
|
||||
namespace ts {
|
||||
export type FileWatcherCallback = (path: string, removed?: boolean) => void;
|
||||
export type DirectoryWatcherCallback = (path: string) => void;
|
||||
|
||||
export interface System {
|
||||
args: string[];
|
||||
newLine: string;
|
||||
@@ -8,8 +11,8 @@ namespace ts {
|
||||
write(s: string): void;
|
||||
readFile(path: string, encoding?: string): string;
|
||||
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher;
|
||||
watchDirectory?(path: string, callback: (path: string) => void, recursive?: boolean): FileWatcher;
|
||||
watchFile?(path: Path, callback: FileWatcherCallback): FileWatcher;
|
||||
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
|
||||
resolvePath(path: string): string;
|
||||
fileExists(path: string): boolean;
|
||||
directoryExists(path: string): boolean;
|
||||
@@ -22,15 +25,20 @@ namespace ts {
|
||||
}
|
||||
|
||||
interface WatchedFile {
|
||||
fileName: string;
|
||||
callback: (fileName: string, removed?: boolean) => void;
|
||||
mtime: Date;
|
||||
filePath: Path;
|
||||
callback: FileWatcherCallback;
|
||||
mtime?: Date;
|
||||
}
|
||||
|
||||
export interface FileWatcher {
|
||||
close(): void;
|
||||
}
|
||||
|
||||
export interface DirectoryWatcher extends FileWatcher {
|
||||
directoryPath: Path;
|
||||
referenceCount: number;
|
||||
}
|
||||
|
||||
declare var require: any;
|
||||
declare var module: any;
|
||||
declare var process: any;
|
||||
@@ -62,8 +70,8 @@ namespace ts {
|
||||
readFile(path: string): string;
|
||||
writeFile(path: string, contents: string): void;
|
||||
readDirectory(path: string, extension?: string, exclude?: string[]): string[];
|
||||
watchFile?(path: string, callback: (path: string, removed?: boolean) => void): FileWatcher;
|
||||
watchDirectory?(path: string, callback: (path: string) => void, recursive?: boolean): FileWatcher;
|
||||
watchFile?(path: string, callback: FileWatcherCallback): FileWatcher;
|
||||
watchDirectory?(path: string, callback: DirectoryWatcherCallback, recursive?: boolean): FileWatcher;
|
||||
};
|
||||
|
||||
export var sys: System = (function () {
|
||||
@@ -221,7 +229,7 @@ namespace ts {
|
||||
|
||||
// average async stat takes about 30 microseconds
|
||||
// set chunk size to do 30 files in < 1 millisecond
|
||||
function createWatchedFileSet(interval = 2500, chunkSize = 30) {
|
||||
function createPollingWatchedFileSet(interval = 2500, chunkSize = 30) {
|
||||
let watchedFiles: WatchedFile[] = [];
|
||||
let nextFileToCheck = 0;
|
||||
let watchTimer: any;
|
||||
@@ -236,13 +244,13 @@ namespace ts {
|
||||
return;
|
||||
}
|
||||
|
||||
_fs.stat(watchedFile.fileName, (err: any, stats: any) => {
|
||||
_fs.stat(watchedFile.filePath, (err: any, stats: any) => {
|
||||
if (err) {
|
||||
watchedFile.callback(watchedFile.fileName);
|
||||
watchedFile.callback(watchedFile.filePath);
|
||||
}
|
||||
else if (watchedFile.mtime.getTime() !== stats.mtime.getTime()) {
|
||||
watchedFile.mtime = getModifiedTime(watchedFile.fileName);
|
||||
watchedFile.callback(watchedFile.fileName, watchedFile.mtime.getTime() === 0);
|
||||
watchedFile.mtime = getModifiedTime(watchedFile.filePath);
|
||||
watchedFile.callback(watchedFile.filePath, watchedFile.mtime.getTime() === 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -270,11 +278,11 @@ namespace ts {
|
||||
}, interval);
|
||||
}
|
||||
|
||||
function addFile(fileName: string, callback: (fileName: string, removed?: boolean) => void): WatchedFile {
|
||||
function addFile(filePath: Path, callback: FileWatcherCallback): WatchedFile {
|
||||
const file: WatchedFile = {
|
||||
fileName,
|
||||
filePath,
|
||||
callback,
|
||||
mtime: getModifiedTime(fileName)
|
||||
mtime: getModifiedTime(filePath)
|
||||
};
|
||||
|
||||
watchedFiles.push(file);
|
||||
@@ -297,6 +305,90 @@ namespace ts {
|
||||
};
|
||||
}
|
||||
|
||||
function createWatchedFileSet() {
|
||||
const dirWatchers = createFileMap<DirectoryWatcher>();
|
||||
// One file can have multiple watchers
|
||||
const fileWatcherCallbacks = createFileMap<FileWatcherCallback[]>();
|
||||
return { addFile, removeFile };
|
||||
|
||||
function reduceDirWatcherRefCountForFile(filePath: Path) {
|
||||
const dirPath = getDirectoryPath(filePath);
|
||||
if (dirWatchers.contains(dirPath)) {
|
||||
const watcher = dirWatchers.get(dirPath);
|
||||
watcher.referenceCount -= 1;
|
||||
if (watcher.referenceCount <= 0) {
|
||||
watcher.close();
|
||||
dirWatchers.remove(dirPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addDirWatcher(dirPath: Path): void {
|
||||
if (dirWatchers.contains(dirPath)) {
|
||||
const watcher = dirWatchers.get(dirPath);
|
||||
watcher.referenceCount += 1;
|
||||
return;
|
||||
}
|
||||
|
||||
const watcher: DirectoryWatcher = _fs.watch(
|
||||
dirPath,
|
||||
{ persistent: true },
|
||||
(eventName: string, relativeFileName: string) => fileEventHandler(eventName, relativeFileName, dirPath)
|
||||
);
|
||||
watcher.referenceCount = 1;
|
||||
dirWatchers.set(dirPath, watcher);
|
||||
return;
|
||||
}
|
||||
|
||||
function addFileWatcherCallback(filePath: Path, callback: FileWatcherCallback): void {
|
||||
if (fileWatcherCallbacks.contains(filePath)) {
|
||||
fileWatcherCallbacks.get(filePath).push(callback);
|
||||
}
|
||||
else {
|
||||
fileWatcherCallbacks.set(filePath, [callback]);
|
||||
}
|
||||
}
|
||||
|
||||
function addFile(filePath: Path, callback: FileWatcherCallback): WatchedFile {
|
||||
addFileWatcherCallback(filePath, callback);
|
||||
addDirWatcher(getDirectoryPath(filePath));
|
||||
|
||||
return { filePath, callback };
|
||||
}
|
||||
|
||||
function removeFile(watchedFile: WatchedFile) {
|
||||
removeFileWatcherCallback(watchedFile.filePath, watchedFile.callback);
|
||||
reduceDirWatcherRefCountForFile(watchedFile.filePath);
|
||||
}
|
||||
|
||||
function removeFileWatcherCallback(filePath: Path, callback: FileWatcherCallback) {
|
||||
if (fileWatcherCallbacks.contains(filePath)) {
|
||||
const newCallbacks = copyListRemovingItem(callback, fileWatcherCallbacks.get(filePath));
|
||||
if (newCallbacks.length === 0) {
|
||||
fileWatcherCallbacks.remove(filePath);
|
||||
}
|
||||
else {
|
||||
fileWatcherCallbacks.set(filePath, newCallbacks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param watcherPath is the path from which the watcher is triggered.
|
||||
*/
|
||||
function fileEventHandler(eventName: string, relativeFileName: string, baseDirPath: Path) {
|
||||
// When files are deleted from disk, the triggered "rename" event would have a relativefileName of "undefined"
|
||||
const filePath = typeof relativeFileName !== "string"
|
||||
? undefined
|
||||
: toPath(relativeFileName, baseDirPath, createGetCanonicalFileName(sys.useCaseSensitiveFileNames));
|
||||
if (eventName === "change" && fileWatcherCallbacks.contains(filePath)) {
|
||||
for (const fileCallback of fileWatcherCallbacks.get(filePath)) {
|
||||
fileCallback(filePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// REVIEW: for now this implementation uses polling.
|
||||
// The advantage of polling is that it works reliably
|
||||
// on all os and with network mounted files.
|
||||
@@ -310,8 +402,13 @@ namespace ts {
|
||||
// changes for large reference sets? If so, do we want
|
||||
// to increase the chunk size or decrease the interval
|
||||
// time dynamically to match the large reference set?
|
||||
const pollingWatchedFileSet = createPollingWatchedFileSet();
|
||||
const watchedFileSet = createWatchedFileSet();
|
||||
|
||||
function isNode4OrLater(): boolean {
|
||||
return parseInt(process.version.charAt(1)) >= 4;
|
||||
}
|
||||
|
||||
const platform: string = _os.platform();
|
||||
// win32\win64 are case insensitive platforms, MacOS (darwin) by default is also case insensitive
|
||||
const useCaseSensitiveFileNames = platform !== "win32" && platform !== "win64" && platform !== "darwin";
|
||||
@@ -365,7 +462,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function getCanonicalPath(path: string): string {
|
||||
return useCaseSensitiveFileNames ? path.toLowerCase() : path;
|
||||
return useCaseSensitiveFileNames ? path : path.toLowerCase();
|
||||
}
|
||||
|
||||
function readDirectory(path: string, extension?: string, exclude?: string[]): string[] {
|
||||
@@ -405,29 +502,38 @@ namespace ts {
|
||||
},
|
||||
readFile,
|
||||
writeFile,
|
||||
watchFile: (fileName, callback) => {
|
||||
watchFile: (filePath, callback) => {
|
||||
// Node 4.0 stablized the `fs.watch` function on Windows which avoids polling
|
||||
// and is more efficient than `fs.watchFile` (ref: https://github.com/nodejs/node/pull/2649
|
||||
// and https://github.com/Microsoft/TypeScript/issues/4643), therefore
|
||||
// if the current node.js version is newer than 4, use `fs.watch` instead.
|
||||
const watchedFile = watchedFileSet.addFile(fileName, callback);
|
||||
const watchSet = isNode4OrLater() ? watchedFileSet : pollingWatchedFileSet;
|
||||
const watchedFile = watchSet.addFile(filePath, callback);
|
||||
return {
|
||||
close: () => watchedFileSet.removeFile(watchedFile)
|
||||
close: () => watchSet.removeFile(watchedFile)
|
||||
};
|
||||
},
|
||||
watchDirectory: (path, callback, recursive) => {
|
||||
// Node 4.0 `fs.watch` function supports the "recursive" option on both OSX and Windows
|
||||
// (ref: https://github.com/nodejs/node/pull/2649 and https://github.com/Microsoft/TypeScript/issues/4643)
|
||||
let options: any;
|
||||
if (isNode4OrLater() && (process.platform === "win32" || process.platform === "darwin")) {
|
||||
options = { persistent: true, recursive: !!recursive };
|
||||
}
|
||||
else {
|
||||
options = { persistent: true };
|
||||
}
|
||||
|
||||
return _fs.watch(
|
||||
path,
|
||||
{ persistent: true, recursive: !!recursive },
|
||||
options,
|
||||
(eventName: string, relativeFileName: string) => {
|
||||
// In watchDirectory we only care about adding and removing files (when event name is
|
||||
// "rename"); changes made within files are handled by corresponding fileWatchers (when
|
||||
// event name is "change")
|
||||
if (eventName === "rename") {
|
||||
// When deleting a file, the passed baseFileName is null
|
||||
callback(!relativeFileName ? relativeFileName : normalizePath(ts.combinePaths(path, relativeFileName)));
|
||||
callback(!relativeFileName ? relativeFileName : normalizePath(combinePaths(path, relativeFileName)));
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -511,5 +617,3 @@ namespace ts {
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
|
||||
|
||||
+5
-3
@@ -334,12 +334,13 @@ namespace ts {
|
||||
return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped);
|
||||
}
|
||||
if (configFileName) {
|
||||
configFileWatcher = sys.watchFile(configFileName, configFileChanged);
|
||||
const configFilePath = toPath(configFileName, sys.getCurrentDirectory(), createGetCanonicalFileName(sys.useCaseSensitiveFileNames));
|
||||
configFileWatcher = sys.watchFile(configFilePath, configFileChanged);
|
||||
}
|
||||
if (sys.watchDirectory && configFileName) {
|
||||
const directory = ts.getDirectoryPath(configFileName);
|
||||
directoryWatcher = sys.watchDirectory(
|
||||
// When the configFileName is just "tsconfig.json", the watched directory should be
|
||||
// When the configFileName is just "tsconfig.json", the watched directory should be
|
||||
// the current direcotry; if there is a given "project" parameter, then the configFileName
|
||||
// is an absolute file name.
|
||||
directory == "" ? "." : directory,
|
||||
@@ -442,7 +443,8 @@ namespace ts {
|
||||
const sourceFile = hostGetSourceFile(fileName, languageVersion, onError);
|
||||
if (sourceFile && compilerOptions.watch) {
|
||||
// Attach a file watcher
|
||||
sourceFile.fileWatcher = sys.watchFile(sourceFile.fileName, (fileName: string, removed?: boolean) => sourceFileChanged(sourceFile, removed));
|
||||
const filePath = toPath(sourceFile.fileName, sys.getCurrentDirectory(), createGetCanonicalFileName(sys.useCaseSensitiveFileNames));
|
||||
sourceFile.fileWatcher = sys.watchFile(filePath, (fileName: string, removed?: boolean) => sourceFileChanged(sourceFile, removed));
|
||||
}
|
||||
return sourceFile;
|
||||
}
|
||||
|
||||
+27
-18
@@ -170,6 +170,7 @@ namespace ts {
|
||||
SymbolKeyword,
|
||||
TypeKeyword,
|
||||
FromKeyword,
|
||||
GlobalKeyword,
|
||||
OfKeyword, // LastKeyword and LastToken
|
||||
|
||||
// Parse tree nodes
|
||||
@@ -311,11 +312,11 @@ namespace ts {
|
||||
// Top-level nodes
|
||||
SourceFile,
|
||||
|
||||
// JSDoc nodes.
|
||||
// JSDoc nodes
|
||||
JSDocTypeExpression,
|
||||
// The * type.
|
||||
// The * type
|
||||
JSDocAllType,
|
||||
// The ? type.
|
||||
// The ? type
|
||||
JSDocUnknownType,
|
||||
JSDocArrayType,
|
||||
JSDocUnionType,
|
||||
@@ -389,11 +390,18 @@ namespace ts {
|
||||
ContainsThis = 1 << 18, // Interface contains references to "this"
|
||||
HasImplicitReturn = 1 << 19, // If function implicitly returns on one of codepaths (initialized by binding)
|
||||
HasExplicitReturn = 1 << 20, // If function has explicit reachable return on one of codepaths (initialized by binding)
|
||||
GlobalAugmentation = 1 << 21, // Set if module declaration is an augmentation for the global scope
|
||||
HasClassExtends = 1 << 22, // If the file has a non-ambient class with an extends clause in ES5 or lower (initialized by binding)
|
||||
HasDecorators = 1 << 23, // If the file has decorators (initialized by binding)
|
||||
HasParamDecorators = 1 << 24, // If the file has parameter decorators (initialized by binding)
|
||||
HasAsyncFunctions = 1 << 25, // If the file has async functions (initialized by binding)
|
||||
|
||||
Modifier = Export | Ambient | Public | Private | Protected | Static | Abstract | Default | Async,
|
||||
AccessibilityModifier = Public | Private | Protected,
|
||||
BlockScoped = Let | Const,
|
||||
|
||||
ReachabilityCheckFlags = HasImplicitReturn | HasExplicitReturn
|
||||
ReachabilityCheckFlags = HasImplicitReturn | HasExplicitReturn,
|
||||
EmitHelperFlags = HasClassExtends | HasDecorators | HasParamDecorators | HasAsyncFunctions,
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
@@ -996,7 +1004,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
// @kind(SyntaxKind.CallExpression)
|
||||
export interface CallExpression extends LeftHandSideExpression {
|
||||
export interface CallExpression extends LeftHandSideExpression, Declaration {
|
||||
expression: LeftHandSideExpression;
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
arguments: NodeArray<Expression>;
|
||||
@@ -1475,6 +1483,8 @@ namespace ts {
|
||||
type: JSDocType;
|
||||
}
|
||||
|
||||
export type JSDocTypeReferencingNode = JSDocThisType | JSDocConstructorType | JSDocVariadicType | JSDocOptionalType | JSDocNullableType | JSDocNonNullableType;
|
||||
|
||||
// @kind(SyntaxKind.JSDocRecordMember)
|
||||
export interface JSDocRecordMember extends PropertySignature {
|
||||
name: Identifier | LiteralExpression;
|
||||
@@ -1577,6 +1587,7 @@ namespace ts {
|
||||
// Content of this fiels should never be used directly - use getResolvedModuleFileName/setResolvedModuleFileName functions instead
|
||||
/* @internal */ resolvedModules: Map<ResolvedModule>;
|
||||
/* @internal */ imports: LiteralExpression[];
|
||||
/* @internal */ moduleAugmentations: LiteralExpression[];
|
||||
}
|
||||
|
||||
export interface ScriptReferenceHost {
|
||||
@@ -1725,6 +1736,7 @@ namespace ts {
|
||||
getSymbolAtLocation(node: Node): Symbol;
|
||||
getSymbolsOfParameterPropertyDeclaration(parameter: ParameterDeclaration, parameterName: string): Symbol[];
|
||||
getShorthandAssignmentValueSymbol(location: Node): Symbol;
|
||||
getExportSpecifierLocalTargetSymbol(location: ExportSpecifier): Symbol;
|
||||
getTypeAtLocation(node: Node): Type;
|
||||
typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string;
|
||||
symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string;
|
||||
@@ -1738,6 +1750,7 @@ namespace ts {
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
isUndefinedSymbol(symbol: Symbol): boolean;
|
||||
isArgumentsSymbol(symbol: Symbol): boolean;
|
||||
isUnknownSymbol(symbol: Symbol): boolean;
|
||||
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
|
||||
@@ -1909,7 +1922,7 @@ namespace ts {
|
||||
isOptionalParameter(node: ParameterDeclaration): boolean;
|
||||
moduleExportsSomeValue(moduleReferenceExpression: Expression): boolean;
|
||||
isArgumentsLocalBinding(node: Identifier): boolean;
|
||||
getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration): SourceFile;
|
||||
getExternalModuleFileFromDeclaration(declaration: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration | ModuleDeclaration): SourceFile;
|
||||
}
|
||||
|
||||
export const enum SymbolFlags {
|
||||
@@ -2042,23 +2055,19 @@ namespace ts {
|
||||
TypeChecked = 0x00000001, // Node has been type checked
|
||||
LexicalThis = 0x00000002, // Lexical 'this' reference
|
||||
CaptureThis = 0x00000004, // Lexical 'this' used in body
|
||||
EmitExtends = 0x00000008, // Emit __extends
|
||||
EmitDecorate = 0x00000010, // Emit __decorate
|
||||
EmitParam = 0x00000020, // Emit __param helper for decorators
|
||||
EmitAwaiter = 0x00000040, // Emit __awaiter
|
||||
EmitGenerator = 0x00000080, // Emit __generator
|
||||
SuperInstance = 0x00000100, // Instance 'super' reference
|
||||
SuperStatic = 0x00000200, // Static 'super' reference
|
||||
ContextChecked = 0x00000400, // Contextual types have been assigned
|
||||
LexicalArguments = 0x00000800,
|
||||
CaptureArguments = 0x00001000, // Lexical 'arguments' used in body (for async functions)
|
||||
AsyncMethodWithSuper = 0x00000800, // An async method that reads a value from a member of 'super'.
|
||||
AsyncMethodWithSuperBinding = 0x00001000, // An async method that assigns a value to a member of 'super'.
|
||||
CaptureArguments = 0x00002000, // Lexical 'arguments' used in body (for async functions)
|
||||
|
||||
// Values for enum members have been computed, and any errors have been reported for them.
|
||||
EnumValuesComputed = 0x00002000,
|
||||
BlockScopedBindingInLoop = 0x00004000,
|
||||
LexicalModuleMergesWithClass = 0x00008000, // Instantiated lexical module declaration is merged with a previous class declaration.
|
||||
LoopWithBlockScopedBindingCapturedInFunction = 0x00010000, // Loop that contains block scoped variable captured in closure
|
||||
HasSeenSuperCall = 0x00040000, // Set during the binding when encounter 'super'
|
||||
EnumValuesComputed = 0x00004000,
|
||||
BlockScopedBindingInLoop = 0x00008000,
|
||||
LexicalModuleMergesWithClass = 0x00010000, // Instantiated lexical module declaration is merged with a previous class declaration.
|
||||
LoopWithBlockScopedBindingCapturedInFunction = 0x00020000, // Loop that contains block scoped variable captured in closure
|
||||
HasSeenSuperCall = 0x00040000, // Set during the binding when encounter 'super'
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
|
||||
+104
-60
@@ -251,6 +251,31 @@ namespace ts {
|
||||
isCatchClauseVariableDeclaration(declaration);
|
||||
}
|
||||
|
||||
export function isAmbientModule(node: Node): boolean {
|
||||
return node && node.kind === SyntaxKind.ModuleDeclaration &&
|
||||
((<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral || isGlobalScopeAugmentation(<ModuleDeclaration>node));
|
||||
}
|
||||
|
||||
export function isGlobalScopeAugmentation(module: ModuleDeclaration): boolean {
|
||||
return !!(module.flags & NodeFlags.GlobalAugmentation);
|
||||
}
|
||||
|
||||
export function isExternalModuleAugmentation(node: Node): boolean {
|
||||
// external module augmentation is a ambient module declaration that is either:
|
||||
// - defined in the top level scope and source file is an external module
|
||||
// - defined inside ambient module declaration located in the top level scope and source file not an external module
|
||||
if (!node || !isAmbientModule(node)) {
|
||||
return false;
|
||||
}
|
||||
switch (node.parent.kind) {
|
||||
case SyntaxKind.SourceFile:
|
||||
return isExternalModule(<SourceFile>node.parent);
|
||||
case SyntaxKind.ModuleBlock:
|
||||
return isAmbientModule(node.parent.parent) && !isExternalModule(<SourceFile>node.parent.parent.parent);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Gets the nearest enclosing block scope container that has the provided node
|
||||
// as a descendant, that is not the provided node.
|
||||
export function getEnclosingBlockScopeContainer(node: Node): Node {
|
||||
@@ -343,6 +368,7 @@ namespace ts {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
errorNode = (<Declaration>node).name;
|
||||
break;
|
||||
}
|
||||
@@ -776,10 +802,10 @@ namespace ts {
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an super call\property node returns a closest node where either
|
||||
* - super call\property is legal in the node and not legal in the parent node the node.
|
||||
* Given an super call\property node returns a closest node where either
|
||||
* - super call\property is legal in the node and not legal in the parent node the node.
|
||||
* i.e. super call is legal in constructor but not legal in the class body.
|
||||
* - node is arrow function (so caller might need to call getSuperContainer in case if he needs to climb higher)
|
||||
* - node is arrow function (so caller might need to call getSuperContainer in case it needs to climb higher)
|
||||
* - super call\property is definitely illegal in the node (but might be legal in some subnode)
|
||||
* i.e. super property access is illegal in function declaration but can be legal in the statement list
|
||||
*/
|
||||
@@ -824,6 +850,16 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a node is a property or element access expression for super.
|
||||
*/
|
||||
export function isSuperPropertyOrElementAccess(node: Node) {
|
||||
return (node.kind === SyntaxKind.PropertyAccessExpression
|
||||
|| node.kind === SyntaxKind.ElementAccessExpression)
|
||||
&& (<PropertyAccessExpression | ElementAccessExpression>node).expression.kind === SyntaxKind.SuperKeyword;
|
||||
}
|
||||
|
||||
|
||||
export function getEntityNameFromTypeNode(node: TypeNode): EntityName | Expression {
|
||||
if (node) {
|
||||
switch (node.kind) {
|
||||
@@ -859,54 +895,28 @@ namespace ts {
|
||||
// property declarations are valid if their parent is a class declaration.
|
||||
return node.parent.kind === SyntaxKind.ClassDeclaration;
|
||||
|
||||
case SyntaxKind.Parameter:
|
||||
// if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target;
|
||||
return (<FunctionLikeDeclaration>node.parent).body && node.parent.parent.kind === SyntaxKind.ClassDeclaration;
|
||||
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
// if this method has a body and its parent is a class declaration, this is a valid target.
|
||||
return (<FunctionLikeDeclaration>node).body && node.parent.kind === SyntaxKind.ClassDeclaration;
|
||||
return (<FunctionLikeDeclaration>node).body !== undefined
|
||||
&& node.parent.kind === SyntaxKind.ClassDeclaration;
|
||||
|
||||
case SyntaxKind.Parameter:
|
||||
// if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target;
|
||||
return (<FunctionLikeDeclaration>node.parent).body !== undefined
|
||||
&& (node.parent.kind === SyntaxKind.Constructor
|
||||
|| node.parent.kind === SyntaxKind.MethodDeclaration
|
||||
|| node.parent.kind === SyntaxKind.SetAccessor)
|
||||
&& node.parent.parent.kind === SyntaxKind.ClassDeclaration;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function nodeIsDecorated(node: Node): boolean {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
if (node.decorators) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.Parameter:
|
||||
if (node.decorators) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
case SyntaxKind.GetAccessor:
|
||||
if ((<FunctionLikeDeclaration>node).body && node.decorators) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.SetAccessor:
|
||||
if ((<FunctionLikeDeclaration>node).body && node.decorators) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
return node.decorators !== undefined
|
||||
&& nodeCanBeDecorated(node);
|
||||
}
|
||||
|
||||
export function isPropertyAccessExpression(node: Node): node is PropertyAccessExpression {
|
||||
@@ -1054,7 +1064,7 @@ namespace ts {
|
||||
|
||||
/**
|
||||
* Returns true if the node is a CallExpression to the identifier 'require' with
|
||||
* exactly one string literal argument.
|
||||
* exactly one argument.
|
||||
* This function does not test if the node is in a JavaScript file or not.
|
||||
*/
|
||||
export function isRequireCall(expression: Node): expression is CallExpression {
|
||||
@@ -1062,8 +1072,7 @@ namespace ts {
|
||||
return expression.kind === SyntaxKind.CallExpression &&
|
||||
(<CallExpression>expression).expression.kind === SyntaxKind.Identifier &&
|
||||
(<Identifier>(<CallExpression>expression).expression).text === "require" &&
|
||||
(<CallExpression>expression).arguments.length === 1 &&
|
||||
(<CallExpression>expression).arguments[0].kind === SyntaxKind.StringLiteral;
|
||||
(<CallExpression>expression).arguments.length === 1;
|
||||
}
|
||||
|
||||
/// Given a BinaryExpression, returns SpecialPropertyAssignmentKind for the various kinds of property
|
||||
@@ -1115,6 +1124,9 @@ namespace ts {
|
||||
if (node.kind === SyntaxKind.ExportDeclaration) {
|
||||
return (<ExportDeclaration>node).moduleSpecifier;
|
||||
}
|
||||
if (node.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral) {
|
||||
return (<ModuleDeclaration>node).name;
|
||||
}
|
||||
}
|
||||
|
||||
export function hasQuestionToken(node: Node) {
|
||||
@@ -1140,26 +1152,56 @@ namespace ts {
|
||||
(<JSDocFunctionType>node).parameters[0].type.kind === SyntaxKind.JSDocConstructorType;
|
||||
}
|
||||
|
||||
function getJSDocTag(node: Node, kind: SyntaxKind): JSDocTag {
|
||||
if (node && node.jsDocComment) {
|
||||
for (const tag of node.jsDocComment.tags) {
|
||||
if (tag.kind === kind) {
|
||||
return tag;
|
||||
}
|
||||
function getJSDocTag(node: Node, kind: SyntaxKind, checkParentVariableStatement: boolean): JSDocTag {
|
||||
if (!node) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const jsDocComment = getJSDocComment(node, checkParentVariableStatement);
|
||||
if (!jsDocComment) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
for (const tag of jsDocComment.tags) {
|
||||
if (tag.kind === kind) {
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getJSDocComment(node: Node, checkParentVariableStatement: boolean): JSDocComment {
|
||||
if (node.jsDocComment) {
|
||||
return node.jsDocComment;
|
||||
}
|
||||
// Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement.
|
||||
// /**
|
||||
// * @param {number} name
|
||||
// * @returns {number}
|
||||
// */
|
||||
// var x = function(name) { return name.length; }
|
||||
if (checkParentVariableStatement) {
|
||||
const isInitializerOfVariableDeclarationInStatement =
|
||||
node.parent.kind === SyntaxKind.VariableDeclaration &&
|
||||
(<VariableDeclaration>node.parent).initializer === node &&
|
||||
node.parent.parent.parent.kind === SyntaxKind.VariableStatement;
|
||||
|
||||
const variableStatementNode = isInitializerOfVariableDeclarationInStatement ? node.parent.parent.parent : undefined;
|
||||
return variableStatementNode && variableStatementNode.jsDocComment;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getJSDocTypeTag(node: Node): JSDocTypeTag {
|
||||
return <JSDocTypeTag>getJSDocTag(node, SyntaxKind.JSDocTypeTag);
|
||||
return <JSDocTypeTag>getJSDocTag(node, SyntaxKind.JSDocTypeTag, /*checkParentVariableStatement*/ false);
|
||||
}
|
||||
|
||||
export function getJSDocReturnTag(node: Node): JSDocReturnTag {
|
||||
return <JSDocReturnTag>getJSDocTag(node, SyntaxKind.JSDocReturnTag);
|
||||
return <JSDocReturnTag>getJSDocTag(node, SyntaxKind.JSDocReturnTag, /*checkParentVariableStatement*/ true);
|
||||
}
|
||||
|
||||
export function getJSDocTemplateTag(node: Node): JSDocTemplateTag {
|
||||
return <JSDocTemplateTag>getJSDocTag(node, SyntaxKind.JSDocTemplateTag);
|
||||
return <JSDocTemplateTag>getJSDocTag(node, SyntaxKind.JSDocTemplateTag, /*checkParentVariableStatement*/ false);
|
||||
}
|
||||
|
||||
export function getCorrespondingJSDocParameterTag(parameter: ParameterDeclaration): JSDocParameterTag {
|
||||
@@ -1168,19 +1210,21 @@ namespace ts {
|
||||
// annotation.
|
||||
const parameterName = (<Identifier>parameter.name).text;
|
||||
|
||||
const docComment = parameter.parent.jsDocComment;
|
||||
if (docComment) {
|
||||
return <JSDocParameterTag>forEach(docComment.tags, t => {
|
||||
if (t.kind === SyntaxKind.JSDocParameterTag) {
|
||||
const parameterTag = <JSDocParameterTag>t;
|
||||
const jsDocComment = getJSDocComment(parameter.parent, /*checkParentVariableStatement*/ true);
|
||||
if (jsDocComment) {
|
||||
for (const tag of jsDocComment.tags) {
|
||||
if (tag.kind === SyntaxKind.JSDocParameterTag) {
|
||||
const parameterTag = <JSDocParameterTag>tag;
|
||||
const name = parameterTag.preParameterName || parameterTag.postParameterName;
|
||||
if (name.text === parameterName) {
|
||||
return t;
|
||||
return parameterTag;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function hasRestParameter(s: SignatureDeclaration): boolean {
|
||||
|
||||
@@ -572,6 +572,31 @@ namespace FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
public verifyCompletionListStartsWithItemsInOrder(items: string[]): void {
|
||||
if (items.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const entries = this.getCompletionListAtCaret().entries;
|
||||
assert.isTrue(items.length <= entries.length, `Amount of expected items in completion list [ ${items.length} ] is greater than actual number of items in list [ ${entries.length} ]`);
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
assert.equal(entries[i].name, items[i], `Unexpected item in completion list`);
|
||||
}
|
||||
}
|
||||
|
||||
public noItemsWithSameNameButDifferentKind(): void {
|
||||
const completions = this.getCompletionListAtCaret();
|
||||
const uniqueItems: ts.Map<string> = {};
|
||||
for (const item of completions.entries) {
|
||||
if (!ts.hasProperty(uniqueItems, item.name)) {
|
||||
uniqueItems[item.name] = item.kind;
|
||||
}
|
||||
else {
|
||||
assert.equal(item.kind, uniqueItems[item.name], `Items should have the same kind, got ${item.kind} and ${uniqueItems[item.name]}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public verifyMemberListIsEmpty(negative: boolean) {
|
||||
const members = this.getMemberListAtCaret();
|
||||
if ((!members || members.entries.length === 0) && negative) {
|
||||
@@ -1080,9 +1105,15 @@ namespace FourSlash {
|
||||
}
|
||||
|
||||
public baselineCurrentFileBreakpointLocations() {
|
||||
let baselineFile = this.testData.globalOptions[metadataOptionNames.baselineFile];
|
||||
if (!baselineFile) {
|
||||
baselineFile = this.activeFile.fileName.replace(this.basePath + "/breakpointValidation", "bpSpan");
|
||||
baselineFile = baselineFile.replace(".ts", ".baseline");
|
||||
|
||||
}
|
||||
Harness.Baseline.runBaseline(
|
||||
"Breakpoint Locations for " + this.activeFile.fileName,
|
||||
this.testData.globalOptions[metadataOptionNames.baselineFile],
|
||||
baselineFile,
|
||||
() => {
|
||||
return this.baselineCurrentFileLocations(pos => this.getBreakpointStatementLocation(pos));
|
||||
},
|
||||
@@ -3285,6 +3316,30 @@ namespace FourSlashInterface {
|
||||
return getClassification("typeAliasName", text, position);
|
||||
}
|
||||
|
||||
export function jsxOpenTagName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("jsxOpenTagName", text, position);
|
||||
}
|
||||
|
||||
export function jsxCloseTagName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("jsxCloseTagName", text, position);
|
||||
}
|
||||
|
||||
export function jsxSelfClosingTagName(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("jsxSelfClosingTagName", text, position);
|
||||
}
|
||||
|
||||
export function jsxAttribute(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("jsxAttribute", text, position);
|
||||
}
|
||||
|
||||
export function jsxText(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("jsxText", text, position);
|
||||
}
|
||||
|
||||
export function jsxAttributeStringLiteralValue(text: string, position?: number): { classificationType: string; text: string; textSpan?: FourSlash.TextSpan } {
|
||||
return getClassification("jsxAttributeStringLiteralValue", text, position);
|
||||
}
|
||||
|
||||
function getClassification(type: string, text: string, position?: number) {
|
||||
return {
|
||||
classificationType: type,
|
||||
|
||||
Vendored
-2
@@ -1,5 +1,3 @@
|
||||
/// <reference no-default-lib="true"/>
|
||||
|
||||
/////////////////////////////
|
||||
/// ECMAScript APIs
|
||||
/////////////////////////////
|
||||
|
||||
Vendored
+32
-13
@@ -1255,7 +1255,7 @@ interface Console {
|
||||
select(element: Element): void;
|
||||
time(timerName?: string): void;
|
||||
timeEnd(timerName?: string): void;
|
||||
trace(): void;
|
||||
trace(message?: any, ...optionalParams: any[]): void;
|
||||
warn(message?: any, ...optionalParams: any[]): void;
|
||||
}
|
||||
|
||||
@@ -1514,9 +1514,9 @@ interface DataTransferItemList {
|
||||
length: number;
|
||||
add(data: File): DataTransferItem;
|
||||
clear(): void;
|
||||
item(index: number): File;
|
||||
item(index: number): DataTransferItem;
|
||||
remove(index: number): void;
|
||||
[index: number]: File;
|
||||
[index: number]: DataTransferItem;
|
||||
}
|
||||
|
||||
declare var DataTransferItemList: {
|
||||
@@ -2569,6 +2569,8 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
|
||||
* @param content The text and HTML tags to write.
|
||||
*/
|
||||
writeln(...content: string[]): void;
|
||||
createElement(tagName: "picture"): HTMLPictureElement;
|
||||
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
|
||||
addEventListener(type: "MSContentZoom", listener: (ev: UIEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -2981,6 +2983,7 @@ interface Element extends Node, GlobalEventHandlers, ElementTraversal, NodeSelec
|
||||
webkitRequestFullscreen(): void;
|
||||
getElementsByClassName(classNames: string): NodeListOf<Element>;
|
||||
matches(selector: string): boolean;
|
||||
getElementsByTagName(tagname: "picture"): NodeListOf<HTMLPictureElement>;
|
||||
addEventListener(type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureDoubleTap", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "MSGestureEnd", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void;
|
||||
@@ -3770,6 +3773,7 @@ interface HTMLCanvasElement extends HTMLElement {
|
||||
* @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
|
||||
*/
|
||||
toDataURL(type?: string, ...args: any[]): string;
|
||||
toBlob(): Blob;
|
||||
}
|
||||
|
||||
declare var HTMLCanvasElement: {
|
||||
@@ -6924,7 +6928,7 @@ interface IDBDatabase extends EventTarget {
|
||||
objectStoreNames: DOMStringList;
|
||||
onabort: (ev: Event) => any;
|
||||
onerror: (ev: Event) => any;
|
||||
version: string;
|
||||
version: number;
|
||||
close(): void;
|
||||
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
@@ -7640,7 +7644,7 @@ declare var MediaQueryList: {
|
||||
interface MediaSource extends EventTarget {
|
||||
activeSourceBuffers: SourceBufferList;
|
||||
duration: number;
|
||||
readyState: number;
|
||||
readyState: string;
|
||||
sourceBuffers: SourceBufferList;
|
||||
addSourceBuffer(type: string): SourceBuffer;
|
||||
endOfStream(error?: number): void;
|
||||
@@ -10369,17 +10373,16 @@ declare var Storage: {
|
||||
}
|
||||
|
||||
interface StorageEvent extends Event {
|
||||
key: string;
|
||||
newValue: any;
|
||||
oldValue: any;
|
||||
storageArea: Storage;
|
||||
url: string;
|
||||
initStorageEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, keyArg: string, oldValueArg: any, newValueArg: any, urlArg: string, storageAreaArg: Storage): void;
|
||||
key?: string;
|
||||
oldValue?: string;
|
||||
newValue?: string;
|
||||
storageArea?: Storage;
|
||||
}
|
||||
|
||||
declare var StorageEvent: {
|
||||
prototype: StorageEvent;
|
||||
new(): StorageEvent;
|
||||
new (type: string, eventInitDict?: StorageEventInit): StorageEvent;
|
||||
}
|
||||
|
||||
interface StyleMedia {
|
||||
@@ -11977,7 +11980,7 @@ interface Window extends EventTarget, WindowTimers, WindowSessionStorage, Window
|
||||
msMatchMedia(mediaQuery: string): MediaQueryList;
|
||||
msRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
msWriteProfilerMark(profilerMarkName: string): void;
|
||||
open(url?: string, target?: string, features?: string, replace?: boolean): any;
|
||||
open(url?: string, target?: string, features?: string, replace?: boolean): Window;
|
||||
postMessage(message: any, targetOrigin: string, ports?: any): void;
|
||||
print(): void;
|
||||
prompt(message?: string, _default?: string): string;
|
||||
@@ -12579,6 +12582,14 @@ interface XMLHttpRequestEventTarget {
|
||||
addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
|
||||
}
|
||||
|
||||
interface StorageEventInit extends EventInit {
|
||||
key?: string;
|
||||
oldValue?: string;
|
||||
newValue?: string;
|
||||
url: string;
|
||||
storageArea?: Storage;
|
||||
}
|
||||
|
||||
interface IDBObjectStoreParameters {
|
||||
keyPath?: string | string[];
|
||||
autoIncrement?: boolean;
|
||||
@@ -12633,6 +12644,14 @@ declare var HTMLTemplateElement: {
|
||||
new(): HTMLTemplateElement;
|
||||
}
|
||||
|
||||
interface HTMLPictureElement extends HTMLElement {
|
||||
}
|
||||
|
||||
declare var HTMLPictureElement: {
|
||||
prototype: HTMLPictureElement;
|
||||
new(): HTMLPictureElement;
|
||||
}
|
||||
|
||||
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
||||
|
||||
interface ErrorEventHandler {
|
||||
@@ -12829,7 +12848,7 @@ declare function msCancelRequestAnimationFrame(handle: number): void;
|
||||
declare function msMatchMedia(mediaQuery: string): MediaQueryList;
|
||||
declare function msRequestAnimationFrame(callback: FrameRequestCallback): number;
|
||||
declare function msWriteProfilerMark(profilerMarkName: string): void;
|
||||
declare function open(url?: string, target?: string, features?: string, replace?: boolean): any;
|
||||
declare function open(url?: string, target?: string, features?: string, replace?: boolean): Window;
|
||||
declare function postMessage(message: any, targetOrigin: string, ports?: any): void;
|
||||
declare function print(): void;
|
||||
declare function prompt(message?: string, _default?: string): string;
|
||||
|
||||
Vendored
+8
-10
@@ -819,7 +819,6 @@ interface MapConstructor {
|
||||
declare var Map: MapConstructor;
|
||||
|
||||
interface WeakMap<K, V> {
|
||||
clear(): void;
|
||||
delete(key: K): boolean;
|
||||
get(key: K): V;
|
||||
has(key: K): boolean;
|
||||
@@ -859,7 +858,6 @@ declare var Set: SetConstructor;
|
||||
|
||||
interface WeakSet<T> {
|
||||
add(value: T): WeakSet<T>;
|
||||
clear(): void;
|
||||
delete(value: T): boolean;
|
||||
has(value: T): boolean;
|
||||
[Symbol.toStringTag]: "WeakSet";
|
||||
@@ -1281,15 +1279,15 @@ interface PromiseConstructor {
|
||||
* @param values An array of Promises.
|
||||
* @returns A new Promise.
|
||||
*/
|
||||
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
|
||||
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
|
||||
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
|
||||
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
|
||||
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
|
||||
all<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<[T1, T2, T3, T4, T5, T6]>;
|
||||
all<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>]): Promise<[T1, T2, T3, T4, T5]>;
|
||||
all<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>]): Promise<[T1, T2, T3, T4]>;
|
||||
all<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<[T1, T2, T3]>;
|
||||
all<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<[T1, T2]>;
|
||||
all<TAll>(values: Iterable<TAll | PromiseLike<TAll>>): Promise<TAll[]>;
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+89
@@ -0,0 +1,89 @@
|
||||
interface Array<T> {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: T, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Int8Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Uint8Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Uint8ClampedArray {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Int16Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Uint16Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Int32Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Uint32Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Float32Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Float64Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: number, fromIndex?: number): boolean;
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
/// <reference no-default-lib="true"/>
|
||||
Vendored
+2
-2
@@ -69,7 +69,7 @@ interface Console {
|
||||
select(element: any): void;
|
||||
time(timerName?: string): void;
|
||||
timeEnd(timerName?: string): void;
|
||||
trace(): void;
|
||||
trace(message?: any, ...optionalParams: any[]): void;
|
||||
warn(message?: any, ...optionalParams: any[]): void;
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ interface IDBDatabase extends EventTarget {
|
||||
objectStoreNames: DOMStringList;
|
||||
onabort: (ev: Event) => any;
|
||||
onerror: (ev: Event) => any;
|
||||
version: string;
|
||||
version: number;
|
||||
close(): void;
|
||||
createObjectStore(name: string, optionalParameters?: IDBObjectStoreParameters): IDBObjectStore;
|
||||
deleteObjectStore(name: string): void;
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace ts.server {
|
||||
if (!resolution) {
|
||||
const existingResolution = currentResolutionsInFile && ts.lookUp(currentResolutionsInFile, moduleName);
|
||||
if (moduleResolutionIsValid(existingResolution)) {
|
||||
// ok, it is safe to use existing module resolution results
|
||||
// ok, it is safe to use existing module resolution results
|
||||
resolution = existingResolution;
|
||||
}
|
||||
else {
|
||||
@@ -145,8 +145,8 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
if (resolution.resolvedModule) {
|
||||
// TODO: consider checking failedLookupLocations
|
||||
// TODO: use lastCheckTime to track expiration for module name resolution
|
||||
// TODO: consider checking failedLookupLocations
|
||||
// TODO: use lastCheckTime to track expiration for module name resolution
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -483,7 +483,7 @@ namespace ts.server {
|
||||
openFileRootsConfigured: ScriptInfo[] = [];
|
||||
// a path to directory watcher map that detects added tsconfig files
|
||||
directoryWatchersForTsconfig: ts.Map<FileWatcher> = {};
|
||||
// count of how many projects are using the directory watcher. If the
|
||||
// count of how many projects are using the directory watcher. If the
|
||||
// number becomes 0 for a watcher, then we should close it.
|
||||
directoryWatchersRefCount: ts.Map<number> = {};
|
||||
hostConfiguration: HostConfiguration;
|
||||
@@ -564,11 +564,11 @@ namespace ts.server {
|
||||
// We check if the project file list has changed. If so, we update the project.
|
||||
if (!arrayIsEqualTo(currentRootFiles && currentRootFiles.sort(), newRootFiles && newRootFiles.sort())) {
|
||||
// For configured projects, the change is made outside the tsconfig file, and
|
||||
// it is not likely to affect the project for other files opened by the client. We can
|
||||
// it is not likely to affect the project for other files opened by the client. We can
|
||||
// just update the current project.
|
||||
this.updateConfiguredProject(project);
|
||||
|
||||
// Call updateProjectStructure to clean up inferred projects we may have
|
||||
// Call updateProjectStructure to clean up inferred projects we may have
|
||||
// created for the new files
|
||||
this.updateProjectStructure();
|
||||
}
|
||||
@@ -792,8 +792,8 @@ namespace ts.server {
|
||||
* @param info The file that has been closed or newly configured
|
||||
*/
|
||||
closeOpenFile(info: ScriptInfo) {
|
||||
// Closing file should trigger re-reading the file content from disk. This is
|
||||
// because the user may chose to discard the buffer content before saving
|
||||
// Closing file should trigger re-reading the file content from disk. This is
|
||||
// because the user may chose to discard the buffer content before saving
|
||||
// to the disk, and the server's version of the file can be out of sync.
|
||||
info.svc.reloadFromFile(info.fileName);
|
||||
|
||||
@@ -891,8 +891,8 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is to update the project structure for every projects.
|
||||
* It is called on the premise that all the configured projects are
|
||||
* This function is to update the project structure for every projects.
|
||||
* It is called on the premise that all the configured projects are
|
||||
* up to date.
|
||||
*/
|
||||
updateProjectStructure() {
|
||||
@@ -946,7 +946,7 @@ namespace ts.server {
|
||||
|
||||
if (rootFile.defaultProject && rootFile.defaultProject.isConfiguredProject()) {
|
||||
// If the root file has already been added into a configured project,
|
||||
// meaning the original inferred project is gone already.
|
||||
// meaning the original inferred project is gone already.
|
||||
if (!rootedProject.isConfiguredProject()) {
|
||||
this.removeProject(rootedProject);
|
||||
}
|
||||
@@ -1002,7 +1002,9 @@ namespace ts.server {
|
||||
info.setFormatOptions(this.getFormatCodeOptions());
|
||||
this.filenameToScriptInfo[fileName] = info;
|
||||
if (!info.isOpen) {
|
||||
info.fileWatcher = this.host.watchFile(fileName, _ => { this.watchedFileChanged(fileName); });
|
||||
info.fileWatcher = this.host.watchFile(
|
||||
toPath(fileName, fileName, createGetCanonicalFileName(sys.useCaseSensitiveFileNames)),
|
||||
_ => { this.watchedFileChanged(fileName); });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1024,10 +1026,16 @@ namespace ts.server {
|
||||
// the newly opened file.
|
||||
findConfigFile(searchPath: string): string {
|
||||
while (true) {
|
||||
const fileName = ts.combinePaths(searchPath, "tsconfig.json");
|
||||
if (this.host.fileExists(fileName)) {
|
||||
return fileName;
|
||||
const tsconfigFileName = ts.combinePaths(searchPath, "tsconfig.json");
|
||||
if (this.host.fileExists(tsconfigFileName)) {
|
||||
return tsconfigFileName;
|
||||
}
|
||||
|
||||
const jsconfigFileName = ts.combinePaths(searchPath, "jsconfig.json");
|
||||
if (this.host.fileExists(jsconfigFileName)) {
|
||||
return jsconfigFileName;
|
||||
}
|
||||
|
||||
const parentPath = ts.getDirectoryPath(searchPath);
|
||||
if (parentPath === searchPath) {
|
||||
break;
|
||||
@@ -1051,9 +1059,9 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
/**
|
||||
* This function tries to search for a tsconfig.json for the given file. If we found it,
|
||||
* This function tries to search for a tsconfig.json for the given file. If we found it,
|
||||
* we first detect if there is already a configured project created for it: if so, we re-read
|
||||
* the tsconfig file content and update the project; otherwise we create a new one.
|
||||
* the tsconfig file content and update the project; otherwise we create a new one.
|
||||
*/
|
||||
openOrUpdateConfiguredProjectForFile(fileName: string) {
|
||||
const searchPath = ts.normalizePath(getDirectoryPath(fileName));
|
||||
@@ -1178,7 +1186,7 @@ namespace ts.server {
|
||||
return { succeeded: false, error: rawConfig.error };
|
||||
}
|
||||
else {
|
||||
const parsedCommandLine = ts.parseJsonConfigFileContent(rawConfig.config, this.host, dirPath);
|
||||
const parsedCommandLine = ts.parseJsonConfigFileContent(rawConfig.config, this.host, dirPath, /*existingOptions*/ {}, configFilename);
|
||||
Debug.assert(!!parsedCommandLine.fileNames);
|
||||
|
||||
if (parsedCommandLine.errors && (parsedCommandLine.errors.length > 0)) {
|
||||
@@ -1215,7 +1223,9 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
project.finishGraph();
|
||||
project.projectFileWatcher = this.host.watchFile(configFilename, _ => this.watchedProjectConfigFileChanged(project));
|
||||
project.projectFileWatcher = this.host.watchFile(
|
||||
toPath(configFilename, configFilename, createGetCanonicalFileName(sys.useCaseSensitiveFileNames)),
|
||||
_ => this.watchedProjectConfigFileChanged(project));
|
||||
this.log("Add recursive watcher for: " + ts.getDirectoryPath(configFilename));
|
||||
project.directoryWatcher = this.host.watchDirectory(
|
||||
ts.getDirectoryPath(configFilename),
|
||||
@@ -1255,7 +1265,7 @@ namespace ts.server {
|
||||
info = this.openFile(fileName, /*openedByClient*/ false);
|
||||
}
|
||||
else {
|
||||
// if the root file was opened by client, it would belong to either
|
||||
// if the root file was opened by client, it would belong to either
|
||||
// openFileRoots or openFileReferenced.
|
||||
if (info.isOpen) {
|
||||
if (this.openFileRoots.indexOf(info) >= 0) {
|
||||
|
||||
@@ -792,7 +792,9 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
private closeClientFile(fileName: string) {
|
||||
if (!fileName) { return; }
|
||||
if (!fileName) {
|
||||
return;
|
||||
}
|
||||
const file = ts.normalizePath(fileName);
|
||||
this.projectService.closeClientFile(file);
|
||||
}
|
||||
|
||||
+271
-86
@@ -45,6 +45,10 @@ namespace ts.BreakpointResolver {
|
||||
return createTextSpanFromBounds(start, (endNode || startNode).getEnd());
|
||||
}
|
||||
|
||||
function textSpanEndingAtNextToken(startNode: Node, previousTokenToFindNextEndToken: Node): TextSpan {
|
||||
return textSpan(startNode, findNextToken(previousTokenToFindNextEndToken, previousTokenToFindNextEndToken.parent));
|
||||
}
|
||||
|
||||
function spanInNodeIfStartsOnSameLine(node: Node, otherwiseOnNode?: Node): TextSpan {
|
||||
if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line) {
|
||||
return spanInNode(node);
|
||||
@@ -66,33 +70,6 @@ namespace ts.BreakpointResolver {
|
||||
|
||||
function spanInNode(node: Node): TextSpan {
|
||||
if (node) {
|
||||
if (isExpression(node)) {
|
||||
if (node.parent.kind === SyntaxKind.DoStatement) {
|
||||
// Set span as if on while keyword
|
||||
return spanInPreviousNode(node);
|
||||
}
|
||||
|
||||
if (node.parent.kind === SyntaxKind.Decorator) {
|
||||
// Set breakpoint on the decorator emit
|
||||
return spanInNode(node.parent);
|
||||
}
|
||||
|
||||
if (node.parent.kind === SyntaxKind.ForStatement) {
|
||||
// For now lets set the span on this expression, fix it later
|
||||
return textSpan(node);
|
||||
}
|
||||
|
||||
if (node.parent.kind === SyntaxKind.BinaryExpression && (<BinaryExpression>node.parent).operatorToken.kind === SyntaxKind.CommaToken) {
|
||||
// if this is comma expression, the breakpoint is possible in this expression
|
||||
return textSpan(node);
|
||||
}
|
||||
|
||||
if (node.parent.kind === SyntaxKind.ArrowFunction && (<FunctionLikeDeclaration>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 SyntaxKind.VariableStatement:
|
||||
// Span on first variable declaration
|
||||
@@ -120,7 +97,7 @@ namespace ts.BreakpointResolver {
|
||||
if (isFunctionBlock(node)) {
|
||||
return spanInFunctionBlock(<Block>node);
|
||||
}
|
||||
// Fall through
|
||||
// Fall through
|
||||
case SyntaxKind.ModuleBlock:
|
||||
return spanInBlock(<Block>node);
|
||||
|
||||
@@ -137,7 +114,7 @@ namespace ts.BreakpointResolver {
|
||||
|
||||
case SyntaxKind.WhileStatement:
|
||||
// Span on while(...)
|
||||
return textSpan(node, findNextToken((<WhileStatement>node).expression, node));
|
||||
return textSpanEndingAtNextToken(node, (<WhileStatement>node).expression);
|
||||
|
||||
case SyntaxKind.DoStatement:
|
||||
// span in statement of the do statement
|
||||
@@ -149,7 +126,7 @@ namespace ts.BreakpointResolver {
|
||||
|
||||
case SyntaxKind.IfStatement:
|
||||
// set on if(..) span
|
||||
return textSpan(node, findNextToken((<IfStatement>node).expression, node));
|
||||
return textSpanEndingAtNextToken(node, (<IfStatement>node).expression);
|
||||
|
||||
case SyntaxKind.LabeledStatement:
|
||||
// span in statement
|
||||
@@ -164,13 +141,16 @@ namespace ts.BreakpointResolver {
|
||||
return spanInForStatement(<ForStatement>node);
|
||||
|
||||
case SyntaxKind.ForInStatement:
|
||||
// span of for (a in ...)
|
||||
return textSpanEndingAtNextToken(node, (<ForInStatement>node).expression);
|
||||
|
||||
case SyntaxKind.ForOfStatement:
|
||||
// span on for (a in ...)
|
||||
return textSpan(node, findNextToken((<ForInStatement | ForOfStatement>node).expression, node));
|
||||
// span in initializer
|
||||
return spanInInitializerOfForLike(<ForOfStatement | ForInStatement>node);
|
||||
|
||||
case SyntaxKind.SwitchStatement:
|
||||
// span on switch(...)
|
||||
return textSpan(node, findNextToken((<SwitchStatement>node).expression, node));
|
||||
return textSpanEndingAtNextToken(node, (<SwitchStatement>node).expression);
|
||||
|
||||
case SyntaxKind.CaseClause:
|
||||
case SyntaxKind.DefaultClause:
|
||||
@@ -210,8 +190,7 @@ namespace ts.BreakpointResolver {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
case SyntaxKind.BindingElement:
|
||||
// span on complete node
|
||||
return textSpan(node);
|
||||
|
||||
@@ -222,6 +201,10 @@ namespace ts.BreakpointResolver {
|
||||
case SyntaxKind.Decorator:
|
||||
return spanInNodeArray(node.parent.decorators);
|
||||
|
||||
case SyntaxKind.ObjectBindingPattern:
|
||||
case SyntaxKind.ArrayBindingPattern:
|
||||
return spanInBindingPattern(<BindingPattern>node);
|
||||
|
||||
// No breakpoint in interface, type alias
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
@@ -234,14 +217,17 @@ namespace ts.BreakpointResolver {
|
||||
|
||||
case SyntaxKind.CommaToken:
|
||||
return spanInPreviousNode(node)
|
||||
|
||||
|
||||
case SyntaxKind.OpenBraceToken:
|
||||
return spanInOpenBraceToken(node);
|
||||
|
||||
case SyntaxKind.CloseBraceToken:
|
||||
return spanInCloseBraceToken(node);
|
||||
|
||||
case SyntaxKind.OpenParenToken:
|
||||
case SyntaxKind.CloseBracketToken:
|
||||
return spanInCloseBracketToken(node);
|
||||
|
||||
case SyntaxKind.OpenParenToken:
|
||||
return spanInOpenParenToken(node);
|
||||
|
||||
case SyntaxKind.CloseParenToken:
|
||||
@@ -263,15 +249,93 @@ namespace ts.BreakpointResolver {
|
||||
case SyntaxKind.FinallyKeyword:
|
||||
return spanInNextNode(node);
|
||||
|
||||
case SyntaxKind.OfKeyword:
|
||||
return spanInOfKeyword(node);
|
||||
|
||||
default:
|
||||
// If this is name of property assignment, set breakpoint in the initializer
|
||||
if (node.parent.kind === SyntaxKind.PropertyAssignment && (<PropertyDeclaration>node.parent).name === node) {
|
||||
return spanInNode((<PropertyDeclaration>node.parent).initializer);
|
||||
// Destructuring pattern in destructuring assignment
|
||||
// [a, b, c] of
|
||||
// [a, b, c] = expression
|
||||
if (isArrayLiteralOrObjectLiteralDestructuringPattern(node)) {
|
||||
return spanInArrayLiteralOrObjectLiteralDestructuringPattern(<DestructuringPattern>node);
|
||||
}
|
||||
|
||||
// Set breakpoint on identifier element of destructuring pattern
|
||||
// a or ...c or d: x from
|
||||
// [a, b, ...c] or { a, b } or { d: x } from destructuring pattern
|
||||
if ((node.kind === SyntaxKind.Identifier ||
|
||||
node.kind == SyntaxKind.SpreadElementExpression ||
|
||||
node.kind === SyntaxKind.PropertyAssignment ||
|
||||
node.kind === SyntaxKind.ShorthandPropertyAssignment) &&
|
||||
isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
|
||||
return textSpan(node);
|
||||
}
|
||||
|
||||
if (node.kind === SyntaxKind.BinaryExpression) {
|
||||
const binaryExpression = <BinaryExpression>node;
|
||||
// Set breakpoint in destructuring pattern if its destructuring assignment
|
||||
// [a, b, c] or {a, b, c} of
|
||||
// [a, b, c] = expression or
|
||||
// {a, b, c} = expression
|
||||
if (isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left)) {
|
||||
return spanInArrayLiteralOrObjectLiteralDestructuringPattern(
|
||||
<ArrayLiteralExpression | ObjectLiteralExpression>binaryExpression.left);
|
||||
}
|
||||
|
||||
if (binaryExpression.operatorToken.kind === SyntaxKind.EqualsToken &&
|
||||
isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.parent)) {
|
||||
// Set breakpoint on assignment expression element of destructuring pattern
|
||||
// a = expression of
|
||||
// [a = expression, b, c] = someExpression or
|
||||
// { a = expression, b, c } = someExpression
|
||||
return textSpan(node);
|
||||
}
|
||||
|
||||
if (binaryExpression.operatorToken.kind === SyntaxKind.CommaToken) {
|
||||
return spanInNode(binaryExpression.left);
|
||||
}
|
||||
}
|
||||
|
||||
if (isExpression(node)) {
|
||||
switch (node.parent.kind) {
|
||||
case SyntaxKind.DoStatement:
|
||||
// Set span as if on while keyword
|
||||
return spanInPreviousNode(node);
|
||||
|
||||
case SyntaxKind.Decorator:
|
||||
// Set breakpoint on the decorator emit
|
||||
return spanInNode(node.parent);
|
||||
|
||||
case SyntaxKind.ForStatement:
|
||||
case SyntaxKind.ForOfStatement:
|
||||
return textSpan(node);
|
||||
|
||||
case SyntaxKind.BinaryExpression:
|
||||
if ((<BinaryExpression>node.parent).operatorToken.kind === SyntaxKind.CommaToken) {
|
||||
// if this is comma expression, the breakpoint is possible in this expression
|
||||
return textSpan(node);
|
||||
}
|
||||
break;
|
||||
|
||||
case SyntaxKind.ArrowFunction:
|
||||
if ((<FunctionLikeDeclaration>node.parent).body === node) {
|
||||
// If this is body of arrow function, it is allowed to have the breakpoint
|
||||
return textSpan(node);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If this is name of property assignment, set breakpoint in the initializer
|
||||
if (node.parent.kind === SyntaxKind.PropertyAssignment &&
|
||||
(<PropertyDeclaration>node.parent).name === node &&
|
||||
!isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) {
|
||||
return spanInNode((<PropertyDeclaration>node.parent).initializer);
|
||||
}
|
||||
|
||||
// Breakpoint in type assertion goes to its operand
|
||||
if (node.parent.kind === SyntaxKind.TypeAssertionExpression && (<TypeAssertion>node.parent).type === node) {
|
||||
return spanInNode((<TypeAssertion>node.parent).expression);
|
||||
return spanInNextNode((<TypeAssertion>node.parent).type);
|
||||
}
|
||||
|
||||
// return type of function go to previous token
|
||||
@@ -279,48 +343,70 @@ namespace ts.BreakpointResolver {
|
||||
return spanInPreviousNode(node);
|
||||
}
|
||||
|
||||
// initializer of variable/parameter declaration go to previous node
|
||||
if ((node.parent.kind === SyntaxKind.VariableDeclaration ||
|
||||
node.parent.kind === SyntaxKind.Parameter)) {
|
||||
const paramOrVarDecl = <VariableDeclaration | ParameterDeclaration>node.parent;
|
||||
if (paramOrVarDecl.initializer === node ||
|
||||
paramOrVarDecl.type === node ||
|
||||
isAssignmentOperator(node.kind)) {
|
||||
return spanInPreviousNode(node);
|
||||
}
|
||||
}
|
||||
|
||||
if (node.parent.kind === SyntaxKind.BinaryExpression) {
|
||||
const binaryExpression = <BinaryExpression>node.parent;
|
||||
if (isArrayLiteralOrObjectLiteralDestructuringPattern(binaryExpression.left) &&
|
||||
(binaryExpression.right === node ||
|
||||
binaryExpression.operatorToken === node)) {
|
||||
// If initializer of destructuring assignment move to previous token
|
||||
return spanInPreviousNode(node);
|
||||
}
|
||||
}
|
||||
|
||||
// Default go to parent to set the breakpoint
|
||||
return spanInNode(node.parent);
|
||||
}
|
||||
}
|
||||
|
||||
function textSpanFromVariableDeclaration(variableDeclaration: VariableDeclaration): TextSpan {
|
||||
let declarations = variableDeclaration.parent.declarations;
|
||||
if (declarations && declarations[0] === variableDeclaration) {
|
||||
// First declaration - include let keyword
|
||||
return textSpan(findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration);
|
||||
}
|
||||
else {
|
||||
// Span only on this declaration
|
||||
return textSpan(variableDeclaration);
|
||||
}
|
||||
}
|
||||
|
||||
function spanInVariableDeclaration(variableDeclaration: VariableDeclaration): TextSpan {
|
||||
// If declaration of for in statement, just set the span in parent
|
||||
if (variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement ||
|
||||
variableDeclaration.parent.parent.kind === SyntaxKind.ForOfStatement) {
|
||||
if (variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement) {
|
||||
return spanInNode(variableDeclaration.parent.parent);
|
||||
}
|
||||
|
||||
let isParentVariableStatement = variableDeclaration.parent.parent.kind === SyntaxKind.VariableStatement;
|
||||
let isDeclarationOfForStatement = variableDeclaration.parent.parent.kind === SyntaxKind.ForStatement && contains((<VariableDeclarationList>(<ForStatement>variableDeclaration.parent.parent).initializer).declarations, variableDeclaration);
|
||||
let declarations = isParentVariableStatement
|
||||
? (<VariableStatement>variableDeclaration.parent.parent).declarationList.declarations
|
||||
: isDeclarationOfForStatement
|
||||
? (<VariableDeclarationList>(<ForStatement>variableDeclaration.parent.parent).initializer).declarations
|
||||
: undefined;
|
||||
|
||||
// If this is a destructuring pattern set breakpoint in binding pattern
|
||||
if (isBindingPattern(variableDeclaration.name)) {
|
||||
return spanInBindingPattern(<BindingPattern>variableDeclaration.name);
|
||||
}
|
||||
|
||||
// Breakpoint is possible in variableDeclaration only if there is initialization
|
||||
if (variableDeclaration.initializer || (variableDeclaration.flags & NodeFlags.Export)) {
|
||||
if (declarations && declarations[0] === variableDeclaration) {
|
||||
if (isParentVariableStatement) {
|
||||
// First declaration - include let keyword
|
||||
return textSpan(variableDeclaration.parent, variableDeclaration);
|
||||
}
|
||||
else {
|
||||
Debug.assert(isDeclarationOfForStatement);
|
||||
// Include let keyword from for statement declarations in the span
|
||||
return textSpan(findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent), variableDeclaration);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Span only on this declaration
|
||||
return textSpan(variableDeclaration);
|
||||
}
|
||||
// or its declaration from 'for of'
|
||||
if (variableDeclaration.initializer ||
|
||||
(variableDeclaration.flags & NodeFlags.Export) ||
|
||||
variableDeclaration.parent.parent.kind === SyntaxKind.ForOfStatement) {
|
||||
return textSpanFromVariableDeclaration(variableDeclaration);
|
||||
}
|
||||
else if (declarations && declarations[0] !== variableDeclaration) {
|
||||
|
||||
let declarations = variableDeclaration.parent.declarations;
|
||||
if (declarations && declarations[0] !== variableDeclaration) {
|
||||
// If we cant set breakpoint on this declaration, set it on previous one
|
||||
let indexOfCurrentDeclaration = indexOf(declarations, variableDeclaration);
|
||||
return spanInVariableDeclaration(declarations[indexOfCurrentDeclaration - 1]);
|
||||
// Because the variable declaration may be binding pattern and
|
||||
// we would like to set breakpoint in last binding element if thats the case,
|
||||
// use preceding token instead
|
||||
return spanInNode(findPrecedingToken(variableDeclaration.pos, sourceFile, variableDeclaration.parent));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +417,11 @@ namespace ts.BreakpointResolver {
|
||||
}
|
||||
|
||||
function spanInParameterDeclaration(parameter: ParameterDeclaration): TextSpan {
|
||||
if (canHaveSpanInParameterDeclaration(parameter)) {
|
||||
if (isBindingPattern(parameter.name)) {
|
||||
// set breakpoint in binding pattern
|
||||
return spanInBindingPattern(<BindingPattern>parameter.name);
|
||||
}
|
||||
else if (canHaveSpanInParameterDeclaration(parameter)) {
|
||||
return textSpan(parameter);
|
||||
}
|
||||
else {
|
||||
@@ -388,11 +478,11 @@ namespace ts.BreakpointResolver {
|
||||
case SyntaxKind.WhileStatement:
|
||||
case SyntaxKind.IfStatement:
|
||||
case SyntaxKind.ForInStatement:
|
||||
case SyntaxKind.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 SyntaxKind.ForStatement:
|
||||
case SyntaxKind.ForOfStatement:
|
||||
return spanInNodeIfStartsOnSameLine(findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]);
|
||||
}
|
||||
|
||||
@@ -400,17 +490,23 @@ namespace ts.BreakpointResolver {
|
||||
return spanInNode(block.statements[0]);
|
||||
}
|
||||
|
||||
function spanInInitializerOfForLike(forLikeStaement: ForStatement | ForOfStatement | ForInStatement): TextSpan {
|
||||
if (forLikeStaement.initializer.kind === SyntaxKind.VariableDeclarationList) {
|
||||
// declaration list, set breakpoint in first declaration
|
||||
let variableDeclarationList = <VariableDeclarationList>forLikeStaement.initializer;
|
||||
if (variableDeclarationList.declarations.length > 0) {
|
||||
return spanInNode(variableDeclarationList.declarations[0]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Expression - set breakpoint in it
|
||||
return spanInNode(forLikeStaement.initializer);
|
||||
}
|
||||
}
|
||||
|
||||
function spanInForStatement(forStatement: ForStatement): TextSpan {
|
||||
if (forStatement.initializer) {
|
||||
if (forStatement.initializer.kind === SyntaxKind.VariableDeclarationList) {
|
||||
let variableDeclarationList = <VariableDeclarationList>forStatement.initializer;
|
||||
if (variableDeclarationList.declarations.length > 0) {
|
||||
return spanInNode(variableDeclarationList.declarations[0]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return spanInNode(forStatement.initializer);
|
||||
}
|
||||
return spanInInitializerOfForLike(forStatement);
|
||||
}
|
||||
|
||||
if (forStatement.condition) {
|
||||
@@ -421,6 +517,45 @@ namespace ts.BreakpointResolver {
|
||||
}
|
||||
}
|
||||
|
||||
function spanInBindingPattern(bindingPattern: BindingPattern): TextSpan {
|
||||
// Set breakpoint in first binding element
|
||||
let firstBindingElement = forEach(bindingPattern.elements,
|
||||
element => element.kind !== SyntaxKind.OmittedExpression ? element : undefined);
|
||||
|
||||
if (firstBindingElement) {
|
||||
return spanInNode(firstBindingElement);
|
||||
}
|
||||
|
||||
// Empty binding pattern of binding element, set breakpoint on binding element
|
||||
if (bindingPattern.parent.kind === SyntaxKind.BindingElement) {
|
||||
return textSpan(bindingPattern.parent);
|
||||
}
|
||||
|
||||
// Variable declaration is used as the span
|
||||
return textSpanFromVariableDeclaration(<VariableDeclaration>bindingPattern.parent);
|
||||
}
|
||||
|
||||
function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node: DestructuringPattern): TextSpan {
|
||||
Debug.assert(node.kind !== SyntaxKind.ArrayBindingPattern && node.kind !== SyntaxKind.ObjectBindingPattern);
|
||||
const elements: NodeArray<Expression | ObjectLiteralElement> =
|
||||
node.kind === SyntaxKind.ArrayLiteralExpression ?
|
||||
(<ArrayLiteralExpression>node).elements :
|
||||
(<ObjectLiteralExpression>node).properties;
|
||||
|
||||
const firstBindingElement = forEach(elements,
|
||||
element => element.kind !== SyntaxKind.OmittedExpression ? element : undefined);
|
||||
|
||||
if (firstBindingElement) {
|
||||
return spanInNode(firstBindingElement);
|
||||
}
|
||||
|
||||
// Could be ArrayLiteral from destructuring assignment or
|
||||
// just nested element in another destructuring assignment
|
||||
// set breakpoint on assignment when parent is destructuring assignment
|
||||
// Otherwise set breakpoint for this element
|
||||
return textSpan(node.parent.kind === SyntaxKind.BinaryExpression ? node.parent : node);
|
||||
}
|
||||
|
||||
// Tokens:
|
||||
function spanInOpenBraceToken(node: Node): TextSpan {
|
||||
switch (node.parent.kind) {
|
||||
@@ -472,18 +607,52 @@ namespace ts.BreakpointResolver {
|
||||
}
|
||||
return undefined;
|
||||
|
||||
case SyntaxKind.ObjectBindingPattern:
|
||||
// Breakpoint in last binding element or binding pattern if it contains no elements
|
||||
let bindingPattern = <BindingPattern>node.parent;
|
||||
return spanInNode(lastOrUndefined(bindingPattern.elements) || bindingPattern);
|
||||
|
||||
// Default to parent node
|
||||
default:
|
||||
if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
|
||||
// Breakpoint in last binding element or binding pattern if it contains no elements
|
||||
let objectLiteral = <ObjectLiteralExpression>node.parent;
|
||||
return textSpan(lastOrUndefined(objectLiteral.properties) || objectLiteral);
|
||||
}
|
||||
return spanInNode(node.parent);
|
||||
}
|
||||
}
|
||||
|
||||
function spanInCloseBracketToken(node: Node): TextSpan {
|
||||
switch (node.parent.kind) {
|
||||
case SyntaxKind.ArrayBindingPattern:
|
||||
// Breakpoint in last binding element or binding pattern if it contains no elements
|
||||
let bindingPattern = <BindingPattern>node.parent;
|
||||
return textSpan(lastOrUndefined(bindingPattern.elements) || bindingPattern);
|
||||
|
||||
default:
|
||||
if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
|
||||
// Breakpoint in last binding element or binding pattern if it contains no elements
|
||||
let arrayLiteral = <ArrayLiteralExpression>node.parent;
|
||||
return textSpan(lastOrUndefined(arrayLiteral.elements) || arrayLiteral);
|
||||
}
|
||||
|
||||
// Default to parent node
|
||||
return spanInNode(node.parent);
|
||||
}
|
||||
}
|
||||
|
||||
function spanInOpenParenToken(node: Node): TextSpan {
|
||||
if (node.parent.kind === SyntaxKind.DoStatement) {
|
||||
// Go to while keyword and do action instead
|
||||
if (node.parent.kind === SyntaxKind.DoStatement || // Go to while keyword and do action instead
|
||||
node.parent.kind === SyntaxKind.CallExpression ||
|
||||
node.parent.kind === SyntaxKind.NewExpression) {
|
||||
return spanInPreviousNode(node);
|
||||
}
|
||||
|
||||
if (node.parent.kind === SyntaxKind.ParenthesizedExpression) {
|
||||
return spanInNextNode(node);
|
||||
}
|
||||
|
||||
// Default to parent node
|
||||
return spanInNode(node.parent);
|
||||
}
|
||||
@@ -502,6 +671,10 @@ namespace ts.BreakpointResolver {
|
||||
case SyntaxKind.WhileStatement:
|
||||
case SyntaxKind.DoStatement:
|
||||
case SyntaxKind.ForStatement:
|
||||
case SyntaxKind.ForOfStatement:
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return spanInPreviousNode(node);
|
||||
|
||||
// Default to parent node
|
||||
@@ -512,7 +685,9 @@ namespace ts.BreakpointResolver {
|
||||
|
||||
function spanInColonToken(node: Node): TextSpan {
|
||||
// Is this : specifying return annotation of the function declaration
|
||||
if (isFunctionLike(node.parent) || node.parent.kind === SyntaxKind.PropertyAssignment) {
|
||||
if (isFunctionLike(node.parent) ||
|
||||
node.parent.kind === SyntaxKind.PropertyAssignment ||
|
||||
node.parent.kind === SyntaxKind.Parameter) {
|
||||
return spanInPreviousNode(node);
|
||||
}
|
||||
|
||||
@@ -521,7 +696,7 @@ namespace ts.BreakpointResolver {
|
||||
|
||||
function spanInGreaterThanOrLessThanToken(node: Node): TextSpan {
|
||||
if (node.parent.kind === SyntaxKind.TypeAssertionExpression) {
|
||||
return spanInNode((<TypeAssertion>node.parent).expression);
|
||||
return spanInNextNode(node);
|
||||
}
|
||||
|
||||
return spanInNode(node.parent);
|
||||
@@ -530,7 +705,17 @@ namespace ts.BreakpointResolver {
|
||||
function spanInWhileKeyword(node: Node): TextSpan {
|
||||
if (node.parent.kind === SyntaxKind.DoStatement) {
|
||||
// Set span on while expression
|
||||
return textSpan(node, findNextToken((<DoStatement>node.parent).expression, node.parent));
|
||||
return textSpanEndingAtNextToken(node, (<DoStatement>node.parent).expression);
|
||||
}
|
||||
|
||||
// Default to parent node
|
||||
return spanInNode(node.parent);
|
||||
}
|
||||
|
||||
function spanInOfKeyword(node: Node): TextSpan {
|
||||
if (node.parent.kind === SyntaxKind.ForOfStatement) {
|
||||
// set using next token
|
||||
return spanInNextNode(node);
|
||||
}
|
||||
|
||||
// Default to parent node
|
||||
|
||||
@@ -387,7 +387,7 @@ namespace ts.NavigationBar {
|
||||
|
||||
function getModuleName(moduleDeclaration: ModuleDeclaration): string {
|
||||
// We want to maintain quotation marks.
|
||||
if (moduleDeclaration.name.kind === SyntaxKind.StringLiteral) {
|
||||
if (isAmbientModule(moduleDeclaration)) {
|
||||
return getTextOfNode(moduleDeclaration.name);
|
||||
}
|
||||
|
||||
|
||||
+106
-33
@@ -811,6 +811,7 @@ namespace ts {
|
||||
public nameTable: Map<string>;
|
||||
public resolvedModules: Map<ResolvedModule>;
|
||||
public imports: LiteralExpression[];
|
||||
public moduleAugmentations: LiteralExpression[];
|
||||
private namedDeclarations: Map<Declaration[]>;
|
||||
|
||||
constructor(kind: SyntaxKind, pos: number, end: number) {
|
||||
@@ -1616,6 +1617,9 @@ namespace ts {
|
||||
public static jsxOpenTagName = "jsx open tag name";
|
||||
public static jsxCloseTagName = "jsx close tag name";
|
||||
public static jsxSelfClosingTagName = "jsx self closing tag name";
|
||||
public static jsxAttribute = "jsx attribute";
|
||||
public static jsxText = "jsx text";
|
||||
public static jsxAttributeStringLiteralValue = "jsx attribute string literal value";
|
||||
}
|
||||
|
||||
export const enum ClassificationType {
|
||||
@@ -1640,7 +1644,9 @@ namespace ts {
|
||||
jsxOpenTagName = 19,
|
||||
jsxCloseTagName = 20,
|
||||
jsxSelfClosingTagName = 21,
|
||||
jsxAttribute = 22
|
||||
jsxAttribute = 22,
|
||||
jsxText = 23,
|
||||
jsxAttributeStringLiteralValue = 24,
|
||||
}
|
||||
|
||||
/// Language Service
|
||||
@@ -2013,13 +2019,6 @@ namespace ts {
|
||||
return createLanguageServiceSourceFile(sourceFile.fileName, scriptSnapshot, sourceFile.languageVersion, version, /*setNodeParents*/ true);
|
||||
}
|
||||
|
||||
export function createGetCanonicalFileName(useCaseSensitivefileNames: boolean): (fileName: string) => string {
|
||||
return useCaseSensitivefileNames
|
||||
? ((fileName) => fileName)
|
||||
: ((fileName) => fileName.toLowerCase());
|
||||
}
|
||||
|
||||
|
||||
export function createDocumentRegistry(useCaseSensitiveFileNames?: boolean, currentDirectory = ""): DocumentRegistry {
|
||||
// Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have
|
||||
// for those settings.
|
||||
@@ -3100,6 +3099,7 @@ namespace ts {
|
||||
}
|
||||
else if (kind === SyntaxKind.SlashToken && contextToken.parent.kind === SyntaxKind.JsxClosingElement) {
|
||||
isStartingCloseTag = true;
|
||||
location = contextToken;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3125,8 +3125,11 @@ namespace ts {
|
||||
}
|
||||
else if (isStartingCloseTag) {
|
||||
const tagName = (<JsxElement>contextToken.parent.parent).openingElement.tagName;
|
||||
symbols = [typeChecker.getSymbolAtLocation(tagName)];
|
||||
const tagSymbol = typeChecker.getSymbolAtLocation(tagName);
|
||||
|
||||
if (!typeChecker.isUnknownSymbol(tagSymbol)) {
|
||||
symbols = [tagSymbol];
|
||||
}
|
||||
isMemberCompletion = true;
|
||||
isNewIdentifierLocation = false;
|
||||
}
|
||||
@@ -3832,7 +3835,23 @@ namespace ts {
|
||||
}
|
||||
else {
|
||||
if (!symbols || symbols.length === 0) {
|
||||
return undefined;
|
||||
if (sourceFile.languageVariant === LanguageVariant.JSX &&
|
||||
location.parent && location.parent.kind === SyntaxKind.JsxClosingElement) {
|
||||
// In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag,
|
||||
// instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element.
|
||||
// For example:
|
||||
// var x = <div> </ /*1*/> completion list at "1" will contain "div" with type any
|
||||
const tagName = (<JsxElement>location.parent.parent).openingElement.tagName;
|
||||
entries.push({
|
||||
name: (<Identifier>tagName).text,
|
||||
kind: undefined,
|
||||
kindModifiers: undefined,
|
||||
sortText: "0",
|
||||
});
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
getCompletionEntriesFromSymbols(symbols, entries);
|
||||
@@ -4440,7 +4459,7 @@ namespace ts {
|
||||
const typeChecker = program.getTypeChecker();
|
||||
const symbol = typeChecker.getSymbolAtLocation(node);
|
||||
|
||||
if (!symbol) {
|
||||
if (!symbol || typeChecker.isUnknownSymbol(symbol)) {
|
||||
// Try getting just type at this position and show
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.Identifier:
|
||||
@@ -5492,10 +5511,8 @@ namespace ts {
|
||||
};
|
||||
}
|
||||
|
||||
function isImportOrExportSpecifierImportSymbol(symbol: Symbol) {
|
||||
return (symbol.flags & SymbolFlags.Alias) && forEach(symbol.declarations, declaration => {
|
||||
return declaration.kind === SyntaxKind.ImportSpecifier || declaration.kind === SyntaxKind.ExportSpecifier;
|
||||
});
|
||||
function isImportSpecifierSymbol(symbol: Symbol) {
|
||||
return (symbol.flags & SymbolFlags.Alias) && !!getDeclarationOfKind(symbol, SyntaxKind.ImportSpecifier);
|
||||
}
|
||||
|
||||
function getInternedName(symbol: Symbol, location: Node, declarations: Declaration[]): string {
|
||||
@@ -5939,8 +5956,17 @@ namespace ts {
|
||||
let result = [symbol];
|
||||
|
||||
// If the symbol is an alias, add what it alaises to the list
|
||||
if (isImportOrExportSpecifierImportSymbol(symbol)) {
|
||||
result.push(typeChecker.getAliasedSymbol(symbol));
|
||||
if (isImportSpecifierSymbol(symbol)) {
|
||||
result.push(typeChecker.getAliasedSymbol(symbol));
|
||||
}
|
||||
|
||||
// For export specifiers, the exported name can be refering to a local symbol, e.g.:
|
||||
// import {a} from "mod";
|
||||
// export {a as somethingElse}
|
||||
// We want the *local* declaration of 'a' as declared in the import,
|
||||
// *not* as declared within "mod" (or farther)
|
||||
if (location.parent.kind === SyntaxKind.ExportSpecifier) {
|
||||
result.push(typeChecker.getExportSpecifierLocalTargetSymbol(<ExportSpecifier>location.parent));
|
||||
}
|
||||
|
||||
// If the location is in a context sensitive location (i.e. in an object literal) try
|
||||
@@ -5986,15 +6012,43 @@ namespace ts {
|
||||
|
||||
// Add symbol of properties/methods of the same name in base classes and implemented interfaces definitions
|
||||
if (rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
|
||||
getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result);
|
||||
getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ {});
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function getPropertySymbolsFromBaseTypes(symbol: Symbol, propertyName: string, result: Symbol[]): void {
|
||||
if (symbol && symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
|
||||
/**
|
||||
* Find symbol of the given property-name and add the symbol to the given result array
|
||||
* @param symbol a symbol to start searching for the given propertyName
|
||||
* @param propertyName a name of property to serach for
|
||||
* @param result an array of symbol of found property symbols
|
||||
* @param previousIterationSymbolsCache a cache of symbol from previous iterations of calling this function to prevent infinite revisitng of the same symbol.
|
||||
* The value of previousIterationSymbol is undefined when the function is first called.
|
||||
*/
|
||||
function getPropertySymbolsFromBaseTypes(symbol: Symbol, propertyName: string, result: Symbol[],
|
||||
previousIterationSymbolsCache: SymbolTable): void {
|
||||
if (!symbol) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the current symbol is the same as the previous-iteration symbol, we can just return the symbol that has already been visited
|
||||
// This is particularly important for the following cases, so that we do not infinitely visit the same symbol.
|
||||
// For example:
|
||||
// interface C extends C {
|
||||
// /*findRef*/propName: string;
|
||||
// }
|
||||
// The first time getPropertySymbolsFromBaseTypes is called when finding-all-references at propName,
|
||||
// the symbol argument will be the symbol of an interface "C" and previousIterationSymbol is undefined,
|
||||
// the function will add any found symbol of the property-name, then its sub-routine will call
|
||||
// getPropertySymbolsFromBaseTypes again to walk up any base types to prevent revisiting already
|
||||
// visited symbol, interface "C", the sub-routine will pass the current symbol as previousIterationSymbol.
|
||||
if (hasProperty(previousIterationSymbolsCache, symbol.name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
|
||||
forEach(symbol.getDeclarations(), declaration => {
|
||||
if (declaration.kind === SyntaxKind.ClassDeclaration) {
|
||||
getPropertySymbolFromTypeReference(getClassExtendsHeritageClauseElement(<ClassDeclaration>declaration));
|
||||
@@ -6017,7 +6071,8 @@ namespace ts {
|
||||
}
|
||||
|
||||
// Visit the typeReference as well to see if it directly or indirectly use that property
|
||||
getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result);
|
||||
previousIterationSymbolsCache[symbol.name] = symbol;
|
||||
getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6030,13 +6085,24 @@ namespace ts {
|
||||
|
||||
// If the reference symbol is an alias, check if what it is aliasing is one of the search
|
||||
// symbols.
|
||||
if (isImportOrExportSpecifierImportSymbol(referenceSymbol)) {
|
||||
if (isImportSpecifierSymbol(referenceSymbol)) {
|
||||
const aliasedSymbol = typeChecker.getAliasedSymbol(referenceSymbol);
|
||||
if (searchSymbols.indexOf(aliasedSymbol) >= 0) {
|
||||
return aliasedSymbol;
|
||||
}
|
||||
}
|
||||
|
||||
// For export specifiers, it can be a local symbol, e.g.
|
||||
// import {a} from "mod";
|
||||
// export {a as somethingElse}
|
||||
// We want the local target of the export (i.e. the import symbol) and not the final target (i.e. "mod".a)
|
||||
if (referenceLocation.parent.kind === SyntaxKind.ExportSpecifier) {
|
||||
const aliasedSymbol = typeChecker.getExportSpecifierLocalTargetSymbol(<ExportSpecifier>referenceLocation.parent);
|
||||
if (searchSymbols.indexOf(aliasedSymbol) >= 0) {
|
||||
return aliasedSymbol;
|
||||
}
|
||||
}
|
||||
|
||||
// If the reference location is in an object literal, try to get the contextual type for the
|
||||
// object literal, lookup the property symbol in the contextual type, and use this symbol to
|
||||
// compare to our searchSymbol
|
||||
@@ -6058,7 +6124,7 @@ namespace ts {
|
||||
// see if any is in the list
|
||||
if (rootSymbol.parent && rootSymbol.parent.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
|
||||
const result: Symbol[] = [];
|
||||
getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result);
|
||||
getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, /*previousIterationSymbolsCache*/ {});
|
||||
return forEach(result, s => searchSymbols.indexOf(s) >= 0 ? s : undefined);
|
||||
}
|
||||
|
||||
@@ -6231,7 +6297,7 @@ namespace ts {
|
||||
return SemanticMeaning.Value | SemanticMeaning.Type;
|
||||
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
if ((<ModuleDeclaration>node).name.kind === SyntaxKind.StringLiteral) {
|
||||
if (isAmbientModule(<ModuleDeclaration>node)) {
|
||||
return SemanticMeaning.Namespace | SemanticMeaning.Value;
|
||||
}
|
||||
else if (getModuleInstanceState(node) === ModuleInstanceState.Instantiated) {
|
||||
@@ -6575,6 +6641,9 @@ namespace ts {
|
||||
case ClassificationType.jsxOpenTagName: return ClassificationTypeNames.jsxOpenTagName;
|
||||
case ClassificationType.jsxCloseTagName: return ClassificationTypeNames.jsxCloseTagName;
|
||||
case ClassificationType.jsxSelfClosingTagName: return ClassificationTypeNames.jsxSelfClosingTagName;
|
||||
case ClassificationType.jsxAttribute: return ClassificationTypeNames.jsxAttribute;
|
||||
case ClassificationType.jsxText: return ClassificationTypeNames.jsxText;
|
||||
case ClassificationType.jsxAttributeStringLiteralValue: return ClassificationTypeNames.jsxAttributeStringLiteralValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6759,7 +6828,8 @@ namespace ts {
|
||||
function classifyDisabledMergeCode(text: string, start: number, end: number) {
|
||||
// Classify the line that the ======= marker is on as a comment. Then just lex
|
||||
// all further tokens and add them to the result.
|
||||
for (var i = start; i < end; i++) {
|
||||
let i: number;
|
||||
for (i = start; i < end; i++) {
|
||||
if (isLineBreak(text.charCodeAt(i))) {
|
||||
break;
|
||||
}
|
||||
@@ -6783,12 +6853,12 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function classifyToken(token: Node): void {
|
||||
function classifyTokenOrJsxText(token: Node): void {
|
||||
if (nodeIsMissing(token)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const tokenStart = classifyLeadingTriviaAndGetTokenStart(token);
|
||||
const tokenStart = token.kind === SyntaxKind.JsxText ? token.pos : classifyLeadingTriviaAndGetTokenStart(token);
|
||||
|
||||
const tokenWidth = token.end - tokenStart;
|
||||
Debug.assert(tokenWidth >= 0);
|
||||
@@ -6824,7 +6894,8 @@ namespace ts {
|
||||
// the '=' in a variable declaration is special cased here.
|
||||
if (token.parent.kind === SyntaxKind.VariableDeclaration ||
|
||||
token.parent.kind === SyntaxKind.PropertyDeclaration ||
|
||||
token.parent.kind === SyntaxKind.Parameter) {
|
||||
token.parent.kind === SyntaxKind.Parameter ||
|
||||
token.parent.kind === SyntaxKind.JsxAttribute) {
|
||||
return ClassificationType.operator;
|
||||
}
|
||||
}
|
||||
@@ -6843,7 +6914,7 @@ namespace ts {
|
||||
return ClassificationType.numericLiteral;
|
||||
}
|
||||
else if (tokenKind === SyntaxKind.StringLiteral || tokenKind === SyntaxKind.StringLiteralType) {
|
||||
return ClassificationType.stringLiteral;
|
||||
return token.parent.kind === SyntaxKind.JsxAttribute ? ClassificationType.jsxAttributeStringLiteralValue : ClassificationType.stringLiteral;
|
||||
}
|
||||
else if (tokenKind === SyntaxKind.RegularExpressionLiteral) {
|
||||
// TODO: we should get another classification type for these literals.
|
||||
@@ -6853,6 +6924,9 @@ namespace ts {
|
||||
// TODO (drosen): we should *also* get another classification type for these literals.
|
||||
return ClassificationType.stringLiteral;
|
||||
}
|
||||
else if (tokenKind === SyntaxKind.JsxText) {
|
||||
return ClassificationType.jsxText;
|
||||
}
|
||||
else if (tokenKind === SyntaxKind.Identifier) {
|
||||
if (token) {
|
||||
switch (token.parent.kind) {
|
||||
@@ -6926,8 +7000,8 @@ namespace ts {
|
||||
const children = element.getChildren(sourceFile);
|
||||
for (let i = 0, n = children.length; i < n; i++) {
|
||||
const child = children[i];
|
||||
if (isToken(child)) {
|
||||
classifyToken(child);
|
||||
if (isToken(child) || child.kind === SyntaxKind.JsxText) {
|
||||
classifyTokenOrJsxText(child);
|
||||
}
|
||||
else {
|
||||
// Recurse into our child nodes.
|
||||
@@ -7105,8 +7179,7 @@ namespace ts {
|
||||
|
||||
const indentationStr = sourceFile.text.substr(lineStart, posLineAndChar.character);
|
||||
|
||||
// TODO: call a helper method instead once PR #4133 gets merged in.
|
||||
const newLine = host.getNewLine ? host.getNewLine() : "\r\n";
|
||||
const newLine = getNewLineOrDefaultFromHost(host);
|
||||
|
||||
let docParams = "";
|
||||
for (let i = 0, numParams = parameters.length; i < numParams; i++) {
|
||||
|
||||
@@ -946,7 +946,8 @@ namespace ts {
|
||||
};
|
||||
}
|
||||
|
||||
const configFile = parseJsonConfigFileContent(result.config, this.host, getDirectoryPath(normalizeSlashes(fileName)));
|
||||
const normalizedFileName = normalizeSlashes(fileName);
|
||||
const configFile = parseJsonConfigFileContent(result.config, this.host, getDirectoryPath(normalizedFileName), /*existingOptions*/ {}, normalizedFileName);
|
||||
|
||||
return {
|
||||
options: configFile.options,
|
||||
@@ -1056,6 +1057,6 @@ namespace TypeScript.Services {
|
||||
// TODO: it should be moved into a namespace though.
|
||||
|
||||
/* @internal */
|
||||
const toolsVersion = "1.8";
|
||||
const toolsVersion = "1.9";
|
||||
|
||||
/* tslint:enable:no-unused-variable */
|
||||
@@ -608,6 +608,36 @@ namespace ts {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export function isArrayLiteralOrObjectLiteralDestructuringPattern(node: Node) {
|
||||
if (node.kind === SyntaxKind.ArrayLiteralExpression ||
|
||||
node.kind === SyntaxKind.ObjectLiteralExpression) {
|
||||
// [a,b,c] from:
|
||||
// [a, b, c] = someExpression;
|
||||
if (node.parent.kind === SyntaxKind.BinaryExpression &&
|
||||
(<BinaryExpression>node.parent).left === node &&
|
||||
(<BinaryExpression>node.parent).operatorToken.kind === SyntaxKind.EqualsToken) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// [a, b, c] from:
|
||||
// for([a, b, c] of expression)
|
||||
if (node.parent.kind === SyntaxKind.ForOfStatement &&
|
||||
(<ForOfStatement>node.parent).initializer === node) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// [a, b, c] of
|
||||
// [x, [a, b, c] ] = someExpression
|
||||
// or
|
||||
// {x, a: {a, b, c} } = someExpression
|
||||
if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === SyntaxKind.PropertyAssignment ? node.parent.parent : node.parent)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Display-part writer helpers
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
//// [ES5For-of1.js.map]
|
||||
{"version":3,"file":"ES5For-of1.js","sourceRoot":"","sources":["ES5For-of1.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAxB,cAAK,EAAL,IAAwB,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAClB"}
|
||||
{"version":3,"file":"ES5For-of1.js","sourceRoot":"","sources":["ES5For-of1.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAf,cAAe,EAAf,IAAe,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAClB"}
|
||||
@@ -41,9 +41,9 @@ sourceFile:ES5For-of1.ts
|
||||
12> 'c'
|
||||
13> ]
|
||||
14>
|
||||
15> var v
|
||||
15> ['a', 'b', 'c']
|
||||
16>
|
||||
17> var v of ['a', 'b', 'c']
|
||||
17> ['a', 'b', 'c']
|
||||
18> )
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0)
|
||||
@@ -58,9 +58,9 @@ sourceFile:ES5For-of1.ts
|
||||
11>Emitted(1, 34) Source(1, 26) + SourceIndex(0)
|
||||
12>Emitted(1, 37) Source(1, 29) + SourceIndex(0)
|
||||
13>Emitted(1, 38) Source(1, 30) + SourceIndex(0)
|
||||
14>Emitted(1, 40) Source(1, 6) + SourceIndex(0)
|
||||
15>Emitted(1, 54) Source(1, 11) + SourceIndex(0)
|
||||
16>Emitted(1, 56) Source(1, 6) + SourceIndex(0)
|
||||
14>Emitted(1, 40) Source(1, 15) + SourceIndex(0)
|
||||
15>Emitted(1, 54) Source(1, 30) + SourceIndex(0)
|
||||
16>Emitted(1, 56) Source(1, 15) + SourceIndex(0)
|
||||
17>Emitted(1, 60) Source(1, 30) + SourceIndex(0)
|
||||
18>Emitted(1, 61) Source(1, 31) + SourceIndex(0)
|
||||
---
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
//// [ES5For-of13.js.map]
|
||||
{"version":3,"file":"ES5For-of13.js","sourceRoot":"","sources":["ES5For-of13.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAxB,cAAK,EAAL,IAAwB,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CACb"}
|
||||
{"version":3,"file":"ES5For-of13.js","sourceRoot":"","sources":["ES5For-of13.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAf,cAAe,EAAf,IAAe,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CACb"}
|
||||
@@ -41,9 +41,9 @@ sourceFile:ES5For-of13.ts
|
||||
12> 'c'
|
||||
13> ]
|
||||
14>
|
||||
15> let v
|
||||
15> ['a', 'b', 'c']
|
||||
16>
|
||||
17> let v of ['a', 'b', 'c']
|
||||
17> ['a', 'b', 'c']
|
||||
18> )
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0)
|
||||
@@ -58,9 +58,9 @@ sourceFile:ES5For-of13.ts
|
||||
11>Emitted(1, 34) Source(1, 26) + SourceIndex(0)
|
||||
12>Emitted(1, 37) Source(1, 29) + SourceIndex(0)
|
||||
13>Emitted(1, 38) Source(1, 30) + SourceIndex(0)
|
||||
14>Emitted(1, 40) Source(1, 6) + SourceIndex(0)
|
||||
15>Emitted(1, 54) Source(1, 11) + SourceIndex(0)
|
||||
16>Emitted(1, 56) Source(1, 6) + SourceIndex(0)
|
||||
14>Emitted(1, 40) Source(1, 15) + SourceIndex(0)
|
||||
15>Emitted(1, 54) Source(1, 30) + SourceIndex(0)
|
||||
16>Emitted(1, 56) Source(1, 15) + SourceIndex(0)
|
||||
17>Emitted(1, 60) Source(1, 30) + SourceIndex(0)
|
||||
18>Emitted(1, 61) Source(1, 31) + SourceIndex(0)
|
||||
---
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
//// [ES5For-of25.js.map]
|
||||
{"version":3,"file":"ES5For-of25.js","sourceRoot":"","sources":["ES5For-of25.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAClB,GAAG,CAAC,CAAU,UAAC,EAAD,OAAC,EAAV,eAAK,EAAL,IAAU,CAAC;IAAX,IAAI,CAAC,UAAA;IACN,CAAC,CAAC;IACF,CAAC,CAAC;CACL"}
|
||||
{"version":3,"file":"ES5For-of25.js","sourceRoot":"","sources":["ES5For-of25.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAClB,GAAG,CAAC,CAAU,UAAC,EAAD,OAAC,EAAD,eAAC,EAAD,IAAC,CAAC;IAAX,IAAI,CAAC,UAAA;IACN,CAAC,CAAC;IACF,CAAC,CAAC;CACL"}
|
||||
@@ -69,9 +69,9 @@ sourceFile:ES5For-of25.ts
|
||||
6 >
|
||||
7 > a
|
||||
8 >
|
||||
9 > var v
|
||||
9 > a
|
||||
10>
|
||||
11> var v of a
|
||||
11> a
|
||||
12> )
|
||||
1->Emitted(2, 1) Source(2, 1) + SourceIndex(0)
|
||||
2 >Emitted(2, 4) Source(2, 4) + SourceIndex(0)
|
||||
@@ -80,9 +80,9 @@ sourceFile:ES5For-of25.ts
|
||||
5 >Emitted(2, 16) Source(2, 16) + SourceIndex(0)
|
||||
6 >Emitted(2, 18) Source(2, 15) + SourceIndex(0)
|
||||
7 >Emitted(2, 25) Source(2, 16) + SourceIndex(0)
|
||||
8 >Emitted(2, 27) Source(2, 6) + SourceIndex(0)
|
||||
9 >Emitted(2, 42) Source(2, 11) + SourceIndex(0)
|
||||
10>Emitted(2, 44) Source(2, 6) + SourceIndex(0)
|
||||
8 >Emitted(2, 27) Source(2, 15) + SourceIndex(0)
|
||||
9 >Emitted(2, 42) Source(2, 16) + SourceIndex(0)
|
||||
10>Emitted(2, 44) Source(2, 15) + SourceIndex(0)
|
||||
11>Emitted(2, 48) Source(2, 16) + SourceIndex(0)
|
||||
12>Emitted(2, 49) Source(2, 17) + SourceIndex(0)
|
||||
---
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
//// [ES5For-of26.js.map]
|
||||
{"version":3,"file":"ES5For-of26.js","sourceRoot":"","sources":["ES5For-of26.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAuB,UAAM,EAAN,MAAC,CAAC,EAAE,CAAC,CAAC,EAA5B,cAAkB,EAAlB,IAA4B,CAAC;IAA7B,6BAAK,CAAC,mBAAG,CAAC,mBAAE,CAAC,mBAAG,CAAC,KAAC;IACnB,CAAC,CAAC;IACF,CAAC,CAAC;CACL"}
|
||||
{"version":3,"file":"ES5For-of26.js","sourceRoot":"","sources":["ES5For-of26.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAuB,UAAM,EAAN,MAAC,CAAC,EAAE,CAAC,CAAC,EAAN,cAAM,EAAN,IAAM,CAAC;IAA7B,eAAkB,EAAb,UAAK,EAAL,0BAAK,EAAE,UAAK,EAAL,0BAAK;IAClB,CAAC,CAAC;IACF,CAAC,CAAC;CACL"}
|
||||
@@ -38,9 +38,9 @@ sourceFile:ES5For-of26.ts
|
||||
10> 3
|
||||
11> ]
|
||||
12>
|
||||
13> var [a = 0, b = 1]
|
||||
13> [2, 3]
|
||||
14>
|
||||
15> var [a = 0, b = 1] of [2, 3]
|
||||
15> [2, 3]
|
||||
16> )
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0)
|
||||
@@ -53,50 +53,50 @@ sourceFile:ES5For-of26.ts
|
||||
9 >Emitted(1, 27) Source(1, 32) + SourceIndex(0)
|
||||
10>Emitted(1, 28) Source(1, 33) + SourceIndex(0)
|
||||
11>Emitted(1, 29) Source(1, 34) + SourceIndex(0)
|
||||
12>Emitted(1, 31) Source(1, 6) + SourceIndex(0)
|
||||
13>Emitted(1, 45) Source(1, 24) + SourceIndex(0)
|
||||
14>Emitted(1, 47) Source(1, 6) + SourceIndex(0)
|
||||
12>Emitted(1, 31) Source(1, 28) + SourceIndex(0)
|
||||
13>Emitted(1, 45) Source(1, 34) + SourceIndex(0)
|
||||
14>Emitted(1, 47) Source(1, 28) + SourceIndex(0)
|
||||
15>Emitted(1, 51) Source(1, 34) + SourceIndex(0)
|
||||
16>Emitted(1, 52) Source(1, 35) + SourceIndex(0)
|
||||
---
|
||||
>>> var _b = _a[_i], _c = _b[0], a = _c === void 0 ? 0 : _c, _d = _b[1], b = _d === void 0 ? 1 : _d;
|
||||
1->^^^^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
3 > ^
|
||||
4 > ^^^^^^^^^^^^^^^^^^^
|
||||
5 > ^
|
||||
6 > ^^^^^^^^^^^^^^^^^^^
|
||||
7 > ^
|
||||
8 > ^^^^^^^^^^^^^^^^^^^
|
||||
9 > ^
|
||||
10> ^^^^^
|
||||
2 > ^^^^^^^^^^^^^^^
|
||||
3 > ^^
|
||||
4 > ^^^^^^^^^^
|
||||
5 > ^^
|
||||
6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
7 > ^^
|
||||
8 > ^^^^^^^^^^
|
||||
9 > ^^
|
||||
10> ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
1->
|
||||
2 > var [
|
||||
3 > a
|
||||
4 > =
|
||||
5 > 0
|
||||
6 > ,
|
||||
7 > b
|
||||
8 > =
|
||||
9 > 1
|
||||
10> ]
|
||||
2 > var [a = 0, b = 1]
|
||||
3 >
|
||||
4 > a = 0
|
||||
5 >
|
||||
6 > a = 0
|
||||
7 > ,
|
||||
8 > b = 1
|
||||
9 >
|
||||
10> b = 1
|
||||
1->Emitted(2, 5) Source(1, 6) + SourceIndex(0)
|
||||
2 >Emitted(2, 34) Source(1, 11) + SourceIndex(0)
|
||||
3 >Emitted(2, 35) Source(1, 12) + SourceIndex(0)
|
||||
4 >Emitted(2, 54) Source(1, 15) + SourceIndex(0)
|
||||
5 >Emitted(2, 55) Source(1, 16) + SourceIndex(0)
|
||||
6 >Emitted(2, 74) Source(1, 18) + SourceIndex(0)
|
||||
7 >Emitted(2, 75) Source(1, 19) + SourceIndex(0)
|
||||
8 >Emitted(2, 94) Source(1, 22) + SourceIndex(0)
|
||||
9 >Emitted(2, 95) Source(1, 23) + SourceIndex(0)
|
||||
10>Emitted(2, 100) Source(1, 24) + SourceIndex(0)
|
||||
2 >Emitted(2, 20) Source(1, 24) + SourceIndex(0)
|
||||
3 >Emitted(2, 22) Source(1, 11) + SourceIndex(0)
|
||||
4 >Emitted(2, 32) Source(1, 16) + SourceIndex(0)
|
||||
5 >Emitted(2, 34) Source(1, 11) + SourceIndex(0)
|
||||
6 >Emitted(2, 60) Source(1, 16) + SourceIndex(0)
|
||||
7 >Emitted(2, 62) Source(1, 18) + SourceIndex(0)
|
||||
8 >Emitted(2, 72) Source(1, 23) + SourceIndex(0)
|
||||
9 >Emitted(2, 74) Source(1, 18) + SourceIndex(0)
|
||||
10>Emitted(2, 100) Source(1, 23) + SourceIndex(0)
|
||||
---
|
||||
>>> a;
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^
|
||||
4 > ^->
|
||||
1 > of [2, 3]) {
|
||||
1 >] of [2, 3]) {
|
||||
>
|
||||
2 > a
|
||||
3 > ;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
//// [ES5For-of3.js.map]
|
||||
{"version":3,"file":"ES5For-of3.js","sourceRoot":"","sources":["ES5For-of3.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAxB,cAAK,EAAL,IAAwB,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CAAA"}
|
||||
{"version":3,"file":"ES5For-of3.js","sourceRoot":"","sources":["ES5For-of3.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAU,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAf,cAAe,EAAf,IAAe,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CAAA"}
|
||||
@@ -41,9 +41,9 @@ sourceFile:ES5For-of3.ts
|
||||
12> 'c'
|
||||
13> ]
|
||||
14>
|
||||
15> var v
|
||||
15> ['a', 'b', 'c']
|
||||
16>
|
||||
17> var v of ['a', 'b', 'c']
|
||||
17> ['a', 'b', 'c']
|
||||
18> )
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0)
|
||||
@@ -58,9 +58,9 @@ sourceFile:ES5For-of3.ts
|
||||
11>Emitted(1, 34) Source(1, 26) + SourceIndex(0)
|
||||
12>Emitted(1, 37) Source(1, 29) + SourceIndex(0)
|
||||
13>Emitted(1, 38) Source(1, 30) + SourceIndex(0)
|
||||
14>Emitted(1, 40) Source(1, 6) + SourceIndex(0)
|
||||
15>Emitted(1, 54) Source(1, 11) + SourceIndex(0)
|
||||
16>Emitted(1, 56) Source(1, 6) + SourceIndex(0)
|
||||
14>Emitted(1, 40) Source(1, 15) + SourceIndex(0)
|
||||
15>Emitted(1, 54) Source(1, 30) + SourceIndex(0)
|
||||
16>Emitted(1, 56) Source(1, 15) + SourceIndex(0)
|
||||
17>Emitted(1, 60) Source(1, 30) + SourceIndex(0)
|
||||
18>Emitted(1, 61) Source(1, 31) + SourceIndex(0)
|
||||
---
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
//// [ES5For-of8.js.map]
|
||||
{"version":3,"file":"ES5For-of8.js","sourceRoot":"","sources":["ES5For-of8.ts"],"names":[],"mappings":"AAAA;IACI,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;AACD,GAAG,CAAC,CAAY,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAA1B,cAAO,EAAP,IAA0B,CAAC;IAA3B,GAAG,EAAE,CAAC,CAAC,SAAA;IACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;CACnB"}
|
||||
{"version":3,"file":"ES5For-of8.js","sourceRoot":"","sources":["ES5For-of8.ts"],"names":[],"mappings":"AAAA;IACI,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;AACD,GAAG,CAAC,CAAY,UAAe,EAAf,MAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAf,cAAe,EAAf,IAAe,CAAC;IAA3B,GAAG,EAAE,CAAC,CAAC,SAAA;IACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;CACnB"}
|
||||
@@ -88,9 +88,9 @@ sourceFile:ES5For-of8.ts
|
||||
12> 'c'
|
||||
13> ]
|
||||
14>
|
||||
15> foo().x
|
||||
15> ['a', 'b', 'c']
|
||||
16>
|
||||
17> foo().x of ['a', 'b', 'c']
|
||||
17> ['a', 'b', 'c']
|
||||
18> )
|
||||
1->Emitted(4, 1) Source(4, 1) + SourceIndex(0)
|
||||
2 >Emitted(4, 4) Source(4, 4) + SourceIndex(0)
|
||||
@@ -105,9 +105,9 @@ sourceFile:ES5For-of8.ts
|
||||
11>Emitted(4, 34) Source(4, 28) + SourceIndex(0)
|
||||
12>Emitted(4, 37) Source(4, 31) + SourceIndex(0)
|
||||
13>Emitted(4, 38) Source(4, 32) + SourceIndex(0)
|
||||
14>Emitted(4, 40) Source(4, 6) + SourceIndex(0)
|
||||
15>Emitted(4, 54) Source(4, 13) + SourceIndex(0)
|
||||
16>Emitted(4, 56) Source(4, 6) + SourceIndex(0)
|
||||
14>Emitted(4, 40) Source(4, 17) + SourceIndex(0)
|
||||
15>Emitted(4, 54) Source(4, 32) + SourceIndex(0)
|
||||
16>Emitted(4, 56) Source(4, 17) + SourceIndex(0)
|
||||
17>Emitted(4, 60) Source(4, 32) + SourceIndex(0)
|
||||
18>Emitted(4, 61) Source(4, 33) + SourceIndex(0)
|
||||
---
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(2,3): error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(3,11): error TS2304: Cannot find name 'foo'.
|
||||
tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(3,11): error TS2663: Cannot find name 'foo'. Did you mean the instance member 'this.foo'?
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts (2 errors) ====
|
||||
@@ -9,6 +9,6 @@ tests/cases/conformance/es6/yieldExpressions/YieldExpression11_es6.ts(3,11): err
|
||||
!!! error TS1220: Generators are only available when targeting ECMAScript 6 or higher.
|
||||
yield(foo);
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
!!! error TS2663: Cannot find name 'foo'. Did you mean the instance member 'this.foo'?
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
tests/cases/compiler/accessInstanceMemberFromStaticMethod01.ts(5,17): error TS2662: Cannot find name 'foo'. Did you mean the static member 'C.foo'?
|
||||
|
||||
|
||||
==== tests/cases/compiler/accessInstanceMemberFromStaticMethod01.ts (1 errors) ====
|
||||
class C {
|
||||
static foo: string;
|
||||
|
||||
bar() {
|
||||
let k = foo;
|
||||
~~~
|
||||
!!! error TS2662: Cannot find name 'foo'. Did you mean the static member 'C.foo'?
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [accessInstanceMemberFromStaticMethod01.ts]
|
||||
class C {
|
||||
static foo: string;
|
||||
|
||||
bar() {
|
||||
let k = foo;
|
||||
}
|
||||
}
|
||||
|
||||
//// [accessInstanceMemberFromStaticMethod01.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
var k = foo;
|
||||
};
|
||||
return C;
|
||||
}());
|
||||
@@ -0,0 +1,13 @@
|
||||
tests/cases/compiler/accessStaticMemberFromInstanceMethod01.ts(5,17): error TS2304: Cannot find name 'foo'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/accessStaticMemberFromInstanceMethod01.ts (1 errors) ====
|
||||
class C {
|
||||
foo: string;
|
||||
|
||||
static bar() {
|
||||
let k = foo;
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
//// [accessStaticMemberFromInstanceMethod01.ts]
|
||||
class C {
|
||||
foo: string;
|
||||
|
||||
static bar() {
|
||||
let k = foo;
|
||||
}
|
||||
}
|
||||
|
||||
//// [accessStaticMemberFromInstanceMethod01.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.bar = function () {
|
||||
var k = foo;
|
||||
};
|
||||
return C;
|
||||
}());
|
||||
@@ -1,5 +1,4 @@
|
||||
tests/cases/compiler/aliasAssignments_1.ts(3,1): error TS2322: Type 'number' is not assignable to type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"'.
|
||||
Property 'someClass' is missing in type 'Number'.
|
||||
tests/cases/compiler/aliasAssignments_1.ts(5,1): error TS2322: Type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"' is not assignable to type 'number'.
|
||||
|
||||
|
||||
@@ -9,7 +8,6 @@ tests/cases/compiler/aliasAssignments_1.ts(5,1): error TS2322: Type 'typeof "tes
|
||||
x = 1; // Should be error
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'typeof "tests/cases/compiler/aliasAssignments_moduleA"'.
|
||||
!!! error TS2322: Property 'someClass' is missing in type 'Number'.
|
||||
var y = 1;
|
||||
y = moduleA; // should be error
|
||||
~
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(5,16): error TS2435: Ambient modules cannot be nested in other modules or namespaces.
|
||||
tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(5,16): error TS2664: Invalid module name in augmentation, module 'ext' cannot be found.
|
||||
tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(10,22): error TS2307: Cannot find module 'ext'.
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(10,22): err
|
||||
|
||||
declare module "ext" {
|
||||
~~~~~
|
||||
!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces.
|
||||
!!! error TS2664: Invalid module name in augmentation, module 'ext' cannot be found.
|
||||
export class C { }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts(2,5): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible.
|
||||
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts(2,27): error TS2435: Ambient modules cannot be nested in other modules or namespaces.
|
||||
|
||||
|
||||
==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts (1 errors) ====
|
||||
==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts (2 errors) ====
|
||||
module M {
|
||||
export declare module "M" { }
|
||||
~~~~~~
|
||||
!!! error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible.
|
||||
~~~
|
||||
!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces.
|
||||
}
|
||||
+6
-3
@@ -1,7 +1,10 @@
|
||||
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts(1,23): error TS2435: Ambient modules cannot be nested in other modules or namespaces.
|
||||
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts(1,1): error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible.
|
||||
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts(1,23): error TS2664: Invalid module name in augmentation, module 'M' cannot be found.
|
||||
|
||||
|
||||
==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts (1 errors) ====
|
||||
==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts (2 errors) ====
|
||||
export declare module "M" { }
|
||||
~~~~~~
|
||||
!!! error TS2668: 'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible.
|
||||
~~~
|
||||
!!! error TS2435: Ambient modules cannot be nested in other modules or namespaces.
|
||||
!!! error TS2664: Invalid module name in augmentation, module 'M' cannot be found.
|
||||
@@ -1,5 +1,4 @@
|
||||
tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts(3,5): error TS2322: Type 'number' is not assignable to type 'IArguments'.
|
||||
Property 'length' is missing in type 'Number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts (1 errors) ====
|
||||
@@ -8,5 +7,4 @@ tests/cases/compiler/argumentsBindsToFunctionScopeArgumentList.ts(3,5): error TS
|
||||
arguments = 10; /// This shouldnt be of type number and result in error.
|
||||
~~~~~~~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'IArguments'.
|
||||
!!! error TS2322: Property 'length' is missing in type 'Number'.
|
||||
}
|
||||
@@ -26,10 +26,13 @@ tests/cases/compiler/arrayAssignmentTest1.ts(70,1): error TS2322: Type 'C3[]' is
|
||||
Property 'C2M1' is missing in type 'C3'.
|
||||
tests/cases/compiler/arrayAssignmentTest1.ts(75,1): error TS2322: Type 'C2[]' is not assignable to type 'C3[]'.
|
||||
Type 'C2' is not assignable to type 'C3'.
|
||||
Property 'CM3M1' is missing in type 'C2'.
|
||||
tests/cases/compiler/arrayAssignmentTest1.ts(76,1): error TS2322: Type 'C1[]' is not assignable to type 'C3[]'.
|
||||
Type 'C1' is not assignable to type 'C3'.
|
||||
Property 'CM3M1' is missing in type 'C1'.
|
||||
tests/cases/compiler/arrayAssignmentTest1.ts(77,1): error TS2322: Type 'I1[]' is not assignable to type 'C3[]'.
|
||||
Type 'I1' is not assignable to type 'C3'.
|
||||
Property 'CM3M1' is missing in type 'I1'.
|
||||
tests/cases/compiler/arrayAssignmentTest1.ts(79,1): error TS2322: Type '() => C1' is not assignable to type 'any[]'.
|
||||
Property 'push' is missing in type '() => C1'.
|
||||
tests/cases/compiler/arrayAssignmentTest1.ts(80,1): error TS2322: Type '{ one: number; }' is not assignable to type 'any[]'.
|
||||
@@ -159,14 +162,17 @@ tests/cases/compiler/arrayAssignmentTest1.ts(85,1): error TS2322: Type 'I1' is n
|
||||
~~~~~~
|
||||
!!! error TS2322: Type 'C2[]' is not assignable to type 'C3[]'.
|
||||
!!! error TS2322: Type 'C2' is not assignable to type 'C3'.
|
||||
!!! error TS2322: Property 'CM3M1' is missing in type 'C2'.
|
||||
arr_c3 = arr_c1_2; // should be an error - is
|
||||
~~~~~~
|
||||
!!! error TS2322: Type 'C1[]' is not assignable to type 'C3[]'.
|
||||
!!! error TS2322: Type 'C1' is not assignable to type 'C3'.
|
||||
!!! error TS2322: Property 'CM3M1' is missing in type 'C1'.
|
||||
arr_c3 = arr_i1_2; // should be an error - is
|
||||
~~~~~~
|
||||
!!! error TS2322: Type 'I1[]' is not assignable to type 'C3[]'.
|
||||
!!! error TS2322: Type 'I1' is not assignable to type 'C3'.
|
||||
!!! error TS2322: Property 'CM3M1' is missing in type 'I1'.
|
||||
|
||||
arr_any = f1; // should be an error - is
|
||||
~~~~~~~
|
||||
|
||||
@@ -18,7 +18,6 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error
|
||||
Types of parameters 'items' and 'items' are incompatible.
|
||||
Type 'number | string' is not assignable to type 'Number'.
|
||||
Type 'string' is not assignable to type 'Number'.
|
||||
Property 'toFixed' is missing in type 'String'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts (6 errors) ====
|
||||
@@ -82,5 +81,4 @@ tests/cases/conformance/expressions/arrayLiterals/arrayLiterals3.ts(34,5): error
|
||||
!!! error TS2322: Types of parameters 'items' and 'items' are incompatible.
|
||||
!!! error TS2322: Type 'number | string' is not assignable to type 'Number'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'Number'.
|
||||
!!! error TS2322: Property 'toFixed' is missing in type 'String'.
|
||||
|
||||
@@ -4,7 +4,6 @@ tests/cases/compiler/arraySigChecking.ts(18,5): error TS2322: Type 'void[]' is n
|
||||
tests/cases/compiler/arraySigChecking.ts(22,1): error TS2322: Type 'number[][]' is not assignable to type 'number[][][]'.
|
||||
Type 'number[]' is not assignable to type 'number[][]'.
|
||||
Type 'number' is not assignable to type 'number[]'.
|
||||
Property 'length' is missing in type 'Number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/arraySigChecking.ts (3 errors) ====
|
||||
@@ -39,7 +38,6 @@ tests/cases/compiler/arraySigChecking.ts(22,1): error TS2322: Type 'number[][]'
|
||||
!!! error TS2322: Type 'number[][]' is not assignable to type 'number[][][]'.
|
||||
!!! error TS2322: Type 'number[]' is not assignable to type 'number[][]'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'number[]'.
|
||||
!!! error TS2322: Property 'length' is missing in type 'Number'.
|
||||
|
||||
function isEmpty(l: { length: number }) {
|
||||
return l.length === 0;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,5): error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'.
|
||||
Property 'isArray' is missing in type 'Number'.
|
||||
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,22): error TS1005: '=' expected.
|
||||
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(6,30): error TS1109: Expression expected.
|
||||
tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(7,5): error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'.
|
||||
@@ -16,7 +15,6 @@ tests/cases/conformance/types/specifyingTypes/typeLiterals/arrayTypeOfTypeOf.ts(
|
||||
var xs3: typeof Array<number>;
|
||||
~~~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'ArrayConstructor'.
|
||||
!!! error TS2322: Property 'isArray' is missing in type 'Number'.
|
||||
~
|
||||
!!! error TS1005: '=' expected.
|
||||
~
|
||||
|
||||
@@ -3,9 +3,7 @@ tests/cases/compiler/assignmentCompat1.ts(4,1): error TS2322: Type '{ [index: st
|
||||
tests/cases/compiler/assignmentCompat1.ts(6,1): error TS2322: Type '{ [index: number]: any; }' is not assignable to type '{ one: number; }'.
|
||||
Property 'one' is missing in type '{ [index: number]: any; }'.
|
||||
tests/cases/compiler/assignmentCompat1.ts(8,1): error TS2322: Type 'string' is not assignable to type '{ [index: string]: any; }'.
|
||||
Index signature is missing in type 'String'.
|
||||
tests/cases/compiler/assignmentCompat1.ts(10,1): error TS2322: Type 'boolean' is not assignable to type '{ [index: number]: any; }'.
|
||||
Index signature is missing in type 'Boolean'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompat1.ts (4 errors) ====
|
||||
@@ -25,11 +23,9 @@ tests/cases/compiler/assignmentCompat1.ts(10,1): error TS2322: Type 'boolean' is
|
||||
y = "foo"; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '{ [index: string]: any; }'.
|
||||
!!! error TS2322: Index signature is missing in type 'String'.
|
||||
z = "foo"; // OK, string has numeric indexer
|
||||
z = false; // Error
|
||||
~
|
||||
!!! error TS2322: Type 'boolean' is not assignable to type '{ [index: number]: any; }'.
|
||||
!!! error TS2322: Index signature is missing in type 'Boolean'.
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts(53,9): error TS2322: Type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type '<T extends Base, U extends Derived>(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U'.
|
||||
Types of parameters 'y' and 'y' are incompatible.
|
||||
Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'.
|
||||
Types of parameters 'arg2' and 'arg2' are incompatible.
|
||||
Type 'Base' is not assignable to type '{ foo: number; }'.
|
||||
Types of property 'foo' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithCallSignatures4.ts (2 errors) ====
|
||||
@@ -76,6 +80,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
!!! error TS2322: Type '(x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type '<T extends Base, U extends Derived>(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U'.
|
||||
!!! error TS2322: Types of parameters 'y' and 'y' are incompatible.
|
||||
!!! error TS2322: Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'.
|
||||
!!! error TS2322: Types of parameters 'arg2' and 'arg2' are incompatible.
|
||||
!!! error TS2322: Type 'Base' is not assignable to type '{ foo: number; }'.
|
||||
!!! error TS2322: Types of property 'foo' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
var b10: <T extends Derived>(...x: T[]) => T;
|
||||
|
||||
@@ -8,6 +8,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(53,9): error TS2322: Type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type 'new <T extends Base, U extends Derived>(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U'.
|
||||
Types of parameters 'y' and 'y' are incompatible.
|
||||
Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'.
|
||||
Types of parameters 'arg2' and 'arg2' are incompatible.
|
||||
Type 'Base' is not assignable to type '{ foo: number; }'.
|
||||
Types of property 'foo' are incompatible.
|
||||
Type 'string' is not assignable to type 'number'.
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(77,9): error TS2322: Type 'new <T>(x: (a: T) => T) => T[]' is not assignable to type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '(a: any) => any' is not assignable to type '{ new (a: number): number; new (a?: number): number; }'.
|
||||
@@ -15,6 +19,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(78,9): error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new <T>(x: (a: T) => T) => T[]'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'.
|
||||
Type '{ new (a: number): number; new (a?: number): number; }' provides no match for the signature '(a: any): any'
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(81,9): error TS2322: Type 'new <T>(x: (a: T) => T) => any[]' is not assignable to type '{ new (x: { new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }): any[]; new (x: { new <T extends Derived2>(a: T): T; new <T extends Base>(a: T): T; }): any[]; }'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '(a: any) => any' is not assignable to type '{ new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }'.
|
||||
@@ -22,6 +27,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts(82,9): error TS2322: Type '{ new (x: { new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }): any[]; new (x: { new <T extends Derived2>(a: T): T; new <T extends Base>(a: T): T; }): any[]; }' is not assignable to type 'new <T>(x: (a: T) => T) => any[]'.
|
||||
Types of parameters 'x' and 'x' are incompatible.
|
||||
Type '{ new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }' is not assignable to type '(a: any) => any'.
|
||||
Type '{ new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }' provides no match for the signature '(a: any): any'
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithConstructSignatures4.ts (6 errors) ====
|
||||
@@ -90,6 +96,10 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
!!! error TS2322: Type 'new (x: (arg: Base) => Derived, y: (arg2: Base) => Derived) => (r: Base) => Derived' is not assignable to type 'new <T extends Base, U extends Derived>(x: (arg: T) => U, y: (arg2: { foo: number; }) => U) => (r: T) => U'.
|
||||
!!! error TS2322: Types of parameters 'y' and 'y' are incompatible.
|
||||
!!! error TS2322: Type '(arg2: Base) => Derived' is not assignable to type '(arg2: { foo: number; }) => any'.
|
||||
!!! error TS2322: Types of parameters 'arg2' and 'arg2' are incompatible.
|
||||
!!! error TS2322: Type 'Base' is not assignable to type '{ foo: number; }'.
|
||||
!!! error TS2322: Types of property 'foo' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
||||
|
||||
|
||||
var b10: new <T extends Derived>(...x: T[]) => T;
|
||||
@@ -124,6 +134,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
!!! error TS2322: Type '{ new (x: { new (a: number): number; new (a?: number): number; }): number[]; new (x: { new (a: boolean): boolean; new (a?: boolean): boolean; }): boolean[]; }' is not assignable to type 'new <T>(x: (a: T) => T) => T[]'.
|
||||
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2322: Type '{ new (a: number): number; new (a?: number): number; }' is not assignable to type '(a: any) => any'.
|
||||
!!! error TS2322: Type '{ new (a: number): number; new (a?: number): number; }' provides no match for the signature '(a: any): any'
|
||||
|
||||
var b17: new <T>(x: (a: T) => T) => any[];
|
||||
a17 = b17; // error
|
||||
@@ -137,6 +148,7 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignme
|
||||
!!! error TS2322: Type '{ new (x: { new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }): any[]; new (x: { new <T extends Derived2>(a: T): T; new <T extends Base>(a: T): T; }): any[]; }' is not assignable to type 'new <T>(x: (a: T) => T) => any[]'.
|
||||
!!! error TS2322: Types of parameters 'x' and 'x' are incompatible.
|
||||
!!! error TS2322: Type '{ new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }' is not assignable to type '(a: any) => any'.
|
||||
!!! error TS2322: Type '{ new <T extends Derived>(a: T): T; new <T extends Base>(a: T): T; }' provides no match for the signature '(a: any): any'
|
||||
}
|
||||
|
||||
module WithGenericSignaturesInBaseType {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
tests/cases/compiler/assignmentCompatability16.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: any[]; }'.
|
||||
Types of property 'one' are incompatible.
|
||||
Type 'number' is not assignable to type 'any[]'.
|
||||
Property 'length' is missing in type 'Number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatability16.ts (1 errors) ====
|
||||
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability16.ts(9,1): error TS2322: Type 'inte
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: any[]; }'.
|
||||
!!! error TS2322: Types of property 'one' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'any[]'.
|
||||
!!! error TS2322: Property 'length' is missing in type 'Number'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'any[]'.
|
||||
@@ -1,7 +1,6 @@
|
||||
tests/cases/compiler/assignmentCompatability17.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ two: any[]; }'.
|
||||
Types of property 'two' are incompatible.
|
||||
Type 'string' is not assignable to type 'any[]'.
|
||||
Property 'push' is missing in type 'String'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatability17.ts (1 errors) ====
|
||||
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability17.ts(9,1): error TS2322: Type 'inte
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ two: any[]; }'.
|
||||
!!! error TS2322: Types of property 'two' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'any[]'.
|
||||
!!! error TS2322: Property 'push' is missing in type 'String'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'any[]'.
|
||||
@@ -1,7 +1,6 @@
|
||||
tests/cases/compiler/assignmentCompatability18.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: number[]; }'.
|
||||
Types of property 'one' are incompatible.
|
||||
Type 'number' is not assignable to type 'number[]'.
|
||||
Property 'length' is missing in type 'Number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatability18.ts (1 errors) ====
|
||||
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability18.ts(9,1): error TS2322: Type 'inte
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: number[]; }'.
|
||||
!!! error TS2322: Types of property 'one' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'number[]'.
|
||||
!!! error TS2322: Property 'length' is missing in type 'Number'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'number[]'.
|
||||
@@ -1,7 +1,6 @@
|
||||
tests/cases/compiler/assignmentCompatability19.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ two: number[]; }'.
|
||||
Types of property 'two' are incompatible.
|
||||
Type 'string' is not assignable to type 'number[]'.
|
||||
Property 'push' is missing in type 'String'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatability19.ts (1 errors) ====
|
||||
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability19.ts(9,1): error TS2322: Type 'inte
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ two: number[]; }'.
|
||||
!!! error TS2322: Types of property 'two' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number[]'.
|
||||
!!! error TS2322: Property 'push' is missing in type 'String'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number[]'.
|
||||
@@ -1,7 +1,6 @@
|
||||
tests/cases/compiler/assignmentCompatability20.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: string[]; }'.
|
||||
Types of property 'one' are incompatible.
|
||||
Type 'number' is not assignable to type 'string[]'.
|
||||
Property 'length' is missing in type 'Number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatability20.ts (1 errors) ====
|
||||
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability20.ts(9,1): error TS2322: Type 'inte
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: string[]; }'.
|
||||
!!! error TS2322: Types of property 'one' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string[]'.
|
||||
!!! error TS2322: Property 'length' is missing in type 'Number'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string[]'.
|
||||
@@ -1,7 +1,6 @@
|
||||
tests/cases/compiler/assignmentCompatability21.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ two: string[]; }'.
|
||||
Types of property 'two' are incompatible.
|
||||
Type 'string' is not assignable to type 'string[]'.
|
||||
Property 'push' is missing in type 'String'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatability21.ts (1 errors) ====
|
||||
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability21.ts(9,1): error TS2322: Type 'inte
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ two: string[]; }'.
|
||||
!!! error TS2322: Types of property 'two' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'string[]'.
|
||||
!!! error TS2322: Property 'push' is missing in type 'String'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'string[]'.
|
||||
@@ -1,7 +1,6 @@
|
||||
tests/cases/compiler/assignmentCompatability22.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: boolean[]; }'.
|
||||
Types of property 'one' are incompatible.
|
||||
Type 'number' is not assignable to type 'boolean[]'.
|
||||
Property 'length' is missing in type 'Number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatability22.ts (1 errors) ====
|
||||
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability22.ts(9,1): error TS2322: Type 'inte
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: boolean[]; }'.
|
||||
!!! error TS2322: Types of property 'one' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'boolean[]'.
|
||||
!!! error TS2322: Property 'length' is missing in type 'Number'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'boolean[]'.
|
||||
@@ -1,7 +1,6 @@
|
||||
tests/cases/compiler/assignmentCompatability23.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ two: boolean[]; }'.
|
||||
Types of property 'two' are incompatible.
|
||||
Type 'string' is not assignable to type 'boolean[]'.
|
||||
Property 'push' is missing in type 'String'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatability23.ts (1 errors) ====
|
||||
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability23.ts(9,1): error TS2322: Type 'inte
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ two: boolean[]; }'.
|
||||
!!! error TS2322: Types of property 'two' are incompatible.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'boolean[]'.
|
||||
!!! error TS2322: Property 'push' is missing in type 'String'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'boolean[]'.
|
||||
@@ -1,7 +1,6 @@
|
||||
tests/cases/compiler/assignmentCompatability29.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: any[]; }'.
|
||||
Types of property 'one' are incompatible.
|
||||
Type 'number' is not assignable to type 'any[]'.
|
||||
Property 'length' is missing in type 'Number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatability29.ts (1 errors) ====
|
||||
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability29.ts(9,1): error TS2322: Type 'inte
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: any[]; }'.
|
||||
!!! error TS2322: Types of property 'one' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'any[]'.
|
||||
!!! error TS2322: Property 'length' is missing in type 'Number'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'any[]'.
|
||||
@@ -1,7 +1,6 @@
|
||||
tests/cases/compiler/assignmentCompatability30.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: number[]; }'.
|
||||
Types of property 'one' are incompatible.
|
||||
Type 'number' is not assignable to type 'number[]'.
|
||||
Property 'length' is missing in type 'Number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatability30.ts (1 errors) ====
|
||||
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability30.ts(9,1): error TS2322: Type 'inte
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: number[]; }'.
|
||||
!!! error TS2322: Types of property 'one' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'number[]'.
|
||||
!!! error TS2322: Property 'length' is missing in type 'Number'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'number[]'.
|
||||
@@ -1,7 +1,6 @@
|
||||
tests/cases/compiler/assignmentCompatability31.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: string[]; }'.
|
||||
Types of property 'one' are incompatible.
|
||||
Type 'number' is not assignable to type 'string[]'.
|
||||
Property 'length' is missing in type 'Number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatability31.ts (1 errors) ====
|
||||
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability31.ts(9,1): error TS2322: Type 'inte
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: string[]; }'.
|
||||
!!! error TS2322: Types of property 'one' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string[]'.
|
||||
!!! error TS2322: Property 'length' is missing in type 'Number'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'string[]'.
|
||||
@@ -1,7 +1,6 @@
|
||||
tests/cases/compiler/assignmentCompatability32.ts(9,1): error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: boolean[]; }'.
|
||||
Types of property 'one' are incompatible.
|
||||
Type 'number' is not assignable to type 'boolean[]'.
|
||||
Property 'length' is missing in type 'Number'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/assignmentCompatability32.ts (1 errors) ====
|
||||
@@ -17,5 +16,4 @@ tests/cases/compiler/assignmentCompatability32.ts(9,1): error TS2322: Type 'inte
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type 'interfaceWithPublicAndOptional<number, string>' is not assignable to type '{ one: boolean[]; }'.
|
||||
!!! error TS2322: Types of property 'one' are incompatible.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'boolean[]'.
|
||||
!!! error TS2322: Property 'length' is missing in type 'Number'.
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'boolean[]'.
|
||||
-4
@@ -1,9 +1,7 @@
|
||||
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(10,1): error TS2322: Type 'string' is not assignable to type 'Applicable'.
|
||||
Property 'apply' is missing in type 'String'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(11,1): error TS2322: Type 'string[]' is not assignable to type 'Applicable'.
|
||||
Property 'apply' is missing in type 'string[]'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(12,1): error TS2322: Type 'number' is not assignable to type 'Applicable'.
|
||||
Property 'apply' is missing in type 'Number'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(13,1): error TS2322: Type '{}' is not assignable to type 'Applicable'.
|
||||
Property 'apply' is missing in type '{}'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Applicable'.
|
||||
@@ -26,7 +24,6 @@ tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-functi
|
||||
x = '';
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'Applicable'.
|
||||
!!! error TS2322: Property 'apply' is missing in type 'String'.
|
||||
x = [''];
|
||||
~
|
||||
!!! error TS2322: Type 'string[]' is not assignable to type 'Applicable'.
|
||||
@@ -34,7 +31,6 @@ tests/cases/compiler/assignmentCompatability_checking-apply-member-off-of-functi
|
||||
x = 4;
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'Applicable'.
|
||||
!!! error TS2322: Property 'apply' is missing in type 'Number'.
|
||||
x = {};
|
||||
~
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'Applicable'.
|
||||
|
||||
-4
@@ -1,9 +1,7 @@
|
||||
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(10,1): error TS2322: Type 'string' is not assignable to type 'Callable'.
|
||||
Property 'call' is missing in type 'String'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(11,1): error TS2322: Type 'string[]' is not assignable to type 'Callable'.
|
||||
Property 'call' is missing in type 'string[]'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(12,1): error TS2322: Type 'number' is not assignable to type 'Callable'.
|
||||
Property 'call' is missing in type 'Number'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(13,1): error TS2322: Type '{}' is not assignable to type 'Callable'.
|
||||
Property 'call' is missing in type '{}'.
|
||||
tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-function-interface.ts(22,4): error TS2345: Argument of type 'string' is not assignable to parameter of type 'Callable'.
|
||||
@@ -26,7 +24,6 @@ tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-functio
|
||||
x = '';
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'Callable'.
|
||||
!!! error TS2322: Property 'call' is missing in type 'String'.
|
||||
x = [''];
|
||||
~
|
||||
!!! error TS2322: Type 'string[]' is not assignable to type 'Callable'.
|
||||
@@ -34,7 +31,6 @@ tests/cases/compiler/assignmentCompatability_checking-call-member-off-of-functio
|
||||
x = 4;
|
||||
~
|
||||
!!! error TS2322: Type 'number' is not assignable to type 'Callable'.
|
||||
!!! error TS2322: Property 'call' is missing in type 'Number'.
|
||||
x = {};
|
||||
~
|
||||
!!! error TS2322: Type '{}' is not assignable to type 'Callable'.
|
||||
|
||||
@@ -11,6 +11,6 @@ class C {
|
||||
class C {
|
||||
method() {
|
||||
function other() { }
|
||||
var fn = () => __awaiter(this, arguments, Promise, function* (_arguments) { return yield other.apply(this, _arguments); });
|
||||
var fn = () => __awaiter(this, arguments, Promise, function* () { return yield other.apply(this, arguments); });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,17 +40,12 @@ module M {
|
||||
}
|
||||
|
||||
//// [asyncAwaitIsolatedModules_es6.js]
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
generator = generator.call(thisArg, _arguments);
|
||||
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
|
||||
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
|
||||
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
|
||||
function step(verb, value) {
|
||||
var result = generator[verb](value);
|
||||
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
|
||||
}
|
||||
step("next", void 0);
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new P(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
function f0() {
|
||||
|
||||
@@ -40,17 +40,12 @@ module M {
|
||||
}
|
||||
|
||||
//// [asyncAwait_es6.js]
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
generator = generator.call(thisArg, _arguments);
|
||||
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
|
||||
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
|
||||
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
|
||||
function step(verb, value) {
|
||||
var result = generator[verb](value);
|
||||
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
|
||||
}
|
||||
step("next", void 0);
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new P(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
function f0() {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
//// [tests/cases/compiler/asyncFunctionsAcrossFiles.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
import { b } from './b';
|
||||
export const a = {
|
||||
f: async () => {
|
||||
await b.f();
|
||||
}
|
||||
};
|
||||
//// [b.ts]
|
||||
import { a } from './a';
|
||||
export const b = {
|
||||
f: async () => {
|
||||
await a.f();
|
||||
}
|
||||
};
|
||||
|
||||
//// [b.js]
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new P(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
import { a } from './a';
|
||||
export const b = {
|
||||
f: () => __awaiter(this, void 0, Promise, function* () {
|
||||
yield a.f();
|
||||
})
|
||||
};
|
||||
//// [a.js]
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new P(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
import { b } from './b';
|
||||
export const a = {
|
||||
f: () => __awaiter(this, void 0, Promise, function* () {
|
||||
yield b.f();
|
||||
})
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import { b } from './b';
|
||||
>b : Symbol(b, Decl(a.ts, 0, 8))
|
||||
|
||||
export const a = {
|
||||
>a : Symbol(a, Decl(a.ts, 1, 12))
|
||||
|
||||
f: async () => {
|
||||
>f : Symbol(f, Decl(a.ts, 1, 18))
|
||||
|
||||
await b.f();
|
||||
>b.f : Symbol(f, Decl(b.ts, 1, 18))
|
||||
>b : Symbol(b, Decl(a.ts, 0, 8))
|
||||
>f : Symbol(f, Decl(b.ts, 1, 18))
|
||||
}
|
||||
};
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import { a } from './a';
|
||||
>a : Symbol(a, Decl(b.ts, 0, 8))
|
||||
|
||||
export const b = {
|
||||
>b : Symbol(b, Decl(b.ts, 1, 12))
|
||||
|
||||
f: async () => {
|
||||
>f : Symbol(f, Decl(b.ts, 1, 18))
|
||||
|
||||
await a.f();
|
||||
>a.f : Symbol(f, Decl(a.ts, 1, 18))
|
||||
>a : Symbol(a, Decl(b.ts, 0, 8))
|
||||
>f : Symbol(f, Decl(a.ts, 1, 18))
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import { b } from './b';
|
||||
>b : { f: () => Promise<void>; }
|
||||
|
||||
export const a = {
|
||||
>a : { f: () => Promise<void>; }
|
||||
>{ f: async () => { await b.f(); }} : { f: () => Promise<void>; }
|
||||
|
||||
f: async () => {
|
||||
>f : () => Promise<void>
|
||||
>async () => { await b.f(); } : () => Promise<void>
|
||||
|
||||
await b.f();
|
||||
>await b.f() : void
|
||||
>b.f() : Promise<void>
|
||||
>b.f : () => Promise<void>
|
||||
>b : { f: () => Promise<void>; }
|
||||
>f : () => Promise<void>
|
||||
}
|
||||
};
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
import { a } from './a';
|
||||
>a : { f: () => Promise<void>; }
|
||||
|
||||
export const b = {
|
||||
>b : { f: () => Promise<void>; }
|
||||
>{ f: async () => { await a.f(); }} : { f: () => Promise<void>; }
|
||||
|
||||
f: async () => {
|
||||
>f : () => Promise<void>
|
||||
>async () => { await a.f(); } : () => Promise<void>
|
||||
|
||||
await a.f();
|
||||
>await a.f() : void
|
||||
>a.f() : Promise<void>
|
||||
>a.f : () => Promise<void>
|
||||
>a : { f: () => Promise<void>; }
|
||||
>f : () => Promise<void>
|
||||
}
|
||||
};
|
||||
@@ -16,20 +16,15 @@ class Task extends Promise {
|
||||
exports.Task = Task;
|
||||
//// [test.js]
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
generator = generator.call(thisArg, _arguments);
|
||||
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
|
||||
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
|
||||
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
|
||||
function step(verb, value) {
|
||||
var result = generator[verb](value);
|
||||
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
|
||||
}
|
||||
step("next", void 0);
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new P(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
var task_1 = require("./task");
|
||||
const task_1 = require("./task");
|
||||
class Test {
|
||||
example() {
|
||||
return __awaiter(this, void 0, task_1.Task, function* () { return; });
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
//// [asyncMethodWithSuper_es6.ts]
|
||||
class A {
|
||||
x() {
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
// async method with only call/get on 'super' does not require a binding
|
||||
async simple() {
|
||||
// call with property access
|
||||
super.x();
|
||||
|
||||
// call with element access
|
||||
super["x"]();
|
||||
|
||||
// property access (read)
|
||||
const a = super.x;
|
||||
|
||||
// element access (read)
|
||||
const b = super["x"];
|
||||
}
|
||||
|
||||
// async method with assignment/destructuring on 'super' requires a binding
|
||||
async advanced() {
|
||||
const f = () => {};
|
||||
|
||||
// call with property access
|
||||
super.x();
|
||||
|
||||
// call with element access
|
||||
super["x"]();
|
||||
|
||||
// property access (read)
|
||||
const a = super.x;
|
||||
|
||||
// element access (read)
|
||||
const b = super["x"];
|
||||
|
||||
// property access (assign)
|
||||
super.x = f;
|
||||
|
||||
// element access (assign)
|
||||
super["x"] = f;
|
||||
|
||||
// destructuring assign with property access
|
||||
({ f: super.x } = { f });
|
||||
|
||||
// destructuring assign with element access
|
||||
({ f: super["x"] } = { f });
|
||||
}
|
||||
}
|
||||
|
||||
//// [asyncMethodWithSuper_es6.js]
|
||||
class A {
|
||||
x() {
|
||||
}
|
||||
}
|
||||
class B extends A {
|
||||
// async method with only call/get on 'super' does not require a binding
|
||||
simple() {
|
||||
const _super = name => super[name];
|
||||
return __awaiter(this, void 0, Promise, function* () {
|
||||
// call with property access
|
||||
_super("x").call(this);
|
||||
// call with element access
|
||||
_super("x").call(this);
|
||||
// property access (read)
|
||||
const a = _super("x");
|
||||
// element access (read)
|
||||
const b = _super("x");
|
||||
});
|
||||
}
|
||||
// async method with assignment/destructuring on 'super' requires a binding
|
||||
advanced() {
|
||||
const _super = (function (geti, seti) {
|
||||
const cache = Object.create(null);
|
||||
return name => cache[name] || (cache[name] = { get value() { return geti(name); }, set value(v) { seti(name, v); } });
|
||||
})(name => super[name], (name, value) => super[name] = value);
|
||||
return __awaiter(this, void 0, Promise, function* () {
|
||||
const f = () => { };
|
||||
// call with property access
|
||||
_super("x").value.call(this);
|
||||
// call with element access
|
||||
_super("x").value.call(this);
|
||||
// property access (read)
|
||||
const a = _super("x").value;
|
||||
// element access (read)
|
||||
const b = _super("x").value;
|
||||
// property access (assign)
|
||||
_super("x").value = f;
|
||||
// element access (assign)
|
||||
_super("x").value = f;
|
||||
// destructuring assign with property access
|
||||
({ f: _super("x").value } = { f });
|
||||
// destructuring assign with element access
|
||||
({ f: _super("x").value } = { f });
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
=== tests/cases/conformance/async/es6/asyncMethodWithSuper_es6.ts ===
|
||||
class A {
|
||||
>A : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
|
||||
x() {
|
||||
>x : Symbol(x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
>B : Symbol(B, Decl(asyncMethodWithSuper_es6.ts, 3, 1))
|
||||
>A : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
|
||||
// async method with only call/get on 'super' does not require a binding
|
||||
async simple() {
|
||||
>simple : Symbol(simple, Decl(asyncMethodWithSuper_es6.ts, 5, 19))
|
||||
|
||||
// call with property access
|
||||
super.x();
|
||||
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
|
||||
// call with element access
|
||||
super["x"]();
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
|
||||
// property access (read)
|
||||
const a = super.x;
|
||||
>a : Symbol(a, Decl(asyncMethodWithSuper_es6.ts, 15, 13))
|
||||
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
|
||||
// element access (read)
|
||||
const b = super["x"];
|
||||
>b : Symbol(b, Decl(asyncMethodWithSuper_es6.ts, 18, 13))
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
}
|
||||
|
||||
// async method with assignment/destructuring on 'super' requires a binding
|
||||
async advanced() {
|
||||
>advanced : Symbol(advanced, Decl(asyncMethodWithSuper_es6.ts, 19, 5))
|
||||
|
||||
const f = () => {};
|
||||
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 23, 13))
|
||||
|
||||
// call with property access
|
||||
super.x();
|
||||
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
|
||||
// call with element access
|
||||
super["x"]();
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
|
||||
// property access (read)
|
||||
const a = super.x;
|
||||
>a : Symbol(a, Decl(asyncMethodWithSuper_es6.ts, 32, 13))
|
||||
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
|
||||
// element access (read)
|
||||
const b = super["x"];
|
||||
>b : Symbol(b, Decl(asyncMethodWithSuper_es6.ts, 35, 13))
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
|
||||
// property access (assign)
|
||||
super.x = f;
|
||||
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 23, 13))
|
||||
|
||||
// element access (assign)
|
||||
super["x"] = f;
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 23, 13))
|
||||
|
||||
// destructuring assign with property access
|
||||
({ f: super.x } = { f });
|
||||
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 44, 10))
|
||||
>super.x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>x : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 44, 27))
|
||||
|
||||
// destructuring assign with element access
|
||||
({ f: super["x"] } = { f });
|
||||
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 47, 10))
|
||||
>super : Symbol(A, Decl(asyncMethodWithSuper_es6.ts, 0, 0))
|
||||
>"x" : Symbol(A.x, Decl(asyncMethodWithSuper_es6.ts, 0, 9))
|
||||
>f : Symbol(f, Decl(asyncMethodWithSuper_es6.ts, 47, 30))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
=== tests/cases/conformance/async/es6/asyncMethodWithSuper_es6.ts ===
|
||||
class A {
|
||||
>A : A
|
||||
|
||||
x() {
|
||||
>x : () => void
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
>B : B
|
||||
>A : A
|
||||
|
||||
// async method with only call/get on 'super' does not require a binding
|
||||
async simple() {
|
||||
>simple : () => Promise<void>
|
||||
|
||||
// call with property access
|
||||
super.x();
|
||||
>super.x() : void
|
||||
>super.x : () => void
|
||||
>super : A
|
||||
>x : () => void
|
||||
|
||||
// call with element access
|
||||
super["x"]();
|
||||
>super["x"]() : void
|
||||
>super["x"] : () => void
|
||||
>super : A
|
||||
>"x" : string
|
||||
|
||||
// property access (read)
|
||||
const a = super.x;
|
||||
>a : () => void
|
||||
>super.x : () => void
|
||||
>super : A
|
||||
>x : () => void
|
||||
|
||||
// element access (read)
|
||||
const b = super["x"];
|
||||
>b : () => void
|
||||
>super["x"] : () => void
|
||||
>super : A
|
||||
>"x" : string
|
||||
}
|
||||
|
||||
// async method with assignment/destructuring on 'super' requires a binding
|
||||
async advanced() {
|
||||
>advanced : () => Promise<void>
|
||||
|
||||
const f = () => {};
|
||||
>f : () => void
|
||||
>() => {} : () => void
|
||||
|
||||
// call with property access
|
||||
super.x();
|
||||
>super.x() : void
|
||||
>super.x : () => void
|
||||
>super : A
|
||||
>x : () => void
|
||||
|
||||
// call with element access
|
||||
super["x"]();
|
||||
>super["x"]() : void
|
||||
>super["x"] : () => void
|
||||
>super : A
|
||||
>"x" : string
|
||||
|
||||
// property access (read)
|
||||
const a = super.x;
|
||||
>a : () => void
|
||||
>super.x : () => void
|
||||
>super : A
|
||||
>x : () => void
|
||||
|
||||
// element access (read)
|
||||
const b = super["x"];
|
||||
>b : () => void
|
||||
>super["x"] : () => void
|
||||
>super : A
|
||||
>"x" : string
|
||||
|
||||
// property access (assign)
|
||||
super.x = f;
|
||||
>super.x = f : () => void
|
||||
>super.x : () => void
|
||||
>super : A
|
||||
>x : () => void
|
||||
>f : () => void
|
||||
|
||||
// element access (assign)
|
||||
super["x"] = f;
|
||||
>super["x"] = f : () => void
|
||||
>super["x"] : () => void
|
||||
>super : A
|
||||
>"x" : string
|
||||
>f : () => void
|
||||
|
||||
// destructuring assign with property access
|
||||
({ f: super.x } = { f });
|
||||
>({ f: super.x } = { f }) : { f: () => void; }
|
||||
>{ f: super.x } = { f } : { f: () => void; }
|
||||
>{ f: super.x } : { f: () => void; }
|
||||
>f : () => void
|
||||
>super.x : () => void
|
||||
>super : A
|
||||
>x : () => void
|
||||
>{ f } : { f: () => void; }
|
||||
>f : () => void
|
||||
|
||||
// destructuring assign with element access
|
||||
({ f: super["x"] } = { f });
|
||||
>({ f: super["x"] } = { f }) : { f: () => void; }
|
||||
>{ f: super["x"] } = { f } : { f: () => void; }
|
||||
>{ f: super["x"] } : { f: () => void; }
|
||||
>f : () => void
|
||||
>super["x"] : () => void
|
||||
>super : A
|
||||
>"x" : string
|
||||
>{ f } : { f: () => void; }
|
||||
>f : () => void
|
||||
}
|
||||
}
|
||||
@@ -6,17 +6,12 @@ async function f() {}
|
||||
function g() { }
|
||||
|
||||
//// [a.js]
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promise, generator) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
generator = generator.call(thisArg, _arguments);
|
||||
function cast(value) { return value instanceof Promise && value.constructor === Promise ? value : new Promise(function (resolve) { resolve(value); }); }
|
||||
function onfulfill(value) { try { step("next", value); } catch (e) { reject(e); } }
|
||||
function onreject(value) { try { step("throw", value); } catch (e) { reject(e); } }
|
||||
function step(verb, value) {
|
||||
var result = generator[verb](value);
|
||||
result.done ? resolve(result.value) : cast(result.value).then(onfulfill, onreject);
|
||||
}
|
||||
step("next", void 0);
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new P(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator.throw(value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments)).next());
|
||||
});
|
||||
};
|
||||
function f() {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user