mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge branch 'master' of https://github.com/Microsoft/TypeScript into iteratorSpreadDestructure
This commit is contained in:
@@ -21,6 +21,7 @@ tests/services/baselines/local/*
|
||||
tests/baselines/prototyping/local/*
|
||||
tests/baselines/rwc/*
|
||||
tests/baselines/test262/*
|
||||
tests/baselines/local/projectOutput/*
|
||||
tests/services/baselines/prototyping/local/*
|
||||
tests/services/browser/typescriptServices.js
|
||||
scripts/processDiagnosticMessages.d.ts
|
||||
|
||||
@@ -111,6 +111,7 @@ var definitionsRoots = [
|
||||
"compiler/parser.d.ts",
|
||||
"compiler/checker.d.ts",
|
||||
"compiler/program.d.ts",
|
||||
"compiler/commandLineParser.d.ts",
|
||||
"services/services.d.ts",
|
||||
];
|
||||
|
||||
@@ -143,7 +144,8 @@ var harnessSources = [
|
||||
"services/colorization.ts",
|
||||
"services/documentRegistry.ts",
|
||||
"services/preProcessFile.ts",
|
||||
"services/patternMatcher.ts"
|
||||
"services/patternMatcher.ts",
|
||||
"versionCache.ts"
|
||||
].map(function (f) {
|
||||
return path.join(unittestsDirectory, f);
|
||||
})).concat([
|
||||
@@ -222,15 +224,17 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
|
||||
var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory;
|
||||
var options = "--module commonjs -noImplicitAny";
|
||||
|
||||
if (!keepComments) {
|
||||
options += " -removeComments";
|
||||
// Keep comments when specifically requested
|
||||
// or when in debug mode.
|
||||
if (!(keepComments || useDebugMode)) {
|
||||
options += " --removeComments";
|
||||
}
|
||||
|
||||
if (generateDeclarations) {
|
||||
options += " --declaration";
|
||||
}
|
||||
|
||||
if (useDebugMode || preserveConstEnums) {
|
||||
if (preserveConstEnums || useDebugMode) {
|
||||
options += " --preserveConstEnums";
|
||||
}
|
||||
|
||||
@@ -254,8 +258,6 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
|
||||
options += " --stripInternal"
|
||||
}
|
||||
|
||||
options += " --cacheDownlevelForOfLength --preserveNewLines";
|
||||
|
||||
var cmd = host + " " + dir + compilerFilename + " " + options + " ";
|
||||
cmd = cmd + sources.join(" ");
|
||||
console.log(cmd + "\n");
|
||||
|
||||
Vendored
+14
@@ -1170,3 +1170,17 @@ interface ArrayConstructor {
|
||||
}
|
||||
|
||||
declare var Array: ArrayConstructor;
|
||||
|
||||
interface TypedPropertyDescriptor<T> {
|
||||
enumerable?: boolean;
|
||||
configurable?: boolean;
|
||||
writable?: boolean;
|
||||
value?: T;
|
||||
get?: () => T;
|
||||
set?: (value: T) => void;
|
||||
}
|
||||
|
||||
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
|
||||
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
|
||||
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
|
||||
declare type ParameterDecorator = (target: Function, propertyKey: string | symbol, parameterIndex: number) => void;
|
||||
|
||||
Vendored
+14
@@ -1170,6 +1170,20 @@ interface ArrayConstructor {
|
||||
}
|
||||
|
||||
declare var Array: ArrayConstructor;
|
||||
|
||||
interface TypedPropertyDescriptor<T> {
|
||||
enumerable?: boolean;
|
||||
configurable?: boolean;
|
||||
writable?: boolean;
|
||||
value?: T;
|
||||
get?: () => T;
|
||||
set?: (value: T) => void;
|
||||
}
|
||||
|
||||
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
|
||||
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
|
||||
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
|
||||
declare type ParameterDecorator = (target: Function, propertyKey: string | symbol, parameterIndex: number) => void;
|
||||
declare type PropertyKey = string | number | symbol;
|
||||
|
||||
interface Symbol {
|
||||
|
||||
Vendored
+172
-8
@@ -1171,6 +1171,20 @@ interface ArrayConstructor {
|
||||
|
||||
declare var Array: ArrayConstructor;
|
||||
|
||||
interface TypedPropertyDescriptor<T> {
|
||||
enumerable?: boolean;
|
||||
configurable?: boolean;
|
||||
writable?: boolean;
|
||||
value?: T;
|
||||
get?: () => T;
|
||||
set?: (value: T) => void;
|
||||
}
|
||||
|
||||
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
|
||||
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
|
||||
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
|
||||
declare type ParameterDecorator = (target: Function, propertyKey: string | symbol, parameterIndex: number) => void;
|
||||
|
||||
/////////////////////////////
|
||||
/// IE10 ECMAScript Extensions
|
||||
/////////////////////////////
|
||||
@@ -14209,7 +14223,11 @@ declare function importScripts(...urls: string[]): void;
|
||||
/// Windows Script Host APIS
|
||||
/////////////////////////////
|
||||
|
||||
declare var ActiveXObject: { new (s: string): any; };
|
||||
|
||||
interface ActiveXObject {
|
||||
new (s: string): any;
|
||||
}
|
||||
declare var ActiveXObject: ActiveXObject;
|
||||
|
||||
interface ITextWriter {
|
||||
Write(s: string): void;
|
||||
@@ -14217,11 +14235,157 @@ interface ITextWriter {
|
||||
Close(): void;
|
||||
}
|
||||
|
||||
declare var WScript: {
|
||||
Echo(s: any): void;
|
||||
StdErr: ITextWriter;
|
||||
StdOut: ITextWriter;
|
||||
Arguments: { length: number; Item(n: number): string; };
|
||||
ScriptFullName: string;
|
||||
Quit(exitCode?: number): number;
|
||||
interface TextStreamBase {
|
||||
/**
|
||||
* The column number of the current character position in an input stream.
|
||||
*/
|
||||
Column: number;
|
||||
/**
|
||||
* The current line number in an input stream.
|
||||
*/
|
||||
Line: number;
|
||||
/**
|
||||
* Closes a text stream.
|
||||
* It is not necessary to close standard streams; they close automatically when the process ends. If you close a standard stream, be aware that any other pointers to that standard stream become invalid.
|
||||
*/
|
||||
Close(): void;
|
||||
}
|
||||
|
||||
interface TextStreamWriter extends TextStreamBase {
|
||||
/**
|
||||
* Sends a string to an output stream.
|
||||
*/
|
||||
Write(s: string): void;
|
||||
/**
|
||||
* Sends a specified number of blank lines (newline characters) to an output stream.
|
||||
*/
|
||||
WriteBlankLines(intLines: number): void;
|
||||
/**
|
||||
* Sends a string followed by a newline character to an output stream.
|
||||
*/
|
||||
WriteLine(s: string): void;
|
||||
}
|
||||
|
||||
interface TextStreamReader extends TextStreamBase {
|
||||
/**
|
||||
* Returns a specified number of characters from an input stream, beginning at the current pointer position.
|
||||
* Does not return until the ENTER key is pressed.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
*/
|
||||
Read(characters: number): string;
|
||||
/**
|
||||
* Returns all characters from an input stream.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
*/
|
||||
ReadAll(): string;
|
||||
/**
|
||||
* Returns an entire line from an input stream.
|
||||
* Although this method extracts the newline character, it does not add it to the returned string.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
*/
|
||||
ReadLine(): string;
|
||||
/**
|
||||
* Skips a specified number of characters when reading from an input text stream.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
* @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)
|
||||
*/
|
||||
Skip(characters: number): void;
|
||||
/**
|
||||
* Skips the next line when reading from an input text stream.
|
||||
* Can only be used on a stream in reading mode, not writing or appending mode.
|
||||
*/
|
||||
SkipLine(): void;
|
||||
/**
|
||||
* Indicates whether the stream pointer position is at the end of a line.
|
||||
*/
|
||||
AtEndOfLine: boolean;
|
||||
/**
|
||||
* Indicates whether the stream pointer position is at the end of a stream.
|
||||
*/
|
||||
AtEndOfStream: boolean;
|
||||
}
|
||||
|
||||
declare var WScript: {
|
||||
/**
|
||||
* Outputs text to either a message box (under WScript.exe) or the command console window followed by a newline (under CScript.ext).
|
||||
*/
|
||||
Echo(s: any): void;
|
||||
/**
|
||||
* Exposes the write-only error output stream for the current script.
|
||||
* Can be accessed only while using CScript.exe.
|
||||
*/
|
||||
StdErr: TextStreamWriter;
|
||||
/**
|
||||
* Exposes the write-only output stream for the current script.
|
||||
* Can be accessed only while using CScript.exe.
|
||||
*/
|
||||
StdOut: TextStreamWriter;
|
||||
Arguments: { length: number; Item(n: number): string; };
|
||||
/**
|
||||
* The full path of the currently running script.
|
||||
*/
|
||||
ScriptFullName: string;
|
||||
/**
|
||||
* Forces the script to stop immediately, with an optional exit code.
|
||||
*/
|
||||
Quit(exitCode?: number): number;
|
||||
/**
|
||||
* The Windows Script Host build version number.
|
||||
*/
|
||||
BuildVersion: number;
|
||||
/**
|
||||
* Fully qualified path of the host executable.
|
||||
*/
|
||||
FullName: string;
|
||||
/**
|
||||
* Gets/sets the script mode - interactive(true) or batch(false).
|
||||
*/
|
||||
Interactive: boolean;
|
||||
/**
|
||||
* The name of the host executable (WScript.exe or CScript.exe).
|
||||
*/
|
||||
Name: string;
|
||||
/**
|
||||
* Path of the directory containing the host executable.
|
||||
*/
|
||||
Path: string;
|
||||
/**
|
||||
* The filename of the currently running script.
|
||||
*/
|
||||
ScriptName: string;
|
||||
/**
|
||||
* Exposes the read-only input stream for the current script.
|
||||
* Can be accessed only while using CScript.exe.
|
||||
*/
|
||||
StdIn: TextStreamReader;
|
||||
/**
|
||||
* Windows Script Host version
|
||||
*/
|
||||
Version: string;
|
||||
/**
|
||||
* Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.
|
||||
*/
|
||||
ConnectObject(objEventSource: any, strPrefix: string): void;
|
||||
/**
|
||||
* Creates a COM object.
|
||||
* @param strProgiID
|
||||
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
|
||||
*/
|
||||
CreateObject(strProgID: string, strPrefix?: string): any;
|
||||
/**
|
||||
* Disconnects a COM object from its event sources.
|
||||
*/
|
||||
DisconnectObject(obj: any): void;
|
||||
/**
|
||||
* Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.
|
||||
* @param strPathname Fully qualified path to the file containing the object persisted to disk. For objects in memory, pass a zero-length string.
|
||||
* @param strProgID
|
||||
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
|
||||
*/
|
||||
GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;
|
||||
/**
|
||||
* Suspends script execution for a specified length of time, then continues execution.
|
||||
* @param intTime Interval (in milliseconds) to suspend script execution.
|
||||
*/
|
||||
Sleep(intTime: number): void;
|
||||
};
|
||||
|
||||
Vendored
+172
-8
@@ -1170,6 +1170,20 @@ interface ArrayConstructor {
|
||||
}
|
||||
|
||||
declare var Array: ArrayConstructor;
|
||||
|
||||
interface TypedPropertyDescriptor<T> {
|
||||
enumerable?: boolean;
|
||||
configurable?: boolean;
|
||||
writable?: boolean;
|
||||
value?: T;
|
||||
get?: () => T;
|
||||
set?: (value: T) => void;
|
||||
}
|
||||
|
||||
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
|
||||
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
|
||||
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
|
||||
declare type ParameterDecorator = (target: Function, propertyKey: string | symbol, parameterIndex: number) => void;
|
||||
declare type PropertyKey = string | number | symbol;
|
||||
|
||||
interface Symbol {
|
||||
@@ -17191,7 +17205,11 @@ declare function importScripts(...urls: string[]): void;
|
||||
/// Windows Script Host APIS
|
||||
/////////////////////////////
|
||||
|
||||
declare var ActiveXObject: { new (s: string): any; };
|
||||
|
||||
interface ActiveXObject {
|
||||
new (s: string): any;
|
||||
}
|
||||
declare var ActiveXObject: ActiveXObject;
|
||||
|
||||
interface ITextWriter {
|
||||
Write(s: string): void;
|
||||
@@ -17199,11 +17217,157 @@ interface ITextWriter {
|
||||
Close(): void;
|
||||
}
|
||||
|
||||
declare var WScript: {
|
||||
Echo(s: any): void;
|
||||
StdErr: ITextWriter;
|
||||
StdOut: ITextWriter;
|
||||
Arguments: { length: number; Item(n: number): string; };
|
||||
ScriptFullName: string;
|
||||
Quit(exitCode?: number): number;
|
||||
interface TextStreamBase {
|
||||
/**
|
||||
* The column number of the current character position in an input stream.
|
||||
*/
|
||||
Column: number;
|
||||
/**
|
||||
* The current line number in an input stream.
|
||||
*/
|
||||
Line: number;
|
||||
/**
|
||||
* Closes a text stream.
|
||||
* It is not necessary to close standard streams; they close automatically when the process ends. If you close a standard stream, be aware that any other pointers to that standard stream become invalid.
|
||||
*/
|
||||
Close(): void;
|
||||
}
|
||||
|
||||
interface TextStreamWriter extends TextStreamBase {
|
||||
/**
|
||||
* Sends a string to an output stream.
|
||||
*/
|
||||
Write(s: string): void;
|
||||
/**
|
||||
* Sends a specified number of blank lines (newline characters) to an output stream.
|
||||
*/
|
||||
WriteBlankLines(intLines: number): void;
|
||||
/**
|
||||
* Sends a string followed by a newline character to an output stream.
|
||||
*/
|
||||
WriteLine(s: string): void;
|
||||
}
|
||||
|
||||
interface TextStreamReader extends TextStreamBase {
|
||||
/**
|
||||
* Returns a specified number of characters from an input stream, beginning at the current pointer position.
|
||||
* Does not return until the ENTER key is pressed.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
*/
|
||||
Read(characters: number): string;
|
||||
/**
|
||||
* Returns all characters from an input stream.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
*/
|
||||
ReadAll(): string;
|
||||
/**
|
||||
* Returns an entire line from an input stream.
|
||||
* Although this method extracts the newline character, it does not add it to the returned string.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
*/
|
||||
ReadLine(): string;
|
||||
/**
|
||||
* Skips a specified number of characters when reading from an input text stream.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
* @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)
|
||||
*/
|
||||
Skip(characters: number): void;
|
||||
/**
|
||||
* Skips the next line when reading from an input text stream.
|
||||
* Can only be used on a stream in reading mode, not writing or appending mode.
|
||||
*/
|
||||
SkipLine(): void;
|
||||
/**
|
||||
* Indicates whether the stream pointer position is at the end of a line.
|
||||
*/
|
||||
AtEndOfLine: boolean;
|
||||
/**
|
||||
* Indicates whether the stream pointer position is at the end of a stream.
|
||||
*/
|
||||
AtEndOfStream: boolean;
|
||||
}
|
||||
|
||||
declare var WScript: {
|
||||
/**
|
||||
* Outputs text to either a message box (under WScript.exe) or the command console window followed by a newline (under CScript.ext).
|
||||
*/
|
||||
Echo(s: any): void;
|
||||
/**
|
||||
* Exposes the write-only error output stream for the current script.
|
||||
* Can be accessed only while using CScript.exe.
|
||||
*/
|
||||
StdErr: TextStreamWriter;
|
||||
/**
|
||||
* Exposes the write-only output stream for the current script.
|
||||
* Can be accessed only while using CScript.exe.
|
||||
*/
|
||||
StdOut: TextStreamWriter;
|
||||
Arguments: { length: number; Item(n: number): string; };
|
||||
/**
|
||||
* The full path of the currently running script.
|
||||
*/
|
||||
ScriptFullName: string;
|
||||
/**
|
||||
* Forces the script to stop immediately, with an optional exit code.
|
||||
*/
|
||||
Quit(exitCode?: number): number;
|
||||
/**
|
||||
* The Windows Script Host build version number.
|
||||
*/
|
||||
BuildVersion: number;
|
||||
/**
|
||||
* Fully qualified path of the host executable.
|
||||
*/
|
||||
FullName: string;
|
||||
/**
|
||||
* Gets/sets the script mode - interactive(true) or batch(false).
|
||||
*/
|
||||
Interactive: boolean;
|
||||
/**
|
||||
* The name of the host executable (WScript.exe or CScript.exe).
|
||||
*/
|
||||
Name: string;
|
||||
/**
|
||||
* Path of the directory containing the host executable.
|
||||
*/
|
||||
Path: string;
|
||||
/**
|
||||
* The filename of the currently running script.
|
||||
*/
|
||||
ScriptName: string;
|
||||
/**
|
||||
* Exposes the read-only input stream for the current script.
|
||||
* Can be accessed only while using CScript.exe.
|
||||
*/
|
||||
StdIn: TextStreamReader;
|
||||
/**
|
||||
* Windows Script Host version
|
||||
*/
|
||||
Version: string;
|
||||
/**
|
||||
* Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.
|
||||
*/
|
||||
ConnectObject(objEventSource: any, strPrefix: string): void;
|
||||
/**
|
||||
* Creates a COM object.
|
||||
* @param strProgiID
|
||||
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
|
||||
*/
|
||||
CreateObject(strProgID: string, strPrefix?: string): any;
|
||||
/**
|
||||
* Disconnects a COM object from its event sources.
|
||||
*/
|
||||
DisconnectObject(obj: any): void;
|
||||
/**
|
||||
* Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.
|
||||
* @param strPathname Fully qualified path to the file containing the object persisted to disk. For objects in memory, pass a zero-length string.
|
||||
* @param strProgID
|
||||
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
|
||||
*/
|
||||
GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;
|
||||
/**
|
||||
* Suspends script execution for a specified length of time, then continues execution.
|
||||
* @param intTime Interval (in milliseconds) to suspend script execution.
|
||||
*/
|
||||
Sleep(intTime: number): void;
|
||||
};
|
||||
|
||||
Vendored
+158
-8
@@ -20,7 +20,11 @@ and limitations under the License.
|
||||
/// Windows Script Host APIS
|
||||
/////////////////////////////
|
||||
|
||||
declare var ActiveXObject: { new (s: string): any; };
|
||||
|
||||
interface ActiveXObject {
|
||||
new (s: string): any;
|
||||
}
|
||||
declare var ActiveXObject: ActiveXObject;
|
||||
|
||||
interface ITextWriter {
|
||||
Write(s: string): void;
|
||||
@@ -28,11 +32,157 @@ interface ITextWriter {
|
||||
Close(): void;
|
||||
}
|
||||
|
||||
declare var WScript: {
|
||||
Echo(s: any): void;
|
||||
StdErr: ITextWriter;
|
||||
StdOut: ITextWriter;
|
||||
Arguments: { length: number; Item(n: number): string; };
|
||||
ScriptFullName: string;
|
||||
Quit(exitCode?: number): number;
|
||||
interface TextStreamBase {
|
||||
/**
|
||||
* The column number of the current character position in an input stream.
|
||||
*/
|
||||
Column: number;
|
||||
/**
|
||||
* The current line number in an input stream.
|
||||
*/
|
||||
Line: number;
|
||||
/**
|
||||
* Closes a text stream.
|
||||
* It is not necessary to close standard streams; they close automatically when the process ends. If you close a standard stream, be aware that any other pointers to that standard stream become invalid.
|
||||
*/
|
||||
Close(): void;
|
||||
}
|
||||
|
||||
interface TextStreamWriter extends TextStreamBase {
|
||||
/**
|
||||
* Sends a string to an output stream.
|
||||
*/
|
||||
Write(s: string): void;
|
||||
/**
|
||||
* Sends a specified number of blank lines (newline characters) to an output stream.
|
||||
*/
|
||||
WriteBlankLines(intLines: number): void;
|
||||
/**
|
||||
* Sends a string followed by a newline character to an output stream.
|
||||
*/
|
||||
WriteLine(s: string): void;
|
||||
}
|
||||
|
||||
interface TextStreamReader extends TextStreamBase {
|
||||
/**
|
||||
* Returns a specified number of characters from an input stream, beginning at the current pointer position.
|
||||
* Does not return until the ENTER key is pressed.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
*/
|
||||
Read(characters: number): string;
|
||||
/**
|
||||
* Returns all characters from an input stream.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
*/
|
||||
ReadAll(): string;
|
||||
/**
|
||||
* Returns an entire line from an input stream.
|
||||
* Although this method extracts the newline character, it does not add it to the returned string.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
*/
|
||||
ReadLine(): string;
|
||||
/**
|
||||
* Skips a specified number of characters when reading from an input text stream.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
* @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)
|
||||
*/
|
||||
Skip(characters: number): void;
|
||||
/**
|
||||
* Skips the next line when reading from an input text stream.
|
||||
* Can only be used on a stream in reading mode, not writing or appending mode.
|
||||
*/
|
||||
SkipLine(): void;
|
||||
/**
|
||||
* Indicates whether the stream pointer position is at the end of a line.
|
||||
*/
|
||||
AtEndOfLine: boolean;
|
||||
/**
|
||||
* Indicates whether the stream pointer position is at the end of a stream.
|
||||
*/
|
||||
AtEndOfStream: boolean;
|
||||
}
|
||||
|
||||
declare var WScript: {
|
||||
/**
|
||||
* Outputs text to either a message box (under WScript.exe) or the command console window followed by a newline (under CScript.ext).
|
||||
*/
|
||||
Echo(s: any): void;
|
||||
/**
|
||||
* Exposes the write-only error output stream for the current script.
|
||||
* Can be accessed only while using CScript.exe.
|
||||
*/
|
||||
StdErr: TextStreamWriter;
|
||||
/**
|
||||
* Exposes the write-only output stream for the current script.
|
||||
* Can be accessed only while using CScript.exe.
|
||||
*/
|
||||
StdOut: TextStreamWriter;
|
||||
Arguments: { length: number; Item(n: number): string; };
|
||||
/**
|
||||
* The full path of the currently running script.
|
||||
*/
|
||||
ScriptFullName: string;
|
||||
/**
|
||||
* Forces the script to stop immediately, with an optional exit code.
|
||||
*/
|
||||
Quit(exitCode?: number): number;
|
||||
/**
|
||||
* The Windows Script Host build version number.
|
||||
*/
|
||||
BuildVersion: number;
|
||||
/**
|
||||
* Fully qualified path of the host executable.
|
||||
*/
|
||||
FullName: string;
|
||||
/**
|
||||
* Gets/sets the script mode - interactive(true) or batch(false).
|
||||
*/
|
||||
Interactive: boolean;
|
||||
/**
|
||||
* The name of the host executable (WScript.exe or CScript.exe).
|
||||
*/
|
||||
Name: string;
|
||||
/**
|
||||
* Path of the directory containing the host executable.
|
||||
*/
|
||||
Path: string;
|
||||
/**
|
||||
* The filename of the currently running script.
|
||||
*/
|
||||
ScriptName: string;
|
||||
/**
|
||||
* Exposes the read-only input stream for the current script.
|
||||
* Can be accessed only while using CScript.exe.
|
||||
*/
|
||||
StdIn: TextStreamReader;
|
||||
/**
|
||||
* Windows Script Host version
|
||||
*/
|
||||
Version: string;
|
||||
/**
|
||||
* Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.
|
||||
*/
|
||||
ConnectObject(objEventSource: any, strPrefix: string): void;
|
||||
/**
|
||||
* Creates a COM object.
|
||||
* @param strProgiID
|
||||
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
|
||||
*/
|
||||
CreateObject(strProgID: string, strPrefix?: string): any;
|
||||
/**
|
||||
* Disconnects a COM object from its event sources.
|
||||
*/
|
||||
DisconnectObject(obj: any): void;
|
||||
/**
|
||||
* Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.
|
||||
* @param strPathname Fully qualified path to the file containing the object persisted to disk. For objects in memory, pass a zero-length string.
|
||||
* @param strProgID
|
||||
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
|
||||
*/
|
||||
GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;
|
||||
/**
|
||||
* Suspends script execution for a specified length of time, then continues execution.
|
||||
* @param intTime Interval (in milliseconds) to suspend script execution.
|
||||
*/
|
||||
Sleep(intTime: number): void;
|
||||
};
|
||||
|
||||
+12036
-5697
File diff suppressed because one or more lines are too long
+9368
-6866
File diff suppressed because it is too large
Load Diff
Vendored
+259
-219
@@ -74,192 +74,198 @@ declare module "typescript" {
|
||||
BarBarToken = 49,
|
||||
QuestionToken = 50,
|
||||
ColonToken = 51,
|
||||
EqualsToken = 52,
|
||||
PlusEqualsToken = 53,
|
||||
MinusEqualsToken = 54,
|
||||
AsteriskEqualsToken = 55,
|
||||
SlashEqualsToken = 56,
|
||||
PercentEqualsToken = 57,
|
||||
LessThanLessThanEqualsToken = 58,
|
||||
GreaterThanGreaterThanEqualsToken = 59,
|
||||
GreaterThanGreaterThanGreaterThanEqualsToken = 60,
|
||||
AmpersandEqualsToken = 61,
|
||||
BarEqualsToken = 62,
|
||||
CaretEqualsToken = 63,
|
||||
Identifier = 64,
|
||||
BreakKeyword = 65,
|
||||
CaseKeyword = 66,
|
||||
CatchKeyword = 67,
|
||||
ClassKeyword = 68,
|
||||
ConstKeyword = 69,
|
||||
ContinueKeyword = 70,
|
||||
DebuggerKeyword = 71,
|
||||
DefaultKeyword = 72,
|
||||
DeleteKeyword = 73,
|
||||
DoKeyword = 74,
|
||||
ElseKeyword = 75,
|
||||
EnumKeyword = 76,
|
||||
ExportKeyword = 77,
|
||||
ExtendsKeyword = 78,
|
||||
FalseKeyword = 79,
|
||||
FinallyKeyword = 80,
|
||||
ForKeyword = 81,
|
||||
FunctionKeyword = 82,
|
||||
IfKeyword = 83,
|
||||
ImportKeyword = 84,
|
||||
InKeyword = 85,
|
||||
InstanceOfKeyword = 86,
|
||||
NewKeyword = 87,
|
||||
NullKeyword = 88,
|
||||
ReturnKeyword = 89,
|
||||
SuperKeyword = 90,
|
||||
SwitchKeyword = 91,
|
||||
ThisKeyword = 92,
|
||||
ThrowKeyword = 93,
|
||||
TrueKeyword = 94,
|
||||
TryKeyword = 95,
|
||||
TypeOfKeyword = 96,
|
||||
VarKeyword = 97,
|
||||
VoidKeyword = 98,
|
||||
WhileKeyword = 99,
|
||||
WithKeyword = 100,
|
||||
AsKeyword = 101,
|
||||
ImplementsKeyword = 102,
|
||||
InterfaceKeyword = 103,
|
||||
LetKeyword = 104,
|
||||
PackageKeyword = 105,
|
||||
PrivateKeyword = 106,
|
||||
ProtectedKeyword = 107,
|
||||
PublicKeyword = 108,
|
||||
StaticKeyword = 109,
|
||||
YieldKeyword = 110,
|
||||
AnyKeyword = 111,
|
||||
BooleanKeyword = 112,
|
||||
ConstructorKeyword = 113,
|
||||
DeclareKeyword = 114,
|
||||
GetKeyword = 115,
|
||||
ModuleKeyword = 116,
|
||||
RequireKeyword = 117,
|
||||
NumberKeyword = 118,
|
||||
SetKeyword = 119,
|
||||
StringKeyword = 120,
|
||||
SymbolKeyword = 121,
|
||||
TypeKeyword = 122,
|
||||
FromKeyword = 123,
|
||||
OfKeyword = 124,
|
||||
QualifiedName = 125,
|
||||
ComputedPropertyName = 126,
|
||||
TypeParameter = 127,
|
||||
Parameter = 128,
|
||||
PropertySignature = 129,
|
||||
PropertyDeclaration = 130,
|
||||
MethodSignature = 131,
|
||||
MethodDeclaration = 132,
|
||||
Constructor = 133,
|
||||
GetAccessor = 134,
|
||||
SetAccessor = 135,
|
||||
CallSignature = 136,
|
||||
ConstructSignature = 137,
|
||||
IndexSignature = 138,
|
||||
TypeReference = 139,
|
||||
FunctionType = 140,
|
||||
ConstructorType = 141,
|
||||
TypeQuery = 142,
|
||||
TypeLiteral = 143,
|
||||
ArrayType = 144,
|
||||
TupleType = 145,
|
||||
UnionType = 146,
|
||||
ParenthesizedType = 147,
|
||||
ObjectBindingPattern = 148,
|
||||
ArrayBindingPattern = 149,
|
||||
BindingElement = 150,
|
||||
ArrayLiteralExpression = 151,
|
||||
ObjectLiteralExpression = 152,
|
||||
PropertyAccessExpression = 153,
|
||||
ElementAccessExpression = 154,
|
||||
CallExpression = 155,
|
||||
NewExpression = 156,
|
||||
TaggedTemplateExpression = 157,
|
||||
TypeAssertionExpression = 158,
|
||||
ParenthesizedExpression = 159,
|
||||
FunctionExpression = 160,
|
||||
ArrowFunction = 161,
|
||||
DeleteExpression = 162,
|
||||
TypeOfExpression = 163,
|
||||
VoidExpression = 164,
|
||||
PrefixUnaryExpression = 165,
|
||||
PostfixUnaryExpression = 166,
|
||||
BinaryExpression = 167,
|
||||
ConditionalExpression = 168,
|
||||
TemplateExpression = 169,
|
||||
YieldExpression = 170,
|
||||
SpreadElementExpression = 171,
|
||||
OmittedExpression = 172,
|
||||
TemplateSpan = 173,
|
||||
Block = 174,
|
||||
VariableStatement = 175,
|
||||
EmptyStatement = 176,
|
||||
ExpressionStatement = 177,
|
||||
IfStatement = 178,
|
||||
DoStatement = 179,
|
||||
WhileStatement = 180,
|
||||
ForStatement = 181,
|
||||
ForInStatement = 182,
|
||||
ForOfStatement = 183,
|
||||
ContinueStatement = 184,
|
||||
BreakStatement = 185,
|
||||
ReturnStatement = 186,
|
||||
WithStatement = 187,
|
||||
SwitchStatement = 188,
|
||||
LabeledStatement = 189,
|
||||
ThrowStatement = 190,
|
||||
TryStatement = 191,
|
||||
DebuggerStatement = 192,
|
||||
VariableDeclaration = 193,
|
||||
VariableDeclarationList = 194,
|
||||
FunctionDeclaration = 195,
|
||||
ClassDeclaration = 196,
|
||||
InterfaceDeclaration = 197,
|
||||
TypeAliasDeclaration = 198,
|
||||
EnumDeclaration = 199,
|
||||
ModuleDeclaration = 200,
|
||||
ModuleBlock = 201,
|
||||
CaseBlock = 202,
|
||||
ImportEqualsDeclaration = 203,
|
||||
ImportDeclaration = 204,
|
||||
ImportClause = 205,
|
||||
NamespaceImport = 206,
|
||||
NamedImports = 207,
|
||||
ImportSpecifier = 208,
|
||||
ExportAssignment = 209,
|
||||
ExportDeclaration = 210,
|
||||
NamedExports = 211,
|
||||
ExportSpecifier = 212,
|
||||
ExternalModuleReference = 213,
|
||||
CaseClause = 214,
|
||||
DefaultClause = 215,
|
||||
HeritageClause = 216,
|
||||
CatchClause = 217,
|
||||
PropertyAssignment = 218,
|
||||
ShorthandPropertyAssignment = 219,
|
||||
EnumMember = 220,
|
||||
SourceFile = 221,
|
||||
SyntaxList = 222,
|
||||
Count = 223,
|
||||
FirstAssignment = 52,
|
||||
LastAssignment = 63,
|
||||
FirstReservedWord = 65,
|
||||
LastReservedWord = 100,
|
||||
FirstKeyword = 65,
|
||||
LastKeyword = 124,
|
||||
FirstFutureReservedWord = 102,
|
||||
LastFutureReservedWord = 110,
|
||||
FirstTypeNode = 139,
|
||||
LastTypeNode = 147,
|
||||
AtToken = 52,
|
||||
EqualsToken = 53,
|
||||
PlusEqualsToken = 54,
|
||||
MinusEqualsToken = 55,
|
||||
AsteriskEqualsToken = 56,
|
||||
SlashEqualsToken = 57,
|
||||
PercentEqualsToken = 58,
|
||||
LessThanLessThanEqualsToken = 59,
|
||||
GreaterThanGreaterThanEqualsToken = 60,
|
||||
GreaterThanGreaterThanGreaterThanEqualsToken = 61,
|
||||
AmpersandEqualsToken = 62,
|
||||
BarEqualsToken = 63,
|
||||
CaretEqualsToken = 64,
|
||||
Identifier = 65,
|
||||
BreakKeyword = 66,
|
||||
CaseKeyword = 67,
|
||||
CatchKeyword = 68,
|
||||
ClassKeyword = 69,
|
||||
ConstKeyword = 70,
|
||||
ContinueKeyword = 71,
|
||||
DebuggerKeyword = 72,
|
||||
DefaultKeyword = 73,
|
||||
DeleteKeyword = 74,
|
||||
DoKeyword = 75,
|
||||
ElseKeyword = 76,
|
||||
EnumKeyword = 77,
|
||||
ExportKeyword = 78,
|
||||
ExtendsKeyword = 79,
|
||||
FalseKeyword = 80,
|
||||
FinallyKeyword = 81,
|
||||
ForKeyword = 82,
|
||||
FunctionKeyword = 83,
|
||||
IfKeyword = 84,
|
||||
ImportKeyword = 85,
|
||||
InKeyword = 86,
|
||||
InstanceOfKeyword = 87,
|
||||
NewKeyword = 88,
|
||||
NullKeyword = 89,
|
||||
ReturnKeyword = 90,
|
||||
SuperKeyword = 91,
|
||||
SwitchKeyword = 92,
|
||||
ThisKeyword = 93,
|
||||
ThrowKeyword = 94,
|
||||
TrueKeyword = 95,
|
||||
TryKeyword = 96,
|
||||
TypeOfKeyword = 97,
|
||||
VarKeyword = 98,
|
||||
VoidKeyword = 99,
|
||||
WhileKeyword = 100,
|
||||
WithKeyword = 101,
|
||||
AsKeyword = 102,
|
||||
ImplementsKeyword = 103,
|
||||
InterfaceKeyword = 104,
|
||||
LetKeyword = 105,
|
||||
PackageKeyword = 106,
|
||||
PrivateKeyword = 107,
|
||||
ProtectedKeyword = 108,
|
||||
PublicKeyword = 109,
|
||||
StaticKeyword = 110,
|
||||
YieldKeyword = 111,
|
||||
AnyKeyword = 112,
|
||||
BooleanKeyword = 113,
|
||||
ConstructorKeyword = 114,
|
||||
DeclareKeyword = 115,
|
||||
GetKeyword = 116,
|
||||
ModuleKeyword = 117,
|
||||
RequireKeyword = 118,
|
||||
NumberKeyword = 119,
|
||||
SetKeyword = 120,
|
||||
StringKeyword = 121,
|
||||
SymbolKeyword = 122,
|
||||
TypeKeyword = 123,
|
||||
FromKeyword = 124,
|
||||
OfKeyword = 125,
|
||||
QualifiedName = 126,
|
||||
ComputedPropertyName = 127,
|
||||
TypeParameter = 128,
|
||||
Parameter = 129,
|
||||
Decorator = 130,
|
||||
PropertySignature = 131,
|
||||
PropertyDeclaration = 132,
|
||||
MethodSignature = 133,
|
||||
MethodDeclaration = 134,
|
||||
Constructor = 135,
|
||||
GetAccessor = 136,
|
||||
SetAccessor = 137,
|
||||
CallSignature = 138,
|
||||
ConstructSignature = 139,
|
||||
IndexSignature = 140,
|
||||
TypeReference = 141,
|
||||
FunctionType = 142,
|
||||
ConstructorType = 143,
|
||||
TypeQuery = 144,
|
||||
TypeLiteral = 145,
|
||||
ArrayType = 146,
|
||||
TupleType = 147,
|
||||
UnionType = 148,
|
||||
ParenthesizedType = 149,
|
||||
ObjectBindingPattern = 150,
|
||||
ArrayBindingPattern = 151,
|
||||
BindingElement = 152,
|
||||
ArrayLiteralExpression = 153,
|
||||
ObjectLiteralExpression = 154,
|
||||
PropertyAccessExpression = 155,
|
||||
ElementAccessExpression = 156,
|
||||
CallExpression = 157,
|
||||
NewExpression = 158,
|
||||
TaggedTemplateExpression = 159,
|
||||
TypeAssertionExpression = 160,
|
||||
ParenthesizedExpression = 161,
|
||||
FunctionExpression = 162,
|
||||
ArrowFunction = 163,
|
||||
DeleteExpression = 164,
|
||||
TypeOfExpression = 165,
|
||||
VoidExpression = 166,
|
||||
PrefixUnaryExpression = 167,
|
||||
PostfixUnaryExpression = 168,
|
||||
BinaryExpression = 169,
|
||||
ConditionalExpression = 170,
|
||||
TemplateExpression = 171,
|
||||
YieldExpression = 172,
|
||||
SpreadElementExpression = 173,
|
||||
ClassExpression = 174,
|
||||
OmittedExpression = 175,
|
||||
TemplateSpan = 176,
|
||||
HeritageClauseElement = 177,
|
||||
SemicolonClassElement = 178,
|
||||
Block = 179,
|
||||
VariableStatement = 180,
|
||||
EmptyStatement = 181,
|
||||
ExpressionStatement = 182,
|
||||
IfStatement = 183,
|
||||
DoStatement = 184,
|
||||
WhileStatement = 185,
|
||||
ForStatement = 186,
|
||||
ForInStatement = 187,
|
||||
ForOfStatement = 188,
|
||||
ContinueStatement = 189,
|
||||
BreakStatement = 190,
|
||||
ReturnStatement = 191,
|
||||
WithStatement = 192,
|
||||
SwitchStatement = 193,
|
||||
LabeledStatement = 194,
|
||||
ThrowStatement = 195,
|
||||
TryStatement = 196,
|
||||
DebuggerStatement = 197,
|
||||
VariableDeclaration = 198,
|
||||
VariableDeclarationList = 199,
|
||||
FunctionDeclaration = 200,
|
||||
ClassDeclaration = 201,
|
||||
InterfaceDeclaration = 202,
|
||||
TypeAliasDeclaration = 203,
|
||||
EnumDeclaration = 204,
|
||||
ModuleDeclaration = 205,
|
||||
ModuleBlock = 206,
|
||||
CaseBlock = 207,
|
||||
ImportEqualsDeclaration = 208,
|
||||
ImportDeclaration = 209,
|
||||
ImportClause = 210,
|
||||
NamespaceImport = 211,
|
||||
NamedImports = 212,
|
||||
ImportSpecifier = 213,
|
||||
ExportAssignment = 214,
|
||||
ExportDeclaration = 215,
|
||||
NamedExports = 216,
|
||||
ExportSpecifier = 217,
|
||||
MissingDeclaration = 218,
|
||||
ExternalModuleReference = 219,
|
||||
CaseClause = 220,
|
||||
DefaultClause = 221,
|
||||
HeritageClause = 222,
|
||||
CatchClause = 223,
|
||||
PropertyAssignment = 224,
|
||||
ShorthandPropertyAssignment = 225,
|
||||
EnumMember = 226,
|
||||
SourceFile = 227,
|
||||
SyntaxList = 228,
|
||||
Count = 229,
|
||||
FirstAssignment = 53,
|
||||
LastAssignment = 64,
|
||||
FirstReservedWord = 66,
|
||||
LastReservedWord = 101,
|
||||
FirstKeyword = 66,
|
||||
LastKeyword = 125,
|
||||
FirstFutureReservedWord = 103,
|
||||
LastFutureReservedWord = 111,
|
||||
FirstTypeNode = 141,
|
||||
LastTypeNode = 149,
|
||||
FirstPunctuation = 14,
|
||||
LastPunctuation = 63,
|
||||
LastPunctuation = 64,
|
||||
FirstToken = 0,
|
||||
LastToken = 124,
|
||||
LastToken = 125,
|
||||
FirstTriviaToken = 2,
|
||||
LastTriviaToken = 6,
|
||||
FirstLiteralToken = 7,
|
||||
@@ -267,8 +273,8 @@ declare module "typescript" {
|
||||
FirstTemplateToken = 10,
|
||||
LastTemplateToken = 13,
|
||||
FirstBinaryOperator = 24,
|
||||
LastBinaryOperator = 63,
|
||||
FirstNode = 125,
|
||||
LastBinaryOperator = 64,
|
||||
FirstNode = 126,
|
||||
}
|
||||
const enum NodeFlags {
|
||||
Export = 1,
|
||||
@@ -284,6 +290,7 @@ declare module "typescript" {
|
||||
Let = 4096,
|
||||
Const = 8192,
|
||||
OctalLiteral = 16384,
|
||||
ExportContext = 32768,
|
||||
Modifier = 499,
|
||||
AccessibilityModifier = 112,
|
||||
BlockScoped = 12288,
|
||||
@@ -293,10 +300,11 @@ declare module "typescript" {
|
||||
DisallowIn = 2,
|
||||
Yield = 4,
|
||||
GeneratorParameter = 8,
|
||||
ThisNodeHasError = 16,
|
||||
ParserGeneratedFlags = 31,
|
||||
ThisNodeOrAnySubNodesHasError = 32,
|
||||
HasAggregatedChildData = 64,
|
||||
Decorator = 16,
|
||||
ThisNodeHasError = 32,
|
||||
ParserGeneratedFlags = 63,
|
||||
ThisNodeOrAnySubNodesHasError = 64,
|
||||
HasAggregatedChildData = 128,
|
||||
}
|
||||
const enum RelationComparisonResult {
|
||||
Succeeded = 1,
|
||||
@@ -307,6 +315,7 @@ declare module "typescript" {
|
||||
kind: SyntaxKind;
|
||||
flags: NodeFlags;
|
||||
parserContextFlags?: ParserContextFlags;
|
||||
decorators?: NodeArray<Decorator>;
|
||||
modifiers?: ModifiersArray;
|
||||
id?: number;
|
||||
parent?: Node;
|
||||
@@ -337,6 +346,9 @@ declare module "typescript" {
|
||||
interface ComputedPropertyName extends Node {
|
||||
expression: Expression;
|
||||
}
|
||||
interface Decorator extends Node {
|
||||
expression: LeftHandSideExpression;
|
||||
}
|
||||
interface TypeParameterDeclaration extends Declaration {
|
||||
name: Identifier;
|
||||
constraint?: TypeNode;
|
||||
@@ -423,6 +435,9 @@ declare module "typescript" {
|
||||
interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement {
|
||||
body?: Block;
|
||||
}
|
||||
interface SemicolonClassElement extends ClassElement {
|
||||
_semicolonClassElementBrand: any;
|
||||
}
|
||||
interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
|
||||
_accessorDeclarationBrand: any;
|
||||
body: Block;
|
||||
@@ -516,6 +531,9 @@ declare module "typescript" {
|
||||
name?: Identifier;
|
||||
body: Block | Expression;
|
||||
}
|
||||
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
equalsGreaterThanToken: Node;
|
||||
}
|
||||
interface LiteralExpression extends PrimaryExpression {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
@@ -558,6 +576,10 @@ declare module "typescript" {
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
arguments: NodeArray<Expression>;
|
||||
}
|
||||
interface HeritageClauseElement extends Node {
|
||||
expression: LeftHandSideExpression;
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
}
|
||||
interface NewExpression extends CallExpression, PrimaryExpression {
|
||||
}
|
||||
interface TaggedTemplateExpression extends MemberExpression {
|
||||
@@ -652,12 +674,16 @@ declare module "typescript" {
|
||||
interface ModuleElement extends Node {
|
||||
_moduleElementBrand: any;
|
||||
}
|
||||
interface ClassDeclaration extends Declaration, ModuleElement {
|
||||
interface ClassLikeDeclaration extends Declaration {
|
||||
name?: Identifier;
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
heritageClauses?: NodeArray<HeritageClause>;
|
||||
members: NodeArray<ClassElement>;
|
||||
}
|
||||
interface ClassDeclaration extends ClassLikeDeclaration, Statement {
|
||||
}
|
||||
interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
|
||||
}
|
||||
interface ClassElement extends Declaration {
|
||||
_classElementBrand: any;
|
||||
}
|
||||
@@ -669,7 +695,7 @@ declare module "typescript" {
|
||||
}
|
||||
interface HeritageClause extends Node {
|
||||
token: SyntaxKind;
|
||||
types?: NodeArray<TypeReferenceNode>;
|
||||
types?: NodeArray<HeritageClauseElement>;
|
||||
}
|
||||
interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
name: Identifier;
|
||||
@@ -725,7 +751,8 @@ declare module "typescript" {
|
||||
type ExportSpecifier = ImportOrExportSpecifier;
|
||||
interface ExportAssignment extends Declaration, ModuleElement {
|
||||
isExportEquals?: boolean;
|
||||
expression: Expression;
|
||||
expression?: Expression;
|
||||
type?: TypeNode;
|
||||
}
|
||||
interface FileReference extends TextRange {
|
||||
fileName: string;
|
||||
@@ -760,14 +787,14 @@ declare module "typescript" {
|
||||
interface Program extends ScriptReferenceHost {
|
||||
getSourceFiles(): SourceFile[];
|
||||
/**
|
||||
* Emits the javascript and declaration files. If targetSourceFile is not specified, then
|
||||
* the javascript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the javascript and declaration for that
|
||||
* Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
|
||||
* the JavaScript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the JavaScript and declaration for that
|
||||
* specific file will be generated.
|
||||
*
|
||||
* If writeFile is not specified then the writeFile callback from the compiler host will be
|
||||
* used for writing the javascript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the javascript and declaration files.
|
||||
* used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the JavaScript and declaration files.
|
||||
*/
|
||||
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
|
||||
getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
@@ -886,9 +913,10 @@ declare module "typescript" {
|
||||
NotAccessible = 1,
|
||||
CannotBeNamed = 2,
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
interface SymbolVisibilityResult {
|
||||
accessibility: SymbolAccessibility;
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[];
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
errorSymbolName?: string;
|
||||
errorNode?: Node;
|
||||
}
|
||||
@@ -896,20 +924,22 @@ declare module "typescript" {
|
||||
errorModuleName?: string;
|
||||
}
|
||||
interface EmitResolver {
|
||||
getGeneratedNameForNode(node: Node): string;
|
||||
getExpressionNameSubstitution(node: Identifier): string;
|
||||
hasExportDefaultValue(node: SourceFile): boolean;
|
||||
isReferencedAliasDeclaration(node: Node): boolean;
|
||||
hasGlobalName(name: string): boolean;
|
||||
getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string;
|
||||
isValueAliasDeclaration(node: Node): boolean;
|
||||
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
|
||||
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
|
||||
getNodeCheckFlags(node: Node): NodeCheckFlags;
|
||||
isDeclarationVisible(node: Declaration): boolean;
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isUnknownIdentifier(location: Node, name: string): boolean;
|
||||
resolvesToSomeValue(location: Node, name: string): boolean;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
}
|
||||
const enum SymbolFlags {
|
||||
@@ -1016,6 +1046,7 @@ declare module "typescript" {
|
||||
ContextChecked = 64,
|
||||
EnumValuesComputed = 128,
|
||||
BlockScopedBindingInLoop = 256,
|
||||
EmitDecorate = 512,
|
||||
}
|
||||
interface NodeLinks {
|
||||
resolvedType?: Type;
|
||||
@@ -1135,17 +1166,6 @@ declare module "typescript" {
|
||||
interface TypeMapper {
|
||||
(t: Type): Type;
|
||||
}
|
||||
interface TypeInferences {
|
||||
primary: Type[];
|
||||
secondary: Type[];
|
||||
}
|
||||
interface InferenceContext {
|
||||
typeParameters: TypeParameter[];
|
||||
inferUnionTypes: boolean;
|
||||
inferences: TypeInferences[];
|
||||
inferredTypes: Type[];
|
||||
failedTypeParameterIndex?: number;
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
key: string;
|
||||
category: DiagnosticCategory;
|
||||
@@ -1173,7 +1193,6 @@ declare module "typescript" {
|
||||
interface CompilerOptions {
|
||||
allowNonTsExtensions?: boolean;
|
||||
charset?: string;
|
||||
codepage?: number;
|
||||
declaration?: boolean;
|
||||
diagnostics?: boolean;
|
||||
emitBOM?: boolean;
|
||||
@@ -1187,7 +1206,6 @@ declare module "typescript" {
|
||||
noErrorTruncation?: boolean;
|
||||
noImplicitAny?: boolean;
|
||||
noLib?: boolean;
|
||||
noLibCheck?: boolean;
|
||||
noResolve?: boolean;
|
||||
out?: string;
|
||||
outDir?: string;
|
||||
@@ -1200,6 +1218,7 @@ declare module "typescript" {
|
||||
target?: ScriptTarget;
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
separateCompilation?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
const enum ModuleKind {
|
||||
@@ -1442,11 +1461,26 @@ declare module "typescript" {
|
||||
declare module "typescript" {
|
||||
/** The version of the TypeScript compiler release */
|
||||
let version: string;
|
||||
function createCompilerHost(options: CompilerOptions): CompilerHost;
|
||||
function findConfigFile(searchPath: string): string;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program): Diagnostic[];
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
|
||||
}
|
||||
declare module "typescript" {
|
||||
/**
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
*/
|
||||
function readConfigFile(fileName: string): any;
|
||||
/**
|
||||
* Parse the contents of a config file (tsconfig.json).
|
||||
* @param json The contents of the config file to parse
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
|
||||
}
|
||||
declare module "typescript" {
|
||||
/** The version of the language service API */
|
||||
let servicesVersion: string;
|
||||
@@ -1556,6 +1590,7 @@ declare module "typescript" {
|
||||
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
findReferences(fileName: string, position: number): ReferencedSymbol[];
|
||||
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
|
||||
getNavigationBarItems(fileName: string): NavigationBarItem[];
|
||||
getOutliningSpans(fileName: string): OutliningSpan[];
|
||||
@@ -1642,6 +1677,10 @@ declare module "typescript" {
|
||||
containerKind: string;
|
||||
containerName: string;
|
||||
}
|
||||
interface ReferencedSymbol {
|
||||
definition: DefinitionInfo;
|
||||
references: ReferenceEntry[];
|
||||
}
|
||||
enum SymbolDisplayPartKind {
|
||||
aliasName = 0,
|
||||
className = 1,
|
||||
@@ -1935,6 +1974,7 @@ declare module "typescript" {
|
||||
isCancellationRequested(): boolean;
|
||||
throwIfCancellationRequested(): void;
|
||||
}
|
||||
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string;
|
||||
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;
|
||||
|
||||
+8865
-6538
File diff suppressed because it is too large
Load Diff
Vendored
+259
-219
@@ -74,192 +74,198 @@ declare module ts {
|
||||
BarBarToken = 49,
|
||||
QuestionToken = 50,
|
||||
ColonToken = 51,
|
||||
EqualsToken = 52,
|
||||
PlusEqualsToken = 53,
|
||||
MinusEqualsToken = 54,
|
||||
AsteriskEqualsToken = 55,
|
||||
SlashEqualsToken = 56,
|
||||
PercentEqualsToken = 57,
|
||||
LessThanLessThanEqualsToken = 58,
|
||||
GreaterThanGreaterThanEqualsToken = 59,
|
||||
GreaterThanGreaterThanGreaterThanEqualsToken = 60,
|
||||
AmpersandEqualsToken = 61,
|
||||
BarEqualsToken = 62,
|
||||
CaretEqualsToken = 63,
|
||||
Identifier = 64,
|
||||
BreakKeyword = 65,
|
||||
CaseKeyword = 66,
|
||||
CatchKeyword = 67,
|
||||
ClassKeyword = 68,
|
||||
ConstKeyword = 69,
|
||||
ContinueKeyword = 70,
|
||||
DebuggerKeyword = 71,
|
||||
DefaultKeyword = 72,
|
||||
DeleteKeyword = 73,
|
||||
DoKeyword = 74,
|
||||
ElseKeyword = 75,
|
||||
EnumKeyword = 76,
|
||||
ExportKeyword = 77,
|
||||
ExtendsKeyword = 78,
|
||||
FalseKeyword = 79,
|
||||
FinallyKeyword = 80,
|
||||
ForKeyword = 81,
|
||||
FunctionKeyword = 82,
|
||||
IfKeyword = 83,
|
||||
ImportKeyword = 84,
|
||||
InKeyword = 85,
|
||||
InstanceOfKeyword = 86,
|
||||
NewKeyword = 87,
|
||||
NullKeyword = 88,
|
||||
ReturnKeyword = 89,
|
||||
SuperKeyword = 90,
|
||||
SwitchKeyword = 91,
|
||||
ThisKeyword = 92,
|
||||
ThrowKeyword = 93,
|
||||
TrueKeyword = 94,
|
||||
TryKeyword = 95,
|
||||
TypeOfKeyword = 96,
|
||||
VarKeyword = 97,
|
||||
VoidKeyword = 98,
|
||||
WhileKeyword = 99,
|
||||
WithKeyword = 100,
|
||||
AsKeyword = 101,
|
||||
ImplementsKeyword = 102,
|
||||
InterfaceKeyword = 103,
|
||||
LetKeyword = 104,
|
||||
PackageKeyword = 105,
|
||||
PrivateKeyword = 106,
|
||||
ProtectedKeyword = 107,
|
||||
PublicKeyword = 108,
|
||||
StaticKeyword = 109,
|
||||
YieldKeyword = 110,
|
||||
AnyKeyword = 111,
|
||||
BooleanKeyword = 112,
|
||||
ConstructorKeyword = 113,
|
||||
DeclareKeyword = 114,
|
||||
GetKeyword = 115,
|
||||
ModuleKeyword = 116,
|
||||
RequireKeyword = 117,
|
||||
NumberKeyword = 118,
|
||||
SetKeyword = 119,
|
||||
StringKeyword = 120,
|
||||
SymbolKeyword = 121,
|
||||
TypeKeyword = 122,
|
||||
FromKeyword = 123,
|
||||
OfKeyword = 124,
|
||||
QualifiedName = 125,
|
||||
ComputedPropertyName = 126,
|
||||
TypeParameter = 127,
|
||||
Parameter = 128,
|
||||
PropertySignature = 129,
|
||||
PropertyDeclaration = 130,
|
||||
MethodSignature = 131,
|
||||
MethodDeclaration = 132,
|
||||
Constructor = 133,
|
||||
GetAccessor = 134,
|
||||
SetAccessor = 135,
|
||||
CallSignature = 136,
|
||||
ConstructSignature = 137,
|
||||
IndexSignature = 138,
|
||||
TypeReference = 139,
|
||||
FunctionType = 140,
|
||||
ConstructorType = 141,
|
||||
TypeQuery = 142,
|
||||
TypeLiteral = 143,
|
||||
ArrayType = 144,
|
||||
TupleType = 145,
|
||||
UnionType = 146,
|
||||
ParenthesizedType = 147,
|
||||
ObjectBindingPattern = 148,
|
||||
ArrayBindingPattern = 149,
|
||||
BindingElement = 150,
|
||||
ArrayLiteralExpression = 151,
|
||||
ObjectLiteralExpression = 152,
|
||||
PropertyAccessExpression = 153,
|
||||
ElementAccessExpression = 154,
|
||||
CallExpression = 155,
|
||||
NewExpression = 156,
|
||||
TaggedTemplateExpression = 157,
|
||||
TypeAssertionExpression = 158,
|
||||
ParenthesizedExpression = 159,
|
||||
FunctionExpression = 160,
|
||||
ArrowFunction = 161,
|
||||
DeleteExpression = 162,
|
||||
TypeOfExpression = 163,
|
||||
VoidExpression = 164,
|
||||
PrefixUnaryExpression = 165,
|
||||
PostfixUnaryExpression = 166,
|
||||
BinaryExpression = 167,
|
||||
ConditionalExpression = 168,
|
||||
TemplateExpression = 169,
|
||||
YieldExpression = 170,
|
||||
SpreadElementExpression = 171,
|
||||
OmittedExpression = 172,
|
||||
TemplateSpan = 173,
|
||||
Block = 174,
|
||||
VariableStatement = 175,
|
||||
EmptyStatement = 176,
|
||||
ExpressionStatement = 177,
|
||||
IfStatement = 178,
|
||||
DoStatement = 179,
|
||||
WhileStatement = 180,
|
||||
ForStatement = 181,
|
||||
ForInStatement = 182,
|
||||
ForOfStatement = 183,
|
||||
ContinueStatement = 184,
|
||||
BreakStatement = 185,
|
||||
ReturnStatement = 186,
|
||||
WithStatement = 187,
|
||||
SwitchStatement = 188,
|
||||
LabeledStatement = 189,
|
||||
ThrowStatement = 190,
|
||||
TryStatement = 191,
|
||||
DebuggerStatement = 192,
|
||||
VariableDeclaration = 193,
|
||||
VariableDeclarationList = 194,
|
||||
FunctionDeclaration = 195,
|
||||
ClassDeclaration = 196,
|
||||
InterfaceDeclaration = 197,
|
||||
TypeAliasDeclaration = 198,
|
||||
EnumDeclaration = 199,
|
||||
ModuleDeclaration = 200,
|
||||
ModuleBlock = 201,
|
||||
CaseBlock = 202,
|
||||
ImportEqualsDeclaration = 203,
|
||||
ImportDeclaration = 204,
|
||||
ImportClause = 205,
|
||||
NamespaceImport = 206,
|
||||
NamedImports = 207,
|
||||
ImportSpecifier = 208,
|
||||
ExportAssignment = 209,
|
||||
ExportDeclaration = 210,
|
||||
NamedExports = 211,
|
||||
ExportSpecifier = 212,
|
||||
ExternalModuleReference = 213,
|
||||
CaseClause = 214,
|
||||
DefaultClause = 215,
|
||||
HeritageClause = 216,
|
||||
CatchClause = 217,
|
||||
PropertyAssignment = 218,
|
||||
ShorthandPropertyAssignment = 219,
|
||||
EnumMember = 220,
|
||||
SourceFile = 221,
|
||||
SyntaxList = 222,
|
||||
Count = 223,
|
||||
FirstAssignment = 52,
|
||||
LastAssignment = 63,
|
||||
FirstReservedWord = 65,
|
||||
LastReservedWord = 100,
|
||||
FirstKeyword = 65,
|
||||
LastKeyword = 124,
|
||||
FirstFutureReservedWord = 102,
|
||||
LastFutureReservedWord = 110,
|
||||
FirstTypeNode = 139,
|
||||
LastTypeNode = 147,
|
||||
AtToken = 52,
|
||||
EqualsToken = 53,
|
||||
PlusEqualsToken = 54,
|
||||
MinusEqualsToken = 55,
|
||||
AsteriskEqualsToken = 56,
|
||||
SlashEqualsToken = 57,
|
||||
PercentEqualsToken = 58,
|
||||
LessThanLessThanEqualsToken = 59,
|
||||
GreaterThanGreaterThanEqualsToken = 60,
|
||||
GreaterThanGreaterThanGreaterThanEqualsToken = 61,
|
||||
AmpersandEqualsToken = 62,
|
||||
BarEqualsToken = 63,
|
||||
CaretEqualsToken = 64,
|
||||
Identifier = 65,
|
||||
BreakKeyword = 66,
|
||||
CaseKeyword = 67,
|
||||
CatchKeyword = 68,
|
||||
ClassKeyword = 69,
|
||||
ConstKeyword = 70,
|
||||
ContinueKeyword = 71,
|
||||
DebuggerKeyword = 72,
|
||||
DefaultKeyword = 73,
|
||||
DeleteKeyword = 74,
|
||||
DoKeyword = 75,
|
||||
ElseKeyword = 76,
|
||||
EnumKeyword = 77,
|
||||
ExportKeyword = 78,
|
||||
ExtendsKeyword = 79,
|
||||
FalseKeyword = 80,
|
||||
FinallyKeyword = 81,
|
||||
ForKeyword = 82,
|
||||
FunctionKeyword = 83,
|
||||
IfKeyword = 84,
|
||||
ImportKeyword = 85,
|
||||
InKeyword = 86,
|
||||
InstanceOfKeyword = 87,
|
||||
NewKeyword = 88,
|
||||
NullKeyword = 89,
|
||||
ReturnKeyword = 90,
|
||||
SuperKeyword = 91,
|
||||
SwitchKeyword = 92,
|
||||
ThisKeyword = 93,
|
||||
ThrowKeyword = 94,
|
||||
TrueKeyword = 95,
|
||||
TryKeyword = 96,
|
||||
TypeOfKeyword = 97,
|
||||
VarKeyword = 98,
|
||||
VoidKeyword = 99,
|
||||
WhileKeyword = 100,
|
||||
WithKeyword = 101,
|
||||
AsKeyword = 102,
|
||||
ImplementsKeyword = 103,
|
||||
InterfaceKeyword = 104,
|
||||
LetKeyword = 105,
|
||||
PackageKeyword = 106,
|
||||
PrivateKeyword = 107,
|
||||
ProtectedKeyword = 108,
|
||||
PublicKeyword = 109,
|
||||
StaticKeyword = 110,
|
||||
YieldKeyword = 111,
|
||||
AnyKeyword = 112,
|
||||
BooleanKeyword = 113,
|
||||
ConstructorKeyword = 114,
|
||||
DeclareKeyword = 115,
|
||||
GetKeyword = 116,
|
||||
ModuleKeyword = 117,
|
||||
RequireKeyword = 118,
|
||||
NumberKeyword = 119,
|
||||
SetKeyword = 120,
|
||||
StringKeyword = 121,
|
||||
SymbolKeyword = 122,
|
||||
TypeKeyword = 123,
|
||||
FromKeyword = 124,
|
||||
OfKeyword = 125,
|
||||
QualifiedName = 126,
|
||||
ComputedPropertyName = 127,
|
||||
TypeParameter = 128,
|
||||
Parameter = 129,
|
||||
Decorator = 130,
|
||||
PropertySignature = 131,
|
||||
PropertyDeclaration = 132,
|
||||
MethodSignature = 133,
|
||||
MethodDeclaration = 134,
|
||||
Constructor = 135,
|
||||
GetAccessor = 136,
|
||||
SetAccessor = 137,
|
||||
CallSignature = 138,
|
||||
ConstructSignature = 139,
|
||||
IndexSignature = 140,
|
||||
TypeReference = 141,
|
||||
FunctionType = 142,
|
||||
ConstructorType = 143,
|
||||
TypeQuery = 144,
|
||||
TypeLiteral = 145,
|
||||
ArrayType = 146,
|
||||
TupleType = 147,
|
||||
UnionType = 148,
|
||||
ParenthesizedType = 149,
|
||||
ObjectBindingPattern = 150,
|
||||
ArrayBindingPattern = 151,
|
||||
BindingElement = 152,
|
||||
ArrayLiteralExpression = 153,
|
||||
ObjectLiteralExpression = 154,
|
||||
PropertyAccessExpression = 155,
|
||||
ElementAccessExpression = 156,
|
||||
CallExpression = 157,
|
||||
NewExpression = 158,
|
||||
TaggedTemplateExpression = 159,
|
||||
TypeAssertionExpression = 160,
|
||||
ParenthesizedExpression = 161,
|
||||
FunctionExpression = 162,
|
||||
ArrowFunction = 163,
|
||||
DeleteExpression = 164,
|
||||
TypeOfExpression = 165,
|
||||
VoidExpression = 166,
|
||||
PrefixUnaryExpression = 167,
|
||||
PostfixUnaryExpression = 168,
|
||||
BinaryExpression = 169,
|
||||
ConditionalExpression = 170,
|
||||
TemplateExpression = 171,
|
||||
YieldExpression = 172,
|
||||
SpreadElementExpression = 173,
|
||||
ClassExpression = 174,
|
||||
OmittedExpression = 175,
|
||||
TemplateSpan = 176,
|
||||
HeritageClauseElement = 177,
|
||||
SemicolonClassElement = 178,
|
||||
Block = 179,
|
||||
VariableStatement = 180,
|
||||
EmptyStatement = 181,
|
||||
ExpressionStatement = 182,
|
||||
IfStatement = 183,
|
||||
DoStatement = 184,
|
||||
WhileStatement = 185,
|
||||
ForStatement = 186,
|
||||
ForInStatement = 187,
|
||||
ForOfStatement = 188,
|
||||
ContinueStatement = 189,
|
||||
BreakStatement = 190,
|
||||
ReturnStatement = 191,
|
||||
WithStatement = 192,
|
||||
SwitchStatement = 193,
|
||||
LabeledStatement = 194,
|
||||
ThrowStatement = 195,
|
||||
TryStatement = 196,
|
||||
DebuggerStatement = 197,
|
||||
VariableDeclaration = 198,
|
||||
VariableDeclarationList = 199,
|
||||
FunctionDeclaration = 200,
|
||||
ClassDeclaration = 201,
|
||||
InterfaceDeclaration = 202,
|
||||
TypeAliasDeclaration = 203,
|
||||
EnumDeclaration = 204,
|
||||
ModuleDeclaration = 205,
|
||||
ModuleBlock = 206,
|
||||
CaseBlock = 207,
|
||||
ImportEqualsDeclaration = 208,
|
||||
ImportDeclaration = 209,
|
||||
ImportClause = 210,
|
||||
NamespaceImport = 211,
|
||||
NamedImports = 212,
|
||||
ImportSpecifier = 213,
|
||||
ExportAssignment = 214,
|
||||
ExportDeclaration = 215,
|
||||
NamedExports = 216,
|
||||
ExportSpecifier = 217,
|
||||
MissingDeclaration = 218,
|
||||
ExternalModuleReference = 219,
|
||||
CaseClause = 220,
|
||||
DefaultClause = 221,
|
||||
HeritageClause = 222,
|
||||
CatchClause = 223,
|
||||
PropertyAssignment = 224,
|
||||
ShorthandPropertyAssignment = 225,
|
||||
EnumMember = 226,
|
||||
SourceFile = 227,
|
||||
SyntaxList = 228,
|
||||
Count = 229,
|
||||
FirstAssignment = 53,
|
||||
LastAssignment = 64,
|
||||
FirstReservedWord = 66,
|
||||
LastReservedWord = 101,
|
||||
FirstKeyword = 66,
|
||||
LastKeyword = 125,
|
||||
FirstFutureReservedWord = 103,
|
||||
LastFutureReservedWord = 111,
|
||||
FirstTypeNode = 141,
|
||||
LastTypeNode = 149,
|
||||
FirstPunctuation = 14,
|
||||
LastPunctuation = 63,
|
||||
LastPunctuation = 64,
|
||||
FirstToken = 0,
|
||||
LastToken = 124,
|
||||
LastToken = 125,
|
||||
FirstTriviaToken = 2,
|
||||
LastTriviaToken = 6,
|
||||
FirstLiteralToken = 7,
|
||||
@@ -267,8 +273,8 @@ declare module ts {
|
||||
FirstTemplateToken = 10,
|
||||
LastTemplateToken = 13,
|
||||
FirstBinaryOperator = 24,
|
||||
LastBinaryOperator = 63,
|
||||
FirstNode = 125,
|
||||
LastBinaryOperator = 64,
|
||||
FirstNode = 126,
|
||||
}
|
||||
const enum NodeFlags {
|
||||
Export = 1,
|
||||
@@ -284,6 +290,7 @@ declare module ts {
|
||||
Let = 4096,
|
||||
Const = 8192,
|
||||
OctalLiteral = 16384,
|
||||
ExportContext = 32768,
|
||||
Modifier = 499,
|
||||
AccessibilityModifier = 112,
|
||||
BlockScoped = 12288,
|
||||
@@ -293,10 +300,11 @@ declare module ts {
|
||||
DisallowIn = 2,
|
||||
Yield = 4,
|
||||
GeneratorParameter = 8,
|
||||
ThisNodeHasError = 16,
|
||||
ParserGeneratedFlags = 31,
|
||||
ThisNodeOrAnySubNodesHasError = 32,
|
||||
HasAggregatedChildData = 64,
|
||||
Decorator = 16,
|
||||
ThisNodeHasError = 32,
|
||||
ParserGeneratedFlags = 63,
|
||||
ThisNodeOrAnySubNodesHasError = 64,
|
||||
HasAggregatedChildData = 128,
|
||||
}
|
||||
const enum RelationComparisonResult {
|
||||
Succeeded = 1,
|
||||
@@ -307,6 +315,7 @@ declare module ts {
|
||||
kind: SyntaxKind;
|
||||
flags: NodeFlags;
|
||||
parserContextFlags?: ParserContextFlags;
|
||||
decorators?: NodeArray<Decorator>;
|
||||
modifiers?: ModifiersArray;
|
||||
id?: number;
|
||||
parent?: Node;
|
||||
@@ -337,6 +346,9 @@ declare module ts {
|
||||
interface ComputedPropertyName extends Node {
|
||||
expression: Expression;
|
||||
}
|
||||
interface Decorator extends Node {
|
||||
expression: LeftHandSideExpression;
|
||||
}
|
||||
interface TypeParameterDeclaration extends Declaration {
|
||||
name: Identifier;
|
||||
constraint?: TypeNode;
|
||||
@@ -423,6 +435,9 @@ declare module ts {
|
||||
interface ConstructorDeclaration extends FunctionLikeDeclaration, ClassElement {
|
||||
body?: Block;
|
||||
}
|
||||
interface SemicolonClassElement extends ClassElement {
|
||||
_semicolonClassElementBrand: any;
|
||||
}
|
||||
interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
|
||||
_accessorDeclarationBrand: any;
|
||||
body: Block;
|
||||
@@ -516,6 +531,9 @@ declare module ts {
|
||||
name?: Identifier;
|
||||
body: Block | Expression;
|
||||
}
|
||||
interface ArrowFunction extends Expression, FunctionLikeDeclaration {
|
||||
equalsGreaterThanToken: Node;
|
||||
}
|
||||
interface LiteralExpression extends PrimaryExpression {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
@@ -558,6 +576,10 @@ declare module ts {
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
arguments: NodeArray<Expression>;
|
||||
}
|
||||
interface HeritageClauseElement extends Node {
|
||||
expression: LeftHandSideExpression;
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
}
|
||||
interface NewExpression extends CallExpression, PrimaryExpression {
|
||||
}
|
||||
interface TaggedTemplateExpression extends MemberExpression {
|
||||
@@ -652,12 +674,16 @@ declare module ts {
|
||||
interface ModuleElement extends Node {
|
||||
_moduleElementBrand: any;
|
||||
}
|
||||
interface ClassDeclaration extends Declaration, ModuleElement {
|
||||
interface ClassLikeDeclaration extends Declaration {
|
||||
name?: Identifier;
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
heritageClauses?: NodeArray<HeritageClause>;
|
||||
members: NodeArray<ClassElement>;
|
||||
}
|
||||
interface ClassDeclaration extends ClassLikeDeclaration, Statement {
|
||||
}
|
||||
interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
|
||||
}
|
||||
interface ClassElement extends Declaration {
|
||||
_classElementBrand: any;
|
||||
}
|
||||
@@ -669,7 +695,7 @@ declare module ts {
|
||||
}
|
||||
interface HeritageClause extends Node {
|
||||
token: SyntaxKind;
|
||||
types?: NodeArray<TypeReferenceNode>;
|
||||
types?: NodeArray<HeritageClauseElement>;
|
||||
}
|
||||
interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
name: Identifier;
|
||||
@@ -725,7 +751,8 @@ declare module ts {
|
||||
type ExportSpecifier = ImportOrExportSpecifier;
|
||||
interface ExportAssignment extends Declaration, ModuleElement {
|
||||
isExportEquals?: boolean;
|
||||
expression: Expression;
|
||||
expression?: Expression;
|
||||
type?: TypeNode;
|
||||
}
|
||||
interface FileReference extends TextRange {
|
||||
fileName: string;
|
||||
@@ -760,14 +787,14 @@ declare module ts {
|
||||
interface Program extends ScriptReferenceHost {
|
||||
getSourceFiles(): SourceFile[];
|
||||
/**
|
||||
* Emits the javascript and declaration files. If targetSourceFile is not specified, then
|
||||
* the javascript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the javascript and declaration for that
|
||||
* Emits the JavaScript and declaration files. If targetSourceFile is not specified, then
|
||||
* the JavaScript and declaration files will be produced for all the files in this program.
|
||||
* If targetSourceFile is specified, then only the JavaScript and declaration for that
|
||||
* specific file will be generated.
|
||||
*
|
||||
* If writeFile is not specified then the writeFile callback from the compiler host will be
|
||||
* used for writing the javascript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the javascript and declaration files.
|
||||
* used for writing the JavaScript and declaration files. Otherwise, the writeFile parameter
|
||||
* will be invoked when writing the JavaScript and declaration files.
|
||||
*/
|
||||
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
|
||||
getSyntacticDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
@@ -886,9 +913,10 @@ declare module ts {
|
||||
NotAccessible = 1,
|
||||
CannotBeNamed = 2,
|
||||
}
|
||||
type AnyImportSyntax = ImportDeclaration | ImportEqualsDeclaration;
|
||||
interface SymbolVisibilityResult {
|
||||
accessibility: SymbolAccessibility;
|
||||
aliasesToMakeVisible?: ImportEqualsDeclaration[];
|
||||
aliasesToMakeVisible?: AnyImportSyntax[];
|
||||
errorSymbolName?: string;
|
||||
errorNode?: Node;
|
||||
}
|
||||
@@ -896,20 +924,22 @@ declare module ts {
|
||||
errorModuleName?: string;
|
||||
}
|
||||
interface EmitResolver {
|
||||
getGeneratedNameForNode(node: Node): string;
|
||||
getExpressionNameSubstitution(node: Identifier): string;
|
||||
hasExportDefaultValue(node: SourceFile): boolean;
|
||||
isReferencedAliasDeclaration(node: Node): boolean;
|
||||
hasGlobalName(name: string): boolean;
|
||||
getExpressionNameSubstitution(node: Identifier, getGeneratedNameForNode: (node: Node) => string): string;
|
||||
isValueAliasDeclaration(node: Node): boolean;
|
||||
isReferencedAliasDeclaration(node: Node, checkChildren?: boolean): boolean;
|
||||
isTopLevelValueImportEqualsWithEntityName(node: ImportEqualsDeclaration): boolean;
|
||||
getNodeCheckFlags(node: Node): NodeCheckFlags;
|
||||
isDeclarationVisible(node: Declaration): boolean;
|
||||
collectLinkedAliases(node: Identifier): Node[];
|
||||
isImplementationOfOverload(node: FunctionLikeDeclaration): boolean;
|
||||
writeTypeOfDeclaration(declaration: AccessorDeclaration | VariableLikeDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isUnknownIdentifier(location: Node, name: string): boolean;
|
||||
resolvesToSomeValue(location: Node, name: string): boolean;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
}
|
||||
const enum SymbolFlags {
|
||||
@@ -1016,6 +1046,7 @@ declare module ts {
|
||||
ContextChecked = 64,
|
||||
EnumValuesComputed = 128,
|
||||
BlockScopedBindingInLoop = 256,
|
||||
EmitDecorate = 512,
|
||||
}
|
||||
interface NodeLinks {
|
||||
resolvedType?: Type;
|
||||
@@ -1135,17 +1166,6 @@ declare module ts {
|
||||
interface TypeMapper {
|
||||
(t: Type): Type;
|
||||
}
|
||||
interface TypeInferences {
|
||||
primary: Type[];
|
||||
secondary: Type[];
|
||||
}
|
||||
interface InferenceContext {
|
||||
typeParameters: TypeParameter[];
|
||||
inferUnionTypes: boolean;
|
||||
inferences: TypeInferences[];
|
||||
inferredTypes: Type[];
|
||||
failedTypeParameterIndex?: number;
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
key: string;
|
||||
category: DiagnosticCategory;
|
||||
@@ -1173,7 +1193,6 @@ declare module ts {
|
||||
interface CompilerOptions {
|
||||
allowNonTsExtensions?: boolean;
|
||||
charset?: string;
|
||||
codepage?: number;
|
||||
declaration?: boolean;
|
||||
diagnostics?: boolean;
|
||||
emitBOM?: boolean;
|
||||
@@ -1187,7 +1206,6 @@ declare module ts {
|
||||
noErrorTruncation?: boolean;
|
||||
noImplicitAny?: boolean;
|
||||
noLib?: boolean;
|
||||
noLibCheck?: boolean;
|
||||
noResolve?: boolean;
|
||||
out?: string;
|
||||
outDir?: string;
|
||||
@@ -1200,6 +1218,7 @@ declare module ts {
|
||||
target?: ScriptTarget;
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
separateCompilation?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
const enum ModuleKind {
|
||||
@@ -1442,11 +1461,26 @@ declare module ts {
|
||||
declare module ts {
|
||||
/** The version of the TypeScript compiler release */
|
||||
let version: string;
|
||||
function createCompilerHost(options: CompilerOptions): CompilerHost;
|
||||
function findConfigFile(searchPath: string): string;
|
||||
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
|
||||
function getPreEmitDiagnostics(program: Program): Diagnostic[];
|
||||
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
|
||||
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
|
||||
}
|
||||
declare module ts {
|
||||
/**
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
*/
|
||||
function readConfigFile(fileName: string): any;
|
||||
/**
|
||||
* Parse the contents of a config file (tsconfig.json).
|
||||
* @param json The contents of the config file to parse
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
|
||||
}
|
||||
declare module ts {
|
||||
/** The version of the language service API */
|
||||
let servicesVersion: string;
|
||||
@@ -1556,6 +1590,7 @@ declare module ts {
|
||||
getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[];
|
||||
getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[];
|
||||
findReferences(fileName: string, position: number): ReferencedSymbol[];
|
||||
getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[];
|
||||
getNavigationBarItems(fileName: string): NavigationBarItem[];
|
||||
getOutliningSpans(fileName: string): OutliningSpan[];
|
||||
@@ -1642,6 +1677,10 @@ declare module ts {
|
||||
containerKind: string;
|
||||
containerName: string;
|
||||
}
|
||||
interface ReferencedSymbol {
|
||||
definition: DefinitionInfo;
|
||||
references: ReferenceEntry[];
|
||||
}
|
||||
enum SymbolDisplayPartKind {
|
||||
aliasName = 0,
|
||||
className = 1,
|
||||
@@ -1935,6 +1974,7 @@ declare module ts {
|
||||
isCancellationRequested(): boolean;
|
||||
throwIfCancellationRequested(): void;
|
||||
}
|
||||
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string;
|
||||
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;
|
||||
|
||||
+8865
-6538
File diff suppressed because it is too large
Load Diff
Vendored
+65
-8
@@ -41,6 +41,10 @@ declare module ts {
|
||||
*/
|
||||
function lastOrUndefined<T>(array: T[]): T;
|
||||
function binarySearch(array: number[], value: number): number;
|
||||
function reduceLeft<T>(array: T[], f: (a: T, x: T) => T): T;
|
||||
function reduceLeft<T, U>(array: T[], f: (a: U, x: T) => U, initial: U): U;
|
||||
function reduceRight<T>(array: T[], f: (a: T, x: T) => T): T;
|
||||
function reduceRight<T, U>(array: T[], f: (a: U, x: T) => U, initial: U): U;
|
||||
function hasProperty<T>(map: Map<T>, key: string): boolean;
|
||||
function getProperty<T>(map: Map<T>, key: string): T;
|
||||
function isEmpty<T>(map: Map<T>): boolean;
|
||||
@@ -49,7 +53,6 @@ declare module ts {
|
||||
function forEachValue<T, U>(map: Map<T>, callback: (value: T) => U): U;
|
||||
function forEachKey<T, U>(map: Map<T>, callback: (key: string) => U): U;
|
||||
function lookUp<T>(map: Map<T>, key: string): T;
|
||||
function mapToArray<T>(map: Map<T>): T[];
|
||||
function copyMap<T>(source: Map<T>, target: Map<T>): void;
|
||||
/**
|
||||
* Creates a map from the elements of an array.
|
||||
@@ -184,7 +187,7 @@ declare module ts {
|
||||
function isConst(node: Node): boolean;
|
||||
function isLet(node: Node): boolean;
|
||||
function isPrologueDirective(node: Node): boolean;
|
||||
function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode?: SourceFile): CommentRange[];
|
||||
function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode: SourceFile): CommentRange[];
|
||||
function getJsDocComments(node: Node, sourceFileOfNode: SourceFile): CommentRange[];
|
||||
let fullTripleSlashReferencePathRegEx: RegExp;
|
||||
function forEachReturnStatement<T>(body: Block, visitor: (stmt: ReturnStatement) => T): T;
|
||||
@@ -195,6 +198,10 @@ declare module ts {
|
||||
function getThisContainer(node: Node, includeArrowFunctions: boolean): Node;
|
||||
function getSuperContainer(node: Node, includeFunctions: boolean): Node;
|
||||
function getInvokedExpression(node: CallLikeExpression): Expression;
|
||||
function nodeCanBeDecorated(node: Node): boolean;
|
||||
function nodeIsDecorated(node: Node): boolean;
|
||||
function childIsDecorated(node: Node): boolean;
|
||||
function nodeOrChildIsDecorated(node: Node): boolean;
|
||||
function isExpression(node: Node): boolean;
|
||||
function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean): boolean;
|
||||
function isExternalModuleImportEqualsDeclaration(node: Node): boolean;
|
||||
@@ -211,10 +218,12 @@ declare module ts {
|
||||
function isInAmbientContext(node: Node): boolean;
|
||||
function isDeclaration(node: Node): boolean;
|
||||
function isStatement(n: Node): boolean;
|
||||
function isClassElement(n: Node): boolean;
|
||||
function isDeclarationName(name: Node): boolean;
|
||||
function getClassBaseTypeNode(node: ClassDeclaration): TypeReferenceNode;
|
||||
function getClassImplementedTypeNodes(node: ClassDeclaration): NodeArray<TypeReferenceNode>;
|
||||
function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray<TypeReferenceNode>;
|
||||
function isAliasSymbolDeclaration(node: Node): boolean;
|
||||
function getClassExtendsHeritageClauseElement(node: ClassLikeDeclaration): HeritageClauseElement;
|
||||
function getClassImplementsHeritageClauseElements(node: ClassDeclaration): NodeArray<HeritageClauseElement>;
|
||||
function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray<HeritageClauseElement>;
|
||||
function getHeritageClause(clauses: NodeArray<HeritageClause>, kind: SyntaxKind): HeritageClause;
|
||||
function tryResolveScriptReference(host: ScriptReferenceHost, sourceFile: SourceFile, reference: FileReference): SourceFile;
|
||||
function getAncestor(node: Node, kind: SyntaxKind): Node;
|
||||
@@ -270,7 +279,6 @@ declare module ts {
|
||||
function nodeStartsNewLexicalEnvironment(n: Node): boolean;
|
||||
function nodeIsSynthesized(node: Node): boolean;
|
||||
function createSynthesizedNode(kind: SyntaxKind, startsOnNewLine?: boolean): Node;
|
||||
function generateUniqueName(baseName: string, isExistingName: (name: string) => boolean): string;
|
||||
/**
|
||||
* Based heavily on the abstract 'Quote'/'QuoteJSONString' operation from ECMA-262 (24.3.2.2),
|
||||
* but augmented for a few select characters (e.g. lineSeparator, paragraphSeparator, nextLine)
|
||||
@@ -278,11 +286,54 @@ declare module ts {
|
||||
*/
|
||||
function escapeString(s: string): string;
|
||||
function escapeNonAsciiCharacters(s: string): string;
|
||||
interface EmitTextWriter {
|
||||
write(s: string): void;
|
||||
writeTextOfNode(sourceFile: SourceFile, node: Node): void;
|
||||
writeLine(): void;
|
||||
increaseIndent(): void;
|
||||
decreaseIndent(): void;
|
||||
getText(): string;
|
||||
rawWrite(s: string): void;
|
||||
writeLiteral(s: string): void;
|
||||
getTextPos(): number;
|
||||
getLine(): number;
|
||||
getColumn(): number;
|
||||
getIndent(): number;
|
||||
}
|
||||
function getIndentString(level: number): string;
|
||||
function getIndentSize(): number;
|
||||
function createTextWriter(newLine: String): EmitTextWriter;
|
||||
function getOwnEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost, extension: string): string;
|
||||
function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string): string;
|
||||
function writeFile(host: EmitHost, diagnostics: Diagnostic[], fileName: string, data: string, writeByteOrderMark: boolean): void;
|
||||
function getLineOfLocalPosition(currentSourceFile: SourceFile, pos: number): number;
|
||||
function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration;
|
||||
function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean;
|
||||
function getAllAccessorDeclarations(declarations: NodeArray<Declaration>, accessor: AccessorDeclaration): {
|
||||
firstAccessor: AccessorDeclaration;
|
||||
secondAccessor: AccessorDeclaration;
|
||||
getAccessor: AccessorDeclaration;
|
||||
setAccessor: AccessorDeclaration;
|
||||
};
|
||||
function emitNewLineBeforeLeadingComments(currentSourceFile: SourceFile, writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]): void;
|
||||
function emitComments(currentSourceFile: SourceFile, writer: EmitTextWriter, comments: CommentRange[], trailingSeparator: boolean, newLine: string, writeComment: (currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string) => void): void;
|
||||
function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string): void;
|
||||
function isSupportedHeritageClauseElement(node: HeritageClauseElement): boolean;
|
||||
function isRightSideOfQualifiedNameOrPropertyAccess(node: Node): boolean;
|
||||
function getLocalSymbolForExportDefault(symbol: Symbol): Symbol;
|
||||
}
|
||||
declare module ts {
|
||||
var optionDeclarations: CommandLineOption[];
|
||||
function parseCommandLine(commandLine: string[]): ParsedCommandLine;
|
||||
/**
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
*/
|
||||
function readConfigFile(fileName: string): any;
|
||||
/**
|
||||
* Parse the contents of a config file (tsconfig.json).
|
||||
* @param json The contents of the config file to parse
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
|
||||
}
|
||||
declare module ts {
|
||||
@@ -297,7 +348,10 @@ declare module ts {
|
||||
function rangeContainsStartEnd(range: TextRange, start: number, end: number): boolean;
|
||||
function rangeOverlapsWithStartEnd(r1: TextRange, start: number, end: number): boolean;
|
||||
function startEndOverlapsWithStartEnd(start1: number, end1: number, start2: number, end2: number): boolean;
|
||||
function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean;
|
||||
function isCompletedNode(n: Node, sourceFile: SourceFile): boolean;
|
||||
function findListItemInfo(node: Node): ListItemInfo;
|
||||
function hasChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): boolean;
|
||||
function findChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): Node;
|
||||
function findContainingList(node: Node): Node;
|
||||
function getTouchingWord(sourceFile: SourceFile, position: number): Node;
|
||||
@@ -320,9 +374,11 @@ declare module ts {
|
||||
function getNodeModifiers(node: Node): string;
|
||||
function getTypeArgumentOrTypeParameterList(node: Node): NodeArray<Node>;
|
||||
function isToken(n: Node): boolean;
|
||||
function isWord(kind: SyntaxKind): boolean;
|
||||
function isComment(kind: SyntaxKind): boolean;
|
||||
function isPunctuation(kind: SyntaxKind): boolean;
|
||||
function isInsideTemplateLiteral(node: LiteralExpression, position: number): boolean;
|
||||
function isAccessibilityModifier(kind: SyntaxKind): boolean;
|
||||
function compareDataObjects(dst: any, src: any): boolean;
|
||||
}
|
||||
declare module ts {
|
||||
@@ -333,6 +389,7 @@ declare module ts {
|
||||
function keywordPart(kind: SyntaxKind): SymbolDisplayPart;
|
||||
function punctuationPart(kind: SyntaxKind): SymbolDisplayPart;
|
||||
function operatorPart(kind: SyntaxKind): SymbolDisplayPart;
|
||||
function textOrKeywordPart(text: string): SymbolDisplayPart;
|
||||
function textPart(text: string): SymbolDisplayPart;
|
||||
function lineBreakPart(): SymbolDisplayPart;
|
||||
function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[];
|
||||
|
||||
Vendored
+65
-8
@@ -41,6 +41,10 @@ declare module "typescript" {
|
||||
*/
|
||||
function lastOrUndefined<T>(array: T[]): T;
|
||||
function binarySearch(array: number[], value: number): number;
|
||||
function reduceLeft<T>(array: T[], f: (a: T, x: T) => T): T;
|
||||
function reduceLeft<T, U>(array: T[], f: (a: U, x: T) => U, initial: U): U;
|
||||
function reduceRight<T>(array: T[], f: (a: T, x: T) => T): T;
|
||||
function reduceRight<T, U>(array: T[], f: (a: U, x: T) => U, initial: U): U;
|
||||
function hasProperty<T>(map: Map<T>, key: string): boolean;
|
||||
function getProperty<T>(map: Map<T>, key: string): T;
|
||||
function isEmpty<T>(map: Map<T>): boolean;
|
||||
@@ -49,7 +53,6 @@ declare module "typescript" {
|
||||
function forEachValue<T, U>(map: Map<T>, callback: (value: T) => U): U;
|
||||
function forEachKey<T, U>(map: Map<T>, callback: (key: string) => U): U;
|
||||
function lookUp<T>(map: Map<T>, key: string): T;
|
||||
function mapToArray<T>(map: Map<T>): T[];
|
||||
function copyMap<T>(source: Map<T>, target: Map<T>): void;
|
||||
/**
|
||||
* Creates a map from the elements of an array.
|
||||
@@ -184,7 +187,7 @@ declare module "typescript" {
|
||||
function isConst(node: Node): boolean;
|
||||
function isLet(node: Node): boolean;
|
||||
function isPrologueDirective(node: Node): boolean;
|
||||
function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode?: SourceFile): CommentRange[];
|
||||
function getLeadingCommentRangesOfNode(node: Node, sourceFileOfNode: SourceFile): CommentRange[];
|
||||
function getJsDocComments(node: Node, sourceFileOfNode: SourceFile): CommentRange[];
|
||||
let fullTripleSlashReferencePathRegEx: RegExp;
|
||||
function forEachReturnStatement<T>(body: Block, visitor: (stmt: ReturnStatement) => T): T;
|
||||
@@ -195,6 +198,10 @@ declare module "typescript" {
|
||||
function getThisContainer(node: Node, includeArrowFunctions: boolean): Node;
|
||||
function getSuperContainer(node: Node, includeFunctions: boolean): Node;
|
||||
function getInvokedExpression(node: CallLikeExpression): Expression;
|
||||
function nodeCanBeDecorated(node: Node): boolean;
|
||||
function nodeIsDecorated(node: Node): boolean;
|
||||
function childIsDecorated(node: Node): boolean;
|
||||
function nodeOrChildIsDecorated(node: Node): boolean;
|
||||
function isExpression(node: Node): boolean;
|
||||
function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean): boolean;
|
||||
function isExternalModuleImportEqualsDeclaration(node: Node): boolean;
|
||||
@@ -211,10 +218,12 @@ declare module "typescript" {
|
||||
function isInAmbientContext(node: Node): boolean;
|
||||
function isDeclaration(node: Node): boolean;
|
||||
function isStatement(n: Node): boolean;
|
||||
function isClassElement(n: Node): boolean;
|
||||
function isDeclarationName(name: Node): boolean;
|
||||
function getClassBaseTypeNode(node: ClassDeclaration): TypeReferenceNode;
|
||||
function getClassImplementedTypeNodes(node: ClassDeclaration): NodeArray<TypeReferenceNode>;
|
||||
function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray<TypeReferenceNode>;
|
||||
function isAliasSymbolDeclaration(node: Node): boolean;
|
||||
function getClassExtendsHeritageClauseElement(node: ClassLikeDeclaration): HeritageClauseElement;
|
||||
function getClassImplementsHeritageClauseElements(node: ClassDeclaration): NodeArray<HeritageClauseElement>;
|
||||
function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray<HeritageClauseElement>;
|
||||
function getHeritageClause(clauses: NodeArray<HeritageClause>, kind: SyntaxKind): HeritageClause;
|
||||
function tryResolveScriptReference(host: ScriptReferenceHost, sourceFile: SourceFile, reference: FileReference): SourceFile;
|
||||
function getAncestor(node: Node, kind: SyntaxKind): Node;
|
||||
@@ -270,7 +279,6 @@ declare module "typescript" {
|
||||
function nodeStartsNewLexicalEnvironment(n: Node): boolean;
|
||||
function nodeIsSynthesized(node: Node): boolean;
|
||||
function createSynthesizedNode(kind: SyntaxKind, startsOnNewLine?: boolean): Node;
|
||||
function generateUniqueName(baseName: string, isExistingName: (name: string) => boolean): string;
|
||||
/**
|
||||
* Based heavily on the abstract 'Quote'/'QuoteJSONString' operation from ECMA-262 (24.3.2.2),
|
||||
* but augmented for a few select characters (e.g. lineSeparator, paragraphSeparator, nextLine)
|
||||
@@ -278,11 +286,54 @@ declare module "typescript" {
|
||||
*/
|
||||
function escapeString(s: string): string;
|
||||
function escapeNonAsciiCharacters(s: string): string;
|
||||
interface EmitTextWriter {
|
||||
write(s: string): void;
|
||||
writeTextOfNode(sourceFile: SourceFile, node: Node): void;
|
||||
writeLine(): void;
|
||||
increaseIndent(): void;
|
||||
decreaseIndent(): void;
|
||||
getText(): string;
|
||||
rawWrite(s: string): void;
|
||||
writeLiteral(s: string): void;
|
||||
getTextPos(): number;
|
||||
getLine(): number;
|
||||
getColumn(): number;
|
||||
getIndent(): number;
|
||||
}
|
||||
function getIndentString(level: number): string;
|
||||
function getIndentSize(): number;
|
||||
function createTextWriter(newLine: String): EmitTextWriter;
|
||||
function getOwnEmitOutputFilePath(sourceFile: SourceFile, host: EmitHost, extension: string): string;
|
||||
function getSourceFilePathInNewDir(sourceFile: SourceFile, host: EmitHost, newDirPath: string): string;
|
||||
function writeFile(host: EmitHost, diagnostics: Diagnostic[], fileName: string, data: string, writeByteOrderMark: boolean): void;
|
||||
function getLineOfLocalPosition(currentSourceFile: SourceFile, pos: number): number;
|
||||
function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration;
|
||||
function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean;
|
||||
function getAllAccessorDeclarations(declarations: NodeArray<Declaration>, accessor: AccessorDeclaration): {
|
||||
firstAccessor: AccessorDeclaration;
|
||||
secondAccessor: AccessorDeclaration;
|
||||
getAccessor: AccessorDeclaration;
|
||||
setAccessor: AccessorDeclaration;
|
||||
};
|
||||
function emitNewLineBeforeLeadingComments(currentSourceFile: SourceFile, writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]): void;
|
||||
function emitComments(currentSourceFile: SourceFile, writer: EmitTextWriter, comments: CommentRange[], trailingSeparator: boolean, newLine: string, writeComment: (currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string) => void): void;
|
||||
function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string): void;
|
||||
function isSupportedHeritageClauseElement(node: HeritageClauseElement): boolean;
|
||||
function isRightSideOfQualifiedNameOrPropertyAccess(node: Node): boolean;
|
||||
function getLocalSymbolForExportDefault(symbol: Symbol): Symbol;
|
||||
}
|
||||
declare module "typescript" {
|
||||
var optionDeclarations: CommandLineOption[];
|
||||
function parseCommandLine(commandLine: string[]): ParsedCommandLine;
|
||||
/**
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
*/
|
||||
function readConfigFile(fileName: string): any;
|
||||
/**
|
||||
* Parse the contents of a config file (tsconfig.json).
|
||||
* @param json The contents of the config file to parse
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
|
||||
}
|
||||
declare module "typescript" {
|
||||
@@ -297,7 +348,10 @@ declare module "typescript" {
|
||||
function rangeContainsStartEnd(range: TextRange, start: number, end: number): boolean;
|
||||
function rangeOverlapsWithStartEnd(r1: TextRange, start: number, end: number): boolean;
|
||||
function startEndOverlapsWithStartEnd(start1: number, end1: number, start2: number, end2: number): boolean;
|
||||
function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean;
|
||||
function isCompletedNode(n: Node, sourceFile: SourceFile): boolean;
|
||||
function findListItemInfo(node: Node): ListItemInfo;
|
||||
function hasChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): boolean;
|
||||
function findChildOfKind(n: Node, kind: SyntaxKind, sourceFile?: SourceFile): Node;
|
||||
function findContainingList(node: Node): Node;
|
||||
function getTouchingWord(sourceFile: SourceFile, position: number): Node;
|
||||
@@ -320,9 +374,11 @@ declare module "typescript" {
|
||||
function getNodeModifiers(node: Node): string;
|
||||
function getTypeArgumentOrTypeParameterList(node: Node): NodeArray<Node>;
|
||||
function isToken(n: Node): boolean;
|
||||
function isWord(kind: SyntaxKind): boolean;
|
||||
function isComment(kind: SyntaxKind): boolean;
|
||||
function isPunctuation(kind: SyntaxKind): boolean;
|
||||
function isInsideTemplateLiteral(node: LiteralExpression, position: number): boolean;
|
||||
function isAccessibilityModifier(kind: SyntaxKind): boolean;
|
||||
function compareDataObjects(dst: any, src: any): boolean;
|
||||
}
|
||||
declare module "typescript" {
|
||||
@@ -333,6 +389,7 @@ declare module "typescript" {
|
||||
function keywordPart(kind: SyntaxKind): SymbolDisplayPart;
|
||||
function punctuationPart(kind: SyntaxKind): SymbolDisplayPart;
|
||||
function operatorPart(kind: SyntaxKind): SymbolDisplayPart;
|
||||
function textOrKeywordPart(text: string): SymbolDisplayPart;
|
||||
function textPart(text: string): SymbolDisplayPart;
|
||||
function lineBreakPart(): SymbolDisplayPart;
|
||||
function mapToDisplayParts(writeDisplayParts: (writer: DisplayPartsSymbolWriter) => void): SymbolDisplayPart[];
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+1
-1
@@ -545,7 +545,7 @@ class CheckingAccount extends BankAccount {
|
||||
}
|
||||
```
|
||||
|
||||
In this example, the class 'CheckingAccount' *derives* from class 'BankAccount'. The constructor for 'CheckingAccount' calls the constructor for class 'BankAccount' using the 'super' keyword. In the emitted JavaScript code, the prototype of 'CheckingAccount' will chain to the prototype of 'BankingAccount'.
|
||||
In this example, the class 'CheckingAccount' *derives* from class 'BankAccount'. The constructor for 'CheckingAccount' calls the constructor for class 'BankAccount' using the 'super' keyword. In the emitted JavaScript code, the prototype of 'CheckingAccount' will chain to the prototype of 'BankAccount'.
|
||||
|
||||
TypeScript classes may also specify static members. Static class members become properties of the class constructor.
|
||||
|
||||
|
||||
+18
-9
@@ -168,7 +168,7 @@ module ts {
|
||||
addDeclarationToSymbol(symbol, node, includes);
|
||||
symbol.parent = parent;
|
||||
|
||||
if (node.kind === SyntaxKind.ClassDeclaration && symbol.exports) {
|
||||
if ((node.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.ClassExpression) && symbol.exports) {
|
||||
// TypeScript 1.0 spec (April 2014): 8.4
|
||||
// Every class automatically contains a static property member named 'prototype',
|
||||
// the type of which is an instantiation of the class type with type Any supplied as a type argument for each type parameter.
|
||||
@@ -286,6 +286,7 @@ module ts {
|
||||
case SyntaxKind.ArrowFunction:
|
||||
declareSymbol(container.locals, undefined, node, symbolKind, symbolExcludes);
|
||||
break;
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
if (node.flags & NodeFlags.Static) {
|
||||
declareSymbol(container.symbol.exports, container.symbol, node, symbolKind, symbolExcludes);
|
||||
@@ -387,23 +388,28 @@ module ts {
|
||||
bindChildren(node, /*symbolKind:*/ 0, /*isBlockScopeContainer:*/ true);
|
||||
}
|
||||
|
||||
function bindBlockScopedVariableDeclaration(node: Declaration) {
|
||||
function bindBlockScopedDeclaration(node: Declaration, symbolKind: SymbolFlags, symbolExcludes: SymbolFlags) {
|
||||
switch (blockScopeContainer.kind) {
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
declareModuleMember(node, SymbolFlags.BlockScopedVariable, SymbolFlags.BlockScopedVariableExcludes);
|
||||
declareModuleMember(node, symbolKind, symbolExcludes);
|
||||
break;
|
||||
case SyntaxKind.SourceFile:
|
||||
if (isExternalModule(<SourceFile>container)) {
|
||||
declareModuleMember(node, SymbolFlags.BlockScopedVariable, SymbolFlags.BlockScopedVariableExcludes);
|
||||
declareModuleMember(node, symbolKind, symbolExcludes);
|
||||
break;
|
||||
}
|
||||
// fall through.
|
||||
default:
|
||||
if (!blockScopeContainer.locals) {
|
||||
blockScopeContainer.locals = {};
|
||||
}
|
||||
declareSymbol(blockScopeContainer.locals, undefined, node, SymbolFlags.BlockScopedVariable, SymbolFlags.BlockScopedVariableExcludes);
|
||||
declareSymbol(blockScopeContainer.locals, undefined, node, symbolKind, symbolExcludes);
|
||||
}
|
||||
bindChildren(node, SymbolFlags.BlockScopedVariable, /*isBlockScopeContainer*/ false);
|
||||
bindChildren(node, symbolKind, /*isBlockScopeContainer*/ false);
|
||||
}
|
||||
|
||||
function bindBlockScopedVariableDeclaration(node: Declaration) {
|
||||
bindBlockScopedDeclaration(node, SymbolFlags.BlockScopedVariable, SymbolFlags.BlockScopedVariableExcludes);
|
||||
}
|
||||
|
||||
function getDestructuringParameterName(node: Declaration) {
|
||||
@@ -485,11 +491,14 @@ module ts {
|
||||
case SyntaxKind.ArrowFunction:
|
||||
bindAnonymousDeclaration(<FunctionExpression>node, SymbolFlags.Function, "__function", /*isBlockScopeContainer*/ true);
|
||||
break;
|
||||
case SyntaxKind.ClassExpression:
|
||||
bindAnonymousDeclaration(<ClassExpression>node, SymbolFlags.Class, "__class", /*isBlockScopeContainer*/ false);
|
||||
break;
|
||||
case SyntaxKind.CatchClause:
|
||||
bindCatchVariableDeclaration(<CatchClause>node);
|
||||
break;
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Class, SymbolFlags.ClassExcludes, /*isBlockScopeContainer*/ false);
|
||||
bindBlockScopedDeclaration(<Declaration>node, SymbolFlags.Class, SymbolFlags.ClassExcludes);
|
||||
break;
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
bindDeclaration(<Declaration>node, SymbolFlags.Interface, SymbolFlags.InterfaceExcludes, /*isBlockScopeContainer*/ false);
|
||||
@@ -584,9 +593,9 @@ module ts {
|
||||
// containing class.
|
||||
if (node.flags & NodeFlags.AccessibilityModifier &&
|
||||
node.parent.kind === SyntaxKind.Constructor &&
|
||||
node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
(node.parent.parent.kind === SyntaxKind.ClassDeclaration || node.parent.parent.kind === SyntaxKind.ClassExpression)) {
|
||||
|
||||
let classDeclaration = <ClassDeclaration>node.parent.parent;
|
||||
let classDeclaration = <ClassLikeDeclaration>node.parent.parent;
|
||||
declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
|
||||
}
|
||||
}
|
||||
|
||||
+554
-162
File diff suppressed because it is too large
Load Diff
@@ -4,15 +4,12 @@
|
||||
/// <reference path="scanner.ts"/>
|
||||
|
||||
module ts {
|
||||
/* @internal */
|
||||
export var optionDeclarations: CommandLineOption[] = [
|
||||
{
|
||||
name: "charset",
|
||||
type: "string",
|
||||
},
|
||||
{
|
||||
name: "codepage",
|
||||
type: "number",
|
||||
},
|
||||
{
|
||||
name: "declaration",
|
||||
shortName: "d",
|
||||
@@ -78,10 +75,6 @@ module ts {
|
||||
name: "noLib",
|
||||
type: "boolean",
|
||||
},
|
||||
{
|
||||
name: "noLibCheck",
|
||||
type: "boolean",
|
||||
},
|
||||
{
|
||||
name: "noResolve",
|
||||
type: "boolean",
|
||||
@@ -117,6 +110,10 @@ module ts {
|
||||
type: "boolean",
|
||||
description: Diagnostics.Do_not_emit_comments_to_output,
|
||||
},
|
||||
{
|
||||
name: "separateCompilation",
|
||||
type: "boolean",
|
||||
},
|
||||
{
|
||||
name: "sourceMap",
|
||||
type: "boolean",
|
||||
@@ -140,18 +137,6 @@ module ts {
|
||||
description: Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation,
|
||||
experimental: true
|
||||
},
|
||||
{
|
||||
name: "preserveNewLines",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Preserve_new_lines_when_emitting_code,
|
||||
experimental: true
|
||||
},
|
||||
{
|
||||
name: "cacheDownlevelForOfLength",
|
||||
type: "boolean",
|
||||
description: "Cache length access when downlevel emitting for-of statements",
|
||||
experimental: true,
|
||||
},
|
||||
{
|
||||
name: "target",
|
||||
shortName: "t",
|
||||
@@ -171,9 +156,15 @@ module ts {
|
||||
shortName: "w",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Watch_input_files,
|
||||
},
|
||||
{
|
||||
name: "emitDecoratorMetadata",
|
||||
type: "boolean",
|
||||
experimental: true
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
/* @internal */
|
||||
export function parseCommandLine(commandLine: string[]): ParsedCommandLine {
|
||||
var options: CompilerOptions = {};
|
||||
var fileNames: string[] = [];
|
||||
@@ -283,6 +274,10 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
*/
|
||||
export function readConfigFile(fileName: string): any {
|
||||
try {
|
||||
var text = sys.readFile(fileName);
|
||||
@@ -292,6 +287,12 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the contents of a config file (tsconfig.json).
|
||||
* @param json The contents of the config file to parse
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
export function parseConfigFile(json: any, basePath?: string): ParsedCommandLine {
|
||||
var errors: Diagnostic[] = [];
|
||||
|
||||
|
||||
@@ -314,12 +314,12 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type: TypeNode | EntityName, getSymbolAccessibilityDiagnostic: GetSymbolAccessibilityDiagnostic) {
|
||||
function emitTypeWithNewGetSymbolAccessibilityDiagnostic(type: TypeNode | EntityName | HeritageClauseElement, getSymbolAccessibilityDiagnostic: GetSymbolAccessibilityDiagnostic) {
|
||||
writer.getSymbolAccessibilityDiagnostic = getSymbolAccessibilityDiagnostic;
|
||||
emitType(type);
|
||||
}
|
||||
|
||||
function emitType(type: TypeNode | StringLiteralExpression | Identifier | QualifiedName) {
|
||||
function emitType(type: TypeNode | StringLiteralExpression | Identifier | QualifiedName | HeritageClauseElement) {
|
||||
switch (type.kind) {
|
||||
case SyntaxKind.AnyKeyword:
|
||||
case SyntaxKind.StringKeyword:
|
||||
@@ -329,6 +329,8 @@ module ts {
|
||||
case SyntaxKind.VoidKeyword:
|
||||
case SyntaxKind.StringLiteral:
|
||||
return writeTextOfNode(currentSourceFile, type);
|
||||
case SyntaxKind.HeritageClauseElement:
|
||||
return emitHeritageClauseElement(<HeritageClauseElement>type);
|
||||
case SyntaxKind.TypeReference:
|
||||
return emitTypeReference(<TypeReferenceNode>type);
|
||||
case SyntaxKind.TypeQuery:
|
||||
@@ -350,11 +352,9 @@ module ts {
|
||||
return emitEntityName(<Identifier>type);
|
||||
case SyntaxKind.QualifiedName:
|
||||
return emitEntityName(<QualifiedName>type);
|
||||
default:
|
||||
Debug.fail("Unknown type annotation: " + type.kind);
|
||||
}
|
||||
|
||||
function emitEntityName(entityName: EntityName) {
|
||||
function emitEntityName(entityName: EntityName | PropertyAccessExpression) {
|
||||
let visibilityResult = resolver.isEntityNameVisible(entityName,
|
||||
// Aliases can be written asynchronously so use correct enclosing declaration
|
||||
entityName.parent.kind === SyntaxKind.ImportEqualsDeclaration ? entityName.parent : enclosingDeclaration);
|
||||
@@ -362,15 +362,28 @@ module ts {
|
||||
handleSymbolAccessibilityError(visibilityResult);
|
||||
writeEntityName(entityName);
|
||||
|
||||
function writeEntityName(entityName: EntityName) {
|
||||
function writeEntityName(entityName: EntityName | Expression) {
|
||||
if (entityName.kind === SyntaxKind.Identifier) {
|
||||
writeTextOfNode(currentSourceFile, entityName);
|
||||
}
|
||||
else {
|
||||
let qualifiedName = <QualifiedName>entityName;
|
||||
writeEntityName(qualifiedName.left);
|
||||
let left = entityName.kind === SyntaxKind.QualifiedName ? (<QualifiedName>entityName).left : (<PropertyAccessExpression>entityName).expression;
|
||||
let right = entityName.kind === SyntaxKind.QualifiedName ? (<QualifiedName>entityName).right : (<PropertyAccessExpression>entityName).name;
|
||||
writeEntityName(left);
|
||||
write(".");
|
||||
writeTextOfNode(currentSourceFile, qualifiedName.right);
|
||||
writeTextOfNode(currentSourceFile, right);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function emitHeritageClauseElement(node: HeritageClauseElement) {
|
||||
if (isSupportedHeritageClauseElement(node)) {
|
||||
Debug.assert(node.expression.kind === SyntaxKind.Identifier || node.expression.kind === SyntaxKind.PropertyAccessExpression);
|
||||
emitEntityName(<Identifier | PropertyAccessExpression>node.expression);
|
||||
if (node.typeArguments) {
|
||||
write("<");
|
||||
emitCommaList(node.typeArguments, emitType);
|
||||
write(">");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -827,14 +840,16 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitHeritageClause(typeReferences: TypeReferenceNode[], isImplementsList: boolean) {
|
||||
function emitHeritageClause(typeReferences: HeritageClauseElement[], isImplementsList: boolean) {
|
||||
if (typeReferences) {
|
||||
write(isImplementsList ? " implements " : " extends ");
|
||||
emitCommaList(typeReferences, emitTypeOfTypeReference);
|
||||
}
|
||||
|
||||
function emitTypeOfTypeReference(node: TypeReferenceNode) {
|
||||
emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError);
|
||||
function emitTypeOfTypeReference(node: HeritageClauseElement) {
|
||||
if (isSupportedHeritageClauseElement(node)) {
|
||||
emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError);
|
||||
}
|
||||
|
||||
function getHeritageClauseVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
|
||||
let diagnosticMessage: DiagnosticMessage;
|
||||
@@ -877,11 +892,11 @@ module ts {
|
||||
let prevEnclosingDeclaration = enclosingDeclaration;
|
||||
enclosingDeclaration = node;
|
||||
emitTypeParameters(node.typeParameters);
|
||||
let baseTypeNode = getClassBaseTypeNode(node);
|
||||
let baseTypeNode = getClassExtendsHeritageClauseElement(node);
|
||||
if (baseTypeNode) {
|
||||
emitHeritageClause([baseTypeNode], /*isImplementsList*/ false);
|
||||
}
|
||||
emitHeritageClause(getClassImplementedTypeNodes(node), /*isImplementsList*/ true);
|
||||
emitHeritageClause(getClassImplementsHeritageClauseElements(node), /*isImplementsList*/ true);
|
||||
write(" {");
|
||||
writeLine();
|
||||
increaseIndent();
|
||||
@@ -993,7 +1008,18 @@ module ts {
|
||||
}
|
||||
|
||||
function emitBindingPattern(bindingPattern: BindingPattern) {
|
||||
emitCommaList(bindingPattern.elements, emitBindingElement);
|
||||
// Only select non-omitted expression from the bindingPattern's elements.
|
||||
// We have to do this to avoid emitting trailing commas.
|
||||
// For example:
|
||||
// original: var [, c,,] = [ 2,3,4]
|
||||
// emitted: declare var c: number; // instead of declare var c:number, ;
|
||||
let elements: Node[] = [];
|
||||
for (let element of bindingPattern.elements) {
|
||||
if (element.kind !== SyntaxKind.OmittedExpression){
|
||||
elements.push(element);
|
||||
}
|
||||
}
|
||||
emitCommaList(elements, emitBindingElement);
|
||||
}
|
||||
|
||||
function emitBindingElement(bindingElement: BindingElement) {
|
||||
@@ -1291,7 +1317,10 @@ module ts {
|
||||
write("...");
|
||||
}
|
||||
if (isBindingPattern(node.name)) {
|
||||
write("_" + indexOf((<FunctionLikeDeclaration>node.parent).parameters, node));
|
||||
// For bindingPattern, we can't simply writeTextOfNode from the source file
|
||||
// because we want to omit the initializer and using writeTextOfNode will result in initializer get emitted.
|
||||
// Therefore, we will have to recursively emit each element in the bindingPattern.
|
||||
emitBindingPattern(<BindingPattern>node.name);
|
||||
}
|
||||
else {
|
||||
writeTextOfNode(currentSourceFile, node.name);
|
||||
@@ -1311,41 +1340,46 @@ module ts {
|
||||
}
|
||||
|
||||
function getParameterDeclarationTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
|
||||
let diagnosticMessage: DiagnosticMessage;
|
||||
let diagnosticMessage: DiagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult);
|
||||
return diagnosticMessage !== undefined ? {
|
||||
diagnosticMessage,
|
||||
errorNode: node,
|
||||
typeName: node.name
|
||||
} : undefined;
|
||||
}
|
||||
|
||||
function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult: SymbolAccessiblityResult): DiagnosticMessage {
|
||||
switch (node.parent.kind) {
|
||||
case SyntaxKind.Constructor:
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
return symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;
|
||||
break;
|
||||
|
||||
case SyntaxKind.ConstructSignature:
|
||||
// Interfaces cannot have parameter types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
return symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
|
||||
break;
|
||||
|
||||
case SyntaxKind.CallSignature:
|
||||
// Interfaces cannot have parameter types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
return symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
|
||||
break;
|
||||
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
if (node.parent.flags & NodeFlags.Static) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
return symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
|
||||
}
|
||||
else if (node.parent.parent.kind === SyntaxKind.ClassDeclaration) {
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
return symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
|
||||
@@ -1353,30 +1387,99 @@ module ts {
|
||||
}
|
||||
else {
|
||||
// Interfaces cannot have parameter types that cannot be named
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
return symbolAccesibilityResult.errorModuleName ?
|
||||
Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
|
||||
}
|
||||
break;
|
||||
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
diagnosticMessage = symbolAccesibilityResult.errorModuleName ?
|
||||
return symbolAccesibilityResult.errorModuleName ?
|
||||
symbolAccesibilityResult.accessibility === SymbolAccessibility.CannotBeNamed ?
|
||||
Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
|
||||
Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 :
|
||||
Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1;
|
||||
break;
|
||||
|
||||
default:
|
||||
Debug.fail("This is unknown parent for parameter: " + node.parent.kind);
|
||||
}
|
||||
|
||||
return {
|
||||
diagnosticMessage,
|
||||
errorNode: node,
|
||||
typeName: node.name
|
||||
};
|
||||
}
|
||||
|
||||
function emitBindingPattern(bindingPattern: BindingPattern) {
|
||||
// We have to explicitly emit square bracket and bracket because these tokens are not store inside the node.
|
||||
if (bindingPattern.kind === SyntaxKind.ObjectBindingPattern) {
|
||||
write("{");
|
||||
emitCommaList(bindingPattern.elements, emitBindingElement);
|
||||
write("}");
|
||||
}
|
||||
else if (bindingPattern.kind === SyntaxKind.ArrayBindingPattern) {
|
||||
write("[");
|
||||
let elements = bindingPattern.elements;
|
||||
emitCommaList(elements, emitBindingElement);
|
||||
if (elements && elements.hasTrailingComma) {
|
||||
write(", ");
|
||||
}
|
||||
write("]");
|
||||
}
|
||||
}
|
||||
|
||||
function emitBindingElement(bindingElement: BindingElement) {
|
||||
function getBindingElementTypeVisibilityError(symbolAccesibilityResult: SymbolAccessiblityResult): SymbolAccessibilityDiagnostic {
|
||||
let diagnosticMessage = getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccesibilityResult);
|
||||
return diagnosticMessage !== undefined ? {
|
||||
diagnosticMessage,
|
||||
errorNode: bindingElement,
|
||||
typeName: bindingElement.name
|
||||
} : undefined;
|
||||
}
|
||||
|
||||
if (bindingElement.kind === SyntaxKind.OmittedExpression) {
|
||||
// If bindingElement is an omittedExpression (i.e. containing elision),
|
||||
// we will emit blank space (although this may differ from users' original code,
|
||||
// it allows emitSeparatedList to write separator appropriately)
|
||||
// Example:
|
||||
// original: function foo([, x, ,]) {}
|
||||
// emit : function foo([ , x, , ]) {}
|
||||
write(" ");
|
||||
}
|
||||
else if (bindingElement.kind === SyntaxKind.BindingElement) {
|
||||
if (bindingElement.propertyName) {
|
||||
// bindingElement has propertyName property in the following case:
|
||||
// { y: [a,b,c] ...} -> bindingPattern will have a property called propertyName for "y"
|
||||
// We have to explicitly emit the propertyName before descending into its binding elements.
|
||||
// Example:
|
||||
// original: function foo({y: [a,b,c]}) {}
|
||||
// emit : declare function foo({y: [a, b, c]}: { y: [any, any, any] }) void;
|
||||
writeTextOfNode(currentSourceFile, bindingElement.propertyName);
|
||||
write(": ");
|
||||
|
||||
// If bindingElement has propertyName property, then its name must be another bindingPattern of SyntaxKind.ObjectBindingPattern
|
||||
emitBindingPattern(<BindingPattern>bindingElement.name);
|
||||
}
|
||||
else if (bindingElement.name) {
|
||||
if (isBindingPattern(bindingElement.name)) {
|
||||
// If it is a nested binding pattern, we will recursively descend into each element and emit each one separately.
|
||||
// In the case of rest element, we will omit rest element.
|
||||
// Example:
|
||||
// original: function foo([a, [[b]], c] = [1,[["string"]], 3]) {}
|
||||
// emit : declare function foo([a, [[b]], c]: [number, [[string]], number]): void;
|
||||
// original with rest: function foo([a, ...c]) {}
|
||||
// emit : declare function foo([a, ...c]): void;
|
||||
emitBindingPattern(<BindingPattern>bindingElement.name);
|
||||
}
|
||||
else {
|
||||
Debug.assert(bindingElement.name.kind === SyntaxKind.Identifier);
|
||||
// If the node is just an identifier, we will simply emit the text associated with the node's name
|
||||
// Example:
|
||||
// original: function foo({y = 10, x}) {}
|
||||
// emit : declare function foo({y, x}: {number, any}): void;
|
||||
if (bindingElement.dotDotDotToken) {
|
||||
write("...");
|
||||
}
|
||||
writeTextOfNode(currentSourceFile, bindingElement.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function emitNode(node: Node) {
|
||||
|
||||
@@ -165,6 +165,10 @@ module ts {
|
||||
Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." },
|
||||
Decorators_are_not_valid_here: { code: 1206, category: DiagnosticCategory.Error, key: "Decorators are not valid here." },
|
||||
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." },
|
||||
Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." },
|
||||
Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." },
|
||||
Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: DiagnosticCategory.Error, key: "Invalid use of '{0}'. Class definitions are automatically in strict mode." },
|
||||
A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" },
|
||||
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
|
||||
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
|
||||
Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." },
|
||||
@@ -351,6 +355,8 @@ module ts {
|
||||
The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 2496, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." },
|
||||
External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." },
|
||||
External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." },
|
||||
An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." },
|
||||
A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." },
|
||||
Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." },
|
||||
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." },
|
||||
@@ -434,6 +440,11 @@ module ts {
|
||||
Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." },
|
||||
Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." },
|
||||
Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." },
|
||||
Option_sourceMap_cannot_be_specified_with_option_separateCompilation: { code: 5043, category: DiagnosticCategory.Error, key: "Option 'sourceMap' cannot be specified with option 'separateCompilation'." },
|
||||
Option_declaration_cannot_be_specified_with_option_separateCompilation: { code: 5044, category: DiagnosticCategory.Error, key: "Option 'declaration' cannot be specified with option 'separateCompilation'." },
|
||||
Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation: { code: 5045, category: DiagnosticCategory.Error, key: "Option 'noEmitOnError' cannot be specified with option 'separateCompilation'." },
|
||||
Option_out_cannot_be_specified_with_option_separateCompilation: { code: 5046, category: DiagnosticCategory.Error, key: "Option 'out' cannot be specified with option 'separateCompilation'." },
|
||||
Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher: { code: 5047, category: DiagnosticCategory.Error, key: "Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher." },
|
||||
Concatenate_and_emit_output_to_single_file: { code: 6001, category: DiagnosticCategory.Message, key: "Concatenate and emit output to single file." },
|
||||
Generates_corresponding_d_ts_file: { code: 6002, category: DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." },
|
||||
Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." },
|
||||
@@ -496,7 +507,26 @@ module ts {
|
||||
Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: DiagnosticCategory.Error, key: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." },
|
||||
You_cannot_rename_this_element: { code: 8000, category: DiagnosticCategory.Error, key: "You cannot rename this element." },
|
||||
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: DiagnosticCategory.Error, key: "You cannot rename elements that are defined in the standard TypeScript library." },
|
||||
import_can_only_be_used_in_a_ts_file: { code: 8002, category: DiagnosticCategory.Error, key: "'import ... =' can only be used in a .ts file." },
|
||||
export_can_only_be_used_in_a_ts_file: { code: 8003, category: DiagnosticCategory.Error, key: "'export=' can only be used in a .ts file." },
|
||||
type_parameter_declarations_can_only_be_used_in_a_ts_file: { code: 8004, category: DiagnosticCategory.Error, key: "'type parameter declarations' can only be used in a .ts file." },
|
||||
implements_clauses_can_only_be_used_in_a_ts_file: { code: 8005, category: DiagnosticCategory.Error, key: "'implements clauses' can only be used in a .ts file." },
|
||||
interface_declarations_can_only_be_used_in_a_ts_file: { code: 8006, category: DiagnosticCategory.Error, key: "'interface declarations' can only be used in a .ts file." },
|
||||
module_declarations_can_only_be_used_in_a_ts_file: { code: 8007, category: DiagnosticCategory.Error, key: "'module declarations' can only be used in a .ts file." },
|
||||
type_aliases_can_only_be_used_in_a_ts_file: { code: 8008, category: DiagnosticCategory.Error, key: "'type aliases' can only be used in a .ts file." },
|
||||
_0_can_only_be_used_in_a_ts_file: { code: 8009, category: DiagnosticCategory.Error, key: "'{0}' can only be used in a .ts file." },
|
||||
types_can_only_be_used_in_a_ts_file: { code: 8010, category: DiagnosticCategory.Error, key: "'types' can only be used in a .ts file." },
|
||||
type_arguments_can_only_be_used_in_a_ts_file: { code: 8011, category: DiagnosticCategory.Error, key: "'type arguments' can only be used in a .ts file." },
|
||||
parameter_modifiers_can_only_be_used_in_a_ts_file: { code: 8012, category: DiagnosticCategory.Error, key: "'parameter modifiers' can only be used in a .ts file." },
|
||||
can_only_be_used_in_a_ts_file: { code: 8013, category: DiagnosticCategory.Error, key: "'?' can only be used in a .ts file." },
|
||||
property_declarations_can_only_be_used_in_a_ts_file: { code: 8014, category: DiagnosticCategory.Error, key: "'property declarations' can only be used in a .ts file." },
|
||||
enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: DiagnosticCategory.Error, key: "'enum declarations' can only be used in a .ts file." },
|
||||
type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: DiagnosticCategory.Error, key: "'type assertion expressions' can only be used in a .ts file." },
|
||||
decorators_can_only_be_used_in_a_ts_file: { code: 8017, category: DiagnosticCategory.Error, key: "'decorators' can only be used in a .ts file." },
|
||||
yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." },
|
||||
Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." },
|
||||
Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses: { code: 9002, category: DiagnosticCategory.Error, key: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses." },
|
||||
class_expressions_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'class' expressions are not currently supported." },
|
||||
class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration: { code: 9004, category: DiagnosticCategory.Error, key: "'class' declarations are only supported directly inside a module or as a top level declaration." },
|
||||
};
|
||||
}
|
||||
@@ -651,7 +651,22 @@
|
||||
"category": "Error",
|
||||
"code": 1207
|
||||
},
|
||||
|
||||
"Cannot compile non-external modules when the '--separateCompilation' flag is provided.": {
|
||||
"category": "Error",
|
||||
"code": 1208
|
||||
},
|
||||
"Ambient const enums are not allowed when the '--separateCompilation' flag is provided.": {
|
||||
"category": "Error",
|
||||
"code": 1209
|
||||
},
|
||||
"Invalid use of '{0}'. Class definitions are automatically in strict mode.": {
|
||||
"category": "Error",
|
||||
"code": 1210
|
||||
},
|
||||
"A class declaration without the 'default' modifier must have a name": {
|
||||
"category": "Error",
|
||||
"code": 1211
|
||||
},
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2300
|
||||
@@ -1396,6 +1411,14 @@
|
||||
"category": "Error",
|
||||
"code": 2498
|
||||
},
|
||||
"An interface can only extend an identifier/qualified-name with optional type arguments.": {
|
||||
"category": "Error",
|
||||
"code": 2499
|
||||
},
|
||||
"A class can only implement an identifier/qualified-name with optional type arguments.": {
|
||||
"category": "Error",
|
||||
"code": 2500
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
@@ -1729,6 +1752,26 @@
|
||||
"category": "Error",
|
||||
"code": 5042
|
||||
},
|
||||
"Option 'sourceMap' cannot be specified with option 'separateCompilation'.": {
|
||||
"category": "Error",
|
||||
"code": 5043
|
||||
},
|
||||
"Option 'declaration' cannot be specified with option 'separateCompilation'.": {
|
||||
"category": "Error",
|
||||
"code": 5044
|
||||
},
|
||||
"Option 'noEmitOnError' cannot be specified with option 'separateCompilation'.": {
|
||||
"category": "Error",
|
||||
"code": 5045
|
||||
},
|
||||
"Option 'out' cannot be specified with option 'separateCompilation'.": {
|
||||
"category": "Error",
|
||||
"code": 5046
|
||||
},
|
||||
"Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher.": {
|
||||
"category": "Error",
|
||||
"code": 5047
|
||||
},
|
||||
"Concatenate and emit output to single file.": {
|
||||
"category": "Message",
|
||||
"code": 6001
|
||||
@@ -1978,6 +2021,71 @@
|
||||
"category": "Error",
|
||||
"code": 8001
|
||||
},
|
||||
"'import ... =' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8002
|
||||
},
|
||||
"'export=' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8003
|
||||
},
|
||||
"'type parameter declarations' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8004
|
||||
},
|
||||
"'implements clauses' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8005
|
||||
},
|
||||
"'interface declarations' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8006
|
||||
},
|
||||
"'module declarations' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8007
|
||||
},
|
||||
"'type aliases' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8008
|
||||
},
|
||||
"'{0}' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8009
|
||||
},
|
||||
"'types' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8010
|
||||
},
|
||||
"'type arguments' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8011
|
||||
},
|
||||
"'parameter modifiers' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8012
|
||||
},
|
||||
"'?' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8013
|
||||
},
|
||||
"'property declarations' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8014
|
||||
},
|
||||
"'enum declarations' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8015
|
||||
},
|
||||
"'type assertion expressions' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8016
|
||||
},
|
||||
"'decorators' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8017
|
||||
},
|
||||
|
||||
"'yield' expressions are not currently supported.": {
|
||||
"category": "Error",
|
||||
"code": 9000
|
||||
@@ -1985,5 +2093,17 @@
|
||||
"Generators are not currently supported.": {
|
||||
"category": "Error",
|
||||
"code": 9001
|
||||
},
|
||||
"Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.": {
|
||||
"category": "Error",
|
||||
"code": 9002
|
||||
},
|
||||
"'class' expressions are not currently supported.": {
|
||||
"category": "Error",
|
||||
"code": 9003
|
||||
},
|
||||
"'class' declarations are only supported directly inside a module or as a top level declaration.": {
|
||||
"category": "Error",
|
||||
"code": 9004
|
||||
}
|
||||
}
|
||||
|
||||
+815
-714
File diff suppressed because it is too large
Load Diff
+152
-47
@@ -237,12 +237,13 @@ module ts {
|
||||
case SyntaxKind.Decorator:
|
||||
return visitNode(cbNode, (<Decorator>node).expression);
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ClassExpression:
|
||||
return visitNodes(cbNodes, node.decorators) ||
|
||||
visitNodes(cbNodes, node.modifiers) ||
|
||||
visitNode(cbNode, (<ClassDeclaration>node).name) ||
|
||||
visitNodes(cbNodes, (<ClassDeclaration>node).typeParameters) ||
|
||||
visitNodes(cbNodes, (<ClassDeclaration>node).heritageClauses) ||
|
||||
visitNodes(cbNodes, (<ClassDeclaration>node).members);
|
||||
visitNode(cbNode, (<ClassLikeDeclaration>node).name) ||
|
||||
visitNodes(cbNodes, (<ClassLikeDeclaration>node).typeParameters) ||
|
||||
visitNodes(cbNodes, (<ClassLikeDeclaration>node).heritageClauses) ||
|
||||
visitNodes(cbNodes, (<ClassLikeDeclaration>node).members);
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
return visitNodes(cbNodes, node.decorators) ||
|
||||
visitNodes(cbNodes, node.modifiers) ||
|
||||
@@ -308,6 +309,9 @@ module ts {
|
||||
return visitNode(cbNode, (<ComputedPropertyName>node).expression);
|
||||
case SyntaxKind.HeritageClause:
|
||||
return visitNodes(cbNodes, (<HeritageClause>node).types);
|
||||
case SyntaxKind.HeritageClauseElement:
|
||||
return visitNode(cbNode, (<HeritageClauseElement>node).expression) ||
|
||||
visitNodes(cbNodes, (<HeritageClauseElement>node).typeArguments);
|
||||
case SyntaxKind.ExternalModuleReference:
|
||||
return visitNode(cbNode, (<ExternalModuleReference>node).expression);
|
||||
case SyntaxKind.MissingDeclaration:
|
||||
@@ -324,7 +328,7 @@ module ts {
|
||||
TypeMembers, // Members in interface or type literal
|
||||
ClassMembers, // Members in class declaration
|
||||
EnumMembers, // Members in enum declaration
|
||||
TypeReferences, // Type references in extends or implements clause
|
||||
HeritageClauseElement, // Elements in a heritage clause
|
||||
VariableDeclarations, // Variable declarations in variable statement
|
||||
ObjectBindingElements, // Binding elements in object binding list
|
||||
ArrayBindingElements, // Binding elements in array binding list
|
||||
@@ -356,7 +360,7 @@ module ts {
|
||||
case ParsingContext.TypeMembers: return Diagnostics.Property_or_signature_expected;
|
||||
case ParsingContext.ClassMembers: return Diagnostics.Unexpected_token_A_constructor_method_accessor_or_property_was_expected;
|
||||
case ParsingContext.EnumMembers: return Diagnostics.Enum_member_expected;
|
||||
case ParsingContext.TypeReferences: return Diagnostics.Type_reference_expected;
|
||||
case ParsingContext.HeritageClauseElement: return Diagnostics.Expression_expected;
|
||||
case ParsingContext.VariableDeclarations: return Diagnostics.Variable_declaration_expected;
|
||||
case ParsingContext.ObjectBindingElements: return Diagnostics.Property_destructuring_pattern_expected;
|
||||
case ParsingContext.ArrayBindingElements: return Diagnostics.Array_element_destructuring_pattern_expected;
|
||||
@@ -824,7 +828,7 @@ module ts {
|
||||
// to reuse are already at the appropriate position in the new text. That way when we
|
||||
// reuse them, we don't have to figure out if they need to be adjusted. Second, it makes
|
||||
// it very easy to determine if we can reuse a node. If the node's position is at where
|
||||
// we are in the text, then we can reuse it. Otherwise we can't. If hte node's position
|
||||
// we are in the text, then we can reuse it. Otherwise we can't. If the node's position
|
||||
// is ahead of us, then we'll need to rescan tokens. If the node's position is behind
|
||||
// us, then we'll need to skip it or crumble it as appropriate
|
||||
//
|
||||
@@ -1029,7 +1033,7 @@ module ts {
|
||||
// that some tokens that would be considered identifiers may be considered keywords.
|
||||
//
|
||||
// When adding more parser context flags, consider which is the more common case that the
|
||||
// flag will be in. This should be hte 'false' state for that flag. The reason for this is
|
||||
// flag will be in. This should be the 'false' state for that flag. The reason for this is
|
||||
// that we don't store data in our nodes unless the value is in the *non-default* state. So,
|
||||
// for example, more often than code 'allows-in' (or doesn't 'disallow-in'). We opt for
|
||||
// 'disallow-in' set to 'false'. Otherwise, if we had 'allowsIn' set to 'true', then almost
|
||||
@@ -1040,7 +1044,7 @@ module ts {
|
||||
//
|
||||
// An important thing about these context concepts. By default they are effectively inherited
|
||||
// while parsing through every grammar production. i.e. if you don't change them, then when
|
||||
// you parse a sub-production, it will have the same context values as hte parent production.
|
||||
// you parse a sub-production, it will have the same context values as the parent production.
|
||||
// This is great most of the time. After all, consider all the 'expression' grammar productions
|
||||
// and how nearly all of them pass along the 'in' and 'yield' context values:
|
||||
//
|
||||
@@ -1605,7 +1609,11 @@ module ts {
|
||||
case ParsingContext.TypeMembers:
|
||||
return isStartOfTypeMember();
|
||||
case ParsingContext.ClassMembers:
|
||||
return lookAhead(isClassMemberStart);
|
||||
// We allow semicolons as class elements (as specified by ES6) as long as we're
|
||||
// not in error recovery. If we're in error recovery, we don't want an errant
|
||||
// semicolon to be treated as a class member (since they're almost always used
|
||||
// for statements.
|
||||
return lookAhead(isClassMemberStart) || (token === SyntaxKind.SemicolonToken && !inErrorRecovery);
|
||||
case ParsingContext.EnumMembers:
|
||||
// Include open bracket computed properties. This technically also lets in indexers,
|
||||
// which would be a candidate for improved error reporting.
|
||||
@@ -1614,10 +1622,22 @@ module ts {
|
||||
return token === SyntaxKind.OpenBracketToken || token === SyntaxKind.AsteriskToken || isLiteralPropertyName();
|
||||
case ParsingContext.ObjectBindingElements:
|
||||
return isLiteralPropertyName();
|
||||
case ParsingContext.TypeReferences:
|
||||
// We want to make sure that the "extends" in "extends foo" or the "implements" in
|
||||
// "implements foo" is not considered a type name.
|
||||
return isIdentifier() && !isNotHeritageClauseTypeName();
|
||||
case ParsingContext.HeritageClauseElement:
|
||||
// If we see { } then only consume it as an expression if it is followed by , or {
|
||||
// That way we won't consume the body of a class in its heritage clause.
|
||||
if (token === SyntaxKind.OpenBraceToken) {
|
||||
return lookAhead(isValidHeritageClauseObjectLiteral);
|
||||
}
|
||||
|
||||
if (!inErrorRecovery) {
|
||||
return isStartOfLeftHandSideExpression() && !isHeritageClauseExtendsOrImplementsKeyword();
|
||||
}
|
||||
else {
|
||||
// If we're in error recovery we tighten up what we're willing to match.
|
||||
// That way we don't treat something like "this" as a valid heritage clause
|
||||
// element during recovery.
|
||||
return isIdentifier() && !isHeritageClauseExtendsOrImplementsKeyword();
|
||||
}
|
||||
case ParsingContext.VariableDeclarations:
|
||||
return isIdentifierOrPattern();
|
||||
case ParsingContext.ArrayBindingElements:
|
||||
@@ -1641,21 +1661,44 @@ module ts {
|
||||
Debug.fail("Non-exhaustive case in 'isListElement'.");
|
||||
}
|
||||
|
||||
function isValidHeritageClauseObjectLiteral() {
|
||||
Debug.assert(token === SyntaxKind.OpenBraceToken);
|
||||
if (nextToken() === SyntaxKind.CloseBraceToken) {
|
||||
// if we see "extends {}" then only treat the {} as what we're extending (and not
|
||||
// the class body) if we have:
|
||||
//
|
||||
// extends {} {
|
||||
// extends {},
|
||||
// extends {} extends
|
||||
// extends {} implements
|
||||
|
||||
let next = nextToken();
|
||||
return next === SyntaxKind.CommaToken || next === SyntaxKind.OpenBraceToken || next === SyntaxKind.ExtendsKeyword || next === SyntaxKind.ImplementsKeyword;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function nextTokenIsIdentifier() {
|
||||
nextToken();
|
||||
return isIdentifier();
|
||||
}
|
||||
|
||||
function isNotHeritageClauseTypeName(): boolean {
|
||||
function isHeritageClauseExtendsOrImplementsKeyword(): boolean {
|
||||
if (token === SyntaxKind.ImplementsKeyword ||
|
||||
token === SyntaxKind.ExtendsKeyword) {
|
||||
|
||||
return lookAhead(nextTokenIsIdentifier);
|
||||
return lookAhead(nextTokenIsStartOfExpression);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function nextTokenIsStartOfExpression() {
|
||||
nextToken();
|
||||
return isStartOfExpression();
|
||||
}
|
||||
|
||||
// True if positioned at a list terminator
|
||||
function isListTerminator(kind: ParsingContext): boolean {
|
||||
if (token === SyntaxKind.EndOfFileToken) {
|
||||
@@ -1676,7 +1719,7 @@ module ts {
|
||||
return token === SyntaxKind.CloseBraceToken;
|
||||
case ParsingContext.SwitchClauseStatements:
|
||||
return token === SyntaxKind.CloseBraceToken || token === SyntaxKind.CaseKeyword || token === SyntaxKind.DefaultKeyword;
|
||||
case ParsingContext.TypeReferences:
|
||||
case ParsingContext.HeritageClauseElement:
|
||||
return token === SyntaxKind.OpenBraceToken || token === SyntaxKind.ExtendsKeyword || token === SyntaxKind.ImplementsKeyword;
|
||||
case ParsingContext.VariableDeclarations:
|
||||
return isVariableDeclaratorListTerminator();
|
||||
@@ -1793,7 +1836,7 @@ module ts {
|
||||
// some node, then we cannot get a node from the old source tree. This is because we
|
||||
// want to mark the next node we encounter as being unusable.
|
||||
//
|
||||
// Note: This may be too conservative. Perhaps we could reuse hte node and set the bit
|
||||
// Note: This may be too conservative. Perhaps we could reuse the node and set the bit
|
||||
// on it (or its leftmost child) as having the error. For now though, being conservative
|
||||
// is nice and likely won't ever affect perf.
|
||||
if (parseErrorBeforeNextFinishedNode) {
|
||||
@@ -1891,12 +1934,6 @@ module ts {
|
||||
// This would probably be safe to reuse. There is no speculative parsing with
|
||||
// heritage clauses.
|
||||
|
||||
case ParsingContext.TypeReferences:
|
||||
// This would probably be safe to reuse. There is no speculative parsing with
|
||||
// type names in a heritage clause. There can be generic names in the type
|
||||
// name list. But because it is a type context, we never use speculative
|
||||
// parsing on the type argument list.
|
||||
|
||||
case ParsingContext.TypeParameters:
|
||||
// This would probably be safe to reuse. There is no speculative parsing with
|
||||
// type parameters. Note that that's because type *parameters* only occur in
|
||||
@@ -1923,6 +1960,12 @@ module ts {
|
||||
// cases. i.e. a property assignment may end with an expression, and thus might
|
||||
// have lookahead far beyond it's old node.
|
||||
case ParsingContext.ObjectLiteralMembers:
|
||||
|
||||
// This is probably not safe to reuse. There can be speculative parsing with
|
||||
// type names in a heritage clause. There can be generic names in the type
|
||||
// name list, and there can be left hand side expressions (which can have type
|
||||
// arguments.)
|
||||
case ParsingContext.HeritageClauseElement:
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1957,6 +2000,7 @@ module ts {
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.SemicolonClassElement:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2846,8 +2890,7 @@ module ts {
|
||||
}
|
||||
|
||||
// EXPRESSIONS
|
||||
|
||||
function isStartOfExpression(): boolean {
|
||||
function isStartOfLeftHandSideExpression(): boolean {
|
||||
switch (token) {
|
||||
case SyntaxKind.ThisKeyword:
|
||||
case SyntaxKind.SuperKeyword:
|
||||
@@ -2862,9 +2905,23 @@ module ts {
|
||||
case SyntaxKind.OpenBracketToken:
|
||||
case SyntaxKind.OpenBraceToken:
|
||||
case SyntaxKind.FunctionKeyword:
|
||||
case SyntaxKind.ClassKeyword:
|
||||
case SyntaxKind.NewKeyword:
|
||||
case SyntaxKind.SlashToken:
|
||||
case SyntaxKind.SlashEqualsToken:
|
||||
case SyntaxKind.Identifier:
|
||||
return true;
|
||||
default:
|
||||
return isIdentifier();
|
||||
}
|
||||
}
|
||||
|
||||
function isStartOfExpression(): boolean {
|
||||
if (isStartOfLeftHandSideExpression()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (token) {
|
||||
case SyntaxKind.PlusToken:
|
||||
case SyntaxKind.MinusToken:
|
||||
case SyntaxKind.TildeToken:
|
||||
@@ -2875,7 +2932,6 @@ module ts {
|
||||
case SyntaxKind.PlusPlusToken:
|
||||
case SyntaxKind.MinusMinusToken:
|
||||
case SyntaxKind.LessThanToken:
|
||||
case SyntaxKind.Identifier:
|
||||
case SyntaxKind.YieldKeyword:
|
||||
// Yield always starts an expression. Either it is an identifier (in which case
|
||||
// it is definitely an expression). Or it's a keyword (either because we're in
|
||||
@@ -2895,8 +2951,12 @@ module ts {
|
||||
}
|
||||
|
||||
function isStartOfExpressionStatement(): boolean {
|
||||
// As per the grammar, neither '{' nor 'function' can start an expression statement.
|
||||
return token !== SyntaxKind.OpenBraceToken && token !== SyntaxKind.FunctionKeyword && token !== SyntaxKind.AtToken && isStartOfExpression();
|
||||
// As per the grammar, none of '{' or 'function' or 'class' can start an expression statement.
|
||||
return token !== SyntaxKind.OpenBraceToken &&
|
||||
token !== SyntaxKind.FunctionKeyword &&
|
||||
token !== SyntaxKind.ClassKeyword &&
|
||||
token !== SyntaxKind.AtToken &&
|
||||
isStartOfExpression();
|
||||
}
|
||||
|
||||
function parseExpression(): Expression {
|
||||
@@ -3241,8 +3301,12 @@ module ts {
|
||||
return parseFunctionBlock(/*allowYield:*/ false, /* ignoreMissingOpenBrace */ false);
|
||||
}
|
||||
|
||||
if (isStartOfStatement(/*inErrorRecovery:*/ true) && !isStartOfExpressionStatement() && token !== SyntaxKind.FunctionKeyword) {
|
||||
// Check if we got a plain statement (i.e. no expression-statements, no functions expressions/declarations)
|
||||
if (isStartOfStatement(/*inErrorRecovery:*/ true) &&
|
||||
!isStartOfExpressionStatement() &&
|
||||
token !== SyntaxKind.FunctionKeyword &&
|
||||
token !== SyntaxKind.ClassKeyword) {
|
||||
|
||||
// Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations)
|
||||
//
|
||||
// Here we try to recover from a potential error situation in the case where the
|
||||
// user meant to supply a block. For example, if the user wrote:
|
||||
@@ -3667,7 +3731,6 @@ module ts {
|
||||
case SyntaxKind.CloseBracketToken: // foo<x>]
|
||||
case SyntaxKind.ColonToken: // foo<x>:
|
||||
case SyntaxKind.SemicolonToken: // foo<x>;
|
||||
case SyntaxKind.CommaToken: // foo<x>,
|
||||
case SyntaxKind.QuestionToken: // foo<x>?
|
||||
case SyntaxKind.EqualsEqualsToken: // foo<x> ==
|
||||
case SyntaxKind.EqualsEqualsEqualsToken: // foo<x> ===
|
||||
@@ -3685,6 +3748,12 @@ module ts {
|
||||
// treat it as such.
|
||||
return true;
|
||||
|
||||
case SyntaxKind.CommaToken: // foo<x>,
|
||||
case SyntaxKind.OpenBraceToken: // foo<x> {
|
||||
// We don't want to treat these as type arguments. Otherwise we'll parse this
|
||||
// as an invocation expression. Instead, we want to parse out the expression
|
||||
// in isolation from the type arguments.
|
||||
|
||||
default:
|
||||
// Anything else treat as an expression.
|
||||
return false;
|
||||
@@ -3709,6 +3778,8 @@ module ts {
|
||||
return parseArrayLiteralExpression();
|
||||
case SyntaxKind.OpenBraceToken:
|
||||
return parseObjectLiteralExpression();
|
||||
case SyntaxKind.ClassKeyword:
|
||||
return parseClassExpression();
|
||||
case SyntaxKind.FunctionKeyword:
|
||||
return parseFunctionExpression();
|
||||
case SyntaxKind.NewKeyword:
|
||||
@@ -4129,13 +4200,14 @@ module ts {
|
||||
}
|
||||
|
||||
function isStartOfStatement(inErrorRecovery: boolean): boolean {
|
||||
// Functions and variable statements are allowed as a statement. But as per the grammar,
|
||||
// they also allow modifiers. So we have to check for those statements that might be
|
||||
// following modifiers.This ensures that things work properly when incrementally parsing
|
||||
// as the parser will produce the same FunctionDeclaraiton or VariableStatement if it has
|
||||
// the same text regardless of whether it is inside a block or not.
|
||||
// Functions, variable statements and classes are allowed as a statement. But as per
|
||||
// the grammar, they also allow modifiers. So we have to check for those statements
|
||||
// that might be following modifiers.This ensures that things work properly when
|
||||
// incrementally parsing as the parser will produce the same FunctionDeclaraiton,
|
||||
// VariableStatement or ClassDeclaration, if it has the same text regardless of whether
|
||||
// it is inside a block or not.
|
||||
if (isModifier(token)) {
|
||||
let result = lookAhead(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers);
|
||||
let result = lookAhead(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers);
|
||||
if (result) {
|
||||
return true;
|
||||
}
|
||||
@@ -4154,6 +4226,7 @@ module ts {
|
||||
case SyntaxKind.VarKeyword:
|
||||
case SyntaxKind.LetKeyword:
|
||||
case SyntaxKind.FunctionKeyword:
|
||||
case SyntaxKind.ClassKeyword:
|
||||
case SyntaxKind.IfKeyword:
|
||||
case SyntaxKind.DoKeyword:
|
||||
case SyntaxKind.WhileKeyword:
|
||||
@@ -4178,7 +4251,6 @@ module ts {
|
||||
let isConstEnum = lookAhead(nextTokenIsEnumKeyword);
|
||||
return !isConstEnum;
|
||||
case SyntaxKind.InterfaceKeyword:
|
||||
case SyntaxKind.ClassKeyword:
|
||||
case SyntaxKind.ModuleKeyword:
|
||||
case SyntaxKind.EnumKeyword:
|
||||
case SyntaxKind.TypeKeyword:
|
||||
@@ -4222,6 +4294,8 @@ module ts {
|
||||
return parseVariableStatement(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined);
|
||||
case SyntaxKind.FunctionKeyword:
|
||||
return parseFunctionDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined);
|
||||
case SyntaxKind.ClassKeyword:
|
||||
return parseClassDeclaration(scanner.getStartPos(), /*decorators*/ undefined, /*modifiers:*/ undefined);
|
||||
case SyntaxKind.SemicolonToken:
|
||||
return parseEmptyStatement();
|
||||
case SyntaxKind.IfKeyword:
|
||||
@@ -4267,7 +4341,7 @@ module ts {
|
||||
// Even though variable statements and function declarations cannot have decorators,
|
||||
// we parse them here to provide better error recovery.
|
||||
if (isModifier(token) || token === SyntaxKind.AtToken) {
|
||||
let result = tryParse(parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers);
|
||||
let result = tryParse(parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
@@ -4277,7 +4351,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function parseVariableStatementOrFunctionDeclarationWithDecoratorsOrModifiers(): FunctionDeclaration | VariableStatement {
|
||||
function parseVariableStatementOrFunctionDeclarationOrClassDeclarationWithDecoratorsOrModifiers(): FunctionDeclaration | VariableStatement | ClassDeclaration {
|
||||
let start = scanner.getStartPos();
|
||||
let decorators = parseDecorators();
|
||||
let modifiers = parseModifiers();
|
||||
@@ -4297,8 +4371,12 @@ module ts {
|
||||
|
||||
case SyntaxKind.VarKeyword:
|
||||
return parseVariableStatement(start, decorators, modifiers);
|
||||
|
||||
case SyntaxKind.FunctionKeyword:
|
||||
return parseFunctionDeclaration(start, decorators, modifiers);
|
||||
|
||||
case SyntaxKind.ClassKeyword:
|
||||
return parseClassDeclaration(start, decorators, modifiers);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
@@ -4619,6 +4697,12 @@ module ts {
|
||||
}
|
||||
|
||||
function parseClassElement(): ClassElement {
|
||||
if (token === SyntaxKind.SemicolonToken) {
|
||||
let result = <SemicolonClassElement>createNode(SyntaxKind.SemicolonClassElement);
|
||||
nextToken();
|
||||
return finishNode(result);
|
||||
}
|
||||
|
||||
let fullStart = getNodePos();
|
||||
let decorators = parseDecorators();
|
||||
let modifiers = parseModifiers();
|
||||
@@ -4657,18 +4741,28 @@ module ts {
|
||||
Debug.fail("Should not have attempted to parse class member declaration.");
|
||||
}
|
||||
|
||||
function parseClassExpression(): ClassExpression {
|
||||
return <ClassExpression>parseClassDeclarationOrExpression(
|
||||
/*fullStart:*/ scanner.getStartPos(),
|
||||
/*decorators:*/ undefined,
|
||||
/*modifiers:*/ undefined,
|
||||
SyntaxKind.ClassExpression);
|
||||
}
|
||||
|
||||
function parseClassDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ClassDeclaration {
|
||||
return <ClassDeclaration>parseClassDeclarationOrExpression(fullStart, decorators, modifiers, SyntaxKind.ClassDeclaration);
|
||||
}
|
||||
|
||||
function parseClassDeclarationOrExpression(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, kind: SyntaxKind): ClassLikeDeclaration {
|
||||
// In ES6 specification, All parts of a ClassDeclaration or a ClassExpression are strict mode code
|
||||
let savedStrictModeContext = inStrictModeContext();
|
||||
if (languageVersion >= ScriptTarget.ES6) {
|
||||
setStrictModeContext(true);
|
||||
}
|
||||
setStrictModeContext(true);
|
||||
|
||||
var node = <ClassDeclaration>createNode(SyntaxKind.ClassDeclaration, fullStart);
|
||||
var node = <ClassLikeDeclaration>createNode(kind, fullStart);
|
||||
node.decorators = decorators;
|
||||
setModifiers(node, modifiers);
|
||||
parseExpected(SyntaxKind.ClassKeyword);
|
||||
node.name = node.flags & NodeFlags.Default ? parseOptionalIdentifier() : parseIdentifier();
|
||||
node.name = parseOptionalIdentifier();
|
||||
node.typeParameters = parseTypeParameters();
|
||||
node.heritageClauses = parseHeritageClauses(/*isClassHeritageClause:*/ true);
|
||||
|
||||
@@ -4714,13 +4808,23 @@ module ts {
|
||||
let node = <HeritageClause>createNode(SyntaxKind.HeritageClause);
|
||||
node.token = token;
|
||||
nextToken();
|
||||
node.types = parseDelimitedList(ParsingContext.TypeReferences, parseTypeReference);
|
||||
node.types = parseDelimitedList(ParsingContext.HeritageClauseElement, parseHeritageClauseElement);
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function parseHeritageClauseElement(): HeritageClauseElement {
|
||||
let node = <HeritageClauseElement>createNode(SyntaxKind.HeritageClauseElement);
|
||||
node.expression = parseLeftHandSideExpressionOrHigher();
|
||||
if (token === SyntaxKind.LessThanToken) {
|
||||
node.typeArguments = parseBracketedList(ParsingContext.TypeArguments, parseType, SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken);
|
||||
}
|
||||
|
||||
return finishNode(node);
|
||||
}
|
||||
|
||||
function isHeritageClause(): boolean {
|
||||
return token === SyntaxKind.ExtendsKeyword || token === SyntaxKind.ImplementsKeyword;
|
||||
}
|
||||
@@ -5263,6 +5367,7 @@ module ts {
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.Identifier:
|
||||
case SyntaxKind.RegularExpressionLiteral:
|
||||
|
||||
+34
-7
@@ -8,7 +8,7 @@ module ts {
|
||||
/* @internal */ export let ioWriteTime = 0;
|
||||
|
||||
/** The version of the TypeScript compiler release */
|
||||
export let version = "1.5.0.0";
|
||||
export let version = "1.5.0";
|
||||
|
||||
export function findConfigFile(searchPath: string): string {
|
||||
var fileName = "tsconfig.json";
|
||||
@@ -454,6 +454,24 @@ module ts {
|
||||
}
|
||||
|
||||
function verifyCompilerOptions() {
|
||||
if (options.separateCompilation) {
|
||||
if (options.sourceMap) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_sourceMap_cannot_be_specified_with_option_separateCompilation));
|
||||
}
|
||||
|
||||
if (options.declaration) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_declaration_cannot_be_specified_with_option_separateCompilation));
|
||||
}
|
||||
|
||||
if (options.noEmitOnError) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_noEmitOnError_cannot_be_specified_with_option_separateCompilation));
|
||||
}
|
||||
|
||||
if (options.out) {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_out_cannot_be_specified_with_option_separateCompilation));
|
||||
}
|
||||
}
|
||||
|
||||
if (!options.sourceMap && (options.mapRoot || options.sourceRoot)) {
|
||||
// Error to specify --mapRoot or --sourceRoot without mapSourceFiles
|
||||
if (options.mapRoot) {
|
||||
@@ -468,12 +486,21 @@ module ts {
|
||||
let languageVersion = options.target || ScriptTarget.ES3;
|
||||
|
||||
let firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined);
|
||||
if (firstExternalModuleSourceFile && !options.module) {
|
||||
if (options.separateCompilation) {
|
||||
if (!options.module && languageVersion < ScriptTarget.ES6) {
|
||||
// We cannot use createDiagnosticFromNode because nodes do not have parents yet
|
||||
let span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator);
|
||||
diagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided));
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Option_separateCompilation_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES6_or_higher));
|
||||
}
|
||||
|
||||
let firstNonExternalModuleSourceFile = forEach(files, f => !isExternalModule(f) && !isDeclarationFile(f) ? f : undefined);
|
||||
if (firstNonExternalModuleSourceFile) {
|
||||
let span = getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);
|
||||
diagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided));
|
||||
}
|
||||
}
|
||||
else if (firstExternalModuleSourceFile && languageVersion < ScriptTarget.ES6 && !options.module) {
|
||||
// We cannot use createDiagnosticFromNode because nodes do not have parents yet
|
||||
let span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator);
|
||||
diagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided));
|
||||
}
|
||||
|
||||
// Cannot specify module gen target when in es6 or above
|
||||
@@ -481,11 +508,11 @@ module ts {
|
||||
diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_external_modules_into_amd_or_commonjs_when_targeting_es6_or_higher));
|
||||
}
|
||||
|
||||
// there has to be common source directory if user specified --outdir || --sourcRoot
|
||||
// there has to be common source directory if user specified --outdir || --sourceRoot
|
||||
// if user specified --mapRoot, there needs to be common source directory if there would be multiple files being emitted
|
||||
if (options.outDir || // there is --outDir specified
|
||||
options.sourceRoot || // there is --sourceRoot specified
|
||||
(options.mapRoot && // there is --mapRoot Specified and there would be multiple js files generated
|
||||
(options.mapRoot && // there is --mapRoot specified and there would be multiple js files generated
|
||||
(!options.out || firstExternalModuleSourceFile !== undefined))) {
|
||||
|
||||
let commonPathComponents: string[];
|
||||
|
||||
@@ -276,6 +276,7 @@ module ts {
|
||||
|
||||
// If a source file changes, mark it as unwatched and start the recompilation timer
|
||||
function sourceFileChanged(sourceFile: SourceFile) {
|
||||
sourceFile.fileWatcher.close();
|
||||
sourceFile.fileWatcher = undefined;
|
||||
startTimer();
|
||||
}
|
||||
|
||||
+30
-9
@@ -203,9 +203,12 @@ module ts {
|
||||
TemplateExpression,
|
||||
YieldExpression,
|
||||
SpreadElementExpression,
|
||||
ClassExpression,
|
||||
OmittedExpression,
|
||||
// Misc
|
||||
TemplateSpan,
|
||||
HeritageClauseElement,
|
||||
SemicolonClassElement,
|
||||
// Element
|
||||
Block,
|
||||
VariableStatement,
|
||||
@@ -536,6 +539,11 @@ module ts {
|
||||
body?: Block;
|
||||
}
|
||||
|
||||
// For when we encounter a semicolon in a class declaration. ES6 allows these as class elements.
|
||||
export interface SemicolonClassElement extends ClassElement {
|
||||
_semicolonClassElementBrand: any;
|
||||
}
|
||||
|
||||
// See the comment on MethodDeclaration for the intuition behind AccessorDeclaration being a
|
||||
// ClassElement and an ObjectLiteralElement.
|
||||
export interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
|
||||
@@ -728,6 +736,11 @@ module ts {
|
||||
arguments: NodeArray<Expression>;
|
||||
}
|
||||
|
||||
export interface HeritageClauseElement extends Node {
|
||||
expression: LeftHandSideExpression;
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
}
|
||||
|
||||
export interface NewExpression extends CallExpression, PrimaryExpression { }
|
||||
|
||||
export interface TaggedTemplateExpression extends MemberExpression {
|
||||
@@ -849,13 +862,19 @@ module ts {
|
||||
_moduleElementBrand: any;
|
||||
}
|
||||
|
||||
export interface ClassDeclaration extends Declaration, ModuleElement {
|
||||
export interface ClassLikeDeclaration extends Declaration {
|
||||
name?: Identifier;
|
||||
typeParameters?: NodeArray<TypeParameterDeclaration>;
|
||||
heritageClauses?: NodeArray<HeritageClause>;
|
||||
members: NodeArray<ClassElement>;
|
||||
}
|
||||
|
||||
export interface ClassDeclaration extends ClassLikeDeclaration, Statement {
|
||||
}
|
||||
|
||||
export interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
|
||||
}
|
||||
|
||||
export interface ClassElement extends Declaration {
|
||||
_classElementBrand: any;
|
||||
}
|
||||
@@ -869,7 +888,7 @@ module ts {
|
||||
|
||||
export interface HeritageClause extends Node {
|
||||
token: SyntaxKind;
|
||||
types?: NodeArray<TypeReferenceNode>;
|
||||
types?: NodeArray<HeritageClauseElement>;
|
||||
}
|
||||
|
||||
export interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
@@ -914,7 +933,7 @@ module ts {
|
||||
// import "mod" => importClause = undefined, moduleSpecifier = "mod"
|
||||
// In rest of the cases, module specifier is string literal corresponding to module
|
||||
// ImportClause information is shown at its declaration below.
|
||||
export interface ImportDeclaration extends Statement, ModuleElement {
|
||||
export interface ImportDeclaration extends ModuleElement {
|
||||
importClause?: ImportClause;
|
||||
moduleSpecifier: Expression;
|
||||
}
|
||||
@@ -1127,7 +1146,7 @@ module ts {
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean;
|
||||
getAliasedSymbol(symbol: Symbol): Symbol;
|
||||
getExportsOfExternalModule(node: ImportDeclaration): Symbol[];
|
||||
getExportsOfModule(moduleSymbol: Symbol): Symbol[];
|
||||
|
||||
// Should not be called directly. Should only be accessed through the Program instance.
|
||||
/* @internal */ getDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
@@ -1231,11 +1250,14 @@ module ts {
|
||||
writeReturnTypeOfSignatureDeclaration(signatureDeclaration: SignatureDeclaration, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
writeTypeOfExpression(expr: Expression, enclosingDeclaration: Node, flags: TypeFormatFlags, writer: SymbolWriter): void;
|
||||
isSymbolAccessible(symbol: Symbol, enclosingDeclaration: Node, meaning: SymbolFlags): SymbolAccessiblityResult;
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
// Returns the constant value this property access resolves to, or 'undefined' for a non-constant
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
resolvesToSomeValue(location: Node, name: string): boolean;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
serializeTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
|
||||
serializeParameterTypesOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): (string | string[])[];
|
||||
serializeReturnTypeOfNode(node: Node, getGeneratedNameForNode: (Node: Node) => string): string | string[];
|
||||
}
|
||||
|
||||
export const enum SymbolFlags {
|
||||
@@ -1361,6 +1383,7 @@ module ts {
|
||||
EnumValuesComputed = 0x00000080,
|
||||
BlockScopedBindingInLoop = 0x00000100,
|
||||
EmitDecorate = 0x00000200, // Emit __decorate
|
||||
EmitParam = 0x00000400, // Emit __param helper for decorators
|
||||
}
|
||||
|
||||
export interface NodeLinks {
|
||||
@@ -1560,7 +1583,6 @@ module ts {
|
||||
export interface CompilerOptions {
|
||||
allowNonTsExtensions?: boolean;
|
||||
charset?: string;
|
||||
codepage?: number;
|
||||
declaration?: boolean;
|
||||
diagnostics?: boolean;
|
||||
emitBOM?: boolean;
|
||||
@@ -1574,7 +1596,6 @@ module ts {
|
||||
noErrorTruncation?: boolean;
|
||||
noImplicitAny?: boolean;
|
||||
noLib?: boolean;
|
||||
noLibCheck?: boolean;
|
||||
noResolve?: boolean;
|
||||
out?: string;
|
||||
outDir?: string;
|
||||
@@ -1587,9 +1608,9 @@ module ts {
|
||||
target?: ScriptTarget;
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
separateCompilation?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
/* @internal */ stripInternal?: boolean;
|
||||
/* @internal */ preserveNewLines?: boolean;
|
||||
/* @internal */ cacheDownlevelForOfLength?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
|
||||
|
||||
+84
-10
@@ -145,7 +145,7 @@ module ts {
|
||||
|
||||
return node.pos === node.end && node.kind !== SyntaxKind.EndOfFileToken;
|
||||
}
|
||||
|
||||
|
||||
export function nodeIsPresent(node: Node) {
|
||||
return !nodeIsMissing(node);
|
||||
}
|
||||
@@ -274,11 +274,19 @@ module ts {
|
||||
export function getErrorSpanForNode(sourceFile: SourceFile, node: Node): TextSpan {
|
||||
let errorNode = node;
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.SourceFile:
|
||||
let pos = skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false);
|
||||
if (pos === sourceFile.text.length) {
|
||||
// file is empty - return span for the beginning of the file
|
||||
return createTextSpan(0, 0);
|
||||
}
|
||||
return getSpanOfTokenAtPosition(sourceFile, pos);
|
||||
// This list is a work in progress. Add missing node kinds to improve their error
|
||||
// spans.
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.BindingElement:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
@@ -288,7 +296,7 @@ module ts {
|
||||
errorNode = (<Declaration>node).name;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (errorNode === undefined) {
|
||||
// If we don't have a better node, then just set the error on the first token of
|
||||
// construct.
|
||||
@@ -441,6 +449,18 @@ module ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isAccessor(node: Node): boolean {
|
||||
if (node) {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isFunctionLike(node: Node): boolean {
|
||||
if (node) {
|
||||
switch (node.kind) {
|
||||
@@ -506,6 +526,19 @@ module ts {
|
||||
// the *body* of the container.
|
||||
node = node.parent;
|
||||
break;
|
||||
case SyntaxKind.Decorator:
|
||||
// Decorators are always applied outside of the body of a class or method.
|
||||
if (node.parent.kind === SyntaxKind.Parameter && isClassElement(node.parent.parent)) {
|
||||
// If the decorator's parent is a Parameter, we resolve the this container from
|
||||
// the grandparent class declaration.
|
||||
node = node.parent.parent;
|
||||
}
|
||||
else if (isClassElement(node.parent)) {
|
||||
// If the decorator's parent is a class element, we resolve the 'this' container
|
||||
// from the parent class declaration.
|
||||
node = node.parent;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.ArrowFunction:
|
||||
if (!includeArrowFunctions) {
|
||||
continue;
|
||||
@@ -548,6 +581,19 @@ module ts {
|
||||
// the *body* of the container.
|
||||
node = node.parent;
|
||||
break;
|
||||
case SyntaxKind.Decorator:
|
||||
// Decorators are always applied outside of the body of a class or method.
|
||||
if (node.parent.kind === SyntaxKind.Parameter && isClassElement(node.parent.parent)) {
|
||||
// If the decorator's parent is a Parameter, we resolve the this container from
|
||||
// the grandparent class declaration.
|
||||
node = node.parent.parent;
|
||||
}
|
||||
else if (isClassElement(node.parent)) {
|
||||
// If the decorator's parent is a class element, we resolve the 'this' container
|
||||
// from the parent class declaration.
|
||||
node = node.parent;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
@@ -634,7 +680,7 @@ module ts {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
export function childIsDecorated(node: Node): boolean {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
@@ -670,6 +716,7 @@ module ts {
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.VoidExpression:
|
||||
case SyntaxKind.DeleteExpression:
|
||||
@@ -745,7 +792,7 @@ module ts {
|
||||
export function isInstantiatedModule(node: ModuleDeclaration, preserveConstEnums: boolean) {
|
||||
let moduleState = getModuleInstanceState(node)
|
||||
return moduleState === ModuleInstanceState.Instantiated ||
|
||||
(preserveConstEnums && moduleState === ModuleInstanceState.ConstEnumOnly);
|
||||
(preserveConstEnums && moduleState === ModuleInstanceState.ConstEnumOnly);
|
||||
}
|
||||
|
||||
export function isExternalModuleImportEqualsDeclaration(node: Node) {
|
||||
@@ -898,6 +945,7 @@ module ts {
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.IndexSignature:
|
||||
return true;
|
||||
default:
|
||||
@@ -942,12 +990,12 @@ module ts {
|
||||
node.kind === SyntaxKind.ExportAssignment && (<ExportAssignment>node).expression.kind === SyntaxKind.Identifier;
|
||||
}
|
||||
|
||||
export function getClassBaseTypeNode(node: ClassDeclaration) {
|
||||
export function getClassExtendsHeritageClauseElement(node: ClassLikeDeclaration) {
|
||||
let heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ExtendsKeyword);
|
||||
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
|
||||
}
|
||||
|
||||
export function getClassImplementedTypeNodes(node: ClassDeclaration) {
|
||||
export function getClassImplementsHeritageClauseElements(node: ClassDeclaration) {
|
||||
let heritageClause = getHeritageClause(node.heritageClauses, SyntaxKind.ImplementsKeyword);
|
||||
return heritageClause ? heritageClause.types : undefined;
|
||||
}
|
||||
@@ -1161,7 +1209,7 @@ module ts {
|
||||
export function createTextSpanFromBounds(start: number, end: number) {
|
||||
return createTextSpan(start, end - start);
|
||||
}
|
||||
|
||||
|
||||
export function textChangeRangeNewSpan(range: TextChangeRange) {
|
||||
return createTextSpan(range.span.start, range.newLength);
|
||||
}
|
||||
@@ -1435,13 +1483,13 @@ module ts {
|
||||
return escapedCharsMap[c] || get16BitUnicodeEscapeSequence(c.charCodeAt(0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function get16BitUnicodeEscapeSequence(charCode: number): string {
|
||||
let hexCharCode = charCode.toString(16).toUpperCase();
|
||||
let paddedHexCode = ("0000" + hexCharCode).slice(-4);
|
||||
return "\\u" + paddedHexCode;
|
||||
}
|
||||
|
||||
|
||||
let nonAsciiCharacters = /[^\u0000-\u007F]/g;
|
||||
export function escapeNonAsciiCharacters(s: string): string {
|
||||
// Replace non-ASCII characters with '\uNNNN' escapes if any exist.
|
||||
@@ -1573,7 +1621,7 @@ module ts {
|
||||
return getLineAndCharacterOfPosition(currentSourceFile, pos).line;
|
||||
}
|
||||
|
||||
export function getFirstConstructorWithBody(node: ClassDeclaration): ConstructorDeclaration {
|
||||
export function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration {
|
||||
return forEach(node.members, member => {
|
||||
if (member.kind === SyntaxKind.Constructor && nodeIsPresent((<ConstructorDeclaration>member).body)) {
|
||||
return <ConstructorDeclaration>member;
|
||||
@@ -1768,4 +1816,30 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
// Returns false if this heritage clause element's expression contains something unsupported
|
||||
// (i.e. not a name or dotted name).
|
||||
export function isSupportedHeritageClauseElement(node: HeritageClauseElement): boolean {
|
||||
return isSupportedHeritageClauseElementExpression(node.expression);
|
||||
}
|
||||
|
||||
function isSupportedHeritageClauseElementExpression(node: Expression): boolean {
|
||||
if (node.kind === SyntaxKind.Identifier) {
|
||||
return true;
|
||||
}
|
||||
else if (node.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
return isSupportedHeritageClauseElementExpression((<PropertyAccessExpression>node).expression);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function isRightSideOfQualifiedNameOrPropertyAccess(node: Node) {
|
||||
return (node.parent.kind === SyntaxKind.QualifiedName && (<QualifiedName>node.parent).right === node) ||
|
||||
(node.parent.kind === SyntaxKind.PropertyAccessExpression && (<PropertyAccessExpression>node.parent).name === node);
|
||||
}
|
||||
|
||||
export function getLocalSymbolForExportDefault(symbol: Symbol) {
|
||||
return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) ? symbol.valueDeclaration.localSymbol : undefined;
|
||||
}
|
||||
}
|
||||
|
||||
+30
-18
@@ -14,6 +14,7 @@
|
||||
//
|
||||
|
||||
/// <reference path='..\services\services.ts' />
|
||||
/// <reference path='..\services\shims.ts' />
|
||||
/// <reference path='harnessLanguageService.ts' />
|
||||
/// <reference path='harness.ts' />
|
||||
/// <reference path='fourslashRunner.ts' />
|
||||
@@ -115,7 +116,7 @@ module FourSlash {
|
||||
// Name of testcase metadata including ts.CompilerOptions properties that will be used by globalOptions
|
||||
// To add additional option, add property into the testOptMetadataNames, refer the property in either globalMetadataNames or fileMetadataNames
|
||||
// Add cases into convertGlobalOptionsToCompilationsSettings function for the compiler to acknowledge such option from meta data
|
||||
var testOptMetadataNames = {
|
||||
var metadataOptionNames = {
|
||||
baselineFile: 'BaselineFile',
|
||||
declaration: 'declaration',
|
||||
emitThisFile: 'emitThisFile', // This flag is used for testing getEmitOutput feature. It allows test-cases to indicate what file to be output in multiple files project
|
||||
@@ -126,14 +127,15 @@ module FourSlash {
|
||||
outDir: 'outDir',
|
||||
sourceMap: 'sourceMap',
|
||||
sourceRoot: 'sourceRoot',
|
||||
allowNonTsExtensions: 'allowNonTsExtensions',
|
||||
resolveReference: 'ResolveReference', // This flag is used to specify entry file for resolve file references. The flag is only allow once per test file
|
||||
};
|
||||
|
||||
// List of allowed metadata names
|
||||
var fileMetadataNames = [testOptMetadataNames.fileName, testOptMetadataNames.emitThisFile, testOptMetadataNames.resolveReference];
|
||||
var globalMetadataNames = [testOptMetadataNames.baselineFile, testOptMetadataNames.declaration,
|
||||
testOptMetadataNames.mapRoot, testOptMetadataNames.module, testOptMetadataNames.out,
|
||||
testOptMetadataNames.outDir, testOptMetadataNames.sourceMap, testOptMetadataNames.sourceRoot]
|
||||
var fileMetadataNames = [metadataOptionNames.fileName, metadataOptionNames.emitThisFile, metadataOptionNames.resolveReference];
|
||||
var globalMetadataNames = [metadataOptionNames.allowNonTsExtensions, metadataOptionNames.baselineFile, metadataOptionNames.declaration,
|
||||
metadataOptionNames.mapRoot, metadataOptionNames.module, metadataOptionNames.out,
|
||||
metadataOptionNames.outDir, metadataOptionNames.sourceMap, metadataOptionNames.sourceRoot]
|
||||
|
||||
function convertGlobalOptionsToCompilerOptions(globalOptions: { [idx: string]: string }): ts.CompilerOptions {
|
||||
var settings: ts.CompilerOptions = { target: ts.ScriptTarget.ES5 };
|
||||
@@ -141,13 +143,16 @@ module FourSlash {
|
||||
for (var prop in globalOptions) {
|
||||
if (globalOptions.hasOwnProperty(prop)) {
|
||||
switch (prop) {
|
||||
case testOptMetadataNames.declaration:
|
||||
case metadataOptionNames.allowNonTsExtensions:
|
||||
settings.allowNonTsExtensions = true;
|
||||
break;
|
||||
case metadataOptionNames.declaration:
|
||||
settings.declaration = true;
|
||||
break;
|
||||
case testOptMetadataNames.mapRoot:
|
||||
case metadataOptionNames.mapRoot:
|
||||
settings.mapRoot = globalOptions[prop];
|
||||
break;
|
||||
case testOptMetadataNames.module:
|
||||
case metadataOptionNames.module:
|
||||
// create appropriate external module target for CompilationSettings
|
||||
switch (globalOptions[prop]) {
|
||||
case "AMD":
|
||||
@@ -162,16 +167,16 @@ module FourSlash {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case testOptMetadataNames.out:
|
||||
case metadataOptionNames.out:
|
||||
settings.out = globalOptions[prop];
|
||||
break;
|
||||
case testOptMetadataNames.outDir:
|
||||
case metadataOptionNames.outDir:
|
||||
settings.outDir = globalOptions[prop];
|
||||
break;
|
||||
case testOptMetadataNames.sourceMap:
|
||||
case metadataOptionNames.sourceMap:
|
||||
settings.sourceMap = true;
|
||||
break;
|
||||
case testOptMetadataNames.sourceRoot:
|
||||
case metadataOptionNames.sourceRoot:
|
||||
settings.sourceRoot = globalOptions[prop];
|
||||
break;
|
||||
}
|
||||
@@ -303,7 +308,7 @@ module FourSlash {
|
||||
ts.forEach(testData.files, file => {
|
||||
// Create map between fileName and its content for easily looking up when resolveReference flag is specified
|
||||
this.inputFiles[file.fileName] = file.content;
|
||||
if (!startResolveFileRef && file.fileOptions[testOptMetadataNames.resolveReference]) {
|
||||
if (!startResolveFileRef && file.fileOptions[metadataOptionNames.resolveReference]) {
|
||||
startResolveFileRef = file;
|
||||
} else if (startResolveFileRef) {
|
||||
// If entry point for resolving file references is already specified, report duplication error
|
||||
@@ -793,6 +798,13 @@ module FourSlash {
|
||||
return "\nActual " + name + ":\n\t" + actualValue + "\nExpected value:\n\t" + expectedValue;
|
||||
}
|
||||
|
||||
public getSemanticDiagnostics(expected: string) {
|
||||
var diagnostics = this.languageService.getSemanticDiagnostics(this.activeFile.fileName);
|
||||
var realized = ts.realizeDiagnostics(diagnostics, "\r\n");
|
||||
var actual = JSON.stringify(realized, null, " ");
|
||||
assert.equal(actual, expected);
|
||||
}
|
||||
|
||||
public verifyQuickInfoString(negative: boolean, expectedText?: string, expectedDocumentation?: string) {
|
||||
[expectedText, expectedDocumentation].forEach(str => {
|
||||
if (str) {
|
||||
@@ -1131,7 +1143,7 @@ module FourSlash {
|
||||
|
||||
Harness.Baseline.runBaseline(
|
||||
"Breakpoint Locations for " + this.activeFile.fileName,
|
||||
this.testData.globalOptions[testOptMetadataNames.baselineFile],
|
||||
this.testData.globalOptions[metadataOptionNames.baselineFile],
|
||||
() => {
|
||||
return this.baselineCurrentFileLocations(pos => this.getBreakpointStatementLocation(pos));
|
||||
},
|
||||
@@ -1146,7 +1158,7 @@ module FourSlash {
|
||||
var allFourSlashFiles = this.testData.files;
|
||||
for (var idx = 0; idx < allFourSlashFiles.length; ++idx) {
|
||||
var file = allFourSlashFiles[idx];
|
||||
if (file.fileOptions[testOptMetadataNames.emitThisFile]) {
|
||||
if (file.fileOptions[metadataOptionNames.emitThisFile]) {
|
||||
// Find a file with the flag emitThisFile turned on
|
||||
emitFiles.push(file);
|
||||
}
|
||||
@@ -1159,7 +1171,7 @@ module FourSlash {
|
||||
|
||||
Harness.Baseline.runBaseline(
|
||||
"Generate getEmitOutput baseline : " + emitFiles.join(" "),
|
||||
this.testData.globalOptions[testOptMetadataNames.baselineFile],
|
||||
this.testData.globalOptions[metadataOptionNames.baselineFile],
|
||||
() => {
|
||||
var resultString = "";
|
||||
// Loop through all the emittedFiles and emit them one by one
|
||||
@@ -1704,7 +1716,7 @@ module FourSlash {
|
||||
|
||||
Harness.Baseline.runBaseline(
|
||||
"Name OrDottedNameSpans for " + this.activeFile.fileName,
|
||||
this.testData.globalOptions[testOptMetadataNames.baselineFile],
|
||||
this.testData.globalOptions[metadataOptionNames.baselineFile],
|
||||
() => {
|
||||
return this.baselineCurrentFileLocations(pos =>
|
||||
this.getNameOrDottedNameSpan(pos));
|
||||
@@ -2280,7 +2292,7 @@ module FourSlash {
|
||||
if (globalMetadataNamesIndex === -1) {
|
||||
if (fileMetadataNamesIndex === -1) {
|
||||
throw new Error('Unrecognized metadata name "' + match[1] + '". Available global metadata names are: ' + globalMetadataNames.join(', ') + '; file metadata names are: ' + fileMetadataNames.join(', '));
|
||||
} else if (fileMetadataNamesIndex === fileMetadataNames.indexOf(testOptMetadataNames.fileName)) {
|
||||
} else if (fileMetadataNamesIndex === fileMetadataNames.indexOf(metadataOptionNames.fileName)) {
|
||||
// Found an @FileName directive, if this is not the first then create a new subfile
|
||||
if (currentFileContent) {
|
||||
var file = parseFileContent(currentFileContent, currentFileName, markerPositions, markers, ranges);
|
||||
|
||||
+33
-21
@@ -781,7 +781,7 @@ module Harness {
|
||||
|
||||
public reset() { this.fileCollection = {}; }
|
||||
|
||||
public toArray(): { fileName: string; file: WriterAggregator; }[] {
|
||||
public toArray(): { fileName: string; file: WriterAggregator; }[]{
|
||||
var result: { fileName: string; file: WriterAggregator; }[] = [];
|
||||
for (var p in this.fileCollection) {
|
||||
if (this.fileCollection.hasOwnProperty(p)) {
|
||||
@@ -944,6 +944,10 @@ module Harness {
|
||||
|
||||
var newLine = '\r\n';
|
||||
|
||||
// Files from built\local that are requested by test "@includeBuiltFiles" to be in the context.
|
||||
// Treat them as library files, so include them in build, but not in baselines.
|
||||
var includeBuiltFiles: { unitName: string; content: string }[] = [];
|
||||
|
||||
var useCaseSensitiveFileNames = ts.sys.useCaseSensitiveFileNames;
|
||||
this.settings.forEach(setting => {
|
||||
switch (setting.flag.toLowerCase()) {
|
||||
@@ -1008,10 +1012,6 @@ module Harness {
|
||||
options.outDir = setting.value;
|
||||
break;
|
||||
|
||||
case 'preservenewlines':
|
||||
options.preserveNewLines = !!setting.value;
|
||||
break;
|
||||
|
||||
case 'sourceroot':
|
||||
options.sourceRoot = setting.value;
|
||||
break;
|
||||
@@ -1040,17 +1040,7 @@ module Harness {
|
||||
useCaseSensitiveFileNames = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'mapsourcefiles':
|
||||
case 'maproot':
|
||||
case 'generatedeclarationfiles':
|
||||
case 'gatherDiagnostics':
|
||||
case 'codepage':
|
||||
case 'createFileLog':
|
||||
case 'filename':
|
||||
case 'removecomments':
|
||||
case 'watch':
|
||||
case 'allowautomaticsemicoloninsertion':
|
||||
case 'locale':
|
||||
// Not supported yet
|
||||
break;
|
||||
|
||||
@@ -1066,23 +1056,28 @@ module Harness {
|
||||
options.preserveConstEnums = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'separatecompilation':
|
||||
options.separateCompilation = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'suppressimplicitanyindexerrors':
|
||||
options.suppressImplicitAnyIndexErrors = setting.value === 'true';
|
||||
break;
|
||||
|
||||
case 'includebuiltfile':
|
||||
inputFiles.push({ unitName: setting.value, content: normalizeLineEndings(IO.readFile(libFolder + setting.value), newLine) });
|
||||
let builtFileName = libFolder + setting.value;
|
||||
includeBuiltFiles.push({ unitName: builtFileName, content: normalizeLineEndings(IO.readFile(builtFileName), newLine) });
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Error('Unsupported compiler setting ' + setting.flag);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
var fileOutputs: GeneratedFile[] = [];
|
||||
|
||||
var programFiles = inputFiles.map(file => file.unitName);
|
||||
var program = ts.createProgram(programFiles, options, createCompilerHost(inputFiles.concat(otherFiles),
|
||||
var programFiles = inputFiles.concat(includeBuiltFiles).map(file => file.unitName);
|
||||
var program = ts.createProgram(programFiles, options, createCompilerHost(inputFiles.concat(includeBuiltFiles).concat(otherFiles),
|
||||
(fn, contents, writeByteOrderMark) => fileOutputs.push({ fileName: fn, code: contents, writeByteOrderMark: writeByteOrderMark }),
|
||||
options.target, useCaseSensitiveFileNames, currentDirectory));
|
||||
|
||||
@@ -1305,7 +1300,7 @@ module Harness {
|
||||
});
|
||||
|
||||
var numLibraryDiagnostics = ts.countWhere(diagnostics, diagnostic => {
|
||||
return diagnostic.fileName && isLibraryFile(diagnostic.fileName);
|
||||
return diagnostic.fileName && (isLibraryFile(diagnostic.fileName) || isBuiltFile(diagnostic.fileName));
|
||||
});
|
||||
|
||||
var numTest262HarnessDiagnostics = ts.countWhere(diagnostics, diagnostic => {
|
||||
@@ -1465,7 +1460,12 @@ module Harness {
|
||||
var optionRegex = /^[\/]{2}\s*@(\w+)\s*:\s*(\S*)/gm; // multiple matches on multiple lines
|
||||
|
||||
// List of allowed metadata names
|
||||
var fileMetadataNames = ["filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noemitonerror", "noimplicitany", "noresolve", "newline", "newlines", "emitbom", "errortruncation", "usecasesensitivefilenames", "preserveconstenums", "preservenewlines", "includebuiltfile", "suppressimplicitanyindexerrors", "stripinternal"];
|
||||
var fileMetadataNames = ["filename", "comments", "declaration", "module",
|
||||
"nolib", "sourcemap", "target", "out", "outdir", "noemitonerror",
|
||||
"noimplicitany", "noresolve", "newline", "newlines", "emitbom",
|
||||
"errortruncation", "usecasesensitivefilenames", "preserveconstenums",
|
||||
"includebuiltfile", "suppressimplicitanyindexerrors", "stripinternal",
|
||||
"separatecompilation"];
|
||||
|
||||
function extractCompilerSettings(content: string): CompilerSetting[] {
|
||||
|
||||
@@ -1703,6 +1703,18 @@ module Harness {
|
||||
return (Path.getFileName(filePath) === 'lib.d.ts') || (Path.getFileName(filePath) === 'lib.core.d.ts');
|
||||
}
|
||||
|
||||
export function isBuiltFile(filePath: string): boolean {
|
||||
return filePath.indexOf(Harness.libFolder) === 0;
|
||||
}
|
||||
|
||||
export function getDefaultLibraryFile(): { unitName: string, content: string } {
|
||||
var libFile = Harness.userSpecifiedroot + Harness.libFolder + "/" + "lib.d.ts";
|
||||
return {
|
||||
unitName: libFile,
|
||||
content: IO.readFile(libFile)
|
||||
}
|
||||
}
|
||||
|
||||
if (Error) (<any>Error).stackTraceLimit = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ interface IOLog {
|
||||
arguments: string[];
|
||||
executingPath: string;
|
||||
currentDirectory: string;
|
||||
useCustomLibraryFile?: boolean;
|
||||
filesRead: {
|
||||
path: string;
|
||||
codepage: number;
|
||||
|
||||
+38
-14
@@ -32,6 +32,7 @@ module RWC {
|
||||
};
|
||||
var baseName = /(.*)\/(.*).json/.exec(ts.normalizeSlashes(jsonPath))[2];
|
||||
var currentDirectory: string;
|
||||
var useCustomLibraryFile: boolean;
|
||||
|
||||
after(() => {
|
||||
// Mocha holds onto the closure environment of the describe callback even after the test is done.
|
||||
@@ -43,6 +44,10 @@ module RWC {
|
||||
baselineOpts = undefined;
|
||||
baseName = undefined;
|
||||
currentDirectory = undefined;
|
||||
// useCustomLibraryFile is a flag specified in the json object to indicate whether to use built/local/lib.d.ts
|
||||
// or to use lib.d.ts inside the json object. If the flag is true, use the lib.d.ts inside json file
|
||||
// otherwise use the lib.d.ts from built/local
|
||||
useCustomLibraryFile = undefined;
|
||||
});
|
||||
|
||||
it('can compile', () => {
|
||||
@@ -51,34 +56,52 @@ module RWC {
|
||||
|
||||
var ioLog: IOLog = JSON.parse(Harness.IO.readFile(jsonPath));
|
||||
currentDirectory = ioLog.currentDirectory;
|
||||
useCustomLibraryFile = ioLog.useCustomLibraryFile;
|
||||
runWithIOLog(ioLog, () => {
|
||||
opts = ts.parseCommandLine(ioLog.arguments);
|
||||
assert.equal(opts.errors.length, 0);
|
||||
|
||||
// To provide test coverage of output javascript file,
|
||||
// we will set noEmitOnError flag to be false.
|
||||
opts.options.noEmitOnError = false;
|
||||
});
|
||||
|
||||
runWithIOLog(ioLog, () => {
|
||||
harnessCompiler.reset();
|
||||
|
||||
// Load the files
|
||||
ts.forEach(opts.fileNames, fileName => {
|
||||
inputFiles.push(getHarnessCompilerInputUnit(fileName));
|
||||
});
|
||||
|
||||
if (!opts.options.noLib) {
|
||||
// Find the lib.d.ts file in the input file and add it to the input files list
|
||||
var libFile = ts.forEach(ioLog.filesRead, fileRead=> Harness.isLibraryFile(fileRead.path) ? fileRead.path : undefined);
|
||||
if (libFile) {
|
||||
inputFiles.push(getHarnessCompilerInputUnit(libFile));
|
||||
}
|
||||
}
|
||||
|
||||
ts.forEach(ioLog.filesRead, fileRead => {
|
||||
// Add files to compilation
|
||||
for(let fileRead of ioLog.filesRead) {
|
||||
// Check if the file is already added into the set of input files.
|
||||
var resolvedPath = ts.normalizeSlashes(ts.sys.resolvePath(fileRead.path));
|
||||
var inInputList = ts.forEach(inputFiles, inputFile=> inputFile.unitName === resolvedPath);
|
||||
if (!inInputList) {
|
||||
// Add the file to other files
|
||||
var inInputList = ts.forEach(inputFiles, inputFile => inputFile.unitName === resolvedPath);
|
||||
|
||||
if (!Harness.isLibraryFile(fileRead.path)) {
|
||||
if (inInputList) {
|
||||
continue;
|
||||
}
|
||||
otherFiles.push(getHarnessCompilerInputUnit(fileRead.path));
|
||||
}
|
||||
});
|
||||
else if (!opts.options.noLib && Harness.isLibraryFile(fileRead.path)){
|
||||
if (!inInputList) {
|
||||
// If useCustomLibraryFile is true, we will use lib.d.ts from json object
|
||||
// otherwise use the lib.d.ts from built/local
|
||||
// Majority of RWC code will be using built/local/lib.d.ts instead of
|
||||
// lib.d.ts inside json file. However, some RWC cases will still use
|
||||
// their own version of lib.d.ts because they have customized lib.d.ts
|
||||
if (useCustomLibraryFile) {
|
||||
inputFiles.push(getHarnessCompilerInputUnit(fileRead.path));
|
||||
}
|
||||
else {
|
||||
inputFiles.push(Harness.getDefaultLibraryFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// do not use lib since we already read it in above
|
||||
opts.options.noLib = true;
|
||||
@@ -115,9 +138,10 @@ module RWC {
|
||||
|
||||
it('has the expected declaration file content', () => {
|
||||
Harness.Baseline.runBaseline('has the expected declaration file content', baseName + '.d.ts', () => {
|
||||
if (compilerResult.errors.length || !compilerResult.declFilesCode.length) {
|
||||
if (!compilerResult.declFilesCode.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Harness.Compiler.collateOutputs(compilerResult.declFilesCode);
|
||||
}, false, baselineOpts);
|
||||
});
|
||||
|
||||
@@ -38,7 +38,6 @@ class TypeWriterWalker {
|
||||
case ts.SyntaxKind.SuperKeyword:
|
||||
case ts.SyntaxKind.ArrayLiteralExpression:
|
||||
case ts.SyntaxKind.ObjectLiteralExpression:
|
||||
case ts.SyntaxKind.PropertyAccessExpression:
|
||||
case ts.SyntaxKind.ElementAccessExpression:
|
||||
case ts.SyntaxKind.CallExpression:
|
||||
case ts.SyntaxKind.NewExpression:
|
||||
@@ -57,6 +56,14 @@ class TypeWriterWalker {
|
||||
this.log(node, this.getTypeOfNode(node));
|
||||
break;
|
||||
|
||||
case ts.SyntaxKind.PropertyAccessExpression:
|
||||
for (var current = node; current.kind === ts.SyntaxKind.PropertyAccessExpression; current = current.parent) {
|
||||
}
|
||||
if (current.kind !== ts.SyntaxKind.HeritageClauseElement) {
|
||||
this.log(node, this.getTypeOfNode(node));
|
||||
}
|
||||
break;
|
||||
|
||||
// Should not change expression status (maybe expressions)
|
||||
// TODO: Again, ideally should log number and string literals too,
|
||||
// but to be consistent with the old typeWriter, just log identifiers
|
||||
|
||||
Vendored
+1
-1
@@ -1168,4 +1168,4 @@ interface TypedPropertyDescriptor<T> {
|
||||
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
|
||||
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
|
||||
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
|
||||
declare type ParameterDecorator = (target: Function, propertyKey: string | symbol, parameterIndex: number) => void;
|
||||
declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
|
||||
|
||||
Vendored
+18
-18
@@ -3513,27 +3513,27 @@ interface ProxyHandler<T> {
|
||||
|
||||
interface ProxyConstructor {
|
||||
revocable<T>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
|
||||
new <T>(target: T, handeler: ProxyHandler<T>): T
|
||||
new <T>(target: T, handler: ProxyHandler<T>): T
|
||||
}
|
||||
declare var Proxy: ProxyConstructor;
|
||||
|
||||
declare var Reflect: {
|
||||
apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
|
||||
construct(target: Function, argumentsList: ArrayLike<any>): any;
|
||||
defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
|
||||
deleteProperty(target: any, propertyKey: PropertyKey): boolean;
|
||||
enumerate(target: any): IterableIterator<any>;
|
||||
get(target: any, propertyKey: PropertyKey, receiver?: any): any;
|
||||
getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
|
||||
getPrototypeOf(target: any): any;
|
||||
has(target: any, propertyKey: string): boolean;
|
||||
has(target: any, propertyKey: symbol): boolean;
|
||||
isExtensible(target: any): boolean;
|
||||
ownKeys(target: any): Array<PropertyKey>;
|
||||
preventExtensions(target: any): boolean;
|
||||
set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean;
|
||||
setPrototypeOf(target: any, proto: any): boolean;
|
||||
};
|
||||
declare module Reflect {
|
||||
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
|
||||
function construct(target: Function, argumentsList: ArrayLike<any>): any;
|
||||
function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
|
||||
function deleteProperty(target: any, propertyKey: PropertyKey): boolean;
|
||||
function enumerate(target: any): IterableIterator<any>;
|
||||
function get(target: any, propertyKey: PropertyKey, receiver?: any): any;
|
||||
function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
|
||||
function getPrototypeOf(target: any): any;
|
||||
function has(target: any, propertyKey: string): boolean;
|
||||
function has(target: any, propertyKey: symbol): boolean;
|
||||
function isExtensible(target: any): boolean;
|
||||
function ownKeys(target: any): Array<PropertyKey>;
|
||||
function preventExtensions(target: any): boolean;
|
||||
function set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean;
|
||||
function setPrototypeOf(target: any, proto: any): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the completion of an asynchronous operation
|
||||
|
||||
Vendored
+158
-8
@@ -4,7 +4,11 @@
|
||||
/// Windows Script Host APIS
|
||||
/////////////////////////////
|
||||
|
||||
declare var ActiveXObject: { new (s: string): any; };
|
||||
|
||||
interface ActiveXObject {
|
||||
new (s: string): any;
|
||||
}
|
||||
declare var ActiveXObject: ActiveXObject;
|
||||
|
||||
interface ITextWriter {
|
||||
Write(s: string): void;
|
||||
@@ -12,11 +16,157 @@ interface ITextWriter {
|
||||
Close(): void;
|
||||
}
|
||||
|
||||
declare var WScript: {
|
||||
Echo(s: any): void;
|
||||
StdErr: ITextWriter;
|
||||
StdOut: ITextWriter;
|
||||
Arguments: { length: number; Item(n: number): string; };
|
||||
ScriptFullName: string;
|
||||
Quit(exitCode?: number): number;
|
||||
interface TextStreamBase {
|
||||
/**
|
||||
* The column number of the current character position in an input stream.
|
||||
*/
|
||||
Column: number;
|
||||
/**
|
||||
* The current line number in an input stream.
|
||||
*/
|
||||
Line: number;
|
||||
/**
|
||||
* Closes a text stream.
|
||||
* It is not necessary to close standard streams; they close automatically when the process ends. If you close a standard stream, be aware that any other pointers to that standard stream become invalid.
|
||||
*/
|
||||
Close(): void;
|
||||
}
|
||||
|
||||
interface TextStreamWriter extends TextStreamBase {
|
||||
/**
|
||||
* Sends a string to an output stream.
|
||||
*/
|
||||
Write(s: string): void;
|
||||
/**
|
||||
* Sends a specified number of blank lines (newline characters) to an output stream.
|
||||
*/
|
||||
WriteBlankLines(intLines: number): void;
|
||||
/**
|
||||
* Sends a string followed by a newline character to an output stream.
|
||||
*/
|
||||
WriteLine(s: string): void;
|
||||
}
|
||||
|
||||
interface TextStreamReader extends TextStreamBase {
|
||||
/**
|
||||
* Returns a specified number of characters from an input stream, beginning at the current pointer position.
|
||||
* Does not return until the ENTER key is pressed.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
*/
|
||||
Read(characters: number): string;
|
||||
/**
|
||||
* Returns all characters from an input stream.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
*/
|
||||
ReadAll(): string;
|
||||
/**
|
||||
* Returns an entire line from an input stream.
|
||||
* Although this method extracts the newline character, it does not add it to the returned string.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
*/
|
||||
ReadLine(): string;
|
||||
/**
|
||||
* Skips a specified number of characters when reading from an input text stream.
|
||||
* Can only be used on a stream in reading mode; causes an error in writing or appending mode.
|
||||
* @param characters Positive number of characters to skip forward. (Backward skipping is not supported.)
|
||||
*/
|
||||
Skip(characters: number): void;
|
||||
/**
|
||||
* Skips the next line when reading from an input text stream.
|
||||
* Can only be used on a stream in reading mode, not writing or appending mode.
|
||||
*/
|
||||
SkipLine(): void;
|
||||
/**
|
||||
* Indicates whether the stream pointer position is at the end of a line.
|
||||
*/
|
||||
AtEndOfLine: boolean;
|
||||
/**
|
||||
* Indicates whether the stream pointer position is at the end of a stream.
|
||||
*/
|
||||
AtEndOfStream: boolean;
|
||||
}
|
||||
|
||||
declare var WScript: {
|
||||
/**
|
||||
* Outputs text to either a message box (under WScript.exe) or the command console window followed by a newline (under CScript.ext).
|
||||
*/
|
||||
Echo(s: any): void;
|
||||
/**
|
||||
* Exposes the write-only error output stream for the current script.
|
||||
* Can be accessed only while using CScript.exe.
|
||||
*/
|
||||
StdErr: TextStreamWriter;
|
||||
/**
|
||||
* Exposes the write-only output stream for the current script.
|
||||
* Can be accessed only while using CScript.exe.
|
||||
*/
|
||||
StdOut: TextStreamWriter;
|
||||
Arguments: { length: number; Item(n: number): string; };
|
||||
/**
|
||||
* The full path of the currently running script.
|
||||
*/
|
||||
ScriptFullName: string;
|
||||
/**
|
||||
* Forces the script to stop immediately, with an optional exit code.
|
||||
*/
|
||||
Quit(exitCode?: number): number;
|
||||
/**
|
||||
* The Windows Script Host build version number.
|
||||
*/
|
||||
BuildVersion: number;
|
||||
/**
|
||||
* Fully qualified path of the host executable.
|
||||
*/
|
||||
FullName: string;
|
||||
/**
|
||||
* Gets/sets the script mode - interactive(true) or batch(false).
|
||||
*/
|
||||
Interactive: boolean;
|
||||
/**
|
||||
* The name of the host executable (WScript.exe or CScript.exe).
|
||||
*/
|
||||
Name: string;
|
||||
/**
|
||||
* Path of the directory containing the host executable.
|
||||
*/
|
||||
Path: string;
|
||||
/**
|
||||
* The filename of the currently running script.
|
||||
*/
|
||||
ScriptName: string;
|
||||
/**
|
||||
* Exposes the read-only input stream for the current script.
|
||||
* Can be accessed only while using CScript.exe.
|
||||
*/
|
||||
StdIn: TextStreamReader;
|
||||
/**
|
||||
* Windows Script Host version
|
||||
*/
|
||||
Version: string;
|
||||
/**
|
||||
* Connects a COM object's event sources to functions named with a given prefix, in the form prefix_event.
|
||||
*/
|
||||
ConnectObject(objEventSource: any, strPrefix: string): void;
|
||||
/**
|
||||
* Creates a COM object.
|
||||
* @param strProgiID
|
||||
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
|
||||
*/
|
||||
CreateObject(strProgID: string, strPrefix?: string): any;
|
||||
/**
|
||||
* Disconnects a COM object from its event sources.
|
||||
*/
|
||||
DisconnectObject(obj: any): void;
|
||||
/**
|
||||
* Retrieves an existing object with the specified ProgID from memory, or creates a new one from a file.
|
||||
* @param strPathname Fully qualified path to the file containing the object persisted to disk. For objects in memory, pass a zero-length string.
|
||||
* @param strProgID
|
||||
* @param strPrefix Function names in the form prefix_event will be bound to this object's COM events.
|
||||
*/
|
||||
GetObject(strPathname: string, strProgID?: string, strPrefix?: string): any;
|
||||
/**
|
||||
* Suspends script execution for a specified length of time, then continues execution.
|
||||
* @param intTime Interval (in milliseconds) to suspend script execution.
|
||||
*/
|
||||
Sleep(intTime: number): void;
|
||||
};
|
||||
|
||||
@@ -68,12 +68,12 @@ module ts.server {
|
||||
};
|
||||
}
|
||||
|
||||
private processRequest<T extends protocol.Request>(command: string, arguments?: any): T {
|
||||
private processRequest<T extends protocol.Request>(command: string, args?: any): T {
|
||||
var request: protocol.Request = {
|
||||
seq: this.sequence++,
|
||||
type: "request",
|
||||
command: command,
|
||||
arguments: arguments
|
||||
arguments: args,
|
||||
command
|
||||
};
|
||||
|
||||
this.writeMessage(JSON.stringify(request));
|
||||
|
||||
@@ -458,7 +458,7 @@ module ts.server {
|
||||
var info = this.filenameToScriptInfo[args.file];
|
||||
if (info) {
|
||||
info.setFormatOptions(args.formatOptions);
|
||||
this.log("Host configuration update for file " + args.file);
|
||||
this.log("Host configuration update for file " + args.file, "Info");
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -764,6 +764,26 @@ module ts.server {
|
||||
return info;
|
||||
}
|
||||
|
||||
// This is different from the method the compiler uses because
|
||||
// the compiler can assume it will always start searching in the
|
||||
// current directory (the directory in which tsc was invoked).
|
||||
// The server must start searching from the directory containing
|
||||
// the newly opened file.
|
||||
findConfigFile(searchPath: string): string {
|
||||
while (true) {
|
||||
var fileName = ts.combinePaths(searchPath, "tsconfig.json");
|
||||
if (sys.fileExists(fileName)) {
|
||||
return fileName;
|
||||
}
|
||||
var parentPath = ts.getDirectoryPath(searchPath);
|
||||
if (parentPath === searchPath) {
|
||||
break;
|
||||
}
|
||||
searchPath = parentPath;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open file whose contents is managed by the client
|
||||
* @param filename is absolute pathname
|
||||
@@ -771,7 +791,13 @@ module ts.server {
|
||||
|
||||
openClientFile(fileName: string) {
|
||||
var searchPath = ts.normalizePath(getDirectoryPath(fileName));
|
||||
var configFileName = ts.findConfigFile(searchPath);
|
||||
this.log("Search path: " + searchPath,"Info");
|
||||
var configFileName = this.findConfigFile(searchPath);
|
||||
if (configFileName) {
|
||||
this.log("Config file name: " + configFileName, "Info");
|
||||
} else {
|
||||
this.log("no config file");
|
||||
}
|
||||
if (configFileName) {
|
||||
configFileName = getAbsolutePath(configFileName, searchPath);
|
||||
}
|
||||
@@ -797,7 +823,6 @@ module ts.server {
|
||||
*/
|
||||
|
||||
closeClientFile(filename: string) {
|
||||
// TODO: tsconfig check
|
||||
var info = ts.lookUp(this.filenameToScriptInfo, filename);
|
||||
if (info) {
|
||||
this.closeOpenFile(info);
|
||||
@@ -830,6 +855,9 @@ module ts.server {
|
||||
}
|
||||
|
||||
printProjects() {
|
||||
if (!this.psLogger.isVerbose()) {
|
||||
return;
|
||||
}
|
||||
this.psLogger.startGroup();
|
||||
for (var i = 0, len = this.inferredProjects.length; i < len; i++) {
|
||||
var project = this.inferredProjects[i];
|
||||
@@ -1440,6 +1468,10 @@ module ts.server {
|
||||
return accum;
|
||||
}
|
||||
|
||||
getLength(): number {
|
||||
return this.root.charCount();
|
||||
}
|
||||
|
||||
every(f: (ll: LineLeaf, s: number, len: number) => boolean, rangeStart: number, rangeEnd?: number) {
|
||||
if (!rangeEnd) {
|
||||
rangeEnd = this.root.charCount();
|
||||
|
||||
Vendored
+25
-1
@@ -405,6 +405,13 @@ declare module ts.server.protocol {
|
||||
arguments: OpenRequestArgs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exit request; value of command field is "exit". Ask the server process
|
||||
* to exit.
|
||||
*/
|
||||
export interface ExitRequest extends Request {
|
||||
}
|
||||
|
||||
/**
|
||||
* Close request; value of command field is "close". Notify the
|
||||
* server that the client has closed a previously open file. If
|
||||
@@ -617,12 +624,29 @@ declare module ts.server.protocol {
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
*/
|
||||
kindModifiers: string;
|
||||
/**
|
||||
* A string that is used for comparing completion items so that they can be ordered. This
|
||||
* is often the same as the name but may be different in certain circumstances.
|
||||
*/
|
||||
sortText: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional completion entry details, available on demand
|
||||
*/
|
||||
export interface CompletionEntryDetails extends CompletionEntry {
|
||||
export interface CompletionEntryDetails {
|
||||
/**
|
||||
* The symbol's name.
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The symbol's kind (such as 'className' or 'parameterName').
|
||||
*/
|
||||
kind: string;
|
||||
/**
|
||||
* Optional modifiers for the kind (such as 'public').
|
||||
*/
|
||||
kindModifiers: string;
|
||||
/**
|
||||
* Display parts of the symbol (similar to quick info).
|
||||
*/
|
||||
|
||||
@@ -177,6 +177,12 @@ module ts.server {
|
||||
super(host, logger);
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.projectService.log("Exiting...","Info");
|
||||
this.projectService.closeLog();
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
listen() {
|
||||
rl.on('line',(input: string) => {
|
||||
var message = input.trim();
|
||||
@@ -184,9 +190,7 @@ module ts.server {
|
||||
});
|
||||
|
||||
rl.on('close',() => {
|
||||
this.projectService.log("Exiting...");
|
||||
this.projectService.closeLog();
|
||||
process.exit(0);
|
||||
this.exit();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+11
-2
@@ -76,13 +76,14 @@ module ts.server {
|
||||
}
|
||||
|
||||
export module CommandNames {
|
||||
export var Brace = "brace";
|
||||
export var Change = "change";
|
||||
export var Close = "close";
|
||||
export var Completions = "completions";
|
||||
export var CompletionDetails = "completionEntryDetails";
|
||||
export var SignatureHelp = "signatureHelp";
|
||||
export var Configure = "configure";
|
||||
export var Definition = "definition";
|
||||
export var Exit = "exit";
|
||||
export var Format = "format";
|
||||
export var Formatonkey = "formatonkey";
|
||||
export var Geterr = "geterr";
|
||||
@@ -94,7 +95,7 @@ module ts.server {
|
||||
export var Reload = "reload";
|
||||
export var Rename = "rename";
|
||||
export var Saveto = "saveto";
|
||||
export var Brace = "brace";
|
||||
export var SignatureHelp = "signatureHelp";
|
||||
export var Unknown = "unknown";
|
||||
}
|
||||
|
||||
@@ -758,6 +759,9 @@ module ts.server {
|
||||
}));
|
||||
}
|
||||
|
||||
exit() {
|
||||
}
|
||||
|
||||
onMessage(message: string) {
|
||||
if (this.logger.isVerbose()) {
|
||||
this.logger.info("request: " + message);
|
||||
@@ -769,6 +773,11 @@ module ts.server {
|
||||
var errorMessage: string;
|
||||
var responseRequired = true;
|
||||
switch (request.command) {
|
||||
case CommandNames.Exit: {
|
||||
this.exit();
|
||||
responseRequired = false;
|
||||
break;
|
||||
}
|
||||
case CommandNames.Definition: {
|
||||
var defArgs = <protocol.FileLocationRequestArgs>request.arguments;
|
||||
response = this.getDefinition(defArgs.line, defArgs.offset, defArgs.file);
|
||||
|
||||
@@ -22,7 +22,7 @@ module ts.NavigateTo {
|
||||
continue;
|
||||
}
|
||||
|
||||
// It was a match! If the pattern has dots in it, then also see if hte
|
||||
// It was a match! If the pattern has dots in it, then also see if the
|
||||
// declaration container matches as well.
|
||||
if (patternMatcher.patternContainsDots) {
|
||||
let containers = getContainers(declaration);
|
||||
|
||||
@@ -418,10 +418,10 @@ module ts.NavigationBar {
|
||||
}
|
||||
|
||||
function createFunctionItem(node: FunctionDeclaration) {
|
||||
if ((node.name || node.flags & NodeFlags.Default) && node.body && node.body.kind === SyntaxKind.Block) {
|
||||
if (node.body && node.body.kind === SyntaxKind.Block) {
|
||||
let childItems = getItemsWorker(sortNodes((<Block>node.body).statements), createChildItem);
|
||||
|
||||
return getNavigationBarItem((!node.name && node.flags & NodeFlags.Default) ? "default": node.name.text ,
|
||||
return getNavigationBarItem(!node.name ? "default": node.name.text ,
|
||||
ts.ScriptElementKind.functionElement,
|
||||
getNodeModifiers(node),
|
||||
[getNodeSpan(node)],
|
||||
@@ -470,7 +470,7 @@ module ts.NavigationBar {
|
||||
childItems = getItemsWorker(sortNodes(nodes), createChildItem);
|
||||
}
|
||||
|
||||
var nodeName = !node.name && (node.flags & NodeFlags.Default) ? "default" : node.name.text;
|
||||
var nodeName = !node.name ? "default" : node.name.text;
|
||||
|
||||
return getNavigationBarItem(
|
||||
nodeName,
|
||||
|
||||
@@ -471,7 +471,7 @@ module ts {
|
||||
|
||||
// Helper function to compare two matches to determine which is better. Matches are first
|
||||
// ordered by kind (so all prefix matches always beat all substring matches). Then, if the
|
||||
// match is a camel case match, the relative weights of hte match are used to determine
|
||||
// match is a camel case match, the relative weights of the match are used to determine
|
||||
// which is better (with a greater weight being better). Then if the match is of the same
|
||||
// type, then a case sensitive match is considered better than an insensitive one.
|
||||
function patternMatchCompareTo(match1: PatternMatch, match2: PatternMatch): number {
|
||||
|
||||
+528
-173
@@ -730,7 +730,7 @@ module ts {
|
||||
public statements: NodeArray<Statement>;
|
||||
public endOfFileToken: Node;
|
||||
|
||||
public amdDependencies: {name: string; path: string}[];
|
||||
public amdDependencies: { name: string; path: string }[];
|
||||
public amdModuleName: string;
|
||||
public referencedFiles: FileReference[];
|
||||
|
||||
@@ -769,126 +769,131 @@ module ts {
|
||||
|
||||
public getNamedDeclarations() {
|
||||
if (!this.namedDeclarations) {
|
||||
let sourceFile = this;
|
||||
let namedDeclarations: Declaration[] = [];
|
||||
|
||||
forEachChild(sourceFile, function visit(node: Node): void {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
let functionDeclaration = <FunctionLikeDeclaration>node;
|
||||
|
||||
if (functionDeclaration.name && functionDeclaration.name.getFullWidth() > 0) {
|
||||
let lastDeclaration = namedDeclarations.length > 0 ?
|
||||
namedDeclarations[namedDeclarations.length - 1] :
|
||||
undefined;
|
||||
|
||||
// Check whether this declaration belongs to an "overload group".
|
||||
if (lastDeclaration && functionDeclaration.symbol === lastDeclaration.symbol) {
|
||||
// Overwrite the last declaration if it was an overload
|
||||
// and this one is an implementation.
|
||||
if (functionDeclaration.body && !(<FunctionLikeDeclaration>lastDeclaration).body) {
|
||||
namedDeclarations[namedDeclarations.length - 1] = functionDeclaration;
|
||||
}
|
||||
}
|
||||
else {
|
||||
namedDeclarations.push(functionDeclaration);
|
||||
}
|
||||
|
||||
forEachChild(node, visit);
|
||||
}
|
||||
break;
|
||||
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
case SyntaxKind.ExportSpecifier:
|
||||
case SyntaxKind.ImportSpecifier:
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
case SyntaxKind.ImportClause:
|
||||
case SyntaxKind.NamespaceImport:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
if ((<Declaration>node).name) {
|
||||
namedDeclarations.push(<Declaration>node);
|
||||
}
|
||||
// fall through
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.VariableStatement:
|
||||
case SyntaxKind.VariableDeclarationList:
|
||||
case SyntaxKind.ObjectBindingPattern:
|
||||
case SyntaxKind.ArrayBindingPattern:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
forEachChild(node, visit);
|
||||
break;
|
||||
|
||||
case SyntaxKind.Block:
|
||||
if (isFunctionBlock(node)) {
|
||||
forEachChild(node, visit);
|
||||
}
|
||||
break;
|
||||
|
||||
case SyntaxKind.Parameter:
|
||||
// Only consider properties defined as constructor parameters
|
||||
if (!(node.flags & NodeFlags.AccessibilityModifier)) {
|
||||
break;
|
||||
}
|
||||
// fall through
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.BindingElement:
|
||||
if (isBindingPattern((<VariableDeclaration>node).name)) {
|
||||
forEachChild((<VariableDeclaration>node).name, visit);
|
||||
break;
|
||||
}
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
namedDeclarations.push(<Declaration>node);
|
||||
break;
|
||||
|
||||
case SyntaxKind.ExportDeclaration:
|
||||
// Handle named exports case e.g.:
|
||||
// export {a, b as B} from "mod";
|
||||
if ((<ExportDeclaration>node).exportClause) {
|
||||
forEach((<ExportDeclaration>node).exportClause.elements, visit);
|
||||
}
|
||||
break;
|
||||
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
let importClause = (<ImportDeclaration>node).importClause;
|
||||
if (importClause) {
|
||||
// Handle default import case e.g.:
|
||||
// import d from "mod";
|
||||
if (importClause.name) {
|
||||
namedDeclarations.push(importClause);
|
||||
}
|
||||
|
||||
// Handle named bindings in imports e.g.:
|
||||
// import * as NS from "mod";
|
||||
// import {a, b as B} from "mod";
|
||||
if (importClause.namedBindings) {
|
||||
if (importClause.namedBindings.kind === SyntaxKind.NamespaceImport) {
|
||||
namedDeclarations.push(<NamespaceImport>importClause.namedBindings);
|
||||
}
|
||||
else {
|
||||
forEach((<NamedImports>importClause.namedBindings).elements, visit);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
this.namedDeclarations = namedDeclarations;
|
||||
this.namedDeclarations = this.computeNamedDeclarations();
|
||||
}
|
||||
|
||||
return this.namedDeclarations;
|
||||
}
|
||||
|
||||
private computeNamedDeclarations() {
|
||||
let namedDeclarations: Declaration[] = [];
|
||||
|
||||
forEachChild(this, visit);
|
||||
|
||||
return namedDeclarations;
|
||||
|
||||
function visit(node: Node): void {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
let functionDeclaration = <FunctionLikeDeclaration>node;
|
||||
|
||||
if (functionDeclaration.name && functionDeclaration.name.getFullWidth() > 0) {
|
||||
let lastDeclaration = namedDeclarations.length > 0 ?
|
||||
namedDeclarations[namedDeclarations.length - 1] :
|
||||
undefined;
|
||||
|
||||
// Check whether this declaration belongs to an "overload group".
|
||||
if (lastDeclaration && functionDeclaration.symbol === lastDeclaration.symbol) {
|
||||
// Overwrite the last declaration if it was an overload
|
||||
// and this one is an implementation.
|
||||
if (functionDeclaration.body && !(<FunctionLikeDeclaration>lastDeclaration).body) {
|
||||
namedDeclarations[namedDeclarations.length - 1] = functionDeclaration;
|
||||
}
|
||||
}
|
||||
else {
|
||||
namedDeclarations.push(functionDeclaration);
|
||||
}
|
||||
|
||||
forEachChild(node, visit);
|
||||
}
|
||||
break;
|
||||
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
case SyntaxKind.ExportSpecifier:
|
||||
case SyntaxKind.ImportSpecifier:
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
case SyntaxKind.ImportClause:
|
||||
case SyntaxKind.NamespaceImport:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
if ((<Declaration>node).name) {
|
||||
namedDeclarations.push(<Declaration>node);
|
||||
}
|
||||
// fall through
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.VariableStatement:
|
||||
case SyntaxKind.VariableDeclarationList:
|
||||
case SyntaxKind.ObjectBindingPattern:
|
||||
case SyntaxKind.ArrayBindingPattern:
|
||||
case SyntaxKind.ModuleBlock:
|
||||
forEachChild(node, visit);
|
||||
break;
|
||||
|
||||
case SyntaxKind.Block:
|
||||
if (isFunctionBlock(node)) {
|
||||
forEachChild(node, visit);
|
||||
}
|
||||
break;
|
||||
|
||||
case SyntaxKind.Parameter:
|
||||
// Only consider properties defined as constructor parameters
|
||||
if (!(node.flags & NodeFlags.AccessibilityModifier)) {
|
||||
break;
|
||||
}
|
||||
// fall through
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.BindingElement:
|
||||
if (isBindingPattern((<VariableDeclaration>node).name)) {
|
||||
forEachChild((<VariableDeclaration>node).name, visit);
|
||||
break;
|
||||
}
|
||||
case SyntaxKind.EnumMember:
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
namedDeclarations.push(<Declaration>node);
|
||||
break;
|
||||
|
||||
case SyntaxKind.ExportDeclaration:
|
||||
// Handle named exports case e.g.:
|
||||
// export {a, b as B} from "mod";
|
||||
if ((<ExportDeclaration>node).exportClause) {
|
||||
forEach((<ExportDeclaration>node).exportClause.elements, visit);
|
||||
}
|
||||
break;
|
||||
|
||||
case SyntaxKind.ImportDeclaration:
|
||||
let importClause = (<ImportDeclaration>node).importClause;
|
||||
if (importClause) {
|
||||
// Handle default import case e.g.:
|
||||
// import d from "mod";
|
||||
if (importClause.name) {
|
||||
namedDeclarations.push(importClause);
|
||||
}
|
||||
|
||||
// Handle named bindings in imports e.g.:
|
||||
// import * as NS from "mod";
|
||||
// import {a, b as B} from "mod";
|
||||
if (importClause.namedBindings) {
|
||||
if (importClause.namedBindings.kind === SyntaxKind.NamespaceImport) {
|
||||
namedDeclarations.push(<NamespaceImport>importClause.namedBindings);
|
||||
}
|
||||
else {
|
||||
forEach((<NamedImports>importClause.namedBindings).elements, visit);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1143,6 +1148,7 @@ module ts {
|
||||
name: string;
|
||||
kind: string; // see ScriptElementKind
|
||||
kindModifiers: string; // see ScriptElementKindModifier, comma separated
|
||||
sortText: string;
|
||||
}
|
||||
|
||||
export interface CompletionEntryDetails {
|
||||
@@ -1311,6 +1317,7 @@ module ts {
|
||||
// TODO: move these to enums
|
||||
export class ScriptElementKind {
|
||||
static unknown = "";
|
||||
static warning = "warning";
|
||||
|
||||
// predefined type (void) or keyword (class)
|
||||
static keyword = "keyword";
|
||||
@@ -1635,6 +1642,61 @@ module ts {
|
||||
sourceFile.scriptSnapshot = scriptSnapshot;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function will compile source text from 'input' argument using specified compiler options.
|
||||
* If not options are provided - it will use a set of default compiler options.
|
||||
* Extra compiler options that will unconditionally be used bu this function are:
|
||||
* - separateCompilation = true
|
||||
* - allowNonTsExtensions = true
|
||||
*/
|
||||
export function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[]): string {
|
||||
let options = compilerOptions ? clone(compilerOptions) : getDefaultCompilerOptions();
|
||||
|
||||
options.separateCompilation = true;
|
||||
|
||||
// Filename can be non-ts file.
|
||||
options.allowNonTsExtensions = true;
|
||||
|
||||
// Parse
|
||||
var inputFileName = fileName || "module.ts";
|
||||
var sourceFile = createSourceFile(inputFileName, input, options.target);
|
||||
|
||||
// Store syntactic diagnostics
|
||||
if (diagnostics && sourceFile.parseDiagnostics) {
|
||||
diagnostics.push(...sourceFile.parseDiagnostics);
|
||||
}
|
||||
|
||||
// Output
|
||||
let outputText: string;
|
||||
|
||||
// Create a compilerHost object to allow the compiler to read and write files
|
||||
var compilerHost: CompilerHost = {
|
||||
getSourceFile: (fileName, target) => fileName === inputFileName ? sourceFile : undefined,
|
||||
writeFile: (name, text, writeByteOrderMark) => {
|
||||
Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name);
|
||||
outputText = text;
|
||||
},
|
||||
getDefaultLibFileName: () => "lib.d.ts",
|
||||
useCaseSensitiveFileNames: () => false,
|
||||
getCanonicalFileName: fileName => fileName,
|
||||
getCurrentDirectory: () => "",
|
||||
getNewLine: () => (sys && sys.newLine) || "\r\n"
|
||||
};
|
||||
|
||||
var program = createProgram([inputFileName], options, compilerHost);
|
||||
|
||||
if (diagnostics) {
|
||||
diagnostics.push(...program.getGlobalDiagnostics());
|
||||
}
|
||||
|
||||
// Emit
|
||||
program.emit();
|
||||
|
||||
Debug.assert(outputText !== undefined, "Output generation failed");
|
||||
|
||||
return outputText;
|
||||
}
|
||||
|
||||
export function createLanguageServiceSourceFile(fileName: string, scriptSnapshot: IScriptSnapshot, scriptTarget: ScriptTarget, version: string, setNodeParents: boolean): SourceFile {
|
||||
let sourceFile = createSourceFile(fileName, scriptSnapshot.getText(0, scriptSnapshot.getLength()), scriptTarget, setNodeParents);
|
||||
setSourceFileFields(sourceFile, scriptSnapshot, version);
|
||||
@@ -2106,7 +2168,8 @@ module ts {
|
||||
keywordCompletions.push({
|
||||
name: tokenToString(i),
|
||||
kind: ScriptElementKind.keyword,
|
||||
kindModifiers: ScriptElementKindModifier.none
|
||||
kindModifiers: ScriptElementKindModifier.none,
|
||||
sortText: "0"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2370,15 +2433,26 @@ module ts {
|
||||
return program.getSyntacticDiagnostics(getValidSourceFile(fileName));
|
||||
}
|
||||
|
||||
function isJavaScript(fileName: string) {
|
||||
return fileExtensionIs(fileName, ".js");
|
||||
}
|
||||
|
||||
/**
|
||||
* getSemanticDiagnostiscs return array of Diagnostics. If '-d' is not enabled, only report semantic errors
|
||||
* If '-d' enabled, report both semantic and emitter errors
|
||||
*/
|
||||
function getSemanticDiagnostics(fileName: string) {
|
||||
function getSemanticDiagnostics(fileName: string): Diagnostic[] {
|
||||
synchronizeHostData();
|
||||
|
||||
let targetSourceFile = getValidSourceFile(fileName);
|
||||
|
||||
// For JavaScript files, we don't want to report the normal typescript semantic errors.
|
||||
// Instead, we just report errors for using TypeScript-only constructs from within a
|
||||
// JavaScript file.
|
||||
if (isJavaScript(fileName)) {
|
||||
return getJavaScriptSemanticDiagnostics(targetSourceFile);
|
||||
}
|
||||
|
||||
// Only perform the action per file regardless of '-out' flag as LanguageServiceHost is expected to call this function per file.
|
||||
// Therefore only get diagnostics for given file.
|
||||
|
||||
@@ -2392,27 +2466,199 @@ module ts {
|
||||
return concatenate(semanticDiagnostics, declarationDiagnostics);
|
||||
}
|
||||
|
||||
function getJavaScriptSemanticDiagnostics(sourceFile: SourceFile): Diagnostic[] {
|
||||
let diagnostics: Diagnostic[] = [];
|
||||
walk(sourceFile);
|
||||
|
||||
return diagnostics;
|
||||
|
||||
function walk(node: Node): boolean {
|
||||
if (!node) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ImportEqualsDeclaration:
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.import_can_only_be_used_in_a_ts_file));
|
||||
return true;
|
||||
case SyntaxKind.ExportAssignment:
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.export_can_only_be_used_in_a_ts_file));
|
||||
return true;
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
let classDeclaration = <ClassDeclaration>node;
|
||||
if (checkModifiers(classDeclaration.modifiers) ||
|
||||
checkTypeParameters(classDeclaration.typeParameters)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.HeritageClause:
|
||||
let heritageClause = <HeritageClause>node;
|
||||
if (heritageClause.token === SyntaxKind.ImplementsKeyword) {
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file));
|
||||
return true;
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.module_declarations_can_only_be_used_in_a_ts_file));
|
||||
return true;
|
||||
case SyntaxKind.TypeAliasDeclaration:
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.type_aliases_can_only_be_used_in_a_ts_file));
|
||||
return true;
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
case SyntaxKind.Constructor:
|
||||
case SyntaxKind.GetAccessor:
|
||||
case SyntaxKind.SetAccessor:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
let functionDeclaration = <FunctionLikeDeclaration>node;
|
||||
if (checkModifiers(functionDeclaration.modifiers) ||
|
||||
checkTypeParameters(functionDeclaration.typeParameters) ||
|
||||
checkTypeAnnotation(functionDeclaration.type)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.VariableStatement:
|
||||
let variableStatement = <VariableStatement>node;
|
||||
if (checkModifiers(variableStatement.modifiers)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
let variableDeclaration = <VariableDeclaration>node;
|
||||
if (checkTypeAnnotation(variableDeclaration.type)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.CallExpression:
|
||||
case SyntaxKind.NewExpression:
|
||||
let expression = <CallExpression>node;
|
||||
if (expression.typeArguments && expression.typeArguments.length > 0) {
|
||||
let start = expression.typeArguments.pos;
|
||||
diagnostics.push(createFileDiagnostic(sourceFile, start, expression.typeArguments.end - start,
|
||||
Diagnostics.type_arguments_can_only_be_used_in_a_ts_file));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.Parameter:
|
||||
let parameter = <ParameterDeclaration>node;
|
||||
if (parameter.modifiers) {
|
||||
let start = parameter.modifiers.pos;
|
||||
diagnostics.push(createFileDiagnostic(sourceFile, start, parameter.modifiers.end - start,
|
||||
Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file));
|
||||
return true;
|
||||
}
|
||||
if (parameter.questionToken) {
|
||||
diagnostics.push(createDiagnosticForNode(parameter.questionToken, Diagnostics.can_only_be_used_in_a_ts_file));
|
||||
return true;
|
||||
}
|
||||
if (parameter.type) {
|
||||
diagnostics.push(createDiagnosticForNode(parameter.type, Diagnostics.types_can_only_be_used_in_a_ts_file));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.property_declarations_can_only_be_used_in_a_ts_file));
|
||||
return true;
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file));
|
||||
return true;
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
let typeAssertionExpression = <TypeAssertion>node;
|
||||
diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file));
|
||||
return true;
|
||||
case SyntaxKind.Decorator:
|
||||
diagnostics.push(createDiagnosticForNode(node, Diagnostics.decorators_can_only_be_used_in_a_ts_file));
|
||||
return true;
|
||||
}
|
||||
|
||||
return forEachChild(node, walk);
|
||||
}
|
||||
|
||||
function checkTypeParameters(typeParameters: NodeArray<TypeParameterDeclaration>): boolean {
|
||||
if (typeParameters) {
|
||||
let start = typeParameters.pos;
|
||||
diagnostics.push(createFileDiagnostic(sourceFile, start, typeParameters.end - start, Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function checkTypeAnnotation(type: TypeNode): boolean {
|
||||
if (type) {
|
||||
diagnostics.push(createDiagnosticForNode(type, Diagnostics.types_can_only_be_used_in_a_ts_file));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function checkModifiers(modifiers: ModifiersArray): boolean {
|
||||
if (modifiers) {
|
||||
for (let modifier of modifiers) {
|
||||
switch (modifier.kind) {
|
||||
case SyntaxKind.PublicKeyword:
|
||||
case SyntaxKind.PrivateKeyword:
|
||||
case SyntaxKind.ProtectedKeyword:
|
||||
case SyntaxKind.DeclareKeyword:
|
||||
diagnostics.push(createDiagnosticForNode(modifier, Diagnostics._0_can_only_be_used_in_a_ts_file, tokenToString(modifier.kind)));
|
||||
return true;
|
||||
|
||||
// These are all legal modifiers.
|
||||
case SyntaxKind.StaticKeyword:
|
||||
case SyntaxKind.ExportKeyword:
|
||||
case SyntaxKind.ConstKeyword:
|
||||
case SyntaxKind.DefaultKeyword:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getCompilerOptionsDiagnostics() {
|
||||
synchronizeHostData();
|
||||
return program.getGlobalDiagnostics();
|
||||
}
|
||||
|
||||
/// Completion
|
||||
function getCompletionEntryDisplayName(symbol: Symbol, target: ScriptTarget, performCharacterChecks: boolean): string {
|
||||
function getCompletionEntryDisplayNameForSymbol(symbol: Symbol, target: ScriptTarget, performCharacterChecks: boolean): string {
|
||||
let displayName = symbol.getName();
|
||||
if (displayName) {
|
||||
// If this is the default export, get the name of the declaration if it exists
|
||||
if (displayName === "default") {
|
||||
let localSymbol = getLocalSymbolForExportDefault(symbol);
|
||||
if (localSymbol && localSymbol.name) {
|
||||
displayName = symbol.valueDeclaration.localSymbol.name;
|
||||
}
|
||||
}
|
||||
|
||||
let firstCharCode = displayName.charCodeAt(0);
|
||||
// First check of the displayName is not external module; if it is an external module, it is not valid entry
|
||||
if ((symbol.flags & SymbolFlags.Namespace) && (firstCharCode === CharacterCodes.singleQuote || firstCharCode === CharacterCodes.doubleQuote)) {
|
||||
// If the symbol is external module, don't show it in the completion list
|
||||
// (i.e declare module "http" { let x; } | // <= request completion here, "http" should not be there)
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
return getCompletionEntryDisplayName(displayName, target, performCharacterChecks);
|
||||
}
|
||||
|
||||
function getCompletionEntryDisplayName(displayName: string, target: ScriptTarget, performCharacterChecks: boolean): string {
|
||||
if (!displayName) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let firstCharCode = displayName.charCodeAt(0);
|
||||
// First check of the displayName is not external module; if it is an external module, it is not valid entry
|
||||
if ((symbol.flags & SymbolFlags.Namespace) && (firstCharCode === CharacterCodes.singleQuote || firstCharCode === CharacterCodes.doubleQuote)) {
|
||||
// If the symbol is external module, don't show it in the completion list
|
||||
// (i.e declare module "http" { let x; } | // <= request completion here, "http" should not be there)
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (displayName && displayName.length >= 2 && firstCharCode === displayName.charCodeAt(displayName.length - 1) &&
|
||||
if (displayName.length >= 2 &&
|
||||
firstCharCode === displayName.charCodeAt(displayName.length - 1) &&
|
||||
(firstCharCode === CharacterCodes.singleQuote || firstCharCode === CharacterCodes.doubleQuote)) {
|
||||
// If the user entered name for the symbol was quoted, removing the quotes is not enough, as the name could be an
|
||||
// invalid identifier name. We need to check if whatever was inside the quotes is actually a valid identifier name.
|
||||
@@ -2442,19 +2688,24 @@ module ts {
|
||||
// Try to get a valid display name for this symbol, if we could not find one, then ignore it.
|
||||
// We would like to only show things that can be added after a dot, so for instance numeric properties can
|
||||
// not be accessed with a dot (a.1 <- invalid)
|
||||
let displayName = getCompletionEntryDisplayName(symbol, program.getCompilerOptions().target, /*performCharacterChecks:*/ true);
|
||||
let displayName = getCompletionEntryDisplayNameForSymbol(symbol, program.getCompilerOptions().target, /*performCharacterChecks:*/ true);
|
||||
if (!displayName) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// TODO(drosen): Right now we just permit *all* semantic meanings when calling 'getSymbolKind'
|
||||
// which is permissible given that it is backwards compatible; but really we should consider
|
||||
// passing the meaning for the node so that we don't report that a suggestion for a value is an interface.
|
||||
// We COULD also just do what 'getSymbolModifiers' does, which is to use the first declaration.
|
||||
// TODO(drosen): Right now we just permit *all* semantic meanings when calling
|
||||
// 'getSymbolKind' which is permissible given that it is backwards compatible; but
|
||||
// really we should consider passing the meaning for the node so that we don't report
|
||||
// that a suggestion for a value is an interface. We COULD also just do what
|
||||
// 'getSymbolModifiers' does, which is to use the first declaration.
|
||||
|
||||
// Use a 'sortText' of 0' so that all symbol completion entries come before any other
|
||||
// entries (like JavaScript identifier entries).
|
||||
return {
|
||||
name: displayName,
|
||||
kind: getSymbolKind(symbol, typeChecker, location),
|
||||
kindModifiers: getSymbolModifiers(symbol)
|
||||
kindModifiers: getSymbolModifiers(symbol),
|
||||
sortText: "0",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2498,8 +2749,9 @@ module ts {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Find the node where completion is requested on, in the case of a completion after a dot, it is the member access expression
|
||||
// otherwise, it is a request for all visible symbols in the scope, and the node is the current location
|
||||
// Find the node where completion is requested on, in the case of a completion after
|
||||
// a dot, it is the member access expression other wise, it is a request for all
|
||||
// visible symbols in the scope, and the node is the current location.
|
||||
let node = currentToken;
|
||||
let isRightOfDot = false;
|
||||
if (contextToken && contextToken.kind === SyntaxKind.DotToken && contextToken.parent.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
@@ -2517,11 +2769,26 @@ module ts {
|
||||
let semanticStart = new Date().getTime();
|
||||
let isMemberCompletion: boolean;
|
||||
let isNewIdentifierLocation: boolean;
|
||||
let symbols: Symbol[];
|
||||
let symbols: Symbol[] = [];
|
||||
|
||||
if (isRightOfDot) {
|
||||
getTypeScriptMemberSymbols();
|
||||
}
|
||||
else {
|
||||
// For JavaScript or TypeScript, if we're not after a dot, then just try to get the
|
||||
// global symbols in scope. These results should be valid for either language as
|
||||
// the set of symbols that can be referenced from this location.
|
||||
if (!tryGetGlobalSymbols()) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
log("getCompletionData: Semantic work: " + (new Date().getTime() - semanticStart));
|
||||
|
||||
return { symbols, isMemberCompletion, isNewIdentifierLocation, location, isRightOfDot };
|
||||
|
||||
function getTypeScriptMemberSymbols(): void {
|
||||
// Right of dot member completion list
|
||||
symbols = [];
|
||||
isMemberCompletion = true;
|
||||
isNewIdentifierLocation = false;
|
||||
|
||||
@@ -2535,7 +2802,8 @@ module ts {
|
||||
|
||||
if (symbol && symbol.flags & SymbolFlags.HasExports) {
|
||||
// Extract module or enum members
|
||||
forEachValue(symbol.exports, symbol => {
|
||||
let exportedSymbols = typeInfoResolver.getExportsOfModule(symbol);
|
||||
forEach(exportedSymbols, symbol => {
|
||||
if (typeInfoResolver.isValidPropertyAccess(<PropertyAccessExpression>(node.parent), symbol.name)) {
|
||||
symbols.push(symbol);
|
||||
}
|
||||
@@ -2553,7 +2821,8 @@ module ts {
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
function tryGetGlobalSymbols(): boolean {
|
||||
let containingObjectLiteral = getContainingObjectLiteralApplicableForCompletion(contextToken);
|
||||
if (containingObjectLiteral) {
|
||||
// Object literal expression, look up possible property names from contextual type
|
||||
@@ -2562,7 +2831,7 @@ module ts {
|
||||
|
||||
let contextualType = typeInfoResolver.getContextualType(containingObjectLiteral);
|
||||
if (!contextualType) {
|
||||
return undefined;
|
||||
return false;
|
||||
}
|
||||
|
||||
let contextualTypeMembers = typeInfoResolver.getPropertiesOfType(contextualType);
|
||||
@@ -2579,8 +2848,17 @@ module ts {
|
||||
if (showCompletionsInImportsClause(contextToken)) {
|
||||
let importDeclaration = <ImportDeclaration>getAncestor(contextToken, SyntaxKind.ImportDeclaration);
|
||||
Debug.assert(importDeclaration !== undefined);
|
||||
let exports = typeInfoResolver.getExportsOfExternalModule(importDeclaration);
|
||||
symbols = filterModuleExports(exports, importDeclaration);
|
||||
|
||||
let exports: Symbol[];
|
||||
if (importDeclaration.moduleSpecifier) {
|
||||
let moduleSpecifierSymbol = typeInfoResolver.getSymbolAtLocation(importDeclaration.moduleSpecifier);
|
||||
if (moduleSpecifierSymbol) {
|
||||
exports = typeInfoResolver.getExportsOfModule(moduleSpecifierSymbol);
|
||||
}
|
||||
}
|
||||
|
||||
//let exports = typeInfoResolver.getExportsOfImportDeclaration(importDeclaration);
|
||||
symbols = exports ? filterModuleExports(exports, importDeclaration) : emptyArray;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -2620,18 +2898,16 @@ module ts {
|
||||
previousToken.getStart() :
|
||||
position;
|
||||
|
||||
let scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile);
|
||||
let scopeNode = getScopeNode(contextToken, adjustedPosition, sourceFile) || sourceFile;
|
||||
|
||||
/// TODO filter meaning based on the current context
|
||||
let symbolMeanings = SymbolFlags.Type | SymbolFlags.Value | SymbolFlags.Namespace | SymbolFlags.Alias;
|
||||
symbols = typeInfoResolver.getSymbolsInScope(scopeNode, symbolMeanings);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
log("getCompletionData: Semantic work: " + (new Date().getTime() - semanticStart));
|
||||
|
||||
return { symbols, isMemberCompletion, isNewIdentifierLocation, location };
|
||||
|
||||
/**
|
||||
* Finds the first node that "embraces" the position, so that one may
|
||||
* accurately aggregate locals from the closest containing scope.
|
||||
@@ -2932,18 +3208,26 @@ module ts {
|
||||
|
||||
function getCompletionsAtPosition(fileName: string, position: number): CompletionInfo {
|
||||
synchronizeHostData();
|
||||
|
||||
|
||||
let completionData = getCompletionData(fileName, position);
|
||||
if (!completionData) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let { symbols, isMemberCompletion, isNewIdentifierLocation, location } = completionData;
|
||||
if (!symbols || symbols.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
let { symbols, isMemberCompletion, isNewIdentifierLocation, location, isRightOfDot } = completionData;
|
||||
|
||||
var entries = getCompletionEntriesFromSymbols(symbols);
|
||||
let entries: CompletionEntry[];
|
||||
if (isRightOfDot && isJavaScript(fileName)) {
|
||||
entries = getCompletionEntriesFromSymbols(symbols);
|
||||
addRange(entries, getJavaScriptCompletionEntries());
|
||||
}
|
||||
else {
|
||||
if (!symbols || symbols.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
entries = getCompletionEntriesFromSymbols(symbols);
|
||||
}
|
||||
|
||||
// Add keywords if this is not a member completion list
|
||||
if (!isMemberCompletion) {
|
||||
@@ -2952,21 +3236,51 @@ module ts {
|
||||
|
||||
return { isMemberCompletion, isNewIdentifierLocation, entries };
|
||||
|
||||
function getCompletionEntriesFromSymbols(symbols: Symbol[]): CompletionEntry[] {
|
||||
let start = new Date().getTime();
|
||||
var entries: CompletionEntry[] = [];
|
||||
var nameToSymbol: Map<Symbol> = {};
|
||||
function getJavaScriptCompletionEntries(): CompletionEntry[] {
|
||||
let entries: CompletionEntry[] = [];
|
||||
let allNames: Map<string> = {};
|
||||
let target = program.getCompilerOptions().target;
|
||||
|
||||
for (let symbol of symbols) {
|
||||
let entry = createCompletionEntry(symbol, typeInfoResolver, location);
|
||||
if (entry) {
|
||||
let id = escapeIdentifier(entry.name);
|
||||
if (!lookUp(nameToSymbol, id)) {
|
||||
entries.push(entry);
|
||||
nameToSymbol[id] = symbol;
|
||||
for (let sourceFile of program.getSourceFiles()) {
|
||||
let nameTable = getNameTable(sourceFile);
|
||||
for (let name in nameTable) {
|
||||
if (!allNames[name]) {
|
||||
allNames[name] = name;
|
||||
let displayName = getCompletionEntryDisplayName(name, target, /*performCharacterChecks:*/ true);
|
||||
if (displayName) {
|
||||
let entry = {
|
||||
name: displayName,
|
||||
kind: ScriptElementKind.warning,
|
||||
kindModifiers: "",
|
||||
sortText: "1"
|
||||
};
|
||||
entries.push(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
function getCompletionEntriesFromSymbols(symbols: Symbol[]): CompletionEntry[] {
|
||||
let start = new Date().getTime();
|
||||
var entries: CompletionEntry[] = [];
|
||||
|
||||
if (symbols) {
|
||||
var nameToSymbol: Map<Symbol> = {};
|
||||
for (let symbol of symbols) {
|
||||
let entry = createCompletionEntry(symbol, typeInfoResolver, location);
|
||||
if (entry) {
|
||||
let id = escapeIdentifier(entry.name);
|
||||
if (!lookUp(nameToSymbol, id)) {
|
||||
entries.push(entry);
|
||||
nameToSymbol[id] = symbol;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
log("getCompletionsAtPosition: getCompletionEntriesFromSymbols: " + (new Date().getTime() - start));
|
||||
return entries;
|
||||
}
|
||||
@@ -2985,7 +3299,7 @@ module ts {
|
||||
// We don't need to perform character checks here because we're only comparing the
|
||||
// name against 'entryName' (which is known to be good), not building a new
|
||||
// completion entry.
|
||||
let symbol = forEach(symbols, s => getCompletionEntryDisplayName(s, target, /*performCharacterChecks:*/ false) === entryName ? s : undefined);
|
||||
let symbol = forEach(symbols, s => getCompletionEntryDisplayNameForSymbol(s, target, /*performCharacterChecks:*/ false) === entryName ? s : undefined);
|
||||
|
||||
if (symbol) {
|
||||
let displayPartsDocumentationsAndSymbolKind = getSymbolDisplayPartsDocumentationAndSymbolKind(symbol, getValidSourceFile(fileName), location, typeInfoResolver, location, SemanticMeaning.All);
|
||||
@@ -3641,8 +3955,24 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
/// References and Occurrences
|
||||
function getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] {
|
||||
let results = getOccurrencesAtPositionCore(fileName, position);
|
||||
|
||||
if (results) {
|
||||
let sourceFile = getCanonicalFileName(normalizeSlashes(fileName));
|
||||
|
||||
// ensure the results are in the file we're interested in
|
||||
results.forEach((value) => {
|
||||
let targetFile = getCanonicalFileName(normalizeSlashes(value.fileName));
|
||||
Debug.assert(sourceFile == targetFile, `Unexpected file in results. Found results in ${targetFile} expected only results in ${sourceFile}.`);
|
||||
});
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
/// References and Occurrences
|
||||
function getOccurrencesAtPositionCore(fileName: string, position: number): ReferenceEntry[] {
|
||||
synchronizeHostData();
|
||||
|
||||
let sourceFile = getValidSourceFile(fileName);
|
||||
@@ -4877,8 +5207,8 @@ module ts {
|
||||
if (symbol && symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface)) {
|
||||
forEach(symbol.getDeclarations(), declaration => {
|
||||
if (declaration.kind === SyntaxKind.ClassDeclaration) {
|
||||
getPropertySymbolFromTypeReference(getClassBaseTypeNode(<ClassDeclaration>declaration));
|
||||
forEach(getClassImplementedTypeNodes(<ClassDeclaration>declaration), getPropertySymbolFromTypeReference);
|
||||
getPropertySymbolFromTypeReference(getClassExtendsHeritageClauseElement(<ClassDeclaration>declaration));
|
||||
forEach(getClassImplementsHeritageClauseElements(<ClassDeclaration>declaration), getPropertySymbolFromTypeReference);
|
||||
}
|
||||
else if (declaration.kind === SyntaxKind.InterfaceDeclaration) {
|
||||
forEach(getInterfaceBaseTypeNodes(<InterfaceDeclaration>declaration), getPropertySymbolFromTypeReference);
|
||||
@@ -4887,7 +5217,7 @@ module ts {
|
||||
}
|
||||
return;
|
||||
|
||||
function getPropertySymbolFromTypeReference(typeReference: TypeReferenceNode) {
|
||||
function getPropertySymbolFromTypeReference(typeReference: HeritageClauseElement) {
|
||||
if (typeReference) {
|
||||
let type = typeInfoResolver.getTypeAtLocation(typeReference);
|
||||
if (type) {
|
||||
@@ -5144,19 +5474,44 @@ module ts {
|
||||
}
|
||||
|
||||
function isTypeReference(node: Node): boolean {
|
||||
if (isRightSideOfQualifiedName(node)) {
|
||||
if (isRightSideOfQualifiedNameOrPropertyAccess(node) ) {
|
||||
node = node.parent;
|
||||
}
|
||||
|
||||
return node.parent.kind === SyntaxKind.TypeReference;
|
||||
return node.parent.kind === SyntaxKind.TypeReference || node.parent.kind === SyntaxKind.HeritageClauseElement;
|
||||
}
|
||||
|
||||
function isNamespaceReference(node: Node): boolean {
|
||||
return isQualifiedNameNamespaceReference(node) || isPropertyAccessNamespaceReference(node);
|
||||
}
|
||||
|
||||
function isPropertyAccessNamespaceReference(node: Node): boolean {
|
||||
let root = node;
|
||||
let isLastClause = true;
|
||||
if (root.parent.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
while (root.parent && root.parent.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
root = root.parent;
|
||||
}
|
||||
|
||||
isLastClause = (<PropertyAccessExpression>root).name === node;
|
||||
}
|
||||
|
||||
if (!isLastClause && root.parent.kind === SyntaxKind.HeritageClauseElement && root.parent.parent.kind === SyntaxKind.HeritageClause) {
|
||||
let decl = root.parent.parent.parent;
|
||||
return (decl.kind === SyntaxKind.ClassDeclaration && (<HeritageClause>root.parent.parent).token === SyntaxKind.ImplementsKeyword) ||
|
||||
(decl.kind === SyntaxKind.InterfaceDeclaration && (<HeritageClause>root.parent.parent).token === SyntaxKind.ExtendsKeyword);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isQualifiedNameNamespaceReference(node: Node): boolean {
|
||||
let root = node;
|
||||
let isLastClause = true;
|
||||
if (root.parent.kind === SyntaxKind.QualifiedName) {
|
||||
while (root.parent && root.parent.kind === SyntaxKind.QualifiedName)
|
||||
while (root.parent && root.parent.kind === SyntaxKind.QualifiedName) {
|
||||
root = root.parent;
|
||||
}
|
||||
|
||||
isLastClause = (<QualifiedName>root).right === node;
|
||||
}
|
||||
|
||||
+17
-12
@@ -331,6 +331,22 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
/* @internal */
|
||||
export function realizeDiagnostics(diagnostics: Diagnostic[], newLine: string): { message: string; start: number; length: number; category: string; } []{
|
||||
return diagnostics.map(d => realizeDiagnostic(d, newLine));
|
||||
}
|
||||
|
||||
function realizeDiagnostic(diagnostic: Diagnostic, newLine: string): { message: string; start: number; length: number; category: string; } {
|
||||
return {
|
||||
message: flattenDiagnosticMessageText(diagnostic.messageText, newLine),
|
||||
start: diagnostic.start,
|
||||
length: diagnostic.length,
|
||||
/// TODO: no need for the tolowerCase call
|
||||
category: DiagnosticCategory[diagnostic.category].toLowerCase(),
|
||||
code: diagnostic.code
|
||||
};
|
||||
}
|
||||
|
||||
class LanguageServiceShimObject extends ShimBase implements LanguageServiceShim {
|
||||
private logger: Logger;
|
||||
|
||||
@@ -391,18 +407,7 @@ module ts {
|
||||
|
||||
private realizeDiagnostics(diagnostics: Diagnostic[]): { message: string; start: number; length: number; category: string; }[]{
|
||||
var newLine = this.getNewLine();
|
||||
return diagnostics.map(d => this.realizeDiagnostic(d, newLine));
|
||||
}
|
||||
|
||||
private realizeDiagnostic(diagnostic: Diagnostic, newLine: string): { message: string; start: number; length: number; category: string; } {
|
||||
return {
|
||||
message: flattenDiagnosticMessageText(diagnostic.messageText, newLine),
|
||||
start: diagnostic.start,
|
||||
length: diagnostic.length,
|
||||
/// TODO: no need for the tolowerCase call
|
||||
category: DiagnosticCategory[diagnostic.category].toLowerCase(),
|
||||
code: diagnostic.code
|
||||
};
|
||||
return ts.realizeDiagnostics(diagnostics, newLine);
|
||||
}
|
||||
|
||||
public getSyntacticClassifications(fileName: string, start: number, length: number): string {
|
||||
|
||||
@@ -30,9 +30,7 @@ var Board = (function () {
|
||||
function Board() {
|
||||
}
|
||||
Board.prototype.allShipsSunk = function () {
|
||||
return this.ships.every(function (val) {
|
||||
return val.isSunk;
|
||||
});
|
||||
return this.ships.every(function (val) { return val.isSunk; });
|
||||
};
|
||||
return Board;
|
||||
})();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+1
-4
@@ -17,10 +17,7 @@ var cl = Point.Origin;
|
||||
|
||||
//// [function.js]
|
||||
function Point() {
|
||||
return {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
return { x: 0, y: 0 };
|
||||
}
|
||||
//// [test.js]
|
||||
var cl;
|
||||
|
||||
@@ -2,5 +2,4 @@
|
||||
var v = (public x: string) => { };
|
||||
|
||||
//// [ArrowFunctionExpression1.js]
|
||||
var v = function (x) {
|
||||
};
|
||||
var v = function (x) { };
|
||||
|
||||
+2
-5
@@ -58,8 +58,7 @@ var clodule1 = (function () {
|
||||
})();
|
||||
var clodule1;
|
||||
(function (clodule1) {
|
||||
function f(x) {
|
||||
}
|
||||
function f(x) { }
|
||||
})(clodule1 || (clodule1 = {}));
|
||||
var clodule2 = (function () {
|
||||
function clodule2() {
|
||||
@@ -82,9 +81,7 @@ var clodule3 = (function () {
|
||||
})();
|
||||
var clodule3;
|
||||
(function (clodule3) {
|
||||
clodule3.y = {
|
||||
id: T
|
||||
};
|
||||
clodule3.y = { id: T };
|
||||
})(clodule3 || (clodule3 = {}));
|
||||
var clodule4 = (function () {
|
||||
function clodule4() {
|
||||
|
||||
+1
-2
@@ -19,8 +19,7 @@ module clodule {
|
||||
var clodule = (function () {
|
||||
function clodule() {
|
||||
}
|
||||
clodule.fn = function (id) {
|
||||
};
|
||||
clodule.fn = function (id) { };
|
||||
return clodule;
|
||||
})();
|
||||
var clodule;
|
||||
|
||||
+1
-2
@@ -19,8 +19,7 @@ module clodule {
|
||||
var clodule = (function () {
|
||||
function clodule() {
|
||||
}
|
||||
clodule.fn = function (id) {
|
||||
};
|
||||
clodule.fn = function (id) { };
|
||||
return clodule;
|
||||
})();
|
||||
var clodule;
|
||||
|
||||
+1
-3
@@ -19,9 +19,7 @@ module clodule {
|
||||
var clodule = (function () {
|
||||
function clodule() {
|
||||
}
|
||||
clodule.sfn = function (id) {
|
||||
return 42;
|
||||
};
|
||||
clodule.sfn = function (id) { return 42; };
|
||||
return clodule;
|
||||
})();
|
||||
var clodule;
|
||||
|
||||
+4
-18
@@ -28,19 +28,12 @@ var Point = (function () {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
Point.Origin = function () {
|
||||
return {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
}; // unexpected error here bug 840246
|
||||
Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246
|
||||
return Point;
|
||||
})();
|
||||
var Point;
|
||||
(function (Point) {
|
||||
function Origin() {
|
||||
return null;
|
||||
}
|
||||
function Origin() { return null; }
|
||||
Point.Origin = Origin; //expected duplicate identifier error
|
||||
})(Point || (Point = {}));
|
||||
var A;
|
||||
@@ -50,20 +43,13 @@ var A;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
Point.Origin = function () {
|
||||
return {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
}; // unexpected error here bug 840246
|
||||
Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246
|
||||
return Point;
|
||||
})();
|
||||
A.Point = Point;
|
||||
var Point;
|
||||
(function (Point) {
|
||||
function Origin() {
|
||||
return "";
|
||||
}
|
||||
function Origin() { return ""; }
|
||||
Point.Origin = Origin; //expected duplicate identifier error
|
||||
})(Point = A.Point || (A.Point = {}));
|
||||
})(A || (A = {}));
|
||||
|
||||
+4
-18
@@ -28,19 +28,12 @@ var Point = (function () {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
Point.Origin = function () {
|
||||
return {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
};
|
||||
Point.Origin = function () { return { x: 0, y: 0 }; };
|
||||
return Point;
|
||||
})();
|
||||
var Point;
|
||||
(function (Point) {
|
||||
function Origin() {
|
||||
return "";
|
||||
} // not an error, since not exported
|
||||
function Origin() { return ""; } // not an error, since not exported
|
||||
})(Point || (Point = {}));
|
||||
var A;
|
||||
(function (A) {
|
||||
@@ -49,19 +42,12 @@ var A;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
Point.Origin = function () {
|
||||
return {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
};
|
||||
Point.Origin = function () { return { x: 0, y: 0 }; };
|
||||
return Point;
|
||||
})();
|
||||
A.Point = Point;
|
||||
var Point;
|
||||
(function (Point) {
|
||||
function Origin() {
|
||||
return "";
|
||||
} // not an error since not exported
|
||||
function Origin() { return ""; } // not an error since not exported
|
||||
})(Point = A.Point || (A.Point = {}));
|
||||
})(A || (A = {}));
|
||||
|
||||
+2
-8
@@ -28,10 +28,7 @@ var Point = (function () {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
Point.Origin = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
Point.Origin = { x: 0, y: 0 };
|
||||
return Point;
|
||||
})();
|
||||
var Point;
|
||||
@@ -45,10 +42,7 @@ var A;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
Point.Origin = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
Point.Origin = { x: 0, y: 0 };
|
||||
return Point;
|
||||
})();
|
||||
A.Point = Point;
|
||||
|
||||
+2
-8
@@ -28,10 +28,7 @@ var Point = (function () {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
Point.Origin = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
Point.Origin = { x: 0, y: 0 };
|
||||
return Point;
|
||||
})();
|
||||
var Point;
|
||||
@@ -45,10 +42,7 @@ var A;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
Point.Origin = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
Point.Origin = { x: 0, y: 0 };
|
||||
return Point;
|
||||
})();
|
||||
A.Point = Point;
|
||||
|
||||
@@ -8,7 +8,6 @@ class C {
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.foo = function () {
|
||||
};
|
||||
C.prototype.foo = function () { };
|
||||
return C;
|
||||
})();
|
||||
|
||||
@@ -8,7 +8,6 @@ class C {
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.bar = function () {
|
||||
};
|
||||
C.prototype.bar = function () { };
|
||||
return C;
|
||||
})();
|
||||
|
||||
@@ -8,7 +8,6 @@ class C {
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype[1] = function () {
|
||||
};
|
||||
C.prototype[1] = function () { };
|
||||
return C;
|
||||
})();
|
||||
|
||||
@@ -8,7 +8,6 @@ class C {
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype["bar"] = function () {
|
||||
};
|
||||
C.prototype["bar"] = function () { };
|
||||
return C;
|
||||
})();
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
for (var v of [true]) { }
|
||||
|
||||
//// [ES3For-ofTypeCheck2.js]
|
||||
for (var _i = 0, _a = [
|
||||
true
|
||||
]; _i < _a.length; _i++) {
|
||||
for (var _i = 0, _a = [true]; _i < _a.length; _i++) {
|
||||
var v = _a[_i];
|
||||
}
|
||||
|
||||
@@ -4,11 +4,7 @@ for (var v of ['a', 'b', 'c']) {
|
||||
}
|
||||
|
||||
//// [ES5For-of1.js]
|
||||
for (var _i = 0, _a = [
|
||||
'a',
|
||||
'b',
|
||||
'c'
|
||||
]; _i < _a.length; _i++) {
|
||||
for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) {
|
||||
var v = _a[_i];
|
||||
console.log(v);
|
||||
}
|
||||
|
||||
@@ -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;IAAC,GAAG;IAAE,GAAG;IAAE,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,EAAxB,cAAK,EAAL,IAAwB,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAClB"}
|
||||
@@ -8,72 +8,61 @@ sources: ES5For-of1.ts
|
||||
emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of1.js
|
||||
sourceFile:ES5For-of1.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>for (var _i = 0, _a = [
|
||||
>>>for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) {
|
||||
1 >
|
||||
2 >^^^
|
||||
3 > ^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^^^
|
||||
6 > ^^
|
||||
7 > ^^^^^^
|
||||
8 > ^^^
|
||||
9 > ^^
|
||||
10> ^^^
|
||||
11> ^^
|
||||
12> ^^^
|
||||
13> ^
|
||||
14> ^^
|
||||
15> ^^^^^^^^^^^^^^
|
||||
16> ^^
|
||||
17> ^^^^
|
||||
18> ^
|
||||
1 >
|
||||
2 >for
|
||||
3 >
|
||||
4 > (var v of
|
||||
5 > ['a', 'b', 'c']
|
||||
6 >
|
||||
7 > [
|
||||
8 > 'a'
|
||||
9 > ,
|
||||
10> 'b'
|
||||
11> ,
|
||||
12> 'c'
|
||||
13> ]
|
||||
14>
|
||||
15> var v
|
||||
16>
|
||||
17> var v of ['a', 'b', 'c']
|
||||
18> )
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0)
|
||||
3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
|
||||
4 >Emitted(1, 6) Source(1, 15) + SourceIndex(0)
|
||||
5 >Emitted(1, 16) Source(1, 30) + SourceIndex(0)
|
||||
6 >Emitted(1, 18) Source(1, 15) + SourceIndex(0)
|
||||
---
|
||||
>>> 'a',
|
||||
1 >^^^^
|
||||
2 > ^^^
|
||||
3 > ^^->
|
||||
1 >[
|
||||
2 > 'a'
|
||||
1 >Emitted(2, 5) Source(1, 16) + SourceIndex(0)
|
||||
2 >Emitted(2, 8) Source(1, 19) + SourceIndex(0)
|
||||
---
|
||||
>>> 'b',
|
||||
1->^^^^
|
||||
2 > ^^^
|
||||
3 > ^->
|
||||
1->,
|
||||
2 > 'b'
|
||||
1->Emitted(3, 5) Source(1, 21) + SourceIndex(0)
|
||||
2 >Emitted(3, 8) Source(1, 24) + SourceIndex(0)
|
||||
---
|
||||
>>> 'c'
|
||||
1->^^^^
|
||||
2 > ^^^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^->
|
||||
1->,
|
||||
2 > 'c'
|
||||
1->Emitted(4, 5) Source(1, 26) + SourceIndex(0)
|
||||
2 >Emitted(4, 8) Source(1, 29) + SourceIndex(0)
|
||||
---
|
||||
>>>]; _i < _a.length; _i++) {
|
||||
1->^
|
||||
2 > ^^
|
||||
3 > ^^^^^^^^^^^^^^
|
||||
4 > ^^
|
||||
5 > ^^^^
|
||||
6 > ^
|
||||
1->]
|
||||
2 >
|
||||
3 > var v
|
||||
4 >
|
||||
5 > var v of ['a', 'b', 'c']
|
||||
6 > )
|
||||
1->Emitted(5, 2) Source(1, 30) + SourceIndex(0)
|
||||
2 >Emitted(5, 4) Source(1, 6) + SourceIndex(0)
|
||||
3 >Emitted(5, 18) Source(1, 11) + SourceIndex(0)
|
||||
4 >Emitted(5, 20) Source(1, 6) + SourceIndex(0)
|
||||
5 >Emitted(5, 24) Source(1, 30) + SourceIndex(0)
|
||||
6 >Emitted(5, 25) Source(1, 31) + SourceIndex(0)
|
||||
7 >Emitted(1, 24) Source(1, 16) + SourceIndex(0)
|
||||
8 >Emitted(1, 27) Source(1, 19) + SourceIndex(0)
|
||||
9 >Emitted(1, 29) Source(1, 21) + SourceIndex(0)
|
||||
10>Emitted(1, 32) Source(1, 24) + SourceIndex(0)
|
||||
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)
|
||||
17>Emitted(1, 60) Source(1, 30) + SourceIndex(0)
|
||||
18>Emitted(1, 61) Source(1, 31) + SourceIndex(0)
|
||||
---
|
||||
>>> var v = _a[_i];
|
||||
1 >^^^^
|
||||
@@ -85,10 +74,10 @@ sourceFile:ES5For-of1.ts
|
||||
2 > var
|
||||
3 > v
|
||||
4 >
|
||||
1 >Emitted(6, 5) Source(1, 6) + SourceIndex(0)
|
||||
2 >Emitted(6, 9) Source(1, 10) + SourceIndex(0)
|
||||
3 >Emitted(6, 10) Source(1, 11) + SourceIndex(0)
|
||||
4 >Emitted(6, 19) Source(1, 11) + SourceIndex(0)
|
||||
1 >Emitted(2, 5) Source(1, 6) + SourceIndex(0)
|
||||
2 >Emitted(2, 9) Source(1, 10) + SourceIndex(0)
|
||||
3 >Emitted(2, 10) Source(1, 11) + SourceIndex(0)
|
||||
4 >Emitted(2, 19) Source(1, 11) + SourceIndex(0)
|
||||
---
|
||||
>>> console.log(v);
|
||||
1->^^^^
|
||||
@@ -108,20 +97,20 @@ sourceFile:ES5For-of1.ts
|
||||
6 > v
|
||||
7 > )
|
||||
8 > ;
|
||||
1->Emitted(7, 5) Source(2, 5) + SourceIndex(0)
|
||||
2 >Emitted(7, 12) Source(2, 12) + SourceIndex(0)
|
||||
3 >Emitted(7, 13) Source(2, 13) + SourceIndex(0)
|
||||
4 >Emitted(7, 16) Source(2, 16) + SourceIndex(0)
|
||||
5 >Emitted(7, 17) Source(2, 17) + SourceIndex(0)
|
||||
6 >Emitted(7, 18) Source(2, 18) + SourceIndex(0)
|
||||
7 >Emitted(7, 19) Source(2, 19) + SourceIndex(0)
|
||||
8 >Emitted(7, 20) Source(2, 20) + SourceIndex(0)
|
||||
1->Emitted(3, 5) Source(2, 5) + SourceIndex(0)
|
||||
2 >Emitted(3, 12) Source(2, 12) + SourceIndex(0)
|
||||
3 >Emitted(3, 13) Source(2, 13) + SourceIndex(0)
|
||||
4 >Emitted(3, 16) Source(2, 16) + SourceIndex(0)
|
||||
5 >Emitted(3, 17) Source(2, 17) + SourceIndex(0)
|
||||
6 >Emitted(3, 18) Source(2, 18) + SourceIndex(0)
|
||||
7 >Emitted(3, 19) Source(2, 19) + SourceIndex(0)
|
||||
8 >Emitted(3, 20) Source(2, 20) + SourceIndex(0)
|
||||
---
|
||||
>>>}
|
||||
1 >^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>}
|
||||
1 >Emitted(8, 2) Source(3, 2) + SourceIndex(0)
|
||||
1 >Emitted(4, 2) Source(3, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=ES5For-of1.js.map
|
||||
@@ -9,9 +9,7 @@ for (foo().x of []) {
|
||||
|
||||
//// [ES5For-of10.js]
|
||||
function foo() {
|
||||
return {
|
||||
x: 0
|
||||
};
|
||||
return { x: 0 };
|
||||
}
|
||||
for (var _i = 0, _a = []; _i < _a.length; _i++) {
|
||||
foo().x = _a[_i];
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
for ([""] of [[""]]) { }
|
||||
|
||||
//// [ES5For-of12.js]
|
||||
for (var _i = 0, _a = [
|
||||
[
|
||||
""
|
||||
]
|
||||
]; _i < _a.length; _i++) {
|
||||
for (var _i = 0, _a = [[""]]; _i < _a.length; _i++) {
|
||||
"" = _a[_i][0];
|
||||
}
|
||||
|
||||
@@ -4,11 +4,7 @@ for (let v of ['a', 'b', 'c']) {
|
||||
}
|
||||
|
||||
//// [ES5For-of13.js]
|
||||
for (var _i = 0, _a = [
|
||||
'a',
|
||||
'b',
|
||||
'c'
|
||||
]; _i < _a.length; _i++) {
|
||||
for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) {
|
||||
var v = _a[_i];
|
||||
var x = v;
|
||||
}
|
||||
|
||||
@@ -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;IAAC,GAAG;IAAE,GAAG;IAAE,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,EAAxB,cAAK,EAAL,IAAwB,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CACb"}
|
||||
@@ -8,72 +8,61 @@ sources: ES5For-of13.ts
|
||||
emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of13.js
|
||||
sourceFile:ES5For-of13.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>for (var _i = 0, _a = [
|
||||
>>>for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) {
|
||||
1 >
|
||||
2 >^^^
|
||||
3 > ^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^^^
|
||||
6 > ^^
|
||||
7 > ^^^^^^
|
||||
8 > ^^^
|
||||
9 > ^^
|
||||
10> ^^^
|
||||
11> ^^
|
||||
12> ^^^
|
||||
13> ^
|
||||
14> ^^
|
||||
15> ^^^^^^^^^^^^^^
|
||||
16> ^^
|
||||
17> ^^^^
|
||||
18> ^
|
||||
1 >
|
||||
2 >for
|
||||
3 >
|
||||
4 > (let v of
|
||||
5 > ['a', 'b', 'c']
|
||||
6 >
|
||||
7 > [
|
||||
8 > 'a'
|
||||
9 > ,
|
||||
10> 'b'
|
||||
11> ,
|
||||
12> 'c'
|
||||
13> ]
|
||||
14>
|
||||
15> let v
|
||||
16>
|
||||
17> let v of ['a', 'b', 'c']
|
||||
18> )
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0)
|
||||
3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
|
||||
4 >Emitted(1, 6) Source(1, 15) + SourceIndex(0)
|
||||
5 >Emitted(1, 16) Source(1, 30) + SourceIndex(0)
|
||||
6 >Emitted(1, 18) Source(1, 15) + SourceIndex(0)
|
||||
---
|
||||
>>> 'a',
|
||||
1 >^^^^
|
||||
2 > ^^^
|
||||
3 > ^^->
|
||||
1 >[
|
||||
2 > 'a'
|
||||
1 >Emitted(2, 5) Source(1, 16) + SourceIndex(0)
|
||||
2 >Emitted(2, 8) Source(1, 19) + SourceIndex(0)
|
||||
---
|
||||
>>> 'b',
|
||||
1->^^^^
|
||||
2 > ^^^
|
||||
3 > ^->
|
||||
1->,
|
||||
2 > 'b'
|
||||
1->Emitted(3, 5) Source(1, 21) + SourceIndex(0)
|
||||
2 >Emitted(3, 8) Source(1, 24) + SourceIndex(0)
|
||||
---
|
||||
>>> 'c'
|
||||
1->^^^^
|
||||
2 > ^^^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^->
|
||||
1->,
|
||||
2 > 'c'
|
||||
1->Emitted(4, 5) Source(1, 26) + SourceIndex(0)
|
||||
2 >Emitted(4, 8) Source(1, 29) + SourceIndex(0)
|
||||
---
|
||||
>>>]; _i < _a.length; _i++) {
|
||||
1->^
|
||||
2 > ^^
|
||||
3 > ^^^^^^^^^^^^^^
|
||||
4 > ^^
|
||||
5 > ^^^^
|
||||
6 > ^
|
||||
1->]
|
||||
2 >
|
||||
3 > let v
|
||||
4 >
|
||||
5 > let v of ['a', 'b', 'c']
|
||||
6 > )
|
||||
1->Emitted(5, 2) Source(1, 30) + SourceIndex(0)
|
||||
2 >Emitted(5, 4) Source(1, 6) + SourceIndex(0)
|
||||
3 >Emitted(5, 18) Source(1, 11) + SourceIndex(0)
|
||||
4 >Emitted(5, 20) Source(1, 6) + SourceIndex(0)
|
||||
5 >Emitted(5, 24) Source(1, 30) + SourceIndex(0)
|
||||
6 >Emitted(5, 25) Source(1, 31) + SourceIndex(0)
|
||||
7 >Emitted(1, 24) Source(1, 16) + SourceIndex(0)
|
||||
8 >Emitted(1, 27) Source(1, 19) + SourceIndex(0)
|
||||
9 >Emitted(1, 29) Source(1, 21) + SourceIndex(0)
|
||||
10>Emitted(1, 32) Source(1, 24) + SourceIndex(0)
|
||||
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)
|
||||
17>Emitted(1, 60) Source(1, 30) + SourceIndex(0)
|
||||
18>Emitted(1, 61) Source(1, 31) + SourceIndex(0)
|
||||
---
|
||||
>>> var v = _a[_i];
|
||||
1 >^^^^
|
||||
@@ -84,10 +73,10 @@ sourceFile:ES5For-of13.ts
|
||||
2 > let
|
||||
3 > v
|
||||
4 >
|
||||
1 >Emitted(6, 5) Source(1, 6) + SourceIndex(0)
|
||||
2 >Emitted(6, 9) Source(1, 10) + SourceIndex(0)
|
||||
3 >Emitted(6, 10) Source(1, 11) + SourceIndex(0)
|
||||
4 >Emitted(6, 19) Source(1, 11) + SourceIndex(0)
|
||||
1 >Emitted(2, 5) Source(1, 6) + SourceIndex(0)
|
||||
2 >Emitted(2, 9) Source(1, 10) + SourceIndex(0)
|
||||
3 >Emitted(2, 10) Source(1, 11) + SourceIndex(0)
|
||||
4 >Emitted(2, 19) Source(1, 11) + SourceIndex(0)
|
||||
---
|
||||
>>> var x = v;
|
||||
1 >^^^^
|
||||
@@ -103,18 +92,18 @@ sourceFile:ES5For-of13.ts
|
||||
4 > =
|
||||
5 > v
|
||||
6 > ;
|
||||
1 >Emitted(7, 5) Source(2, 5) + SourceIndex(0)
|
||||
2 >Emitted(7, 9) Source(2, 9) + SourceIndex(0)
|
||||
3 >Emitted(7, 10) Source(2, 10) + SourceIndex(0)
|
||||
4 >Emitted(7, 13) Source(2, 13) + SourceIndex(0)
|
||||
5 >Emitted(7, 14) Source(2, 14) + SourceIndex(0)
|
||||
6 >Emitted(7, 15) Source(2, 15) + SourceIndex(0)
|
||||
1 >Emitted(3, 5) Source(2, 5) + SourceIndex(0)
|
||||
2 >Emitted(3, 9) Source(2, 9) + SourceIndex(0)
|
||||
3 >Emitted(3, 10) Source(2, 10) + SourceIndex(0)
|
||||
4 >Emitted(3, 13) Source(2, 13) + SourceIndex(0)
|
||||
5 >Emitted(3, 14) Source(2, 14) + SourceIndex(0)
|
||||
6 >Emitted(3, 15) Source(2, 15) + SourceIndex(0)
|
||||
---
|
||||
>>>}
|
||||
1 >^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>}
|
||||
1 >Emitted(8, 2) Source(3, 2) + SourceIndex(0)
|
||||
1 >Emitted(4, 2) Source(3, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=ES5For-of13.js.map
|
||||
@@ -11,9 +11,7 @@ for (let v of []) {
|
||||
for (var _i = 0, _a = []; _i < _a.length; _i++) {
|
||||
var v = _a[_i];
|
||||
v;
|
||||
for (var _b = 0, _c = [
|
||||
v
|
||||
]; _b < _c.length; _b++) {
|
||||
for (var _b = 0, _c = [v]; _b < _c.length; _b++) {
|
||||
var v_1 = _c[_b];
|
||||
var x = v_1;
|
||||
v_1++;
|
||||
|
||||
@@ -10,9 +10,7 @@ for (let v of []) {
|
||||
for (var _i = 0, _a = []; _i < _a.length; _i++) {
|
||||
var v = _a[_i];
|
||||
var v_1;
|
||||
for (var _b = 0, _c = [
|
||||
v
|
||||
]; _b < _c.length; _b++) {
|
||||
for (var _b = 0, _c = [v]; _b < _c.length; _b++) {
|
||||
var v_2 = _c[_b];
|
||||
var v_3;
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ for (let v of []) {
|
||||
}
|
||||
|
||||
//// [ES5For-of21.js]
|
||||
for (var _i = 0, _a = []; _i < _a.length; _i++) {
|
||||
var v = _a[_i];
|
||||
for (var _b = 0, _c = []; _b < _c.length; _b++) {
|
||||
var _i_1 = _c[_b];
|
||||
for (var _a = 0, _b = []; _a < _b.length; _a++) {
|
||||
var v = _b[_a];
|
||||
for (var _c = 0, _d = []; _c < _d.length; _c++) {
|
||||
var _i = _d[_c];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,8 @@ for (var x of [1, 2, 3]) {
|
||||
}
|
||||
|
||||
//// [ES5For-of22.js]
|
||||
for (var _i = 0, _a = [
|
||||
1,
|
||||
2,
|
||||
3
|
||||
]; _i < _a.length; _i++) {
|
||||
var x = _a[_i];
|
||||
var _a_1 = 0;
|
||||
for (var _i = 0, _b = [1, 2, 3]; _i < _b.length; _i++) {
|
||||
var x = _b[_i];
|
||||
var _a = 0;
|
||||
console.log(x);
|
||||
}
|
||||
|
||||
@@ -5,11 +5,7 @@ for (var x of [1, 2, 3]) {
|
||||
}
|
||||
|
||||
//// [ES5For-of23.js]
|
||||
for (var _i = 0, _b = [
|
||||
1,
|
||||
2,
|
||||
3
|
||||
]; _i < _b.length; _i++) {
|
||||
for (var _i = 0, _b = [1, 2, 3]; _i < _b.length; _i++) {
|
||||
var x = _b[_i];
|
||||
var _a = 0;
|
||||
console.log(x);
|
||||
|
||||
@@ -5,11 +5,7 @@ for (var v of a) {
|
||||
}
|
||||
|
||||
//// [ES5For-of24.js]
|
||||
var a = [
|
||||
1,
|
||||
2,
|
||||
3
|
||||
];
|
||||
var a = [1, 2, 3];
|
||||
for (var _i = 0; _i < a.length; _i++) {
|
||||
var v = a[_i];
|
||||
var a_1 = 0;
|
||||
|
||||
@@ -6,11 +6,7 @@ for (var v of a) {
|
||||
}
|
||||
|
||||
//// [ES5For-of25.js]
|
||||
var a = [
|
||||
1,
|
||||
2,
|
||||
3
|
||||
];
|
||||
var a = [1, 2, 3];
|
||||
for (var _i = 0; _i < a.length; _i++) {
|
||||
var v = a[_i];
|
||||
v;
|
||||
|
||||
@@ -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;IAAC,CAAC;IAAE,CAAC;IAAE,CAAC;CAAC,CAAC;AAClB,GAAG,CAAC,CAAU,UAAC,EAAV,aAAK,EAAL,IAAU,CAAC;IAAX,IAAI,CAAC,GAAI,CAAC,IAAL;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,EAAV,aAAK,EAAL,IAAU,CAAC;IAAX,IAAI,CAAC,GAAI,CAAC,IAAL;IACN,CAAC,CAAC;IACF,CAAC,CAAC;CACL"}
|
||||
@@ -8,54 +8,44 @@ sources: ES5For-of25.ts
|
||||
emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of25.js
|
||||
sourceFile:ES5For-of25.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>var a = [
|
||||
>>>var a = [1, 2, 3];
|
||||
1 >
|
||||
2 >^^^^
|
||||
3 > ^
|
||||
4 > ^^^
|
||||
5 > ^
|
||||
6 > ^
|
||||
7 > ^^
|
||||
8 > ^
|
||||
9 > ^^
|
||||
10> ^
|
||||
11> ^
|
||||
12> ^
|
||||
13> ^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >var
|
||||
3 > a
|
||||
4 > =
|
||||
5 > [
|
||||
6 > 1
|
||||
7 > ,
|
||||
8 > 2
|
||||
9 > ,
|
||||
10> 3
|
||||
11> ]
|
||||
12> ;
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
|
||||
3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0)
|
||||
4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0)
|
||||
---
|
||||
>>> 1,
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^^->
|
||||
1 >[
|
||||
2 > 1
|
||||
1 >Emitted(2, 5) Source(1, 10) + SourceIndex(0)
|
||||
2 >Emitted(2, 6) Source(1, 11) + SourceIndex(0)
|
||||
---
|
||||
>>> 2,
|
||||
1->^^^^
|
||||
2 > ^
|
||||
3 > ^->
|
||||
1->,
|
||||
2 > 2
|
||||
1->Emitted(3, 5) Source(1, 13) + SourceIndex(0)
|
||||
2 >Emitted(3, 6) Source(1, 14) + SourceIndex(0)
|
||||
---
|
||||
>>> 3
|
||||
1->^^^^
|
||||
2 > ^
|
||||
1->,
|
||||
2 > 3
|
||||
1->Emitted(4, 5) Source(1, 16) + SourceIndex(0)
|
||||
2 >Emitted(4, 6) Source(1, 17) + SourceIndex(0)
|
||||
---
|
||||
>>>];
|
||||
1 >^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >]
|
||||
2 > ;
|
||||
1 >Emitted(5, 2) Source(1, 18) + SourceIndex(0)
|
||||
2 >Emitted(5, 3) Source(1, 19) + SourceIndex(0)
|
||||
5 >Emitted(1, 10) Source(1, 10) + SourceIndex(0)
|
||||
6 >Emitted(1, 11) Source(1, 11) + SourceIndex(0)
|
||||
7 >Emitted(1, 13) Source(1, 13) + SourceIndex(0)
|
||||
8 >Emitted(1, 14) Source(1, 14) + SourceIndex(0)
|
||||
9 >Emitted(1, 16) Source(1, 16) + SourceIndex(0)
|
||||
10>Emitted(1, 17) Source(1, 17) + SourceIndex(0)
|
||||
11>Emitted(1, 18) Source(1, 18) + SourceIndex(0)
|
||||
12>Emitted(1, 19) Source(1, 19) + SourceIndex(0)
|
||||
---
|
||||
>>>for (var _i = 0; _i < a.length; _i++) {
|
||||
1->
|
||||
@@ -79,16 +69,16 @@ sourceFile:ES5For-of25.ts
|
||||
8 >
|
||||
9 > var v of a
|
||||
10> )
|
||||
1->Emitted(6, 1) Source(2, 1) + SourceIndex(0)
|
||||
2 >Emitted(6, 4) Source(2, 4) + SourceIndex(0)
|
||||
3 >Emitted(6, 5) Source(2, 5) + SourceIndex(0)
|
||||
4 >Emitted(6, 6) Source(2, 15) + SourceIndex(0)
|
||||
5 >Emitted(6, 16) Source(2, 16) + SourceIndex(0)
|
||||
6 >Emitted(6, 18) Source(2, 6) + SourceIndex(0)
|
||||
7 >Emitted(6, 31) Source(2, 11) + SourceIndex(0)
|
||||
8 >Emitted(6, 33) Source(2, 6) + SourceIndex(0)
|
||||
9 >Emitted(6, 37) Source(2, 16) + SourceIndex(0)
|
||||
10>Emitted(6, 38) Source(2, 17) + SourceIndex(0)
|
||||
1->Emitted(2, 1) Source(2, 1) + SourceIndex(0)
|
||||
2 >Emitted(2, 4) Source(2, 4) + SourceIndex(0)
|
||||
3 >Emitted(2, 5) Source(2, 5) + SourceIndex(0)
|
||||
4 >Emitted(2, 6) Source(2, 15) + SourceIndex(0)
|
||||
5 >Emitted(2, 16) Source(2, 16) + SourceIndex(0)
|
||||
6 >Emitted(2, 18) Source(2, 6) + SourceIndex(0)
|
||||
7 >Emitted(2, 31) Source(2, 11) + SourceIndex(0)
|
||||
8 >Emitted(2, 33) Source(2, 6) + SourceIndex(0)
|
||||
9 >Emitted(2, 37) Source(2, 16) + SourceIndex(0)
|
||||
10>Emitted(2, 38) Source(2, 17) + SourceIndex(0)
|
||||
---
|
||||
>>> var v = a[_i];
|
||||
1 >^^^^
|
||||
@@ -103,12 +93,12 @@ sourceFile:ES5For-of25.ts
|
||||
4 > of
|
||||
5 > a
|
||||
6 >
|
||||
1 >Emitted(7, 5) Source(2, 6) + SourceIndex(0)
|
||||
2 >Emitted(7, 9) Source(2, 10) + SourceIndex(0)
|
||||
3 >Emitted(7, 10) Source(2, 11) + SourceIndex(0)
|
||||
4 >Emitted(7, 13) Source(2, 15) + SourceIndex(0)
|
||||
5 >Emitted(7, 14) Source(2, 16) + SourceIndex(0)
|
||||
6 >Emitted(7, 18) Source(2, 11) + SourceIndex(0)
|
||||
1 >Emitted(3, 5) Source(2, 6) + SourceIndex(0)
|
||||
2 >Emitted(3, 9) Source(2, 10) + SourceIndex(0)
|
||||
3 >Emitted(3, 10) Source(2, 11) + SourceIndex(0)
|
||||
4 >Emitted(3, 13) Source(2, 15) + SourceIndex(0)
|
||||
5 >Emitted(3, 14) Source(2, 16) + SourceIndex(0)
|
||||
6 >Emitted(3, 18) Source(2, 11) + SourceIndex(0)
|
||||
---
|
||||
>>> v;
|
||||
1 >^^^^
|
||||
@@ -119,9 +109,9 @@ sourceFile:ES5For-of25.ts
|
||||
>
|
||||
2 > v
|
||||
3 > ;
|
||||
1 >Emitted(8, 5) Source(3, 5) + SourceIndex(0)
|
||||
2 >Emitted(8, 6) Source(3, 6) + SourceIndex(0)
|
||||
3 >Emitted(8, 7) Source(3, 7) + SourceIndex(0)
|
||||
1 >Emitted(4, 5) Source(3, 5) + SourceIndex(0)
|
||||
2 >Emitted(4, 6) Source(3, 6) + SourceIndex(0)
|
||||
3 >Emitted(4, 7) Source(3, 7) + SourceIndex(0)
|
||||
---
|
||||
>>> a;
|
||||
1->^^^^
|
||||
@@ -131,15 +121,15 @@ sourceFile:ES5For-of25.ts
|
||||
>
|
||||
2 > a
|
||||
3 > ;
|
||||
1->Emitted(9, 5) Source(4, 5) + SourceIndex(0)
|
||||
2 >Emitted(9, 6) Source(4, 6) + SourceIndex(0)
|
||||
3 >Emitted(9, 7) Source(4, 7) + SourceIndex(0)
|
||||
1->Emitted(5, 5) Source(4, 5) + SourceIndex(0)
|
||||
2 >Emitted(5, 6) Source(4, 6) + SourceIndex(0)
|
||||
3 >Emitted(5, 7) Source(4, 7) + SourceIndex(0)
|
||||
---
|
||||
>>>}
|
||||
1 >^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>}
|
||||
1 >Emitted(10, 2) Source(5, 2) + SourceIndex(0)
|
||||
1 >Emitted(6, 2) Source(5, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=ES5For-of25.js.map
|
||||
@@ -5,10 +5,7 @@ for (var [a = 0, b = 1] of [2, 3]) {
|
||||
}
|
||||
|
||||
//// [ES5For-of26.js]
|
||||
for (var _i = 0, _a = [
|
||||
2,
|
||||
3
|
||||
]; _i < _a.length; _i++) {
|
||||
for (var _i = 0, _a = [2, 3]; _i < _a.length; _i++) {
|
||||
var _b = _a[_i], _c = _b[0], a = _c === void 0 ? 0 : _c, _d = _b[1], b = _d === void 0 ? 1 : _d;
|
||||
a;
|
||||
b;
|
||||
|
||||
@@ -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;IAAC,CAAC;IAAE,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,EAA5B,cAAkB,EAAlB,IAA4B,CAAC;IAA7B,6BAAK,CAAC,mBAAG,CAAC,mBAAE,CAAC,mBAAG,CAAC,KAAC;IACnB,CAAC,CAAC;IACF,CAAC,CAAC;CACL"}
|
||||
@@ -8,64 +8,56 @@ sources: ES5For-of26.ts
|
||||
emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of26.js
|
||||
sourceFile:ES5For-of26.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>for (var _i = 0, _a = [
|
||||
>>>for (var _i = 0, _a = [2, 3]; _i < _a.length; _i++) {
|
||||
1 >
|
||||
2 >^^^
|
||||
3 > ^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^^^
|
||||
6 > ^^
|
||||
7 > ^^^^^^
|
||||
8 > ^
|
||||
9 > ^^
|
||||
10> ^
|
||||
11> ^
|
||||
12> ^^
|
||||
13> ^^^^^^^^^^^^^^
|
||||
14> ^^
|
||||
15> ^^^^
|
||||
16> ^
|
||||
17> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
2 >for
|
||||
3 >
|
||||
4 > (var [a = 0, b = 1] of
|
||||
5 > [2, 3]
|
||||
6 >
|
||||
7 > [
|
||||
8 > 2
|
||||
9 > ,
|
||||
10> 3
|
||||
11> ]
|
||||
12>
|
||||
13> var [a = 0, b = 1]
|
||||
14>
|
||||
15> var [a = 0, b = 1] of [2, 3]
|
||||
16> )
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0)
|
||||
3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
|
||||
4 >Emitted(1, 6) Source(1, 28) + SourceIndex(0)
|
||||
5 >Emitted(1, 16) Source(1, 34) + SourceIndex(0)
|
||||
6 >Emitted(1, 18) Source(1, 28) + SourceIndex(0)
|
||||
---
|
||||
>>> 2,
|
||||
1 >^^^^
|
||||
2 > ^
|
||||
3 > ^->
|
||||
1 >[
|
||||
2 > 2
|
||||
1 >Emitted(2, 5) Source(1, 29) + SourceIndex(0)
|
||||
2 >Emitted(2, 6) Source(1, 30) + SourceIndex(0)
|
||||
---
|
||||
>>> 3
|
||||
1->^^^^
|
||||
2 > ^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->,
|
||||
2 > 3
|
||||
1->Emitted(3, 5) Source(1, 32) + SourceIndex(0)
|
||||
2 >Emitted(3, 6) Source(1, 33) + SourceIndex(0)
|
||||
---
|
||||
>>>]; _i < _a.length; _i++) {
|
||||
1->^
|
||||
2 > ^^
|
||||
3 > ^^^^^^^^^^^^^^
|
||||
4 > ^^
|
||||
5 > ^^^^
|
||||
6 > ^
|
||||
7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1->]
|
||||
2 >
|
||||
3 > var [a = 0, b = 1]
|
||||
4 >
|
||||
5 > var [a = 0, b = 1] of [2, 3]
|
||||
6 > )
|
||||
1->Emitted(4, 2) Source(1, 34) + SourceIndex(0)
|
||||
2 >Emitted(4, 4) Source(1, 6) + SourceIndex(0)
|
||||
3 >Emitted(4, 18) Source(1, 24) + SourceIndex(0)
|
||||
4 >Emitted(4, 20) Source(1, 6) + SourceIndex(0)
|
||||
5 >Emitted(4, 24) Source(1, 34) + SourceIndex(0)
|
||||
6 >Emitted(4, 25) Source(1, 35) + SourceIndex(0)
|
||||
7 >Emitted(1, 24) Source(1, 29) + SourceIndex(0)
|
||||
8 >Emitted(1, 25) Source(1, 30) + SourceIndex(0)
|
||||
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)
|
||||
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->^^^^
|
||||
@@ -88,16 +80,16 @@ sourceFile:ES5For-of26.ts
|
||||
8 > =
|
||||
9 > 1
|
||||
10> ]
|
||||
1->Emitted(5, 5) Source(1, 6) + SourceIndex(0)
|
||||
2 >Emitted(5, 34) Source(1, 11) + SourceIndex(0)
|
||||
3 >Emitted(5, 35) Source(1, 12) + SourceIndex(0)
|
||||
4 >Emitted(5, 54) Source(1, 15) + SourceIndex(0)
|
||||
5 >Emitted(5, 55) Source(1, 16) + SourceIndex(0)
|
||||
6 >Emitted(5, 74) Source(1, 18) + SourceIndex(0)
|
||||
7 >Emitted(5, 75) Source(1, 19) + SourceIndex(0)
|
||||
8 >Emitted(5, 94) Source(1, 22) + SourceIndex(0)
|
||||
9 >Emitted(5, 95) Source(1, 23) + SourceIndex(0)
|
||||
10>Emitted(5, 100) Source(1, 24) + SourceIndex(0)
|
||||
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)
|
||||
---
|
||||
>>> a;
|
||||
1 >^^^^
|
||||
@@ -108,9 +100,9 @@ sourceFile:ES5For-of26.ts
|
||||
>
|
||||
2 > a
|
||||
3 > ;
|
||||
1 >Emitted(6, 5) Source(2, 5) + SourceIndex(0)
|
||||
2 >Emitted(6, 6) Source(2, 6) + SourceIndex(0)
|
||||
3 >Emitted(6, 7) Source(2, 7) + SourceIndex(0)
|
||||
1 >Emitted(3, 5) Source(2, 5) + SourceIndex(0)
|
||||
2 >Emitted(3, 6) Source(2, 6) + SourceIndex(0)
|
||||
3 >Emitted(3, 7) Source(2, 7) + SourceIndex(0)
|
||||
---
|
||||
>>> b;
|
||||
1->^^^^
|
||||
@@ -120,15 +112,15 @@ sourceFile:ES5For-of26.ts
|
||||
>
|
||||
2 > b
|
||||
3 > ;
|
||||
1->Emitted(7, 5) Source(3, 5) + SourceIndex(0)
|
||||
2 >Emitted(7, 6) Source(3, 6) + SourceIndex(0)
|
||||
3 >Emitted(7, 7) Source(3, 7) + SourceIndex(0)
|
||||
1->Emitted(4, 5) Source(3, 5) + SourceIndex(0)
|
||||
2 >Emitted(4, 6) Source(3, 6) + SourceIndex(0)
|
||||
3 >Emitted(4, 7) Source(3, 7) + SourceIndex(0)
|
||||
---
|
||||
>>>}
|
||||
1 >^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
>}
|
||||
1 >Emitted(8, 2) Source(4, 2) + SourceIndex(0)
|
||||
1 >Emitted(5, 2) Source(4, 2) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=ES5For-of26.js.map
|
||||
@@ -5,10 +5,7 @@ for (var {x: a = 0, y: b = 1} of [2, 3]) {
|
||||
}
|
||||
|
||||
//// [ES5For-of27.js]
|
||||
for (var _i = 0, _a = [
|
||||
2,
|
||||
3
|
||||
]; _i < _a.length; _i++) {
|
||||
for (var _i = 0, _a = [2, 3]; _i < _a.length; _i++) {
|
||||
var _b = _a[_i], _c = _b.x, a = _c === void 0 ? 0 : _c, _d = _b.y, b = _d === void 0 ? 1 : _d;
|
||||
a;
|
||||
b;
|
||||
|
||||
@@ -5,10 +5,7 @@ for (let [a = 0, b = 1] of [2, 3]) {
|
||||
}
|
||||
|
||||
//// [ES5For-of28.js]
|
||||
for (var _i = 0, _a = [
|
||||
2,
|
||||
3
|
||||
]; _i < _a.length; _i++) {
|
||||
for (var _i = 0, _a = [2, 3]; _i < _a.length; _i++) {
|
||||
var _b = _a[_i], _c = _b[0], a = _c === void 0 ? 0 : _c, _d = _b[1], b = _d === void 0 ? 1 : _d;
|
||||
a;
|
||||
b;
|
||||
|
||||
@@ -5,10 +5,7 @@ for (const {x: a = 0, y: b = 1} of [2, 3]) {
|
||||
}
|
||||
|
||||
//// [ES5For-of29.js]
|
||||
for (var _i = 0, _a = [
|
||||
2,
|
||||
3
|
||||
]; _i < _a.length; _i++) {
|
||||
for (var _i = 0, _a = [2, 3]; _i < _a.length; _i++) {
|
||||
var _b = _a[_i], _c = _b.x, a = _c === void 0 ? 0 : _c, _d = _b.y, b = _d === void 0 ? 1 : _d;
|
||||
a;
|
||||
b;
|
||||
|
||||
@@ -3,11 +3,7 @@ for (var v of ['a', 'b', 'c'])
|
||||
var x = v;
|
||||
|
||||
//// [ES5For-of3.js]
|
||||
for (var _i = 0, _a = [
|
||||
'a',
|
||||
'b',
|
||||
'c'
|
||||
]; _i < _a.length; _i++) {
|
||||
for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) {
|
||||
var v = _a[_i];
|
||||
var x = v;
|
||||
}
|
||||
|
||||
@@ -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;IAAC,GAAG;IAAE,GAAG;IAAE,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,EAAxB,cAAK,EAAL,IAAwB,CAAC;IAAzB,IAAI,CAAC,SAAA;IACN,IAAI,CAAC,GAAG,CAAC,CAAC;CAAA"}
|
||||
@@ -8,72 +8,61 @@ sources: ES5For-of3.ts
|
||||
emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of3.js
|
||||
sourceFile:ES5For-of3.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>for (var _i = 0, _a = [
|
||||
>>>for (var _i = 0, _a = ['a', 'b', 'c']; _i < _a.length; _i++) {
|
||||
1 >
|
||||
2 >^^^
|
||||
3 > ^
|
||||
4 > ^
|
||||
5 > ^^^^^^^^^^
|
||||
6 > ^^
|
||||
7 > ^^^^^^
|
||||
8 > ^^^
|
||||
9 > ^^
|
||||
10> ^^^
|
||||
11> ^^
|
||||
12> ^^^
|
||||
13> ^
|
||||
14> ^^
|
||||
15> ^^^^^^^^^^^^^^
|
||||
16> ^^
|
||||
17> ^^^^
|
||||
18> ^
|
||||
1 >
|
||||
2 >for
|
||||
3 >
|
||||
4 > (var v of
|
||||
5 > ['a', 'b', 'c']
|
||||
6 >
|
||||
7 > [
|
||||
8 > 'a'
|
||||
9 > ,
|
||||
10> 'b'
|
||||
11> ,
|
||||
12> 'c'
|
||||
13> ]
|
||||
14>
|
||||
15> var v
|
||||
16>
|
||||
17> var v of ['a', 'b', 'c']
|
||||
18> )
|
||||
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
|
||||
2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0)
|
||||
3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0)
|
||||
4 >Emitted(1, 6) Source(1, 15) + SourceIndex(0)
|
||||
5 >Emitted(1, 16) Source(1, 30) + SourceIndex(0)
|
||||
6 >Emitted(1, 18) Source(1, 15) + SourceIndex(0)
|
||||
---
|
||||
>>> 'a',
|
||||
1 >^^^^
|
||||
2 > ^^^
|
||||
3 > ^^->
|
||||
1 >[
|
||||
2 > 'a'
|
||||
1 >Emitted(2, 5) Source(1, 16) + SourceIndex(0)
|
||||
2 >Emitted(2, 8) Source(1, 19) + SourceIndex(0)
|
||||
---
|
||||
>>> 'b',
|
||||
1->^^^^
|
||||
2 > ^^^
|
||||
3 > ^->
|
||||
1->,
|
||||
2 > 'b'
|
||||
1->Emitted(3, 5) Source(1, 21) + SourceIndex(0)
|
||||
2 >Emitted(3, 8) Source(1, 24) + SourceIndex(0)
|
||||
---
|
||||
>>> 'c'
|
||||
1->^^^^
|
||||
2 > ^^^
|
||||
3 > ^^^^^^^^^^^^^^^^^^^^->
|
||||
1->,
|
||||
2 > 'c'
|
||||
1->Emitted(4, 5) Source(1, 26) + SourceIndex(0)
|
||||
2 >Emitted(4, 8) Source(1, 29) + SourceIndex(0)
|
||||
---
|
||||
>>>]; _i < _a.length; _i++) {
|
||||
1->^
|
||||
2 > ^^
|
||||
3 > ^^^^^^^^^^^^^^
|
||||
4 > ^^
|
||||
5 > ^^^^
|
||||
6 > ^
|
||||
1->]
|
||||
2 >
|
||||
3 > var v
|
||||
4 >
|
||||
5 > var v of ['a', 'b', 'c']
|
||||
6 > )
|
||||
1->Emitted(5, 2) Source(1, 30) + SourceIndex(0)
|
||||
2 >Emitted(5, 4) Source(1, 6) + SourceIndex(0)
|
||||
3 >Emitted(5, 18) Source(1, 11) + SourceIndex(0)
|
||||
4 >Emitted(5, 20) Source(1, 6) + SourceIndex(0)
|
||||
5 >Emitted(5, 24) Source(1, 30) + SourceIndex(0)
|
||||
6 >Emitted(5, 25) Source(1, 31) + SourceIndex(0)
|
||||
7 >Emitted(1, 24) Source(1, 16) + SourceIndex(0)
|
||||
8 >Emitted(1, 27) Source(1, 19) + SourceIndex(0)
|
||||
9 >Emitted(1, 29) Source(1, 21) + SourceIndex(0)
|
||||
10>Emitted(1, 32) Source(1, 24) + SourceIndex(0)
|
||||
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)
|
||||
17>Emitted(1, 60) Source(1, 30) + SourceIndex(0)
|
||||
18>Emitted(1, 61) Source(1, 31) + SourceIndex(0)
|
||||
---
|
||||
>>> var v = _a[_i];
|
||||
1 >^^^^
|
||||
@@ -84,10 +73,10 @@ sourceFile:ES5For-of3.ts
|
||||
2 > var
|
||||
3 > v
|
||||
4 >
|
||||
1 >Emitted(6, 5) Source(1, 6) + SourceIndex(0)
|
||||
2 >Emitted(6, 9) Source(1, 10) + SourceIndex(0)
|
||||
3 >Emitted(6, 10) Source(1, 11) + SourceIndex(0)
|
||||
4 >Emitted(6, 19) Source(1, 11) + SourceIndex(0)
|
||||
1 >Emitted(2, 5) Source(1, 6) + SourceIndex(0)
|
||||
2 >Emitted(2, 9) Source(1, 10) + SourceIndex(0)
|
||||
3 >Emitted(2, 10) Source(1, 11) + SourceIndex(0)
|
||||
4 >Emitted(2, 19) Source(1, 11) + SourceIndex(0)
|
||||
---
|
||||
>>> var x = v;
|
||||
1 >^^^^
|
||||
@@ -103,17 +92,17 @@ sourceFile:ES5For-of3.ts
|
||||
4 > =
|
||||
5 > v
|
||||
6 > ;
|
||||
1 >Emitted(7, 5) Source(2, 5) + SourceIndex(0)
|
||||
2 >Emitted(7, 9) Source(2, 9) + SourceIndex(0)
|
||||
3 >Emitted(7, 10) Source(2, 10) + SourceIndex(0)
|
||||
4 >Emitted(7, 13) Source(2, 13) + SourceIndex(0)
|
||||
5 >Emitted(7, 14) Source(2, 14) + SourceIndex(0)
|
||||
6 >Emitted(7, 15) Source(2, 15) + SourceIndex(0)
|
||||
1 >Emitted(3, 5) Source(2, 5) + SourceIndex(0)
|
||||
2 >Emitted(3, 9) Source(2, 9) + SourceIndex(0)
|
||||
3 >Emitted(3, 10) Source(2, 10) + SourceIndex(0)
|
||||
4 >Emitted(3, 13) Source(2, 13) + SourceIndex(0)
|
||||
5 >Emitted(3, 14) Source(2, 14) + SourceIndex(0)
|
||||
6 >Emitted(3, 15) Source(2, 15) + SourceIndex(0)
|
||||
---
|
||||
>>>}
|
||||
1 >^
|
||||
2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
|
||||
1 >
|
||||
1 >Emitted(8, 2) Source(2, 15) + SourceIndex(0)
|
||||
1 >Emitted(4, 2) Source(2, 15) + SourceIndex(0)
|
||||
---
|
||||
>>>//# sourceMappingURL=ES5For-of3.js.map
|
||||
@@ -8,10 +8,7 @@ for ([a = 1, b = ""] of tuple) {
|
||||
|
||||
//// [ES5For-of30.js]
|
||||
var a, b;
|
||||
var tuple = [
|
||||
2,
|
||||
"3"
|
||||
];
|
||||
var tuple = [2, "3"];
|
||||
for (var _i = 0; _i < tuple.length; _i++) {
|
||||
_a = tuple[_i], _b = _a[0], a = _b === void 0 ? 1 : _b, _c = _a[1], b = _c === void 0 ? "" : _c;
|
||||
a;
|
||||
|
||||
@@ -10,9 +10,6 @@ for (var _i = 0, _a = []; _i < _a.length; _i++) {
|
||||
var w = _a[_i];
|
||||
for (var _b = 0, _c = []; _b < _c.length; _b++) {
|
||||
var v = _c[_b];
|
||||
var x = [
|
||||
w,
|
||||
v
|
||||
];
|
||||
var x = [w, v];
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user