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 outlineComments
This commit is contained in:
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
Vendored
+158
-8
@@ -14223,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;
|
||||
@@ -14231,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
+158
-8
@@ -17205,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;
|
||||
@@ -17213,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;
|
||||
};
|
||||
|
||||
+8084
-3044
File diff suppressed because one or more lines are too long
+1949
-1593
File diff suppressed because it is too large
Load Diff
Vendored
+86
-58
@@ -196,59 +196,62 @@ declare module "typescript" {
|
||||
TemplateExpression = 171,
|
||||
YieldExpression = 172,
|
||||
SpreadElementExpression = 173,
|
||||
OmittedExpression = 174,
|
||||
TemplateSpan = 175,
|
||||
Block = 176,
|
||||
VariableStatement = 177,
|
||||
EmptyStatement = 178,
|
||||
ExpressionStatement = 179,
|
||||
IfStatement = 180,
|
||||
DoStatement = 181,
|
||||
WhileStatement = 182,
|
||||
ForStatement = 183,
|
||||
ForInStatement = 184,
|
||||
ForOfStatement = 185,
|
||||
ContinueStatement = 186,
|
||||
BreakStatement = 187,
|
||||
ReturnStatement = 188,
|
||||
WithStatement = 189,
|
||||
SwitchStatement = 190,
|
||||
LabeledStatement = 191,
|
||||
ThrowStatement = 192,
|
||||
TryStatement = 193,
|
||||
DebuggerStatement = 194,
|
||||
VariableDeclaration = 195,
|
||||
VariableDeclarationList = 196,
|
||||
FunctionDeclaration = 197,
|
||||
ClassDeclaration = 198,
|
||||
InterfaceDeclaration = 199,
|
||||
TypeAliasDeclaration = 200,
|
||||
EnumDeclaration = 201,
|
||||
ModuleDeclaration = 202,
|
||||
ModuleBlock = 203,
|
||||
CaseBlock = 204,
|
||||
ImportEqualsDeclaration = 205,
|
||||
ImportDeclaration = 206,
|
||||
ImportClause = 207,
|
||||
NamespaceImport = 208,
|
||||
NamedImports = 209,
|
||||
ImportSpecifier = 210,
|
||||
ExportAssignment = 211,
|
||||
ExportDeclaration = 212,
|
||||
NamedExports = 213,
|
||||
ExportSpecifier = 214,
|
||||
MissingDeclaration = 215,
|
||||
ExternalModuleReference = 216,
|
||||
CaseClause = 217,
|
||||
DefaultClause = 218,
|
||||
HeritageClause = 219,
|
||||
CatchClause = 220,
|
||||
PropertyAssignment = 221,
|
||||
ShorthandPropertyAssignment = 222,
|
||||
EnumMember = 223,
|
||||
SourceFile = 224,
|
||||
SyntaxList = 225,
|
||||
Count = 226,
|
||||
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,
|
||||
@@ -432,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;
|
||||
@@ -570,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 {
|
||||
@@ -664,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;
|
||||
}
|
||||
@@ -681,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;
|
||||
@@ -923,7 +937,7 @@ declare module "typescript" {
|
||||
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;
|
||||
resolvesToSomeValue(location: Node, name: string): boolean;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
@@ -1179,7 +1193,6 @@ declare module "typescript" {
|
||||
interface CompilerOptions {
|
||||
allowNonTsExtensions?: boolean;
|
||||
charset?: string;
|
||||
codepage?: number;
|
||||
declaration?: boolean;
|
||||
diagnostics?: boolean;
|
||||
emitBOM?: boolean;
|
||||
@@ -1193,7 +1206,6 @@ declare module "typescript" {
|
||||
noErrorTruncation?: boolean;
|
||||
noImplicitAny?: boolean;
|
||||
noLib?: boolean;
|
||||
noLibCheck?: boolean;
|
||||
noResolve?: boolean;
|
||||
out?: string;
|
||||
outDir?: string;
|
||||
@@ -1206,6 +1218,7 @@ declare module "typescript" {
|
||||
target?: ScriptTarget;
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
separateCompilation?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
const enum ModuleKind {
|
||||
@@ -1454,6 +1467,20 @@ declare module "typescript" {
|
||||
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;
|
||||
@@ -1947,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;
|
||||
|
||||
+2006
-1647
File diff suppressed because it is too large
Load Diff
Vendored
+86
-58
@@ -196,59 +196,62 @@ declare module ts {
|
||||
TemplateExpression = 171,
|
||||
YieldExpression = 172,
|
||||
SpreadElementExpression = 173,
|
||||
OmittedExpression = 174,
|
||||
TemplateSpan = 175,
|
||||
Block = 176,
|
||||
VariableStatement = 177,
|
||||
EmptyStatement = 178,
|
||||
ExpressionStatement = 179,
|
||||
IfStatement = 180,
|
||||
DoStatement = 181,
|
||||
WhileStatement = 182,
|
||||
ForStatement = 183,
|
||||
ForInStatement = 184,
|
||||
ForOfStatement = 185,
|
||||
ContinueStatement = 186,
|
||||
BreakStatement = 187,
|
||||
ReturnStatement = 188,
|
||||
WithStatement = 189,
|
||||
SwitchStatement = 190,
|
||||
LabeledStatement = 191,
|
||||
ThrowStatement = 192,
|
||||
TryStatement = 193,
|
||||
DebuggerStatement = 194,
|
||||
VariableDeclaration = 195,
|
||||
VariableDeclarationList = 196,
|
||||
FunctionDeclaration = 197,
|
||||
ClassDeclaration = 198,
|
||||
InterfaceDeclaration = 199,
|
||||
TypeAliasDeclaration = 200,
|
||||
EnumDeclaration = 201,
|
||||
ModuleDeclaration = 202,
|
||||
ModuleBlock = 203,
|
||||
CaseBlock = 204,
|
||||
ImportEqualsDeclaration = 205,
|
||||
ImportDeclaration = 206,
|
||||
ImportClause = 207,
|
||||
NamespaceImport = 208,
|
||||
NamedImports = 209,
|
||||
ImportSpecifier = 210,
|
||||
ExportAssignment = 211,
|
||||
ExportDeclaration = 212,
|
||||
NamedExports = 213,
|
||||
ExportSpecifier = 214,
|
||||
MissingDeclaration = 215,
|
||||
ExternalModuleReference = 216,
|
||||
CaseClause = 217,
|
||||
DefaultClause = 218,
|
||||
HeritageClause = 219,
|
||||
CatchClause = 220,
|
||||
PropertyAssignment = 221,
|
||||
ShorthandPropertyAssignment = 222,
|
||||
EnumMember = 223,
|
||||
SourceFile = 224,
|
||||
SyntaxList = 225,
|
||||
Count = 226,
|
||||
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,
|
||||
@@ -432,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;
|
||||
@@ -570,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 {
|
||||
@@ -664,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;
|
||||
}
|
||||
@@ -681,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;
|
||||
@@ -923,7 +937,7 @@ declare 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;
|
||||
getConstantValue(node: EnumMember | PropertyAccessExpression | ElementAccessExpression): number;
|
||||
resolvesToSomeValue(location: Node, name: string): boolean;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
@@ -1179,7 +1193,6 @@ declare module ts {
|
||||
interface CompilerOptions {
|
||||
allowNonTsExtensions?: boolean;
|
||||
charset?: string;
|
||||
codepage?: number;
|
||||
declaration?: boolean;
|
||||
diagnostics?: boolean;
|
||||
emitBOM?: boolean;
|
||||
@@ -1193,7 +1206,6 @@ declare module ts {
|
||||
noErrorTruncation?: boolean;
|
||||
noImplicitAny?: boolean;
|
||||
noLib?: boolean;
|
||||
noLibCheck?: boolean;
|
||||
noResolve?: boolean;
|
||||
out?: string;
|
||||
outDir?: string;
|
||||
@@ -1206,6 +1218,7 @@ declare module ts {
|
||||
target?: ScriptTarget;
|
||||
version?: boolean;
|
||||
watch?: boolean;
|
||||
separateCompilation?: boolean;
|
||||
[option: string]: string | number | boolean;
|
||||
}
|
||||
const enum ModuleKind {
|
||||
@@ -1454,6 +1467,20 @@ declare module ts {
|
||||
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;
|
||||
@@ -1947,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;
|
||||
|
||||
+2006
-1647
File diff suppressed because it is too large
Load Diff
Vendored
+17
-6
@@ -221,9 +221,9 @@ declare module ts {
|
||||
function isClassElement(n: Node): boolean;
|
||||
function isDeclarationName(name: Node): boolean;
|
||||
function isAliasSymbolDeclaration(node: Node): boolean;
|
||||
function getClassBaseTypeNode(node: ClassDeclaration): TypeReferenceNode;
|
||||
function getClassImplementedTypeNodes(node: ClassDeclaration): NodeArray<TypeReferenceNode>;
|
||||
function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray<TypeReferenceNode>;
|
||||
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;
|
||||
@@ -307,7 +307,7 @@ declare module ts {
|
||||
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: ClassDeclaration): ConstructorDeclaration;
|
||||
function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration;
|
||||
function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean;
|
||||
function getAllAccessorDeclarations(declarations: NodeArray<Declaration>, accessor: AccessorDeclaration): {
|
||||
firstAccessor: AccessorDeclaration;
|
||||
@@ -318,11 +318,22 @@ declare module ts {
|
||||
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 {
|
||||
|
||||
Vendored
+17
-6
@@ -221,9 +221,9 @@ declare module "typescript" {
|
||||
function isClassElement(n: Node): boolean;
|
||||
function isDeclarationName(name: Node): boolean;
|
||||
function isAliasSymbolDeclaration(node: Node): boolean;
|
||||
function getClassBaseTypeNode(node: ClassDeclaration): TypeReferenceNode;
|
||||
function getClassImplementedTypeNodes(node: ClassDeclaration): NodeArray<TypeReferenceNode>;
|
||||
function getInterfaceBaseTypeNodes(node: InterfaceDeclaration): NodeArray<TypeReferenceNode>;
|
||||
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;
|
||||
@@ -307,7 +307,7 @@ declare module "typescript" {
|
||||
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: ClassDeclaration): ConstructorDeclaration;
|
||||
function getFirstConstructorWithBody(node: ClassLikeDeclaration): ConstructorDeclaration;
|
||||
function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean;
|
||||
function getAllAccessorDeclarations(declarations: NodeArray<Declaration>, accessor: AccessorDeclaration): {
|
||||
firstAccessor: AccessorDeclaration;
|
||||
@@ -318,11 +318,22 @@ declare module "typescript" {
|
||||
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" {
|
||||
|
||||
+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);
|
||||
}
|
||||
}
|
||||
|
||||
+218
-132
@@ -74,7 +74,7 @@ module ts {
|
||||
isImplementationOfOverload,
|
||||
getAliasedSymbol: resolveAlias,
|
||||
getEmitResolver,
|
||||
getExportsOfExternalModule,
|
||||
getExportsOfModule: getExportsOfModuleAsArray,
|
||||
};
|
||||
|
||||
let unknownSymbol = createSymbol(SymbolFlags.Property | SymbolFlags.Transient, "unknown");
|
||||
@@ -349,6 +349,14 @@ module ts {
|
||||
}
|
||||
result = undefined;
|
||||
}
|
||||
else if (location.kind === SyntaxKind.SourceFile) {
|
||||
result = getSymbol(getSymbolOfNode(location).exports, "default", meaning & SymbolFlags.ModuleMember);
|
||||
let localSymbol = getLocalSymbolForExportDefault(result);
|
||||
if (result && (result.flags & meaning) && localSymbol && localSymbol.name === name) {
|
||||
break loop;
|
||||
}
|
||||
result = undefined;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
if (result = getSymbol(getSymbolOfNode(location).exports, name, meaning & SymbolFlags.EnumMember)) {
|
||||
@@ -422,8 +430,15 @@ module ts {
|
||||
result = argumentsSymbol;
|
||||
break loop;
|
||||
}
|
||||
let id = (<FunctionExpression>location).name;
|
||||
if (id && name === id.text) {
|
||||
let functionName = (<FunctionExpression>location).name;
|
||||
if (functionName && name === functionName.text) {
|
||||
result = location.symbol;
|
||||
break loop;
|
||||
}
|
||||
break;
|
||||
case SyntaxKind.ClassExpression:
|
||||
let className = (<ClassExpression>location).name;
|
||||
if (className && name === className.text) {
|
||||
result = location.symbol;
|
||||
break loop;
|
||||
}
|
||||
@@ -582,7 +597,7 @@ module ts {
|
||||
if (moduleSymbol.flags & SymbolFlags.Variable) {
|
||||
let typeAnnotation = (<VariableDeclaration>moduleSymbol.valueDeclaration).type;
|
||||
if (typeAnnotation) {
|
||||
return getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name);
|
||||
return getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -631,7 +646,7 @@ module ts {
|
||||
if (symbol.flags & SymbolFlags.Variable) {
|
||||
var typeAnnotation = (<VariableDeclaration>symbol.valueDeclaration).type;
|
||||
if (typeAnnotation) {
|
||||
return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name));
|
||||
return resolveSymbol(getPropertyOfType(getTypeFromTypeNodeOrHeritageClauseElement(typeAnnotation), name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -779,8 +794,8 @@ module ts {
|
||||
}
|
||||
|
||||
// Resolves a qualified name and any involved aliases
|
||||
function resolveEntityName(name: EntityName, meaning: SymbolFlags): Symbol {
|
||||
if (getFullWidth(name) === 0) {
|
||||
function resolveEntityName(name: EntityName | Expression, meaning: SymbolFlags): Symbol {
|
||||
if (nodeIsMissing(name)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -791,18 +806,23 @@ module ts {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else if (name.kind === SyntaxKind.QualifiedName) {
|
||||
let namespace = resolveEntityName((<QualifiedName>name).left, SymbolFlags.Namespace);
|
||||
if (!namespace || namespace === unknownSymbol || getFullWidth((<QualifiedName>name).right) === 0) {
|
||||
else if (name.kind === SyntaxKind.QualifiedName || name.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
let left = name.kind === SyntaxKind.QualifiedName ? (<QualifiedName>name).left : (<PropertyAccessExpression>name).expression;
|
||||
let right = name.kind === SyntaxKind.QualifiedName ? (<QualifiedName>name).right : (<PropertyAccessExpression>name).name;
|
||||
|
||||
let namespace = resolveEntityName(left, SymbolFlags.Namespace);
|
||||
if (!namespace || namespace === unknownSymbol || nodeIsMissing(right)) {
|
||||
return undefined;
|
||||
}
|
||||
let right = (<QualifiedName>name).right;
|
||||
symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning);
|
||||
if (!symbol) {
|
||||
error(right, Diagnostics.Module_0_has_no_exported_member_1, getFullyQualifiedName(namespace), declarationNameToString(right));
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Debug.fail("Unknown entity name kind.");
|
||||
}
|
||||
Debug.assert((symbol.flags & SymbolFlags.Instantiated) === 0, "Should never get an instantiated symbol here.");
|
||||
return symbol.flags & meaning ? symbol : resolveAlias(symbol);
|
||||
}
|
||||
@@ -878,6 +898,10 @@ module ts {
|
||||
return moduleSymbol.exports["export="];
|
||||
}
|
||||
|
||||
function getExportsOfModuleAsArray(moduleSymbol: Symbol): Symbol[] {
|
||||
return symbolsToArray(getExportsOfModule(moduleSymbol));
|
||||
}
|
||||
|
||||
function getExportsOfSymbol(symbol: Symbol): SymbolTable {
|
||||
return symbol.flags & SymbolFlags.Module ? getExportsOfModule(symbol) : symbol.exports || emptySymbols;
|
||||
}
|
||||
@@ -1097,7 +1121,7 @@ module ts {
|
||||
|
||||
// Check if symbol is any of the alias
|
||||
return forEachValue(symbols, symbolFromSymbolTable => {
|
||||
if (symbolFromSymbolTable.flags & SymbolFlags.Alias) {
|
||||
if (symbolFromSymbolTable.flags & SymbolFlags.Alias && symbolFromSymbolTable.name !== "export=") {
|
||||
if (!useOnlyExternalAliasing || // We can use any type of alias to get the name
|
||||
// Is this external alias, then use it to name
|
||||
ts.forEach(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) {
|
||||
@@ -1261,14 +1285,14 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult {
|
||||
function isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult {
|
||||
// get symbol of the first identifier of the entityName
|
||||
let meaning: SymbolFlags;
|
||||
if (entityName.parent.kind === SyntaxKind.TypeQuery) {
|
||||
// Typeof value
|
||||
meaning = SymbolFlags.Value | SymbolFlags.ExportValue;
|
||||
}
|
||||
else if (entityName.kind === SyntaxKind.QualifiedName ||
|
||||
else if (entityName.kind === SyntaxKind.QualifiedName || entityName.kind === SyntaxKind.PropertyAccessExpression ||
|
||||
entityName.parent.kind === SyntaxKind.ImportEqualsDeclaration) {
|
||||
// Left identifier from type reference or TypeAlias
|
||||
// Entity name of the import declaration
|
||||
@@ -1938,6 +1962,10 @@ module ts {
|
||||
case SyntaxKind.SourceFile:
|
||||
return true;
|
||||
|
||||
// Export assignements do not create name bindings outside the module
|
||||
case SyntaxKind.ExportAssignment:
|
||||
return false;
|
||||
|
||||
default:
|
||||
Debug.fail("isDeclarationVisible unknown: SyntaxKind: " + node.kind);
|
||||
}
|
||||
@@ -2094,7 +2122,7 @@ module ts {
|
||||
}
|
||||
// Use type from type annotation if one is present
|
||||
if (declaration.type) {
|
||||
return getTypeFromTypeNode(declaration.type);
|
||||
return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type);
|
||||
}
|
||||
if (declaration.kind === SyntaxKind.Parameter) {
|
||||
let func = <FunctionLikeDeclaration>declaration.parent;
|
||||
@@ -2231,7 +2259,7 @@ module ts {
|
||||
return links.type = checkExpression(exportAssignment.expression);
|
||||
}
|
||||
else if (exportAssignment.type) {
|
||||
return links.type = getTypeFromTypeNode(exportAssignment.type);
|
||||
return links.type = getTypeFromTypeNodeOrHeritageClauseElement(exportAssignment.type);
|
||||
}
|
||||
else {
|
||||
return links.type = anyType;
|
||||
@@ -2263,11 +2291,11 @@ module ts {
|
||||
function getAnnotatedAccessorType(accessor: AccessorDeclaration): Type {
|
||||
if (accessor) {
|
||||
if (accessor.kind === SyntaxKind.GetAccessor) {
|
||||
return accessor.type && getTypeFromTypeNode(accessor.type);
|
||||
return accessor.type && getTypeFromTypeNodeOrHeritageClauseElement(accessor.type);
|
||||
}
|
||||
else {
|
||||
let setterTypeAnnotation = getSetAccessorTypeAnnotationNode(accessor);
|
||||
return setterTypeAnnotation && getTypeFromTypeNode(setterTypeAnnotation);
|
||||
return setterTypeAnnotation && getTypeFromTypeNodeOrHeritageClauseElement(setterTypeAnnotation);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
@@ -2433,9 +2461,9 @@ module ts {
|
||||
}
|
||||
type.baseTypes = [];
|
||||
let declaration = <ClassDeclaration>getDeclarationOfKind(symbol, SyntaxKind.ClassDeclaration);
|
||||
let baseTypeNode = getClassBaseTypeNode(declaration);
|
||||
let baseTypeNode = getClassExtendsHeritageClauseElement(declaration);
|
||||
if (baseTypeNode) {
|
||||
let baseType = getTypeFromTypeReferenceNode(baseTypeNode);
|
||||
let baseType = getTypeFromHeritageClauseElement(baseTypeNode);
|
||||
if (baseType !== unknownType) {
|
||||
if (getTargetType(baseType).flags & TypeFlags.Class) {
|
||||
if (type !== baseType && !hasBaseType(<InterfaceType>baseType, type)) {
|
||||
@@ -2476,7 +2504,8 @@ module ts {
|
||||
forEach(symbol.declarations, declaration => {
|
||||
if (declaration.kind === SyntaxKind.InterfaceDeclaration && getInterfaceBaseTypeNodes(<InterfaceDeclaration>declaration)) {
|
||||
forEach(getInterfaceBaseTypeNodes(<InterfaceDeclaration>declaration), node => {
|
||||
let baseType = getTypeFromTypeReferenceNode(node);
|
||||
let baseType = getTypeFromHeritageClauseElement(node);
|
||||
|
||||
if (baseType !== unknownType) {
|
||||
if (getTargetType(baseType).flags & (TypeFlags.Class | TypeFlags.Interface)) {
|
||||
if (type !== baseType && !hasBaseType(<InterfaceType>baseType, type)) {
|
||||
@@ -2507,7 +2536,7 @@ module ts {
|
||||
if (!links.declaredType) {
|
||||
links.declaredType = resolvingType;
|
||||
let declaration = <TypeAliasDeclaration>getDeclarationOfKind(symbol, SyntaxKind.TypeAliasDeclaration);
|
||||
let type = getTypeFromTypeNode(declaration.type);
|
||||
let type = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type);
|
||||
if (links.declaredType === resolvingType) {
|
||||
links.declaredType = type;
|
||||
}
|
||||
@@ -3007,17 +3036,6 @@ module ts {
|
||||
return result;
|
||||
}
|
||||
|
||||
function getExportsOfExternalModule(node: ImportDeclaration): Symbol[] {
|
||||
if (!node.moduleSpecifier) {
|
||||
return emptyArray;
|
||||
}
|
||||
let module = resolveExternalModuleName(node, node.moduleSpecifier);
|
||||
if (!module) {
|
||||
return emptyArray;
|
||||
}
|
||||
return symbolsToArray(getExportsOfModule(module));
|
||||
}
|
||||
|
||||
function getSignatureFromDeclaration(declaration: SignatureDeclaration): Signature {
|
||||
let links = getNodeLinks(declaration);
|
||||
if (!links.resolvedSignature) {
|
||||
@@ -3049,7 +3067,7 @@ module ts {
|
||||
returnType = classType;
|
||||
}
|
||||
else if (declaration.type) {
|
||||
returnType = getTypeFromTypeNode(declaration.type);
|
||||
returnType = getTypeFromTypeNodeOrHeritageClauseElement(declaration.type);
|
||||
}
|
||||
else {
|
||||
// TypeScript 1.0 spec (April 2014):
|
||||
@@ -3207,7 +3225,7 @@ module ts {
|
||||
function getIndexTypeOfSymbol(symbol: Symbol, kind: IndexKind): Type {
|
||||
let declaration = getIndexDeclarationOfSymbol(symbol, kind);
|
||||
return declaration
|
||||
? declaration.type ? getTypeFromTypeNode(declaration.type) : anyType
|
||||
? declaration.type ? getTypeFromTypeNodeOrHeritageClauseElement(declaration.type) : anyType
|
||||
: undefined;
|
||||
}
|
||||
|
||||
@@ -3218,7 +3236,7 @@ module ts {
|
||||
type.constraint = targetConstraint ? instantiateType(targetConstraint, type.mapper) : noConstraintType;
|
||||
}
|
||||
else {
|
||||
type.constraint = getTypeFromTypeNode((<TypeParameterDeclaration>getDeclarationOfKind(type.symbol, SyntaxKind.TypeParameter)).constraint);
|
||||
type.constraint = getTypeFromTypeNodeOrHeritageClauseElement((<TypeParameterDeclaration>getDeclarationOfKind(type.symbol, SyntaxKind.TypeParameter)).constraint);
|
||||
}
|
||||
}
|
||||
return type.constraint === noConstraintType ? undefined : type.constraint;
|
||||
@@ -3266,7 +3284,7 @@ module ts {
|
||||
return type;
|
||||
}
|
||||
|
||||
function isTypeParameterReferenceIllegalInConstraint(typeReferenceNode: TypeReferenceNode, typeParameterSymbol: Symbol): boolean {
|
||||
function isTypeParameterReferenceIllegalInConstraint(typeReferenceNode: TypeReferenceNode | HeritageClauseElement, typeParameterSymbol: Symbol): boolean {
|
||||
let links = getNodeLinks(typeReferenceNode);
|
||||
if (links.isIllegalTypeReferenceInConstraint !== undefined) {
|
||||
return links.isIllegalTypeReferenceInConstraint;
|
||||
@@ -3315,39 +3333,57 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function getTypeFromTypeReferenceNode(node: TypeReferenceNode): Type {
|
||||
function getTypeFromTypeReference(node: TypeReferenceNode): Type {
|
||||
return getTypeFromTypeReferenceOrHeritageClauseElement(node);
|
||||
}
|
||||
|
||||
function getTypeFromHeritageClauseElement(node: HeritageClauseElement): Type {
|
||||
return getTypeFromTypeReferenceOrHeritageClauseElement(node);
|
||||
}
|
||||
|
||||
function getTypeFromTypeReferenceOrHeritageClauseElement(node: TypeReferenceNode | HeritageClauseElement): Type {
|
||||
let links = getNodeLinks(node);
|
||||
if (!links.resolvedType) {
|
||||
let symbol = resolveEntityName(node.typeName, SymbolFlags.Type);
|
||||
let type: Type;
|
||||
if (symbol) {
|
||||
if ((symbol.flags & SymbolFlags.TypeParameter) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) {
|
||||
// TypeScript 1.0 spec (April 2014): 3.4.1
|
||||
// Type parameters declared in a particular type parameter list
|
||||
// may not be referenced in constraints in that type parameter list
|
||||
// Implementation: such type references are resolved to 'unknown' type that usually denotes error
|
||||
type = unknownType;
|
||||
}
|
||||
else {
|
||||
type = getDeclaredTypeOfSymbol(symbol);
|
||||
if (type.flags & (TypeFlags.Class | TypeFlags.Interface) && type.flags & TypeFlags.Reference) {
|
||||
let typeParameters = (<InterfaceType>type).typeParameters;
|
||||
if (node.typeArguments && node.typeArguments.length === typeParameters.length) {
|
||||
type = createTypeReference(<GenericType>type, map(node.typeArguments, getTypeFromTypeNode));
|
||||
}
|
||||
else {
|
||||
error(node, Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.WriteArrayAsGenericType), typeParameters.length);
|
||||
type = undefined;
|
||||
}
|
||||
|
||||
// We don't currently support heritage clauses with complex expressions in them.
|
||||
// For these cases, we just set the type to be the unknownType.
|
||||
if (node.kind !== SyntaxKind.HeritageClauseElement || isSupportedHeritageClauseElement(<HeritageClauseElement>node)) {
|
||||
let typeNameOrExpression = node.kind === SyntaxKind.TypeReference
|
||||
? (<TypeReferenceNode>node).typeName
|
||||
: (<HeritageClauseElement>node).expression;
|
||||
|
||||
let symbol = resolveEntityName(typeNameOrExpression, SymbolFlags.Type);
|
||||
if (symbol) {
|
||||
if ((symbol.flags & SymbolFlags.TypeParameter) && isTypeParameterReferenceIllegalInConstraint(node, symbol)) {
|
||||
// TypeScript 1.0 spec (April 2014): 3.4.1
|
||||
// Type parameters declared in a particular type parameter list
|
||||
// may not be referenced in constraints in that type parameter list
|
||||
// Implementation: such type references are resolved to 'unknown' type that usually denotes error
|
||||
type = unknownType;
|
||||
}
|
||||
else {
|
||||
if (node.typeArguments) {
|
||||
error(node, Diagnostics.Type_0_is_not_generic, typeToString(type));
|
||||
type = undefined;
|
||||
type = getDeclaredTypeOfSymbol(symbol);
|
||||
if (type.flags & (TypeFlags.Class | TypeFlags.Interface) && type.flags & TypeFlags.Reference) {
|
||||
let typeParameters = (<InterfaceType>type).typeParameters;
|
||||
if (node.typeArguments && node.typeArguments.length === typeParameters.length) {
|
||||
type = createTypeReference(<GenericType>type, map(node.typeArguments, getTypeFromTypeNodeOrHeritageClauseElement));
|
||||
}
|
||||
else {
|
||||
error(node, Diagnostics.Generic_type_0_requires_1_type_argument_s, typeToString(type, /*enclosingDeclaration*/ undefined, TypeFormatFlags.WriteArrayAsGenericType), typeParameters.length);
|
||||
type = undefined;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (node.typeArguments) {
|
||||
error(node, Diagnostics.Type_0_is_not_generic, typeToString(type));
|
||||
type = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
links.resolvedType = type || unknownType;
|
||||
}
|
||||
return links.resolvedType;
|
||||
@@ -3425,7 +3461,7 @@ module ts {
|
||||
function getTypeFromArrayTypeNode(node: ArrayTypeNode): Type {
|
||||
let links = getNodeLinks(node);
|
||||
if (!links.resolvedType) {
|
||||
links.resolvedType = createArrayType(getTypeFromTypeNode(node.elementType));
|
||||
links.resolvedType = createArrayType(getTypeFromTypeNodeOrHeritageClauseElement(node.elementType));
|
||||
}
|
||||
return links.resolvedType;
|
||||
}
|
||||
@@ -3443,7 +3479,7 @@ module ts {
|
||||
function getTypeFromTupleTypeNode(node: TupleTypeNode): Type {
|
||||
let links = getNodeLinks(node);
|
||||
if (!links.resolvedType) {
|
||||
links.resolvedType = createTupleType(map(node.elementTypes, getTypeFromTypeNode));
|
||||
links.resolvedType = createTupleType(map(node.elementTypes, getTypeFromTypeNodeOrHeritageClauseElement));
|
||||
}
|
||||
return links.resolvedType;
|
||||
}
|
||||
@@ -3539,7 +3575,7 @@ module ts {
|
||||
function getTypeFromUnionTypeNode(node: UnionTypeNode): Type {
|
||||
let links = getNodeLinks(node);
|
||||
if (!links.resolvedType) {
|
||||
links.resolvedType = getUnionType(map(node.types, getTypeFromTypeNode), /*noSubtypeReduction*/ true);
|
||||
links.resolvedType = getUnionType(map(node.types, getTypeFromTypeNodeOrHeritageClauseElement), /*noSubtypeReduction*/ true);
|
||||
}
|
||||
return links.resolvedType;
|
||||
}
|
||||
@@ -3571,7 +3607,7 @@ module ts {
|
||||
return links.resolvedType;
|
||||
}
|
||||
|
||||
function getTypeFromTypeNode(node: TypeNode | LiteralExpression): Type {
|
||||
function getTypeFromTypeNodeOrHeritageClauseElement(node: TypeNode | LiteralExpression | HeritageClauseElement): Type {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.AnyKeyword:
|
||||
return anyType;
|
||||
@@ -3588,7 +3624,9 @@ module ts {
|
||||
case SyntaxKind.StringLiteral:
|
||||
return getTypeFromStringLiteral(<LiteralExpression>node);
|
||||
case SyntaxKind.TypeReference:
|
||||
return getTypeFromTypeReferenceNode(<TypeReferenceNode>node);
|
||||
return getTypeFromTypeReference(<TypeReferenceNode>node);
|
||||
case SyntaxKind.HeritageClauseElement:
|
||||
return getTypeFromHeritageClauseElement(<HeritageClauseElement>node);
|
||||
case SyntaxKind.TypeQuery:
|
||||
return getTypeFromTypeQueryNode(<TypeQueryNode>node);
|
||||
case SyntaxKind.ArrayType:
|
||||
@@ -3598,7 +3636,7 @@ module ts {
|
||||
case SyntaxKind.UnionType:
|
||||
return getTypeFromUnionTypeNode(<UnionTypeNode>node);
|
||||
case SyntaxKind.ParenthesizedType:
|
||||
return getTypeFromTypeNode((<ParenthesizedTypeNode>node).type);
|
||||
return getTypeFromTypeNodeOrHeritageClauseElement((<ParenthesizedTypeNode>node).type);
|
||||
case SyntaxKind.FunctionType:
|
||||
case SyntaxKind.ConstructorType:
|
||||
case SyntaxKind.TypeLiteral:
|
||||
@@ -4961,7 +4999,7 @@ module ts {
|
||||
function getResolvedSymbol(node: Identifier): Symbol {
|
||||
let links = getNodeLinks(node);
|
||||
if (!links.resolvedSymbol) {
|
||||
links.resolvedSymbol = (getFullWidth(node) > 0 && resolveName(node, node.text, SymbolFlags.Value | SymbolFlags.ExportValue, Diagnostics.Cannot_find_name_0, node)) || unknownSymbol;
|
||||
links.resolvedSymbol = (!nodeIsMissing(node) && resolveName(node, node.text, SymbolFlags.Value | SymbolFlags.ExportValue, Diagnostics.Cannot_find_name_0, node)) || unknownSymbol;
|
||||
}
|
||||
return links.resolvedSymbol;
|
||||
}
|
||||
@@ -5467,7 +5505,7 @@ module ts {
|
||||
let isCallExpression = node.parent.kind === SyntaxKind.CallExpression && (<CallExpression>node.parent).expression === node;
|
||||
let enclosingClass = <ClassDeclaration>getAncestor(node, SyntaxKind.ClassDeclaration);
|
||||
let baseClass: Type;
|
||||
if (enclosingClass && getClassBaseTypeNode(enclosingClass)) {
|
||||
if (enclosingClass && getClassExtendsHeritageClauseElement(enclosingClass)) {
|
||||
let classType = <InterfaceType>getDeclaredTypeOfSymbol(getSymbolOfNode(enclosingClass));
|
||||
baseClass = classType.baseTypes.length && classType.baseTypes[0];
|
||||
}
|
||||
@@ -5599,7 +5637,7 @@ module ts {
|
||||
let declaration = <VariableLikeDeclaration>node.parent;
|
||||
if (node === declaration.initializer) {
|
||||
if (declaration.type) {
|
||||
return getTypeFromTypeNode(declaration.type);
|
||||
return getTypeFromTypeNodeOrHeritageClauseElement(declaration.type);
|
||||
}
|
||||
if (declaration.kind === SyntaxKind.Parameter) {
|
||||
let type = getContextuallyTypedParameterType(<ParameterDeclaration>declaration);
|
||||
@@ -5802,7 +5840,7 @@ module ts {
|
||||
case SyntaxKind.NewExpression:
|
||||
return getContextualTypeForArgument(<CallExpression>parent, node);
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
return getTypeFromTypeNode((<TypeAssertion>parent).type);
|
||||
return getTypeFromTypeNodeOrHeritageClauseElement((<TypeAssertion>parent).type);
|
||||
case SyntaxKind.BinaryExpression:
|
||||
return getContextualTypeForBinaryOperand(node);
|
||||
case SyntaxKind.PropertyAssignment:
|
||||
@@ -6459,7 +6497,7 @@ module ts {
|
||||
let templateExpression = <TemplateExpression>tagExpression.template;
|
||||
let lastSpan = lastOrUndefined(templateExpression.templateSpans);
|
||||
Debug.assert(lastSpan !== undefined); // we should always have at least one span.
|
||||
callIsIncomplete = getFullWidth(lastSpan.literal) === 0 || !!lastSpan.literal.isUnterminated;
|
||||
callIsIncomplete = nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated;
|
||||
}
|
||||
else {
|
||||
// If the template didn't end in a backtick, or its beginning occurred right prior to EOF,
|
||||
@@ -6603,7 +6641,7 @@ module ts {
|
||||
let typeArgumentsAreAssignable = true;
|
||||
for (let i = 0; i < typeParameters.length; i++) {
|
||||
let typeArgNode = typeArguments[i];
|
||||
let typeArgument = getTypeFromTypeNode(typeArgNode);
|
||||
let typeArgument = getTypeFromTypeNodeOrHeritageClauseElement(typeArgNode);
|
||||
// Do not push on this array! It has a preallocated length
|
||||
typeArgumentResultTypes[i] = typeArgument;
|
||||
if (typeArgumentsAreAssignable /* so far */) {
|
||||
@@ -6677,7 +6715,7 @@ module ts {
|
||||
function getEffectiveTypeArguments(callExpression: CallExpression): TypeNode[] {
|
||||
if (callExpression.expression.kind === SyntaxKind.SuperKeyword) {
|
||||
let containingClass = <ClassDeclaration>getAncestor(callExpression, SyntaxKind.ClassDeclaration);
|
||||
let baseClassTypeNode = containingClass && getClassBaseTypeNode(containingClass);
|
||||
let baseClassTypeNode = containingClass && getClassExtendsHeritageClauseElement(containingClass);
|
||||
return baseClassTypeNode && baseClassTypeNode.typeArguments;
|
||||
}
|
||||
else {
|
||||
@@ -7085,7 +7123,7 @@ module ts {
|
||||
|
||||
function checkTypeAssertion(node: TypeAssertion): Type {
|
||||
let exprType = checkExpression(node.expression);
|
||||
let targetType = getTypeFromTypeNode(node.type);
|
||||
let targetType = getTypeFromTypeNodeOrHeritageClauseElement(node.type);
|
||||
if (produceDiagnostics && targetType !== unknownType) {
|
||||
let widenedType = getWidenedType(exprType);
|
||||
if (!(isTypeAssignableTo(targetType, widenedType))) {
|
||||
@@ -7264,7 +7302,7 @@ module ts {
|
||||
function checkFunctionExpressionOrObjectLiteralMethodBody(node: FunctionExpression | MethodDeclaration) {
|
||||
Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node));
|
||||
if (node.type) {
|
||||
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type));
|
||||
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type));
|
||||
}
|
||||
|
||||
if (node.body) {
|
||||
@@ -7274,7 +7312,7 @@ module ts {
|
||||
else {
|
||||
let exprType = checkExpression(<Expression>node.body);
|
||||
if (node.type) {
|
||||
checkTypeAssignableTo(exprType, getTypeFromTypeNode(node.type), node.body, /*headMessage*/ undefined);
|
||||
checkTypeAssignableTo(exprType, getTypeFromTypeNodeOrHeritageClauseElement(node.type), node.body, /*headMessage*/ undefined);
|
||||
}
|
||||
checkFunctionExpressionBodies(node.body);
|
||||
}
|
||||
@@ -7354,23 +7392,6 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function isImportedNameFromExternalModule(n: Node): boolean {
|
||||
switch (n.kind) {
|
||||
case SyntaxKind.ElementAccessExpression:
|
||||
case SyntaxKind.PropertyAccessExpression: {
|
||||
// all bindings for external module should be immutable
|
||||
// so attempt to use a.b or a[b] as lhs will always fail
|
||||
// no matter what b is
|
||||
let symbol = findSymbol((<PropertyAccessExpression | ElementAccessExpression>n).expression);
|
||||
return symbol && symbol.flags & SymbolFlags.Alias && isExternalModuleSymbol(resolveAlias(symbol));
|
||||
}
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return isImportedNameFromExternalModule((<ParenthesizedExpression>n).expression);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isReferenceOrErrorExpression(n)) {
|
||||
error(n, invalidReferenceMessage);
|
||||
return false;
|
||||
@@ -7381,10 +7402,6 @@ module ts {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isImportedNameFromExternalModule(n)) {
|
||||
error(n, invalidReferenceMessage);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -7980,6 +7997,8 @@ module ts {
|
||||
return checkTypeAssertion(<TypeAssertion>node);
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
return checkExpression((<ParenthesizedExpression>node).expression, contextualMapper);
|
||||
case SyntaxKind.ClassExpression:
|
||||
return checkClassExpression(<ClassExpression>node);
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
return checkFunctionExpressionOrObjectLiteralMethod(<FunctionExpression>node, contextualMapper);
|
||||
@@ -8207,7 +8226,7 @@ module ts {
|
||||
// TS 1.0 spec (April 2014): 8.3.2
|
||||
// Constructors of classes with no extends clause may not contain super calls, whereas
|
||||
// constructors of derived classes must contain at least one super call somewhere in their function body.
|
||||
if (getClassBaseTypeNode(<ClassDeclaration>node.parent)) {
|
||||
if (getClassExtendsHeritageClauseElement(<ClassDeclaration>node.parent)) {
|
||||
|
||||
if (containsSuperCall(node.body)) {
|
||||
// The first statement in the body of a constructor must be a super call if both of the following are true:
|
||||
@@ -8278,11 +8297,19 @@ module ts {
|
||||
checkDecorators(node);
|
||||
}
|
||||
|
||||
function checkTypeReference(node: TypeReferenceNode) {
|
||||
function checkTypeReferenceNode(node: TypeReferenceNode) {
|
||||
return checkTypeReferenceOrHeritageClauseElement(node);
|
||||
}
|
||||
|
||||
function checkHeritageClauseElement(node: HeritageClauseElement) {
|
||||
return checkTypeReferenceOrHeritageClauseElement(node);
|
||||
}
|
||||
|
||||
function checkTypeReferenceOrHeritageClauseElement(node: TypeReferenceNode | HeritageClauseElement) {
|
||||
// Grammar checking
|
||||
checkGrammarTypeArguments(node, node.typeArguments);
|
||||
|
||||
let type = getTypeFromTypeReferenceNode(node);
|
||||
let type = getTypeFromTypeReferenceOrHeritageClauseElement(node);
|
||||
if (type !== unknownType && node.typeArguments) {
|
||||
// Do type argument local checks only if referenced type is successfully resolved
|
||||
let len = node.typeArguments.length;
|
||||
@@ -8450,7 +8477,7 @@ module ts {
|
||||
let isConstructor = (symbol.flags & SymbolFlags.Constructor) !== 0;
|
||||
|
||||
function reportImplementationExpectedError(node: FunctionLikeDeclaration): void {
|
||||
if (node.name && getFullWidth(node.name) === 0) {
|
||||
if (node.name && nodeIsMissing(node.name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -8773,7 +8800,7 @@ module ts {
|
||||
|
||||
checkSourceElement(node.body);
|
||||
if (node.type && !isAccessor(node.kind)) {
|
||||
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNode(node.type));
|
||||
checkIfNonVoidFunctionHasReturnExpressionsOrSingleThrowStatment(node, getTypeFromTypeNodeOrHeritageClauseElement(node.type));
|
||||
}
|
||||
|
||||
// Report an implicit any error if there is no body, no explicit return type, and node is not a private method
|
||||
@@ -8873,7 +8900,7 @@ module ts {
|
||||
return;
|
||||
}
|
||||
|
||||
if (getClassBaseTypeNode(enclosingClass)) {
|
||||
if (getClassExtendsHeritageClauseElement(enclosingClass)) {
|
||||
let isDeclaration = node.kind !== SyntaxKind.Identifier;
|
||||
if (isDeclaration) {
|
||||
error(node, Diagnostics.Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference);
|
||||
@@ -9721,8 +9748,22 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function checkClassExpression(node: ClassExpression): Type {
|
||||
grammarErrorOnNode(node, Diagnostics.class_expressions_are_not_currently_supported);
|
||||
forEach(node.members, checkSourceElement);
|
||||
return unknownType;
|
||||
}
|
||||
|
||||
function checkClassDeclaration(node: ClassDeclaration) {
|
||||
// Grammar checking
|
||||
if (node.parent.kind !== SyntaxKind.ModuleBlock && node.parent.kind !== SyntaxKind.SourceFile) {
|
||||
grammarErrorOnNode(node, Diagnostics.class_declarations_are_only_supported_directly_inside_a_module_or_as_a_top_level_declaration);
|
||||
}
|
||||
|
||||
if (!node.name && !(node.flags & NodeFlags.Default)) {
|
||||
grammarErrorOnFirstToken(node, Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name);
|
||||
}
|
||||
|
||||
checkGrammarClassDeclarationHeritageClauses(node);
|
||||
checkDecorators(node);
|
||||
if (node.name) {
|
||||
@@ -9735,10 +9776,14 @@ module ts {
|
||||
let symbol = getSymbolOfNode(node);
|
||||
let type = <InterfaceType>getDeclaredTypeOfSymbol(symbol);
|
||||
let staticType = <ObjectType>getTypeOfSymbol(symbol);
|
||||
let baseTypeNode = getClassBaseTypeNode(node);
|
||||
let baseTypeNode = getClassExtendsHeritageClauseElement(node);
|
||||
if (baseTypeNode) {
|
||||
if (!isSupportedHeritageClauseElement(baseTypeNode)) {
|
||||
error(baseTypeNode.expression, Diagnostics.Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses);
|
||||
}
|
||||
|
||||
emitExtends = emitExtends || !isInAmbientContext(node);
|
||||
checkTypeReference(baseTypeNode);
|
||||
checkHeritageClauseElement(baseTypeNode);
|
||||
}
|
||||
if (type.baseTypes.length) {
|
||||
if (produceDiagnostics) {
|
||||
@@ -9747,7 +9792,8 @@ module ts {
|
||||
let staticBaseType = getTypeOfSymbol(baseType.symbol);
|
||||
checkTypeAssignableTo(staticType, getTypeWithoutConstructors(staticBaseType), node.name || node,
|
||||
Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1);
|
||||
if (baseType.symbol !== resolveEntityName(baseTypeNode.typeName, SymbolFlags.Value)) {
|
||||
|
||||
if (baseType.symbol !== resolveEntityName(baseTypeNode.expression, SymbolFlags.Value)) {
|
||||
error(baseTypeNode, Diagnostics.Type_name_0_in_extends_clause_does_not_reference_constructor_function_for_0, typeToString(baseType));
|
||||
}
|
||||
|
||||
@@ -9757,15 +9803,19 @@ module ts {
|
||||
|
||||
if (type.baseTypes.length || (baseTypeNode && compilerOptions.separateCompilation)) {
|
||||
// Check that base type can be evaluated as expression
|
||||
checkExpressionOrQualifiedName(baseTypeNode.typeName);
|
||||
checkExpressionOrQualifiedName(baseTypeNode.expression);
|
||||
}
|
||||
|
||||
let implementedTypeNodes = getClassImplementedTypeNodes(node);
|
||||
let implementedTypeNodes = getClassImplementsHeritageClauseElements(node);
|
||||
if (implementedTypeNodes) {
|
||||
forEach(implementedTypeNodes, typeRefNode => {
|
||||
checkTypeReference(typeRefNode);
|
||||
if (!isSupportedHeritageClauseElement(typeRefNode)) {
|
||||
error(typeRefNode.expression, Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments);
|
||||
}
|
||||
|
||||
checkHeritageClauseElement(typeRefNode);
|
||||
if (produceDiagnostics) {
|
||||
let t = getTypeFromTypeReferenceNode(typeRefNode);
|
||||
let t = getTypeFromHeritageClauseElement(typeRefNode);
|
||||
if (t !== unknownType) {
|
||||
let declaredType = (t.flags & TypeFlags.Reference) ? (<TypeReference>t).target : t;
|
||||
if (declaredType.flags & (TypeFlags.Class | TypeFlags.Interface)) {
|
||||
@@ -9887,7 +9937,7 @@ module ts {
|
||||
if (!tp1.constraint || !tp2.constraint) {
|
||||
return false;
|
||||
}
|
||||
if (!isTypeIdenticalTo(getTypeFromTypeNode(tp1.constraint), getTypeFromTypeNode(tp2.constraint))) {
|
||||
if (!isTypeIdenticalTo(getTypeFromTypeNodeOrHeritageClauseElement(tp1.constraint), getTypeFromTypeNodeOrHeritageClauseElement(tp2.constraint))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -9958,7 +10008,13 @@ module ts {
|
||||
}
|
||||
}
|
||||
}
|
||||
forEach(getInterfaceBaseTypeNodes(node), checkTypeReference);
|
||||
forEach(getInterfaceBaseTypeNodes(node), heritageElement => {
|
||||
if (!isSupportedHeritageClauseElement(heritageElement)) {
|
||||
error(heritageElement.expression, Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments);
|
||||
}
|
||||
|
||||
checkHeritageClauseElement(heritageElement);
|
||||
});
|
||||
forEach(node.members, checkSourceElement);
|
||||
|
||||
if (produceDiagnostics) {
|
||||
@@ -10260,16 +10316,25 @@ module ts {
|
||||
checkSourceElement(node.body);
|
||||
}
|
||||
|
||||
function getFirstIdentifier(node: EntityName): Identifier {
|
||||
while (node.kind === SyntaxKind.QualifiedName) {
|
||||
node = (<QualifiedName>node).left;
|
||||
function getFirstIdentifier(node: EntityName | Expression): Identifier {
|
||||
while (true) {
|
||||
if (node.kind === SyntaxKind.QualifiedName) {
|
||||
node = (<QualifiedName>node).left;
|
||||
}
|
||||
else if (node.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
node = (<PropertyAccessExpression>node).expression;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
Debug.assert(node.kind === SyntaxKind.Identifier);
|
||||
return <Identifier>node;
|
||||
}
|
||||
|
||||
function checkExternalImportOrExportDeclaration(node: ImportDeclaration | ImportEqualsDeclaration | ExportDeclaration): boolean {
|
||||
let moduleName = getExternalModuleName(node);
|
||||
if (getFullWidth(moduleName) !== 0 && moduleName.kind !== SyntaxKind.StringLiteral) {
|
||||
if (!nodeIsMissing(moduleName) && moduleName.kind !== SyntaxKind.StringLiteral) {
|
||||
error(moduleName, Diagnostics.String_literal_expected);
|
||||
return false;
|
||||
}
|
||||
@@ -10490,7 +10555,7 @@ module ts {
|
||||
case SyntaxKind.SetAccessor:
|
||||
return checkAccessorDeclaration(<AccessorDeclaration>node);
|
||||
case SyntaxKind.TypeReference:
|
||||
return checkTypeReference(<TypeReferenceNode>node);
|
||||
return checkTypeReferenceNode(<TypeReferenceNode>node);
|
||||
case SyntaxKind.TypeQuery:
|
||||
return checkTypeQuery(<TypeQueryNode>node);
|
||||
case SyntaxKind.TypeLiteral:
|
||||
@@ -10866,11 +10931,23 @@ module ts {
|
||||
// True if the given identifier is part of a type reference
|
||||
function isTypeReferenceIdentifier(entityName: EntityName): boolean {
|
||||
let node: Node = entityName;
|
||||
while (node.parent && node.parent.kind === SyntaxKind.QualifiedName) node = node.parent;
|
||||
while (node.parent && node.parent.kind === SyntaxKind.QualifiedName) {
|
||||
node = node.parent;
|
||||
}
|
||||
|
||||
return node.parent && node.parent.kind === SyntaxKind.TypeReference;
|
||||
}
|
||||
|
||||
function isTypeNode(node: Node): boolean {
|
||||
function isHeritageClauseElementIdentifier(entityName: Node): boolean {
|
||||
let node = entityName;
|
||||
while (node.parent && node.parent.kind === SyntaxKind.PropertyAccessExpression) {
|
||||
node = node.parent;
|
||||
}
|
||||
|
||||
return node.parent && node.parent.kind === SyntaxKind.HeritageClauseElement;
|
||||
}
|
||||
|
||||
function isTypeNodeOrHeritageClauseElement(node: Node): boolean {
|
||||
if (SyntaxKind.FirstTypeNode <= node.kind && node.kind <= SyntaxKind.LastTypeNode) {
|
||||
return true;
|
||||
}
|
||||
@@ -10887,6 +10964,8 @@ module ts {
|
||||
case SyntaxKind.StringLiteral:
|
||||
// Specialized signatures can have string literals as their parameters' type names
|
||||
return node.parent.kind === SyntaxKind.Parameter;
|
||||
case SyntaxKind.HeritageClauseElement:
|
||||
return true;
|
||||
|
||||
// Identifiers and qualified names may be type nodes, depending on their context. Climb
|
||||
// above them to find the lowest container
|
||||
@@ -10895,10 +10974,15 @@ module ts {
|
||||
if (node.parent.kind === SyntaxKind.QualifiedName && (<QualifiedName>node.parent).right === node) {
|
||||
node = node.parent;
|
||||
}
|
||||
else if (node.parent.kind === SyntaxKind.PropertyAccessExpression && (<PropertyAccessExpression>node.parent).name === node) {
|
||||
node = node.parent;
|
||||
}
|
||||
// fall through
|
||||
case SyntaxKind.QualifiedName:
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
// At this point, node is either a qualified name or an identifier
|
||||
Debug.assert(node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName, "'node' was expected to be a qualified name or identifier in 'isTypeNode'.");
|
||||
Debug.assert(node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName || node.kind === SyntaxKind.PropertyAccessExpression,
|
||||
"'node' was expected to be a qualified name, identifier or property access in 'isTypeNode'.");
|
||||
|
||||
let parent = node.parent;
|
||||
if (parent.kind === SyntaxKind.TypeQuery) {
|
||||
@@ -10914,6 +10998,8 @@ module ts {
|
||||
return true;
|
||||
}
|
||||
switch (parent.kind) {
|
||||
case SyntaxKind.HeritageClauseElement:
|
||||
return true;
|
||||
case SyntaxKind.TypeParameter:
|
||||
return node === (<TypeParameterDeclaration>parent).constraint;
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
@@ -10968,11 +11054,6 @@ module ts {
|
||||
return getLeftSideOfImportEqualsOrExportAssignment(node) !== undefined;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
function getSymbolOfEntityNameOrPropertyAccessExpression(entityName: EntityName | PropertyAccessExpression): Symbol {
|
||||
if (isDeclarationName(entityName)) {
|
||||
return getSymbolOfNode(entityName.parent);
|
||||
@@ -10994,8 +11075,13 @@ module ts {
|
||||
entityName = <QualifiedName | PropertyAccessExpression>entityName.parent;
|
||||
}
|
||||
|
||||
if (isExpression(entityName)) {
|
||||
if (getFullWidth(entityName) === 0) {
|
||||
if (isHeritageClauseElementIdentifier(<EntityName>entityName)) {
|
||||
let meaning = entityName.parent.kind === SyntaxKind.HeritageClauseElement ? SymbolFlags.Type : SymbolFlags.Namespace;
|
||||
meaning |= SymbolFlags.Alias;
|
||||
return resolveEntityName(<EntityName>entityName, meaning);
|
||||
}
|
||||
else if (isExpression(entityName)) {
|
||||
if (nodeIsMissing(entityName)) {
|
||||
// Missing entity name.
|
||||
return undefined;
|
||||
}
|
||||
@@ -11110,12 +11196,12 @@ module ts {
|
||||
return unknownType;
|
||||
}
|
||||
|
||||
if (isExpression(node)) {
|
||||
return getTypeOfExpression(<Expression>node);
|
||||
if (isTypeNodeOrHeritageClauseElement(node)) {
|
||||
return getTypeFromTypeNodeOrHeritageClauseElement(<TypeNode | HeritageClauseElement>node);
|
||||
}
|
||||
|
||||
if (isTypeNode(node)) {
|
||||
return getTypeFromTypeNode(<TypeNode>node);
|
||||
if (isExpression(node)) {
|
||||
return getTypeOfExpression(<Expression>node);
|
||||
}
|
||||
|
||||
if (isTypeDeclaration(node)) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
/// <reference path="scanner.ts"/>
|
||||
|
||||
module ts {
|
||||
/* @internal */
|
||||
export var optionDeclarations: CommandLineOption[] = [
|
||||
{
|
||||
name: "charset",
|
||||
@@ -157,7 +158,8 @@ module ts {
|
||||
description: Diagnostics.Watch_input_files,
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
/* @internal */
|
||||
export function parseCommandLine(commandLine: string[]): ParsedCommandLine {
|
||||
var options: CompilerOptions = {};
|
||||
var fileNames: string[] = [];
|
||||
@@ -267,6 +269,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);
|
||||
@@ -276,6 +282,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();
|
||||
|
||||
@@ -167,6 +167,7 @@ module ts {
|
||||
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." },
|
||||
A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1210, category: DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" },
|
||||
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." },
|
||||
@@ -353,6 +354,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}'." },
|
||||
@@ -503,7 +506,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." },
|
||||
};
|
||||
}
|
||||
@@ -659,6 +659,10 @@
|
||||
"category": "Error",
|
||||
"code": 1209
|
||||
},
|
||||
"A class declaration without the 'default' modifier must have a name": {
|
||||
"category": "Error",
|
||||
"code": 1210
|
||||
},
|
||||
"Duplicate identifier '{0}'.": {
|
||||
"category": "Error",
|
||||
"code": 2300
|
||||
@@ -1403,6 +1407,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",
|
||||
@@ -2005,6 +2017,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
|
||||
@@ -2012,5 +2089,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
|
||||
}
|
||||
}
|
||||
|
||||
+125
-93
@@ -262,6 +262,7 @@ module ts {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ClassExpression:
|
||||
generateNameForFunctionOrClassDeclaration(<Declaration>node);
|
||||
break;
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
@@ -3198,7 +3199,7 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitMemberAssignments(node: ClassDeclaration, staticFlag: NodeFlags) {
|
||||
function emitMemberAssignments(node: ClassLikeDeclaration, staticFlag: NodeFlags) {
|
||||
forEach(node.members, member => {
|
||||
if (member.kind === SyntaxKind.PropertyDeclaration && (member.flags & NodeFlags.Static) === staticFlag && (<PropertyDeclaration>member).initializer) {
|
||||
writeLine();
|
||||
@@ -3222,9 +3223,13 @@ module ts {
|
||||
});
|
||||
}
|
||||
|
||||
function emitMemberFunctionsForES5AndLower(node: ClassDeclaration) {
|
||||
function emitMemberFunctionsForES5AndLower(node: ClassLikeDeclaration) {
|
||||
forEach(node.members, member => {
|
||||
if (member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) {
|
||||
if (member.kind === SyntaxKind.SemicolonClassElement) {
|
||||
writeLine();
|
||||
write(";");
|
||||
}
|
||||
else if (member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) {
|
||||
if (!(<MethodDeclaration>member).body) {
|
||||
return emitOnlyPinnedOrTripleSlashComments(member);
|
||||
}
|
||||
@@ -3292,12 +3297,14 @@ module ts {
|
||||
});
|
||||
}
|
||||
|
||||
function emitMemberFunctionsForES6AndHigher(node: ClassDeclaration) {
|
||||
function emitMemberFunctionsForES6AndHigher(node: ClassLikeDeclaration) {
|
||||
for (let member of node.members) {
|
||||
if ((member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature) && !(<MethodDeclaration>member).body) {
|
||||
emitOnlyPinnedOrTripleSlashComments(member);
|
||||
}
|
||||
else if (member.kind === SyntaxKind.MethodDeclaration || node.kind === SyntaxKind.MethodSignature || member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) {
|
||||
else if (member.kind === SyntaxKind.MethodDeclaration ||
|
||||
member.kind === SyntaxKind.GetAccessor ||
|
||||
member.kind === SyntaxKind.SetAccessor) {
|
||||
writeLine();
|
||||
emitLeadingComments(member);
|
||||
emitStart(member);
|
||||
@@ -3316,10 +3323,14 @@ module ts {
|
||||
emitEnd(member);
|
||||
emitTrailingComments(member);
|
||||
}
|
||||
else if (member.kind === SyntaxKind.SemicolonClassElement) {
|
||||
writeLine();
|
||||
write(";");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function emitConstructor(node: ClassDeclaration, baseTypeNode: TypeReferenceNode) {
|
||||
function emitConstructor(node: ClassLikeDeclaration, baseTypeElement: HeritageClauseElement) {
|
||||
let saveTempFlags = tempFlags;
|
||||
let saveTempVariables = tempVariables;
|
||||
let saveTempParameters = tempParameters;
|
||||
@@ -3373,7 +3384,7 @@ module ts {
|
||||
// Let constructor be the result of parsing the String "constructor(... args){ super (...args);}" using the syntactic grammar with the goal symbol MethodDefinition.
|
||||
// Else,
|
||||
// Let constructor be the result of parsing the String "constructor( ){ }" using the syntactic grammar with the goal symbol MethodDefinition
|
||||
if (baseTypeNode) {
|
||||
if (baseTypeElement) {
|
||||
write("(...args)");
|
||||
}
|
||||
else {
|
||||
@@ -3392,7 +3403,7 @@ module ts {
|
||||
if (ctor) {
|
||||
emitDefaultValueAssignments(ctor);
|
||||
emitRestParameter(ctor);
|
||||
if (baseTypeNode) {
|
||||
if (baseTypeElement) {
|
||||
var superCall = findInitialSuperCall(ctor);
|
||||
if (superCall) {
|
||||
writeLine();
|
||||
@@ -3402,16 +3413,16 @@ module ts {
|
||||
emitParameterPropertyAssignments(ctor);
|
||||
}
|
||||
else {
|
||||
if (baseTypeNode) {
|
||||
if (baseTypeElement) {
|
||||
writeLine();
|
||||
emitStart(baseTypeNode);
|
||||
emitStart(baseTypeElement);
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
write("_super.apply(this, arguments);");
|
||||
}
|
||||
else {
|
||||
write("super(...args);");
|
||||
}
|
||||
emitEnd(baseTypeNode);
|
||||
emitEnd(baseTypeElement);
|
||||
}
|
||||
}
|
||||
emitMemberAssignments(node, /*staticFlag*/0);
|
||||
@@ -3440,82 +3451,92 @@ module ts {
|
||||
tempParameters = saveTempParameters;
|
||||
}
|
||||
|
||||
function emitClassExpression(node: ClassExpression) {
|
||||
return emitClassLikeDeclaration(node);
|
||||
}
|
||||
|
||||
function emitClassDeclaration(node: ClassDeclaration) {
|
||||
return emitClassLikeDeclaration(node);
|
||||
}
|
||||
|
||||
function emitClassLikeDeclaration(node: ClassLikeDeclaration) {
|
||||
if (languageVersion < ScriptTarget.ES6) {
|
||||
emitClassDeclarationBelowES6(<ClassDeclaration>node);
|
||||
emitClassLikeDeclarationBelowES6(node);
|
||||
}
|
||||
else {
|
||||
emitClassDeclarationForES6AndHigher(<ClassDeclaration>node);
|
||||
emitClassLikeDeclarationForES6AndHigher(node);
|
||||
}
|
||||
}
|
||||
|
||||
function emitClassDeclarationForES6AndHigher(node: ClassDeclaration) {
|
||||
function emitClassLikeDeclarationForES6AndHigher(node: ClassLikeDeclaration) {
|
||||
let thisNodeIsDecorated = nodeIsDecorated(node);
|
||||
if (thisNodeIsDecorated) {
|
||||
// To preserve the correct runtime semantics when decorators are applied to the class,
|
||||
// the emit needs to follow one of the following rules:
|
||||
//
|
||||
// * For a local class declaration:
|
||||
//
|
||||
// @dec class C {
|
||||
// }
|
||||
//
|
||||
// The emit should be:
|
||||
//
|
||||
// let C = class {
|
||||
// };
|
||||
// Object.defineProperty(C, "name", { value: "C", configurable: true });
|
||||
// C = __decorate([dec], C);
|
||||
//
|
||||
// * For an exported class declaration:
|
||||
//
|
||||
// @dec export class C {
|
||||
// }
|
||||
//
|
||||
// The emit should be:
|
||||
//
|
||||
// export let C = class {
|
||||
// };
|
||||
// Object.defineProperty(C, "name", { value: "C", configurable: true });
|
||||
// C = __decorate([dec], C);
|
||||
//
|
||||
// * For a default export of a class declaration with a name:
|
||||
//
|
||||
// @dec default export class C {
|
||||
// }
|
||||
//
|
||||
// The emit should be:
|
||||
//
|
||||
// let C = class {
|
||||
// }
|
||||
// Object.defineProperty(C, "name", { value: "C", configurable: true });
|
||||
// C = __decorate([dec], C);
|
||||
// export default C;
|
||||
//
|
||||
// * For a default export of a class declaration without a name:
|
||||
//
|
||||
// @dec default export class {
|
||||
// }
|
||||
//
|
||||
// The emit should be:
|
||||
//
|
||||
// let _default = class {
|
||||
// }
|
||||
// _default = __decorate([dec], _default);
|
||||
// export default _default;
|
||||
//
|
||||
if (isES6ExportedDeclaration(node) && !(node.flags & NodeFlags.Default)) {
|
||||
write("export ");
|
||||
}
|
||||
if (node.kind === SyntaxKind.ClassDeclaration) {
|
||||
if (thisNodeIsDecorated) {
|
||||
// To preserve the correct runtime semantics when decorators are applied to the class,
|
||||
// the emit needs to follow one of the following rules:
|
||||
//
|
||||
// * For a local class declaration:
|
||||
//
|
||||
// @dec class C {
|
||||
// }
|
||||
//
|
||||
// The emit should be:
|
||||
//
|
||||
// let C = class {
|
||||
// };
|
||||
// Object.defineProperty(C, "name", { value: "C", configurable: true });
|
||||
// C = __decorate([dec], C);
|
||||
//
|
||||
// * For an exported class declaration:
|
||||
//
|
||||
// @dec export class C {
|
||||
// }
|
||||
//
|
||||
// The emit should be:
|
||||
//
|
||||
// export let C = class {
|
||||
// };
|
||||
// Object.defineProperty(C, "name", { value: "C", configurable: true });
|
||||
// C = __decorate([dec], C);
|
||||
//
|
||||
// * For a default export of a class declaration with a name:
|
||||
//
|
||||
// @dec default export class C {
|
||||
// }
|
||||
//
|
||||
// The emit should be:
|
||||
//
|
||||
// let C = class {
|
||||
// }
|
||||
// Object.defineProperty(C, "name", { value: "C", configurable: true });
|
||||
// C = __decorate([dec], C);
|
||||
// export default C;
|
||||
//
|
||||
// * For a default export of a class declaration without a name:
|
||||
//
|
||||
// @dec default export class {
|
||||
// }
|
||||
//
|
||||
// The emit should be:
|
||||
//
|
||||
// let _default = class {
|
||||
// }
|
||||
// _default = __decorate([dec], _default);
|
||||
// export default _default;
|
||||
//
|
||||
if (isES6ExportedDeclaration(node) && !(node.flags & NodeFlags.Default)) {
|
||||
write("export ");
|
||||
}
|
||||
|
||||
write("let ");
|
||||
emitDeclarationName(node);
|
||||
write(" = ");
|
||||
}
|
||||
else if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
if (node.flags & NodeFlags.Default) {
|
||||
write("default ");
|
||||
write("let ");
|
||||
emitDeclarationName(node);
|
||||
write(" = ");
|
||||
}
|
||||
else if (isES6ExportedDeclaration(node)) {
|
||||
write("export ");
|
||||
if (node.flags & NodeFlags.Default) {
|
||||
write("default ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3527,10 +3548,10 @@ module ts {
|
||||
emitDeclarationName(node);
|
||||
}
|
||||
|
||||
var baseTypeNode = getClassBaseTypeNode(node);
|
||||
var baseTypeNode = getClassExtendsHeritageClauseElement(node);
|
||||
if (baseTypeNode) {
|
||||
write(" extends ");
|
||||
emit(baseTypeNode.typeName);
|
||||
emit(baseTypeNode.expression);
|
||||
}
|
||||
|
||||
write(" {");
|
||||
@@ -3593,11 +3614,15 @@ module ts {
|
||||
}
|
||||
}
|
||||
|
||||
function emitClassDeclarationBelowES6(node: ClassDeclaration) {
|
||||
write("var ");
|
||||
emitDeclarationName(node);
|
||||
write(" = (function (");
|
||||
let baseTypeNode = getClassBaseTypeNode(node);
|
||||
function emitClassLikeDeclarationBelowES6(node: ClassLikeDeclaration) {
|
||||
if (node.kind === SyntaxKind.ClassDeclaration) {
|
||||
write("var ");
|
||||
emitDeclarationName(node);
|
||||
write(" = ");
|
||||
}
|
||||
|
||||
write("(function (");
|
||||
let baseTypeNode = getClassExtendsHeritageClauseElement(node);
|
||||
if (baseTypeNode) {
|
||||
write("_super");
|
||||
}
|
||||
@@ -3644,32 +3669,37 @@ module ts {
|
||||
emitStart(node);
|
||||
write(")(");
|
||||
if (baseTypeNode) {
|
||||
emit(baseTypeNode.typeName);
|
||||
emit(baseTypeNode.expression);
|
||||
}
|
||||
write(")");
|
||||
if (node.kind === SyntaxKind.ClassDeclaration) {
|
||||
write(";");
|
||||
}
|
||||
write(");");
|
||||
emitEnd(node);
|
||||
|
||||
emitExportMemberAssignment(node);
|
||||
if (node.kind === SyntaxKind.ClassDeclaration) {
|
||||
emitExportMemberAssignment(<ClassDeclaration>node);
|
||||
}
|
||||
|
||||
if (languageVersion < ScriptTarget.ES6 && node.parent === currentSourceFile && node.name) {
|
||||
emitExportMemberAssignments(node.name);
|
||||
}
|
||||
}
|
||||
|
||||
function emitClassMemberPrefix(node: ClassDeclaration, member: Node) {
|
||||
function emitClassMemberPrefix(node: ClassLikeDeclaration, member: Node) {
|
||||
emitDeclarationName(node);
|
||||
if (!(member.flags & NodeFlags.Static)) {
|
||||
write(".prototype");
|
||||
}
|
||||
}
|
||||
|
||||
function emitDecoratorsOfClass(node: ClassDeclaration) {
|
||||
function emitDecoratorsOfClass(node: ClassLikeDeclaration) {
|
||||
emitDecoratorsOfMembers(node, /*staticFlag*/ 0);
|
||||
emitDecoratorsOfMembers(node, NodeFlags.Static);
|
||||
emitDecoratorsOfConstructor(node);
|
||||
}
|
||||
|
||||
function emitDecoratorsOfConstructor(node: ClassDeclaration) {
|
||||
function emitDecoratorsOfConstructor(node: ClassLikeDeclaration) {
|
||||
let constructor = getFirstConstructorWithBody(node);
|
||||
if (constructor) {
|
||||
emitDecoratorsOfParameters(node, constructor);
|
||||
@@ -3701,7 +3731,7 @@ module ts {
|
||||
writeLine();
|
||||
}
|
||||
|
||||
function emitDecoratorsOfMembers(node: ClassDeclaration, staticFlag: NodeFlags) {
|
||||
function emitDecoratorsOfMembers(node: ClassLikeDeclaration, staticFlag: NodeFlags) {
|
||||
forEach(node.members, member => {
|
||||
if ((member.flags & NodeFlags.Static) !== staticFlag) {
|
||||
return;
|
||||
@@ -3805,7 +3835,7 @@ module ts {
|
||||
});
|
||||
}
|
||||
|
||||
function emitDecoratorsOfParameters(node: ClassDeclaration, member: FunctionLikeDeclaration) {
|
||||
function emitDecoratorsOfParameters(node: ClassLikeDeclaration, member: FunctionLikeDeclaration) {
|
||||
forEach(member.parameters, (parameter, parameterIndex) => {
|
||||
if (!nodeIsDecorated(parameter)) {
|
||||
return;
|
||||
@@ -4773,6 +4803,8 @@ var __decorate = this.__decorate || function (decorators, target, key, value) {
|
||||
return emitDebuggerStatement(node);
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
return emitVariableDeclaration(<VariableDeclaration>node);
|
||||
case SyntaxKind.ClassExpression:
|
||||
return emitClassExpression(<ClassExpression>node);
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
return emitClassDeclaration(<ClassDeclaration>node);
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
|
||||
+151
-44
@@ -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,30 @@ 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);
|
||||
}
|
||||
|
||||
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 +4810,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 +5369,7 @@ module ts {
|
||||
case SyntaxKind.ArrayLiteralExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.ObjectLiteralExpression:
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.Identifier:
|
||||
case SyntaxKind.RegularExpressionLiteral:
|
||||
|
||||
+24
-5
@@ -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;
|
||||
}
|
||||
@@ -1128,7 +1147,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[];
|
||||
@@ -1232,7 +1251,7 @@ 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;
|
||||
|
||||
+38
-10
@@ -145,7 +145,7 @@ module ts {
|
||||
|
||||
return node.pos === node.end && node.kind !== SyntaxKind.EndOfFileToken;
|
||||
}
|
||||
|
||||
|
||||
export function nodeIsPresent(node: Node) {
|
||||
return !nodeIsMissing(node);
|
||||
}
|
||||
@@ -286,6 +286,7 @@ module ts {
|
||||
case SyntaxKind.VariableDeclaration:
|
||||
case SyntaxKind.BindingElement:
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.InterfaceDeclaration:
|
||||
case SyntaxKind.ModuleDeclaration:
|
||||
case SyntaxKind.EnumDeclaration:
|
||||
@@ -295,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.
|
||||
@@ -641,7 +642,7 @@ module ts {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
export function childIsDecorated(node: Node): boolean {
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.ClassDeclaration:
|
||||
@@ -677,6 +678,7 @@ module ts {
|
||||
case SyntaxKind.TypeAssertionExpression:
|
||||
case SyntaxKind.ParenthesizedExpression:
|
||||
case SyntaxKind.FunctionExpression:
|
||||
case SyntaxKind.ClassExpression:
|
||||
case SyntaxKind.ArrowFunction:
|
||||
case SyntaxKind.VoidExpression:
|
||||
case SyntaxKind.DeleteExpression:
|
||||
@@ -752,7 +754,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) {
|
||||
@@ -949,12 +951,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;
|
||||
}
|
||||
@@ -1168,7 +1170,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);
|
||||
}
|
||||
@@ -1442,13 +1444,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.
|
||||
@@ -1580,7 +1582,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;
|
||||
@@ -1775,4 +1777,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);
|
||||
|
||||
@@ -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:
|
||||
@@ -56,6 +55,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
|
||||
|
||||
@@ -1466,6 +1466,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
+18
-1
@@ -617,12 +617,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).
|
||||
*/
|
||||
|
||||
@@ -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 {
|
||||
|
||||
+456
-172
@@ -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";
|
||||
@@ -2161,7 +2168,8 @@ module ts {
|
||||
keywordCompletions.push({
|
||||
name: tokenToString(i),
|
||||
kind: ScriptElementKind.keyword,
|
||||
kindModifiers: ScriptElementKindModifier.none
|
||||
kindModifiers: ScriptElementKindModifier.none,
|
||||
sortText: "0"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2425,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.
|
||||
|
||||
@@ -2447,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.
|
||||
@@ -2497,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",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2553,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) {
|
||||
@@ -2572,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;
|
||||
|
||||
@@ -2590,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);
|
||||
}
|
||||
@@ -2608,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
|
||||
@@ -2617,7 +2831,7 @@ module ts {
|
||||
|
||||
let contextualType = typeInfoResolver.getContextualType(containingObjectLiteral);
|
||||
if (!contextualType) {
|
||||
return undefined;
|
||||
return false;
|
||||
}
|
||||
|
||||
let contextualTypeMembers = typeInfoResolver.getPropertiesOfType(contextualType);
|
||||
@@ -2634,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 {
|
||||
@@ -2675,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.
|
||||
@@ -2987,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) {
|
||||
@@ -3007,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;
|
||||
}
|
||||
@@ -3040,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);
|
||||
@@ -4948,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);
|
||||
@@ -4958,7 +5217,7 @@ module ts {
|
||||
}
|
||||
return;
|
||||
|
||||
function getPropertySymbolFromTypeReference(typeReference: TypeReferenceNode) {
|
||||
function getPropertySymbolFromTypeReference(typeReference: HeritageClauseElement) {
|
||||
if (typeReference) {
|
||||
let type = typeInfoResolver.getTypeAtLocation(typeReference);
|
||||
if (type) {
|
||||
@@ -5215,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 {
|
||||
|
||||
@@ -233,59 +233,62 @@ declare module "typescript" {
|
||||
TemplateExpression = 171,
|
||||
YieldExpression = 172,
|
||||
SpreadElementExpression = 173,
|
||||
OmittedExpression = 174,
|
||||
TemplateSpan = 175,
|
||||
Block = 176,
|
||||
VariableStatement = 177,
|
||||
EmptyStatement = 178,
|
||||
ExpressionStatement = 179,
|
||||
IfStatement = 180,
|
||||
DoStatement = 181,
|
||||
WhileStatement = 182,
|
||||
ForStatement = 183,
|
||||
ForInStatement = 184,
|
||||
ForOfStatement = 185,
|
||||
ContinueStatement = 186,
|
||||
BreakStatement = 187,
|
||||
ReturnStatement = 188,
|
||||
WithStatement = 189,
|
||||
SwitchStatement = 190,
|
||||
LabeledStatement = 191,
|
||||
ThrowStatement = 192,
|
||||
TryStatement = 193,
|
||||
DebuggerStatement = 194,
|
||||
VariableDeclaration = 195,
|
||||
VariableDeclarationList = 196,
|
||||
FunctionDeclaration = 197,
|
||||
ClassDeclaration = 198,
|
||||
InterfaceDeclaration = 199,
|
||||
TypeAliasDeclaration = 200,
|
||||
EnumDeclaration = 201,
|
||||
ModuleDeclaration = 202,
|
||||
ModuleBlock = 203,
|
||||
CaseBlock = 204,
|
||||
ImportEqualsDeclaration = 205,
|
||||
ImportDeclaration = 206,
|
||||
ImportClause = 207,
|
||||
NamespaceImport = 208,
|
||||
NamedImports = 209,
|
||||
ImportSpecifier = 210,
|
||||
ExportAssignment = 211,
|
||||
ExportDeclaration = 212,
|
||||
NamedExports = 213,
|
||||
ExportSpecifier = 214,
|
||||
MissingDeclaration = 215,
|
||||
ExternalModuleReference = 216,
|
||||
CaseClause = 217,
|
||||
DefaultClause = 218,
|
||||
HeritageClause = 219,
|
||||
CatchClause = 220,
|
||||
PropertyAssignment = 221,
|
||||
ShorthandPropertyAssignment = 222,
|
||||
EnumMember = 223,
|
||||
SourceFile = 224,
|
||||
SyntaxList = 225,
|
||||
Count = 226,
|
||||
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,
|
||||
@@ -469,6 +472,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;
|
||||
@@ -607,6 +613,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 {
|
||||
@@ -701,12 +711,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;
|
||||
}
|
||||
@@ -718,7 +732,7 @@ declare module "typescript" {
|
||||
}
|
||||
interface HeritageClause extends Node {
|
||||
token: SyntaxKind;
|
||||
types?: NodeArray<TypeReferenceNode>;
|
||||
types?: NodeArray<HeritageClauseElement>;
|
||||
}
|
||||
interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
name: Identifier;
|
||||
@@ -746,7 +760,7 @@ declare module "typescript" {
|
||||
interface ExternalModuleReference extends Node {
|
||||
expression?: Expression;
|
||||
}
|
||||
interface ImportDeclaration extends Statement, ModuleElement {
|
||||
interface ImportDeclaration extends ModuleElement {
|
||||
importClause?: ImportClause;
|
||||
moduleSpecifier: Expression;
|
||||
}
|
||||
@@ -888,7 +902,7 @@ declare module "typescript" {
|
||||
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[];
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
@@ -960,7 +974,7 @@ declare module "typescript" {
|
||||
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;
|
||||
resolvesToSomeValue(location: Node, name: string): boolean;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
@@ -1490,6 +1504,20 @@ declare module "typescript" {
|
||||
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;
|
||||
@@ -1774,6 +1802,7 @@ declare module "typescript" {
|
||||
name: string;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
sortText: string;
|
||||
}
|
||||
interface CompletionEntryDetails {
|
||||
name: string;
|
||||
@@ -1916,6 +1945,7 @@ declare module "typescript" {
|
||||
}
|
||||
class ScriptElementKind {
|
||||
static unknown: string;
|
||||
static warning: string;
|
||||
static keyword: string;
|
||||
static scriptElement: string;
|
||||
static moduleElement: string;
|
||||
|
||||
@@ -717,163 +717,172 @@ declare module "typescript" {
|
||||
SpreadElementExpression = 173,
|
||||
>SpreadElementExpression : SyntaxKind
|
||||
|
||||
OmittedExpression = 174,
|
||||
ClassExpression = 174,
|
||||
>ClassExpression : SyntaxKind
|
||||
|
||||
OmittedExpression = 175,
|
||||
>OmittedExpression : SyntaxKind
|
||||
|
||||
TemplateSpan = 175,
|
||||
TemplateSpan = 176,
|
||||
>TemplateSpan : SyntaxKind
|
||||
|
||||
Block = 176,
|
||||
HeritageClauseElement = 177,
|
||||
>HeritageClauseElement : SyntaxKind
|
||||
|
||||
SemicolonClassElement = 178,
|
||||
>SemicolonClassElement : SyntaxKind
|
||||
|
||||
Block = 179,
|
||||
>Block : SyntaxKind
|
||||
|
||||
VariableStatement = 177,
|
||||
VariableStatement = 180,
|
||||
>VariableStatement : SyntaxKind
|
||||
|
||||
EmptyStatement = 178,
|
||||
EmptyStatement = 181,
|
||||
>EmptyStatement : SyntaxKind
|
||||
|
||||
ExpressionStatement = 179,
|
||||
ExpressionStatement = 182,
|
||||
>ExpressionStatement : SyntaxKind
|
||||
|
||||
IfStatement = 180,
|
||||
IfStatement = 183,
|
||||
>IfStatement : SyntaxKind
|
||||
|
||||
DoStatement = 181,
|
||||
DoStatement = 184,
|
||||
>DoStatement : SyntaxKind
|
||||
|
||||
WhileStatement = 182,
|
||||
WhileStatement = 185,
|
||||
>WhileStatement : SyntaxKind
|
||||
|
||||
ForStatement = 183,
|
||||
ForStatement = 186,
|
||||
>ForStatement : SyntaxKind
|
||||
|
||||
ForInStatement = 184,
|
||||
ForInStatement = 187,
|
||||
>ForInStatement : SyntaxKind
|
||||
|
||||
ForOfStatement = 185,
|
||||
ForOfStatement = 188,
|
||||
>ForOfStatement : SyntaxKind
|
||||
|
||||
ContinueStatement = 186,
|
||||
ContinueStatement = 189,
|
||||
>ContinueStatement : SyntaxKind
|
||||
|
||||
BreakStatement = 187,
|
||||
BreakStatement = 190,
|
||||
>BreakStatement : SyntaxKind
|
||||
|
||||
ReturnStatement = 188,
|
||||
ReturnStatement = 191,
|
||||
>ReturnStatement : SyntaxKind
|
||||
|
||||
WithStatement = 189,
|
||||
WithStatement = 192,
|
||||
>WithStatement : SyntaxKind
|
||||
|
||||
SwitchStatement = 190,
|
||||
SwitchStatement = 193,
|
||||
>SwitchStatement : SyntaxKind
|
||||
|
||||
LabeledStatement = 191,
|
||||
LabeledStatement = 194,
|
||||
>LabeledStatement : SyntaxKind
|
||||
|
||||
ThrowStatement = 192,
|
||||
ThrowStatement = 195,
|
||||
>ThrowStatement : SyntaxKind
|
||||
|
||||
TryStatement = 193,
|
||||
TryStatement = 196,
|
||||
>TryStatement : SyntaxKind
|
||||
|
||||
DebuggerStatement = 194,
|
||||
DebuggerStatement = 197,
|
||||
>DebuggerStatement : SyntaxKind
|
||||
|
||||
VariableDeclaration = 195,
|
||||
VariableDeclaration = 198,
|
||||
>VariableDeclaration : SyntaxKind
|
||||
|
||||
VariableDeclarationList = 196,
|
||||
VariableDeclarationList = 199,
|
||||
>VariableDeclarationList : SyntaxKind
|
||||
|
||||
FunctionDeclaration = 197,
|
||||
FunctionDeclaration = 200,
|
||||
>FunctionDeclaration : SyntaxKind
|
||||
|
||||
ClassDeclaration = 198,
|
||||
ClassDeclaration = 201,
|
||||
>ClassDeclaration : SyntaxKind
|
||||
|
||||
InterfaceDeclaration = 199,
|
||||
InterfaceDeclaration = 202,
|
||||
>InterfaceDeclaration : SyntaxKind
|
||||
|
||||
TypeAliasDeclaration = 200,
|
||||
TypeAliasDeclaration = 203,
|
||||
>TypeAliasDeclaration : SyntaxKind
|
||||
|
||||
EnumDeclaration = 201,
|
||||
EnumDeclaration = 204,
|
||||
>EnumDeclaration : SyntaxKind
|
||||
|
||||
ModuleDeclaration = 202,
|
||||
ModuleDeclaration = 205,
|
||||
>ModuleDeclaration : SyntaxKind
|
||||
|
||||
ModuleBlock = 203,
|
||||
ModuleBlock = 206,
|
||||
>ModuleBlock : SyntaxKind
|
||||
|
||||
CaseBlock = 204,
|
||||
CaseBlock = 207,
|
||||
>CaseBlock : SyntaxKind
|
||||
|
||||
ImportEqualsDeclaration = 205,
|
||||
ImportEqualsDeclaration = 208,
|
||||
>ImportEqualsDeclaration : SyntaxKind
|
||||
|
||||
ImportDeclaration = 206,
|
||||
ImportDeclaration = 209,
|
||||
>ImportDeclaration : SyntaxKind
|
||||
|
||||
ImportClause = 207,
|
||||
ImportClause = 210,
|
||||
>ImportClause : SyntaxKind
|
||||
|
||||
NamespaceImport = 208,
|
||||
NamespaceImport = 211,
|
||||
>NamespaceImport : SyntaxKind
|
||||
|
||||
NamedImports = 209,
|
||||
NamedImports = 212,
|
||||
>NamedImports : SyntaxKind
|
||||
|
||||
ImportSpecifier = 210,
|
||||
ImportSpecifier = 213,
|
||||
>ImportSpecifier : SyntaxKind
|
||||
|
||||
ExportAssignment = 211,
|
||||
ExportAssignment = 214,
|
||||
>ExportAssignment : SyntaxKind
|
||||
|
||||
ExportDeclaration = 212,
|
||||
ExportDeclaration = 215,
|
||||
>ExportDeclaration : SyntaxKind
|
||||
|
||||
NamedExports = 213,
|
||||
NamedExports = 216,
|
||||
>NamedExports : SyntaxKind
|
||||
|
||||
ExportSpecifier = 214,
|
||||
ExportSpecifier = 217,
|
||||
>ExportSpecifier : SyntaxKind
|
||||
|
||||
MissingDeclaration = 215,
|
||||
MissingDeclaration = 218,
|
||||
>MissingDeclaration : SyntaxKind
|
||||
|
||||
ExternalModuleReference = 216,
|
||||
ExternalModuleReference = 219,
|
||||
>ExternalModuleReference : SyntaxKind
|
||||
|
||||
CaseClause = 217,
|
||||
CaseClause = 220,
|
||||
>CaseClause : SyntaxKind
|
||||
|
||||
DefaultClause = 218,
|
||||
DefaultClause = 221,
|
||||
>DefaultClause : SyntaxKind
|
||||
|
||||
HeritageClause = 219,
|
||||
HeritageClause = 222,
|
||||
>HeritageClause : SyntaxKind
|
||||
|
||||
CatchClause = 220,
|
||||
CatchClause = 223,
|
||||
>CatchClause : SyntaxKind
|
||||
|
||||
PropertyAssignment = 221,
|
||||
PropertyAssignment = 224,
|
||||
>PropertyAssignment : SyntaxKind
|
||||
|
||||
ShorthandPropertyAssignment = 222,
|
||||
ShorthandPropertyAssignment = 225,
|
||||
>ShorthandPropertyAssignment : SyntaxKind
|
||||
|
||||
EnumMember = 223,
|
||||
EnumMember = 226,
|
||||
>EnumMember : SyntaxKind
|
||||
|
||||
SourceFile = 224,
|
||||
SourceFile = 227,
|
||||
>SourceFile : SyntaxKind
|
||||
|
||||
SyntaxList = 225,
|
||||
SyntaxList = 228,
|
||||
>SyntaxList : SyntaxKind
|
||||
|
||||
Count = 226,
|
||||
Count = 229,
|
||||
>Count : SyntaxKind
|
||||
|
||||
FirstAssignment = 53,
|
||||
@@ -1430,6 +1439,13 @@ declare module "typescript" {
|
||||
body?: Block;
|
||||
>body : Block
|
||||
>Block : Block
|
||||
}
|
||||
interface SemicolonClassElement extends ClassElement {
|
||||
>SemicolonClassElement : SemicolonClassElement
|
||||
>ClassElement : ClassElement
|
||||
|
||||
_semicolonClassElementBrand: any;
|
||||
>_semicolonClassElementBrand : any
|
||||
}
|
||||
interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
|
||||
>AccessorDeclaration : AccessorDeclaration
|
||||
@@ -1831,6 +1847,19 @@ declare module "typescript" {
|
||||
>arguments : NodeArray<Expression>
|
||||
>NodeArray : NodeArray<T>
|
||||
>Expression : Expression
|
||||
}
|
||||
interface HeritageClauseElement extends Node {
|
||||
>HeritageClauseElement : HeritageClauseElement
|
||||
>Node : Node
|
||||
|
||||
expression: LeftHandSideExpression;
|
||||
>expression : LeftHandSideExpression
|
||||
>LeftHandSideExpression : LeftHandSideExpression
|
||||
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
>typeArguments : NodeArray<TypeNode>
|
||||
>NodeArray : NodeArray<T>
|
||||
>TypeNode : TypeNode
|
||||
}
|
||||
interface NewExpression extends CallExpression, PrimaryExpression {
|
||||
>NewExpression : NewExpression
|
||||
@@ -2115,10 +2144,9 @@ declare module "typescript" {
|
||||
_moduleElementBrand: any;
|
||||
>_moduleElementBrand : any
|
||||
}
|
||||
interface ClassDeclaration extends Declaration, ModuleElement {
|
||||
>ClassDeclaration : ClassDeclaration
|
||||
interface ClassLikeDeclaration extends Declaration {
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>Declaration : Declaration
|
||||
>ModuleElement : ModuleElement
|
||||
|
||||
name?: Identifier;
|
||||
>name : Identifier
|
||||
@@ -2138,6 +2166,16 @@ declare module "typescript" {
|
||||
>members : NodeArray<ClassElement>
|
||||
>NodeArray : NodeArray<T>
|
||||
>ClassElement : ClassElement
|
||||
}
|
||||
interface ClassDeclaration extends ClassLikeDeclaration, Statement {
|
||||
>ClassDeclaration : ClassDeclaration
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>Statement : Statement
|
||||
}
|
||||
interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
|
||||
>ClassExpression : ClassExpression
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>PrimaryExpression : PrimaryExpression
|
||||
}
|
||||
interface ClassElement extends Declaration {
|
||||
>ClassElement : ClassElement
|
||||
@@ -2178,10 +2216,10 @@ declare module "typescript" {
|
||||
>token : SyntaxKind
|
||||
>SyntaxKind : SyntaxKind
|
||||
|
||||
types?: NodeArray<TypeReferenceNode>;
|
||||
>types : NodeArray<TypeReferenceNode>
|
||||
types?: NodeArray<HeritageClauseElement>;
|
||||
>types : NodeArray<HeritageClauseElement>
|
||||
>NodeArray : NodeArray<T>
|
||||
>TypeReferenceNode : TypeReferenceNode
|
||||
>HeritageClauseElement : HeritageClauseElement
|
||||
}
|
||||
interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
>TypeAliasDeclaration : TypeAliasDeclaration
|
||||
@@ -2269,9 +2307,8 @@ declare module "typescript" {
|
||||
>expression : Expression
|
||||
>Expression : Expression
|
||||
}
|
||||
interface ImportDeclaration extends Statement, ModuleElement {
|
||||
interface ImportDeclaration extends ModuleElement {
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
>Statement : Statement
|
||||
>ModuleElement : ModuleElement
|
||||
|
||||
importClause?: ImportClause;
|
||||
@@ -2780,10 +2817,10 @@ declare module "typescript" {
|
||||
>Symbol : Symbol
|
||||
>Symbol : Symbol
|
||||
|
||||
getExportsOfExternalModule(node: ImportDeclaration): Symbol[];
|
||||
>getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[]
|
||||
>node : ImportDeclaration
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
getExportsOfModule(moduleSymbol: Symbol): Symbol[];
|
||||
>getExportsOfModule : (moduleSymbol: Symbol) => Symbol[]
|
||||
>moduleSymbol : Symbol
|
||||
>Symbol : Symbol
|
||||
>Symbol : Symbol
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
@@ -3125,10 +3162,11 @@ declare module "typescript" {
|
||||
>SymbolFlags : SymbolFlags
|
||||
>SymbolAccessiblityResult : SymbolAccessiblityResult
|
||||
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
>isEntityNameVisible : (entityName: Identifier | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult
|
||||
>entityName : Identifier | QualifiedName
|
||||
isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
>isEntityNameVisible : (entityName: Identifier | Expression | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult
|
||||
>entityName : Identifier | Expression | QualifiedName
|
||||
>EntityName : Identifier | QualifiedName
|
||||
>Expression : Expression
|
||||
>enclosingDeclaration : Node
|
||||
>Node : Node
|
||||
>SymbolVisibilityResult : SymbolVisibilityResult
|
||||
@@ -4799,6 +4837,27 @@ declare module "typescript" {
|
||||
>CompilerHost : CompilerHost
|
||||
>Program : Program
|
||||
}
|
||||
declare module "typescript" {
|
||||
/**
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
*/
|
||||
function readConfigFile(fileName: string): any;
|
||||
>readConfigFile : (fileName: string) => any
|
||||
>fileName : string
|
||||
|
||||
/**
|
||||
* 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;
|
||||
>parseConfigFile : (json: any, basePath?: string) => ParsedCommandLine
|
||||
>json : any
|
||||
>basePath : string
|
||||
>ParsedCommandLine : ParsedCommandLine
|
||||
}
|
||||
declare module "typescript" {
|
||||
/** The version of the language service API */
|
||||
let servicesVersion: string;
|
||||
@@ -5698,6 +5757,9 @@ declare module "typescript" {
|
||||
|
||||
kindModifiers: string;
|
||||
>kindModifiers : string
|
||||
|
||||
sortText: string;
|
||||
>sortText : string
|
||||
}
|
||||
interface CompletionEntryDetails {
|
||||
>CompletionEntryDetails : CompletionEntryDetails
|
||||
@@ -5967,6 +6029,9 @@ declare module "typescript" {
|
||||
static unknown: string;
|
||||
>unknown : string
|
||||
|
||||
static warning: string;
|
||||
>warning : string
|
||||
|
||||
static keyword: string;
|
||||
>keyword : string
|
||||
|
||||
|
||||
@@ -264,59 +264,62 @@ declare module "typescript" {
|
||||
TemplateExpression = 171,
|
||||
YieldExpression = 172,
|
||||
SpreadElementExpression = 173,
|
||||
OmittedExpression = 174,
|
||||
TemplateSpan = 175,
|
||||
Block = 176,
|
||||
VariableStatement = 177,
|
||||
EmptyStatement = 178,
|
||||
ExpressionStatement = 179,
|
||||
IfStatement = 180,
|
||||
DoStatement = 181,
|
||||
WhileStatement = 182,
|
||||
ForStatement = 183,
|
||||
ForInStatement = 184,
|
||||
ForOfStatement = 185,
|
||||
ContinueStatement = 186,
|
||||
BreakStatement = 187,
|
||||
ReturnStatement = 188,
|
||||
WithStatement = 189,
|
||||
SwitchStatement = 190,
|
||||
LabeledStatement = 191,
|
||||
ThrowStatement = 192,
|
||||
TryStatement = 193,
|
||||
DebuggerStatement = 194,
|
||||
VariableDeclaration = 195,
|
||||
VariableDeclarationList = 196,
|
||||
FunctionDeclaration = 197,
|
||||
ClassDeclaration = 198,
|
||||
InterfaceDeclaration = 199,
|
||||
TypeAliasDeclaration = 200,
|
||||
EnumDeclaration = 201,
|
||||
ModuleDeclaration = 202,
|
||||
ModuleBlock = 203,
|
||||
CaseBlock = 204,
|
||||
ImportEqualsDeclaration = 205,
|
||||
ImportDeclaration = 206,
|
||||
ImportClause = 207,
|
||||
NamespaceImport = 208,
|
||||
NamedImports = 209,
|
||||
ImportSpecifier = 210,
|
||||
ExportAssignment = 211,
|
||||
ExportDeclaration = 212,
|
||||
NamedExports = 213,
|
||||
ExportSpecifier = 214,
|
||||
MissingDeclaration = 215,
|
||||
ExternalModuleReference = 216,
|
||||
CaseClause = 217,
|
||||
DefaultClause = 218,
|
||||
HeritageClause = 219,
|
||||
CatchClause = 220,
|
||||
PropertyAssignment = 221,
|
||||
ShorthandPropertyAssignment = 222,
|
||||
EnumMember = 223,
|
||||
SourceFile = 224,
|
||||
SyntaxList = 225,
|
||||
Count = 226,
|
||||
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,
|
||||
@@ -500,6 +503,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;
|
||||
@@ -638,6 +644,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 {
|
||||
@@ -732,12 +742,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;
|
||||
}
|
||||
@@ -749,7 +763,7 @@ declare module "typescript" {
|
||||
}
|
||||
interface HeritageClause extends Node {
|
||||
token: SyntaxKind;
|
||||
types?: NodeArray<TypeReferenceNode>;
|
||||
types?: NodeArray<HeritageClauseElement>;
|
||||
}
|
||||
interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
name: Identifier;
|
||||
@@ -777,7 +791,7 @@ declare module "typescript" {
|
||||
interface ExternalModuleReference extends Node {
|
||||
expression?: Expression;
|
||||
}
|
||||
interface ImportDeclaration extends Statement, ModuleElement {
|
||||
interface ImportDeclaration extends ModuleElement {
|
||||
importClause?: ImportClause;
|
||||
moduleSpecifier: Expression;
|
||||
}
|
||||
@@ -919,7 +933,7 @@ declare module "typescript" {
|
||||
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[];
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
@@ -991,7 +1005,7 @@ declare module "typescript" {
|
||||
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;
|
||||
resolvesToSomeValue(location: Node, name: string): boolean;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
@@ -1521,6 +1535,20 @@ declare module "typescript" {
|
||||
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;
|
||||
@@ -1805,6 +1833,7 @@ declare module "typescript" {
|
||||
name: string;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
sortText: string;
|
||||
}
|
||||
interface CompletionEntryDetails {
|
||||
name: string;
|
||||
@@ -1947,6 +1976,7 @@ declare module "typescript" {
|
||||
}
|
||||
class ScriptElementKind {
|
||||
static unknown: string;
|
||||
static warning: string;
|
||||
static keyword: string;
|
||||
static scriptElement: string;
|
||||
static moduleElement: string;
|
||||
@@ -2042,21 +2072,21 @@ function delint(sourceFile) {
|
||||
delintNode(sourceFile);
|
||||
function delintNode(node) {
|
||||
switch (node.kind) {
|
||||
case 183 /* ForStatement */:
|
||||
case 184 /* ForInStatement */:
|
||||
case 182 /* WhileStatement */:
|
||||
case 181 /* DoStatement */:
|
||||
if (node.statement.kind !== 176 /* Block */) {
|
||||
case 186 /* ForStatement */:
|
||||
case 187 /* ForInStatement */:
|
||||
case 185 /* WhileStatement */:
|
||||
case 184 /* DoStatement */:
|
||||
if (node.statement.kind !== 179 /* Block */) {
|
||||
report(node, "A looping statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
case 180 /* IfStatement */:
|
||||
case 183 /* IfStatement */:
|
||||
var ifStatement = node;
|
||||
if (ifStatement.thenStatement.kind !== 176 /* Block */) {
|
||||
if (ifStatement.thenStatement.kind !== 179 /* Block */) {
|
||||
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
if (ifStatement.elseStatement &&
|
||||
ifStatement.elseStatement.kind !== 176 /* Block */ && ifStatement.elseStatement.kind !== 180 /* IfStatement */) {
|
||||
ifStatement.elseStatement.kind !== 179 /* Block */ && ifStatement.elseStatement.kind !== 183 /* IfStatement */) {
|
||||
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -863,163 +863,172 @@ declare module "typescript" {
|
||||
SpreadElementExpression = 173,
|
||||
>SpreadElementExpression : SyntaxKind
|
||||
|
||||
OmittedExpression = 174,
|
||||
ClassExpression = 174,
|
||||
>ClassExpression : SyntaxKind
|
||||
|
||||
OmittedExpression = 175,
|
||||
>OmittedExpression : SyntaxKind
|
||||
|
||||
TemplateSpan = 175,
|
||||
TemplateSpan = 176,
|
||||
>TemplateSpan : SyntaxKind
|
||||
|
||||
Block = 176,
|
||||
HeritageClauseElement = 177,
|
||||
>HeritageClauseElement : SyntaxKind
|
||||
|
||||
SemicolonClassElement = 178,
|
||||
>SemicolonClassElement : SyntaxKind
|
||||
|
||||
Block = 179,
|
||||
>Block : SyntaxKind
|
||||
|
||||
VariableStatement = 177,
|
||||
VariableStatement = 180,
|
||||
>VariableStatement : SyntaxKind
|
||||
|
||||
EmptyStatement = 178,
|
||||
EmptyStatement = 181,
|
||||
>EmptyStatement : SyntaxKind
|
||||
|
||||
ExpressionStatement = 179,
|
||||
ExpressionStatement = 182,
|
||||
>ExpressionStatement : SyntaxKind
|
||||
|
||||
IfStatement = 180,
|
||||
IfStatement = 183,
|
||||
>IfStatement : SyntaxKind
|
||||
|
||||
DoStatement = 181,
|
||||
DoStatement = 184,
|
||||
>DoStatement : SyntaxKind
|
||||
|
||||
WhileStatement = 182,
|
||||
WhileStatement = 185,
|
||||
>WhileStatement : SyntaxKind
|
||||
|
||||
ForStatement = 183,
|
||||
ForStatement = 186,
|
||||
>ForStatement : SyntaxKind
|
||||
|
||||
ForInStatement = 184,
|
||||
ForInStatement = 187,
|
||||
>ForInStatement : SyntaxKind
|
||||
|
||||
ForOfStatement = 185,
|
||||
ForOfStatement = 188,
|
||||
>ForOfStatement : SyntaxKind
|
||||
|
||||
ContinueStatement = 186,
|
||||
ContinueStatement = 189,
|
||||
>ContinueStatement : SyntaxKind
|
||||
|
||||
BreakStatement = 187,
|
||||
BreakStatement = 190,
|
||||
>BreakStatement : SyntaxKind
|
||||
|
||||
ReturnStatement = 188,
|
||||
ReturnStatement = 191,
|
||||
>ReturnStatement : SyntaxKind
|
||||
|
||||
WithStatement = 189,
|
||||
WithStatement = 192,
|
||||
>WithStatement : SyntaxKind
|
||||
|
||||
SwitchStatement = 190,
|
||||
SwitchStatement = 193,
|
||||
>SwitchStatement : SyntaxKind
|
||||
|
||||
LabeledStatement = 191,
|
||||
LabeledStatement = 194,
|
||||
>LabeledStatement : SyntaxKind
|
||||
|
||||
ThrowStatement = 192,
|
||||
ThrowStatement = 195,
|
||||
>ThrowStatement : SyntaxKind
|
||||
|
||||
TryStatement = 193,
|
||||
TryStatement = 196,
|
||||
>TryStatement : SyntaxKind
|
||||
|
||||
DebuggerStatement = 194,
|
||||
DebuggerStatement = 197,
|
||||
>DebuggerStatement : SyntaxKind
|
||||
|
||||
VariableDeclaration = 195,
|
||||
VariableDeclaration = 198,
|
||||
>VariableDeclaration : SyntaxKind
|
||||
|
||||
VariableDeclarationList = 196,
|
||||
VariableDeclarationList = 199,
|
||||
>VariableDeclarationList : SyntaxKind
|
||||
|
||||
FunctionDeclaration = 197,
|
||||
FunctionDeclaration = 200,
|
||||
>FunctionDeclaration : SyntaxKind
|
||||
|
||||
ClassDeclaration = 198,
|
||||
ClassDeclaration = 201,
|
||||
>ClassDeclaration : SyntaxKind
|
||||
|
||||
InterfaceDeclaration = 199,
|
||||
InterfaceDeclaration = 202,
|
||||
>InterfaceDeclaration : SyntaxKind
|
||||
|
||||
TypeAliasDeclaration = 200,
|
||||
TypeAliasDeclaration = 203,
|
||||
>TypeAliasDeclaration : SyntaxKind
|
||||
|
||||
EnumDeclaration = 201,
|
||||
EnumDeclaration = 204,
|
||||
>EnumDeclaration : SyntaxKind
|
||||
|
||||
ModuleDeclaration = 202,
|
||||
ModuleDeclaration = 205,
|
||||
>ModuleDeclaration : SyntaxKind
|
||||
|
||||
ModuleBlock = 203,
|
||||
ModuleBlock = 206,
|
||||
>ModuleBlock : SyntaxKind
|
||||
|
||||
CaseBlock = 204,
|
||||
CaseBlock = 207,
|
||||
>CaseBlock : SyntaxKind
|
||||
|
||||
ImportEqualsDeclaration = 205,
|
||||
ImportEqualsDeclaration = 208,
|
||||
>ImportEqualsDeclaration : SyntaxKind
|
||||
|
||||
ImportDeclaration = 206,
|
||||
ImportDeclaration = 209,
|
||||
>ImportDeclaration : SyntaxKind
|
||||
|
||||
ImportClause = 207,
|
||||
ImportClause = 210,
|
||||
>ImportClause : SyntaxKind
|
||||
|
||||
NamespaceImport = 208,
|
||||
NamespaceImport = 211,
|
||||
>NamespaceImport : SyntaxKind
|
||||
|
||||
NamedImports = 209,
|
||||
NamedImports = 212,
|
||||
>NamedImports : SyntaxKind
|
||||
|
||||
ImportSpecifier = 210,
|
||||
ImportSpecifier = 213,
|
||||
>ImportSpecifier : SyntaxKind
|
||||
|
||||
ExportAssignment = 211,
|
||||
ExportAssignment = 214,
|
||||
>ExportAssignment : SyntaxKind
|
||||
|
||||
ExportDeclaration = 212,
|
||||
ExportDeclaration = 215,
|
||||
>ExportDeclaration : SyntaxKind
|
||||
|
||||
NamedExports = 213,
|
||||
NamedExports = 216,
|
||||
>NamedExports : SyntaxKind
|
||||
|
||||
ExportSpecifier = 214,
|
||||
ExportSpecifier = 217,
|
||||
>ExportSpecifier : SyntaxKind
|
||||
|
||||
MissingDeclaration = 215,
|
||||
MissingDeclaration = 218,
|
||||
>MissingDeclaration : SyntaxKind
|
||||
|
||||
ExternalModuleReference = 216,
|
||||
ExternalModuleReference = 219,
|
||||
>ExternalModuleReference : SyntaxKind
|
||||
|
||||
CaseClause = 217,
|
||||
CaseClause = 220,
|
||||
>CaseClause : SyntaxKind
|
||||
|
||||
DefaultClause = 218,
|
||||
DefaultClause = 221,
|
||||
>DefaultClause : SyntaxKind
|
||||
|
||||
HeritageClause = 219,
|
||||
HeritageClause = 222,
|
||||
>HeritageClause : SyntaxKind
|
||||
|
||||
CatchClause = 220,
|
||||
CatchClause = 223,
|
||||
>CatchClause : SyntaxKind
|
||||
|
||||
PropertyAssignment = 221,
|
||||
PropertyAssignment = 224,
|
||||
>PropertyAssignment : SyntaxKind
|
||||
|
||||
ShorthandPropertyAssignment = 222,
|
||||
ShorthandPropertyAssignment = 225,
|
||||
>ShorthandPropertyAssignment : SyntaxKind
|
||||
|
||||
EnumMember = 223,
|
||||
EnumMember = 226,
|
||||
>EnumMember : SyntaxKind
|
||||
|
||||
SourceFile = 224,
|
||||
SourceFile = 227,
|
||||
>SourceFile : SyntaxKind
|
||||
|
||||
SyntaxList = 225,
|
||||
SyntaxList = 228,
|
||||
>SyntaxList : SyntaxKind
|
||||
|
||||
Count = 226,
|
||||
Count = 229,
|
||||
>Count : SyntaxKind
|
||||
|
||||
FirstAssignment = 53,
|
||||
@@ -1576,6 +1585,13 @@ declare module "typescript" {
|
||||
body?: Block;
|
||||
>body : Block
|
||||
>Block : Block
|
||||
}
|
||||
interface SemicolonClassElement extends ClassElement {
|
||||
>SemicolonClassElement : SemicolonClassElement
|
||||
>ClassElement : ClassElement
|
||||
|
||||
_semicolonClassElementBrand: any;
|
||||
>_semicolonClassElementBrand : any
|
||||
}
|
||||
interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
|
||||
>AccessorDeclaration : AccessorDeclaration
|
||||
@@ -1977,6 +1993,19 @@ declare module "typescript" {
|
||||
>arguments : NodeArray<Expression>
|
||||
>NodeArray : NodeArray<T>
|
||||
>Expression : Expression
|
||||
}
|
||||
interface HeritageClauseElement extends Node {
|
||||
>HeritageClauseElement : HeritageClauseElement
|
||||
>Node : Node
|
||||
|
||||
expression: LeftHandSideExpression;
|
||||
>expression : LeftHandSideExpression
|
||||
>LeftHandSideExpression : LeftHandSideExpression
|
||||
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
>typeArguments : NodeArray<TypeNode>
|
||||
>NodeArray : NodeArray<T>
|
||||
>TypeNode : TypeNode
|
||||
}
|
||||
interface NewExpression extends CallExpression, PrimaryExpression {
|
||||
>NewExpression : NewExpression
|
||||
@@ -2261,10 +2290,9 @@ declare module "typescript" {
|
||||
_moduleElementBrand: any;
|
||||
>_moduleElementBrand : any
|
||||
}
|
||||
interface ClassDeclaration extends Declaration, ModuleElement {
|
||||
>ClassDeclaration : ClassDeclaration
|
||||
interface ClassLikeDeclaration extends Declaration {
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>Declaration : Declaration
|
||||
>ModuleElement : ModuleElement
|
||||
|
||||
name?: Identifier;
|
||||
>name : Identifier
|
||||
@@ -2284,6 +2312,16 @@ declare module "typescript" {
|
||||
>members : NodeArray<ClassElement>
|
||||
>NodeArray : NodeArray<T>
|
||||
>ClassElement : ClassElement
|
||||
}
|
||||
interface ClassDeclaration extends ClassLikeDeclaration, Statement {
|
||||
>ClassDeclaration : ClassDeclaration
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>Statement : Statement
|
||||
}
|
||||
interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
|
||||
>ClassExpression : ClassExpression
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>PrimaryExpression : PrimaryExpression
|
||||
}
|
||||
interface ClassElement extends Declaration {
|
||||
>ClassElement : ClassElement
|
||||
@@ -2324,10 +2362,10 @@ declare module "typescript" {
|
||||
>token : SyntaxKind
|
||||
>SyntaxKind : SyntaxKind
|
||||
|
||||
types?: NodeArray<TypeReferenceNode>;
|
||||
>types : NodeArray<TypeReferenceNode>
|
||||
types?: NodeArray<HeritageClauseElement>;
|
||||
>types : NodeArray<HeritageClauseElement>
|
||||
>NodeArray : NodeArray<T>
|
||||
>TypeReferenceNode : TypeReferenceNode
|
||||
>HeritageClauseElement : HeritageClauseElement
|
||||
}
|
||||
interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
>TypeAliasDeclaration : TypeAliasDeclaration
|
||||
@@ -2415,9 +2453,8 @@ declare module "typescript" {
|
||||
>expression : Expression
|
||||
>Expression : Expression
|
||||
}
|
||||
interface ImportDeclaration extends Statement, ModuleElement {
|
||||
interface ImportDeclaration extends ModuleElement {
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
>Statement : Statement
|
||||
>ModuleElement : ModuleElement
|
||||
|
||||
importClause?: ImportClause;
|
||||
@@ -2926,10 +2963,10 @@ declare module "typescript" {
|
||||
>Symbol : Symbol
|
||||
>Symbol : Symbol
|
||||
|
||||
getExportsOfExternalModule(node: ImportDeclaration): Symbol[];
|
||||
>getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[]
|
||||
>node : ImportDeclaration
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
getExportsOfModule(moduleSymbol: Symbol): Symbol[];
|
||||
>getExportsOfModule : (moduleSymbol: Symbol) => Symbol[]
|
||||
>moduleSymbol : Symbol
|
||||
>Symbol : Symbol
|
||||
>Symbol : Symbol
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
@@ -3271,10 +3308,11 @@ declare module "typescript" {
|
||||
>SymbolFlags : SymbolFlags
|
||||
>SymbolAccessiblityResult : SymbolAccessiblityResult
|
||||
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
>isEntityNameVisible : (entityName: Identifier | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult
|
||||
>entityName : Identifier | QualifiedName
|
||||
isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
>isEntityNameVisible : (entityName: Identifier | Expression | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult
|
||||
>entityName : Identifier | Expression | QualifiedName
|
||||
>EntityName : Identifier | QualifiedName
|
||||
>Expression : Expression
|
||||
>enclosingDeclaration : Node
|
||||
>Node : Node
|
||||
>SymbolVisibilityResult : SymbolVisibilityResult
|
||||
@@ -4945,6 +4983,27 @@ declare module "typescript" {
|
||||
>CompilerHost : CompilerHost
|
||||
>Program : Program
|
||||
}
|
||||
declare module "typescript" {
|
||||
/**
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
*/
|
||||
function readConfigFile(fileName: string): any;
|
||||
>readConfigFile : (fileName: string) => any
|
||||
>fileName : string
|
||||
|
||||
/**
|
||||
* 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;
|
||||
>parseConfigFile : (json: any, basePath?: string) => ParsedCommandLine
|
||||
>json : any
|
||||
>basePath : string
|
||||
>ParsedCommandLine : ParsedCommandLine
|
||||
}
|
||||
declare module "typescript" {
|
||||
/** The version of the language service API */
|
||||
let servicesVersion: string;
|
||||
@@ -5844,6 +5903,9 @@ declare module "typescript" {
|
||||
|
||||
kindModifiers: string;
|
||||
>kindModifiers : string
|
||||
|
||||
sortText: string;
|
||||
>sortText : string
|
||||
}
|
||||
interface CompletionEntryDetails {
|
||||
>CompletionEntryDetails : CompletionEntryDetails
|
||||
@@ -6113,6 +6175,9 @@ declare module "typescript" {
|
||||
static unknown: string;
|
||||
>unknown : string
|
||||
|
||||
static warning: string;
|
||||
>warning : string
|
||||
|
||||
static keyword: string;
|
||||
>keyword : string
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -265,59 +265,62 @@ declare module "typescript" {
|
||||
TemplateExpression = 171,
|
||||
YieldExpression = 172,
|
||||
SpreadElementExpression = 173,
|
||||
OmittedExpression = 174,
|
||||
TemplateSpan = 175,
|
||||
Block = 176,
|
||||
VariableStatement = 177,
|
||||
EmptyStatement = 178,
|
||||
ExpressionStatement = 179,
|
||||
IfStatement = 180,
|
||||
DoStatement = 181,
|
||||
WhileStatement = 182,
|
||||
ForStatement = 183,
|
||||
ForInStatement = 184,
|
||||
ForOfStatement = 185,
|
||||
ContinueStatement = 186,
|
||||
BreakStatement = 187,
|
||||
ReturnStatement = 188,
|
||||
WithStatement = 189,
|
||||
SwitchStatement = 190,
|
||||
LabeledStatement = 191,
|
||||
ThrowStatement = 192,
|
||||
TryStatement = 193,
|
||||
DebuggerStatement = 194,
|
||||
VariableDeclaration = 195,
|
||||
VariableDeclarationList = 196,
|
||||
FunctionDeclaration = 197,
|
||||
ClassDeclaration = 198,
|
||||
InterfaceDeclaration = 199,
|
||||
TypeAliasDeclaration = 200,
|
||||
EnumDeclaration = 201,
|
||||
ModuleDeclaration = 202,
|
||||
ModuleBlock = 203,
|
||||
CaseBlock = 204,
|
||||
ImportEqualsDeclaration = 205,
|
||||
ImportDeclaration = 206,
|
||||
ImportClause = 207,
|
||||
NamespaceImport = 208,
|
||||
NamedImports = 209,
|
||||
ImportSpecifier = 210,
|
||||
ExportAssignment = 211,
|
||||
ExportDeclaration = 212,
|
||||
NamedExports = 213,
|
||||
ExportSpecifier = 214,
|
||||
MissingDeclaration = 215,
|
||||
ExternalModuleReference = 216,
|
||||
CaseClause = 217,
|
||||
DefaultClause = 218,
|
||||
HeritageClause = 219,
|
||||
CatchClause = 220,
|
||||
PropertyAssignment = 221,
|
||||
ShorthandPropertyAssignment = 222,
|
||||
EnumMember = 223,
|
||||
SourceFile = 224,
|
||||
SyntaxList = 225,
|
||||
Count = 226,
|
||||
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,
|
||||
@@ -501,6 +504,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;
|
||||
@@ -639,6 +645,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 {
|
||||
@@ -733,12 +743,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;
|
||||
}
|
||||
@@ -750,7 +764,7 @@ declare module "typescript" {
|
||||
}
|
||||
interface HeritageClause extends Node {
|
||||
token: SyntaxKind;
|
||||
types?: NodeArray<TypeReferenceNode>;
|
||||
types?: NodeArray<HeritageClauseElement>;
|
||||
}
|
||||
interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
name: Identifier;
|
||||
@@ -778,7 +792,7 @@ declare module "typescript" {
|
||||
interface ExternalModuleReference extends Node {
|
||||
expression?: Expression;
|
||||
}
|
||||
interface ImportDeclaration extends Statement, ModuleElement {
|
||||
interface ImportDeclaration extends ModuleElement {
|
||||
importClause?: ImportClause;
|
||||
moduleSpecifier: Expression;
|
||||
}
|
||||
@@ -920,7 +934,7 @@ declare module "typescript" {
|
||||
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[];
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
@@ -992,7 +1006,7 @@ declare module "typescript" {
|
||||
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;
|
||||
resolvesToSomeValue(location: Node, name: string): boolean;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
@@ -1522,6 +1536,20 @@ declare module "typescript" {
|
||||
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;
|
||||
@@ -1806,6 +1834,7 @@ declare module "typescript" {
|
||||
name: string;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
sortText: string;
|
||||
}
|
||||
interface CompletionEntryDetails {
|
||||
name: string;
|
||||
@@ -1948,6 +1977,7 @@ declare module "typescript" {
|
||||
}
|
||||
class ScriptElementKind {
|
||||
static unknown: string;
|
||||
static warning: string;
|
||||
static keyword: string;
|
||||
static scriptElement: string;
|
||||
static moduleElement: string;
|
||||
|
||||
@@ -813,163 +813,172 @@ declare module "typescript" {
|
||||
SpreadElementExpression = 173,
|
||||
>SpreadElementExpression : SyntaxKind
|
||||
|
||||
OmittedExpression = 174,
|
||||
ClassExpression = 174,
|
||||
>ClassExpression : SyntaxKind
|
||||
|
||||
OmittedExpression = 175,
|
||||
>OmittedExpression : SyntaxKind
|
||||
|
||||
TemplateSpan = 175,
|
||||
TemplateSpan = 176,
|
||||
>TemplateSpan : SyntaxKind
|
||||
|
||||
Block = 176,
|
||||
HeritageClauseElement = 177,
|
||||
>HeritageClauseElement : SyntaxKind
|
||||
|
||||
SemicolonClassElement = 178,
|
||||
>SemicolonClassElement : SyntaxKind
|
||||
|
||||
Block = 179,
|
||||
>Block : SyntaxKind
|
||||
|
||||
VariableStatement = 177,
|
||||
VariableStatement = 180,
|
||||
>VariableStatement : SyntaxKind
|
||||
|
||||
EmptyStatement = 178,
|
||||
EmptyStatement = 181,
|
||||
>EmptyStatement : SyntaxKind
|
||||
|
||||
ExpressionStatement = 179,
|
||||
ExpressionStatement = 182,
|
||||
>ExpressionStatement : SyntaxKind
|
||||
|
||||
IfStatement = 180,
|
||||
IfStatement = 183,
|
||||
>IfStatement : SyntaxKind
|
||||
|
||||
DoStatement = 181,
|
||||
DoStatement = 184,
|
||||
>DoStatement : SyntaxKind
|
||||
|
||||
WhileStatement = 182,
|
||||
WhileStatement = 185,
|
||||
>WhileStatement : SyntaxKind
|
||||
|
||||
ForStatement = 183,
|
||||
ForStatement = 186,
|
||||
>ForStatement : SyntaxKind
|
||||
|
||||
ForInStatement = 184,
|
||||
ForInStatement = 187,
|
||||
>ForInStatement : SyntaxKind
|
||||
|
||||
ForOfStatement = 185,
|
||||
ForOfStatement = 188,
|
||||
>ForOfStatement : SyntaxKind
|
||||
|
||||
ContinueStatement = 186,
|
||||
ContinueStatement = 189,
|
||||
>ContinueStatement : SyntaxKind
|
||||
|
||||
BreakStatement = 187,
|
||||
BreakStatement = 190,
|
||||
>BreakStatement : SyntaxKind
|
||||
|
||||
ReturnStatement = 188,
|
||||
ReturnStatement = 191,
|
||||
>ReturnStatement : SyntaxKind
|
||||
|
||||
WithStatement = 189,
|
||||
WithStatement = 192,
|
||||
>WithStatement : SyntaxKind
|
||||
|
||||
SwitchStatement = 190,
|
||||
SwitchStatement = 193,
|
||||
>SwitchStatement : SyntaxKind
|
||||
|
||||
LabeledStatement = 191,
|
||||
LabeledStatement = 194,
|
||||
>LabeledStatement : SyntaxKind
|
||||
|
||||
ThrowStatement = 192,
|
||||
ThrowStatement = 195,
|
||||
>ThrowStatement : SyntaxKind
|
||||
|
||||
TryStatement = 193,
|
||||
TryStatement = 196,
|
||||
>TryStatement : SyntaxKind
|
||||
|
||||
DebuggerStatement = 194,
|
||||
DebuggerStatement = 197,
|
||||
>DebuggerStatement : SyntaxKind
|
||||
|
||||
VariableDeclaration = 195,
|
||||
VariableDeclaration = 198,
|
||||
>VariableDeclaration : SyntaxKind
|
||||
|
||||
VariableDeclarationList = 196,
|
||||
VariableDeclarationList = 199,
|
||||
>VariableDeclarationList : SyntaxKind
|
||||
|
||||
FunctionDeclaration = 197,
|
||||
FunctionDeclaration = 200,
|
||||
>FunctionDeclaration : SyntaxKind
|
||||
|
||||
ClassDeclaration = 198,
|
||||
ClassDeclaration = 201,
|
||||
>ClassDeclaration : SyntaxKind
|
||||
|
||||
InterfaceDeclaration = 199,
|
||||
InterfaceDeclaration = 202,
|
||||
>InterfaceDeclaration : SyntaxKind
|
||||
|
||||
TypeAliasDeclaration = 200,
|
||||
TypeAliasDeclaration = 203,
|
||||
>TypeAliasDeclaration : SyntaxKind
|
||||
|
||||
EnumDeclaration = 201,
|
||||
EnumDeclaration = 204,
|
||||
>EnumDeclaration : SyntaxKind
|
||||
|
||||
ModuleDeclaration = 202,
|
||||
ModuleDeclaration = 205,
|
||||
>ModuleDeclaration : SyntaxKind
|
||||
|
||||
ModuleBlock = 203,
|
||||
ModuleBlock = 206,
|
||||
>ModuleBlock : SyntaxKind
|
||||
|
||||
CaseBlock = 204,
|
||||
CaseBlock = 207,
|
||||
>CaseBlock : SyntaxKind
|
||||
|
||||
ImportEqualsDeclaration = 205,
|
||||
ImportEqualsDeclaration = 208,
|
||||
>ImportEqualsDeclaration : SyntaxKind
|
||||
|
||||
ImportDeclaration = 206,
|
||||
ImportDeclaration = 209,
|
||||
>ImportDeclaration : SyntaxKind
|
||||
|
||||
ImportClause = 207,
|
||||
ImportClause = 210,
|
||||
>ImportClause : SyntaxKind
|
||||
|
||||
NamespaceImport = 208,
|
||||
NamespaceImport = 211,
|
||||
>NamespaceImport : SyntaxKind
|
||||
|
||||
NamedImports = 209,
|
||||
NamedImports = 212,
|
||||
>NamedImports : SyntaxKind
|
||||
|
||||
ImportSpecifier = 210,
|
||||
ImportSpecifier = 213,
|
||||
>ImportSpecifier : SyntaxKind
|
||||
|
||||
ExportAssignment = 211,
|
||||
ExportAssignment = 214,
|
||||
>ExportAssignment : SyntaxKind
|
||||
|
||||
ExportDeclaration = 212,
|
||||
ExportDeclaration = 215,
|
||||
>ExportDeclaration : SyntaxKind
|
||||
|
||||
NamedExports = 213,
|
||||
NamedExports = 216,
|
||||
>NamedExports : SyntaxKind
|
||||
|
||||
ExportSpecifier = 214,
|
||||
ExportSpecifier = 217,
|
||||
>ExportSpecifier : SyntaxKind
|
||||
|
||||
MissingDeclaration = 215,
|
||||
MissingDeclaration = 218,
|
||||
>MissingDeclaration : SyntaxKind
|
||||
|
||||
ExternalModuleReference = 216,
|
||||
ExternalModuleReference = 219,
|
||||
>ExternalModuleReference : SyntaxKind
|
||||
|
||||
CaseClause = 217,
|
||||
CaseClause = 220,
|
||||
>CaseClause : SyntaxKind
|
||||
|
||||
DefaultClause = 218,
|
||||
DefaultClause = 221,
|
||||
>DefaultClause : SyntaxKind
|
||||
|
||||
HeritageClause = 219,
|
||||
HeritageClause = 222,
|
||||
>HeritageClause : SyntaxKind
|
||||
|
||||
CatchClause = 220,
|
||||
CatchClause = 223,
|
||||
>CatchClause : SyntaxKind
|
||||
|
||||
PropertyAssignment = 221,
|
||||
PropertyAssignment = 224,
|
||||
>PropertyAssignment : SyntaxKind
|
||||
|
||||
ShorthandPropertyAssignment = 222,
|
||||
ShorthandPropertyAssignment = 225,
|
||||
>ShorthandPropertyAssignment : SyntaxKind
|
||||
|
||||
EnumMember = 223,
|
||||
EnumMember = 226,
|
||||
>EnumMember : SyntaxKind
|
||||
|
||||
SourceFile = 224,
|
||||
SourceFile = 227,
|
||||
>SourceFile : SyntaxKind
|
||||
|
||||
SyntaxList = 225,
|
||||
SyntaxList = 228,
|
||||
>SyntaxList : SyntaxKind
|
||||
|
||||
Count = 226,
|
||||
Count = 229,
|
||||
>Count : SyntaxKind
|
||||
|
||||
FirstAssignment = 53,
|
||||
@@ -1526,6 +1535,13 @@ declare module "typescript" {
|
||||
body?: Block;
|
||||
>body : Block
|
||||
>Block : Block
|
||||
}
|
||||
interface SemicolonClassElement extends ClassElement {
|
||||
>SemicolonClassElement : SemicolonClassElement
|
||||
>ClassElement : ClassElement
|
||||
|
||||
_semicolonClassElementBrand: any;
|
||||
>_semicolonClassElementBrand : any
|
||||
}
|
||||
interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
|
||||
>AccessorDeclaration : AccessorDeclaration
|
||||
@@ -1927,6 +1943,19 @@ declare module "typescript" {
|
||||
>arguments : NodeArray<Expression>
|
||||
>NodeArray : NodeArray<T>
|
||||
>Expression : Expression
|
||||
}
|
||||
interface HeritageClauseElement extends Node {
|
||||
>HeritageClauseElement : HeritageClauseElement
|
||||
>Node : Node
|
||||
|
||||
expression: LeftHandSideExpression;
|
||||
>expression : LeftHandSideExpression
|
||||
>LeftHandSideExpression : LeftHandSideExpression
|
||||
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
>typeArguments : NodeArray<TypeNode>
|
||||
>NodeArray : NodeArray<T>
|
||||
>TypeNode : TypeNode
|
||||
}
|
||||
interface NewExpression extends CallExpression, PrimaryExpression {
|
||||
>NewExpression : NewExpression
|
||||
@@ -2211,10 +2240,9 @@ declare module "typescript" {
|
||||
_moduleElementBrand: any;
|
||||
>_moduleElementBrand : any
|
||||
}
|
||||
interface ClassDeclaration extends Declaration, ModuleElement {
|
||||
>ClassDeclaration : ClassDeclaration
|
||||
interface ClassLikeDeclaration extends Declaration {
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>Declaration : Declaration
|
||||
>ModuleElement : ModuleElement
|
||||
|
||||
name?: Identifier;
|
||||
>name : Identifier
|
||||
@@ -2234,6 +2262,16 @@ declare module "typescript" {
|
||||
>members : NodeArray<ClassElement>
|
||||
>NodeArray : NodeArray<T>
|
||||
>ClassElement : ClassElement
|
||||
}
|
||||
interface ClassDeclaration extends ClassLikeDeclaration, Statement {
|
||||
>ClassDeclaration : ClassDeclaration
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>Statement : Statement
|
||||
}
|
||||
interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
|
||||
>ClassExpression : ClassExpression
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>PrimaryExpression : PrimaryExpression
|
||||
}
|
||||
interface ClassElement extends Declaration {
|
||||
>ClassElement : ClassElement
|
||||
@@ -2274,10 +2312,10 @@ declare module "typescript" {
|
||||
>token : SyntaxKind
|
||||
>SyntaxKind : SyntaxKind
|
||||
|
||||
types?: NodeArray<TypeReferenceNode>;
|
||||
>types : NodeArray<TypeReferenceNode>
|
||||
types?: NodeArray<HeritageClauseElement>;
|
||||
>types : NodeArray<HeritageClauseElement>
|
||||
>NodeArray : NodeArray<T>
|
||||
>TypeReferenceNode : TypeReferenceNode
|
||||
>HeritageClauseElement : HeritageClauseElement
|
||||
}
|
||||
interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
>TypeAliasDeclaration : TypeAliasDeclaration
|
||||
@@ -2365,9 +2403,8 @@ declare module "typescript" {
|
||||
>expression : Expression
|
||||
>Expression : Expression
|
||||
}
|
||||
interface ImportDeclaration extends Statement, ModuleElement {
|
||||
interface ImportDeclaration extends ModuleElement {
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
>Statement : Statement
|
||||
>ModuleElement : ModuleElement
|
||||
|
||||
importClause?: ImportClause;
|
||||
@@ -2876,10 +2913,10 @@ declare module "typescript" {
|
||||
>Symbol : Symbol
|
||||
>Symbol : Symbol
|
||||
|
||||
getExportsOfExternalModule(node: ImportDeclaration): Symbol[];
|
||||
>getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[]
|
||||
>node : ImportDeclaration
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
getExportsOfModule(moduleSymbol: Symbol): Symbol[];
|
||||
>getExportsOfModule : (moduleSymbol: Symbol) => Symbol[]
|
||||
>moduleSymbol : Symbol
|
||||
>Symbol : Symbol
|
||||
>Symbol : Symbol
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
@@ -3221,10 +3258,11 @@ declare module "typescript" {
|
||||
>SymbolFlags : SymbolFlags
|
||||
>SymbolAccessiblityResult : SymbolAccessiblityResult
|
||||
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
>isEntityNameVisible : (entityName: Identifier | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult
|
||||
>entityName : Identifier | QualifiedName
|
||||
isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
>isEntityNameVisible : (entityName: Identifier | Expression | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult
|
||||
>entityName : Identifier | Expression | QualifiedName
|
||||
>EntityName : Identifier | QualifiedName
|
||||
>Expression : Expression
|
||||
>enclosingDeclaration : Node
|
||||
>Node : Node
|
||||
>SymbolVisibilityResult : SymbolVisibilityResult
|
||||
@@ -4895,6 +4933,27 @@ declare module "typescript" {
|
||||
>CompilerHost : CompilerHost
|
||||
>Program : Program
|
||||
}
|
||||
declare module "typescript" {
|
||||
/**
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
*/
|
||||
function readConfigFile(fileName: string): any;
|
||||
>readConfigFile : (fileName: string) => any
|
||||
>fileName : string
|
||||
|
||||
/**
|
||||
* 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;
|
||||
>parseConfigFile : (json: any, basePath?: string) => ParsedCommandLine
|
||||
>json : any
|
||||
>basePath : string
|
||||
>ParsedCommandLine : ParsedCommandLine
|
||||
}
|
||||
declare module "typescript" {
|
||||
/** The version of the language service API */
|
||||
let servicesVersion: string;
|
||||
@@ -5794,6 +5853,9 @@ declare module "typescript" {
|
||||
|
||||
kindModifiers: string;
|
||||
>kindModifiers : string
|
||||
|
||||
sortText: string;
|
||||
>sortText : string
|
||||
}
|
||||
interface CompletionEntryDetails {
|
||||
>CompletionEntryDetails : CompletionEntryDetails
|
||||
@@ -6063,6 +6125,9 @@ declare module "typescript" {
|
||||
static unknown: string;
|
||||
>unknown : string
|
||||
|
||||
static warning: string;
|
||||
>warning : string
|
||||
|
||||
static keyword: string;
|
||||
>keyword : string
|
||||
|
||||
|
||||
@@ -302,59 +302,62 @@ declare module "typescript" {
|
||||
TemplateExpression = 171,
|
||||
YieldExpression = 172,
|
||||
SpreadElementExpression = 173,
|
||||
OmittedExpression = 174,
|
||||
TemplateSpan = 175,
|
||||
Block = 176,
|
||||
VariableStatement = 177,
|
||||
EmptyStatement = 178,
|
||||
ExpressionStatement = 179,
|
||||
IfStatement = 180,
|
||||
DoStatement = 181,
|
||||
WhileStatement = 182,
|
||||
ForStatement = 183,
|
||||
ForInStatement = 184,
|
||||
ForOfStatement = 185,
|
||||
ContinueStatement = 186,
|
||||
BreakStatement = 187,
|
||||
ReturnStatement = 188,
|
||||
WithStatement = 189,
|
||||
SwitchStatement = 190,
|
||||
LabeledStatement = 191,
|
||||
ThrowStatement = 192,
|
||||
TryStatement = 193,
|
||||
DebuggerStatement = 194,
|
||||
VariableDeclaration = 195,
|
||||
VariableDeclarationList = 196,
|
||||
FunctionDeclaration = 197,
|
||||
ClassDeclaration = 198,
|
||||
InterfaceDeclaration = 199,
|
||||
TypeAliasDeclaration = 200,
|
||||
EnumDeclaration = 201,
|
||||
ModuleDeclaration = 202,
|
||||
ModuleBlock = 203,
|
||||
CaseBlock = 204,
|
||||
ImportEqualsDeclaration = 205,
|
||||
ImportDeclaration = 206,
|
||||
ImportClause = 207,
|
||||
NamespaceImport = 208,
|
||||
NamedImports = 209,
|
||||
ImportSpecifier = 210,
|
||||
ExportAssignment = 211,
|
||||
ExportDeclaration = 212,
|
||||
NamedExports = 213,
|
||||
ExportSpecifier = 214,
|
||||
MissingDeclaration = 215,
|
||||
ExternalModuleReference = 216,
|
||||
CaseClause = 217,
|
||||
DefaultClause = 218,
|
||||
HeritageClause = 219,
|
||||
CatchClause = 220,
|
||||
PropertyAssignment = 221,
|
||||
ShorthandPropertyAssignment = 222,
|
||||
EnumMember = 223,
|
||||
SourceFile = 224,
|
||||
SyntaxList = 225,
|
||||
Count = 226,
|
||||
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,
|
||||
@@ -538,6 +541,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;
|
||||
@@ -676,6 +682,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 {
|
||||
@@ -770,12 +780,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;
|
||||
}
|
||||
@@ -787,7 +801,7 @@ declare module "typescript" {
|
||||
}
|
||||
interface HeritageClause extends Node {
|
||||
token: SyntaxKind;
|
||||
types?: NodeArray<TypeReferenceNode>;
|
||||
types?: NodeArray<HeritageClauseElement>;
|
||||
}
|
||||
interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
name: Identifier;
|
||||
@@ -815,7 +829,7 @@ declare module "typescript" {
|
||||
interface ExternalModuleReference extends Node {
|
||||
expression?: Expression;
|
||||
}
|
||||
interface ImportDeclaration extends Statement, ModuleElement {
|
||||
interface ImportDeclaration extends ModuleElement {
|
||||
importClause?: ImportClause;
|
||||
moduleSpecifier: Expression;
|
||||
}
|
||||
@@ -957,7 +971,7 @@ declare module "typescript" {
|
||||
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[];
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
buildTypeDisplay(type: Type, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags): void;
|
||||
@@ -1029,7 +1043,7 @@ declare module "typescript" {
|
||||
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;
|
||||
resolvesToSomeValue(location: Node, name: string): boolean;
|
||||
getBlockScopedVariableId(node: Identifier): number;
|
||||
@@ -1559,6 +1573,20 @@ declare module "typescript" {
|
||||
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;
|
||||
@@ -1843,6 +1871,7 @@ declare module "typescript" {
|
||||
name: string;
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
sortText: string;
|
||||
}
|
||||
interface CompletionEntryDetails {
|
||||
name: string;
|
||||
@@ -1985,6 +2014,7 @@ declare module "typescript" {
|
||||
}
|
||||
class ScriptElementKind {
|
||||
static unknown: string;
|
||||
static warning: string;
|
||||
static keyword: string;
|
||||
static scriptElement: string;
|
||||
static moduleElement: string;
|
||||
|
||||
@@ -986,163 +986,172 @@ declare module "typescript" {
|
||||
SpreadElementExpression = 173,
|
||||
>SpreadElementExpression : SyntaxKind
|
||||
|
||||
OmittedExpression = 174,
|
||||
ClassExpression = 174,
|
||||
>ClassExpression : SyntaxKind
|
||||
|
||||
OmittedExpression = 175,
|
||||
>OmittedExpression : SyntaxKind
|
||||
|
||||
TemplateSpan = 175,
|
||||
TemplateSpan = 176,
|
||||
>TemplateSpan : SyntaxKind
|
||||
|
||||
Block = 176,
|
||||
HeritageClauseElement = 177,
|
||||
>HeritageClauseElement : SyntaxKind
|
||||
|
||||
SemicolonClassElement = 178,
|
||||
>SemicolonClassElement : SyntaxKind
|
||||
|
||||
Block = 179,
|
||||
>Block : SyntaxKind
|
||||
|
||||
VariableStatement = 177,
|
||||
VariableStatement = 180,
|
||||
>VariableStatement : SyntaxKind
|
||||
|
||||
EmptyStatement = 178,
|
||||
EmptyStatement = 181,
|
||||
>EmptyStatement : SyntaxKind
|
||||
|
||||
ExpressionStatement = 179,
|
||||
ExpressionStatement = 182,
|
||||
>ExpressionStatement : SyntaxKind
|
||||
|
||||
IfStatement = 180,
|
||||
IfStatement = 183,
|
||||
>IfStatement : SyntaxKind
|
||||
|
||||
DoStatement = 181,
|
||||
DoStatement = 184,
|
||||
>DoStatement : SyntaxKind
|
||||
|
||||
WhileStatement = 182,
|
||||
WhileStatement = 185,
|
||||
>WhileStatement : SyntaxKind
|
||||
|
||||
ForStatement = 183,
|
||||
ForStatement = 186,
|
||||
>ForStatement : SyntaxKind
|
||||
|
||||
ForInStatement = 184,
|
||||
ForInStatement = 187,
|
||||
>ForInStatement : SyntaxKind
|
||||
|
||||
ForOfStatement = 185,
|
||||
ForOfStatement = 188,
|
||||
>ForOfStatement : SyntaxKind
|
||||
|
||||
ContinueStatement = 186,
|
||||
ContinueStatement = 189,
|
||||
>ContinueStatement : SyntaxKind
|
||||
|
||||
BreakStatement = 187,
|
||||
BreakStatement = 190,
|
||||
>BreakStatement : SyntaxKind
|
||||
|
||||
ReturnStatement = 188,
|
||||
ReturnStatement = 191,
|
||||
>ReturnStatement : SyntaxKind
|
||||
|
||||
WithStatement = 189,
|
||||
WithStatement = 192,
|
||||
>WithStatement : SyntaxKind
|
||||
|
||||
SwitchStatement = 190,
|
||||
SwitchStatement = 193,
|
||||
>SwitchStatement : SyntaxKind
|
||||
|
||||
LabeledStatement = 191,
|
||||
LabeledStatement = 194,
|
||||
>LabeledStatement : SyntaxKind
|
||||
|
||||
ThrowStatement = 192,
|
||||
ThrowStatement = 195,
|
||||
>ThrowStatement : SyntaxKind
|
||||
|
||||
TryStatement = 193,
|
||||
TryStatement = 196,
|
||||
>TryStatement : SyntaxKind
|
||||
|
||||
DebuggerStatement = 194,
|
||||
DebuggerStatement = 197,
|
||||
>DebuggerStatement : SyntaxKind
|
||||
|
||||
VariableDeclaration = 195,
|
||||
VariableDeclaration = 198,
|
||||
>VariableDeclaration : SyntaxKind
|
||||
|
||||
VariableDeclarationList = 196,
|
||||
VariableDeclarationList = 199,
|
||||
>VariableDeclarationList : SyntaxKind
|
||||
|
||||
FunctionDeclaration = 197,
|
||||
FunctionDeclaration = 200,
|
||||
>FunctionDeclaration : SyntaxKind
|
||||
|
||||
ClassDeclaration = 198,
|
||||
ClassDeclaration = 201,
|
||||
>ClassDeclaration : SyntaxKind
|
||||
|
||||
InterfaceDeclaration = 199,
|
||||
InterfaceDeclaration = 202,
|
||||
>InterfaceDeclaration : SyntaxKind
|
||||
|
||||
TypeAliasDeclaration = 200,
|
||||
TypeAliasDeclaration = 203,
|
||||
>TypeAliasDeclaration : SyntaxKind
|
||||
|
||||
EnumDeclaration = 201,
|
||||
EnumDeclaration = 204,
|
||||
>EnumDeclaration : SyntaxKind
|
||||
|
||||
ModuleDeclaration = 202,
|
||||
ModuleDeclaration = 205,
|
||||
>ModuleDeclaration : SyntaxKind
|
||||
|
||||
ModuleBlock = 203,
|
||||
ModuleBlock = 206,
|
||||
>ModuleBlock : SyntaxKind
|
||||
|
||||
CaseBlock = 204,
|
||||
CaseBlock = 207,
|
||||
>CaseBlock : SyntaxKind
|
||||
|
||||
ImportEqualsDeclaration = 205,
|
||||
ImportEqualsDeclaration = 208,
|
||||
>ImportEqualsDeclaration : SyntaxKind
|
||||
|
||||
ImportDeclaration = 206,
|
||||
ImportDeclaration = 209,
|
||||
>ImportDeclaration : SyntaxKind
|
||||
|
||||
ImportClause = 207,
|
||||
ImportClause = 210,
|
||||
>ImportClause : SyntaxKind
|
||||
|
||||
NamespaceImport = 208,
|
||||
NamespaceImport = 211,
|
||||
>NamespaceImport : SyntaxKind
|
||||
|
||||
NamedImports = 209,
|
||||
NamedImports = 212,
|
||||
>NamedImports : SyntaxKind
|
||||
|
||||
ImportSpecifier = 210,
|
||||
ImportSpecifier = 213,
|
||||
>ImportSpecifier : SyntaxKind
|
||||
|
||||
ExportAssignment = 211,
|
||||
ExportAssignment = 214,
|
||||
>ExportAssignment : SyntaxKind
|
||||
|
||||
ExportDeclaration = 212,
|
||||
ExportDeclaration = 215,
|
||||
>ExportDeclaration : SyntaxKind
|
||||
|
||||
NamedExports = 213,
|
||||
NamedExports = 216,
|
||||
>NamedExports : SyntaxKind
|
||||
|
||||
ExportSpecifier = 214,
|
||||
ExportSpecifier = 217,
|
||||
>ExportSpecifier : SyntaxKind
|
||||
|
||||
MissingDeclaration = 215,
|
||||
MissingDeclaration = 218,
|
||||
>MissingDeclaration : SyntaxKind
|
||||
|
||||
ExternalModuleReference = 216,
|
||||
ExternalModuleReference = 219,
|
||||
>ExternalModuleReference : SyntaxKind
|
||||
|
||||
CaseClause = 217,
|
||||
CaseClause = 220,
|
||||
>CaseClause : SyntaxKind
|
||||
|
||||
DefaultClause = 218,
|
||||
DefaultClause = 221,
|
||||
>DefaultClause : SyntaxKind
|
||||
|
||||
HeritageClause = 219,
|
||||
HeritageClause = 222,
|
||||
>HeritageClause : SyntaxKind
|
||||
|
||||
CatchClause = 220,
|
||||
CatchClause = 223,
|
||||
>CatchClause : SyntaxKind
|
||||
|
||||
PropertyAssignment = 221,
|
||||
PropertyAssignment = 224,
|
||||
>PropertyAssignment : SyntaxKind
|
||||
|
||||
ShorthandPropertyAssignment = 222,
|
||||
ShorthandPropertyAssignment = 225,
|
||||
>ShorthandPropertyAssignment : SyntaxKind
|
||||
|
||||
EnumMember = 223,
|
||||
EnumMember = 226,
|
||||
>EnumMember : SyntaxKind
|
||||
|
||||
SourceFile = 224,
|
||||
SourceFile = 227,
|
||||
>SourceFile : SyntaxKind
|
||||
|
||||
SyntaxList = 225,
|
||||
SyntaxList = 228,
|
||||
>SyntaxList : SyntaxKind
|
||||
|
||||
Count = 226,
|
||||
Count = 229,
|
||||
>Count : SyntaxKind
|
||||
|
||||
FirstAssignment = 53,
|
||||
@@ -1699,6 +1708,13 @@ declare module "typescript" {
|
||||
body?: Block;
|
||||
>body : Block
|
||||
>Block : Block
|
||||
}
|
||||
interface SemicolonClassElement extends ClassElement {
|
||||
>SemicolonClassElement : SemicolonClassElement
|
||||
>ClassElement : ClassElement
|
||||
|
||||
_semicolonClassElementBrand: any;
|
||||
>_semicolonClassElementBrand : any
|
||||
}
|
||||
interface AccessorDeclaration extends FunctionLikeDeclaration, ClassElement, ObjectLiteralElement {
|
||||
>AccessorDeclaration : AccessorDeclaration
|
||||
@@ -2100,6 +2116,19 @@ declare module "typescript" {
|
||||
>arguments : NodeArray<Expression>
|
||||
>NodeArray : NodeArray<T>
|
||||
>Expression : Expression
|
||||
}
|
||||
interface HeritageClauseElement extends Node {
|
||||
>HeritageClauseElement : HeritageClauseElement
|
||||
>Node : Node
|
||||
|
||||
expression: LeftHandSideExpression;
|
||||
>expression : LeftHandSideExpression
|
||||
>LeftHandSideExpression : LeftHandSideExpression
|
||||
|
||||
typeArguments?: NodeArray<TypeNode>;
|
||||
>typeArguments : NodeArray<TypeNode>
|
||||
>NodeArray : NodeArray<T>
|
||||
>TypeNode : TypeNode
|
||||
}
|
||||
interface NewExpression extends CallExpression, PrimaryExpression {
|
||||
>NewExpression : NewExpression
|
||||
@@ -2384,10 +2413,9 @@ declare module "typescript" {
|
||||
_moduleElementBrand: any;
|
||||
>_moduleElementBrand : any
|
||||
}
|
||||
interface ClassDeclaration extends Declaration, ModuleElement {
|
||||
>ClassDeclaration : ClassDeclaration
|
||||
interface ClassLikeDeclaration extends Declaration {
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>Declaration : Declaration
|
||||
>ModuleElement : ModuleElement
|
||||
|
||||
name?: Identifier;
|
||||
>name : Identifier
|
||||
@@ -2407,6 +2435,16 @@ declare module "typescript" {
|
||||
>members : NodeArray<ClassElement>
|
||||
>NodeArray : NodeArray<T>
|
||||
>ClassElement : ClassElement
|
||||
}
|
||||
interface ClassDeclaration extends ClassLikeDeclaration, Statement {
|
||||
>ClassDeclaration : ClassDeclaration
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>Statement : Statement
|
||||
}
|
||||
interface ClassExpression extends ClassLikeDeclaration, PrimaryExpression {
|
||||
>ClassExpression : ClassExpression
|
||||
>ClassLikeDeclaration : ClassLikeDeclaration
|
||||
>PrimaryExpression : PrimaryExpression
|
||||
}
|
||||
interface ClassElement extends Declaration {
|
||||
>ClassElement : ClassElement
|
||||
@@ -2447,10 +2485,10 @@ declare module "typescript" {
|
||||
>token : SyntaxKind
|
||||
>SyntaxKind : SyntaxKind
|
||||
|
||||
types?: NodeArray<TypeReferenceNode>;
|
||||
>types : NodeArray<TypeReferenceNode>
|
||||
types?: NodeArray<HeritageClauseElement>;
|
||||
>types : NodeArray<HeritageClauseElement>
|
||||
>NodeArray : NodeArray<T>
|
||||
>TypeReferenceNode : TypeReferenceNode
|
||||
>HeritageClauseElement : HeritageClauseElement
|
||||
}
|
||||
interface TypeAliasDeclaration extends Declaration, ModuleElement {
|
||||
>TypeAliasDeclaration : TypeAliasDeclaration
|
||||
@@ -2538,9 +2576,8 @@ declare module "typescript" {
|
||||
>expression : Expression
|
||||
>Expression : Expression
|
||||
}
|
||||
interface ImportDeclaration extends Statement, ModuleElement {
|
||||
interface ImportDeclaration extends ModuleElement {
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
>Statement : Statement
|
||||
>ModuleElement : ModuleElement
|
||||
|
||||
importClause?: ImportClause;
|
||||
@@ -3049,10 +3086,10 @@ declare module "typescript" {
|
||||
>Symbol : Symbol
|
||||
>Symbol : Symbol
|
||||
|
||||
getExportsOfExternalModule(node: ImportDeclaration): Symbol[];
|
||||
>getExportsOfExternalModule : (node: ImportDeclaration) => Symbol[]
|
||||
>node : ImportDeclaration
|
||||
>ImportDeclaration : ImportDeclaration
|
||||
getExportsOfModule(moduleSymbol: Symbol): Symbol[];
|
||||
>getExportsOfModule : (moduleSymbol: Symbol) => Symbol[]
|
||||
>moduleSymbol : Symbol
|
||||
>Symbol : Symbol
|
||||
>Symbol : Symbol
|
||||
}
|
||||
interface SymbolDisplayBuilder {
|
||||
@@ -3394,10 +3431,11 @@ declare module "typescript" {
|
||||
>SymbolFlags : SymbolFlags
|
||||
>SymbolAccessiblityResult : SymbolAccessiblityResult
|
||||
|
||||
isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
>isEntityNameVisible : (entityName: Identifier | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult
|
||||
>entityName : Identifier | QualifiedName
|
||||
isEntityNameVisible(entityName: EntityName | Expression, enclosingDeclaration: Node): SymbolVisibilityResult;
|
||||
>isEntityNameVisible : (entityName: Identifier | Expression | QualifiedName, enclosingDeclaration: Node) => SymbolVisibilityResult
|
||||
>entityName : Identifier | Expression | QualifiedName
|
||||
>EntityName : Identifier | QualifiedName
|
||||
>Expression : Expression
|
||||
>enclosingDeclaration : Node
|
||||
>Node : Node
|
||||
>SymbolVisibilityResult : SymbolVisibilityResult
|
||||
@@ -5068,6 +5106,27 @@ declare module "typescript" {
|
||||
>CompilerHost : CompilerHost
|
||||
>Program : Program
|
||||
}
|
||||
declare module "typescript" {
|
||||
/**
|
||||
* Read tsconfig.json file
|
||||
* @param fileName The path to the config file
|
||||
*/
|
||||
function readConfigFile(fileName: string): any;
|
||||
>readConfigFile : (fileName: string) => any
|
||||
>fileName : string
|
||||
|
||||
/**
|
||||
* 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;
|
||||
>parseConfigFile : (json: any, basePath?: string) => ParsedCommandLine
|
||||
>json : any
|
||||
>basePath : string
|
||||
>ParsedCommandLine : ParsedCommandLine
|
||||
}
|
||||
declare module "typescript" {
|
||||
/** The version of the language service API */
|
||||
let servicesVersion: string;
|
||||
@@ -5967,6 +6026,9 @@ declare module "typescript" {
|
||||
|
||||
kindModifiers: string;
|
||||
>kindModifiers : string
|
||||
|
||||
sortText: string;
|
||||
>sortText : string
|
||||
}
|
||||
interface CompletionEntryDetails {
|
||||
>CompletionEntryDetails : CompletionEntryDetails
|
||||
@@ -6236,6 +6298,9 @@ declare module "typescript" {
|
||||
static unknown: string;
|
||||
>unknown : string
|
||||
|
||||
static warning: string;
|
||||
>warning : string
|
||||
|
||||
static keyword: string;
|
||||
>keyword : string
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ import Backbone = require("aliasUsage1_backbone");
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : VisualizationModel
|
||||
>Backbone : unknown
|
||||
>Backbone : typeof Backbone
|
||||
>Model : Backbone.Model
|
||||
|
||||
// interesting stuff here
|
||||
|
||||
@@ -40,7 +40,7 @@ import Backbone = require("aliasUsageInArray_backbone");
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : VisualizationModel
|
||||
>Backbone : unknown
|
||||
>Backbone : typeof Backbone
|
||||
>Model : Backbone.Model
|
||||
|
||||
// interesting stuff here
|
||||
|
||||
@@ -41,7 +41,7 @@ import Backbone = require("aliasUsageInFunctionExpression_backbone");
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : VisualizationModel
|
||||
>Backbone : unknown
|
||||
>Backbone : typeof Backbone
|
||||
>Model : Backbone.Model
|
||||
|
||||
// interesting stuff here
|
||||
|
||||
@@ -55,7 +55,7 @@ import Backbone = require("aliasUsageInGenericFunction_backbone");
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : VisualizationModel
|
||||
>Backbone : unknown
|
||||
>Backbone : typeof Backbone
|
||||
>Model : Backbone.Model
|
||||
|
||||
// interesting stuff here
|
||||
|
||||
@@ -49,7 +49,7 @@ import Backbone = require("aliasUsageInIndexerOfClass_backbone");
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : VisualizationModel
|
||||
>Backbone : unknown
|
||||
>Backbone : typeof Backbone
|
||||
>Model : Backbone.Model
|
||||
|
||||
// interesting stuff here
|
||||
|
||||
@@ -54,7 +54,7 @@ import Backbone = require("aliasUsageInObjectLiteral_backbone");
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : VisualizationModel
|
||||
>Backbone : unknown
|
||||
>Backbone : typeof Backbone
|
||||
>Model : Backbone.Model
|
||||
|
||||
// interesting stuff here
|
||||
|
||||
@@ -75,7 +75,7 @@ import Backbone = require("aliasUsageInOrExpression_backbone");
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : VisualizationModel
|
||||
>Backbone : unknown
|
||||
>Backbone : typeof Backbone
|
||||
>Model : Backbone.Model
|
||||
|
||||
// interesting stuff here
|
||||
|
||||
@@ -75,7 +75,7 @@ import Backbone = require("aliasUsageInOrExpression_backbone");
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : VisualizationModel
|
||||
>Backbone : unknown
|
||||
>Backbone : typeof Backbone
|
||||
>Model : Backbone.Model
|
||||
|
||||
// interesting stuff here
|
||||
|
||||
@@ -45,7 +45,7 @@ import Backbone = require("aliasUsageInTypeArgumentOfExtendsClause_backbone");
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : VisualizationModel
|
||||
>Backbone : unknown
|
||||
>Backbone : typeof Backbone
|
||||
>Model : Backbone.Model
|
||||
|
||||
// interesting stuff here
|
||||
|
||||
@@ -36,7 +36,7 @@ import Backbone = require("aliasUsageInVarAssignment_backbone");
|
||||
|
||||
export class VisualizationModel extends Backbone.Model {
|
||||
>VisualizationModel : VisualizationModel
|
||||
>Backbone : unknown
|
||||
>Backbone : typeof Backbone
|
||||
>Model : Backbone.Model
|
||||
|
||||
// interesting stuff here
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/compiler/anonymousClassExpression1.ts(2,19): error TS9003: 'class' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/compiler/anonymousClassExpression1.ts (1 errors) ====
|
||||
function f() {
|
||||
return typeof class {} === "function";
|
||||
~~~~~
|
||||
!!! error TS9003: 'class' expressions are not currently supported.
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [anonymousClassExpression1.ts]
|
||||
function f() {
|
||||
return typeof class {} === "function";
|
||||
}
|
||||
|
||||
//// [anonymousClassExpression1.js]
|
||||
function f() {
|
||||
return typeof (function () {
|
||||
function default_1() {
|
||||
}
|
||||
return default_1;
|
||||
})() === "function";
|
||||
}
|
||||
@@ -10,7 +10,7 @@ module B {
|
||||
|
||||
export class D extends a.C {
|
||||
>D : D
|
||||
>a : unknown
|
||||
>a : typeof a
|
||||
>C : a.C
|
||||
|
||||
id: number;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
tests/cases/compiler/classDeclarationBlockScoping1.ts(5,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
|
||||
|
||||
|
||||
==== tests/cases/compiler/classDeclarationBlockScoping1.ts (1 errors) ====
|
||||
class C {
|
||||
}
|
||||
|
||||
{
|
||||
class C {
|
||||
~
|
||||
!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//// [classDeclarationBlockScoping1.ts]
|
||||
class C {
|
||||
}
|
||||
|
||||
{
|
||||
class C {
|
||||
}
|
||||
}
|
||||
|
||||
//// [classDeclarationBlockScoping1.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
{
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
tests/cases/compiler/classDeclarationBlockScoping2.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
|
||||
tests/cases/compiler/classDeclarationBlockScoping2.ts(5,15): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
|
||||
|
||||
|
||||
==== tests/cases/compiler/classDeclarationBlockScoping2.ts (2 errors) ====
|
||||
function f() {
|
||||
class C {}
|
||||
~
|
||||
!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
|
||||
var c1 = C;
|
||||
{
|
||||
class C {}
|
||||
~
|
||||
!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
|
||||
var c2 = C;
|
||||
}
|
||||
return C === c1;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
//// [classDeclarationBlockScoping2.ts]
|
||||
function f() {
|
||||
class C {}
|
||||
var c1 = C;
|
||||
{
|
||||
class C {}
|
||||
var c2 = C;
|
||||
}
|
||||
return C === c1;
|
||||
}
|
||||
|
||||
//// [classDeclarationBlockScoping2.js]
|
||||
function f() {
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
var c1 = C;
|
||||
{
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
var c2 = C;
|
||||
}
|
||||
return C === c1;
|
||||
}
|
||||
@@ -18,7 +18,7 @@ module M {
|
||||
|
||||
export class O extends M.N {
|
||||
>O : O
|
||||
>M : unknown
|
||||
>M : typeof M
|
||||
>N : N
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,24 @@
|
||||
tests/cases/conformance/classes/classExpression.ts(1,9): error TS1109: Expression expected.
|
||||
tests/cases/conformance/classes/classExpression.ts(5,10): error TS1109: Expression expected.
|
||||
tests/cases/conformance/classes/classExpression.ts(5,16): error TS1005: ':' expected.
|
||||
tests/cases/conformance/classes/classExpression.ts(5,16): error TS2304: Cannot find name 'C2'.
|
||||
tests/cases/conformance/classes/classExpression.ts(5,19): error TS1005: ',' expected.
|
||||
tests/cases/conformance/classes/classExpression.ts(7,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/classes/classExpression.ts(10,13): error TS1109: Expression expected.
|
||||
tests/cases/conformance/classes/classExpression.ts(1,15): error TS9003: 'class' expressions are not currently supported.
|
||||
tests/cases/conformance/classes/classExpression.ts(5,16): error TS9003: 'class' expressions are not currently supported.
|
||||
tests/cases/conformance/classes/classExpression.ts(10,19): error TS9003: 'class' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classExpression.ts (7 errors) ====
|
||||
==== tests/cases/conformance/classes/classExpression.ts (3 errors) ====
|
||||
var x = class C {
|
||||
~~~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
~
|
||||
!!! error TS9003: 'class' expressions are not currently supported.
|
||||
}
|
||||
|
||||
var y = {
|
||||
foo: class C2 {
|
||||
~~~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS1005: ':' expected.
|
||||
~~
|
||||
!!! error TS2304: Cannot find name 'C2'.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
!!! error TS9003: 'class' expressions are not currently supported.
|
||||
}
|
||||
}
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
|
||||
module M {
|
||||
var z = class C4 {
|
||||
~~~~~
|
||||
!!! error TS1109: Expression expected.
|
||||
~~
|
||||
!!! error TS9003: 'class' expressions are not currently supported.
|
||||
}
|
||||
}
|
||||
@@ -13,18 +13,21 @@ module M {
|
||||
}
|
||||
|
||||
//// [classExpression.js]
|
||||
var x = ;
|
||||
var C = (function () {
|
||||
var x = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
var y = {
|
||||
foo: , class: C2 }, _a = void 0;
|
||||
foo: (function () {
|
||||
function C2() {
|
||||
}
|
||||
return C2;
|
||||
})()
|
||||
};
|
||||
var M;
|
||||
(function (M) {
|
||||
var z = ;
|
||||
var C4 = (function () {
|
||||
var z = (function () {
|
||||
function C4() {
|
||||
}
|
||||
return C4;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/classes/classExpressions/classExpression1.ts(1,15): error TS9003: 'class' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classExpressions/classExpression1.ts (1 errors) ====
|
||||
var v = class C {};
|
||||
~
|
||||
!!! error TS9003: 'class' expressions are not currently supported.
|
||||
@@ -0,0 +1,9 @@
|
||||
//// [classExpression1.ts]
|
||||
var v = class C {};
|
||||
|
||||
//// [classExpression1.js]
|
||||
var v = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/classes/classExpressions/classExpression2.ts(2,15): error TS9003: 'class' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classExpressions/classExpression2.ts (1 errors) ====
|
||||
class D { }
|
||||
var v = class C extends D {};
|
||||
~
|
||||
!!! error TS9003: 'class' expressions are not currently supported.
|
||||
@@ -0,0 +1,17 @@
|
||||
//// [classExpression2.ts]
|
||||
class D { }
|
||||
var v = class C extends D {};
|
||||
|
||||
//// [classExpression2.js]
|
||||
var D = (function () {
|
||||
function D() {
|
||||
}
|
||||
return D;
|
||||
})();
|
||||
var v = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return C;
|
||||
})(D);
|
||||
@@ -0,0 +1,7 @@
|
||||
tests/cases/conformance/es6/classExpressions/classExpressionES61.ts(1,15): error TS9003: 'class' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/classExpressions/classExpressionES61.ts (1 errors) ====
|
||||
var v = class C {};
|
||||
~
|
||||
!!! error TS9003: 'class' expressions are not currently supported.
|
||||
@@ -0,0 +1,7 @@
|
||||
//// [classExpressionES61.ts]
|
||||
var v = class C {};
|
||||
|
||||
//// [classExpressionES61.js]
|
||||
var v = class C {
|
||||
}
|
||||
;
|
||||
@@ -0,0 +1,8 @@
|
||||
tests/cases/conformance/es6/classExpressions/classExpressionES62.ts(2,15): error TS9003: 'class' expressions are not currently supported.
|
||||
|
||||
|
||||
==== tests/cases/conformance/es6/classExpressions/classExpressionES62.ts (1 errors) ====
|
||||
class D { }
|
||||
var v = class C extends D {};
|
||||
~
|
||||
!!! error TS9003: 'class' expressions are not currently supported.
|
||||
@@ -0,0 +1,10 @@
|
||||
//// [classExpressionES62.ts]
|
||||
class D { }
|
||||
var v = class C extends D {};
|
||||
|
||||
//// [classExpressionES62.js]
|
||||
class D {
|
||||
}
|
||||
var v = class C extends D {
|
||||
}
|
||||
;
|
||||
@@ -0,0 +1,18 @@
|
||||
tests/cases/compiler/classExpressionTest1.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
|
||||
|
||||
|
||||
==== tests/cases/compiler/classExpressionTest1.ts (1 errors) ====
|
||||
function M() {
|
||||
class C<X> {
|
||||
~
|
||||
!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
|
||||
f<T>() {
|
||||
var t: T;
|
||||
var x: X;
|
||||
return { t, x };
|
||||
}
|
||||
}
|
||||
|
||||
var v = new C<number>();
|
||||
return v.f<string>();
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
//// [classExpressionTest1.ts]
|
||||
function M() {
|
||||
class C<X> {
|
||||
f<T>() {
|
||||
var t: T;
|
||||
var x: X;
|
||||
return { t, x };
|
||||
}
|
||||
}
|
||||
|
||||
var v = new C<number>();
|
||||
return v.f<string>();
|
||||
}
|
||||
|
||||
//// [classExpressionTest1.js]
|
||||
function M() {
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.f = function () {
|
||||
var t;
|
||||
var x;
|
||||
return { t: t, x: x };
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
var v = new C();
|
||||
return v.f();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
tests/cases/compiler/classExpressionTest2.ts(2,19): error TS9003: 'class' expressions are not currently supported.
|
||||
tests/cases/compiler/classExpressionTest2.ts(5,20): error TS2304: Cannot find name 'X'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/classExpressionTest2.ts (2 errors) ====
|
||||
function M() {
|
||||
var m = class C<X> {
|
||||
~
|
||||
!!! error TS9003: 'class' expressions are not currently supported.
|
||||
f<T>() {
|
||||
var t: T;
|
||||
var x: X;
|
||||
~
|
||||
!!! error TS2304: Cannot find name 'X'.
|
||||
return { t, x };
|
||||
}
|
||||
}
|
||||
|
||||
var v = new m<number>();
|
||||
return v.f<string>();
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
//// [classExpressionTest2.ts]
|
||||
function M() {
|
||||
var m = class C<X> {
|
||||
f<T>() {
|
||||
var t: T;
|
||||
var x: X;
|
||||
return { t, x };
|
||||
}
|
||||
}
|
||||
|
||||
var v = new m<number>();
|
||||
return v.f<string>();
|
||||
}
|
||||
|
||||
//// [classExpressionTest2.js]
|
||||
function M() {
|
||||
var m = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.f = function () {
|
||||
var t;
|
||||
var x;
|
||||
return { t: t, x: x };
|
||||
};
|
||||
return C;
|
||||
})();
|
||||
var v = new m();
|
||||
return v.f();
|
||||
}
|
||||
@@ -2,16 +2,15 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(4,18): error TS2304: Cannot find name 'string'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(5,18): error TS2304: Cannot find name 'boolean'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(6,18): error TS2304: Cannot find name 'Void'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(7,19): error TS1133: Type reference expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(7,19): error TS1109: Expression expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(8,18): error TS2304: Cannot find name 'Null'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,19): error TS1133: Type reference expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,24): error TS1005: ';' expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(9,19): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(10,18): error TS2304: Cannot find name 'undefined'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(11,18): error TS2304: Cannot find name 'Undefined'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts(14,18): error TS2311: A class may only extend another class.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts (11 errors) ====
|
||||
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive.ts (10 errors) ====
|
||||
// classes cannot extend primitives
|
||||
|
||||
class C extends number { }
|
||||
@@ -28,15 +27,13 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla
|
||||
!!! error TS2304: Cannot find name 'Void'.
|
||||
class C4a extends void {}
|
||||
~~~~
|
||||
!!! error TS1133: Type reference expected.
|
||||
!!! error TS1109: Expression expected.
|
||||
class C5 extends Null { }
|
||||
~~~~
|
||||
!!! error TS2304: Cannot find name 'Null'.
|
||||
class C5a extends null { }
|
||||
~~~~
|
||||
!!! error TS1133: Type reference expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
|
||||
class C6 extends undefined { }
|
||||
~~~~~~~~~
|
||||
!!! error TS2304: Cannot find name 'undefined'.
|
||||
|
||||
@@ -63,13 +63,13 @@ var C5 = (function (_super) {
|
||||
}
|
||||
return C5;
|
||||
})(Null);
|
||||
var C5a = (function () {
|
||||
var C5a = (function (_super) {
|
||||
__extends(C5a, _super);
|
||||
function C5a() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return C5a;
|
||||
})();
|
||||
null;
|
||||
{ }
|
||||
})(null);
|
||||
var C6 = (function (_super) {
|
||||
__extends(C6, _super);
|
||||
function C6() {
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(3,19): error TS1133: Type reference expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(4,19): error TS1133: Type reference expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(4,24): error TS1005: ';' expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(3,19): error TS1109: Expression expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts(4,19): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts (3 errors) ====
|
||||
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendingPrimitive2.ts (2 errors) ====
|
||||
// classes cannot extend primitives
|
||||
|
||||
class C4a extends void {}
|
||||
~~~~
|
||||
!!! error TS1133: Type reference expected.
|
||||
!!! error TS1109: Expression expected.
|
||||
class C5a extends null { }
|
||||
~~~~
|
||||
!!! error TS1133: Type reference expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
|
||||
@@ -6,16 +6,22 @@ class C5a extends null { }
|
||||
|
||||
//// [classExtendingPrimitive2.js]
|
||||
// classes cannot extend primitives
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var C4a = (function () {
|
||||
function C4a() {
|
||||
}
|
||||
return C4a;
|
||||
})();
|
||||
void {};
|
||||
var C5a = (function () {
|
||||
var C5a = (function (_super) {
|
||||
__extends(C5a, _super);
|
||||
function C5a() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return C5a;
|
||||
})();
|
||||
null;
|
||||
{ }
|
||||
})(null);
|
||||
|
||||
@@ -8,7 +8,7 @@ module M {
|
||||
|
||||
class D extends M.C {
|
||||
>D : D
|
||||
>M : unknown
|
||||
>M : typeof M
|
||||
>C : C
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(4,17): error TS2311: A class may only extend another class.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(6,18): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(6,31): error TS1005: ',' expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(8,18): error TS2304: Cannot find name 'x'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(11,18): error TS2304: Cannot find name 'M'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(14,18): error TS2304: Cannot find name 'foo'.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,18): error TS1133: Type reference expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,20): error TS1005: ';' expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts(16,18): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts (6 errors) ====
|
||||
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType.ts (7 errors) ====
|
||||
interface I {
|
||||
foo: string;
|
||||
}
|
||||
@@ -15,6 +16,10 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla
|
||||
!!! error TS2311: A class may only extend another class.
|
||||
|
||||
class C2 extends { foo: string; } { } // error
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
var x: { foo: string; }
|
||||
class C3 extends x { } // error
|
||||
~
|
||||
@@ -31,7 +36,5 @@ tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/cla
|
||||
!!! error TS2304: Cannot find name 'foo'.
|
||||
|
||||
class C6 extends []{ } // error
|
||||
~
|
||||
!!! error TS1133: Type reference expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~
|
||||
!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
|
||||
@@ -30,12 +30,13 @@ var C = (function (_super) {
|
||||
}
|
||||
return C;
|
||||
})(I); // error
|
||||
var C2 = (function () {
|
||||
var C2 = (function (_super) {
|
||||
__extends(C2, _super);
|
||||
function C2() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return C2;
|
||||
})();
|
||||
{ } // error
|
||||
})({ foo: string }); // error
|
||||
var x;
|
||||
var C3 = (function (_super) {
|
||||
__extends(C3, _super);
|
||||
@@ -63,10 +64,10 @@ var C5 = (function (_super) {
|
||||
}
|
||||
return C5;
|
||||
})(foo); // error
|
||||
var C6 = (function () {
|
||||
var C6 = (function (_super) {
|
||||
__extends(C6, _super);
|
||||
function C6() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return C6;
|
||||
})();
|
||||
[];
|
||||
{ } // error
|
||||
})([]); // error
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(3,18): error TS1133: Type reference expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(3,20): error TS1005: ';' expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(1,18): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(1,31): error TS1005: ',' expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts(3,18): error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts (2 errors) ====
|
||||
==== tests/cases/conformance/classes/classDeclarations/classHeritageSpecification/classExtendsEveryObjectType2.ts (3 errors) ====
|
||||
class C2 extends { foo: string; } { } // error
|
||||
~~~~~~~~~~~~~~~~
|
||||
!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
|
||||
~
|
||||
!!! error TS1005: ',' expected.
|
||||
|
||||
class C6 extends []{ } // error
|
||||
~
|
||||
!!! error TS1133: Type reference expected.
|
||||
~
|
||||
!!! error TS1005: ';' expected.
|
||||
~~
|
||||
!!! error TS9002: Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clauses.
|
||||
@@ -4,16 +4,23 @@ class C2 extends { foo: string; } { } // error
|
||||
class C6 extends []{ } // error
|
||||
|
||||
//// [classExtendsEveryObjectType2.js]
|
||||
var C2 = (function () {
|
||||
var __extends = this.__extends || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
__.prototype = b.prototype;
|
||||
d.prototype = new __();
|
||||
};
|
||||
var C2 = (function (_super) {
|
||||
__extends(C2, _super);
|
||||
function C2() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return C2;
|
||||
})();
|
||||
{ } // error
|
||||
var C6 = (function () {
|
||||
})({ foo: string }); // error
|
||||
var C6 = (function (_super) {
|
||||
__extends(C6, _super);
|
||||
function C6() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return C6;
|
||||
})();
|
||||
[];
|
||||
{ } // error
|
||||
})([]); // error
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts(2,11): error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classInsideBlock.ts (1 errors) ====
|
||||
function foo() {
|
||||
class C { }
|
||||
~
|
||||
!!! error TS9004: 'class' declarations are only supported directly inside a module or as a top level declaration.
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
//// [classInsideBlock.ts]
|
||||
function foo() {
|
||||
class C { }
|
||||
}
|
||||
|
||||
//// [classInsideBlock.js]
|
||||
function foo() {
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames2.ts(3,7): error TS1003: Identifier expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames2.ts(3,7): error TS1005: '{' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsNames2.ts (1 errors) ====
|
||||
@@ -6,4 +6,4 @@ tests/cases/conformance/classes/classDeclarations/classWithPredefinedTypesAsName
|
||||
|
||||
class void {}
|
||||
~~~~
|
||||
!!! error TS1003: Identifier expected.
|
||||
!!! error TS1005: '{' expected.
|
||||
@@ -5,9 +5,9 @@ class void {}
|
||||
|
||||
//// [classWithPredefinedTypesAsNames2.js]
|
||||
// classes cannot use predefined types as names
|
||||
var = (function () {
|
||||
function () {
|
||||
var default_1 = (function () {
|
||||
function default_1() {
|
||||
}
|
||||
return ;
|
||||
return default_1;
|
||||
})();
|
||||
void {};
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
//// [classWithSemicolonClassElement1.ts]
|
||||
class C {
|
||||
;
|
||||
}
|
||||
|
||||
//// [classWithSemicolonClassElement1.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
;
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement1.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
//// [classWithSemicolonClassElement2.ts]
|
||||
class C {
|
||||
;
|
||||
;
|
||||
}
|
||||
|
||||
//// [classWithSemicolonClassElement2.js]
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
;
|
||||
;
|
||||
return C;
|
||||
})();
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/conformance/classes/classDeclarations/classWithSemicolonClassElement2.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
;
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
//// [classWithSemicolonClassElementES61.ts]
|
||||
class C {
|
||||
;
|
||||
}
|
||||
|
||||
//// [classWithSemicolonClassElementES61.js]
|
||||
class C {
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
=== tests/cases/conformance/es6/classDeclaration/classWithSemicolonClassElementES61.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
//// [classWithSemicolonClassElementES62.ts]
|
||||
class C {
|
||||
;
|
||||
;
|
||||
}
|
||||
|
||||
//// [classWithSemicolonClassElementES62.js]
|
||||
class C {
|
||||
;
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
=== tests/cases/conformance/es6/classDeclaration/classWithSemicolonClassElementES62.ts ===
|
||||
class C {
|
||||
>C : C
|
||||
|
||||
;
|
||||
;
|
||||
}
|
||||
@@ -5,7 +5,7 @@ declare module E {
|
||||
|
||||
class foobar extends D.bar {
|
||||
>foobar : foobar
|
||||
>D : unknown
|
||||
>D : typeof D
|
||||
>bar : D.bar
|
||||
|
||||
foo();
|
||||
|
||||
@@ -147,14 +147,14 @@ export var g = C.F5<C.A<C.B>>();
|
||||
|
||||
export class h extends C.A<C.B>{ }
|
||||
>h : h
|
||||
>C : unknown
|
||||
>C : typeof C
|
||||
>A : C.A<T>
|
||||
>C : unknown
|
||||
>B : C.B
|
||||
|
||||
export interface i extends C.A<C.B> { }
|
||||
>i : i
|
||||
>C : unknown
|
||||
>C : typeof C
|
||||
>A : C.A<T>
|
||||
>C : unknown
|
||||
>B : C.B
|
||||
|
||||
@@ -30,7 +30,7 @@ declare module templa.mvc {
|
||||
>templa : unknown
|
||||
>mvc : unknown
|
||||
>IModel : IModel
|
||||
>mvc : unknown
|
||||
>mvc : typeof mvc
|
||||
>IController : IController<ModelType>
|
||||
>ModelType : ModelType
|
||||
}
|
||||
@@ -42,7 +42,7 @@ declare module templa.mvc.composite {
|
||||
|
||||
interface ICompositeControllerModel extends mvc.IModel {
|
||||
>ICompositeControllerModel : ICompositeControllerModel
|
||||
>mvc : unknown
|
||||
>mvc : typeof mvc
|
||||
>IModel : IModel
|
||||
|
||||
getControllers(): mvc.IController<mvc.IModel>[];
|
||||
@@ -64,8 +64,8 @@ module templa.dom.mvc {
|
||||
>templa : unknown
|
||||
>mvc : unknown
|
||||
>IModel : templa.mvc.IModel
|
||||
>templa : unknown
|
||||
>mvc : unknown
|
||||
>templa : typeof templa
|
||||
>mvc : typeof templa.mvc
|
||||
>IController : templa.mvc.IController<ModelType>
|
||||
>ModelType : ModelType
|
||||
}
|
||||
@@ -82,8 +82,8 @@ module templa.dom.mvc {
|
||||
>templa : unknown
|
||||
>mvc : unknown
|
||||
>IModel : templa.mvc.IModel
|
||||
>templa : unknown
|
||||
>mvc : unknown
|
||||
>templa : typeof templa
|
||||
>mvc : typeof templa.mvc
|
||||
>AbstractController : templa.mvc.AbstractController<ModelType>
|
||||
>ModelType : ModelType
|
||||
>IElementController : IElementController<ModelType>
|
||||
@@ -110,9 +110,9 @@ module templa.dom.mvc.composite {
|
||||
>mvc : unknown
|
||||
>composite : unknown
|
||||
>ICompositeControllerModel : templa.mvc.composite.ICompositeControllerModel
|
||||
>templa : unknown
|
||||
>dom : unknown
|
||||
>mvc : unknown
|
||||
>templa : typeof templa
|
||||
>dom : typeof dom
|
||||
>mvc : typeof mvc
|
||||
>AbstractElementController : AbstractElementController<ModelType>
|
||||
>ModelType : ModelType
|
||||
|
||||
|
||||
@@ -42,23 +42,23 @@ module m2 {
|
||||
|
||||
}
|
||||
var m2: {
|
||||
>m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; }
|
||||
>m2 : { (): m2.connectExport; test1: m2.connectModule; test2(): m2.connectModule; }
|
||||
|
||||
(): m2.connectExport;
|
||||
>m2 : unknown
|
||||
>connectExport : export=.connectExport
|
||||
>connectExport : m2.connectExport
|
||||
|
||||
test1: m2.connectModule;
|
||||
>test1 : export=.connectModule
|
||||
>test1 : m2.connectModule
|
||||
>m2 : unknown
|
||||
>connectModule : export=.connectModule
|
||||
>connectModule : m2.connectModule
|
||||
|
||||
test2(): m2.connectModule;
|
||||
>test2 : () => export=.connectModule
|
||||
>test2 : () => m2.connectModule
|
||||
>m2 : unknown
|
||||
>connectModule : export=.connectModule
|
||||
>connectModule : m2.connectModule
|
||||
|
||||
};
|
||||
export = m2;
|
||||
>m2 : { (): export=.connectExport; test1: export=.connectModule; test2(): export=.connectModule; }
|
||||
>m2 : { (): m2.connectExport; test1: m2.connectModule; test2(): m2.connectModule; }
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ module A.B.C {
|
||||
|
||||
export class W implements A.C.Z {
|
||||
>W : W
|
||||
>A : unknown
|
||||
>A : typeof A
|
||||
>C : unknown
|
||||
>Z : A.C.Z
|
||||
}
|
||||
|
||||
+6
-6
@@ -19,9 +19,9 @@ module X.Y.base {
|
||||
|
||||
export class W extends A.B.Base.W {
|
||||
>W : W
|
||||
>A : unknown
|
||||
>B : unknown
|
||||
>Base : unknown
|
||||
>A : typeof A
|
||||
>B : typeof A.B
|
||||
>Base : typeof A.B.Base
|
||||
>W : A.B.Base.W
|
||||
|
||||
name: string;
|
||||
@@ -38,9 +38,9 @@ module X.Y.base.Z {
|
||||
export class W<TValue> extends X.Y.base.W {
|
||||
>W : W<TValue>
|
||||
>TValue : TValue
|
||||
>X : unknown
|
||||
>Y : unknown
|
||||
>base : unknown
|
||||
>X : typeof X
|
||||
>Y : typeof Y
|
||||
>base : typeof base
|
||||
>W : base.W
|
||||
|
||||
value: boolean;
|
||||
|
||||
+2
-2
@@ -20,8 +20,8 @@ module X.A.B.C {
|
||||
}
|
||||
export class W implements X.A.C.Z { // This needs to be refered as X.A.C.Z as A has conflict
|
||||
>W : W
|
||||
>X : unknown
|
||||
>A : unknown
|
||||
>X : typeof X
|
||||
>A : typeof A
|
||||
>C : unknown
|
||||
>Z : X.A.C.Z
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user